* Needs to be in all Files and every File needs "svn propset *
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
- require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
}
// Add description as navigation point
-ADD_DESCR('admin', __FILE__);
+addMenuDescription('admin', __FILE__);
// Check if the admin has entered title and what-php file name...
-if (((!REQUEST_ISSET_POST('title')) || (!REQUEST_ISSET_POST(('menu'))) || (!REQUEST_ISSET_POST(('descr')))) && (isFormSent())) {
- REQUEST_UNSET_POST('ok');
+if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu'))) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) {
+ unsetPostRequestElement('ok');
} // END - if
-if (!isFormSent())
-{
+if (!isFormSent()) {
// Create arrays
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
// @TODO Cant this be rewritten?
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Init arrays
}
$OUT .= "</select>";
- define('__BELOW_SELECTION' , $OUT);
- define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION('admin', 'what', "name"));
- define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION('admin', 'action', "menu"));
+ // Prepare selections for template
+ $content['below_selection'] = $OUT;
+ $content['what_selection'] = adminAddMenuSelectionBox('member', 'what' , 'name');
+ $content['action_selection'] = adminAddMenuSelectionBox('member', 'action', 'menu');
// Display form
- LOAD_TEMPLATE("admin_admin_add");
-} elseif (!IS_DEMO()) {
+ loadTemplate('admin_admin_add', false, $content);
+} elseif (!isDemoModeActive()) {
// Insert new menu entry
- if (REQUEST_ISSET_POST(('menu'))) {
+ if (isPostRequestElementSet(('menu'))) {
// Add sub menu
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
- array(
- REQUEST_POST('menu'),
- REQUEST_POST('name'),
- REQUEST_POST('title'),
- REQUEST_POST('descr'),
- bigintval(REQUEST_POST('sort')),
- ), __FILE__, __LINE__
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
+ array(
+ postRequestElement('menu'),
+ postRequestElement('name'),
+ postRequestElement('title'),
+ postRequestElement('descr'),
+ bigintval(postRequestElement('sort')),
+ ), __FILE__, __LINE__
);
- cachePurgeAdminMenu(0, REQUEST_POST('menu'), REQUEST_POST('name'));
} else {
// Add main menu
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (action, title, descr, sort) VALUES ('%s','%s','%s','%s')",
- array(
- REQUEST_POST('name'),
- REQUEST_POST('title'),
- REQUEST_POST('descr'),
- bigintval(REQUEST_POST('sort')),
- ), __FILE__, __LINE__
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (action, title, descr, sort) VALUES ('%s','%s','%s','%s')",
+ array(
+ postRequestElement('name'),
+ postRequestElement('title'),
+ postRequestElement('descr'),
+ bigintval(postRequestElement('sort')),
+ ), __FILE__, __LINE__
);
- cachePurgeAdminMenu(0, REQUEST_POST('name'));
}
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+ loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
} else {
// Is demo login!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
+ loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
}
-//
+// [EOF]
?>