Simplified views in UserController

This commit is contained in:
Marcin Kurczewski 2014-05-04 12:01:14 +02:00
parent 8b44a248cc
commit 9e2e3ceb7f
10 changed files with 244 additions and 282 deletions

View file

@ -132,40 +132,39 @@ $tagValidation =
\Chibi\Router::register(['TagController', 'mergeView'], 'GET', '/tags-merge', $tagValidation); \Chibi\Router::register(['TagController', 'mergeView'], 'GET', '/tags-merge', $tagValidation);
\Chibi\Router::register(['TagController', 'mergeAction'], 'POST', '/tags-merge', $tagValidation); \Chibi\Router::register(['TagController', 'mergeAction'], 'POST', '/tags-merge', $tagValidation);
$userValidations = $userValidation =
[ [
'name' => '[^\/]+', 'name' => '[^\/]+',
'page' => '\d*', 'page' => '\d*',
'tab' => 'favs|uploads', 'tab' => 'favs|uploads|settings|edit|delete',
'filter' => '[^\/]+', 'filter' => '[^\/]+',
]; ];
\Chibi\Router::register(['UserController', 'listView'], 'GET', '/users', $userValidations); \Chibi\Router::register(['UserController', 'listView'], 'GET', '/users', $userValidation);
\Chibi\Router::register(['UserController', 'listView'], 'GET', '/users/{page}', $userValidations); \Chibi\Router::register(['UserController', 'listView'], 'GET', '/users/{page}', $userValidation);
\Chibi\Router::register(['UserController', 'listView'], 'GET', '/users/{filter}/{page}', $userValidations); \Chibi\Router::register(['UserController', 'listView'], 'GET', '/users/{filter}/{page}', $userValidation);
\Chibi\Router::register(['UserController', 'flagAction'], 'POST', '/user/{name}/flag', $userValidations); \Chibi\Router::register(['UserController', 'flagAction'], 'POST', '/user/{name}/flag', $userValidation);
\Chibi\Router::register(['UserController', 'banAction'], 'POST', '/user/{name}/ban', $userValidations); \Chibi\Router::register(['UserController', 'banAction'], 'POST', '/user/{name}/ban', $userValidation);
\Chibi\Router::register(['UserController', 'unbanAction'], 'POST', '/user/{name}/unban', $userValidations); \Chibi\Router::register(['UserController', 'unbanAction'], 'POST', '/user/{name}/unban', $userValidation);
\Chibi\Router::register(['UserController', 'acceptRegistrationAction'], 'POST', '/user/{name}/accept-registration', $userValidations); \Chibi\Router::register(['UserController', 'acceptRegistrationAction'], 'POST', '/user/{name}/accept-registration', $userValidation);
\Chibi\Router::register(['UserController', 'deleteView'], 'GET', '/user/{name}/delete', $userValidations); \Chibi\Router::register(['UserController', 'deleteAction'], 'POST', '/user/{name}/delete', $userValidation);
\Chibi\Router::register(['UserController', 'deleteAction'], 'POST', '/user/{name}/delete', $userValidations); \Chibi\Router::register(['UserController', 'settingsAction'], 'POST', '/user/{name}/settings', $userValidation);
\Chibi\Router::register(['UserController', 'editAction'], 'POST', '/user/{name}/edit', $userValidation);
\Chibi\Router::register(['UserController', 'genericView'], 'GET', '/user/{name}/{tab}', $userValidation);
\Chibi\Router::register(['UserController', 'genericView'], 'GET', '/user/{name}/{tab}/{page}', $userValidation);
foreach (['GET', 'POST'] as $method) foreach (['GET', 'POST'] as $method)
{ {
\Chibi\Router::register(['TagController', 'massTagRedirectAction'], $method, '/mass-tag-redirect', $tagValidation); \Chibi\Router::register(['TagController', 'massTagRedirectAction'], $method, '/mass-tag-redirect', $tagValidation);
\Chibi\Router::register(['UserController', 'registrationAction'], $method, '/register', $userValidations); \Chibi\Router::register(['UserController', 'registrationAction'], $method, '/register', $userValidation);
\Chibi\Router::register(['UserController', 'viewAction'], $method, '/user/{name}/{tab}', $userValidations); \Chibi\Router::register(['UserController', 'activationAction'], $method, '/activation/{token}', $userValidation);
\Chibi\Router::register(['UserController', 'viewAction'], $method, '/user/{name}/{tab}/{page}', $userValidations); \Chibi\Router::register(['UserController', 'activationProxyAction'], $method, '/activation-proxy', $userValidation);
\Chibi\Router::register(['UserController', 'settingsAction'], $method, '/user/{name}/settings', $userValidations); \Chibi\Router::register(['UserController', 'activationProxyAction'], $method, '/activation-proxy/{token}', $userValidation);
\Chibi\Router::register(['UserController', 'editAction'], $method, '/user/{name}/edit', $userValidations); \Chibi\Router::register(['UserController', 'passwordResetAction'], $method, '/password-reset/{token}', $userValidation);
\Chibi\Router::register(['UserController', 'activationAction'], $method, '/activation/{token}', $userValidations); \Chibi\Router::register(['UserController', 'passwordResetProxyAction'], $method, '/password-reset-proxy', $userValidation);
\Chibi\Router::register(['UserController', 'activationProxyAction'], $method, '/activation-proxy', $userValidations); \Chibi\Router::register(['UserController', 'passwordResetProxyAction'], $method, '/password-reset-proxy/{token}', $userValidation);
\Chibi\Router::register(['UserController', 'activationProxyAction'], $method, '/activation-proxy/{token}', $userValidations); \Chibi\Router::register(['UserController', 'toggleSafetyAction'], $method, '/user/toggle-safety/{safety}', $userValidation);
\Chibi\Router::register(['UserController', 'passwordResetAction'], $method, '/password-reset/{token}', $userValidations);
\Chibi\Router::register(['UserController', 'passwordResetProxyAction'], $method, '/password-reset-proxy', $userValidations);
\Chibi\Router::register(['UserController', 'passwordResetProxyAction'], $method, '/password-reset-proxy/{token}', $userValidations);
\Chibi\Router::register(['UserController', 'toggleSafetyAction'], $method, '/user/toggle-safety/{safety}', $userValidations);
} }
Assets::setTitle($config->main->title); Assets::setTitle($config->main->title);

