X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-guest_add.php;h=b1e4a4ac063f0702c807093d73a22bce02860151;hp=423415b7bb8d1d9cb3c3756527066c5bdca5980a;hb=2379934be6a196a54f4155bb8e24c49b20736969;hpb=04b69ac9f33369cbf654396c4a42cb1fff710ff4 diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php index 423415b7bb..b1e4a4ac06 100644 --- a/inc/modules/admin/what-guest_add.php +++ b/inc/modules/admin/what-guest_add.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -40,15 +38,15 @@ // Some security stuff... if ((!defined('__SECURITY')) || (!isAdmin())) { die(); -} +} // END - if // Add description as navigation point -addMenuDescription('admin', __FILE__); +addYouAreHereLink('admin', __FILE__); // Check if the admin has entered title and what-php file name... -if (((!isPostRequestParameterSet('title')) || (!isPostRequestParameterSet('menu'))) && (isFormSent())) { +if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu'))) && (isFormSent())) { // Abort adding the menu entry - unsetPostRequestParameter('ok'); + unsetPostRequestElement('ok'); } // END - if if (!isFormSent()) { @@ -56,18 +54,18 @@ if (!isFormSent()) { $menus = array(); $titles = array(); $below = array(); // Get all available main menus - $result = SQL_QUERY("SELECT - `action`, `title`, `sort` + $result_menu = SQL_QUERY("SELECT + `action`,`title`,`sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result_menu)) { // Read menu structure // @TODO Cant this be rewritten? - while ($content = SQL_FETCHARRAY($result)) { + while ($content = SQL_FETCHARRAY($result_menu)) { // Menu actions $menus[] = $content['action']; @@ -78,9 +76,6 @@ ORDER BY $below[] = $content['sort'] + 1; } // END - while - // Free memory - SQL_FREERESULT($result); - // Remove double eintries // @TODO This can be somehow rewritten to a function $prev = ''; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below; @@ -103,7 +98,7 @@ ORDER BY foreach ($menus as $key_main => $value_main) { // Query for sub menus $result = SQL_QUERY_ESC("SELECT - `what`, `title`, `sort` + `what`,`title`,`sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE @@ -112,7 +107,7 @@ WHERE `what` IS NOT NULL ORDER BY `sort` ASC", array($value_main), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Initialize arrays $menus[$value_main] = array(); $titles[$value_main] = array(); @@ -128,10 +123,7 @@ ORDER BY `sort` ASC", // Below this menu point should the new be added so we simply increase the sort value by 1 :-) $below[$value_main][] = $content['sort'] + 1; - } - - // Free memory - SQL_FREERESULT($result); + } // END - while // Remove double eintries // @TODO This can be somehow rewritten to a function @@ -144,34 +136,40 @@ ORDER BY `sort` ASC", } else { $prev = $value; } - } + } // END - foreach // Transfer dummy array $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3; - } - } - } + } // END - if + + // Free memory + SQL_FREERESULT($result); + } // END - foreach + } // END - if + + // Free memory + SQL_FREERESULT($result_menu); - $OUT = " + '; foreach ($below as $key => $m) { if (is_array($m)) { foreach ($m as $key2 => $m2) { - $OUT .= " \n"; + $OUT .= ''; } } else { - $OUT .= " \n"; + $OUT .= ''; } } - $OUT .= ""; + $OUT .= ''; // Prepare selections for template $content['below_selection'] = $OUT; @@ -179,33 +177,33 @@ ORDER BY `sort` ASC", $content['action_selection'] = adminAddMenuSelectionBox('guest', 'action', 'menu'); // Display form - loadTemplate('admin_guest_add', false, $content); + loadTemplate('admin_add_guest_menu', false, $content); } elseif (!isDemoModeActive()) { // Insert new menu entry - if (isPostRequestParameterSet('menu')) { + if (isPostRequestElementSet('menu')) { SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')", array( - postRequestParameter('menu'), - postRequestParameter('name'), - postRequestParameter('title'), - bigintval(postRequestParameter('sort')), - postRequestParameter('visible'), - postRequestParameter('active'), + postRequestElement('menu'), + postRequestElement('name'), + postRequestElement('title'), + bigintval(postRequestElement('sort')), + postRequestElement('visible'), + postRequestElement('active'), ), __FILE__, __LINE__); } else { - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')", + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s')", array( - postRequestParameter('name'), - postRequestParameter('title'), - bigintval(postRequestParameter('sort')), - postRequestParameter('visible'), - postRequestParameter('active'), + postRequestElement('name'), + postRequestElement('title'), + bigintval(postRequestElement('sort')), + postRequestElement('visible'), + postRequestElement('active'), ), __FILE__, __LINE__); } - loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}'); + displayMessage('{--SETTINGS_SAVED--}'); } else { // Demo mode! - loadTemplate('admin_settings_saved', false, '{--SETTINGS_NOT_SAVED--}'); + displayMessage('{--SETTINGS_NOT_SAVED--}'); } // [EOF]