]> git.mxchange.org Git - mailer.git/commitdiff
Fixed a version problem which causes admin logins to fail if ext-admins is installed
authorRoland Häder <roland@mxchange.org>
Sat, 7 Mar 2009 17:43:52 +0000 (17:43 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 7 Mar 2009 17:43:52 +0000 (17:43 +0000)
inc/modules/admin/admin-inc.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-overview.php

index d668fbaacd7d4447dedffe3820c367fc7cff8fe4..024b3f2e5d390cf3dcdf4ec7f03a9cd7526200a2 100644 (file)
@@ -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 .= "<tr>
        <td class=\"admin_menu\" colspan=\"2\">
                <nobr>&nbsp;<strong>&middot;</strong>&nbsp;";
+
                                if (($menu == $act) && (empty($wht))) {
                                        $OUT .= "<strong>";
                                } else {
@@ -371,12 +372,14 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) {
                                } else {
                                        $OUT .= "</a>]";
                                }
+
                                $OUT .= "</nobr></td>
 </tr>\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 .= "<tr>
@@ -437,6 +440,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) {
        </td>
 </tr>\n";
                                }
+
                                $OUT .= "<tr><td height=\"7\" colspan=\"2\"></td></tr>\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... :(
index 6d1b8bdd7ab36ae69ecab3ced8ca567b8476c84b..ffc910af656ca27fb05e486eea73676982476da0 100644 (file)
@@ -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
index 7214a8482e95c37e755baffdf5864d241984936f..9176b32204b276a1f5776ca0d4c6c514b28c5a20 100644 (file)
@@ -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);