View file

@ -17,69 +17,48 @@ class UserController
$context->transport->paginator = $ret; $context->transport->paginator = $ret;
} }
public function flagAction($name) public function genericView($name, $tab = 'favs', $page = 1)
{
Api::run(new FlagUserJob(), [FlagUserJob::USER_NAME => $name]);
}
public function banAction($name)
{
Api::run(new ToggleUserBanJob(), [
ToggleUserBanJob::USER_NAME => $name,
ToggleUserBanJob::STATE => true]);
}
public function unbanAction($name)
{
Api::run(new ToggleUserBanJob(), [
ToggleUserBanJob::USER_NAME => $name,
ToggleUserBanJob::STATE => false]);
}
public function acceptRegistrationAction($name)
{
Api::run(new AcceptUserRegistrationJob(), [
AcceptUserRegistrationJob::USER_NAME => $name]);
}
public function deleteView($name)
{ {
$user = UserModel::findByNameOrEmail($name); $user = UserModel::findByNameOrEmail($name);
$flagged = in_array(TextHelper::reprUser($user), SessionHelper::get('flagged', []));
$this->loadUserView($user);
$context = getContext(); $context = getContext();
$context->transport->tab = 'delete'; $context->flagged = $flagged;
$context->transport->tab = $tab;
$context->transport->user = $user;
$context->handleExceptions = true;
$context->viewName = 'user-view';
if ($tab == 'uploads')
$query = 'submit:' . $user->name;
elseif ($tab == 'favs')
$query = 'fav:' . $user->name;
if (isset($query))
{
$ret = Api::run(
new ListPostsJob(),
[
ListPostsJob::PAGE_NUMBER => $page,
ListPostsJob::QUERY => $query
]);
$context->transport->posts = $ret->entities;
$context->transport->paginator = $ret;
$context->transport->lastSearchQuery = $query;
} }
public function deleteAction($name) Access::assert(
{ Privilege::ViewUser,
$this->deleteView($name); Access::getIdentity($user));
$user = UserModel::findByNameOrEmail($name);
if (Auth::getCurrentUser()->id == $user->id)
{
$suppliedPassword = InputHelper::get('current-password');
$suppliedPasswordHash = UserModel::hashPassword($suppliedPassword, $user->passSalt);
if ($suppliedPasswordHash != $user->passHash)
throw new SimpleException('Must supply valid password');
}
$oldId = $user->id;
Api::run(new DeleteUserJob(), [
DeleteUserJob::USER_NAME => $name]);
if ($oldId == Auth::getCurrentUser()->id)
Auth::logOut();
\Chibi\Util\Url::forward(\Chibi\Router::linkTo(['StaticPagesController', 'mainPageView']));
exit;
} }
public function settingsAction($name) public function settingsAction($name)
{ {
$context = getContext(); $this->genericView($name, 'settings');
$user = UserModel::findByNameOrEmail($name);
$user = getContext()->transport->user;
Access::assert( Access::assert(
Privilege::ViewUser, Privilege::ViewUser,
Access::getIdentity($user)); Access::getIdentity($user));
@ -87,12 +66,6 @@ class UserController
Privilege::ChangeUserSettings, Privilege::ChangeUserSettings,
Access::getIdentity($user)); Access::getIdentity($user));
$this->loadUserView($user);
$context->transport->tab = 'settings';
if (!InputHelper::get('submit'))
return;
$suppliedSafety = InputHelper::get('safety'); $suppliedSafety = InputHelper::get('safety');
if (!is_array($suppliedSafety)) if (!is_array($suppliedSafety))
$suppliedSafety = []; $suppliedSafety = [];
@ -107,32 +80,27 @@ class UserController
UserModel::save($user); UserModel::save($user);
if ($user->id == Auth::getCurrentUser()->id) if ($user->id == Auth::getCurrentUser()->id)
Auth::setCurrentUser($user); Auth::setCurrentUser($user);
Messenger::message('Browsing settings updated!'); Messenger::message('Browsing settings updated!');
} }
public function editAction($name) public function editAction($name)
{ {
$context = getContext(); $this->genericView($name, 'edit');
try $this->requirePasswordConfirmation();
{
$user = UserModel::findByNameOrEmail($name); $user = getContext()->transport->user;
Access::assert( Access::assert(
Privilege::ViewUser, Privilege::ViewUser,
Access::getIdentity($user)); Access::getIdentity($user));
$this->loadUserView($user); $suppliedCurrentPassword = InputHelper::get('current-password');
$context->transport->tab = 'edit'; $suppliedName = InputHelper::get('name');
$suppliedPassword1 = InputHelper::get('password1');
$context->suppliedCurrentPassword = $suppliedCurrentPassword = InputHelper::get('current-password'); $suppliedPassword2 = InputHelper::get('password2');
$context->suppliedName = $suppliedName = InputHelper::get('name'); $suppliedEmail = InputHelper::get('email');
$context->suppliedPassword1 = $suppliedPassword1 = InputHelper::get('password1'); $suppliedAccessRank = InputHelper::get('access-rank');
$context->suppliedPassword2 = $suppliedPassword2 = InputHelper::get('password2');
$context->suppliedEmail = $suppliedEmail = InputHelper::get('email');
$context->suppliedAccessRank = $suppliedAccessRank = InputHelper::get('access-rank');
$currentPasswordHash = $user->passHash;
if (!InputHelper::get('submit'))
return;
$confirmMail = false; $confirmMail = false;
LogHelper::bufferChanges(); LogHelper::bufferChanges();
@ -201,70 +169,60 @@ class UserController
'rank' => AccessRank::toString($suppliedAccessRank)]); 'rank' => AccessRank::toString($suppliedAccessRank)]);
} }
if (Auth::getCurrentUser()->id == $user->id) if ($confirmMail)
{ self::sendEmailChangeConfirmation($user);
$suppliedPasswordHash = UserModel::hashPassword($suppliedCurrentPassword, $user->passSalt);
if ($suppliedPasswordHash != $currentPasswordHash)
throw new SimpleException('Must supply valid current password');
}
UserModel::save($user); UserModel::save($user);
if (Auth::getCurrentUser()->id == $user->id) if (Auth::getCurrentUser()->id == $user->id)
Auth::setCurrentUser($user); Auth::setCurrentUser($user);
if ($confirmMail)
self::sendEmailChangeConfirmation($user);
LogHelper::flush(); LogHelper::flush();
$message = 'Account settings updated!'; $message = 'Account settings updated!';
if ($confirmMail) if ($confirmMail)
$message .= ' You will be sent an e-mail address confirmation message soon.'; $message .= ' You will be sent an e-mail address confirmation message soon.';
Messenger::message($message); Messenger::message($message);
} }
catch (Exception $e)
public function deleteAction($name)
{ {
$context->transport->user = UserModel::findByNameOrEmail($name); $this->genericView($name, 'delete');
throw $e; $this->requirePasswordConfirmation();
}
Api::run(new DeleteUserJob(), [
DeleteUserJob::USER_NAME => $name]);
$user = UserModel::findById(Auth::getCurrentUser()->id, false);
if (!$user)
Auth::logOut();
\Chibi\Util\Url::forward(\Chibi\Router::linkTo(['StaticPagesController', 'mainPageView']));
exit;
} }
public function viewAction($name, $tab = 'favs', $page) public function flagAction($name)
{ {
$context = getContext(); Api::run(new FlagUserJob(), [FlagUserJob::USER_NAME => $name]);
$postsPerPage = intval(getConfig()->browsing->postsPerPage); }
$user = UserModel::findByNameOrEmail($name);
if ($tab === null)
$tab = 'favs';
if ($page === null)
$page = 1;
Access::assert( public function banAction($name)
Privilege::ViewUser, {
Access::getIdentity($user)); Api::run(new ToggleUserBanJob(), [
ToggleUserBanJob::USER_NAME => $name,
ToggleUserBanJob::STATE => true]);
}
$this->loadUserView($user); public function unbanAction($name)
{
Api::run(new ToggleUserBanJob(), [
ToggleUserBanJob::USER_NAME => $name,
ToggleUserBanJob::STATE => false]);
}
$query = ''; public function acceptRegistrationAction($name)
if ($tab == 'uploads') {
$query = 'submit:' . $user->name; Api::run(new AcceptUserRegistrationJob(), [
elseif ($tab == 'favs') AcceptUserRegistrationJob::USER_NAME => $name]);
$query = 'fav:' . $user->name;
else
throw new SimpleException('Wrong tab');
$page = max(1, $page);
$posts = PostSearchService::getEntities($query, $postsPerPage, $page);
$postCount = PostSearchService::getEntityCount($query, $postsPerPage, $page);
$pageCount = ceil($postCount / $postsPerPage);
PostModel::preloadTags($posts);
$context->transport->tab = $tab;
$context->transport->lastSearchQuery = $query;
$context->transport->paginator = new StdClass;
$context->transport->paginator->page = $page;
$context->transport->paginator->pageCount = $pageCount;
$context->transport->paginator->entityCount = $postCount;
$context->transport->paginator->entities = $posts;
$context->transport->posts = $posts;
} }
public function toggleSafetyAction($safety) public function toggleSafetyAction($safety)
@ -462,16 +420,6 @@ class UserController
Messenger::message('Activation e-mail resent.'); Messenger::message('Activation e-mail resent.');
} }
private function loadUserView($user)
{
$context = getContext();
$flagged = in_array(TextHelper::reprUser($user), SessionHelper::get('flagged', []));
$context->flagged = $flagged;
$context->transport->user = $user;
$context->handleExceptions = true;
$context->viewName = 'user-view';
}
private static function sendTokenizedEmail( private static function sendTokenizedEmail(
$user, $user,
$body, $body,
@ -560,4 +508,16 @@ class UserController
$user->emailConfirmed, $user->emailConfirmed,
'passwordResetAction'); 'passwordResetAction');
} }
private function requirePasswordConfirmation()
{
$user = getContext()->transport->user;
if (Auth::getCurrentUser()->id == $user->id)
{
$suppliedPassword = InputHelper::get('current-password');
$suppliedPasswordHash = UserModel::hashPassword($suppliedPassword, $user->passSalt);
if ($suppliedPasswordHash != $user->passHash)
throw new SimpleException('Must supply valid password');
}
}
} }

