[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  /**
   3  * @version $Id: component.php 330 2005-10-02 15:39:51Z Jinx $
   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  // ensure user has access to this function
  19  if ( !$acl->acl_check( 'administration', 'install', 'users', $my->usertype, $element . 's', 'all' ) ) {
  20      mosRedirect( 'index2.php', _NOT_AUTH );
  21  }
  22  
  23  require_once( $mainframe->getPath( 'installer_html', 'component' ) );
  24  
  25  HTML_installer::showInstallForm( 'Install new Component', $option, 'component', '', dirname(__FILE__) );
  26  ?>
  27  <table class="content">
  28  <?php
  29  writableCell( 'media' );
  30  writableCell( 'administrator/components' );
  31  writableCell( 'components' );
  32  writableCell( 'images/stories' );
  33  ?>
  34  </table>
  35  <?php
  36  showInstalledComponents( $option );
  37  
  38  /**
  39  * @param string The URL option
  40  */
  41  function showInstalledComponents( $option ) {
  42      global $database, $mosConfig_absolute_path;
  43  
  44      $query = "SELECT *"
  45      . "\n FROM #__components"
  46      . "\n WHERE parent = 0"
  47      . "\n AND iscore = 0"
  48      . "\n ORDER BY name"
  49      ;
  50      $database->setQuery( $query    );
  51      $rows = $database->loadObjectList();
  52  
  53      // Read the component dir to find components
  54      $componentBaseDir    = mosPathName( $mosConfig_absolute_path . '/administrator/components' );
  55      $componentDirs         = mosReadDirectory( $componentBaseDir );
  56  
  57      $n = count( $rows );
  58      for ($i = 0; $i < $n; $i++) {
  59          $row =& $rows[$i];
  60  
  61          $dirName = $componentBaseDir . $row->option;
  62          $xmlFilesInDir = mosReadDirectory( $dirName, '.xml$' );
  63  
  64          foreach ($xmlFilesInDir as $xmlfile) {
  65              // Read the file to see if it's a valid component XML file
  66              $xmlDoc = new DOMIT_Lite_Document();
  67              $xmlDoc->resolveErrors( true );
  68  
  69              if (!$xmlDoc->loadXML( $dirName . '/' . $xmlfile, false, true )) {
  70                  continue;
  71              }
  72  
  73              $root = &$xmlDoc->documentElement;
  74  
  75              if ($root->getTagName() != 'mosinstall') {
  76                  continue;
  77              }
  78              if ($root->getAttribute( "type" ) != "component") {
  79                  continue;
  80              }
  81  
  82              $element             = &$root->getElementsByPath('creationDate', 1);
  83              $row->creationdate     = $element ? $element->getText() : 'Unknown';
  84  
  85              $element             = &$root->getElementsByPath('author', 1);
  86              $row->author         = $element ? $element->getText() : 'Unknown';
  87  
  88              $element             = &$root->getElementsByPath('copyright', 1);
  89              $row->copyright     = $element ? $element->getText() : '';
  90  
  91              $element             = &$root->getElementsByPath('authorEmail', 1);
  92              $row->authorEmail     = $element ? $element->getText() : '';
  93  
  94              $element             = &$root->getElementsByPath('authorUrl', 1);
  95              $row->authorUrl     = $element ? $element->getText() : '';
  96  
  97              $element             = &$root->getElementsByPath('version', 1);
  98              $row->version         = $element ? $element->getText() : '';
  99  
 100              $row->mosname         = strtolower( str_replace( " ", "_", $row->name ) );
 101          }
 102      }
 103  
 104      HTML_component::showInstalledComponents( $rows, $option );
 105  }
 106  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics