Quick commit to fix tabs
This commit is contained in:
parent
77985e1ab4
commit
f4ed101874
1 changed files with 36 additions and 36 deletions
|
@ -7,22 +7,22 @@ namespace Sakura;
|
||||||
|
|
||||||
class Main {
|
class Main {
|
||||||
|
|
||||||
public static $_TPL;
|
public static $_TPL;
|
||||||
public static $_MD;
|
public static $_MD;
|
||||||
public static $_IN_MANAGE = false;
|
public static $_IN_MANAGE = false;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public static function init($config) {
|
public static function init($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>');
|
||||||
|
|
||||||
// Configuration Management and local configuration
|
// Configuration Management and local configuration
|
||||||
Configuration::init($config);
|
Configuration::init($config);
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
Database::init();
|
Database::init();
|
||||||
|
|
||||||
// "Dynamic" Configuration
|
// "Dynamic" Configuration
|
||||||
Configuration::initDB();
|
Configuration::initDB();
|
||||||
|
@ -39,7 +39,7 @@ class Main {
|
||||||
// Markdown Parser
|
// Markdown Parser
|
||||||
self::initMD();
|
self::initMD();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise Parsedown
|
// Initialise Parsedown
|
||||||
private static function initMD() {
|
private static function initMD() {
|
||||||
|
@ -73,35 +73,35 @@ class Main {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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(ROOT, '', $errstr);
|
$errstr = str_replace(ROOT, '', $errstr);
|
||||||
$errfile = str_replace(ROOT, '', $errfile);
|
$errfile = str_replace(ROOT, '', $errfile);
|
||||||
$templates = ROOT .'_sakura/templates/';
|
$templates = ROOT .'_sakura/templates/';
|
||||||
|
|
||||||
switch ($errno) {
|
switch ($errno) {
|
||||||
|
|
||||||
case E_ERROR:
|
case E_ERROR:
|
||||||
case E_USER_ERROR:
|
case E_USER_ERROR:
|
||||||
$error = '<b>FATAL ERROR</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
$error = '<b>FATAL ERROR</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_WARNING:
|
case E_WARNING:
|
||||||
case E_USER_WARNING:
|
case E_USER_WARNING:
|
||||||
$error = '<b>WARNING</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
$error = '<b>WARNING</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_NOTICE:
|
case E_NOTICE:
|
||||||
case E_USER_NOTICE:
|
case E_USER_NOTICE:
|
||||||
$error = '<b>NOTICE</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
$error = '<b>NOTICE</b>: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$error = '<b>Unknown error type</b> [' . $errno . ']: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
$error = '<b>Unknown error type</b> [' . $errno . ']: ' . $errstr . ' on line ' . $errline . ' in ' . $errfile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use file_get_contents instead of Twig in case the problem is related to twig
|
// Use file_get_contents instead of Twig in case the problem is related to twig
|
||||||
$errorPage = file_get_contents($templates. 'errorPage.tpl');
|
$errorPage = file_get_contents($templates. 'errorPage.tpl');
|
||||||
|
@ -109,13 +109,13 @@ class Main {
|
||||||
// str_replace {{ error }} on the error page with the error data
|
// str_replace {{ error }} on the error page with the error data
|
||||||
$error = str_replace('{{ error }}', $error, $errorPage);
|
$error = str_replace('{{ error }}', $error, $errorPage);
|
||||||
|
|
||||||
// Truncate all previous outputs
|
// Truncate all previous outputs
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
|
||||||
// Die and display error message
|
// Die and display error message
|
||||||
die($error);
|
die($error);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send emails
|
// Send emails
|
||||||
public static function sendMail($to, $subject, $body) {
|
public static function sendMail($to, $subject, $body) {
|
||||||
|
@ -201,13 +201,13 @@ class Main {
|
||||||
// Cleaning strings
|
// Cleaning strings
|
||||||
public static function cleanString($string, $lower = false) {
|
public static function cleanString($string, $lower = false) {
|
||||||
|
|
||||||
$string = htmlentities($string, ENT_QUOTES | ENT_IGNORE, Configuration::getConfig('charset'));
|
$string = htmlentities($string, ENT_QUOTES | ENT_IGNORE, Configuration::getConfig('charset'));
|
||||||
$string = stripslashes($string);
|
$string = stripslashes($string);
|
||||||
$string = strip_tags($string);
|
$string = strip_tags($string);
|
||||||
if($lower)
|
if($lower)
|
||||||
$string = strtolower($string);
|
$string = strtolower($string);
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue