X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-mem_add.php;h=8ed6dea0029b287ac0b0e4fbce1da1448cbcc619;hp=3cfdd7efe7004e4e49e4a5d0622c0feb3aa4a2f7;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=a090e351c49fe021fb3064325694da03402332e0 diff --git a/inc/modules/admin/what-mem_add.php b/inc/modules/admin/what-mem_add.php index 3cfdd7efe7..8ed6dea002 100644 --- a/inc/modules/admin/what-mem_add.php +++ b/inc/modules/admin/what-mem_add.php @@ -1,7 +1,7 @@ 0) { + if (!ifSqlHasZeroNumRows($result)) { // Read menu structure - while ($content = SQL_FETCHARRAY($result)) { + // @TODO Cant this be rewritten? + while ($content = sqlFetchArray($result)) { // 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 - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Remove double eintries // @TODO This can be somehow rewritten to a function - $prev = ''; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below; + $prev = ''; + $dmy = $menus; + $dmy2 = $titles; + $dmy3 = $below; foreach ($menus as $key => $value) { if ($value == $prev) { // Remove entries @@ -93,28 +97,28 @@ 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!}_member_menu` WHERE `action`='%s' AND `what` != '' ORDER BY `sort`", + $result = sqlQueryEscaped("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' 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['action']; + 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; + array_push($below[$value_main], $content['sort'] + 1); } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Remove double eintries // @TODO This can be somehow rewritten to a function @@ -137,58 +141,59 @@ if (!IS_FORM_SENT()) { } // END - foreach } // END - if - $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 .= ''; + } // END - foreach } else { - $OUT .= " \n"; + $OUT .= ''; } } - $OUT .= ""; + $OUT .= ''; - define('__BELOW_SELECTION' , $OUT); - define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION('member', "what", "name")); - define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION('member', "action", "menu")); + // Prepare selection boxes 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_member_add"); -} elseif (!IS_DEMO()) { + loadTemplate('admin_add_member_menu', FALSE, $content); +} elseif (!isDemoModeActive()) { // Insert new menu entry - if (REQUEST_ISSET_POST(('menu'))) { - SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s','%s')", + if (isPostRequestElementSet('menu')) { + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`, `what`, `title`, `visible`, `locked`, `sort`) VALUES ('%s','%s','%s','%s','%s','%s')", array( - REQUEST_POST('menu'), - REQUEST_POST('name'), - REQUEST_POST('title'), - REQUEST_POST('visible'), - REQUEST_POST('active'), - bigintval(REQUEST_POST('sort')), + postRequestElement('menu'), + postRequestElement('name'), + postRequestElement('title'), + postRequestElement('visible'), + postRequestElement('active'), + bigintval(postRequestElement('sort')), ), __FILE__, __LINE__); } else { - SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s')", + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`, `title`, `visible`, `locked`, `sort`) VALUES ('%s','%s','%s','%s','%s')", array( - REQUEST_POST('name'), - REQUEST_POST('title'), - REQUEST_POST('visible'), - REQUEST_POST('active'), - bigintval(REQUEST_POST('sort')), + postRequestElement('name'), + postRequestElement('title'), + postRequestElement('visible'), + postRequestElement('active'), + bigintval(postRequestElement('sort')), ), __FILE__, __LINE__); } - LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED')); + displayMessage('{--SETTINGS_SAVED'); } else { // Demo mode! - LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED')); + displayMessage('{--SETTINGS_NOT_SAVED--}'); } -// +// [EOF] ?>