diff --git a/public_html/includes/base.php b/public_html/includes/base.php index 21ddc5c..a515fff 100644 --- a/public_html/includes/base.php +++ b/public_html/includes/base.php @@ -17,8 +17,35 @@ $_CPHP = true; $_CPHP_CONFIG = "../config.json"; require("cphp/base.php"); +/* Autoloader configuration */ require_once('lib/swiftmailer/swift_required.php'); +function autoload_redonate($class_name) +{ + global $_APP; + + $class_name = str_replace("\\", "/", strtolower($class_name)); + + if(file_exists("classes/{$class_name}.php")) + { + require_once("classes/{$class_name}.php"); + } +} + +spl_autoload_register(autoload_redonate); + +/* Set global templater variables */ +NewTemplater::SetGlobalVariable("logged-in", !empty($_SESSION['user_id'])); + +if(!empty($_SESSION['user_id'])) +{ + $sCurrentUser = new User($_SESSION['user_id']); + + $sCurrentUser->SetGlobalVariables(); + + NewTemplater::SetGlobalVariable("logout-key", $_SESSION['logout_key']); +} + NewTemplater::RegisterVariableHook("errors", "get_errors"); NewTemplater::RegisterVariableHook("notices", "get_notices"); @@ -73,20 +100,6 @@ function flash_notice($message) $_SESSION['notices'][] = $message; } -function autoload_redonate($class_name) -{ - global $_APP; - - $class_name = str_replace("\\", "/", strtolower($class_name)); - - if(file_exists("classes/{$class_name}.php")) - { - require_once("classes/{$class_name}.php"); - } -} - -spl_autoload_register(autoload_redonate); - function send_mail($to, $subject, $text, $html) { global $mail_transport, $cphp_config; diff --git a/public_html/templates/layout.tpl b/public_html/templates/layout.tpl index d4dfd1f..6c1123f 100644 --- a/public_html/templates/layout.tpl +++ b/public_html/templates/layout.tpl @@ -19,8 +19,13 @@