From a58bc1bbba1400ebc78f906a5c18881ff9b15fe4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 7 Mar 2009 17:43:52 +0000 Subject: [PATCH] Fixed a version problem which causes admin logins to fail if ext-admins is installed --- inc/modules/admin/admin-inc.php | 17 +++++++++++++---- inc/modules/admin/overview-inc.php | 13 ++++++------- inc/modules/admin/what-overview.php | 18 ++++++++++-------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index d668fbaacd..024b3f2e5d 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -85,7 +85,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) { incrementConfigEntry('cache_hits'); // Include more admins data? - if (GET_EXT_VERSION("admins") >= "0.7.0") { + if (GET_EXT_VERSION("admins") >= "0.7.2") { // Load them here $data['login_failures'] = $GLOBALS['cache_array']['admins']['login_failures'][$aid]; $data['last_failure'] = $GLOBALS['cache_array']['admins']['last_failure'][$aid]; @@ -358,6 +358,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) { $OUT .= "  · "; + if (($menu == $act) && (empty($wht))) { $OUT .= ""; } else { @@ -371,12 +372,14 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) { } else { $OUT .= "]"; } + $OUT .= " \n"; + + // Check for menu entries $result_what = SQL_QUERY_ESC("SELECT what, title, descr FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`, id DESC", array($menu), __FUNCTION__, __LINE__); - if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)) - { + if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)) { $GLOBALS['menu']['description'] = array(); $GLOBALS['menu']['title'] = array(); $SUB = true; $OUT .= " @@ -437,6 +440,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) { \n"; } + $OUT .= "\n"; } } @@ -683,7 +687,8 @@ function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") { // Return contents return $OUT; } -// + +// Creates a user-profile link for the admin. This function can also be used for many other purposes function ADMIN_USER_PROFILE_LINK ($uid, $title="", $wht="list_user") { if (($title == "") && ($title != "0")) { // Set userid as title @@ -1215,6 +1220,7 @@ function ADMIN_VALIDATE_RESET_LINK_HASH_LOGIN ($hash, $login) { // Return result return $valid; } + // Reset the password for the login. Do NOT call this function without calling above function first! function ADMIN_RESET_PASSWORD ($login, $password) { // Init hash @@ -1239,16 +1245,19 @@ function ADMIN_RESET_PASSWORD ($login, $password) { // Return output return ADMIN_PASSWORD_RESET_DONE; } + // Solves a task by given id number function ADMIN_SOLVE_TASK ($id) { // Update the task data ADMIN_UPDATE_TASK_DATA($id, "status", "SOLVED"); } + // Marks a given task as deleted function ADMIN_DELETE_TASK ($id) { // Update the task data ADMIN_UPDATE_TASK_DATA($id, "status", "DELETED"); } + // Function to update task data function ADMIN_UPDATE_TASK_DATA ($id, $row, $data) { // Is the id not set, then we need a backtrace here... :( diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 6d1b8bdd7a..ffc910af65 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -49,7 +49,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) { // We currently don't want to install an extension so let's find out if we need... $EXT_LOAD_MODE = "register"; - $JOBS_DONE = true; + $jobsDone = true; // Open the extension directory $handle = opendir(constant('PATH')."inc/extensions/") or mxchange_die("Cannot read extension directory!"); @@ -110,19 +110,18 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", if (SQL_NUMROWS($result_tasks) > 0) { // New jobs found! - $JOBS_DONE = false; + $jobsDone = false; } // END - if // Free the result SQL_FREERESULT($result); // Return status - return $JOBS_DONE; + return $jobsDone; } // Outputs selected tasks function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { - global $NOTES; if ((isset($POST['assign'])) && (count($POST['task']) > 0)) { // Assign / do tasks $OUT = ""; $SW = 2; @@ -175,7 +174,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { SET_SQLS(EXTENSION_REGISTER($ext_name, $id, true)); // Add notes to text - $text .= $NOTES; + $text .= EXT_GET_NOTES(); // Set title $title = getMessage('ADMIN_SQLS_EXECUTED_ON_REGISTER'); @@ -191,7 +190,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { EXTENSION_UPDATE($ext_name, $ext_ver, true); // Add notes to text - $text .= $NOTES; + $text .= EXT_GET_NOTES(); // Set title $title = getMessage('ADMIN_SQLS_EXECUTED_ON_UPDATE'); @@ -210,7 +209,7 @@ function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) { } else { // Run SQL commands in dry mode but only return the notes EXTENSION_UPDATE($ext_name, $ext_ver, true); - $text .= $NOTES; + $text .= EXT_GET_NOTES(); } // Prepare array for the template diff --git a/inc/modules/admin/what-overview.php b/inc/modules/admin/what-overview.php index 7214a8482e..9176b32204 100644 --- a/inc/modules/admin/what-overview.php +++ b/inc/modules/admin/what-overview.php @@ -48,28 +48,30 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Otherwise load include file 'overview-inc' (old standard overview page) LOAD_INC_ONCE("inc/modules/admin/overview-inc.php"); -$JOBS_DONE = true; +$jobsDone = true; $taskExt = false; // Default is that "task" is not installed // When the admin is logging in check several things first (new jobs to complete and so on) if ($GLOBALS['action'] == "login") { if (EXT_IS_ACTIVE("task")) { // When task extension is registered output advanced overview page - $JOBS_DONE = OUTPUT_ADVANCED_OVERVIEW($result_tasks); // This function is provided by the extension 'task' + $jobsDone = OUTPUT_ADVANCED_OVERVIEW($result_tasks); // This function is provided by the extension 'task' $taskExt = true; } else { // Output standart overview (provided by overview-inc.php) - $JOBS_DONE = OUTPUT_STANDARD_OVERVIEW($result_tasks); + $jobsDone = OUTPUT_STANDARD_OVERVIEW($result_tasks); } } // END - if -// Are there jobs to be done? -if ($JOBS_DONE) { +// Are we in 'welcome' page and are there jobs to be done? +if ($GLOBALS['action'] != "login") { + // This menu is empty and so no content is displayed + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_MENU_IS_EMPTY'), $GLOBALS['action'])); +} elseif ($jobsDone === true) { // Generate overview of all main menus if ((is_array($GLOBALS['menu']['description'])) && (count($GLOBALS['menu']['description']) > 0)) { $OUT = ""; - foreach ($GLOBALS['menu']['description'] as $key => $value) - { + foreach ($GLOBALS['menu']['description'] as $key => $value) { // Prepare content $content = array( 'title' => $GLOBALS['menu']['title'][$key], @@ -78,7 +80,7 @@ if ($JOBS_DONE) { // Load row template $OUT .= LOAD_TEMPLATE("admin_menu_hints_row", true, $content); - } + } // END - foreach // Load base template LOAD_TEMPLATE("admin_menu_hints", false, $OUT); -- 2.39.2