X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-admin_add.php;h=ef768ff913c9c45a137e6517073bbf5ec602d83b;hp=bc85b8a7912f90834ee57b064db8e4663552a9bd;hb=64c8349613addc3da2242c5cd6b99d64e3fb5f8e;hpb=7b0f17cd637e388049d2167811e4332cec1e979b diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index bc85b8a791..ef768ff913 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')))) && (IS_FORM_SENT())) { - REQUEST_UNSET_POST('ok'); -} +if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu'))) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) { + unsetPostRequestElement('ok'); +} // END - if -if (!IS_FORM_SENT()) -{ +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,8 +92,8 @@ if (!IS_FORM_SENT()) // 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`", - array($value_main), __FILE__, __LINE__); + $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 $menus[$value_main] = array(); @@ -136,67 +135,61 @@ if (!IS_FORM_SENT()) } $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')", + 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')), + 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')", + 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')), + 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] ?>