i apparently changed shit

This commit is contained in:
flash 2015-03-08 07:11:57 +01:00
parent 6a2a1a01be
commit 3a25026c5c
3 changed files with 16 additions and 2 deletions

View file

@ -12,17 +12,20 @@ class Configuration {
// Constructor // Constructor
public static function init($local) { public static function init($local) {
// Store $local in $_LCNF // Store $local in $_LCNF
if(is_array($local)) if(is_array($local))
self::$_LCNF = $local; self::$_LCNF = $local;
else else
die('<h1>Failed to initialise configuration.</h1>'); die('<h1>Failed to initialise configuration.</h1>');
} }
// Initialise Database configuration values. // Initialise Database configuration values.
// Different from __construct as that is called before the database connection is initially // Different from __construct as that is called before the database connection is initially
// established // established
public static function initDB() { public static function initDB() {
$_DATA = Database::fetch('config', true); $_DATA = Database::fetch('config', true);
$_DBCN = array(); $_DBCN = array();
@ -30,10 +33,12 @@ class Configuration {
$_DBCN[$_CONF[0]] = $_CONF[1]; $_DBCN[$_CONF[0]] = $_CONF[1];
self::$_DCNF = $_DBCN; self::$_DCNF = $_DBCN;
} }
// Get values from the configuration on the file system // Get values from the configuration on the file system
public static function getLocalConfig($key, $subkey = null) { public static function getLocalConfig($key, $subkey = null) {
if(array_key_exists($key, self::$_LCNF)) { if(array_key_exists($key, self::$_LCNF)) {
if($subkey) if($subkey)
return self::$_LCNF[$key][$subkey]; return self::$_LCNF[$key][$subkey];
@ -41,10 +46,12 @@ class Configuration {
return self::$_LCNF[$key]; return self::$_LCNF[$key];
} else } else
return null; return null;
} }
// Dynamically set local configuration values, does not update the configuration file // Dynamically set local configuration values, does not update the configuration file
public static function setLocalConfig($key, $subkey, $value) { public static function setLocalConfig($key, $subkey, $value) {
if($subkey) { if($subkey) {
if(!isset(self::$_LCNF[$key])) { if(!isset(self::$_LCNF[$key])) {
self::$_LCNF[$key] = array(); self::$_LCNF[$key] = array();
@ -53,14 +60,17 @@ class Configuration {
} else { } else {
self::$_LCNF[$key] = $value; self::$_LCNF[$key] = $value;
} }
} }
// Get values from the configuration in the database // Get values from the configuration in the database
public static function getConfig($key) { public static function getConfig($key) {
if(array_key_exists($key, self::$_DCNF)) if(array_key_exists($key, self::$_DCNF))
return self::$_DCNF[$key]; return self::$_DCNF[$key];
else else
return null; return null;
} }
} }

View file

@ -74,6 +74,7 @@ class Flashii {
// Error Handler // Error Handler
public static function ErrorHandler($errno, $errstr, $errfile, $errline) { public static function ErrorHandler($errno, $errstr, $errfile, $errline) {
// Set some variables to work with including A HUGE fallback hackjob for the templates folder // Set some variables to work with including A HUGE fallback hackjob for the templates folder
$errstr = str_replace(self::getConfig('etc', 'localPath'), '', $errstr); $errstr = str_replace(self::getConfig('etc', 'localPath'), '', $errstr);
$errfile = str_replace(self::getConfig('etc', 'localPath'), '', $errfile); $errfile = str_replace(self::getConfig('etc', 'localPath'), '', $errfile);
@ -111,11 +112,14 @@ class Flashii {
// Die and display error message // Die and display error message
die($error); die($error);
} }
// Legacy password hashing to be able to validate passwords from users on the old backend. // Legacy password hashing to be able to validate passwords from users on the old backend.
public static function legacyPasswordHash($data) { public static function legacyPasswordHash($data) {
return hash('sha512', strrev(hash('sha512', $data))); return hash('sha512', strrev(hash('sha512', $data)));
} }
} }

View file

@ -11,7 +11,7 @@ $fiiConf['db']['port'] = 3306;
$fiiConf['db']['username'] = 'flashii'; $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']['password'] = 'Ky2YQMr4vu4zcZE&yLZT!gQ&Wdf-CxrQLej+^PS6jS5AgAQh52yf6Br&mq-C8J=F3Yw$3wnMU7?ebA9r+Abe4J_kzzs57C8U22&#wytuf-veF9WEuHfP-GRHQ^?5pXbx';
$fiiConf['db']['database'] = 'flashii'; $fiiConf['db']['database'] = 'flashii';
$fiiConf['db']['prefix'] = 'flashii_'; $fiiConf['db']['prefix'] = 'fii_';
// URLs (for modularity) // URLs (for modularity)
$fiiConf['urls']['main'] = 'iihsalf.net'; $fiiConf['urls']['main'] = 'iihsalf.net';