Issues (1270)

public.php (1 issue)

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()) {
18
        return;
19
    }
20
21
    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...
22
        ob_start("ob_gzhandler");
23
    }
24
25
    $method = $_REQUEST["op"];
26
27
    $override = PluginHost::getInstance()->lookup_handler("public", $method);
28
29
    if ($override) {
30
        $handler = $override;
31
    } else {
32
        $handler = new Handler_Public($_REQUEST);
33
    }
34
35
    if (implements_interface($handler, "IHandler") && $handler->before($method)) {
36
        if ($method && method_exists($handler, $method)) {
37
            $handler->$method();
38
        } else if (method_exists($handler, 'index')) {
39
            $handler->index();
40
        }
41
        $handler->after();
42
        return;
43
    }
44
45
    header("Content-Type: text/plain");
46
    print error_json(13);
47