| 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' ) ); |
| 42 |
break; |
break; |
| 43 |
|
|
| 44 |
case 'deleteconfirm': |
case 'deleteconfirm': |
| 45 |
deleteconfirm( $option, $cid[0] ); |
deleteconfirm( $option, $cid ); |
| 46 |
break; |
break; |
| 47 |
|
|
| 48 |
case 'deletemenu': |
case 'deletemenu': |
| 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(".T_('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 |
} |
} |
| 222 |
$pparser = new mosParameters($menu); |
$pparser = new mosParameters($menu); |
| 223 |
$params = $pparser->getParams(); |
$params = $pparser->getParams(); |
| 224 |
if ( $params->menutype == $menutype ) { |
if ( $params->menutype == $menutype ) { |
| 225 |
echo "<script> alert(".T_('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 |
} |
} |
| 321 |
/** |
/** |
| 322 |
* Compiles a list of the items you have selected to permanently delte |
* Compiles a list of the items you have selected to permanently delte |
| 323 |
*/ |
*/ |
| 324 |
function deleteConfirm( $option, $type ) { |
function deleteConfirm( $option, $types ) { |
| 325 |
global $database; |
global $database; |
| 326 |
|
|
| 327 |
if ( $type == 'mainmenu' ) { |
if ( in_array('mainmenu', $types )) { |
| 328 |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a core menu')."); window.history.go(-1); </script>\n"; |
$types = array_diff($types, array('mainmenu')); |
| 329 |
exit(); |
echo "<script> alert('".T_('You cannot delete the "mainmenu" menu as it is a core menu')."'); </script>\n"; |
| 330 |
} |
} |
| 331 |
|
|
| 332 |
|
$menus = implode("','",$types); |
| 333 |
// list of menu items to delete |
// list of menu items to delete |
| 334 |
$query = "SELECT a.name, a.id" |
$query = "SELECT a.name, a.id" |
| 335 |
. "\n FROM #__menu AS a" |
. "\n FROM #__menu AS a" |
| 336 |
. "\n WHERE ( a.menutype IN ( '$type' ) )" |
. "\n WHERE ( a.menutype IN ( '$menus' ) )" |
| 337 |
. "\n ORDER BY a.name" |
. "\n ORDER BY a.name" |
| 338 |
; |
; |
| 339 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 340 |
$items = $database->loadObjectList(); |
$items = $database->loadObjectList(); |
| 341 |
|
|
| 342 |
|
foreach ($types as $type) { |
| 343 |
// list of modules to delete |
// list of modules to delete |
| 344 |
$query = "SELECT id" |
$query = "SELECT id" |
| 345 |
. "\n FROM #__modules" |
. "\n FROM #__modules" |
| 348 |
; |
; |
| 349 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 350 |
$mods = $database->loadResultArray(); |
$mods = $database->loadResultArray(); |
|
|
|
| 351 |
foreach ( $mods as $module ) { |
foreach ( $mods as $module ) { |
| 352 |
$row = new mosModule( $database ); |
$row = new mosModule( $database ); |
| 353 |
$row->load( $module ); |
$row->load( $module ); |
| 357 |
$mid[] = $module; |
$mid[] = $module; |
| 358 |
} |
} |
| 359 |
} |
} |
| 360 |
|
} |
| 361 |
|
|
| 362 |
@$mids = implode( ',', $mid ); |
@$mids = implode( ',', $mid ); |
| 363 |
$query = "SELECT id, title" |
$query = "SELECT id, title" |
| 377 |
global $database; |
global $database; |
| 378 |
|
|
| 379 |
if ( $type == 'mainmenu' ) { |
if ( $type == 'mainmenu' ) { |
| 380 |
echo "<script> alert(".T_('You cannot delete the "mainmenu" menu as it is a 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"; |
| 381 |
exit(); |
exit(); |
| 382 |
} |
} |
| 383 |
|
|
| 468 |
$pparser = new mosParameters($menu); |
$pparser = new mosParameters($menu); |
| 469 |
$params = $pparser->getParams(); |
$params = $pparser->getParams(); |
| 470 |
if ( $params->menutype == $menu_name ) { |
if ( $params->menutype == $menu_name ) { |
| 471 |
echo "<script> alert(".T_('A menu with that name already exists - 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"; |
| 472 |
exit; |
exit; |
| 473 |
} |
} |
| 474 |
} |
} |