Beispiel #1
0
 public static function run()
 {
     Bootstrap::setup();
     $app = new App();
     if (Util::has_request_param("action")) {
         $api = new Api($app);
         $api->apply();
     } else {
         define("FALLBACK", $app->get_fallback());
         normalized_require_once("page");
     }
 }
define("APP_ABS_HREF", normalize_path(dirname(dirname(dirname(preg_replace('#^.*//#', '/', getenv("SCRIPT_NAME"))))), true));
// fixes lighttpd issues
$url_parts = parse_url(getenv("REQUEST_URI"));
define("ABS_HREF", normalize_path($url_parts["path"]), true);
function normalized_require_once($lib)
{
    require_once APP_ABS_PATH . $lib;
}
/* Fast exit on version check */
if (array_key_exists("version", $_REQUEST)) {
    echo json_encode(array("code" => 0, "version" => "0.24.1", "href" => APP_ABS_HREF));
    exit;
}
/* Load Libs */
normalized_require_once("/server/php/inc/util.php");
normalized_require_once("/server/php/inc/App.php");
normalized_require_once("/server/php/inc/Item.php");
/* Init */
$app = new App(APP_ABS_PATH, APP_ABS_HREF, ABS_HREF);
/* Run */
if (array_key_exists("action", $_REQUEST)) {
    header("Content-type: application/json;charset=utf-8");
    normalized_require_once("/server/php/inc/Api.php");
    $api = new Api($app);
    $api->apply();
} else {
    header("Content-type: text/html;charset=utf-8");
    $HREF = $app->get_app_abs_href();
    $FALLBACK = $app->get_fallback();
    normalized_require_once("/server/php/inc/page.php");
}
Beispiel #3
0
<?php

/*********************************************************************
  SHA1 hash of the info page password, the preset password is the
  empty string. You might change it to keep this information private.
  Online hash generator: http://www.sha1.cz/
*********************************************************************/
define("PASSHASH", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
function normalized_require_once($lib)
{
    require_once preg_replace("#[\\\\/]+#", "/", dirname(__FILE__) . "/inc/{$lib}.php");
}
function __autoload($class_name)
{
    normalized_require_once("class-" . strtolower($class_name));
}
Setup::init();
$app = new App();
if (Util::has_request_param("action")) {
    $api = new Api($app);
    $api->apply();
} else {
    define("FALLBACK", $app->get_fallback());
    normalized_require_once("page");
}