]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
rework initial sanitycheck to use JSON
[tt-rss.git] / backend.php
index 5839c0d2b2a650009a7fff26d8a08c0f6c2d77f5..d13b2d62a474481048c386ba1ab967787e898b02 100644 (file)
                authenticate_user($link, "admin", null);
        }
 
-       /* if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds"
-               && $op != "rss" && $op != "getUnread" && $op != "publish" && $op != "getProfiles") {
-
-               if ($op == "rpc" || $op == "viewfeed" || $op == "view") {
-                       print_error_xml(6); exit;
-               } else {
-                       header("Location: tt-rss.php?return=" .
-                               urlencode($_SERVER['REQUEST_URI']));
-               }
-               exit;
-       } */
-
        if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" &&
                                $op != "rss" && $op != "getUnread" && $op != "getProfiles") {
 
        require_once "modules/pref-labels.php";
        require_once "modules/pref-users.php";
 
-       if (!sanity_check($link)) { return; }
+       $error = sanity_check($link);
+
+       if ($error['code'] != 0) {
+               print json_encode(array("error" => $error));
+               return;
+       }
 
        switch($op) { // Select action according to $op value.
                case "rpc":