]> git.wh0rd.org - tt-rss.git/commitdiff
properly handle redirecting back to requested page after logging in (closes #302)
authorAndrew Dolgov <fox@fakecake.org>
Tue, 18 Jan 2011 13:47:52 +0000 (16:47 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Tue, 18 Jan 2011 13:47:52 +0000 (16:47 +0300)
backend.php
functions.php

index 962453c4be9bb5a0684ea627554b79f8de6d81ef..c7bd61808b7d2557ad1fd0d72f4dcec352e7ffb3 100644 (file)
                if ($op == "rpc" || $op == "viewfeed" || $op == "view") {
                        print_error_xml(6); die;
                } else {
-                       print "
-                       <html><body>
-                               <p>Error: Not logged in.</p>
-                               <script type=\"text/javascript\">
-                                       if (parent.window != 'undefined') {
-                                               parent.window.location = \"tt-rss.php\";                
-                                       } else {
-                                               window.location = \"tt-rss.php\";
-                                       }
-                               </script>
-                       </body></html>
-                       ";
+                       header("Location: tt-rss.php?return=" . 
+                               urlencode($_SERVER['REQUEST_URI']));
                }
                exit;
        }
index 64269aadac1ffb11bfbe84193e1b6a2c21919207..0bbefd58149a94094582675f1f6b08a3d7019fb5 100644 (file)
                                                }
                                        }
 
-                                       header("Location: " . $_SERVER["REQUEST_URI"]);
+                                       if ($_REQUEST['return']) {
+                                               header("Location: " . $_REQUEST['return']);
+                                       } else {
+                                               header("Location: " . $_SERVER["REQUEST_URI"]);
+                                       }
+
                                        exit;
 
                                        return;