From 3a25026c5c80993906e84dc598ae83c72657ede4 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 8 Mar 2015 07:11:57 +0100 Subject: [PATCH] i apparently changed shit --- _sakura/components/Configuration.php | 12 +++++++++++- _sakura/components/Main.php | 4 ++++ _sakura/config/config.php | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/_sakura/components/Configuration.php b/_sakura/components/Configuration.php index b2962b8..3430917 100644 --- a/_sakura/components/Configuration.php +++ b/_sakura/components/Configuration.php @@ -12,17 +12,20 @@ class Configuration { // Constructor public static function init($local) { + // Store $local in $_LCNF if(is_array($local)) self::$_LCNF = $local; else die('

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(); @@ -30,10 +33,12 @@ class Configuration { $_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]; @@ -41,10 +46,12 @@ class Configuration { 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(); @@ -53,14 +60,17 @@ class Configuration { } 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]; + return self::$_DCNF[$key]; else return null; + } } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 2020e3a..e4d1a95 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -74,6 +74,7 @@ class Flashii { // Error Handler public static function ErrorHandler($errno, $errstr, $errfile, $errline) { + // Set some variables to work with including A HUGE fallback hackjob for the templates folder $errstr = str_replace(self::getConfig('etc', 'localPath'), '', $errstr); $errfile = str_replace(self::getConfig('etc', 'localPath'), '', $errfile); @@ -111,11 +112,14 @@ class Flashii { // Die and display error message die($error); + } // Legacy password hashing to be able to validate passwords from users on the old backend. public static function legacyPasswordHash($data) { + return hash('sha512', strrev(hash('sha512', $data))); + } } \ No newline at end of file diff --git a/_sakura/config/config.php b/_sakura/config/config.php index cc25f13..16ddc59 100644 --- a/_sakura/config/config.php +++ b/_sakura/config/config.php @@ -11,7 +11,7 @@ $fiiConf['db']['port'] = 3306; $fiiConf['db']['username'] = 'flashii'; $fiiConf['db']['password'] = 'Ky2YQMr4vu4zcZE&yLZT!gQ&Wdf-CxrQLej+^PS6jS5AgAQh52yf6Br&mq-C8J=F3Yw$3wnMU7?ebA9r+Abe4J_kzzs57C8U22&#wytuf-veF9WEuHfP-GRHQ^?5pXbx'; $fiiConf['db']['database'] = 'flashii'; -$fiiConf['db']['prefix'] = 'flashii_'; +$fiiConf['db']['prefix'] = 'fii_'; // URLs (for modularity) $fiiConf['urls']['main'] = 'iihsalf.net';