]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | set_include_path(get_include_path() . PATH_SEPARATOR . | |
3 | dirname(__FILE__) . "/include"); | |
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 "functions.php"; | |
21 | require_once "sessions.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 (!init_connection($link)) return; | |
36 | ||
37 | if (ENABLE_GZIP_OUTPUT) { | |
38 | ob_start("ob_gzhandler"); | |
39 | } | |
40 | ||
41 | function __autoload($class) { | |
42 | $file = "classes/".strtolower(basename($class)).".php"; | |
43 | if (file_exists($file)) { | |
44 | require $file; | |
45 | } | |
46 | } | |
47 | ||
48 | $method = $_REQUEST["op"]; | |
49 | ||
50 | $handler = new Public_Handler($link, $_REQUEST); | |
51 | ||
52 | if ($handler->before($method)) { | |
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 | header("Content-Type: text/plain"); | |
63 | print json_encode(array("error" => array("code" => 7))); | |
64 | ||
65 | // We close the connection to database. | |
66 | db_close($link); | |
67 | ?> |