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