<?
- define(SCHEMA_VERSION, 1);
+ define(SCHEMA_VERSION, 2);
$op = $_GET["op"];
pg_query("set client_encoding = 'utf-8'");
}
+/*
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
$schema_version = db_fetch_result($result, 0, "schema_version");
(got version $schema_version; expected ".SCHEMA_VERSION.")";
return;
}
-
+*/
+
$fetch = $_GET["fetch"];
/* FIXME this needs reworking */
print "Marked active page as read.";
}
+
+ if ($subop == "sanityCheck") {
+
+ $error_code = 0;
+
+ $result = db_query($link, "SELECT schema_version FROM ttrss_version");
+
+ $schema_version = db_fetch_result($result, 0, "schema_version");
+
+ if ($schema_version != SCHEMA_VERSION) {
+ $error_code = 5;
+ }
+
+ print "<error code='$error_code'/>";
+ }
}
if ($op == "feeds") {
}
}
+function backend_sanity_check_callback() {
+
+ if (xmlhttp.readyState == 4) {
+
+ if (!xmlhttp.responseXML) {
+ fatalError(3);
+ return;
+ }
+
+ var reply = xmlhttp.responseXML.firstChild;
+
+ if (!reply) {
+ fatalError(3);
+ return;
+ }
+
+ var error_code = reply.getAttribute("code");
+
+ if (error_code && error_code != 0) {
+ return fatalError(error_code);
+ }
+
+ init_second_stage();
+ }
+}
+
function updateFeed(feed_id) {
var query_str = "backend.php?op=rpc&subop=updateFeed&feed=" + feed_id;
function genericSanityCheck() {
- if (!xmlhttp) {
+ if (!xmlhttp) fatalError(1);
+
+ setCookie("ttrss_vf_test", "TEST");
+
+ if (getCookie("ttrss_vf_test") != "TEST") {
+ fatalError(2);
+ }
+
+/* if (!xmlhttp) {
document.getElementById("headlines").innerHTML =
"<b>Fatal error:</b> This program requires XmlHttpRequest " +
"to function properly. Your browser doesn't seem to support it.";
"to function properly. Your browser doesn't seem to support them.";
return false;
- }
+ } */
return true;
}
if (!genericSanityCheck())
return;
+ xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck", true);
+ xmlhttp.onreadystatechange=backend_sanity_check_callback;
+ xmlhttp.send(null);
+
+}
+
+function init_second_stage() {
+
setCookie("ttrss_vf_actfeed", "");
updateFeedList(false, false);
document.onkeydown = hotkey_handler;
- setTimeout("timeout()", 1800*1000);
- scheduleFeedUpdate(true);
-
var content = document.getElementById("content");
if (getCookie("ttrss_vf_vmode")) {
// viewfeed(getCookie("ttrss_vf_actfeed"), 0, '');
// }
+ setTimeout("timeout()", 2*1000);
+// scheduleFeedUpdate(true);
+
+
}
function quickMenuGo() {
}
}
+
+