[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/components/com_menus/ -> toolbar.menus.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Menus
   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  require_once( $mainframe->getPath( 'toolbar_html' ) );
  21  require_once( $mainframe->getPath( 'toolbar_default' ) );
  22  
  23  switch ($task) {
  24      case 'new':
  25          TOOLBAR_menus::_NEW();
  26          break;
  27  
  28      case 'movemenu':
  29          TOOLBAR_menus::_MOVEMENU();
  30          break;
  31  
  32      case 'copymenu':
  33          TOOLBAR_menus::_COPYMENU();
  34          break;
  35  
  36      case 'edit':
  37          $cid     = mosGetParam( $_POST, 'cid', array(0) );
  38          if (!is_array( $cid )) {
  39              $cid = array(0);
  40          }
  41          $path     = $mosConfig_absolute_path .'/administrator/components/com_menus/';    
  42  
  43          if ( $cid[0] ) {
  44              // @RawSQLUse, trivial_implementation, SELECT, CONCEPT
  45              $query = "SELECT type FROM #__menu WHERE id = $cid[0]";
  46              $database->setQuery( $query );
  47              $type = $database->loadResult();
  48              $item_path  = $path . $type .'/'. $type .'.menubar.php';
  49              
  50              if ( $type ) {
  51                  if ( file_exists( $item_path  ) ) {
  52                      require_once( $item_path  );
  53                  } else {
  54                      TOOLBAR_menus::_EDIT($type);
  55                  }
  56              } else {
  57                  echo $database->stderr();
  58              }
  59          } else {
  60              $type         = mosGetParam( $_REQUEST, 'type', null );
  61              $item_path  = $path . $type .'/'. $type .'.menubar.php';
  62              
  63              if ( $type ) {
  64                  if ( file_exists( $item_path ) ) {
  65                      require_once( $item_path  );
  66                  } else {
  67                      TOOLBAR_menus::_EDIT($type);
  68                  }
  69              } else {
  70                  TOOLBAR_menus::_EDIT($type);
  71              }
  72          }
  73          break;
  74  
  75      default:
  76          $type         = trim( mosGetParam( $_REQUEST, 'type', null ) );
  77          $item_path  = $path . $type .'/'. $type .'.menubar.php';
  78          
  79          if ( $type ) {
  80              if ( file_exists( $item_path ) ) {
  81                  require_once( $item_path );
  82              } else {
  83                  TOOLBAR_menus::_DEFAULT();
  84              }
  85          } else {
  86              TOOLBAR_menus::_DEFAULT();
  87          }
  88          break;
  89  }
  90  ?>