Fix more IOS stuff. Adjust sig size. Adjust bootstrap inc. Add site welcome. Fix User admin. Fix site delete. NOTE - updates past this must adjust sql initial column. ALTER TABLE lsio_visits MODIFY initials INT. Also add WELCOMETO to lang file or recopy if you use defaults.
This commit is contained in:
100
users.php
100
users.php
@@ -59,29 +59,47 @@
|
||||
?>
|
||||
|
||||
<!-- USER EDIT START -->
|
||||
<div class="container">
|
||||
<div class="container bg-info rounded">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2><?php echo $app_current_pageicon . $transLang['EDIT_PROFILE']; ?></h2>
|
||||
</div>
|
||||
</div>
|
||||
<form class="form-inline my-2 my-lg-0" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
<form class="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
<fieldset id="editor">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="form-row">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="firstname"><?php echo $transLang['FIRSTNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $edituser["0"]["users_firstname"]; ?>" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="lastname"><?php echo $transLang['LASTNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $edituser["0"]["users_lastname"]; ?>" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="username"><?php echo $transLang['USERNAME']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="username" name="username" value="<?php echo $edituser["0"]["users_username"]; ?>" required />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="email"><?php echo $transLang['EMAIL']; ?></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="email" name="email" value="<?php echo $edituser["0"]["users_email"]; ?>" />
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="username"><?php echo $transLang['ACCESS_LEVEL']; ?></span>
|
||||
</div>
|
||||
<select class="custom-select" id="usertype" aria-label="<?php echo $transLang['ACCESS_LEVEL']; ?>" name="usertype" required>
|
||||
<?php foreach($Users->getUserTypeInfo("%") as $row): ?>
|
||||
<option value="<?php echo $row['usertypes_id']; ?>"<?php if ($row['usertypes_id']==$edituser["0"]["users_usertypeid"]) { echo " selected"; } ?>><?php echo $transLang[$row['usertypes_name']]; ?></option>
|
||||
@@ -89,29 +107,24 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<?php
|
||||
// var_dump($SiteInfo->getSite("0", "0", "0", "0"));
|
||||
// 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"; }
|
||||
?>
|
||||
<select id="sitepermissions" name="sitepermissions" class="custom-select" multiple size="5">
|
||||
<?php foreach($SiteInfo->getSite("0", $edituser["0"]["users_id"], "0", "0") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"<?php if ($row['users_sites_users_id']==$edituser["0"]["users_id"]) { echo " selected"; } ?>><?php echo $row['sites_name']; ?></option>
|
||||
<div class="form-row">
|
||||
<div class="col input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="username"><?php echo $transLang['SITE']; ?></span>
|
||||
</div>
|
||||
<select id="sitepermissions" name="sitepermissions[]" class="custom-select" multiple size="5">
|
||||
<?php foreach($SiteInfo->listSite("0", "0") as $row): ?>
|
||||
<option value="<?php echo $row['sites_id']; ?>"<?php if ($SiteInfo->getSitePerms($row['sites_id'], $edituser["0"]["users_id"])=="1") { echo " selected"; } ?>><?php echo $row['sites_name']; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<button type="submit" class="form-control btn btn-block btn-primary" value="Submit" name="editusercomplete"><i class="fa fa-user-plus"></i> <?php echo $transLang['SAVE']; ?></button>
|
||||
<div class="form-row">
|
||||
<div class="col input-group">
|
||||
<input type="hidden" id="edituserid" name="edituserid" value="<?php echo $edituser["0"]["users_id"]; ?>" />
|
||||
<button type="submit" class="form-control btn btn-block btn-success" value="Submit" name="editusercomplete"><i class="fa fa-user-plus"></i> <?php echo $transLang['SAVE']; ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@@ -156,6 +169,39 @@
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
|
||||
if (!empty($_POST['editusercomplete'])): // EDIT 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['editusercomplete']) && empty($errors)):
|
||||
// $hasher = new PasswordHash(8, FALSE);
|
||||
// $password = $hasher->HashPassword($_POST['password']);
|
||||
$Users->editUserInfo($_POST['edituserid'], $_POST['firstname'], $_POST['lastname'], $_POST['username'], $_POST['email'], $_POST['usertype']);
|
||||
//foreach loop to check if exists, if new, delete or add as needed
|
||||
if (!empty($_POST['sitepermissions'])){
|
||||
$SiteInfo->delSitePerms($_POST['edituserid']);
|
||||
foreach($_POST['sitepermissions'] as $editsitepermission) {
|
||||
$SiteInfo->setSitePerms($editsitepermission, $_POST['edituserid']);
|
||||
}
|
||||
}
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// DEL USER
|
||||
if (!empty($_POST['deluser'])) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE' || ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['_METHOD'] == 'DELETE')) {
|
||||
$deleteid = (int) $_POST['deleteid'];
|
||||
@@ -294,7 +340,7 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
|
||||
|
||||
<?php
|
||||
|
||||
// delete user only if submitted by button
|
||||
// delete site 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'];
|
||||
|
||||
Reference in New Issue
Block a user