. */ 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_lifetime', '0'); ini_set('session.cookie_secure', '1'); ini_set('session.cookie_httponly', '1'); ini_set('session.cookie_samesite', 'Strict'); 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', FILTER_SANITIZE_FULL_SPECIAL_CHARS); // 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 = ' '; require_once("inc/header.inc.php"); if ($StaticFunctions->getUserSessionStatus() == false) { // CHECK STATUS echo $StaticFunctions->killSession(); // ELSE DIE } else { ?>

(string)FILTER_SANITIZE_STRING, 'fd_pgNumUsers' => (int)FILTER_VALIDATE_INT, 'fd_pgNumSites' => (int)FILTER_VALIDATE_INT, 'edituser' => (string)FILTER_SANITIZE_STRING, 'fd_editUserId' => (string)FILTER_SANITIZE_STRING, 'fd_initialPassword' => (string)FILTER_SANITIZE_STRING, 'fd_confirmPassword' => (string)FILTER_SANITIZE_STRING, 'fd_firstName' => (string)FILTER_SANITIZE_STRING, 'fd_lastName' => (string)FILTER_SANITIZE_STRING, 'fd_userEmail' => (string)FILTER_SANITIZE_STRING, 'fd_newSiteName' => (string)FILTER_SANITIZE_STRING, 'fd_newSiteTimezone' => (string)FILTER_SANITIZE_STRING, 'fd_newSiteRegion' => (string)FILTER_SANITIZE_STRING ]); if(empty($form_data['fd_formAction'])){ // SET INITIAL STAGE $form_data['fd_formAction'] = 'actionInitial'; } ?> getMinPass(); // MINIMUM PASSWORD LENGTH ?> addSite($form_data['fd_newSiteName'], $form_data['fd_newSiteTimezone'], $form_data['fd_newSiteRegion']); $fd_newSiteId = $SiteInfo->getSiteByID($form_data['fd_newSiteName']); $SiteInfo->grantSitePermissionBySiteAndUser($fd_newSiteId["0"]["id"], "1"); $SiteInfo->grantSitePermissionBySiteAndUser($fd_newSiteId["0"]["id"], "2"); header('Location: users.php'); ob_end_clean(); unset($form_data); } } ?> getUserInfo($form_data['fd_editUserId'], "0", "0") ?>
" />

" />
" readonly/>
" />
" />
" />
checkUser($_POST['username'], $email); if ($existing): if ($existing[0]["users_username"] == $_POST['username']): $errors['username'] = $transLang['USER-USERNAMEUSED']; 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: users.php'); endif; } elseif (Registry::AUTHMETHOD == 'SAML') { if (!empty($_POST['newuser'])): // NEW USER SAML $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); if (!$email): $errors['email'] = $transLang['EMAIL_NOTVALID']; endif; $existing = $Users->lookupSamlUserByEmail($email); if ($existing): if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif; endif; endif; if (!empty($_POST['newuser']) && empty($errors)): $Users->addSAMLUser($timezone, $_POST['email'], $_POST['usertype']); header('Location: users.php'); endif; } if (!empty($_POST['editusercomplete'])): // EDIT USER if (Registry::AUTHMETHOD == 'INTERNAL') { require_once("src/Misc/PasswordHash.php"); if (empty($_POST['username'])): $errors['username'] = $transLang['USER-USERNAMENOTEMPTY']; 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['USER-USERNAMEUSED']; endif; // if ($existing[0]["users_email"] == $email): $errors['email'] = $transLang['PASSWORD_USED']; endif; // endif; } endif; if (!empty($_POST['editusercomplete']) && empty($errors)): // $hasher = new PasswordHash(8, FALSE); // $password = $hasher->HashPassword($_POST['password']); if (Registry::AUTHMETHOD == 'INTERNAL') { $editedusername=$_POST['username']; } else { $editedusername="SAML/SSO"; } $Users->editUserInfo($_POST['edituserid'], $_POST['firstname'], $_POST['lastname'], $editedusername, $_POST['email'], $_POST['usertype']); //foreach loop to check if exists, if new, delete or add as needed $SiteInfo->deleteSitePermissionByUser($_POST['edituserid']); foreach($_POST['sitepermissions'] as $editsitepermission) { $SiteInfo->grantSitePermissionBySiteAndUser($editsitepermission, $_POST['edituserid']); } header('Location: users.php'); endif; // DEL USER 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: users.php'); } } ?> getPageRows(); $pgRowCountUsers=(int)count($Users->getUserInfo("%", "%", "%")); $pgCountUsers=(int)0; if(0===$pgRowCountUsers){}else{$pgCountUsers=(int)ceil($pgRowCountUsers/$StaticFunctions->getPageRows());if($pgNumUsers>$pgCountUsers){$pgNumUsers=(int)1;}} ?>

getUserInfo("%", $StaticFunctions->getPageRows(), $pgOffsetUsers) as $rowUsers): ?>
getSite("0", $rowUsers['users_id'], "0", "0") as $sidrow) { ?> "; } elseif($sidrowcount==5) {echo '...'; break; } } ?>
deleteSitePermissionByUserAndSite ('0', $deleteid); $SiteInfo->deleteSitePermissionByUserAndSite ('1', $deleteid); $SiteInfo->deleteSitePermissionByUserAndSite ('2', $deleteid); echo $SiteInfo->deleteSite($deleteid); echo "site deleted!"; header('Location: users.php'); } } ?> getPageRows(); $pgRowCountSites=(int)count($SiteInfo->listSite("0", "0")); $pgCountSites=(int)0; if(0===$pgRowCountSites){}else{$pgCountSites=(int)ceil($pgRowCountSites/$StaticFunctions->getPageRows());if($pgNumSites>$pgCountSites){$pgNumSites=(int)1;}} ?>

listSite($StaticFunctions->getPageRows(), $pgOffsetSites) as $rowSites): ?>
countSiteUsers($rowSites['sites_id'])?>