fix fatalError() not working properly
This commit is contained in:
parent
d195055341
commit
6853521166
15
errors.php
15
errors.php
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once "functions.php";
|
||||||
|
|
||||||
$ERRORS[0] = __("Unknown error");
|
$ERRORS[0] = __("Unknown error");
|
||||||
|
|
||||||
|
@ -30,4 +31,18 @@
|
||||||
$ERRORS[11] = "[This error is not returned by server]";
|
$ERRORS[11] = "[This error is not returned by server]";
|
||||||
|
|
||||||
$ERRORS[12] = __("SQL escaping test failed, check your database and PHP configuration");
|
$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";
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
36
functions.js
36
functions.js
|
@ -503,8 +503,6 @@ function setInitParam(key, value) {
|
||||||
function fatalError(code, msg, ext_info) {
|
function fatalError(code, msg, ext_info) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!ext_info) ext_info = "N/A";
|
|
||||||
|
|
||||||
if (code == 6) {
|
if (code == 6) {
|
||||||
window.location.href = "tt-rss.php";
|
window.location.href = "tt-rss.php";
|
||||||
} else if (code == 5) {
|
} else if (code == 5) {
|
||||||
|
@ -513,28 +511,36 @@ function fatalError(code, msg, ext_info) {
|
||||||
|
|
||||||
if (msg == "") msg = "Unknown error";
|
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) {
|
||||||
if (ext_info.responseText) {
|
if (ext_info.responseText) {
|
||||||
ext_info = ext_info.responseText;
|
ext_info = ext_info.responseText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ebc.innerHTML =
|
if (ERRORS && ERRORS[code] && !msg) {
|
||||||
"<div><b>Error message:</b></div>" +
|
msg = ERRORS[code];
|
||||||
"<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) {
|
} catch (e) {
|
||||||
exception_error("fatalError", e);
|
exception_error("fatalError", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,30 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Tiny Tiny RSS : Login</title>
|
<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="stylesheet" type="text/css" href="tt-rss.css">
|
||||||
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
|
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<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/prototype.js"></script>
|
||||||
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></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" src="functions.js"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="ttrssLogin">
|
<body id="ttrssLogin" class="claro">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function init() {
|
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");
|
var limit_set = getCookie("ttrss_bwlimit");
|
||||||
|
|
||||||
if (limit_set == "true") {
|
if (limit_set == "true") {
|
||||||
|
|
|
@ -266,7 +266,7 @@ function genericSanityCheck() {
|
||||||
setCookie("ttrss_test", "TEST");
|
setCookie("ttrss_test", "TEST");
|
||||||
|
|
||||||
if (getCookie("ttrss_test") != "TEST") {
|
if (getCookie("ttrss_test") != "TEST") {
|
||||||
fatalError(2);
|
return fatalError(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -314,7 +314,7 @@ function init() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!genericSanityCheck())
|
if (!genericSanityCheck())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
loading_set_progress(20);
|
loading_set_progress(20);
|
||||||
|
|
||||||
|
|
|
@ -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="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="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="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"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue