This commit is contained in:
parent
b978dfb077
commit
f3563100bb
@ -1,29 +1,53 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../autoload.php'; // AUTOLOAD
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
ob_start(); // OUTPUT BUFFER
|
||||
if (isset($_SESSION['user_id'])): $session_user = $Users->getUserInfo($_SESSION['user_id'], "1", "0"); endif; // SEE IF WE ARE LOGGED IN AND PULL NAME IF SO
|
||||
$session_status = $StaticFunctions->getSessionStatus(); // SET A STATUS
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
ob_start(); // OUTPUT BUFFER
|
||||
$session_status = $StaticFunctions->getSessionStatus(); // SET A STATUS
|
||||
$defaulttimezone = $StaticFunctions->getDefaultTZ();
|
||||
date_default_timezone_set('UTC'); // DEFAULT TO UTC
|
||||
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { // IF NO LANGUAGE COOKIE, SET LANG TO APP DEFAULT, OTHERWISE USE COOKIE LANGUAGE
|
||||
$app_disp_lang=$StaticFunctions->getDefaultLanguage();
|
||||
} else {
|
||||
$app_disp_lang=$_COOKIE['app_disp_lang'];
|
||||
};
|
||||
if(!isset($_COOKIE['app_site'])) { // LIKE LANGUAGE, DEFAULT IF NO COOKIE
|
||||
$siteid="NOT SET"; // AND TIMEZONE AGAIN
|
||||
$timezone = "UTC"; // BUT THE MODAL SHOULD POP AND BLOCK ANYWAY
|
||||
} else {
|
||||
$siteid=$_COOKIE['app_site'];
|
||||
$timezone = $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"];
|
||||
};
|
||||
$timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
|
||||
date_default_timezone_set('UTC'); // DEFAULT TO UTC
|
||||
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING
|
||||
$timezone = $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_timezone"]; // GET TIMEZONE FROM SITE ID
|
||||
$timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
|
||||
$timeplus->setTimezone(new DateTimeZone("$timezone"));
|
||||
$timenow = $timeplus->format('Y-m-d H:i:s');
|
||||
?>
|
||||
@ -97,19 +121,18 @@
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['SIGNOUT']): echo " active"; endif; ?>"><a class="nav-link" href="signout.php"><i class="fas fa-sign-out-alt"></i> <?php echo $transLang['SIGNOUT']; ?></a></li>
|
||||
</ul>
|
||||
<ul class="navbar-nav mr-sm-2">
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGIN']): echo " active"; endif; ?>"><a class="nav-link" href="login.php"><i class="fas fa-cogs"></i> <?php echo $transLang['LOGIN']; ?></a></li>
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGIN']): echo " active"; endif; ?>"><a class="nav-link btn btn-sm btn-outline-success" href="login.php"><i class="fas fa-cogs"></i> </a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($session_status == true): ?>
|
||||
<!-- MENU FOR ALL LOGGED IN - BOTTOM END -->
|
||||
</ul>
|
||||
<ul class="navbar-nav mr-sm-2">
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGOUT']): echo " active"; endif; ?>"><a class="nav-link" href="logout.php"><i class="fas fa-ban"></i> <?php echo $transLang['LOGOUT']; ?></a></li>
|
||||
<li class="nav-item"><a class="nav-link<?php $sname=$SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; if($sname=="NOSITE") { echo " btn btn-sm btn-outline-warning"; } else { echo " btn btn-sm btn-outline-secondary"; }; ?>" href="#" data-toggle="modal" data-target="#sitetimeModal"><i class="fas fa-map-marker-alt"></i> <?php if ($sname=="NOSITE") {echo $transLang['NOSITE'];} else { echo $sname; } ?></a></li>
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['LOGOUT']): echo " active"; endif; ?>"><a class="nav-link btn btn-sm btn-outline-danger" href="logout.php"><i class="fas fa-ban"></i> <?php echo $transLang['LOGOUT']; ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<ul class="form-control-sm">
|
||||
<form action="changelang.php" method="post" name="changelang" class="changelang">
|
||||
<div class="input-group mb-3">
|
||||
<select class="custom-select" id="app_disp_lang" aria-label="Language" name="app_disp_lang">
|
||||
<select class="form-control custom-select btn btn-outline-secondary" id="app_disp_lang" aria-label="Language" name="app_disp_lang">
|
||||
<?php foreach(glob('src/Language/*.ini') as $file){
|
||||
if(!is_dir($file)) { $filename=basename(preg_replace('/\.[^.]+$/','',preg_replace('/\.[^.]+$/','',$file))); }; ?>
|
||||
<option value="<?php echo $filename; ?>"<?php if ($filename==$app_disp_lang) { echo " selected"; }; ?>><?php echo strtoupper($filename); ?></option>
|
||||
@ -127,7 +150,7 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="Site"><?php echo $transLang['CHOOSE']; ?> <?php echo $transLang['SITE']; ?></h5>
|
||||
<h5 class="modal-title" id="Site"><i class="fas fa-map-marker-alt"></i> <?php echo $transLang['SITE']; ?></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@ -136,12 +159,12 @@
|
||||
<form class="form-inline my-2 my-lg-0" action="changesite.php" method="post">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<button class="btn btn-outline-secondary" type="button"><?php echo $transLang['SITE']; ?></button>
|
||||
<button class="btn btn-outline-secondary" type="button"><?php echo $transLang['CHOOSE']; ?></button>
|
||||
</div>
|
||||
<select class="custom-select" id="site" aria-label="Site" name="site">
|
||||
<option selected><?php echo $transLang['CHOOSE']; ?></option>
|
||||
<?php foreach($SiteInfo->getSiteInfo("%") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"><?php echo $row['sites_name']; ?></option>
|
||||
<select class="custom-select" id="site" aria-label="Site" name="site" required>
|
||||
<option value="<?php if (isset($siteid)) { echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; } else { echo ""; } ?>" selected><?php if (isset($siteid)) { if ($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]=="NOSITE") {echo $transLang['NOSITE'];} else { echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; } } else { echo "- - -"; } ?></option>
|
||||
<?php foreach($SiteInfo->getSite("0", $uid, "0", "0") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"><?php if ($row['sites_name']=="NOSITE") {echo $transLang['NOSITE'];} else { echo $row['sites_name']; } ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input class="btn" type="submit" value="<?php echo $transLang['SAVE']; ?>" />
|
||||
|
53
index.php
53
index.php
@ -17,26 +17,38 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['HOME']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-home"></i> '; // PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
$app_current_pagename = $transLang['HOME']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-home"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
?>
|
||||
<!-- GUEST CONTENT START -->
|
||||
|
||||
@ -129,7 +141,6 @@
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
@ -171,12 +182,14 @@
|
||||
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked" disabled>
|
||||
<?php }; ?>
|
||||
<label class="form-check-label" for="id_checked"><?php echo $transLang['ID_CHECKED']; ?></label><br>
|
||||
<?php if($row['visits_citizen']==1) { ?>
|
||||
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { if($row['visits_citizen']==1) { ?>
|
||||
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" checked disabled>
|
||||
<?php } else { ?>
|
||||
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen" disabled>
|
||||
<?php }; ?>
|
||||
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label></td>
|
||||
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label>
|
||||
<?php }; ?>
|
||||
</td>
|
||||
<td><input type="text" id="badge" name="badge" class="form-control" autofocus disabled value="<?php echo $row['visits_badge']; ?>"> <input type="text" id="initials" name="initials" class="form-control" autofocus disabled value="<?php echo $row['visits_initials']; ?>"></td>
|
||||
<td> </td>
|
||||
<td><button type="submit" name="endvisit" value="<?php echo $row['visits_id']; ?>" class="btn btn-warning btn-block"><i class="fas fa-sign-out-alt"></i> <?php echo $transLang['SIGNOUT']; ?></button><br>
|
||||
@ -201,8 +214,10 @@
|
||||
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
|
||||
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked">
|
||||
<label class="form-check-label" for="id_checked"><?php echo $transLang['ID_CHECKED']; ?></label><br>
|
||||
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { ?>
|
||||
<input class="form-check-input" type="checkbox" value="1" id="citizen" name="citizen">
|
||||
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label>
|
||||
<?php }; ?>
|
||||
<td>
|
||||
<input type="text" id="badge" name="badge" class="form-control<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['BADGE']; ?>" autofocus maxlength="15">
|
||||
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
|
||||
|
48
login.php
48
login.php
@ -17,23 +17,35 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['LOGIN']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$app_current_pagename = $transLang['LOGIN']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
@ -60,9 +72,9 @@ endif;
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<?php if(isset($_COOKIE['app_site'])) { $timezone = $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"]; } else {$timezone = "UTC";}; ?>
|
||||
<p><b><?php echo $transLang['SITE']; ?>:</b> <?php echo $SiteInfo->getSiteInfo($siteid)[0]["sites_name"]; ?>
|
||||
<br><b><?php echo $transLang['TIMEZONE']; ?>:</b> <?php echo $SiteInfo->getSiteInfo($siteid)[0]["sites_timezone"]; ?></p>
|
||||
<p><b><?php echo $transLang['SITE']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_name"]; ?>
|
||||
<br><b><?php echo $transLang['TIMEZONE']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_timezone"]; ?>
|
||||
<br><b><?php echo $transLang['REGION']; ?>:</b> <?php echo $SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"]; ?></p>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#sitetimeModal"><?php echo $transLang['CHANGE']; ?></button>
|
||||
|
44
logout.php
44
logout.php
@ -17,21 +17,35 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['LOGOUT']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-sign-out"></i> '; // PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$app_current_pagename = $transLang['LOGOUT']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-sign-out"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
|
43
profile.php
43
profile.php
@ -17,22 +17,35 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['ACCOUNT']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';// PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$app_current_pagename = $transLang['ACCOUNT']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
|
53
reports.php
53
reports.php
@ -17,25 +17,38 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo();
|
||||
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['REPORTS']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> '; // PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
$app_current_pagename = $transLang['REPORTS']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
@ -70,8 +83,10 @@
|
||||
</div>
|
||||
<?php if (isset($_POST['repsite'])) { $currentrepsite = $_POST['repsite']; } else { $currentrepsite = "0"; }; ?>
|
||||
<select name="repsite" class="form-control">
|
||||
<?php if($session_user["0"]["users_usertype"] == "ADMIN") { ?>
|
||||
<option value="all"<?php if ($currentrepsite == "all") {echo " selected";}; ?>><?php echo $transLang['ALL']; ?></option>
|
||||
<?php foreach($SiteInfo->getSiteInfo("%") as $row): ?>
|
||||
<?php } ?>
|
||||
<?php foreach($SiteInfo->getSite("0", $uid, "0", "0") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"<?php if ($currentrepsite == $row['sites_id']) {echo " selected";}; ?>><?php echo $row['sites_name']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@ -118,7 +133,7 @@
|
||||
<?php if ($_POST['reporttype'] == "Default"): ?>
|
||||
<div class="container-fluid">
|
||||
<table id="report" class="table table-striped table-bordered">
|
||||
<thead><tr><th><?php echo $transLang['IN']; ?></th><th><?php echo $transLang['OUT']; ?></th><th><?php echo $transLang['SITE']; ?></th><th><?php echo $transLang['COMPANY']; ?></th><th><?php echo $transLang['REASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['BADGE']; ?></th><th><?php echo $transLang['INITIALS']; ?></th><th><?php echo $transLang['CITIZEN']; ?></th><th><?php echo $transLang['ID_TYPE']; ?></th><th><?php echo $transLang['ID_CHECKED']; ?></th></tr></thead>
|
||||
<thead><tr><th><?php echo $transLang['IN']; ?></th><th><?php echo $transLang['OUT']; ?></th><th><?php echo $transLang['SITE']; ?></th><th><?php echo $transLang['COMPANY']; ?></th><th><?php echo $transLang['REASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['BADGE']; ?></th><th><?php echo $transLang['INITIALS']; ?></th><?php if($SiteInfo->getSite($_POST['repsite'], $uid, "0", "0")[0]["sites_region"] == "US") { ?><th><?php echo $transLang['CITIZEN']; ?></th><?php }; ?><th><?php echo $transLang['ID_TYPE']; ?></th><th><?php echo $transLang['ID_CHECKED']; ?></th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$approval = "2";
|
||||
@ -134,14 +149,14 @@
|
||||
<tr>
|
||||
<td><?php echo $timein_disp; ?></td>
|
||||
<td><?php if (!empty($row['visits_outtime'])) {echo $timeout_disp; } else {echo $transLang['IN'];}; ?></td>
|
||||
<td><?php echo $SiteInfo->getSiteInfo($row['visits_site_id'])[0]["sites_name"]; ?></td>
|
||||
<td><?php echo $SiteInfo->getSite($row['visits_site_id'], $uid, "0", "0")[0]["sites_name"]; ?></td>
|
||||
<td><?php echo $row['visits_company']; ?></td>
|
||||
<td><?php echo $transLang[$VisitTypeInfo->getVisitTypeInfo($row['visits_reason'])[0]['visittypes_name']]; ?></td>
|
||||
<td><?php echo $row['visits_lastname'] . ", " . $row['visits_firstname']; ?><br /><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50" alt="Signature" /></td>
|
||||
<td><?php if (!empty($row['visits_escort'])) {echo $row['visits_escort'] . '<br /><img src="' . $row['visits_escort_signature'] . '" width="200" height="50" alt="Escort Signature" />'; } ?></td>
|
||||
<td><?php echo $row['visits_badge']; ?></td>
|
||||
<td><?php echo $row['visits_initials']; ?></td>
|
||||
<td><?php if($row['visits_citizen']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; }; ?></td>
|
||||
<?php if($SiteInfo->getSite($_POST['repsite'], $uid, "0", "0")[0]["sites_region"] == "US") { ?> <td><?php if($row['visits_citizen']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; }; ?></td> <?php }; ?>
|
||||
<td><?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'])[0]['idtypes_name']]; ?></td>
|
||||
<td><?php if($row['visits_id_checked']==1) { echo $transLang['YESYES']; } else { echo $transLang['NONO']; }; ?></td>
|
||||
</tr>
|
||||
|
45
signin.php
45
signin.php
@ -17,23 +17,36 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';// PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
$app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-sign-in-alt"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
@ -108,7 +121,7 @@
|
||||
</div>
|
||||
<input type="hidden" name="v_signature" id="v_signature" required />
|
||||
<input type="hidden" name="siteid" id="siteid" value="<?php echo $siteid; ?>" />
|
||||
<p><?php echo $transLang['ACKNOWLEDGEMENT']; ?><p>
|
||||
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { echo "<p>" . $transLang['ACKNOWLEDGEMENT'] . "</p>"; } ?>
|
||||
<p><?php echo $transLang['GDPR_TEXT']; ?><p>
|
||||
<p><a class="btn btn-outline-secondary btn-block" data-toggle="modal" data-target="#termsModalLong" href="<?php echo $StaticFunctions->getRules(); ?>"><?php echo $transLang['REFERENCE']; ?>: (<?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?>)</a></p>
|
||||
<button type="submit" id="saveBtn" class="btn btn-lg btn-success btn-block" name="signin"><?php echo $transLang['SIGNIN']; ?></button>
|
||||
|
@ -17,24 +17,37 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$VisitActions = new \App\LobbySIO\Database\VisitActions();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['SIGNIN']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-file-signature"></i> ';// PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
$app_current_pagename = $transLang['SIGNIN']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-file-signature"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
@ -62,8 +75,8 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h4><?php echo $transLang['ACKNOWLEDGEMENT']; ?></h4>
|
||||
<h5><?php echo $transLang['ACKNOWLEDGEMENT_DOC_NAME']; ?></h5>
|
||||
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { echo "<p>" . $transLang['ACKNOWLEDGEMENT'] . "</p>"; } ?>
|
||||
<p><?php echo $transLang['GDPR_TEXT']; ?><p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { // EXIT IF NO POST
|
||||
|
44
signout.php
44
signout.php
@ -17,23 +17,37 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$VisitInfo = new \App\LobbySIO\Database\VisitInfo();
|
||||
$VisitActions = new \App\LobbySIO\Database\VisitActions();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['SIGNOUT']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';// PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
$app_current_pagename = $transLang['SIGNOUT']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-sign-out-alt"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == true) { // CHECK STATUS
|
||||
header('Location: index.php'); // ELSE HOME
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Registry { const
|
||||
DB_PRFX = 'lsio_', // DB table prefix
|
||||
ORGANIZATION = 'Widgets, Inc', // Organization name
|
||||
DEFAULTLANGUAGE = 'en', // Default language - make sure a translation file exists
|
||||
ROWSPERPAGE = '5', // Rows per page on tables (does not include reports)
|
||||
ROWSPERPAGE = '10', // Rows per page on tables (does not include reports)
|
||||
MINPASS = '8', // Minimum password length
|
||||
DEFAULTTZ = 'America/New_York' // DEFAULT TIME ZONE
|
||||
;}
|
||||
|
63
src/Database/SiteInfo.php
Executable file → Normal file
63
src/Database/SiteInfo.php
Executable file → Normal file
@ -27,29 +27,60 @@ use App\LobbySIO\Config\Registry;
|
||||
*/
|
||||
|
||||
class SiteInfo {
|
||||
public function getSiteInfo ($siteid){
|
||||
|
||||
// Return Site Information array. 0 eliminates argument
|
||||
public function getSite ($sites_id, $users_id, $rowsperpage, $offset) {
|
||||
if ($sites_id == "0") { $c_sites_id = NULL; }
|
||||
else { $c_sites_id = Registry::DB_PRFX . "sites.id LIKE \"$sites_id\""; }
|
||||
if ($users_id == "0") { $c_users_id = NULL; }
|
||||
else { $c_users_id = Registry::DB_PRFX . "users_sites.users_id LIKE \"$users_id\""; }
|
||||
|
||||
if ($c_sites_id === NULL AND $c_users_id === NULL) {
|
||||
$c_where = NULL;
|
||||
} elseif ($c_sites_id !== NULL AND $c_users_id !== NULL) {
|
||||
$c_where = "WHERE " . $c_sites_id . " AND " . $c_users_id;
|
||||
} elseif ($c_sites_id === NULL AND $c_users_id !== NULL) {
|
||||
$c_where = "WHERE " . $c_users_id;
|
||||
} elseif ($c_sites_id !== NULL AND $c_users_id === NULL) {
|
||||
$c_where = "WHERE " . $c_sites_id;
|
||||
}
|
||||
|
||||
if ($rowsperpage == "0") { $c_rowsperpage = NULL; }
|
||||
else { $c_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; }
|
||||
if ($offset == "0") { $c_offset = NULL; }
|
||||
else { $c_offset = " OFFSET " . $offset; }
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE \"$siteid\"";
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.region as sites_region,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
JOIN " . Registry::DB_PRFX . "users_sites ON " . Registry::DB_PRFX . "sites.id=" . Registry::DB_PRFX . "users_sites.sites_id
|
||||
" . $c_where . "
|
||||
ORDER BY " . Registry::DB_PRFX . "sites.name ASC" . $c_rowsperpage . $c_offset;
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getSiteName ($siteid) {
|
||||
|
||||
public function deleteSite ($siteid) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE $siteid";
|
||||
DELETE FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.id=\"$siteid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows[0]["sites_name"];
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function addSite ($sitename, $timezone, $region) {
|
||||
$query = "
|
||||
INSERT INTO " . Registry::DB_PRFX . "sites (" . Registry::DB_PRFX . "sites.name, " . Registry::DB_PRFX . "sites.timezone, " . Registry::DB_PRFX . "sites.region)
|
||||
VALUES (\"$sitename\", \"$timezone\", \"$region\")
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
5
src/Database/Users.php
Executable file → Normal file
5
src/Database/Users.php
Executable file → Normal file
@ -26,7 +26,7 @@ use App\LobbySIO\Config\Registry;
|
||||
* @author josh.north
|
||||
*/
|
||||
class Users {
|
||||
// Get site info as array by site id. Pass % for all.
|
||||
// Get user info as array by user id. Pass % for all.
|
||||
public function getUserInfo($userid, $rowsperpage, $offset) {
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
@ -86,6 +86,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) {
|
||||
@ -102,6 +103,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getUserType ($usertypeid){
|
||||
@ -122,6 +124,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getUserTypeInfo ($usertypeid) {
|
||||
|
2
src/Database/VisitInfo.php
Executable file → Normal file
2
src/Database/VisitInfo.php
Executable file → Normal file
@ -41,7 +41,7 @@ class VisitInfo {
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
if ($intime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime=\"$intime\" AND "; };
|
||||
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id=\"$siteid\" AND "; };
|
||||
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id IN (\"$siteid\") AND "; };
|
||||
if ($visitid == "%") { $cond_visitid = NULL; } else { $cond_visitid = Registry::DB_PRFX . "visits.id LIKE \"$visitid\" AND "; };
|
||||
if ($starttime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime BETWEEN \"$starttime\" and \"$endtime\" AND "; };
|
||||
$query = "
|
||||
|
@ -9,6 +9,8 @@ ACTIVEVISITS = 'Aktive Besuche'
|
||||
ADDEQPT = 'Ausrüstung hinzufügen'
|
||||
ADD_USER = 'Benutzer hinzufügen'
|
||||
ADD_USER_DESC = 'Alle Felder sind erforderlich! Benutzername und E-Mail müssen eindeutig sein. Minimale Passwortlänge ist '
|
||||
ADD_SITE = 'Ort hinzufügen'
|
||||
SADMIN = 'Standortadministrator'
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Verwaltung'
|
||||
ALL = 'Alles'
|
||||
@ -74,6 +76,7 @@ NAME = 'Vollständiger Name'
|
||||
NEW = 'Neu'
|
||||
NONEAVA = 'Keiner'
|
||||
NOSIGNIN = 'Keine Anmeldung'
|
||||
NOSITE = 'Kein Standort ausgewählt'
|
||||
NOTES = 'Anmerkungen'
|
||||
NOTES_PLACEHOLDER = 'Geben Sie bei Bedarf Notizen ein'
|
||||
NOT_AUTHORIZED = 'Nicht berechtigt!'
|
||||
@ -94,6 +97,7 @@ REASON = 'Grund für den Zugang zu Einrichtungen'
|
||||
REASONCOMPANY = 'Firma / Grund'
|
||||
REFERENCE = 'Referenz'
|
||||
REFRESH = 'Aktualisieren'
|
||||
REGION ='Region'
|
||||
REMEQPT = 'Ausrüstung entfernen'
|
||||
REPORTS = 'Berichte'
|
||||
REPORTS_DESC = 'Die Dropdown-Liste kann verwendet werden, um vorkonfigurierte Berichte auszuwählen. Weitere Berichte werden gerade geschrieben.'
|
||||
|
@ -9,6 +9,8 @@ ACTIVEVISITS = 'Active Visits'
|
||||
ADDEQPT = 'Add Equipment'
|
||||
ADD_USER = 'Add User'
|
||||
ADD_USER_DESC = 'All fields are required! Username and email must be unique. Minimum password length is '
|
||||
ADD_SITE = 'Add Site'
|
||||
SADMIN = 'Site Administrator'
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'All'
|
||||
@ -74,6 +76,7 @@ NAME = 'Name'
|
||||
NEW = 'New'
|
||||
NONEAVA = 'None'
|
||||
NOSIGNIN = 'No sign in'
|
||||
NOSITE = 'No Site Selected'
|
||||
NOTES = 'Notes'
|
||||
NOTES_PLACEHOLDER = 'Enter notes if needed'
|
||||
NOT_AUTHORIZED = 'Not Authorized!'
|
||||
@ -94,6 +97,7 @@ REASON = 'Reason for Facility Access'
|
||||
REASONCOMPANY = 'Company / Reason'
|
||||
REFERENCE = 'Reference'
|
||||
REFRESH = 'Refresh'
|
||||
REGION ='Region'
|
||||
REMEQPT = 'Remove Equipment'
|
||||
REPORTS = 'Reports'
|
||||
REPORTS_DESC = 'The drop-down below can be used to select pre-configured reports. Other reports are currently being written.'
|
||||
|
@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visitas activas'
|
||||
ADDEQPT = 'Agregar Equipo'
|
||||
ADD_USER = 'Agregar usuario'
|
||||
ADD_USER_DESC = '¡Todos los campos son obligatorios! El nombre de usuario y el correo electrónico deben ser únicos. La longitud mínima de la contraseña es '
|
||||
ADD_SITE = 'Agregar sitio'
|
||||
SADMIN = 'Administrador de ubicación'
|
||||
ADMIN = 'Administrador'
|
||||
ADMINISTRATION = 'Administración'
|
||||
ALL = 'Todos'
|
||||
@ -74,6 +76,7 @@ NAME = 'Nombre'
|
||||
NEW = 'Nuevo'
|
||||
NONEAVA = 'Nada'
|
||||
NOSIGNIN = 'No completó'
|
||||
NOSITE = 'Ningún sitio seleccionado'
|
||||
NOTES = 'Notas'
|
||||
NOTES_PLACEHOLDER = 'Introduce notas si es necesario'
|
||||
NOT_AUTHORIZED = '¡No autorizado!'
|
||||
@ -94,6 +97,7 @@ REASON = 'Razón para el acceso a las instalaciones'
|
||||
REASONCOMPANY = 'Empresa / Razón'
|
||||
REFERENCE = 'Referencia'
|
||||
REFRESH = 'Recargar'
|
||||
REGION ='Región'
|
||||
REMEQPT = 'Llevar Equipo'
|
||||
REPORTS = 'Informes'
|
||||
REPORTS_DESC = 'El menú desplegable a continuación se puede utilizar para seleccionar informes preconfigurados. Otros informes se están escribiendo actualmente.'
|
||||
|
@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visites actives'
|
||||
ADDEQPT = 'Ajouter un équipement'
|
||||
ADD_USER = 'Ajouter un utilisateur'
|
||||
ADD_USER_DESC = 'Tous les champs sont requis! Le nom d'utilisateur et l'adresse e-mail doivent être uniques. La longueur minimale du mot de passe est '
|
||||
ADD_SITE = 'Ajouter un site'
|
||||
SADMIN = 'Administrateur d'emplacement'
|
||||
ADMIN = 'Administrateur'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'Tout'
|
||||
@ -74,6 +76,7 @@ NAME = 'Nom complet'
|
||||
NEW = 'Nouveau'
|
||||
NONEAVA = 'Aucun'
|
||||
NOSIGNIN = 'Pas de connexion'
|
||||
NOSITE = 'Aucun site sélectionné'
|
||||
NOTES = 'Notes'
|
||||
NOTES_PLACEHOLDER = 'Entrez des notes si nécessaire'
|
||||
NOT_AUTHORIZED = 'Pas autorisé!'
|
||||
@ -94,6 +97,7 @@ REASON = 'Raison de l’accès aux installations'
|
||||
REASONCOMPANY = 'Organisation / Raison'
|
||||
REFERENCE = 'Reference'
|
||||
REFRESH = 'Actualiser'
|
||||
REGION ='Région'
|
||||
REMEQPT = 'Remove Equipment'
|
||||
REPORTS = 'Rapports'
|
||||
REPORTS_DESC = 'Le menu déroulant ci-dessous peut être utilisé pour sélectionner des rapports préconfigurés. D'autres rapports sont en cours de rédaction.'
|
||||
|
220
users.php
220
users.php
@ -17,38 +17,78 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // CLASSES
|
||||
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
|
||||
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
|
||||
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
|
||||
$Users = new \App\LobbySIO\Database\Users();
|
||||
if(!isset($_COOKIE['app_disp_lang'])) { $app_disp_lang = $StaticFunctions->getDefaultLanguage(); } else { $app_disp_lang = $_COOKIE['app_disp_lang']; };
|
||||
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang);
|
||||
$transLang = $Translate->userLanguage(); // SETUP TRANSLATOR
|
||||
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE FUNCTION
|
||||
$app_current_pageicon = '<i class="fas fa-list"></i> '; // PAGE ICON
|
||||
require_once("inc/header.inc.php"); // SHOW HEADER
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
|
||||
$session_user = $Users->getUserInfo($_SESSION['user_id'], "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();
|
||||
$app_current_pagename = $transLang['ADMINISTRATION']; // PAGE SETUP
|
||||
$app_current_pageicon = '<i class="fas fa-list"></i> ';
|
||||
require_once("inc/header.inc.php");
|
||||
if ($StaticFunctions->getSessionStatus() == false) { // CHECK STATUS
|
||||
echo $StaticFunctions->killSession(); // ELSE DIE
|
||||
} else { ?>
|
||||
<!-- CONTENT START -->
|
||||
|
||||
<?php if (isset($session_user)) { if($session_user["0"]["users_usertype"] !== "ADMIN") { header("Location: index.php"); ?><h2 class="content-subhead"><?php echo $transLang['NOT_AUTHORIZED']; ?></h2><?php }; }; ?>
|
||||
|
||||
<?php
|
||||
<?php // POST ACTIONS
|
||||
|
||||
// delete user only if submitted by button
|
||||
if (!empty($_POST['deluser'])) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
|
||||
$deleteid = (int) $_POST['deleteid'];
|
||||
echo $Users->deleteUser($deleteid);
|
||||
echo "user deleted!";
|
||||
if (!empty($_POST['newsite'])): // NEW SITE
|
||||
$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
|
||||
if (!empty($_POST['newuser'])): // NEW USER
|
||||
require_once("src/Misc/PasswordHash.php");
|
||||
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
|
||||
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
|
||||
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
|
||||
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
|
||||
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
|
||||
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
|
||||
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
|
||||
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
|
||||
$existing = $Users->checkUser($_POST['username'], $email);
|
||||
if ($existing):
|
||||
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
|
||||
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
|
||||
endif;
|
||||
endif;
|
||||
if (!empty($_POST['newuser']) && empty($errors)):
|
||||
$hasher = new PasswordHash(8, FALSE);
|
||||
$password = $hasher->HashPassword($_POST['password']);
|
||||
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
|
||||
if (!empty($_POST['deluser'])) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
|
||||
$deleteid = (int) $_POST['deleteid'];
|
||||
echo $Users->deleteUser($deleteid);
|
||||
echo "user deleted!";
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set up pagination
|
||||
$page_num = 1;
|
||||
@ -66,7 +106,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- USER MGMT START -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
@ -86,7 +126,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
<tbody>
|
||||
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
|
||||
<tr>
|
||||
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="button-error pure-button" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
|
||||
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="btn btn-danger btn-sm" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; if ($row['users_username'] == "KIOSK"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
@ -113,31 +153,6 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
<p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// new user pw check
|
||||
require_once("src/Misc/PasswordHash.php");
|
||||
if (!empty($_POST['newuser'])):
|
||||
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
|
||||
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
|
||||
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
|
||||
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
|
||||
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
|
||||
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
|
||||
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
|
||||
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
|
||||
$existing = $Users->checkUser($_POST['username'], $email);
|
||||
if ($existing):
|
||||
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
|
||||
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
|
||||
endif;
|
||||
endif;
|
||||
if (!empty($_POST['newuser']) && empty($errors)):
|
||||
$hasher = new PasswordHash(8, FALSE);
|
||||
$password = $hasher->HashPassword($_POST['password']);
|
||||
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
?>
|
||||
<fieldset id="registration">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
@ -184,27 +199,55 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
</div>
|
||||
</div>
|
||||
<!-- MODAL END -->
|
||||
<!-- USER MGMT END -->
|
||||
|
||||
<?php
|
||||
|
||||
// delete user only if submitted by button
|
||||
if (!empty($_POST['delsite'])) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
|
||||
$deleteid = (int) $_POST['deleteid'];
|
||||
echo $SiteInfo->deleteSite($deleteid);
|
||||
echo "site deleted!";
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up pagination
|
||||
$page_num1 = 1;
|
||||
if(!empty($_GET['pnum1'])):
|
||||
$page_num1 = filter_input(INPUT_GET, 'pnum1', FILTER_VALIDATE_INT);
|
||||
if(false === $page_num1):
|
||||
$page_num1 = 1;
|
||||
endif;
|
||||
endif;
|
||||
$offset1 = ($page_num1 - 1) * $StaticFunctions->getPageRows();
|
||||
$row_count1 = count($SiteInfo->getSite("0", "0", "0", "0"));
|
||||
$page_count1 = 0;
|
||||
if (0 === $row_count1): else: $page_count1 = (int)ceil($row_count1 / $StaticFunctions->getPageRows()); if($page_num1 > $page_count1): $page_num1 = 1; endif; endif;
|
||||
?>
|
||||
|
||||
<!-- SITE MGMT START -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2><?php echo $app_current_pageicon . $transLang['USERS']; ?></h2>
|
||||
<h2><?php echo $app_current_pageicon . $transLang['SITE']; ?></h2>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#addUserModal"><?php echo $transLang['ADD_USER']; ?></button>
|
||||
<button type="button" class="btn btn-block btn-lg btn-success" data-toggle="modal" data-target="#addSiteModal"><?php echo $transLang['ADD_SITE']; ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo '<ul class="pagination pagination-sm"><li class="page-item disabled"><a class="page-link" href="#" tabindex="-1">' . $transLang['PAGE'] . '</a></li>'; for ($i = 1; $i <= $page_count; $i++): echo '<li class="page-item'; if ($i === $page_num): echo ' active'; else: echo ' '; endif; echo '"><a class="page-link" href="' . $_SERVER['PHP_SELF'] . '?pnum=' . $i . '">' . $i . '</a></li>'; endfor; echo '</ul>'; ?>
|
||||
<?php echo '<ul class="pagination pagination-sm"><li class="page-item disabled"><a class="page-link" href="#" tabindex="-1">' . $transLang['PAGE'] . '</a></li>'; for ($i1 = 1; $i1 <= $page_count1; $i1++): echo '<li class="page-item'; if ($i1 === $page_num1): echo ' active'; else: echo ' '; endif; echo '"><a class="page-link" href="' . $_SERVER['PHP_SELF'] . '?pnum1=' . $i1 . '">' . $i1 . '</a></li>'; endfor; echo '</ul>'; ?>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['USERNAME']; ?></th><th><?php echo $transLang['EMAIL']; ?></th><th><?php echo $transLang['CREATED']; ?></th><th><?php echo $transLang['USERTYPE']; ?></th><th><?php echo $transLang['ACTIONS']; ?></th>
|
||||
<th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['TIMEZONE']; ?></th><th><?php echo $transLang['REGION']; ?></th><th><?php echo $transLang['ACTIONS']; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
|
||||
<?php foreach($SiteInfo->getSite("0", "0", $StaticFunctions->getPageRows(), $offset1) as $row1): ?>
|
||||
<tr>
|
||||
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td><td><?php echo $row['users_username']; ?></td><td><?php echo $row['users_email']; ?></td><td><?php echo $row['users_created']; ?></td><td><?php echo $transLang[$row['users_usertype']]; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row['users_id']; ?>" /><button class="button-error pure-button" id="deluser" name="deluser" value="deluser" type="submit" <?php if ($row['users_username'] == "admin"): echo "disabled"; endif; ?>><i class="fa fa-trash"></i> </button></form></td>
|
||||
<td><?php echo $row1['sites_name']; ?></td><td><?php echo $row1['sites_timezone']; ?></td><td><?php echo $row1['sites_region']; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row1['sites_id']; ?>" /><button class="btn btn-danger btn-sm" id="deluser" name="delsite" value="delsite" type="submit"><i class="fa fa-trash"></i> </button></form></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
@ -215,11 +258,11 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
?>
|
||||
|
||||
<!-- MODAL START -->
|
||||
<div class="modal fade" id="addUserModal" tabindex="-1" role="dialog" aria-labelledby="Site" aria-hidden="true">
|
||||
<div class="modal fade" id="addSiteModal" tabindex="-1" role="dialog" aria-labelledby="Site" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="AddUser"><?php echo $transLang['ADD_USER']; ?></h5>
|
||||
<h5 class="modal-title" id="AddSite"><?php echo $transLang['ADD_SITE']; ?></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@ -228,69 +271,33 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
<form class="form-inline my-2 my-lg-0" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<p class="lead"><?php echo $transLang['ADD_USER_DESC'] . $minpasslength; ?></p>
|
||||
<p class="lead"><?php echo $transLang['ADD_SITE']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// new user pw check
|
||||
require_once("src/Misc/PasswordHash.php");
|
||||
if (!empty($_POST['newuser'])):
|
||||
if (empty($_POST['username'])): $errors['username'] = $transLang['USERNAME_NOTEMPTY']; endif;
|
||||
if (preg_match('/[^a-zA-Z0-9 .-_]/', $_POST['username'])): $errors['username'] = $transLang['ILLEGAL_CHARACTERS']; endif;
|
||||
if (empty($_POST['password'])): $errors['password'] = $transLang['PASSWORD_NOTEMPTY']; endif;
|
||||
if (strlen($_POST['password']) < $minpasslength): $errors['password'] = $transLang['MIN_PASSWORD_LENGTH'] . $minpasslength; endif;
|
||||
if (empty($_POST['password_confirm'])): $errors['password_confirm'] = $transLang['PASSWORD_NOTCONFIRMED']; endif;
|
||||
if ($_POST['password'] != $_POST['password_confirm']): $errors['password_confirm'] = $transLang['PASSWORD_NOTMATCH']; endif;
|
||||
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
|
||||
if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif;
|
||||
$existing = $Users->checkUser($_POST['username'], $email);
|
||||
if ($existing):
|
||||
if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USERNAME_USED']; endif;
|
||||
if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif;
|
||||
endif;
|
||||
endif;
|
||||
if (!empty($_POST['newuser']) && empty($errors)):
|
||||
$hasher = new PasswordHash(8, FALSE);
|
||||
$password = $hasher->HashPassword($_POST['password']);
|
||||
$Users->addUser($_POST['firstname'], $_POST['lastname'], $_POST['username'], $timezone, $password, $_POST['email'], $_POST['usertype']);
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
?>
|
||||
<fieldset id="registration">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" required />
|
||||
<input type="text" class="form-control" id="sitename" name="sitename" placeholder="Site Name" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" required />
|
||||
<select class="form-control" id="timezone" name="timezone" required>
|
||||
<option value=""><?php echo $transLang['TIMEZONE']; ?></option>
|
||||
<?php foreach(DateTimeZone::listIdentifiers(DateTimeZone::ALL) as $row2) { ?><option><?php echo $row2; ?></option><?php }; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" id="username" name="username" placeholder="Username" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" id="email" name="email" placeholder="Email" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<input type="password" class="form-control" id="password" name="password" placeholder="Password" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="password" class="form-control" id="password_confirm" name="password_confirm" placeholder="Confirm Password" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<select class="custom-select" id="usertype" aria-label="<?php echo $transLang['ACCESS_LEVEL']; ?>" name="usertype" required>
|
||||
<option value="" selected><?php echo $transLang['CHOOSE']; ?> <?php echo $transLang['ACCESS_LEVEL']; ?></option><?php foreach($Users->getUserTypeInfo("%") as $row): ?>
|
||||
<option value="<?php echo $row['usertypes_id']; ?>"><?php echo $transLang[$row['usertypes_name']]; ?></option><?php endforeach; ?>
|
||||
<select class="form-control" id="region" name="region" required>
|
||||
<option value=""><?php echo $transLang['REGION']; ?></option>
|
||||
<option>CAN</option>
|
||||
<option>EMEA</option>
|
||||
<option>US</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="newuser"><i class="fa fa-user-plus"></i> <?php echo $transLang['ADD_USER']; ?></button>
|
||||
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="newsite"><i class="fa fa-user-plus"></i> <?php echo $transLang['ADD_SITE']; ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -302,6 +309,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
</div>
|
||||
</div>
|
||||
<!-- MODAL END -->
|
||||
<!-- SITE MGMT END -->
|
||||
|
||||
|
||||
<!-- CONTENT END -->
|
||||
|
Loading…
Reference in New Issue
Block a user