2017-11-23 18:09:36 -05:00
|
|
|
<?php
|
|
|
|
$id = $_SESSION['user'];
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_GET['id'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
$id = $_GET['id'];
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$displayed_user = new User($id);
|
|
|
|
} catch (Exception $e) {
|
2021-03-18 13:26:03 -04:00
|
|
|
header("Location: " . WEB_URL . "/admin/?do=user");
|
2017-11-23 18:09:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['password'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
$displayed_user->change_password();
|
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['username'])) {
|
2018-07-22 15:03:07 -04:00
|
|
|
$displayed_user->change_username();
|
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['name'])) {
|
2018-07-22 15:03:07 -04:00
|
|
|
$displayed_user->change_name();
|
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['email'])) {
|
2018-07-22 15:03:07 -04:00
|
|
|
$success = $displayed_user->email_link();
|
2017-11-23 18:09:36 -05:00
|
|
|
}
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_POST['permission'])) {
|
2017-11-23 18:09:36 -05:00
|
|
|
$displayed_user->change_permission();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($_GET['what']) && $_GET['what'] == 'toggle') {
|
2017-11-23 18:09:36 -05:00
|
|
|
$displayed_user->toggle();
|
|
|
|
}
|
|
|
|
|
2018-01-07 14:39:10 -05:00
|
|
|
Template::render_header(_("User"), true);
|
2017-11-23 18:09:36 -05:00
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="text-center">
|
2021-03-18 13:26:03 -04:00
|
|
|
<h1><?php
|
|
|
|
if ($_SESSION['user'] == $_GET['id']) {
|
|
|
|
echo _("User settings");
|
|
|
|
} else {
|
|
|
|
echo _("User");
|
|
|
|
} ?></h1>
|
2017-11-23 18:09:36 -05:00
|
|
|
</div>
|
2021-03-18 13:26:03 -04:00
|
|
|
<?php if (isset($message)) { ?>
|
|
|
|
<p class="alert alert-danger"><?php echo $message ?></p>
|
2017-11-23 18:09:36 -05:00
|
|
|
<?php }
|
|
|
|
|
2021-03-18 13:26:03 -04:00
|
|
|
if (isset($success)) { ?>
|
|
|
|
<p class="alert alert-success"><?php echo $success ?></p>
|
2018-07-22 15:03:07 -04:00
|
|
|
<?php }
|
2021-03-18 13:26:03 -04:00
|
|
|
$displayed_user->render_user_settings();
|