[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_installer/component/ -> component.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Installer
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  // ensure user has access to this function
  21  if ( !$acl->acl_check( 'administration', 'install', 'users', $my->usertype, $element . 's', 'all' ) ) {
  22      mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') );
  23  }
  24  
  25  require_once( $mainframe->getPath( 'installer_html', 'component' ) );
  26  
  27  showInstalledComponents( $option );
  28  
  29  /**
  30  * @param string The URL option
  31  */
  32  function showInstalledComponents( $option ) {
  33      global $database, $mosConfig_absolute_path;
  34  
  35      // @RawSQLUse, trivial_implementation, SELECT, CONCEPT
  36      $database->setQuery( "SELECT *"
  37      . "\n FROM #__components"
  38      . "\n WHERE parent = 0 AND iscore = 0"
  39      . "\n ORDER BY name"
  40      );
  41      $rows = $database->loadObjectList();
  42  
  43      // Read the component dir to find components
  44      $componentBaseDir    = mosPathName($mosConfig_absolute_path.'/administrator/components');
  45      $componentDirs = mosReadDirectory( $componentBaseDir );
  46  
  47      $n = count( $rows );
  48      for ($i = 0; $i < $n; $i++) {
  49          $row =& $rows[$i];
  50  
  51          $dirName = mosPathName($componentBaseDir.$row->option);
  52          $xmlFilesInDir = mosReadDirectory( $dirName, '.xml$' );
  53          foreach ($xmlFilesInDir as $xmlfile) {
  54              // Read the file to see if it's a valid component XML file
  55              $parser =& new mosXMLDescription($dirName.$xmlfile);
  56              if ($parser->getType() != 'component') continue;
  57              $row->creationdate = $parser->getCreationDate('component');
  58              $row->author = $parser->getAuthor('component');
  59              $row->copyright = $parser->getCopyright('component');
  60              $row->authorEmail = $parser->getAuthorEmail('component');
  61              $row->authorUrl = $parser->getAuthorUrl('component');
  62              $row->version = $parser->getVersion('component');
  63              $row->mosname = strtolower( str_replace( " ", "_", $row->name ) );
  64          }
  65      }
  66  
  67      HTML_component::showInstalledComponents( $rows, $option );
  68  }
  69  ?>