Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/application_delete.php
<?php   
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /**
    @version $Id: application_delete.php,v 1.8 2004/04/03 16:15:48 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */
	  
	// execute init file
	require_once 'inc/init.php';
	
    /***************************************************************************   
    * INSTALLER FRAMEWORK FUNCTIONS                                            *   
    ***************************************************************************/   
	
	function zi_process()
	{
        global $zi_registry;
        
        if($application = $zi_registry->getApplication()){
            //if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != 'dev'){
                $application_settings = $zi_registry->getApplicationSettings($application['name'].'-'.$application['release']['version']);
                
                if(isset($application_settings["application_root"]) && strlen($application_settings["application_root"])){
                    // First we delete the application root.
                    if(is_dir($application_settings["application_root"])){
                        System::rm(array('-rf', $application_settings["application_root"]));
                    }
                    
                    // remove other directories if they are outside of the application root
                    if(is_array($application["release"]["packages"]["package"])) {
                        foreach($application["release"]["packages"]["package"] as $package) {
                            if(isset($package["@"]["baseinstalldir"])) {
                                $dir = $application_settings["application_root"];
                                $dir .= $package["@"]["baseinstalldir"];
                                if(is_dir($dir)) {
                                    System::rm(array('-rf',$dir));
                                }
                            }
                        }
                    }
                }
            //}
            
            // remove application from registry
            $zi_registry->removeApplication();
        }
	}
	
    /***************************************************************************   
    * PAGE CONTENT                                                             *   
    ***************************************************************************/   
	
	include 'themes/'.$GLOBALS['ZI']['theme'].'/header.php';
	?>
	<h1>Remove Application</h1>
    <div class="warning">Are you sure, you want to remove this application?</div>
    <?php
    // load selected package
    $application = $zi_registry->getApplication();
    // make those items a numeric array where more than one element with the same name occurs
    // on the same level
    require_once 'ZZOSS_Config/Config.php';
    $info = ZZOSS_Config::prepareNumeric($application, array('license', 'maintainer', 'holder'));
    
	// show application information table
    include 'inc/info.php';
    $content = '';
    // Show the installation paths if it is an installed application
    if(isset($info['installed'])){
        $settings = $zi_registry->getApplicationSettings();
        $content .= zi_info_td('Install Root', $settings['application_root']);
        $content .= zi_info_td('Install URL', '<a href="'.$settings['application_url'].'" target="_blank">'.$settings['application_url'].'</a>');
    }
    $content .= zi_info_td('Description', zi_info_text($info["description"]) );
    if(isset($_REQUEST['type']) && $_REQUEST['type'] != 'distribution'){
        $distribution = $zi_registry->getDistribution();
        $content  .= zi_info_td('Distribution', $distribution['summary'].' '.$distribution['release']['version']);
    }
	$content .= zi_info_td('UNIX Name', $info["name"] );
	$content .= zi_info_td('Version', $info["release"]["version"] );
	$content .= zi_info_td('Release Date', $info["release"]["date"] );
	$content .= zi_info_td('State', zi_info_text($info["release"]["state"]) );
    if(isset($info['homepage'])){
        $content .= zi_info_td('Homepage', zi_info_text($info['homepage']) );
    }
	$content .= zi_info_td('Licenses', zi_info_licenses($info["release"]["license"]) );
    if(isset($info["release"]["copyright"]['holder'])){
        $content .= zi_info_td('Copyrights', zi_info_copyrights($info["release"]["copyright"]['holder']) );
    }
    if(isset($info["maintainers"]["maintainer"])){
        $content .= zi_info_td('Maintainers', zi_info_maintainers($info["maintainers"]["maintainer"]) );
    }
	$content .= zi_info_td('Notes', zi_info_text($info["release"]["notes"]) );
	echo zi_info_table($info["summary"].' '. $info["release"]["version"], $content);
    
    $zi_buttons['ok'] = $zi_buttons['cancel'] = 'applications.php'.zi_form_querystr();
	include 'themes/'.$GLOBALS['ZI']['theme'].'/footer.php';

?>
Return current item: ZZ/OSS Installer