Location: PHPKode > projects > Informium > admin/menu.php
<?

//
// Copyright (c) 2002, Cameron McKay
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions 
// are met:

// * Redistributions of source code must retain the above copyright 
//   notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright 
//   notice, this list of conditions and the following disclaimer in the 
//   documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

//
// Informium -- Advanced News Script
//
// Menu State Script (menu.php)
//
// Author: Cameron McKay
// Note:   Sets the cookie that sets the menu state (either collapsed or
//         expanded).
//

// Import CONF.
require_once('../conf/inf-conf.php');

// Require MENU class, if needed.
require_once("$CONF[local_path]/class/menu-class.php");

// Register needed variables.
$menu_name = $_GET['menu_name'];
$state     = $_GET['state'];

// Verify that the 'allow' array is clean.
$allow = array();

// Make an allowable menus array.
$allow['MISC']    = true;
$allow['ARTICLE'] = true;
$allow['COMMENT'] = true;
$allow['USER']    = true;
$allow['SECTION'] = true;
$allow['TOPIC']   = true;
$allow['IMAGE']   = true;

// Verify that the 'state_allow' array is clean.
$state_allow = array();

// Make an allowable states array.
$state_allow['STATE_COL'] = true;
$state_allow['STATE_EXP'] = true;

// If we have no 'menu_name' or 'state' then return to the
// main menu.
if (!isset($menu_name) || !isset($state)) {
	header('Location: admin.php');

}

// Make sure the 'menu_name' and 'state' are allowed.
if ($allow[$menu_name] == true && $state_allow[$state] == true) {

	// Make a new MENU object.
	$menu = new menu($menu_name);

	// Set the appropriate cookie.
	$menu->set_state($state);

}

// Return to the main menu.
header('Location: admin.php');

?>
Return current item: Informium