diff --git a/_sakura/components/Configuration.php b/_sakura/components/Configuration.php index e69de29..b2962b8 100644 --- a/_sakura/components/Configuration.php +++ b/_sakura/components/Configuration.php @@ -0,0 +1,66 @@ +Failed to initialise configuration.'); + } + + // Initialise Database configuration values. + // Different from __construct as that is called before the database connection is initially + // established + public static function initDB() { + $_DATA = Database::fetch('config', true); + $_DBCN = array(); + + foreach($_DATA as $_CONF) + $_DBCN[$_CONF[0]] = $_CONF[1]; + + self::$_DCNF = $_DBCN; + } + + // Get values from the configuration on the file system + public static function getLocalConfig($key, $subkey = null) { + if(array_key_exists($key, self::$_LCNF)) { + if($subkey) + return self::$_LCNF[$key][$subkey]; + else + return self::$_LCNF[$key]; + } else + return null; + } + + // Dynamically set local configuration values, does not update the configuration file + public static function setLocalConfig($key, $subkey, $value) { + if($subkey) { + if(!isset(self::$_LCNF[$key])) { + self::$_LCNF[$key] = array(); + } + self::$_LCNF[$key][$subkey] = $value; + } else { + self::$_LCNF[$key] = $value; + } + } + + // Get values from the configuration in the database + public static function getConfig($key) { + if(array_key_exists($key, self::$_DCNF)) + return self::$_DCNF[$key]; + else + return null; + } + +} diff --git a/_sakura/config/config.php b/_sakura/config/config.php index 09a386f..a11fc57 100644 --- a/_sakura/config/config.php +++ b/_sakura/config/config.php @@ -25,3 +25,8 @@ $fiiConf['urls']['system'] = 'sys.iihsalf.net'; $fiiConf['etc']['localPath'] = '/var/www/flashii.net/'; $fiiConf['etc']['templatesPath'] = $fiiConf['etc']['localPath'] .'_sakura/templates/'; $fiiConf['etc']['design'] = 'yuuno'; + +// Administrator details +$fiiConf['admin']['name'] = 'Flashwave'; +$fiiConf['admin']['twitter'] = '_flashii'; +$fiiConf['admin']['statuspage'] = 'status.flashii.net'; diff --git a/main/index.php b/main/index.php index 5e60a37..959b0de 100644 --- a/main/index.php +++ b/main/index.php @@ -10,9 +10,9 @@ require_once('/var/www/flashii.net/_sakura/sakura.php'); $flashii->initTwig(); // Add page specific things -$renderData['page'] = array_merge($renderData['page'], [ +$renderData['page'] = [ 'title' => 'Flashii Dev' -]); +]; // Print page contents print $flashii->twig->render('main/index.tpl', $renderData);