summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--errors.php15
-rw-r--r--functions.js44
-rw-r--r--login_form.php13
-rw-r--r--tt-rss.js4
-rw-r--r--tt-rss.php1
5 files changed, 55 insertions, 22 deletions
diff --git a/errors.php b/errors.php
index b2e0841a3..cd76d10a6 100644
--- a/errors.php
+++ b/errors.php
@@ -1,4 +1,5 @@
<?php
+ require_once "functions.php";
$ERRORS[0] = __("Unknown error");
@@ -30,4 +31,18 @@
$ERRORS[11] = "[This error is not returned by server]";
$ERRORS[12] = __("SQL escaping test failed, check your database and PHP configuration");
+
+ if ($_REQUEST['mode'] == 'js') {
+ header("Content-Type: text/plain; charset=UTF-8");
+
+ print "var ERRORS = [];\n";
+
+ foreach ($ERRORS as $id => $error) {
+
+ $error = preg_replace("/\n/", "", $error);
+ $error = preg_replace("/\"/", "\\\"", $error);
+
+ print "ERRORS[$id] = \"$error\";\n";
+ }
+ }
?>
diff --git a/functions.js b/functions.js
index 67d7b4f23..88365d70a 100644
--- a/functions.js
+++ b/functions.js
@@ -503,8 +503,6 @@ function setInitParam(key, value) {
function fatalError(code, msg, ext_info) {
try {
- if (!ext_info) ext_info = "N/A";
-
if (code == 6) {
window.location.href = "tt-rss.php";
} else if (code == 5) {
@@ -513,28 +511,36 @@ function fatalError(code, msg, ext_info) {
if (msg == "") msg = "Unknown error";
- var ebc = $("xebContent");
-
- if (ebc) {
-
- Element.show("dialog_overlay");
- Element.show("errorBoxShadow");
- Element.hide("xebBtn");
-
- if (ext_info) {
- if (ext_info.responseText) {
- ext_info = ext_info.responseText;
- }
+ if (ext_info) {
+ if (ext_info.responseText) {
+ ext_info = ext_info.responseText;
}
+ }
+
+ if (ERRORS && ERRORS[code] && !msg) {
+ msg = ERRORS[code];
+ }
- ebc.innerHTML =
- "<div><b>Error message:</b></div>" +
- "<pre>" + msg + "</pre>" +
- "<div><b>Additional information:</b></div>" +
- "<textarea readonly=\"1\">" + ext_info + "</textarea>";
+ var content = "<div><b>Error code:</b> " + code + "</div>" +
+ "<p>" + msg + "</p>";
+
+ if (ext_info) {
+ content = content + "<div><b>Additional information:</b></div>" +
+ "<textarea style='width: 100%' readonly=\"1\">" +
+ ext_info + "</textarea>";
}
+
+ var dialog = new dijit.Dialog({
+ title: "Fatal error",
+ style: "width: 600px",
+ content: content});
+
+ dialog.show();
+
}
+ return false;
+
} catch (e) {
exception_error("fatalError", e);
}
diff --git a/login_form.php b/login_form.php
index 14882b34f..141f3f0bf 100644
--- a/login_form.php
+++ b/login_form.php
@@ -1,19 +1,30 @@
<html>
<head>
<title>Tiny Tiny RSS : Login</title>
+ <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
<link rel="stylesheet" type="text/css" href="tt-rss.css">
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <script type="text/javascript" src="lib/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" src="lib/prototype.js"></script>
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
<script type="text/javascript" src="functions.js"></script>
+ <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
</head>
-<body id="ttrssLogin">
+<body id="ttrssLogin" class="claro">
<script type="text/javascript">
function init() {
+ dojo.require("dijit.Dialog");
+
+ var test = setCookie("ttrss_test", "TEST");
+
+ if (getCookie("ttrss_test") != "TEST") {
+ return fatalError(2);
+ }
+
var limit_set = getCookie("ttrss_bwlimit");
if (limit_set == "true") {
diff --git a/tt-rss.js b/tt-rss.js
index 5884d8d4e..5b4947b4c 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -266,7 +266,7 @@ function genericSanityCheck() {
setCookie("ttrss_test", "TEST");
if (getCookie("ttrss_test") != "TEST") {
- fatalError(2);
+ return fatalError(2);
}
return true;
@@ -314,7 +314,7 @@ function init() {
});
if (!genericSanityCheck())
- return;
+ return false;
loading_set_progress(20);
diff --git a/tt-rss.php b/tt-rss.php
index b4f8dc293..49c882db0 100644
--- a/tt-rss.php
+++ b/tt-rss.php
@@ -41,6 +41,7 @@
<script type="text/javascript" charset="utf-8" src="functions.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" charset="utf-8" src="feedlist.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" charset="utf-8" src="viewfeed.js?<?php echo $dt_add ?>"></script>
+ <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>