FreeSTAR-Status-Engine/admin/user.php

64 lines
1.1 KiB
PHP
Raw Normal View History

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