Example #1
0
    header('Cache-Control: max-age=0');
    header('Pragma: public');
}
//Do not overwrite a previously sent content-type header, this breaks WAP.
if (!isset($enable_wap)) {
    header('Content-Type: text/html; charset=UTF-8');
}
$permission = new Permission();
$authentication = new Authentication();
if (isset($authenticate) and $authenticate === FALSE) {
    Debug::text('Bypassing Authentication', __FILE__, __LINE__, __METHOD__, 10);
    TTi18n::chooseBestLocale();
} else {
    //Increase timeout on WAP devices, so they don't have to login as often.
    if (isset($enable_wap) and $enable_wap == TRUE) {
        $authentication->setIdle(32400);
        //9hrs
    } elseif (isset($config_vars['other']['web_session_timeout']) and $config_vars['other']['web_session_timeout'] != '') {
        $authentication->setIdle((int) $config_vars['other']['web_session_timeout']);
    }
    if ($authentication->Check() === TRUE) {
        /*
         * Get default interface data here. Things like User info, Company info etc...
         */
        $current_user = $authentication->getObject();
        Debug::text('User Authenticated: ' . $current_user->getUserName() . ' Created Date: ' . $authentication->getCreatedDate(), __FILE__, __LINE__, __METHOD__, 10);
        $clf = new CompanyListFactory();
        $current_company = $clf->getByID($current_user->getCompany())->getCurrent();
        unset($clf);
        //Check to make sure the logged in user's information is all up to date.
        //Make sure they also have permissions to edit information, otherwise don't redirect them.
 function isLoggedIn($touch_updated_date = TRUE)
 {
     global $authentication, $config_vars;
     $session_id = getSessionID();
     if ($session_id != '') {
         $authentication = new Authentication();
         Debug::text('AMF Session ID: ' . $session_id . ' Source IP: ' . $_SERVER['REMOTE_ADDR'], __FILE__, __LINE__, __METHOD__, 10);
         if (isset($config_vars['other']['web_session_timeout']) and $config_vars['other']['web_session_timeout'] != '') {
             $authentication->setIdle((int) $config_vars['other']['web_session_timeout']);
         }
         if ($authentication->Check($session_id, $touch_updated_date) === TRUE) {
             return TRUE;
         }
     }
     return FALSE;
 }