View file

@ -145,7 +145,7 @@ class CustomMarkdown extends \Michelf\MarkdownExtra
protected function doUsers($text) protected function doUsers($text)
{ {
$link = \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => '_name_']); $link = \Chibi\Router::linkTo(['UserController', 'genericView'], ['name' => '_name_']);
return preg_replace_callback('/(?:(?<![^\s\(\)\[\]]))\+([a-zA-Z0-9_-]+)/', function($x) use ($link) return preg_replace_callback('/(?:(?<![^\s\(\)\[\]]))\+([a-zA-Z0-9_-]+)/', function($x) use ($link)
{ {
return $this->hashPart('<a href="' . str_replace('_name_', $x[1], $link) . '">' . $x[0] . '</a>'); return $this->hashPart('<a href="' . str_replace('_name_', $x[1], $link) . '">' . $x[0] . '</a>');

View file

@ -8,7 +8,7 @@ Assets::addScript('comment-edit.js');
<div class="avatar"> <div class="avatar">
<?php $commenter = $this->context->comment->getCommenter() ?> <?php $commenter = $this->context->comment->getCommenter() ?>
<?php if ($commenter): ?> <?php if ($commenter): ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $commenter->name]) ?>"> <a href="<?= \Chibi\Router::linkTo(['UserController', 'genericView'], ['name' => $commenter->name]) ?>">
<img src="<?= htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?= $commenter->name ?>"/> <img src="<?= htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?= $commenter->name ?>"/>
</a> </a>
<?php else: ?> <?php else: ?>
@ -23,7 +23,7 @@ Assets::addScript('comment-edit.js');
<span class="nickname"> <span class="nickname">
<?php if ($commenter): ?> <?php if ($commenter): ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $commenter->name]) ?>"> ['name' => $commenter->name]) ?>">
<?= $commenter->name ?> <?= $commenter->name ?>
</a> </a>

