diff --git a/_sakura/components/Configuration.php b/_sakura/components/Configuration.php index 41cfe7f..b414c42 100644 --- a/_sakura/components/Configuration.php +++ b/_sakura/components/Configuration.php @@ -45,7 +45,7 @@ class Configuration { else return self::$_LCNF[$key]; } else - return null; + trigger_error('Unable to get local configuration value!', E_USER_ERROR); } @@ -68,7 +68,7 @@ class Configuration { if(array_key_exists($key, self::$_DCNF)) return self::$_DCNF[$key]; else - return null; + trigger_error('Unable to get configuration value!', E_USER_ERROR); } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index b621cf0..81f9fab 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -37,13 +37,6 @@ class Main { } - // Alias for Configuration::getConfig(), only exists because I'm lazy - public static function getConfig($key) { - - return Configuration::getConfig($key); - - } - // Initialise Twig private static function initTwig() { @@ -73,7 +66,7 @@ class Main { public static function verifyCaptcha($response) { // Attempt to get the response - $resp = @file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='. self::getConfig('recaptcha_private') .'&response='. $response); + $resp = @file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='. Configuration::getConfig('recaptcha_private') .'&response='. $response); // In the highly unlikely case that it failed to get anything forge a false if(!$resp) @@ -138,4 +131,17 @@ class Main { } + // Cleaning strings + public static function cleanString($string, $lower = false) { + + $string = htmlentities($string, ENT_QUOTES | ENT_IGNORE, Configuration::getConfig('charset')); + $string = stripslashes($string); + $string = strip_tags($string); + if($lower) + $string = strtolower($string); + + return $string; + + } + } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index fa189dc..a8ad692 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -1,6 +1,6 @@ */ @@ -31,7 +31,7 @@ require_once ROOT_DIRECTORY .'_sakura/components/Sessions.php'; require_once ROOT_DIRECTORY .'_sakura/components/Users.php'; // Generate path to database driver -$_DBNGNPATH = ROOT_DIRECTORY .'_sakura/components/database/' . $fiiConf['db']['driver'] . '.php'; +$_DBNGNPATH = ROOT_DIRECTORY .'_sakura/components/database/'. Configuration::getLocalConfig('db', 'driver') .'.php'; // Include database driver if(file_exists($_DBNGNPATH)) @@ -39,7 +39,6 @@ if(file_exists($_DBNGNPATH)) else die('