[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_installer/mambot/ -> mambot.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', 'mambot' ) );
  26  
  27  showInstalledMambots( $option );
  28  
  29  function showInstalledMambots( $_option ) {
  30      global $database, $mosConfig_absolute_path;
  31  
  32      // @RawSQLUse, trivial_implementation, SELECT
  33      $database->setQuery( "SELECT id, name, folder, element, client_id"
  34      . "\n FROM #__mambots"
  35      . "\n WHERE iscore='0'"
  36      . "\n ORDER BY folder, name"
  37      );
  38      $rows = $database->loadObjectList();
  39  
  40      // path to mambot directory
  41      $mambotBaseDir    = mosPathName($mosConfig_absolute_path.'/mambots');
  42  
  43      $id = 0;
  44      $n = count( $rows );
  45      for ($i = 0; $i < $n; $i++) {
  46          $row =& $rows[$i];
  47          // xml file for module
  48          $xmlfile = mosPathName ($mambotBaseDir.$row->folder).$row->element.".xml";
  49  
  50          if (file_exists( $xmlfile )) {
  51              $parser =& new mosXMLDescription($xmlfile);
  52              if ($parser->getType() != 'mambot') continue;
  53              $row->creationdate = $parser->getCreationDate('mambot');
  54              $row->author = $parser->getAuthor('mambot');
  55              $row->copyright = $parser->getCopyright('mambot');
  56              $row->authorEmail = $parser->getAuthorEmail('mambot');
  57              $row->authorUrl = $parser->getAuthorUrl('mambot');
  58              $row->version = $parser->getVersion('mambot');
  59  
  60  /*            $xmlDoc =& new DOMIT_Lite_Document();
  61              $xmlDoc->resolveErrors( true );
  62              if (!$xmlDoc->loadXML( $xmlfile, false, true )) {
  63                  continue;
  64              }
  65  
  66              $element = &$xmlDoc->documentElement;
  67  
  68              if ($element->getTagName() != 'mosinstall') {
  69                  continue;
  70              }
  71              if ($element->getAttribute( "type" ) != "mambot") {
  72                  continue;
  73              }
  74  
  75              $element = &$xmlDoc->getElementsByPath('creationDate', 1);
  76              $row->creationdate = $element ? $element->getText() : '';
  77  
  78              $element = &$xmlDoc->getElementsByPath('author', 1);
  79              $row->author = $element ? $element->getText() : '';
  80  
  81              $element = &$xmlDoc->getElementsByPath('copyright', 1);
  82              $row->copyright = $element ? $element->getText() : '';
  83  
  84              $element = &$xmlDoc->getElementsByPath('authorEmail', 1);
  85              $row->authorEmail = $element ? $element->getText() : '';
  86  
  87              $element = &$xmlDoc->getElementsByPath('authorUrl', 1);
  88              $row->authorUrl = $element ? $element->getText() : '';
  89  
  90              $element = &$xmlDoc->getElementsByPath('version', 1);
  91              $row->version = $element ? $element->getText() : '';
  92  */
  93          }
  94      }
  95  
  96      HTML_mambot::showInstalledMambots($rows, $_option, $id, $xmlfile );
  97  }
  98  ?>