View file

@ -94,7 +94,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php if ($uploader): ?> <?php if ($uploader): ?>
<span class="value" title="<?= $val = $uploader->name ?>"> <span class="value" title="<?= $val = $uploader->name ?>">
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $uploader->name]) ?>"> ['name' => $uploader->name]) ?>">
<img src="<?= htmlentities($uploader->getAvatarUrl(24)) ?>" alt="<?= $uploader->name ?>"/> <img src="<?= htmlentities($uploader->getAvatarUrl(24)) ?>" alt="<?= $uploader->name ?>"/>
<?= $val ?> <?= $val ?>
@ -243,7 +243,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php foreach ($this->context->transport->post->getFavorites() as $user): ?> <?php foreach ($this->context->transport->post->getFavorites() as $user): ?>
<li> <li>
<a title="<?= $user->name ?>" href="<?= \Chibi\Router::linkTo( <a title="<?= $user->name ?>" href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $user->name]) ?>"> ['name' => $user->name]) ?>">
<img src="<?= htmlspecialchars($user->getAvatarUrl()) ?>" alt="<?= $user->name ?>"> <img src="<?= htmlspecialchars($user->getAvatarUrl()) ?>" alt="<?= $user->name ?>">
</a> </a>

View file

@ -42,7 +42,7 @@ Assets::addStylesheet('static-main.css');
<?php if ($this->context->featuredPostUser): ?> <?php if ($this->context->featuredPostUser): ?>
by by
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $this->context->featuredPostUser->name]) ?>"> ['name' => $this->context->featuredPostUser->name]) ?>">
<?= $this->context->featuredPostUser->name ?> <?= $this->context->featuredPostUser->name ?>
</a>, </a>,

