| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
| 3 |
* @version $Id: admin.menumanager.php,v 1.1 2005/07/22 01:52:39 eddieajau Exp $ |
* @package Mambo Open Source |
|
* @package Mambo |
|
| 4 |
* @subpackage Menus |
* @subpackage Menus |
| 5 |
* @copyright (C) 2000 - 2005 Miro International Pty Ltd |
* @copyright (C) 2005 - 2006 Mambo Foundation Inc. |
| 6 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
| 7 |
|
* |
| 8 |
|
* Mambo was originally developed by Miro (www.miro.com.au) in 2000. Miro assigned the copyright in Mambo to The Mambo Foundation in 2005 to ensure |
| 9 |
|
* that Mambo remained free Open Source software owned and managed by the community. |
| 10 |
* Mambo is Free Software |
* Mambo is Free Software |
| 11 |
*/ |
*/ |
| 12 |
|
|
| 15 |
|
|
| 16 |
// ensure user has access to this function |
// ensure user has access to this function |
| 17 |
if (!$acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_menumanager' )) { |
if (!$acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_menumanager' )) { |
| 18 |
mosRedirect( 'index2.php', _NOT_AUTH ); |
mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') ); |
| 19 |
} |
} |
| 20 |
|
|
| 21 |
require_once( $mainframe->getPath( 'admin_html' ) ); |
require_once( $mainframe->getPath( 'admin_html' ) ); |
| 118 |
; |
; |
| 119 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 120 |
$unpublished = $database->loadObjectList(); |
$unpublished = $database->loadObjectList(); |
| 121 |
|
if (!$unpublished) $unpublished = array(); |
| 122 |
|
|
| 123 |
// Query to get trash menu item counts |
// Query to get trash menu item counts |
| 124 |
$query = "SELECT a.menutype, count( a.menutype ) as num" |
$query = "SELECT a.menutype, count( a.menutype ) as num" |
| 129 |
; |
; |
| 130 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 131 |
$trash = $database->loadObjectList(); |
$trash = $database->loadObjectList(); |
| 132 |
|
if (!$trash) $trash = array(); |
| 133 |
|
|
| 134 |
for( $i = 0; $i < $total; $i++ ) { |
for( $i = 0; $i < $total; $i++ ) { |
| 135 |
// adds published count |
// adds published count |
| 206 |
// block to stop renaming of 'mainmenu' menutype |
// block to stop renaming of 'mainmenu' menutype |
| 207 |
if ( $old_menutype == 'mainmenu' ) { |
if ( $old_menutype == 'mainmenu' ) { |
| 208 |
if ( $menutype <> 'mainmenu' ) { |
if ( $menutype <> 'mainmenu' ) { |
| 209 |
echo "<script> alert('You cannot rename the \'mainmenu\' Menu as this will disrupt the proper operation of Mambo'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot rename the "mainmenu" Menu as this will disrupt the proper operation of Mambo')."); window.history.go(-1); </script>\n"; |
| 210 |
exit; |
exit; |
| 211 |
} |
} |
| 212 |
} |
} |
| 219 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 220 |
$menus = $database->loadResultArray(); |
$menus = $database->loadResultArray(); |
| 221 |
foreach ( $menus as $menu ) { |
foreach ( $menus as $menu ) { |
| 222 |
$params = mosParseParams( $menu ); |
$pparser = new mosParameters($menu); |
| 223 |
|
$params = $pparser->getParams(); |
| 224 |
if ( $params->menutype == $menutype ) { |
if ( $params->menutype == $menutype ) { |
| 225 |
echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('A menu already exists with that name - you must enter a unique Menu Name')."); window.history.go(-1); </script>\n"; |
| 226 |
exit; |
exit; |
| 227 |
} |
} |
| 228 |
} |
} |
| 257 |
exit(); |
exit(); |
| 258 |
} |
} |
| 259 |
|
|
| 260 |
$msg = 'New Menu created [ '. $menutype .' ]'; |
$msg = sprintf(T_('New Menu created [ %s ]'), $menutype); |
| 261 |
break; |
break; |
| 262 |
|
|
| 263 |
default: |
default: |
| 275 |
$row->load( $module ); |
$row->load( $module ); |
| 276 |
|
|
| 277 |
$save = 0; |
$save = 0; |
| 278 |
$params = mosParseParams( $row->params ); |
$pparser = new mosParameters($row->params); |
| 279 |
|
$params = $pparser->getParams(); |
| 280 |
if ( $params->menutype == $old_menutype ) { |
if ( $params->menutype == $old_menutype ) { |
| 281 |
$params->menutype = $menutype; |
$params->menutype = $menutype; |
| 282 |
$save = 1; |
$save = 1; |
| 311 |
$database->query(); |
$database->query(); |
| 312 |
} |
} |
| 313 |
|
|
| 314 |
$msg = 'Menu Items & Modules updated'; |
$msg = T_('Menu Items & Modules updated'); |
| 315 |
break; |
break; |
| 316 |
} |
} |
| 317 |
|
|
| 325 |
global $database; |
global $database; |
| 326 |
|
|
| 327 |
if ( $type == 'mainmenu' ) { |
if ( $type == 'mainmenu' ) { |
| 328 |
echo "<script> alert('You cannot delete the \'mainmenu\' menu as it is core menu'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a core menu')."); window.history.go(-1); </script>\n"; |
| 329 |
exit(); |
exit(); |
| 330 |
} |
} |
| 331 |
|
|
| 350 |
foreach ( $mods as $module ) { |
foreach ( $mods as $module ) { |
| 351 |
$row = new mosModule( $database ); |
$row = new mosModule( $database ); |
| 352 |
$row->load( $module ); |
$row->load( $module ); |
| 353 |
|
$pparser = new mosParameters($row->params); |
| 354 |
$params = mosParseParams( $row->params ); |
$params = $pparser->getParams(); |
| 355 |
if ( $params->menutype == $type ) { |
if ( $params->menutype == $type ) { |
| 356 |
$mid[] = $module; |
$mid[] = $module; |
| 357 |
} |
} |
| 375 |
global $database; |
global $database; |
| 376 |
|
|
| 377 |
if ( $type == 'mainmenu' ) { |
if ( $type == 'mainmenu' ) { |
| 378 |
echo "<script> alert('You cannot delete the \'mainmenu\' menu as it is core menu'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a core menu')."); window.history.go(-1); </script>\n"; |
| 379 |
exit(); |
exit(); |
| 380 |
} |
} |
| 381 |
|
|
| 463 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 464 |
$menus = $database->loadResultArray(); |
$menus = $database->loadResultArray(); |
| 465 |
foreach ( $menus as $menu ) { |
foreach ( $menus as $menu ) { |
| 466 |
$params = mosParseParams( $menu ); |
$pparser = new mosParameters($menu); |
| 467 |
|
$params = $pparser->getParams(); |
| 468 |
if ( $params->menutype == $menu_name ) { |
if ( $params->menutype == $menu_name ) { |
| 469 |
echo "<script> alert('A menu already exists with that name - you must enter a unique Menu Name'); window.history.go(-1); </script>\n"; |
echo "<script> alert(".T_('A menu with that name already exists - you must enter a unique Menu Name')."); window.history.go(-1); </script>\n"; |
| 470 |
exit; |
exit; |
| 471 |
} |
} |
| 472 |
} |
} |
| 526 |
exit(); |
exit(); |
| 527 |
} |
} |
| 528 |
|
|
| 529 |
$msg = 'Copy of Menu `'. $type .'` created, consisting of '. $total .' items'; |
$msg = sprintf(Tn_('Copy of Menu `%s` created, consisting of %d item', 'Copy of Menu `%s` created, consisting of %d items', $total), $type, $total); |
| 530 |
mosRedirect( 'index2.php?option=' . $option, $msg ); |
mosRedirect( 'index2.php?option=' . $option, $msg ); |
| 531 |
} |
} |
| 532 |
|
|