Passed
Push — master ( a3c0d0...678db7 )
by Cody
06:27 queued 03:12
created

public.php (1 issue)

Labels
Severity
1
<?php
2
	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
3
		get_include_path());
4
5
	require_once "autoload.php";
6
	require_once "sessions.php";
7
	require_once "functions.php";
8
	require_once "sanity_check.php";
9
	require_once "config.php";
10
	require_once "db.php";
11
	require_once "db-prefs.php";
12
13
	startup_gettext();
14
15
	$script_started = microtime(true);
16
17
	if (!init_plugins()) return;
18
19
	if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
0 ignored issues
show
The constant ENABLE_GZIP_OUTPUT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
20
		ob_start("ob_gzhandler");
21
	}
22
23
	$method = $_REQUEST["op"];
24
25
	$override = PluginHost::getInstance()->lookup_handler("public", $method);
26
27
	if ($override) {
28
		$handler = $override;
29
	} else {
30
		$handler = new Handler_Public($_REQUEST);
31
	}
32
33
	if (implements_interface($handler, "IHandler") && $handler->before($method)) {
34
		if ($method && method_exists($handler, $method)) {
35
			$handler->$method();
36
		} else if (method_exists($handler, 'index')) {
37
			$handler->index();
38
		}
39
		$handler->after();
40
		return;
41
	}
42
43
	header("Content-Type: text/plain");
44
	print error_json(13);
45