More direct porting over from sockhub without testing
This commit is contained in:
parent
14790ad901
commit
55b7948891
1 changed files with 36 additions and 18 deletions
|
@ -7,33 +7,44 @@ namespace Flashii;
|
||||||
|
|
||||||
class Flashii {
|
class Flashii {
|
||||||
|
|
||||||
public static $_CONF;
|
public $_TPL;
|
||||||
public static $_DB;
|
public $_MD;
|
||||||
public $twig;
|
public static $_CNF;
|
||||||
|
public static $_TPLPUBPATH;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
function __construct($config) {
|
function __construct($config) {
|
||||||
|
|
||||||
// Stop the execution if the PHP Version is older than 5.4.0
|
// Stop the execution if the PHP Version is older than 5.4.0
|
||||||
if(version_compare(phpversion(), '5.4.0', '<'))
|
if(version_compare(phpversion(), '5.4.0', '<'))
|
||||||
die('<h3>Upgrade your PHP Version to at least PHP 5.4!</h3>');
|
die('<h3>Upgrade your PHP Version to at least PHP 5.4!</h3>');
|
||||||
|
|
||||||
// Assign $config values to $_CONF
|
// Start session
|
||||||
self::$_CONF = $config;
|
if(session_status() != PHP_SESSION_ACTIVE)
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Configuration Management and local configuration
|
||||||
|
Configuration::init($config);
|
||||||
|
|
||||||
// Initialise database
|
// Database
|
||||||
self::$_DB = new Database();
|
Database::init();
|
||||||
|
|
||||||
|
// "Dynamic" Configuration
|
||||||
|
Configuration::initDB();
|
||||||
|
|
||||||
|
// Templating engine
|
||||||
|
$this->initTwig();
|
||||||
|
|
||||||
|
// Markdown Parser
|
||||||
|
$this->initParsedown();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get values from the configuration
|
// Alias for Configuration::getConfig(), only exists because I'm lazy
|
||||||
public static function getConfig($key, $subkey = null) {
|
public static function getConfig($key) {
|
||||||
if(array_key_exists($key, self::$_CONF)) {
|
|
||||||
if($subkey)
|
return Configuration::getConfig($key);
|
||||||
return self::$_CONF[$key][$subkey];
|
|
||||||
else
|
|
||||||
return self::$_CONF[$key];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise Twig
|
// Initialise Twig
|
||||||
|
@ -49,6 +60,13 @@ class Flashii {
|
||||||
$this->twig = new \Twig_Environment($twigLoader, array(
|
$this->twig = new \Twig_Environment($twigLoader, array(
|
||||||
// 'cache' => $satoko['cacheFolder']
|
// 'cache' => $satoko['cacheFolder']
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise Parsedown
|
||||||
|
private function initParsedown() {
|
||||||
|
|
||||||
|
$this->_MD = new \Parsedown();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error Handler
|
// Error Handler
|
||||||
|
|
Reference in a new issue