View file

@ -76,7 +76,7 @@
{ {
$registerNavItem( $registerNavItem(
'My account', 'My account',
\Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => Auth::getCurrentUser()->name]), \Chibi\Router::linkTo(['UserController', 'genericView'], ['name' => Auth::getCurrentUser()->name]),
$activeController == 'user' and isset($this->context->route->arguments['name']) and $activeController == 'user' and isset($this->context->route->arguments['name']) and
$this->context->route->arguments['name'] == Auth::getCurrentUser()->name); $this->context->route->arguments['name'] == Auth::getCurrentUser()->name);

View file

@ -32,7 +32,7 @@
name="name" name="name"
id="name" id="name"
placeholder="New name&hellip;" placeholder="New name&hellip;"
value="<?= htmlspecialchars($this->context->suppliedName) ?>"/> value="<?= htmlspecialchars(InputHelper::get('name')) ?>">
</div> </div>
</div> </div>
<?php endif ?> <?php endif ?>
@ -49,7 +49,7 @@
name="email" name="email"
id="email" id="email"
placeholder="New e-mail&hellip;" placeholder="New e-mail&hellip;"
value="<?= htmlspecialchars($this->context->suppliedEmail) ?>"/> value="<?= htmlspecialchars(InputHelper::get('email')) ?>"/>
</div> </div>
</div> </div>
<?php endif ?> <?php endif ?>
@ -66,7 +66,7 @@
name="password1" name="password1"
id="password1" id="password1"
placeholder="New password&hellip;" placeholder="New password&hellip;"
value="<?= htmlspecialchars($this->context->suppliedPassword1) ?>"/> value="<?= htmlspecialchars(InputHelper::get('password1')) ?>"/>
</div> </div>
</div> </div>
<div class="form-row password2"> <div class="form-row password2">
@ -77,7 +77,7 @@
name="password2" name="password2"
id="password2" id="password2"
placeholder="New password&hellip; (repeat)" placeholder="New password&hellip; (repeat)"
value="<?= htmlspecialchars($this->context->suppliedPassword2) ?>"/> value="<?= htmlspecialchars(InputHelper::get('password2')) ?>"/>
</div> </div>
</div> </div>
<?php endif ?> <?php endif ?>
@ -92,8 +92,8 @@
<select name="access-rank" id="access-rank"> <select name="access-rank" id="access-rank">
<?php foreach (AccessRank::getAll() as $rank): ?> <?php foreach (AccessRank::getAll() as $rank): ?>
<?php if ($rank == AccessRank::Nobody) continue ?> <?php if ($rank == AccessRank::Nobody) continue ?>
<?php if (($this->context->suppliedAccessRank != '' and $rank == $this->context->suppliedAccessRank) <?php if ($rank == InputHelper::get('access-rank') or (!InputHelper::get('access-rank')
or ($this->context->suppliedAccessRank == '' and $rank == $this->context->transport->user->accessRank)): ?> and $rank == $this->context->transport->user->accessRank)): ?>
<option value="<?= $rank ?>" selected="selected"> <option value="<?= $rank ?>" selected="selected">
<?php else: ?> <?php else: ?>
<option value="<?= $rank ?>"> <option value="<?= $rank ?>">

