.
*/
ini_set('session.gc_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES
session_save_path('.tmp'); // TEMP
session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
use App\LobbySIO\Config\Registry;
$Users = new \App\LobbySIO\Database\Users();
if (Registry::AUTHMETHOD == 'SAML') {
//simplesaml
require_once('../simplesamlphp/lib/_autoload.php');
$auth = new \SimpleSAML\Auth\Simple(Registry::AUTHIDP);
//$auth->requireAuth();
$auth->isAuthenticated();
if (!$auth->isAuthenticated()) {
$attributes = 'none';
} else {
$attributes = $auth->getAttributes();
$saml_user_email = $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'][0];
$saml_user_info = $Users->getUserInfoByEmail($saml_user_email, "1", "0");
$saml_user_id = $saml_user_info["0"]["users_id"];
}
$session = \SimpleSAML\Session::getSessionFromRequest();
$session->cleanup();
}
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
if (isset($saml_user_id)) {
$sessuserid=$saml_user_id;
} else {
$sessuserid=$_SESSION['user_id'];
}
} elseif (!isset($_SESSION['user_id'])) {
if (isset($saml_user_id)) {
$sessuserid=$saml_user_id;
} else {
$sessuserid='2';
}
$session_user = $Users->getUserInfo($sessuserid, "1", "0"); }
if (isset($session_user)) { // GET UID OR SET TO KIOSK
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
if(!isset($app_disp_lang)) {
$app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
$siteidcookie = filter_input(INPUT_COOKIE, 'app_site'); // SETUP SITE
foreach($SiteInfo->getSite("0", $uid, "0", "0") as $arr) {
$lookup_array[$arr['sites_id']]=1; }
if(isset($lookup_array[$siteidcookie])) {
$siteid = $siteidcookie; } else { $siteid = "1"; }
if(!isset($siteid)) { $siteid="1"; }
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); // SETUP TRANSLATOR
$transLang = $Translate->userLanguage();
$VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo(); // ADDITIONAL CLASSES
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
$VisitActions = new \App\LobbySIO\Database\VisitActions();
$app_current_pagename = $transLang['HOME']; // PAGE SETUP
$app_current_pageicon = ' ';
require_once("inc/header.inc.php");
if ($StaticFunctions->getUserSessionStatus() == false) { // CHECK STATUS
?>
getSite($siteid, $uid, "0", "0")[0]["sites_name"]; ?>
setTimeZone(new DateTimeZone('UTC'));
$postdate=$newdate->format('Y-m-d H:i:s');
echo $VisitActions->endVisit($_POST['endvisit'], $postdate);
} else {
echo $VisitActions->endVisit($_POST['endvisit'], $StaticFunctions->getUTC());
}
}
if (!empty($_POST['voidvisit'])) {
echo $VisitActions->voidVisit($_POST['voidvisit'], "0", $_POST['voidnotes']);
}
// If post is approved, save after error checking.
if (!empty($_POST['approvevisit'])) {
if (empty($_POST['id_type'])) { $id_type_error="1"; }
else { $id_type_error="0";
if (empty($_POST['badge'])) { $badge_error="1"; }
else { $badge_error="0";
if (empty($_POST['initials'])) { $initials_error="1"; }
else { $initials_error="0";
if (empty($_POST['citizen'])) { $citizen_error="1"; }
elseif ($_POST['citizen'] === "00") { $citizen_error="1"; }
else { $citizen_error="0";
if (isset($_POST['id_type']) && $_POST['id_type'] === 1 && isset($_POST['id_reference'])) { $id_reference_error="0"; }
elseif (isset($_POST['id_type']) && $_POST['id_type'] === 1 && empty($_POST['id_reference'])) { $id_reference_error="1"; }
$approved="2";
echo $VisitActions->approveVisit($_POST['approvevisit'], $_POST['id_type'], $_POST['id_reference'], $_POST['citizen'], $_POST['badge'], $_POST['initials'], $approved);
}
}
}
}
}
// check all unapproved or approved
$approval = "1";
// Set up pagination
$page_num = 1;
if(!empty($_GET['pnum'])):
$page_num = filter_input(INPUT_GET, 'pnum', FILTER_VALIDATE_INT);
if(false === $page_num):
$page_num = 1;
endif;
endif;
$offset = ($page_num - 1) * $StaticFunctions->getPageRows();
$row_count = count($VisitInfo->getVisitInfo($siteid, $approval, "empty", "%", "%", "%", "%", "%", "%"));
$page_count = 0;
if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctions->getPageRows()); if($page_num > $page_count): $page_num = 1; endif; endif;
?>
' . $transLang['PAGE'] . ''; for ($i = 1; $i <= $page_count; $i++): echo '
' . $i . ''; endfor; echo ''; ?>
| | | | | getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?> | |
getVisitInfo($siteid, $approval, "empty", "%", "%", "%", "%", $StaticFunctions->getPageRows(), $offset) as $row):
$visitid = $row['visits_id'];
$timein = new DateTime($row['visits_intime'], new DateTimeZone('UTC'));
$timein->setTimezone(new DateTimeZone("$timezone"));
$timein_disp = $timein->format('Y-m-d H:i:s');
if(!empty($row['visits_carnum'])) { $carnum=$row['visits_carnum']; } else { $carnum="";};
if(!empty($row['visits_ssanum'])) { $ssanum=$row['visits_ssanum']; } else { $ssanum="";};
?>