Fixed continuation after authorization timeout.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 4 Feb 2010 20:45:35 +0000 (20:45 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 4 Feb 2010 20:45:35 +0000 (20:45 +0000)
access/login.php
includes/main.inc
includes/page/footer.inc
includes/session.inc

index efdd276dad79b6ac6e4620b5294f0b0b30adcbe7..210d61d4ca29f15c27249d9078d142976d744f58 100644 (file)
@@ -51,21 +51,22 @@ function set_fullmode() {
        echo "<html dir='$rtl' >\n";
        echo "<head><title>$title</title>\n";
        echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding' />\n";
-       echo "<link href='$path_to_root/themes/$def_theme/login.css' rel='stylesheet' type='text/css'> \n";
-       echo $js2;
+       echo "<link href='$path_to_root/themes/$def_theme/default.css' rel='stylesheet' type='text/css'> \n";
        if (!$login_timeout)
        {
                echo $js;
        }       
+       echo $js2;
        echo "</head>\n";
 
-       echo "<body $onload>\n";
+       echo "<body id='loginscreen' $onload>\n";
 
        echo "<table class='titletext'><tr><td>$title</td></tr></table>\n";
        
+       div_start('_page_body');
        br();br();
        start_form(false, false, $_SESSION['timeout']['uri'], "loginform");
-       start_table($table_style2);
+       start_table("class='login' $table_style2");
        start_row();
        echo "<td align='center' colspan=2>";
        if (!$login_timeout) { // FA logo
@@ -103,8 +104,8 @@ function set_fullmode() {
                end_row();
        }; 
        end_table(1);
-       echo "<center><input type='submit' value='&nbsp;&nbsp;"._("Login -->")."&nbsp;&nbsp;' name='SubmitUser' onclick='set_fullmode();' /></center>\n";
-       end_form(1);
+       echo "<center><input type='submit' value='&nbsp;&nbsp;"._("Login -->")."&nbsp;&nbsp;' name='SubmitUser'"
+               .($login_timeout ? '':" onclick='set_fullmode();'")." /></center>\n";
 
        foreach($_SESSION['timeout']['post'] as $p => $val) {
                // add all request variables to be resend together with login data
@@ -112,6 +113,7 @@ function set_fullmode() {
                        'password', 'SubmitUser', 'company_login_name'))) 
                        echo "<input type='hidden' name='$p' value='$val'>";
        }
+       end_form(1);
     echo "<script language='JavaScript' type='text/javascript'>
     //<![CDATA[
             <!--
@@ -120,6 +122,7 @@ function set_fullmode() {
             //-->
     //]]>
     </script>";
+    div_end();
        echo "<table class='bottomBar'>\n";
        echo "<tr>";
        if (isset($_SESSION['wa_current_user'])) 
index 138ae369a53eca55ad3cb3fd76ffbf73bcff3f96..0a63e397571a00555979716730d367f832848a52 100644 (file)
@@ -50,11 +50,14 @@ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $scri
 
 function end_page($no_menu=false, $is_index=false, $hide_back_link=false)
 {
-       global $path_to_root, $Ajax;
-       $hide_menu = $no_menu;
-               div_end();      // _page_body section
-       include($path_to_root . "/includes/page/footer.inc");
-       page_footer($no_menu, $is_index, $hide_back_link);
+       global $path_to_root;
+
+       if (!$is_index && !$hide_back_link && function_exists('hyperlink_back'))
+               hyperlink_back();
+       div_end();      // end of _page_body section
+
+       include($path_to_root . "/includes/page/footer.inc");
+       page_footer($no_menu, $is_index, $hide_back_link);
 }
 
 function flush_dir($path, $wipe = false) 
index e07f69838a5b900b126c5fc739b37eae7c9cae48..23318932abfc68376ad4f2f4d76043fb29b59f23 100644 (file)
@@ -13,8 +13,6 @@ function page_footer($no_menu=false, $is_index=false, $hide_back_link=false)
 {
        global $path_to_root, $js_lib, $Validate, $Editors, $Ajax;
 
-       if (!$is_index && !$hide_back_link && function_exists('hyperlink_back'))
-               hyperlink_back();
        include_once($path_to_root."/themes/".user_theme()."/renderer.php");
        $rend = new renderer();
        $rend->menu_footer($no_menu, $is_index);
index 8929ff2e4341e83a777b7e75ebd4fb7d76e8789c..af62f7fff5a537ee40d8eccb79d304060d220733 100644 (file)
@@ -221,16 +221,14 @@ if (strstr($_SERVER['PHP_SELF'], 'logout.php') == false){
                // Show login screen
                if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "")
                {
-                       $_SESSION['timeout'] = array( 'uri'=> $_SERVER['REQUEST_URI'],
+                       // strip ajax marker from uri, to force synchronous page reload
+                       $_SESSION['timeout'] = array( 'uri'=>preg_replace('/JsHttpRequest=(?:(\d+)-)?([^&]+)/s',
+                                       '', @$_SERVER['REQUEST_URI']), 
                                'post' => $_POST);
 
-                       if (!in_ajax()) {
-                               include($path_to_root . "/access/login.php");
-                       } else {
-                               // ajax update of current page elements - open login window in popup
-                               // to not interfere with ajaxified page.
-                               $Ajax->popup($path_to_root . "/access/timeout.php");
-                       }
+                       include($path_to_root . "/access/login.php");
+                       if (in_ajax())
+                               $Ajax->activate('_page_body');
                        exit;
                } else {
                        $succeed = $_SESSION["wa_current_user"]->login($_POST["company_login_name"],
@@ -257,7 +255,6 @@ if (strstr($_SERVER['PHP_SELF'], 'logout.php') == false){
        }
 }
 
-
 // POST vars cleanup needed for direct reuse.
 // We quote all values later with db_escape() before db update.
        $_POST = strip_quotes($_POST);