Fix for if session has expired and user is still in login area
[mailer.git] / inc / modules / login.php
index 1c796983da8fd78f216d6af68b833c1993f33ca1..06c4ffb97b7eef26451804c53eada28a86c7020b 100644 (file)
@@ -42,13 +42,13 @@ if (!defined('__SECURITY')) {
        require($INC);
 } elseif (!IS_MEMBER()) {
        $URL = 'modules.php?module=index';
-       if ($check == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY') . '&mod='.$GLOBALS['module'];
+       if (checkModulePermissions('login') == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY') . '&mod='.getModule();
        redirectToUrl($URL);
 }
 
-if ($status != 'CONFIRMED') {
+if ($GLOBALS['status'] != 'CONFIRMED') {
        // If the status is different than confirmed move the user away from here
-       $errorCode = generateErrorCodeFromUserStatus($status);
+       $errorCode = generateErrorCodeFromUserStatus($GLOBALS['status']);
 
        // Load URL
        redirectToUrl('modules.php?module=index&what=login&login=' . $errorCode);
@@ -58,7 +58,7 @@ if ($status != 'CONFIRMED') {
 define('__MEMBER_ADVERT', LOAD_TEMPLATE('member_banner', true));
 
 // Disable block mode by default
-$GLOBALS['block_mode'] = false;
+enableBlockMode(false);
 
 // Generate a tableset for the menu title and content
 LOAD_TEMPLATE('member_header');
@@ -68,23 +68,26 @@ OUTPUT_HTML("<tr>
   <td class=\"member_menu\">");
 
 // Adding the main content module here
-if (empty($GLOBALS['action'])) {
-       if (empty($GLOBALS['what'])) $GLOBALS['what'] = 'welcome';
+if (!isActionSet()) {
+       if (!isWhatSet()) setWhat('welcome');
 } else {
-       $act = SQL_ESCAPE($GLOBALS['action']);
+       $act = getAction();
 }
 
 // Add the member's menu here...
 if ((getConfig('member_menu') == 'Y') || (!EXT_IS_ACTIVE('sql_patches', true))) {
-       ADD_MENU('member', getModeAction('member', $GLOBALS['what']), $GLOBALS['what']);
+       ADD_MENU('member', getModeAction('member', getWhat()), getWhat());
 } // END - if
 
+// Disable block-mode again
+enableBlockMode(false);
+
 // Menu -> content
 OUTPUT_HTML("   </td>
   <td valign=\"top\" align=\"center\" rowspan=\"3\" class=\"member_content\">");
 
 $INC = sprintf("inc/modules/member/action-%s.php", $act);
-if ((isIncludeReadable($INC)) && (isMenuActionValid('member', $GLOBALS['action'], $GLOBALS['what']))) {
+if ((isIncludeReadable($INC)) && (isMenuActionValid('member', getAction(), getWhat()))) {
        // Requested module is available so we load it
        loadInclude($INC);
 } else {