X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-admin_add.php;h=7e66899d8255772e00366d569d3a41ecaa06d892;hb=4b9887f734067dc52a1730468e25ba066036a3e1;hp=4f3f661ee89ec32f4e85e12cd8c5a333946bd071;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index 4f3f661ee8..7e66899d82 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -18,6 +18,7 @@ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -39,14 +40,14 @@ // Some security stuff... if ((!defined('__SECURITY')) || (!isAdmin())) { die(); -} +} // END - if // Add description as navigation point addMenuDescription('admin', __FILE__); // Check if the admin has entered title and what-php file name... -if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu')) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) { - unsetPostRequestElement('ok'); +if ((isFormSent()) && ((!isPostRequestParameterSet('title')) || (!isPostRequestParameterSet('menu')) || (!isPostRequestParameterSet('descr')))) { + unsetPostRequestParameter('ok'); } // END - if if (!isFormSent()) { @@ -54,8 +55,8 @@ if (!isFormSent()) { $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__); - if (SQL_NUMROWS($result) > 0) { + $result = SQL_QUERY("SELECT `action`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__); + if (!SQL_HASZERONUMS($result)) { // Read menu structure // @TODO Cant this be rewritten? while ($content = SQL_FETCHARRAY($result)) { @@ -92,9 +93,9 @@ 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`", - array($value_main), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + $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` ASC", + array($value_main), __FILE__, __LINE__); + if (!SQL_HASZERONUMS($result)) { // Init arrays $menus[$value_main] = array(); $titles[$value_main] = array(); @@ -133,62 +134,61 @@ if (!isFormSent()) { } } } - $OUT = " + '; foreach ($below as $key => $m) { if (is_array($m)) { foreach ($m as $key2 => $m2) { - $OUT .= " \n"; + $OUT .= ' (' . $titles[$k] . ')'; + } // END - if + } // END - foreach + $OUT .= ''; } - } - else - { - $OUT .= " \n"; + } else { + $OUT .= ' '; } } - $OUT .= ""; + $OUT .= ''; // Prepare selections for template $content['below_selection'] = $OUT; - $content['what_selection'] = adminAddMenuSelectionBox('member', 'what' , 'name'); - $content['action_selection'] = adminAddMenuSelectionBox('member', 'action', 'menu'); + $content['what_selection'] = adminAddMenuSelectionBox('admin', 'what' , 'name'); + $content['action_selection'] = adminAddMenuSelectionBox('admin', 'action', 'menu'); // Display form - loadTemplate('admin_admin_add', false, $content); + loadTemplate('admin_add_admin_menu', false, $content); } elseif (!isDemoModeActive()) { // Insert new menu entry - if (isPostRequestElementSet('menu')) { + if (isPostRequestParameterSet('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( - postRequestElement('menu'), - postRequestElement('name'), - postRequestElement('title'), - postRequestElement('descr'), - bigintval(postRequestElement('sort')), + postRequestParameter('menu'), + postRequestParameter('name'), + postRequestParameter('title'), + postRequestParameter('descr'), + bigintval(postRequestParameter('sort')), ), __FILE__, __LINE__ ); } else { // Add main menu 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')), + postRequestParameter('name'), + postRequestParameter('title'), + postRequestParameter('descr'), + bigintval(postRequestParameter('sort')), ), __FILE__, __LINE__ ); } - loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED')); + loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}'); } else { // Is demo login! - loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED')); + loadTemplate('admin_settings_saved', false, '{--SETTINGS_NOT_SAVED--}'); } // [EOF]