[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/modules/ -> mod_components.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  // cache some acl checks
  20  $canConfig = $acl->acl_check( 'administration', 'config', 'users', $my->usertype );
  21  
  22  $manageTemplates     = $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_templates' );
  23  $manageLanguages     = $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_languages' );
  24  $installModules     = $acl->acl_check( 'administration', 'install', 'users', $my->usertype, 'modules', 'all' );
  25  $editAllModules     = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'modules', 'all' );
  26  $installComponents     = $acl->acl_check( 'administration', 'install', 'users', $my->usertype, 'components', 'all' );
  27  $editAllComponents     = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' );
  28  $canMassMail         = $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_massmail' );
  29  $canManageUsers     = $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_users' );
  30  
  31  // @RawSQLUse, trivial_implementation, SELECT
  32  $query = "SELECT * FROM #__components ORDER BY ordering,name";
  33  $database->setQuery( $query );
  34  $comps = $database->loadObjectList();    // component list
  35  
  36  $subs = array();    // sub menus
  37  
  38  // first pass to collect sub-menu items
  39  foreach ($comps as $row) {
  40      if ($row->parent) {
  41          if (!array_key_exists( $row->parent, $subs )) {
  42              $subs[$row->parent] = array();
  43          } // if
  44          $subs[$row->parent][] = $row;
  45      } // if
  46  } // foreach
  47  
  48  echo '<div align="left">';
  49  
  50  $topLevelLimit = 100;
  51  $i = 0;
  52  foreach ($comps as $row) {
  53  
  54      if ( $editAllComponents | $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', $row->option ) ) {
  55  
  56          if ($row->parent == 0 && (trim( $row->admin_menu_link ) || array_key_exists( $row->id, $subs ))) {
  57  
  58              if ($i >= $topLevelLimit) {
  59                  if ($i == $topLevelLimit) {
  60  
  61                      echo "Error!<br />";
  62                      $i = 1000;
  63                  } // if
  64              } else {
  65                  if ($i < $topLevelLimit ) {
  66                      $i++;
  67                      $name = htmlspecialchars( $row->name, ENT_QUOTES );
  68                      // $alt = htmlspecialchars( $row->admin_menu_alt, ENT_QUOTES );
  69                      if ($row->admin_menu_link) {
  70                          echo "\n".'<a href="index2.php?'.htmlspecialchars($row->admin_menu_link,ENT_QUOTES).'"><strong>'.$name.'</strong></a><br />';
  71                      } else {
  72                          echo "\n".'<strong>'.$name.'</strong><br />';
  73                      } // if else
  74                      if (array_key_exists( $row->id, $subs )) {
  75                          foreach ($subs[$row->id] as $sub) {//print_r($row);
  76                              $name = htmlspecialchars( $sub->name );
  77                              // $alt = htmlspecialchars( $sub->admin_menu_alt );
  78                              // $link = $sub->admin_menu_link ? "" : "null";
  79                              // $img = $sub->admin_menu_img ? "<img src=\"../includes/$sub->admin_menu_img\" />" : '';
  80                              if ($sub->admin_menu_link) {
  81                                  echo "\n".'&nbsp;&nbsp;- <a href="index2.php?'.htmlspecialchars($sub->admin_menu_link, ENT_QUOTES).'">'.$name.'</a><br />';
  82                              } else {
  83                                  echo "\n".'- '.$name.'<br />';
  84                              } // if else
  85                          } // foreach
  86                      } // if
  87                  } // if
  88              } // if else
  89          } // if
  90      } // if
  91  } // foreach
  92  echo "\n".'</div>';
  93  ?>