Example #1
0
 public function testDetectBaseUrlEditSubdir()
 {
     $_GET['id'] = 82;
     $_SERVER['REQUEST_URI'] = '/foo/82/edit';
     $_SERVER['SCRIPT_NAME'] = '/edit.php';
     $this->assertEquals('/foo/', Tools::detectBaseUrl());
 }
Example #2
0
} else {
    //remove phar:// from the path
    $cfgFilePath = substr($pharFile, 7) . '.config.php';
}
$GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = false;
$GLOBALS['phorkie']['suggestSetupCheck'] = false;
if (file_exists($cfgFilePath)) {
    $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = true;
    require_once $cfgFilePath;
} else {
    if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
        $GLOBALS['phorkie']['suggestSetupCheck'] = true;
    }
}
if ($GLOBALS['phorkie']['cfg']['baseurl'] === null) {
    $GLOBALS['phorkie']['cfg']['baseurl'] = Tools::detectBaseUrl();
    if (substr($GLOBALS['phorkie']['cfg']['git']['public'], 0, 9) == '%BASEURL%') {
        //make autoconfig work
        $GLOBALS['phorkie']['cfg']['git']['public'] = Tools::fullUrlNoPhar(substr($GLOBALS['phorkie']['cfg']['git']['public'], 9));
    }
}
// Set/Get git commit session variables
$_SESSION['ipaddr'] = $_SERVER['REMOTE_ADDR'];
if (!isset($_SESSION['name'])) {
    $_SESSION['name'] = $GLOBALS['phorkie']['auth']['anonymousName'];
}
if (!isset($_SESSION['email'])) {
    $_SESSION['email'] = $GLOBALS['phorkie']['auth']['anonymousEmail'];
}
\Twig_Autoloader::register();
$loader = new \Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']);