Annotation of /mambo/branches/4.6/administrator/components/com_installer/component/component.php
Parent Directory
|
Revision Log
Revision 1 -
(view)
(download)
Original Path: mambo/trunk/administrator/components/com_installer/component/component.php
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @version $Id: component.php,v 1.1 2005/07/22 01:52:30 eddieajau Exp $ | ||
| 4 : | * @package Mambo | ||
| 5 : | * @subpackage Installer | ||
| 6 : | * @copyright (C) 2000 - 2005 Miro International Pty Ltd | ||
| 7 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 8 : | * Mambo is Free Software | ||
| 9 : | */ | ||
| 10 : | |||
| 11 : | /** ensure this file is being included by a parent file */ | ||
| 12 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 13 : | |||
| 14 : | // ensure user has access to this function | ||
| 15 : | if ( !$acl->acl_check( 'administration', 'install', 'users', $my->usertype, $element . 's', 'all' ) ) { | ||
| 16 : | mosRedirect( 'index2.php', _NOT_AUTH ); | ||
| 17 : | } | ||
| 18 : | |||
| 19 : | require_once( $mainframe->getPath( 'installer_html', 'component' ) ); | ||
| 20 : | |||
| 21 : | HTML_installer::showInstallForm( 'Install new Component', $option, 'component', '', dirname(__FILE__) ); | ||
| 22 : | ?> | ||
| 23 : | <table class="content"> | ||
| 24 : | <?php | ||
| 25 : | writableCell( 'media' ); | ||
| 26 : | writableCell( 'administrator/components' ); | ||
| 27 : | writableCell( 'components' ); | ||
| 28 : | writableCell( 'images/stories' ); | ||
| 29 : | ?> | ||
| 30 : | </table> | ||
| 31 : | <?php | ||
| 32 : | showInstalledComponents( $option ); | ||
| 33 : | |||
| 34 : | /** | ||
| 35 : | * @param string The URL option | ||
| 36 : | */ | ||
| 37 : | function showInstalledComponents( $option ) { | ||
| 38 : | global $database, $mosConfig_absolute_path; | ||
| 39 : | |||
| 40 : | $database->setQuery( "SELECT *" | ||
| 41 : | . "\n FROM #__components" | ||
| 42 : | . "\n WHERE parent = 0 AND iscore = 0" | ||
| 43 : | . "\n ORDER BY name" | ||
| 44 : | ); | ||
| 45 : | $rows = $database->loadObjectList(); | ||
| 46 : | |||
| 47 : | // Read the component dir to find components | ||
| 48 : | $componentBaseDir = mosPathName( $mosConfig_absolute_path . '/administrator/components' ); | ||
| 49 : | $componentDirs = mosReadDirectory( $componentBaseDir ); | ||
| 50 : | |||
| 51 : | $n = count( $rows ); | ||
| 52 : | for ($i = 0; $i < $n; $i++) { | ||
| 53 : | $row =& $rows[$i]; | ||
| 54 : | |||
| 55 : | $dirName = $componentBaseDir . $row->option; | ||
| 56 : | $xmlFilesInDir = mosReadDirectory( $dirName, '.xml$' ); | ||
| 57 : | |||
| 58 : | foreach ($xmlFilesInDir as $xmlfile) { | ||
| 59 : | // Read the file to see if it's a valid component XML file | ||
| 60 : | $xmlDoc =& new DOMIT_Lite_Document(); | ||
| 61 : | $xmlDoc->resolveErrors( true ); | ||
| 62 : | |||
| 63 : | if (!$xmlDoc->loadXML( $dirName . '/' . $xmlfile, false, true )) { | ||
| 64 : | continue; | ||
| 65 : | } | ||
| 66 : | |||
| 67 : | $element = &$xmlDoc->documentElement; | ||
| 68 : | |||
| 69 : | if ($element->getTagName() != 'mosinstall') { | ||
| 70 : | continue; | ||
| 71 : | } | ||
| 72 : | if ($element->getAttribute( "type" ) != "component") { | ||
| 73 : | continue; | ||
| 74 : | } | ||
| 75 : | |||
| 76 : | $element = &$xmlDoc->getElementsByPath('creationDate', 1); | ||
| 77 : | $row->creationdate = $element ? $element->getText() : 'Unknown'; | ||
| 78 : | |||
| 79 : | $element = &$xmlDoc->getElementsByPath('author', 1); | ||
| 80 : | $row->author = $element ? $element->getText() : 'Unknown'; | ||
| 81 : | |||
| 82 : | $element = &$xmlDoc->getElementsByPath('copyright', 1); | ||
| 83 : | $row->copyright = $element ? $element->getText() : ''; | ||
| 84 : | |||
| 85 : | $element = &$xmlDoc->getElementsByPath('authorEmail', 1); | ||
| 86 : | $row->authorEmail = $element ? $element->getText() : ''; | ||
| 87 : | |||
| 88 : | $element = &$xmlDoc->getElementsByPath('authorUrl', 1); | ||
| 89 : | $row->authorUrl = $element ? $element->getText() : ''; | ||
| 90 : | |||
| 91 : | $element = &$xmlDoc->getElementsByPath('version', 1); | ||
| 92 : | $row->version = $element ? $element->getText() : ''; | ||
| 93 : | |||
| 94 : | $row->mosname = strtolower( str_replace( " ", "_", $row->name ) ); | ||
| 95 : | } | ||
| 96 : | } | ||
| 97 : | |||
| 98 : | HTML_component::showInstalledComponents( $rows, $option ); | ||
| 99 : | } | ||
| 100 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

