<?php
+$pharFile = \Phar::running();
+if ($pharFile == '') {
+ $phorkieDir = __DIR__ . '/../';
+} else {
+ //remove phar:// from the path
+ $phorkieDir = dirname(substr($pharFile, 7)) . '/';
+}
+
$GLOBALS['phorkie']['cfg'] = array(
'debug' => false,
- 'gitdir' => __DIR__ . '/../repos/git/',
- 'workdir' => __DIR__ . '/../repos/work/',
+ 'gitdir' => $phorkieDir . 'repos/git/',
+ 'workdir' => $phorkieDir . 'repos/work/',
'tpl' => __DIR__ . '/templates/',
- 'baseurl' => '/',
+ 'baseurl' => null,
'avatars' => true,
'css' => '',
'iconpng' => '',//phorkie browser icon (favicon)
'topbar' => '',
'setupcheck' => true,
'elasticsearch' => null,
- 'geshi' => 'MediaWiki/geshi/geshi/geshi.php',
'index' => 'new',//"new" or "list"
'perPage' => 10,
'defaultListPage' => 'last',//a number or "last"
*/
public function toHtml(File $file, Tool_Result $res = null)
{
- if (!class_exists('\\GeSHi', true)) {
- require_once 'geshi.php';
+ /**
+ * Yes, geshi needs to be in your include path
- * We use the mediawiki geshi extension package.
++ * We use the geshi pear package.
+ */
+ if (!class_exists('\\geshi', true)) {
+ require_once $GLOBALS['phorkie']['cfg']['geshi'];
}
- $geshi = new \GeSHi($file->getContent(), $this->getType($file));
+ $geshi = new \geshi($file->getContent(), $this->getType($file));
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
<?php
namespace phorkie;
+ error_reporting(error_reporting() & ~E_STRICT);
+ session_set_cookie_params(14 * 86400);//2 weeks session expiry time
session_start();
require_once __DIR__ . '/../src/phorkie/autoload.php';
);
require_once __DIR__ . '/../data/config.default.php';
-if (file_exists(__DIR__ . '/../data/config.php')) {
- require_once __DIR__ . '/../data/config.php';
+$pharFile = \Phar::running();
+if ($pharFile == '') {
+ $cfgFilePath = __DIR__ . '/../data/config.php';
+} else {
+ //remove phar:// from the path
+ $cfgFilePath = substr($pharFile, 7) . '.config.php';
+}
+$GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = false;
+if (file_exists($cfgFilePath)) {
+ $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = true;
+ require_once $cfgFilePath;
+}
+
+if ($GLOBALS['phorkie']['cfg']['baseurl'] === null) {
+ $GLOBALS['phorkie']['cfg']['baseurl'] = Tools::detectBaseUrl();
}
// Set/Get git commit session variables