X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=backend.php;h=b583d379e46fbbe726655adbfe7698ecb10a7027;hb=404e2e3603c852a3f82a21c14b8888005e2b3f99;hp=b670451a48722d233cd1c64f03d85bb3d90fce1d;hpb=0d421af86fdfe270e7396f308cf53f3b908e3d74;p=tt-rss.git diff --git a/backend.php b/backend.php index b670451a..b583d379 100644 --- a/backend.php +++ b/backend.php @@ -1,6 +1,6 @@ array("code" => 6))); + return; } - return; + load_user_plugins($link, $_SESSION["uid"]); } $purge_intervals = array( @@ -107,18 +101,6 @@ 1440 => __("Daily"), 10080 => __("Weekly")); - $update_methods = array( - 0 => __("Default"), - 1 => __("Magpie"), - 2 => __("SimplePie"), - 3 => __("Twitter OAuth")); - - if (DEFAULT_UPDATE_METHOD == "1") { - $update_methods[0] .= ' (SimplePie)'; - } else { - $update_methods[0] .= ' (Magpie)'; - } - $access_level_names = array( 0 => __("User"), 5 => __("Power User"), @@ -133,27 +115,43 @@ $op = str_replace("-", "_", $op); - if (class_exists($op)) { - $handler = new $op($link, $_REQUEST); + global $pluginhost; + $override = $pluginhost->lookup_handler($op, $method); - if ($handler) { + if (class_exists($op) || $override) { + + if ($override) { + $handler = $override; + } else { + $handler = new $op($link, $_REQUEST); + } + + if ($handler && implements_interface($handler, 'IHandler')) { if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) { if ($handler->before($method)) { if ($method && method_exists($handler, $method)) { $handler->$method(); + } else { + if (method_exists($handler, "catchall")) { + $handler->catchall($method); + } } $handler->after(); return; + } else { + header("Content-Type: text/json"); + print json_encode(array("error" => array("code" => 6))); + return; } } else { - header("Content-Type: text/plain"); + header("Content-Type: text/json"); print json_encode(array("error" => array("code" => 6))); return; } } } - header("Content-Type: text/plain"); + header("Content-Type: text/json"); print json_encode(array("error" => array("code" => 7))); // We close the connection to database.