Endless redirect fixed and needless action/what sets removed
[mailer.git] / inc / mysql-manager.php
index 95fc006a8423946b4e46c308a29315570220126a..bd453fac30a4aa7c3b1f44fd84a53c971608df86 100644 (file)
@@ -326,7 +326,7 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false) {
                if (isAdmin()) $ADD = '';
 
                $dummy = substr($search, 0, -4);
-               $ADD .= " AND `action`='".getModeAction($accessLevel, $dummy)."'";
+               $ADD .= " AND `action`='".getActionFromModuleWhat($accessLevel, $dummy)."'";
        } elseif (($accessLevel == 'sponsor') || ($accessLevel == 'engine')) {
                // Sponsor / engine menu
                $type     = 'what';
@@ -870,29 +870,29 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) {
 }
 
 // Get action value from mode (admin/guest/member) and what-value
-function getModeAction ($mode, $what) {
+function getActionFromModuleWhat ($module, $what) {
        // Init status
        $data['action'] = '';
 
-       //* DEBUG: */ print(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=<br />");
+       //* DEBUG: */ print(__LINE__.'='.$module.'/'.$what.'/'.getAction()."=<br />");
        if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
                // sql_patches is missing so choose depending on mode
                if (isWhatSet()) {
                        // Use setted what
                        $what = getWhat();
-               } elseif ($mode == 'admin') {
+               } elseif ($module == 'admin') {
                        // Admin area
                        $what = 'overview';
                } else {
                        // Everywhere else
                        $what = 'welcome';
                }
-       } elseif ((empty($what)) && ($mode != 'admin')) {
+       } elseif ((empty($what)) && ($module != 'admin')) {
                // Use configured 'home'
                $what = getConfig('index_home');
        } // END - if
 
-       if ($mode == 'admin') {
+       if ($module == 'admin') {
                // Action value for admin area
                if (isGetRequestParameterSet('action')) {
                        // Use from request!
@@ -908,19 +908,19 @@ function getModeAction ($mode, $what) {
                // Get it directly from URL
                return getAction();
        }
-       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): ret=".$data['action'].'<br />');
+       //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ret=' . $data['action'] . '<br />');
 
        // Does the module have a menu?
-       if (ifModuleHasMenu($mode)) {
+       if (ifModuleHasMenu($module)) {
                // Rewriting modules to menu
-               $mode = mapModuleToTable($mode);
+               $module = mapModuleToTable($module);
 
                // Guest and member menu is 'main' as the default
                if (empty($data['action'])) $data['action'] = 'main';
 
                // Load from database
                $result = SQL_QUERY_ESC("SELECT `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `what`='%s' LIMIT 1",
-                       array($mode, $what), __FUNCTION__, __LINE__);
+                       array($module, $what), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load action value and pray that this one is the right you want... ;-)
                        $data = SQL_FETCHARRAY($result);
@@ -928,7 +928,7 @@ function getModeAction ($mode, $what) {
 
                // Free memory
                SQL_FREERESULT($result);
-       } elseif ((!isExtensionInstalled('sql_patches')) && (($mode != 'admin') && ($mode != 'unknown'))) {
+       } elseif ((!isExtensionInstalled('sql_patches')) && ($module != 'admin') && ($module != 'unknown')) {
                // No sql_patches installed, but maybe we need to register an admin?
                if (isAdminRegistered()) {
                        // Redirect to admin area