]> git.wh0rd.org - tt-rss.git/blame - public.php
implement ProtectedHandler
[tt-rss.git] / public.php
CommitLineData
e0d91d84 1<?php
3f363052
AD
2 set_include_path(get_include_path() . PATH_SEPARATOR . "include");
3
e0d91d84
AD
4 /* remove ill effects of magic quotes */
5
6 if (get_magic_quotes_gpc()) {
7 function stripslashes_deep($value) {
8 $value = is_array($value) ?
9 array_map('stripslashes_deep', $value) : stripslashes($value);
10 return $value;
11 }
12
13 $_POST = array_map('stripslashes_deep', $_POST);
14 $_GET = array_map('stripslashes_deep', $_GET);
15 $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
16 $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
17 }
18
19 $op = $_REQUEST["op"];
20
21 require_once "functions.php";
22 if ($op != "share") require_once "sessions.php";
e0d91d84
AD
23 require_once "sanity_check.php";
24 require_once "config.php";
25 require_once "db.php";
26 require_once "db-prefs.php";
27
28 no_cache_incantation();
29
30 startup_gettext();
31
32 $script_started = getmicrotime();
33
34 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
35
36 if (!$link) {
37 if (DB_TYPE == "mysql") {
38 print mysql_error();
39 }
40 // PG seems to display its own errors just fine by default.
41 return;
42 }
43
44 init_connection($link);
45
f30ef1fa 46 $method = $_REQUEST["method"];
e0d91d84
AD
47 $mode = $_REQUEST["mode"];
48
49 if ((!$op || $op == "rss" || $op == "dlg") && !$_REQUEST["noxml"]) {
50 header("Content-Type: application/xml; charset=utf-8");
51 } else {
52 header("Content-Type: text/plain; charset=utf-8");
53 }
54
55 if (ENABLE_GZIP_OUTPUT) {
56 ob_start("ob_gzhandler");
57 }
58
59 handle_public_request($link, $op);
60
61 // We close the connection to database.
62 db_close($link);
63?>