X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-admin_add.php;h=fa3a6012ab9b7b0271e47b70ae7152a0ec572e75;hb=0e269568bd666186509e98594e83bac199ac26da;hp=18a9dcfdeeb81cc4ac94964359ca10cf7a652ce9;hpb=3afdce4fe00b4af570122ce7b8158ced44aec7d3;p=mailer.git diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index 18a9dcfdee..fa3a6012ab 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -17,7 +17,7 @@ * 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 * @@ -37,28 +37,27 @@ ************************************************************************/ // 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? while ($content = SQL_FETCHARRAY($result)) { // Menu actions $menus[] = $content['action']; @@ -93,7 +92,7 @@ if (!isFormSent()) // 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 @@ -135,7 +134,7 @@ if (!isFormSent()) } } $OUT = " "; - 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] ?>