]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
better fatal error handling by frontend (remove error.php)
[tt-rss.git] / backend.php
index 5554adae2b985a3675f2405ab63ead5f11f81a46..df3e7d036104e98599663a7a73a2c583819976e2 100644 (file)
 
        require_once "sanity_check.php";
        require_once "config.php";
+       
+       require_once "db.php";
+       require_once "db-prefs.php";
+       require_once "functions.php";
+       require_once "magpierss/rss_fetch.inc";
 
        $err_msg = check_configuration_variables();
 
        if ($err_msg) {
-               print "Fatal error: $err_msg";
-               exit;
+               header("Content-Type: application/xml");
+               print_error_xml(9, $err_msg); die;
        }
 
        if ((!$op || $op == "rpc" || $op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) {
@@ -35,7 +40,7 @@
        if (!$_SESSION["uid"] && $op != "globalUpdateFeeds") {
 
                if ($op == "rpc") {
-                       print "<error error-code=\"6\"/>";
+                       print_error_xml(6); die;
                } else {
                        print "
                        <html><body>
        }
 
        if (!$op) {
-               print "<error error-code=\"7\"/>";
-               exit;
+               print_error_xml(7); exit;
        }
 
-       require_once "db.php";
-       require_once "db-prefs.php";
-       require_once "functions.php";
-       require_once "magpierss/rss_fetch.inc";
-
        $purge_intervals = array(
                0  => "Default",
                -1 => "Never purge",