Add links for logged in users and reorganize the base include a bit

master
Sven Slootweg 12 years ago
parent 2dcdf68c52
commit 8ab7322b13

@ -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;

@ -19,8 +19,13 @@
<div class="footer">
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/sign-up">Sign up</a>
<a href="/login">Login</a>
{%if logged-in == false}
<a href="/sign-up">Sign up</a>
<a href="/login">Login</a>
{%else}
<a href="/dashboard">Dashboard</a>
<a href="/logout/{%?logout-key}">Logout</a>
{%/if}
</div>
</div>
</body>

Loading…
Cancel
Save