Tweak report
This commit is contained in:
parent
b0b325522a
commit
ad8af8eb8f
@ -89,7 +89,7 @@
|
||||
<?php endif; ?>
|
||||
<?php if (isset($session_user)) { if ($session_user["0"]["users_usertype"] == "ADMIN"): ?>
|
||||
<!-- ADDITIONAL MENU IF LOGGED IN AS ADMIN -->
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['USERS']): echo " active"; endif; ?>"><a class="nav-link" href="users.php"><i class="fas fa-users"></i> <?php echo $transLang['USERS']; ?></a></li>
|
||||
<li class="nav-item<?php if ($app_current_pagename==$transLang['ADMINISTRATION']): echo " active"; endif; ?>"><a class="nav-link" href="users.php"><i class="fas fa-users"></i> <?php echo $transLang['ADMINISTRATION']; ?></a></li>
|
||||
<?php endif; }; ?>
|
||||
<?php if ($session_status == false): ?>
|
||||
<!-- MENU FOR ALL LOGGED OUT -->
|
||||
|
@ -81,10 +81,10 @@
|
||||
<div class="form-group row">
|
||||
<div class='col-sm'>
|
||||
<div class="input-group date" id="datetimepicker-1" data-target-input="#datetimepicker-1">
|
||||
<div class="input-group-prepend" data-target=".datetimepicker-1" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i>  <?php echo $transLang['START']; ?></div>
|
||||
<div class="input-group-prepend " data-target=".datetimepicker-1" data-toggle="datetimepicker">
|
||||
<div class="input-group-text "><i class="fa fa-calendar"></i>  <?php echo $transLang['START']; ?></div>
|
||||
</div>
|
||||
<input value="<?php if (isset($_POST['starttime'])) { echo $_POST['starttime']; }; ?>" name="starttime" type="text" class="form-control datetimepicker-1" id="datetimepicker-1" data-target=".datetimepicker-1" autocomplete="new-password" required />
|
||||
<input value="<?php if (isset($_POST['starttime'])) { echo $_POST['starttime']; }; ?>" name="starttime" type="text" class="datetimepicker-input form-control datetimepicker-1" id="datetimepicker-1" data-target=".datetimepicker-1" autocomplete="new-password" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-sm'>
|
||||
@ -92,7 +92,7 @@
|
||||
<div class="input-group-prepend" data-target=".datetimepicker-2" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i>  <?php echo $transLang['END']; ?></div>
|
||||
</div>
|
||||
<input value="<?php if (isset($_POST['endtime'])) { echo $_POST['endtime']; }; ?>" name="endtime" type="text" class="form-control datetimepicker-2" id="datetimepicker-2" data-target=".datetimepicker-2" autocomplete="new-password" required />
|
||||
<input value="<?php if (isset($_POST['endtime'])) { echo $_POST['endtime']; }; ?>" name="endtime" type="text" class="datetimepicker-input form-control datetimepicker-2" id="datetimepicker-2" data-target=".datetimepicker-2" autocomplete="new-password" required />
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
@ -10,6 +10,7 @@ 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 '
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Verwaltung'
|
||||
ALL = 'Alles'
|
||||
APPROVE = 'Genehmigen'
|
||||
APP_NAME = 'Empfangshalle Einloggen / Ausloggen'
|
||||
|
@ -10,6 +10,7 @@ ADDEQPT = 'Add Equipment'
|
||||
ADD_USER = 'Add User'
|
||||
ADD_USER_DESC = 'All fields are required! Username and email must be unique. Minimum password length is '
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'All'
|
||||
APPROVE = 'Approve'
|
||||
APP_NAME = 'Lobby Sign-In/Sign-Out'
|
||||
|
@ -10,6 +10,7 @@ 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 '
|
||||
ADMIN = 'Administrador'
|
||||
ADMINISTRATION = 'Administración'
|
||||
ALL = 'Todos'
|
||||
APPROVE = 'Autorizar'
|
||||
APP_NAME = 'Lobby de inicio / cierre de sesión'
|
||||
|
@ -10,6 +10,7 @@ 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 '
|
||||
ADMIN = 'Administrateur'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'Tout'
|
||||
APPROVE = 'Approuver'
|
||||
APP_NAME = 'Vestibule register/se désinscrire'
|
||||
|
121
users.php
121
users.php
@ -28,7 +28,7 @@
|
||||
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['USERS']; // PAGE FUNCTION
|
||||
$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
|
||||
@ -185,5 +185,124 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
</div>
|
||||
<!-- MODAL END -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2><?php echo $app_current_pageicon . $transLang['USERS']; ?></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>
|
||||
</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>'; ?>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
<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>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
$minpasslength = $StaticFunctions->getMinPass();
|
||||
?>
|
||||
|
||||
<!-- MODAL START -->
|
||||
<div class="modal fade" id="addUserModal" 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>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<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>
|
||||
</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 />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" required />
|
||||
</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>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- MODAL END -->
|
||||
|
||||
|
||||
<!-- CONTENT END -->
|
||||
<?php }; require_once("inc/footer.inc.php");
|
||||
|
Loading…
Reference in New Issue
Block a user