2014-02-01 11:17:02 +01:00
|
|
|
<?php
|
2014-04-29 21:35:29 +02:00
|
|
|
Assets::setSubTitle($this->context->transport->user->name);
|
|
|
|
Assets::addStylesheet('user-view.css');
|
2014-02-01 11:17:02 +01:00
|
|
|
?>
|
|
|
|
|
2013-10-14 10:22:53 +02:00
|
|
|
<div id="sidebar">
|
|
|
|
<div class="avatar-wrapper">
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $this->context->transport->user->name]) ?>">
|
2014-04-27 15:59:29 +02:00
|
|
|
<img
|
|
|
|
src="<?= htmlspecialchars($this->context->transport->user->getAvatarUrl(140)) ?>"
|
|
|
|
alt="<?= $this->context->transport->user->name ?>"/>
|
2013-10-14 10:22:53 +02:00
|
|
|
</a>
|
2014-04-27 14:44:06 +02:00
|
|
|
<h1><?= $this->context->transport->user->name ?></h1>
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|
|
|
|
|
2013-10-19 22:56:56 +02:00
|
|
|
<div class="unit details">
|
2013-10-15 00:41:04 +02:00
|
|
|
<h1>details</h1>
|
|
|
|
|
2013-10-15 13:14:48 +02:00
|
|
|
<div class="key-value join-date">
|
2013-10-14 10:22:53 +02:00
|
|
|
<span class="key">Joined:</span>
|
2014-04-27 15:59:29 +02:00
|
|
|
<span
|
|
|
|
class="value"
|
|
|
|
title="<?= TextHelper::formatDate($this->context->transport->user->joinDate, true) ?>">
|
|
|
|
|
2014-04-27 14:44:06 +02:00
|
|
|
<?= TextHelper::formatDate($this->context->transport->user->joinDate, false) ?>
|
2014-04-27 15:59:29 +02:00
|
|
|
|
2014-02-16 13:10:29 +01:00
|
|
|
</span>
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|
|
|
|
|
2014-02-13 09:10:24 +01:00
|
|
|
<div class="key-value last-login">
|
|
|
|
<span class="key">Last login:</span>
|
2014-04-27 15:59:29 +02:00
|
|
|
<span
|
|
|
|
class="value"
|
|
|
|
title="<?= TextHelper::formatDate($this->context->transport->user->lastLoginDate, true) ?>">
|
|
|
|
|
2014-04-27 14:44:06 +02:00
|
|
|
<?= TextHelper::formatDate($this->context->transport->user->lastLoginDate, false) ?>
|
2014-04-27 15:59:29 +02:00
|
|
|
|
2014-02-16 13:10:29 +01:00
|
|
|
</span>
|
2014-02-13 09:10:24 +01:00
|
|
|
</div>
|
|
|
|
|
2013-10-15 13:14:48 +02:00
|
|
|
<div class="key-value access-rank">
|
2013-10-14 10:22:53 +02:00
|
|
|
<span class="key">Access rank:</span>
|
2014-04-27 15:59:29 +02:00
|
|
|
<span
|
|
|
|
class="value"
|
|
|
|
title="<?= $val = AccessRank::toDisplayString($this->context->transport->user->accessRank) ?>">
|
|
|
|
|
2014-04-27 14:44:06 +02:00
|
|
|
<?= $val ?>
|
2014-04-27 15:59:29 +02:00
|
|
|
|
2014-02-16 13:10:29 +01:00
|
|
|
</span>
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|
2013-10-15 13:14:48 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
<?php if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::ViewUserEmail,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user))): ?>
|
2014-04-27 15:59:29 +02:00
|
|
|
|
2013-10-15 13:14:48 +02:00
|
|
|
<div class="key-value email">
|
|
|
|
<span class="key">E-mail:</span>
|
2014-04-27 14:44:06 +02:00
|
|
|
<span class="value" title="<?= $val = ($this->context->transport->user->emailUnconfirmed
|
2014-02-16 13:10:29 +01:00
|
|
|
? '(unconfirmed) ' . $this->context->transport->user->emailUnconfirmed
|
|
|
|
: $this->context->transport->user->emailConfirmed ?: 'none specified') ?>">
|
2014-04-27 14:44:06 +02:00
|
|
|
<?= $val ?>
|
2014-02-16 13:10:29 +01:00
|
|
|
</span>
|
2013-10-16 20:26:48 +02:00
|
|
|
<br>(only you and staff can see this)
|
2013-10-15 13:14:48 +02:00
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2013-11-30 00:07:23 +01:00
|
|
|
<?php
|
|
|
|
$userModificationPrivileges = [
|
|
|
|
Privilege::ChangeUserName,
|
|
|
|
Privilege::ChangeUserEmail,
|
|
|
|
Privilege::ChangeUserPassword,
|
|
|
|
Privilege::ChangeUserAccessRank,
|
|
|
|
];
|
|
|
|
$userModificationPrivileges = array_fill_keys($userModificationPrivileges, false);
|
|
|
|
foreach (array_keys($userModificationPrivileges) as $privilege)
|
|
|
|
{
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
$privilege,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user)))
|
2014-04-27 15:59:29 +02:00
|
|
|
{
|
2013-11-30 00:07:23 +01:00
|
|
|
$userModificationPrivileges[$privilege] = true;
|
2014-04-27 15:59:29 +02:00
|
|
|
}
|
2013-11-30 00:07:23 +01:00
|
|
|
}
|
|
|
|
$canModifyAnything = count(array_filter($userModificationPrivileges)) > 0;
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2013-11-30 00:07:23 +01:00
|
|
|
$options = [];
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2013-11-30 00:07:23 +01:00
|
|
|
if ($canModifyAnything)
|
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
|
|
|
'class' => 'edit',
|
|
|
|
'text' => 'Edit account settings',
|
2014-04-29 21:35:29 +02:00
|
|
|
'link' => \Chibi\Router::linkTo(['UserController', 'editAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name, 'tab' => 'edit']),
|
2013-11-30 00:07:23 +01:00
|
|
|
];
|
|
|
|
}
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
if (Access::check(Privilege::AcceptUserRegistration)
|
2014-04-27 15:59:29 +02:00
|
|
|
and !$this->context->transport->user->staffConfirmed
|
2014-04-29 21:35:29 +02:00
|
|
|
and getConfig()->registration->staffActivation)
|
2013-11-30 00:07:23 +01:00
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
2014-02-17 19:50:02 +01:00
|
|
|
'class' => 'accept-registration',
|
|
|
|
'text' => 'Accept registration',
|
2014-04-29 21:35:29 +02:00
|
|
|
'simple-action' => \Chibi\Router::linkTo(['UserController', 'acceptRegistrationAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]),
|
2013-11-30 00:07:23 +01:00
|
|
|
];
|
|
|
|
}
|
2013-10-19 19:34:15 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::FlagUser,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user)))
|
2013-11-30 00:07:23 +01:00
|
|
|
{
|
|
|
|
if ($this->context->flagged)
|
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
|
|
|
'class' => 'flag',
|
|
|
|
'text' => 'Flagged',
|
|
|
|
'inactive' => true,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
|
|
|
'class' => 'flag',
|
|
|
|
'text' => 'Flag for moderator attention',
|
2014-04-29 21:35:29 +02:00
|
|
|
'simple-action' => \Chibi\Router::linkTo(['UserController', 'flagAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]),
|
2013-11-30 00:07:23 +01:00
|
|
|
'data-confirm-text' => 'Are you sure you want to flag this user?',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
2013-11-17 14:52:46 +01:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::BanUser,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user)))
|
2013-11-30 00:07:23 +01:00
|
|
|
{
|
|
|
|
if (!$this->context->transport->user->banned)
|
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
|
|
|
'class' => 'ban',
|
|
|
|
'text' => 'Ban user',
|
2014-04-29 21:35:29 +02:00
|
|
|
'simple-action' => \Chibi\Router::linkTo(['UserController', 'banAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]),
|
2014-02-19 20:43:34 +01:00
|
|
|
'data-confirm-text' => 'Are you sure you want to ban this user?',
|
2013-11-30 00:07:23 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
|
|
|
'class' => 'unban',
|
|
|
|
'text' => 'Unban user',
|
2014-04-29 21:35:29 +02:00
|
|
|
'simple-action' => \Chibi\Router::linkTo(['UserController', 'unbanAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]),
|
2014-02-19 20:43:34 +01:00
|
|
|
'data-confirm-text' => 'Are you sure you want to unban this user?',
|
2013-11-30 00:07:23 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
2013-10-15 13:14:48 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::DeleteUser,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user)))
|
2013-11-30 00:07:23 +01:00
|
|
|
{
|
|
|
|
$options []=
|
|
|
|
[
|
2014-02-17 19:50:02 +01:00
|
|
|
'class' => 'delete',
|
|
|
|
'text' => 'Delete account',
|
2014-04-29 21:35:29 +02:00
|
|
|
'link' => \Chibi\Router::linkTo(['UserController', 'deleteAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name, 'tab' => 'delete']),
|
2013-11-30 00:07:23 +01:00
|
|
|
];
|
|
|
|
}
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2013-11-30 00:07:23 +01:00
|
|
|
$this->context->options = $options;
|
2014-04-29 21:35:29 +02:00
|
|
|
\Chibi\View::render('sidebar-options', $this->context);
|
2013-11-30 00:07:23 +01:00
|
|
|
?>
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="inner-content">
|
2013-11-30 00:03:59 +01:00
|
|
|
<nav class="tabs">
|
|
|
|
<ul>
|
|
|
|
<?php if ($this->context->transport->tab == 'favs'): ?>
|
|
|
|
<li class="selected favs">
|
|
|
|
<?php else: ?>
|
|
|
|
<li class="favs">
|
|
|
|
<?php endif ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name,
|
|
|
|
'tab' => 'favs',
|
|
|
|
'page' => 1]) ?>">
|
2013-11-30 00:03:59 +01:00
|
|
|
Favs
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<?php if ($this->context->transport->tab == 'uploads'): ?>
|
|
|
|
<li class="selected uploads">
|
|
|
|
<?php else: ?>
|
|
|
|
<li class="uploads">
|
|
|
|
<?php endif ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name,
|
|
|
|
'tab' => 'uploads',
|
|
|
|
'page' => 1]) ?>">
|
2013-11-30 00:03:59 +01:00
|
|
|
Uploads
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
<?php if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::ChangeUserSettings,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user))): ?>
|
2014-04-27 15:59:29 +02:00
|
|
|
|
2013-11-30 00:03:59 +01:00
|
|
|
<?php if ($this->context->transport->tab == 'settings'): ?>
|
|
|
|
<li class="selected settings">
|
2013-10-14 10:22:53 +02:00
|
|
|
<?php else: ?>
|
2013-11-30 00:03:59 +01:00
|
|
|
<li class="settings">
|
2013-10-14 10:22:53 +02:00
|
|
|
<?php endif ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'settingsAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]) ?>">
|
2013-11-30 00:03:59 +01:00
|
|
|
Browsing settings
|
2013-10-14 10:22:53 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
2013-11-30 00:03:59 +01:00
|
|
|
<?php endif ?>
|
2013-10-14 10:22:53 +02:00
|
|
|
|
2013-11-30 00:03:59 +01:00
|
|
|
<?php if ($canModifyAnything): ?>
|
|
|
|
<?php if ($this->context->transport->tab == 'edit'): ?>
|
|
|
|
<li class="selected edit">
|
2013-10-14 10:22:53 +02:00
|
|
|
<?php else: ?>
|
2013-11-30 00:03:59 +01:00
|
|
|
<li class="edit">
|
2013-10-14 10:22:53 +02:00
|
|
|
<?php endif ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'editAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]) ?>">
|
2013-11-30 00:03:59 +01:00
|
|
|
Account settings
|
2013-10-14 10:22:53 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
2013-11-30 00:03:59 +01:00
|
|
|
<?php endif ?>
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2014-04-29 23:52:17 +02:00
|
|
|
<?php if (Access::check(
|
2014-04-27 15:59:29 +02:00
|
|
|
Privilege::DeleteUser,
|
2014-04-29 23:52:17 +02:00
|
|
|
Access::getIdentity($this->context->transport->user))): ?>
|
2013-11-30 00:03:59 +01:00
|
|
|
<?php if ($this->context->transport->tab == 'delete'): ?>
|
|
|
|
<li class="selected delete">
|
|
|
|
<?php else: ?>
|
|
|
|
<li class="delete">
|
2013-10-15 13:14:48 +02:00
|
|
|
<?php endif ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<a href="<?= \Chibi\Router::linkTo(['UserController', 'deleteAction'], [
|
2014-04-27 15:59:29 +02:00
|
|
|
'name' => $this->context->transport->user->name]) ?>">
|
2013-11-30 00:03:59 +01:00
|
|
|
Delete account
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<?php endif ?>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2013-10-14 10:22:53 +02:00
|
|
|
|
2014-02-16 11:44:42 +01:00
|
|
|
<div class="tab-content">
|
|
|
|
<?php if (isset($this->context->transport->posts)): ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<?php \Chibi\View::render('post-list', $this->context) ?>
|
2014-02-16 11:44:42 +01:00
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
<?php if ($this->context->transport->tab == 'settings'): ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<?php \Chibi\View::render('user-settings', $this->context) ?>
|
2014-02-16 11:44:42 +01:00
|
|
|
<?php elseif ($this->context->transport->tab == 'edit'): ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<?php \Chibi\View::render('user-edit', $this->context) ?>
|
2014-02-16 11:44:42 +01:00
|
|
|
<?php elseif ($this->context->transport->tab == 'delete'): ?>
|
2014-04-29 21:35:29 +02:00
|
|
|
<?php \Chibi\View::render('user-delete', $this->context) ?>
|
2014-02-16 11:44:42 +01:00
|
|
|
<?php endif ?>
|
|
|
|
</div>
|
2013-10-15 00:41:04 +02:00
|
|
|
|
2013-10-14 10:22:53 +02:00
|
|
|
</div>
|