X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-guest_add.php;h=b17b369e97621c8fbc569331156813620b479e66;hp=8db69b86c711ad8452f8e7aff5d15d2368e86c99;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=1c3cf7c8bd60ea09a2b268e37a2cb2d0ee0cdeef diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php index 8db69b86c7..b17b369e97 100644 --- a/inc/modules/admin/what-guest_add.php +++ b/inc/modules/admin/what-guest_add.php @@ -1,7 +1,7 @@ 0) { + + if (!ifSqlHasZeroNumRows($result_menu)) { // Read menu structure // @TODO Cant this be rewritten? - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result_menu)) { // Menu actions - $menus[] = $content['action']; + array_push($menus, $content['action']); // Menu titles - $titles[] = $content['title']; + array_push($titles, $content['title']); // Below this menu point should the new be added so we simply increase the sort value by 1 :-) - $below[] = $content['sort'] + 1; + array_push($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; @@ -101,7 +98,7 @@ ORDER BY // Load sub menus :) foreach ($menus as $key_main => $value_main) { // Query for sub menus - $result = SQL_QUERY_ESC("SELECT + $result = sqlQueryEscaped("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` @@ -111,26 +108,24 @@ WHERE `what` IS NOT NULL ORDER BY `sort` ASC", array($value_main), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) { + + if (!ifSqlHasZeroNumRows($result)) { // Initialize arrays $menus[$value_main] = array(); $titles[$value_main] = array(); $below[$value_main] = array(); // Read menu structure - while ($content = SQL_FETCHARRAY($result)) { + while ($content = sqlFetchArray($result)) { // Menu actions - $menus[$value_main][] = $content['what']; + array_push($menus[$value_main], $content['what']); // Menu titles - $titles[$value_main][] = $content['title']; + array_push($titles[$value_main], $content['title']); // 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); + array_push($below[$value_main], $content['sort'] + 1); + } // END - while // Remove double eintries // @TODO This can be somehow rewritten to a function @@ -143,46 +138,52 @@ 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 + sqlFreeResult($result); + } // END - foreach + } // END - if + + // Free memory + sqlFreeResult($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; - $content['what_selection'] = adminAddMenuSelectionBox('member', 'what' , 'name'); - $content['action_selection'] = adminAddMenuSelectionBox('member', 'action', 'menu'); + $content['what_selection'] = adminAddMenuSelectionBox('guest', 'what' , 'name'); + $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 (isPostRequestElementSet('menu')) { - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `what`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s','%s')", array( postRequestElement('menu'), postRequestElement('name'), @@ -192,7 +193,7 @@ ORDER BY `sort` ASC", 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')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')", array( postRequestElement('name'), postRequestElement('title'), @@ -201,10 +202,10 @@ ORDER BY `sort` ASC", postRequestElement('active'), ), __FILE__, __LINE__); } - loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED')); + displayMessage('{--SETTINGS_SAVED--}'); } else { // Demo mode! - loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED')); + displayMessage('{--SETTINGS_NOT_SAVED--}'); } // [EOF]