[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  /**
   3  * @version $Id: module.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', 'module' ) );
  24  
  25  HTML_installer::showInstallForm( 'Install new Modules', $option, 'module', '', dirname(__FILE__) );
  26  ?>
  27  <table class="content">
  28  <?php
  29  writableCell( 'media' );
  30  writableCell( 'administrator/modules' );
  31  writableCell( 'modules' );
  32  ?>
  33  </table>
  34  <?php
  35  showInstalledModules( $option );
  36  
  37  /**
  38  * @param string The URL option
  39  */
  40  function showInstalledModules( $_option ) {
  41      global $database, $mosConfig_absolute_path;
  42  
  43      $filter         = mosGetParam( $_POST, 'filter', '' );
  44      $select[]         = mosHTML::makeOption( '', 'All' );
  45      $select[]         = mosHTML::makeOption( '0', 'Site Modules' );
  46      $select[]         = mosHTML::makeOption( '1', 'Admin Modules' );
  47      $lists['filter'] = mosHTML::selectList( $select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter );
  48      if ( $filter == NULL ) {
  49          $and = '';
  50      } else if ( !$filter ) {
  51          $and = "\n AND client_id = 0";
  52      } else if ( $filter ) {
  53          $and = "\n AND client_id = 1";
  54      }
  55  
  56      $query = "SELECT id, module, client_id"
  57      . "\n FROM #__modules"
  58      . "\n WHERE module LIKE 'mod_%' AND iscore='0'"
  59      . $and
  60      . "\n GROUP BY module, client_id"
  61      . "\n ORDER BY client_id, module"
  62      ;
  63      $database->setQuery( $query );
  64      $rows = $database->loadObjectList();
  65  
  66      $n = count( $rows );
  67      for ($i = 0; $i < $n; $i++) {
  68          $row =& $rows[$i];
  69  
  70          // path to module directory
  71          if ($row->client_id == "1"){
  72              $moduleBaseDir    = mosPathName( mosPathName( $mosConfig_absolute_path ) . "administrator/modules" );
  73          } else {
  74              $moduleBaseDir    = mosPathName( mosPathName( $mosConfig_absolute_path ) . "modules" );
  75          }
  76  
  77          // xml file for module
  78          $xmlfile = $moduleBaseDir. "/" .$row->module .".xml";
  79  
  80          if (file_exists( $xmlfile )) {
  81              $xmlDoc = new DOMIT_Lite_Document();
  82              $xmlDoc->resolveErrors( true );
  83              if (!$xmlDoc->loadXML( $xmlfile, false, true )) {
  84                  continue;
  85              }
  86  
  87              $root = &$xmlDoc->documentElement;
  88  
  89              if ($root->getTagName() != 'mosinstall') {
  90                  continue;
  91              }
  92              if ($root->getAttribute( "type" ) != "module") {
  93                  continue;
  94              }
  95  
  96              $element             = &$root->getElementsByPath( 'creationDate', 1 );
  97              $row->creationdate     = $element ? $element->getText() : '';
  98  
  99              $element             = &$root->getElementsByPath( 'author', 1 );
 100              $row->author         = $element ? $element->getText() : '';
 101  
 102              $element             = &$root->getElementsByPath( 'copyright', 1 );
 103              $row->copyright     = $element ? $element->getText() : '';
 104  
 105              $element             = &$root->getElementsByPath( 'authorEmail', 1 );
 106              $row->authorEmail     = $element ? $element->getText() : '';
 107  
 108              $element             = &$root->getElementsByPath( 'authorUrl', 1 );
 109              $row->authorUrl     = $element ? $element->getText() : '';
 110  
 111              $element             = &$root->getElementsByPath( 'version', 1 );
 112              $row->version         = $element ? $element->getText() : '';
 113          }
 114      }
 115  
 116      HTML_module::showInstalledModules( $rows, $_option, $xmlfile, $lists );
 117  }
 118  ?>


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