[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_installer/module/ -> module.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  
  18  /** ensure this file is being included by a parent file */
  19  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  20  
  21  // ensure user has access to this function
  22  if ( !$acl->acl_check( 'administration', 'install', 'users', $my->usertype, $element . 's', 'all' ) ) {
  23      mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') );
  24  }
  25  
  26  require_once( $mainframe->getPath( 'installer_html', 'module' ) );
  27  
  28  showInstalledModules( $option );
  29  
  30  /**
  31  * @param string The URL option
  32  */
  33  function showInstalledModules( $_option ) {
  34      global $database, $mosConfig_absolute_path;
  35  
  36      $filter = mosGetParam( $_POST, 'filter', '' );
  37      $select[] = mosHTML::makeOption( '', T_('All') );
  38      $select[] = mosHTML::makeOption( '0', T_('Site Modules') );
  39      $select[] = mosHTML::makeOption( '1', T_('Admin Modules') );
  40      $lists['filter'] = mosHTML::selectList( $select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter );
  41      if ( $filter == NULL ) {
  42          $_and = '';
  43      } else if ( !$filter ) {
  44          $_and = "\n AND client_id = '0'";
  45      } else if ( $filter ) {
  46          $_and = "\n AND client_id = '1'";
  47      }
  48  
  49      $database->setQuery( "SELECT id, module, client_id"
  50          . "\n FROM #__modules"
  51          . "\n WHERE module LIKE 'mod_%' AND iscore='0'"
  52          . $_and
  53          . "\n GROUP BY module, client_id"
  54          . "\n ORDER BY client_id, module"
  55      );
  56      $rows = $database->loadObjectList();
  57  
  58      $n = count( $rows );
  59      for ($i = 0; $i < $n; $i++) {
  60          $row =& $rows[$i];
  61  
  62          // path to module directory
  63          if ($row->client_id == "1"){
  64              $moduleBaseDir    = mosPathName($mosConfig_absolute_path.'/administrator/modules');
  65          } else {
  66              $moduleBaseDir    = mosPathName($mosConfig_absolute_path.'/modules');
  67          }
  68  
  69          // xml file for module
  70          $xmlfile = $moduleBaseDir.$row->module.".xml";
  71  
  72          if (file_exists( $xmlfile )) {
  73              $parser =& new mosXMLDescription($xmlfile);
  74              if ($parser->getType() != 'module') continue;
  75              $row->creationdate = $parser->getCreationDate('module');
  76              $row->author = $parser->getAuthor('module');
  77              $row->copyright = $parser->getCopyright('module');
  78              $row->authorEmail = $parser->getAuthorEmail('module');
  79              $row->authorUrl = $parser->getAuthorUrl('module');
  80              $row->version = $parser->getVersion('module');
  81  /*
  82              $xmlDoc =& new DOMIT_Lite_Document();
  83              $xmlDoc->resolveErrors( true );
  84              if (!$xmlDoc->loadXML( $xmlfile, false, true )) {
  85                  continue;
  86              }
  87  
  88              $element = &$xmlDoc->documentElement;
  89  
  90              if ($element->getTagName() != 'mosinstall') {
  91                  continue;
  92              }
  93              if ($element->getAttribute( "type" ) != "module") {
  94                  continue;
  95              }
  96  
  97              $element = &$xmlDoc->getElementsByPath( 'creationDate', 1 );
  98              $row->creationdate = $element ? $element->getText() : '';
  99  
 100              $element = &$xmlDoc->getElementsByPath( 'author', 1 );
 101              $row->author = $element ? $element->getText() : '';
 102  
 103              $element = &$xmlDoc->getElementsByPath( 'copyright', 1 );
 104              $row->copyright = $element ? $element->getText() : '';
 105  
 106              $element = &$xmlDoc->getElementsByPath( 'authorEmail', 1 );
 107              $row->authorEmail = $element ? $element->getText() : '';
 108  
 109              $element = &$xmlDoc->getElementsByPath( 'authorUrl', 1 );
 110              $row->authorUrl = $element ? $element->getText() : '';
 111  
 112              $element = &$xmlDoc->getElementsByPath( 'version', 1 );
 113              $row->version = $element ? $element->getText() : '';
 114  */
 115          }
 116      }
 117  
 118      HTML_module::showInstalledModules( $rows, $_option, $xmlfile, $lists );
 119  }
 120  ?>