This commit is contained in:
Marcin Kurczewski
2013-10-22 00:17:06 +02:00
parent 823888b0c1
commit eaa8c4897d
8 changed files with 114 additions and 6 deletions

View File

@ -53,7 +53,7 @@ class UserController
{
$this->context->stylesheets []= 'user-list.css';
$this->context->stylesheets []= 'paginator.css';
if ($this->config->browsing->endlessScrolling)
if ($this->context->user->hasEnabledEndlessScrolling())
$this->context->scripts []= 'paginator-endless.js';
$page = intval($page);
@ -217,6 +217,42 @@ class UserController
/**
* @route /user/{name}/settings
* @validate name [^\/]+
*/
public function settingsAction($name)
{
$user = Model_User::locate($name);
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
$this->context->handleExceptions = true;
$this->context->transport->user = $user;
$this->context->transport->tab = 'settings';
$this->context->viewName = 'user-view';
$this->context->stylesheets []= 'user-view.css';
$this->context->subTitle = $name;
if (InputHelper::get('submit'))
{
$suppliedSafety = InputHelper::get('safety');
if (!is_array($suppliedSafety))
$suppliedSafety = [];
foreach (PostSafety::getAll() as $safety)
$user->enableSafety($safety, in_array($safety, $suppliedSafety));
$user->enableEndlessScrolling(InputHelper::get('endless-scrolling'));
R::store($user);
$this->context->transport->user = $user;
if ($this->context->user->id == $user->id)
$this->context->user = $user;
$this->context->transport->success = true;
}
}
/**
* @route /user/{name}/edit
* @validate name [^\/]+
@ -324,7 +360,7 @@ class UserController
$this->context->stylesheets []= 'post-list.css';
$this->context->stylesheets []= 'post-small.css';
$this->context->stylesheets []= 'paginator.css';
if ($this->config->browsing->endlessScrolling)
if ($this->context->user->hasEnabledEndlessScrolling())
$this->context->scripts []= 'paginator-endless.js';
$this->context->subTitle = $name;