<?php
+ require_once "functions.php";
$ERRORS[0] = __("Unknown error");
$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";
+ }
+ }
?>
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) {
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);
}
<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") {
setCookie("ttrss_test", "TEST");
if (getCookie("ttrss_test") != "TEST") {
- fatalError(2);
+ return fatalError(2);
}
return true;
});
if (!genericSanityCheck())
- return;
+ return false;
loading_set_progress(20);
<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"/>