$confirm) { if ($confirm == 1) { $count++; $result = SQL_QUERY_ESC("SELECT `title`,`action`,`what`,`descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval($sel)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Entry found so we load the stuff... $content = SQL_FETCHARRAY($result); // Prepare data for the row template $content = array( 'action' => adminAddMenuSelectionBox('admin', 'action', 'sel_action[' . $sel . ']', $content['action']), 'what' => adminAddMenuSelectionBox('admin', 'what' , 'sel_what[' . $sel . ']', $content['what']), 'sel' => $sel, 'menu' => $content['title'], 'descr' => $content['descr'], 'count' => $count, ); // Load row template $OUT .= loadTemplate('admin_edit_admin_menu_row', true, $content); } else { // Entry not found? $content = array( 'sel' => $sel ); // Load row template $OUT .= loadTemplate('admin_menu_404_row', true, $content); } // Free result and switch color SQL_FREERESULT($result); } // END - if } // END - foreach $content['rows'] = $OUT; $content['sub'] = $subMenu; $content['chk'] = countPostSelection(); $content['count'] = $count; // Load template loadTemplate('admin_edit_admin_menu_form', false, $content); } elseif ((isFormSent('delete')) && (ifPostContainsSelections()) && (!isDemoModeActive())) { // Prepare misc content $content['sub'] = $subMenu; $content['chk'] = countPostSelection(); // Del menu entries with or without confirmation $count = '0'; $OUT = ''; foreach (postRequestElement('sel') as $sel => $confirm) { if ($confirm == 1) { $count++; $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval($sel)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Entry found so we load the stuff... $content = SQL_FETCHARRAY($result); // Prepare data for the row template $content = array( 'menu' => $content['title'], 'count' => $count, 'sel' => $sel, ); $OUT .= loadTemplate('admin_delete_admin_menu_row', true, $content); } else { // Entry not found? $content = array( 'sel' => $sel ); $OUT .= loadTemplate('admin_menu_404_row', true, $content); } SQL_FREERESULT($result); } // END - if } // END - switch $content['rows'] = $OUT; $content['sub'] = $subMenu; $content['chk'] = countPostSelection(); $content['count'] = $count; // Load template loadTemplate('admin_delete_admin_menu', false, $content); } elseif ((isFormSent()) && (!isDemoModeActive())) { // An action is done... switch (postRequestElement('ok')) { case 'edit': // Edit menu foreach (postRequestElement('sel') as $sel => $menu) { // Secure id $sel = bigintval($sel); // Update entry SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title`='%s', `action`='%s', `what`='%s', `descr`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1", array( $menu, postRequestElement('sel_action', $sel), postRequestElement('sel_what', $sel), postRequestElement('sel_desc', $sel), $sel, ), __FILE__, __LINE__); } // Load template displayMessage('{--SETTINGS_SAVED--}'); break; case 'delete': // Delete menu foreach (postRequestElement('sel') as $sel => $menu) { SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." AND `id`=%s LIMIT 1", array(bigintval($sel)), __FILE__, __LINE__); } // END - foreach // Load template displayMessage('{--SETTINGS_SAVED--}'); break; default: // Unexpected action logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestElement('ok'))); displayMessage('{%message,ADMIN_UNKNOWN_OKAY=' . postRequestElement('ok') . '%}'); break; } // END - switch } else { // Handle weightning doAdminProcessMenuWeightning('admin', $AND); // Run SQL $result = SQL_QUERY("SELECT `id`,`action`,`what`,`title`,`sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__); // Do we have entries? if (!SQL_HASZERONUMS($result)) { // Init variables $OUT = ''; $count = '0'; // Process all entries while ($content = SQL_FETCHARRAY($result)) { // Remember sub value $content['sub'] = $subMenu; // Count this entry $count++; // Init navigation variable $content['navi'] = ''; if (($content['sort'] == '0') || (($content['sort'] == 1) && (!empty($subMenu)))) { // Is highest position $content['navi'] = '{--LOWER--}'; } elseif ($count == SQL_NUMROWS($result)) { // Is lowest position $content['navi'] = '{--HIGHER--}'; } elseif ($content['sort'] > 0) { // Anything else between highest and lowest $content['navi'] = '{--HIGHER--}|{--LOWER--}'; } // Add more data to $content $content['mode'] = 'admin'; // Load row template and switch colors $OUT .= loadTemplate('admin_menu_overview_row', true, $content); } // END - switch // Remember all rows $content['rows'] = $OUT; $content['sub'] = $subMenu; // Free memory SQL_FREERESULT($result); // Load template loadTemplate('admin_edit_admin_menu', false, $content); } else { // Menu entries are missing... (???) displayMessage('{--ADMIN_NO_MENUS_FOUND--}'); } } // ?>