]> git.wh0rd.org - tt-rss.git/blob - public.php
fix some missing constructor parameters
[tt-rss.git] / public.php
1 <?php
2 set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
3 get_include_path());
4
5 /* remove ill effects of magic quotes */
6
7 if (get_magic_quotes_gpc()) {
8 function stripslashes_deep($value) {
9 $value = is_array($value) ?
10 array_map('stripslashes_deep', $value) : stripslashes($value);
11 return $value;
12 }
13
14 $_POST = array_map('stripslashes_deep', $_POST);
15 $_GET = array_map('stripslashes_deep', $_GET);
16 $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
17 $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
18 }
19
20 require_once "autoload.php";
21 require_once "sessions.php";
22 require_once "functions.php";
23 require_once "sanity_check.php";
24 require_once "config.php";
25 require_once "db.php";
26 require_once "db-prefs.php";
27
28 startup_gettext();
29
30 $script_started = microtime(true);
31
32 if (!init_plugins()) return;
33
34 if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
35 ob_start("ob_gzhandler");
36 }
37
38 $method = $_REQUEST["op"];
39
40 global $pluginhost;
41 $override = $pluginhost->lookup_handler("public", $method);
42
43 if ($override) {
44 $handler = $override;
45 } else {
46 $handler = new Handler_Public(Db::get(), $_REQUEST);
47 }
48
49 if (implements_interface($handler, "IHandler") && $handler->before($method)) {
50 if ($method && method_exists($handler, $method)) {
51 $handler->$method();
52 } else if (method_exists($handler, 'index')) {
53 $handler->index();
54 }
55 $handler->after();
56 return;
57 }
58
59 header("Content-Type: text/plain");
60 print json_encode(array("error" => array("code" => 7)));
61
62 ?>