From: Andrew Dolgov Date: Sat, 19 Nov 2005 14:46:23 +0000 (+0100) Subject: automatically logout user when session expires X-Git-Tag: schema_feature_freeze_for_1.1~184 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=262bd8ea53c3e96bfeb1d82d952ab7cc2f67e8e4;p=tt-rss.git automatically logout user when session expires --- diff --git a/backend.php b/backend.php index 5cb58fb6..4b9d3a7f 100644 --- a/backend.php +++ b/backend.php @@ -1,7 +1,21 @@ "; + } + exit; + } define(SCHEMA_VERSION, 2); @@ -11,12 +25,6 @@ require_once "functions.php"; require_once "magpierss/rss_fetch.inc"; - $op = $_REQUEST["op"]; - - if (($op == "rpc" || $op == "updateAllFeeds") && !$_REQUEST["noxml"]) { - header("Content-Type: application/xml"); - } - $script_started = getmicrotime(); $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); @@ -417,7 +425,7 @@ $error_code = 5; } - print ""; + print ""; } if ($subop == "globalPurge") { diff --git a/error.php b/error.php index 1fd59ed7..1569d309 100644 --- a/error.php +++ b/error.php @@ -17,6 +17,12 @@ $ERRORS[5] = "Incorrect database schema version."; + $ERRORS[6] = "Not authorized."; + + if ($_GET["c"] == 6) { + header("Location: login.php"); + } + ?> diff --git a/tt-rss.js b/tt-rss.js index e6dbc1b9..70412fcb 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -70,7 +70,7 @@ function refetch_callback() { notify("refetch_callback: backend did not return valid XML"); return; } - + var reply = xmlhttp.responseXML.firstChild; if (!reply) { @@ -78,6 +78,12 @@ function refetch_callback() { return; } + var error_code = reply.getAttribute("error-code"); + + if (error_code && error_code != 0) { + return fatalError(error_code); + } + var f_document = window.frames["feeds-frame"].document; for (var l = 0; l < reply.childNodes.length; l++) { @@ -133,7 +139,7 @@ function backend_sanity_check_callback() { return; } - var error_code = reply.getAttribute("code"); + var error_code = reply.getAttribute("error-code"); if (error_code && error_code != 0) { return fatalError(error_code);