.
*/
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
ini_set('session.use_cookies', '1');
ini_set('session.use_only_cookies', '1');
ini_set('session.cookie_secure', '0');
ini_set('session.cookie_httponly', '0');
ini_set('session.cookie_samesite', 'Lax');
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['STR_COMMON_HOME']; // PAGE SETUP
$app_current_pageicon = ' ';
require_once("inc/header.inc.php");
header("X-Frame-Options: SAMEORIGIN");
header("X-Content-Type-Options: nosniff");
//header("Content-Security-Policy: script-src 'self' 'unsafe-inline'; script-src-elem 'self'; script-src-attr 'self'; style-src 'self'; style-src-elem 'self'; style-src-attr 'self'; img-src 'self'; connect-src 'self'; frame-src 'self'; font-src 'self'; media-src 'self'; object-src 'self'; manifest-src 'self'; worker-src 'self'; prefetch-src 'self'; form-action 'self'; frame-ancestors 'self'; default-src 'self'", false);
if (!empty($_GET['a'])) {
echo '
' . print_r($_POST, true) . '
';
echo 'Verification has been : ' . (Csrf::verifyToken('home') ? 'successful' : 'unsuccessful');
}
?>
getUserSessionStatus() == false) { ?>
getSite($siteid, $uid, "0", "0")[0]["sites_name"]; ?>
getUserSessionStatus() == true) {
if (empty($Users->readUserFirstAndLast($uid)[0]["users_lastname"])) {
$Users->updateSamlFirstAndLast($uid, $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname'][0], $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname'][0]);
?>
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());
}
}
// VOID VISIT IF POSTED
if (!empty($_POST['voidvisit'])) {
echo $VisitActions->voidVisit($_POST['voidvisit'], "0", $_POST['voidnotes']);
}
// UPDATE VENDOR RECORD IF POSTED
if (!empty($_POST['updateinitialvendorvisit'])) {
echo $VisitActions->setInfoVendorVisitInitial($_POST['db_vendorinfo_id'], $_POST['db_vendorinfo_checklistrequired'], $_POST['db_vendorinfo_routinework'], $_POST['db_vendorinfo_nonroutinework'], $_POST['db_vendorinfo_coi'], $_POST['db_vendorinfo_worksummary'], $_POST['db_vendorinfo_equipmentsummary'] );
}
// FINALIZE VENDOR RECORD IF POSTED
if (!empty($_POST['updatefinalvendorvisit'])) {
echo $VisitActions->setInfoVendorVisitFinal($_POST['db_vendorinfo_id'], $_POST['db_vendorinfo_checklistcompleted'], $_POST['db_vendorinfo_workcompleted'], $_POST['db_vendorinfo_sitecleanup'], $uid, $_POST['db_vendorinfo_doccompleted'] );
}
// MANUAL SIGNIN
$form_data = filter_input_array(INPUT_POST, [
'form_data_stage' => (string)FILTER_SANITIZE_STRING,
'form_data_siteid' => (int)FILTER_VALIDATE_INT,
'form_data_isvendor' => (int)FILTER_VALIDATE_INT,
'form_data_manualsignindate' => (string)FILTER_SANITIZE_STRING,
'form_data_firstname' => (string)FILTER_SANITIZE_STRING,
'form_data_lastname' => (string)FILTER_SANITIZE_STRING,
'form_data_carnum' => (string)FILTER_SANITIZE_STRING,
'form_data_ssanum' => (string)FILTER_SANITIZE_STRING,
'form_data_company' => (string)FILTER_SANITIZE_STRING,
'form_data_contact1' => (string)FILTER_SANITIZE_STRING,
'form_data_contact2' => (string)FILTER_SANITIZE_STRING,
'form_data_workstart' => (string)FILTER_SANITIZE_STRING,
'form_data_workend' => (string)FILTER_SANITIZE_STRING,
'form_data_visittype' => (int)FILTER_VALIDATE_INT,
'form_data_escortrequired' => (int)FILTER_VALIDATE_INT,
'form_data_v_signature' => (string)FILTER_SANITIZE_STRING,
'form_data_e_signature' => (string)FILTER_SANITIZE_STRING,
'form_data_escortname' => (string)FILTER_SANITIZE_STRING
]);
// SET MANUALSIGNIN STAGE
if(!empty($form_data['form_data_stage'])){
if($form_data['form_data_stage']==='manualsignin'){
if(!empty($form_data['form_data_manualsignindate'])){
$manualdate = new DateTime($form_data['form_data_manualsignindate'], new DateTimeZone($timezone));
$manualdate->setTimeZone(new DateTimeZone('UTC'));
$form_data['form_data_manualsignindate']=$manualdate->format('Y-m-d H:i:s');
} else {
$form_data['form_data_manualsignindate'] = $StaticFunctions->getUTC();
}
if (empty($form_data['form_data_carnum'])) { $carnum="";} else {$carnum=$form_data['form_data_carnum'];}
if (empty($form_data['form_data_ssanum'])) { $ssanum="";} else {$ssanum=$form_data['form_data_ssanum'];}
if (empty($form_data['form_data_isvendor'])) { $isvendor="0";} else {$isvendor=$form_data['form_data_isvendor'];}
if (empty($form_data['form_data_contact1'])) { $db_vendorinfo_contact1="";} else {$db_vendorinfo_contact1=$form_data['form_data_contact1'];}
if (empty($form_data['form_data_contact2'])) { $db_vendorinfo_contact2="";} else {$db_vendorinfo_contact2=$form_data['form_data_contact2'];}
if (empty($form_data['form_data_workstart'])) { $db_vendorinfo_workstart="";} else {$db_vendorinfo_workstart=$form_data['form_data_workstart'];}
if (empty($form_data['form_data_workend'])) { $db_vendorinfo_workend="";} else {$db_vendorinfo_workend=$form_data['form_data_workend'];}
$visitid = $VisitActions->newVisit($form_data['form_data_firstname'], $form_data['form_data_lastname'], $form_data['form_data_company'], $form_data['form_data_visittype'], $form_data['form_data_manualsignindate'], $form_data['form_data_v_signature'], $form_data['form_data_siteid'], "1", $form_data['form_data_e_signature'], $form_data['form_data_escortname'], $carnum, $ssanum, $isvendor);
if($form_data['form_data_isvendor'] === (int)"1") {
$vendorid = $VisitActions->setInfoVendorVisitNew($visitid, $db_vendorinfo_contact1, $db_vendorinfo_contact2, $db_vendorinfo_workstart, $db_vendorinfo_workend);
}
}
}
// 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=(int)'1'; } elseif ($_POST['citizen']==='00') { $citizen_error=(int)'1'; } else { $citizen_error=(int)'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; } else { $id_reference_error=0; };
if ($id_type_error+$badge_error+$initials_error+$citizen_error+$id_reference_error===0) {
$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;
?>
| | | | | 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="";}
if(!empty($row['visits_isvendor'])) { $isvendor=$row['visits_isvendor']; } else { $isvendor="";}
if(!empty($row['visits_approved'])) { $visitapproved=$row['visits_approved']; } else { $visitapproved="";}
?>
getInfoVendorVisitInitial($visitid) as $rowvn) {
$db_vendorinfo_id = $rowvn['db_vendorinfo_id'];
$db_vendorinfo_contact1 = $rowvn['db_vendorinfo_contact1'];
$db_vendorinfo_contact2 = $rowvn['db_vendorinfo_contact2'];
$db_vendorinfo_workstart = $rowvn['db_vendorinfo_workstart'];
$db_vendorinfo_workend = $rowvn['db_vendorinfo_workend'];
$db_vendorinfo_customerimpacted = $rowvn['db_vendorinfo_customerimpacted'];
$db_vendorinfo_checklistrequired= $rowvn['db_vendorinfo_checklistrequired'];
$db_vendorinfo_routinework = $rowvn['db_vendorinfo_routinework'];
$db_vendorinfo_nonroutinework = $rowvn['db_vendorinfo_nonroutinework'];
$db_vendorinfo_coi = $rowvn['db_vendorinfo_coi'];
$db_vendorinfo_worksummary = $rowvn['db_vendorinfo_worksummary'];
$db_vendorinfo_equipmentsummary = $rowvn['db_vendorinfo_equipmentsummary'];
if ($db_vendorinfo_routinework === 1 || $db_vendorinfo_nonroutinework === 1) {
if (!empty($db_vendorinfo_worksummary) && !empty($db_vendorinfo_equipmentsummary)){$initialvendorformcomplete=1;}
} else {$initialvendorformcomplete=0;}
?>
getInfoVendorVisitFinal($visitid) as $rowvm) {
$db_vendorinfo_id = $rowvm['db_vendorinfo_id'];
$db_vendorinfo_contact1 = $rowvm['db_vendorinfo_contact1'];
$db_vendorinfo_contact2 = $rowvm['db_vendorinfo_contact2'];
$db_vendorinfo_workstart = $rowvm['db_vendorinfo_workstart'];
$db_vendorinfo_workend = $rowvm['db_vendorinfo_workend'];
$db_vendorinfo_customerimpacted = $rowvm['db_vendorinfo_customerimpacted'];
$db_vendorinfo_checklistrequired = $rowvm['db_vendorinfo_checklistrequired'];
$db_vendorinfo_routinework = $rowvm['db_vendorinfo_routinework'];
$db_vendorinfo_nonroutinework = $rowvm['db_vendorinfo_nonroutinework'];
$db_vendorinfo_coi = $rowvm['db_vendorinfo_coi'];
$db_vendorinfo_worksummary = $rowvm['db_vendorinfo_worksummary'];
$db_vendorinfo_equipmentsummary = $rowvm['db_vendorinfo_equipmentsummary'];
$db_vendorinfo_checklistcompleted = $rowvm['db_vendorinfo_checklistcompleted'];
$db_vendorinfo_workcompleted = $rowvm['db_vendorinfo_workcompleted'];
$db_vendorinfo_sitecleanup = $rowvm['db_vendorinfo_sitecleanup'];
$db_vendorinfo_doccompleted = $rowvm['db_vendorinfo_doccompleted'];
if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $finalvendorformcomplete=1; } else { $finalvendorformcomplete=0; }
?>