[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: language.class.php 331 2005-10-02 15:48:09Z stingrey $ 4 * @package Joomla 5 * @subpackage Installer 6 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 7 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // no direct access 16 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 17 /** 18 * Language installer 19 * @package Joomla 20 * @subpackage Installer 21 */ 22 class mosInstallerLanguage extends mosInstaller { 23 /** 24 * Custom install method 25 * @param boolean True if installing from directory 26 */ 27 function install( $p_fromdir = null ) { 28 global $mosConfig_absolute_path,$database; 29 30 if (!$this->preInstallCheck( $p_fromdir, 'language' )) { 31 return false; 32 } 33 34 $xmlDoc = $this->xmlDoc(); 35 $root = &$xmlDoc->documentElement; 36 37 // Set some vars 38 $e = &$root->getElementsByPath( 'name', 1); 39 $this->elementName($e->getText()); 40 $this->elementDir( mosPathName( $mosConfig_absolute_path . "/language/" ) ); 41 42 // Find files to copy 43 if ($this->parseFiles( 'files', 'language' ) === false) { 44 return false; 45 } 46 if ($e = &$root->getElementsByPath( 'description', 1 )) { 47 $this->setError( 0, $this->elementName() . '<p>' . $e->getText() . '</p>' ); 48 } 49 50 return $this->copySetupFile('front'); 51 } 52 /** 53 * Custom install method 54 * @param int The id of the module 55 * @param string The URL option 56 * @param int The client id 57 */ 58 function uninstall( $id, $option, $client=0 ) { 59 global $mosConfig_absolute_path; 60 $id = str_replace( array( '\\', '/' ), '', $id ); 61 62 $basepath = $mosConfig_absolute_path . '/language/'; 63 $xmlfile = $basepath . $id . '.xml'; 64 65 // see if there is an xml install file, must be same name as element 66 if (file_exists( $xmlfile )) { 67 $this->i_xmldoc = new DOMIT_Lite_Document(); 68 $this->i_xmldoc->resolveErrors( true ); 69 70 if ($this->i_xmldoc->loadXML( $xmlfile, false, true )) { 71 $mosinstall =& $this->i_xmldoc->documentElement; 72 // get the files element 73 $files_element =& $mosinstall->getElementsByPath( 'files', 1 ); 74 75 if (!is_null( $files_element )) { 76 $files = $files_element->childNodes; 77 foreach ($files as $file) { 78 // delete the files 79 $filename = $file->getText(); 80 echo $filename; 81 if (file_exists( $basepath . $filename )) { 82 echo '<br />Deleting: '. $basepath . $filename; 83 $result = unlink( $basepath . $filename ); 84 } 85 echo intval( $result ); 86 } 87 } 88 } 89 } else { 90 HTML_installer::showInstallMessage( 'Language id empty, cannot remove files', 'Uninstall - error', $this->returnTo( $option, 'language', $client ) ); 91 exit(); 92 } 93 94 // remove XML file from front 95 @unlink( $xmlfile ); 96 97 return true; 98 } 99 /** 100 * return to method 101 */ 102 function returnTo( $option, $element, $client ) { 103 return "index2.php?option=com_languages"; 104 } 105 106 } 107 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |