]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | set_include_path(get_include_path() . PATH_SEPARATOR . "include"); | |
3 | ||
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 | require_once "functions.php"; | |
20 | require_once "sessions.php"; | |
21 | require_once "sanity_check.php"; | |
22 | require_once "config.php"; | |
23 | require_once "db.php"; | |
24 | require_once "db-prefs.php"; | |
25 | ||
26 | no_cache_incantation(); | |
27 | ||
28 | startup_gettext(); | |
29 | ||
30 | $script_started = getmicrotime(); | |
31 | ||
32 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
33 | ||
34 | if (!init_connection($link)) return; | |
35 | ||
36 | if (ENABLE_GZIP_OUTPUT) { | |
37 | ob_start("ob_gzhandler"); | |
38 | } | |
39 | ||
40 | function __autoload($class) { | |
41 | $file = "classes/".strtolower(basename($class)).".php"; | |
42 | if (file_exists($file)) { | |
43 | require $file; | |
44 | } | |
45 | } | |
46 | ||
47 | $method = $_REQUEST["op"]; | |
48 | ||
49 | $handler = new Public_Handler($link, $_REQUEST); | |
50 | ||
51 | if ($handler) { | |
52 | if ($handler->before()) { | |
53 | if ($method && method_exists($handler, $method)) { | |
54 | $handler->$method(); | |
55 | } else if (method_exists($handler, 'index')) { | |
56 | $handler->index(); | |
57 | } | |
58 | $handler->after(); | |
59 | return; | |
60 | } | |
61 | } | |
62 | ||
63 | header("Content-Type: text/plain"); | |
64 | print json_encode(array("error" => array("code" => 7))); | |
65 | ||
66 | // We close the connection to database. | |
67 | db_close($link); | |
68 | ?> |