Пример #1
0
<?php

$uid = TaskerMAN\Core\IO::GET('id');
$user = new TaskerMAN\Application\User($uid);
// User does not exist, throw 404
if (!$user->exists) {
    throw new TaskMAN\Core\FatalException('404 - Page Not Found', new \Exception('Requested user (' . $uid . ') was not found'));
}
TaskerMAN\WebInterface\WebInterface::setTitle($user->name);
$stats = TaskerMAN\Application\DashboardStats::getStats($user->id);
if (isset($_POST['delete'])) {
    try {
        TaskerMAN\Application\UserManagement::delete($uid);
        if ($uid == TaskerMAN\WebInterface\WebInterface::$user->getID()) {
            // User deleted themselves, log them out
            TaskerMAN\WebInterface\Session::destroy();
            header('Location: index.php?p=login');
            exit;
        }
        header('Location: index.php?p=list_users');
        exit;
    } catch (TaskerMAN\Application\UserManagementException $e) {
        $alert = '<div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div>';
    }
} elseif (isset($_POST['submit'])) {
    // Form submitted
    if (isset($_POST['admin'])) {
        $is_admin = true;
    } else {
        $is_admin = false;
    }