-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.php
22 lines (20 loc) · 1.09 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$start_time = Logger::processing_time(); //let's measure page load time
//Logger::$logToPHPErrorLog = true; //let's log app events into the PHP error log
//Logger::$logToUser = true;
function currentUser($force = true){
if(WebApplication::getGet('force_login') || WebApplication::getGet('fl')) $force = true;
if($user = WebApplication::getSession('user')){ // first, try to get the user from the session
WebApplication::setSession('user', $user);
//if we've been bounced, jump to the last place we were bounced from now that we're logged in
if($location = WebApplication::getSession('bounce_location')){
WebApplication::setSession('bounce_location');
WebApplication::redirect($location);
}
}else if($force === true){ //if we're in force mode and there's no user, boot em
WebApplication::setSession('bounce_location', WebApplication::url());
WebApplication::redirect('/');
}
PageRenderer::$core_data['user'] = $user;
return $user;
}