View file

@ -43,14 +43,14 @@ if (Auth::getCurrentUser()->hasEnabledEndlessScrolling())
<?php foreach ($this->context->transport->users as $user): ?> <?php foreach ($this->context->transport->users as $user): ?>
<div class="user"> <div class="user">
<a class="avatar" href="<?= \Chibi\Router::linkTo( <a class="avatar" href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $user->name]) ?>"> ['name' => $user->name]) ?>">
<img src="<?= htmlspecialchars($user->getAvatarUrl(100)) ?>" alt="<?= $user->name ?>"/> <img src="<?= htmlspecialchars($user->getAvatarUrl(100)) ?>" alt="<?= $user->name ?>"/>
</a> </a>
<div class="details"> <div class="details">
<h1> <h1>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $user->name]) ?>"> ['name' => $user->name]) ?>">
<?= $user->name ?> <?= $user->name ?>
</a> </a>

View file

@ -6,7 +6,7 @@ Assets::addStylesheet('user-view.css');
<div id="sidebar"> <div id="sidebar">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name]) ?>"> ['name' => $this->context->transport->user->name]) ?>">
<img <img
@ -201,7 +201,7 @@ Assets::addStylesheet('user-view.css');
<li class="favs"> <li class="favs">
<?php endif ?> <?php endif ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name, ['name' => $this->context->transport->user->name,
'tab' => 'favs', 'tab' => 'favs',
'page' => 1]) ?>"> 'page' => 1]) ?>">
@ -215,7 +215,7 @@ Assets::addStylesheet('user-view.css');
<li class="uploads"> <li class="uploads">
<?php endif ?> <?php endif ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name, ['name' => $this->context->transport->user->name,
'tab' => 'uploads', 'tab' => 'uploads',
'page' => 1]) ?>"> 'page' => 1]) ?>">
@ -233,8 +233,9 @@ Assets::addStylesheet('user-view.css');
<li class="settings"> <li class="settings">
<?php endif ?> <?php endif ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'settingsAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name]) ?>"> ['name' => $this->context->transport->user->name,
'tab' => 'settings']) ?>">
Browsing settings Browsing settings
</a> </a>
</li> </li>
@ -247,8 +248,9 @@ Assets::addStylesheet('user-view.css');
<li class="edit"> <li class="edit">
<?php endif ?> <?php endif ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'editAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name]) ?>"> ['name' => $this->context->transport->user->name,
'tab' => 'edit']) ?>">
Account settings Account settings
</a> </a>
</li> </li>
@ -263,8 +265,9 @@ Assets::addStylesheet('user-view.css');
<li class="delete"> <li class="delete">
<?php endif ?> <?php endif ?>
<a href="<?= \Chibi\Router::linkTo( <a href="<?= \Chibi\Router::linkTo(
['UserController', 'deleteAction'], ['UserController', 'genericView'],
['name' => $this->context->transport->user->name]) ?>"> ['name' => $this->context->transport->user->name,
'tab' => 'delete']) ?>">
Delete account Delete account
</a> </a>
</li> </li>