Lines wrapped again

This commit is contained in:
Marcin Kurczewski 2014-04-30 00:11:13 +02:00
parent 396ea97cad
commit c18c9ec680
22 changed files with 277 additions and 92 deletions

View file

@ -84,7 +84,8 @@ class CommentController
if (InputHelper::get('sender') != 'preview')
{
CommentModel::save($comment);
LogHelper::log('{user} edited comment in {post}', ['post' => TextHelper::reprPost($comment->getPost())]);
LogHelper::log('{user} edited comment in {post}', [
'post' => TextHelper::reprPost($comment->getPost())]);
}
$context->transport->textPreview = $comment->getText();
StatusHelper::success();
@ -101,7 +102,8 @@ class CommentController
CommentModel::remove($comment);
LogHelper::log('{user} removed comment from {post}', ['post' => TextHelper::reprPost($comment->getPost())]);
LogHelper::log('{user} removed comment from {post}', [
'post' => TextHelper::reprPost($comment->getPost())]);
StatusHelper::success();
}
}

View file

@ -502,7 +502,11 @@ class PostController
$newSafety = $post->safety;
if ($oldSafety != $newSafety)
LogHelper::log('{user} changed safety of {post} to {safety}', ['post' => TextHelper::reprPost($post), 'safety' => PostSafety::toString($post->safety)]);
{
LogHelper::log('{user} changed safety of {post} to {safety}', [
'post' => TextHelper::reprPost($post),
'safety' => PostSafety::toString($post->safety)]);
}
}
/* tags */
@ -517,10 +521,18 @@ class PostController
$newTags = array_map(function($tag) { return $tag->name; }, $post->getTags());
foreach (array_diff($oldTags, $newTags) as $tag)
LogHelper::log('{user} untagged {post} with {tag}', ['post' => TextHelper::reprPost($post), 'tag' => TextHelper::reprTag($tag)]);
{
LogHelper::log('{user} untagged {post} with {tag}', [
'post' => TextHelper::reprPost($post),
'tag' => TextHelper::reprTag($tag)]);
}
foreach (array_diff($newTags, $oldTags) as $tag)
LogHelper::log('{user} tagged {post} with {tag}', ['post' => TextHelper::reprPost($post), 'tag' => TextHelper::reprTag($tag)]);
{
LogHelper::log('{user} tagged {post} with {tag}', [
'post' => TextHelper::reprPost($post),
'tag' => TextHelper::reprTag($tag)]);
}
}
/* source */
@ -535,7 +547,11 @@ class PostController
$newSource = $post->source;
if ($oldSource != $newSource)
LogHelper::log('{user} changed source of {post} to {source}', ['post' => TextHelper::reprPost($post), 'source' => $post->source]);
{
LogHelper::log('{user} changed source of {post} to {source}', [
'post' => TextHelper::reprPost($post),
'source' => $post->source]);
}
}
/* relations */
@ -550,10 +566,18 @@ class PostController
$newRelatedIds = array_map(function($post) { return $post->id; }, $post->getRelations());
foreach (array_diff($oldRelatedIds, $newRelatedIds) as $post2id)
LogHelper::log('{user} removed relation between {post} and {post2}', ['post' => TextHelper::reprPost($post), 'post2' => TextHelper::reprPost($post2id)]);
{
LogHelper::log('{user} removed relation between {post} and {post2}', [
'post' => TextHelper::reprPost($post),
'post2' => TextHelper::reprPost($post2id)]);
}
foreach (array_diff($newRelatedIds, $oldRelatedIds) as $post2id)
LogHelper::log('{user} added relation between {post} and {post2}', ['post' => TextHelper::reprPost($post), 'post2' => TextHelper::reprPost($post2id)]);
{
LogHelper::log('{user} added relation between {post} and {post2}', [
'post' => TextHelper::reprPost($post),
'post2' => TextHelper::reprPost($post2id)]);
}
}
/* thumbnail */

View file

@ -108,7 +108,11 @@ class PostEntity extends AbstractEntity
continue;
if (count($relatedPosts) > $config->browsing->maxRelatedPosts)
throw new SimpleException('Too many related posts (maximum: %d)', $config->browsing->maxRelatedPosts);
{
throw new SimpleException(
'Too many related posts (maximum: %d)',
$config->browsing->maxRelatedPosts);
}
$relatedPosts []= PostModel::findById($relatedId);
}
@ -372,7 +376,11 @@ class PostEntity extends AbstractEntity
$duplicatedPost = PostModel::findByHash($this->fileHash, false);
if ($duplicatedPost !== null and (!$this->id or $this->id != $duplicatedPost->id))
throw new SimpleException('Duplicate upload: %s', TextHelper::reprPost($duplicatedPost));
{
throw new SimpleException(
'Duplicate upload: %s',
TextHelper::reprPost($duplicatedPost));
}
$dstPath = $this->getFullPath();
@ -407,7 +415,11 @@ class PostEntity extends AbstractEntity
$duplicatedPost = PostModel::findByHash($youtubeId, false);
if ($duplicatedPost !== null and (!$this->id or $this->id != $duplicatedPost->id))
throw new SimpleException('Duplicate upload: %s' . TextHelper::reprPost($duplicatedPost));
{
throw new SimpleException(
'Duplicate upload: %s',
TextHelper::reprPost($duplicatedPost));
}
return;
}
@ -436,7 +448,11 @@ class PostEntity extends AbstractEntity
throw new SimpleException('Cannot write into file');
fflush($srcFP);
if (ftell($srcFP) > $maxBytes)
throw new SimpleException('File is too big (maximum size: %s)', TextHelper::useBytesUnits($maxBytes));
{
throw new SimpleException(
'File is too big (maximum size: %s)',
TextHelper::useBytesUnits($maxBytes));
}
}
}
finally

View file

@ -3,7 +3,12 @@ Assets::setSubTitle('authentication form');
Assets::addStylesheet('auth.css');
?>
<form action="<?= \Chibi\Router::linkTo(['AuthController', 'loginAction']) ?>" class="auth" method="post">
<form
method="post"
action="<?= \Chibi\Router::linkTo(
['AuthController', 'loginAction']) ?>"
class="auth">
<p>
If you don't have an account yet,<br/>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'registrationAction']); ?>">click here</a> to create a new one.

View file

@ -4,8 +4,10 @@ Assets::addScript('comment-edit.js');
?>
<form
action="<?= \Chibi\Router::linkTo(['CommentController', 'addAction'], ['postId' => $this->context->transport->post->id]) ?>"
method="post"
action="<?= \Chibi\Router::linkTo(
['CommentController', 'addAction'],
['postId' => $this->context->transport->post->id]) ?>"
class="add-comment">
<h1>add comment</h1>

View file

@ -4,8 +4,10 @@ Assets::addScript('comment-edit.js');
?>
<form
action="<?= \Chibi\Router::linkTo(['CommentController', 'editAction'], ['id' => $this->context->transport->comment->id]) ?>"
method="post"
action="<?= \Chibi\Router::linkTo(
['CommentController', 'editAction'],
['id' => $this->context->transport->comment->id]) ?>"
class="edit-comment">
<h1>edit comment</h1>

View file

@ -31,7 +31,9 @@ Assets::setSubTitle('comments');
<?php endforeach ?>
<?php if (count($comments) > count($commentsToDisplay)): ?>
<a href="<?= \Chibi\Router::linkTo(['PostController', 'viewAction'], ['id' => $this->context->post->id]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'viewAction'],
['id' => $this->context->post->id]) ?>">
<span class="hellip">(more&hellip;)</span>
</a>
<?php endif ?>

View file

@ -22,7 +22,9 @@ Assets::addScript('comment-edit.js');
<div class="header">
<span class="nickname">
<?php if ($commenter): ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $commenter->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $commenter->name]) ?>">
<?= $commenter->name ?>
</a>
<?php else: ?>
@ -38,7 +40,9 @@ Assets::addScript('comment-edit.js');
Privilege::EditComment,
Access::getIdentity($commenter))): ?>
<span class="edit">
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'editAction'], ['id' => $this->context->comment->id]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['CommentController', 'editAction'],
['id' => $this->context->comment->id]) ?>">
edit
</a>
</span>
@ -48,9 +52,11 @@ Assets::addScript('comment-edit.js');
Access::check(Privilege::DeleteComment,
Access::getIdentity($commenter))): ?>
<span class="delete">
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'deleteAction'], ['id' => $this->context->comment->id]) ?>"
class="simple-action confirmable"
data-confirm-text="Are you sure you want to delete this comment?">
<a class="simple-action confirmable"
data-confirm-text="Are you sure you want to delete this comment?"
href="<?= \Chibi\Router::linkTo(
['CommentController', 'deleteAction'],
['id' => $this->context->comment->id]) ?>">
delete
</a>
</span>

View file

@ -16,7 +16,9 @@ $showTabs = count($tabs) > 1;
<?php else: ?>
<li class="<?= $tab ?>">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['IndexController', 'helpAction'], $tab == $firstTab ? [] : ['tab' => $tab]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['IndexController', 'helpAction'],
$tab == $firstTab ? [] : ['tab' => $tab]) ?>">
<?= $text ?>
</a>
</li>

View file

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

View file

@ -13,7 +13,9 @@ Assets::setSubTitle('logs (' . $this->context->transport->name . ')');
?>
<form method="get"
action="<?= \Chibi\Router::linkTo(['LogController', 'viewAction'], ['name' => $this->context->transport->name]) ?>">
action="<?= \Chibi\Router::linkTo(
['LogController', 'viewAction'],
['name' => $this->context->transport->name]) ?>">
Keep only lines that contain:

View file

@ -1,5 +1,7 @@
<form method="post"
action="<?= \Chibi\Router::linkTo(['PostController', 'editAction'], ['id' => $this->context->transport->post->id]) ?>"
action="<?= \Chibi\Router::linkTo(
['PostController', 'editAction'],
['id' => $this->context->transport->post->id]) ?>"
enctype="multipart/form-data"
class="edit-post">

View file

@ -1,5 +1,9 @@
<?php Assets::setPageThumb(\Chibi\Router::linkTo(['PostController', 'thumbAction'], ['name' => $this->context->transport->post->name])) ?>
<?php $post = $this->context->transport->post ?>
<?php
Assets::setPageThumb(\Chibi\Router::linkTo(
['PostController', 'thumbAction'],
['name' => $this->context->transport->post->name]));
$post = $this->context->transport->post;
?>
<?php if ($post->type == PostType::Image): ?>
@ -7,7 +11,10 @@
<a href="<?= $this->context->imageLink ?>">
<?php endif ?>
<img src="<?= \Chibi\Router::linkTo(['PostController', 'retrieveAction'], ['name' => $post->name]) ?>" alt="<?= $post->name ?>"/>
<img alt="<?= $post->name ?>"
src="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>"/>
<?php if (!empty($this->context->imageLink)): ?>
</a>
@ -19,10 +26,14 @@
type="<?= $post->mimeType ?>"
width="<?= $post->imageWidth ?>"
height="<?= $post->imageHeight ?>"
data="<?= \Chibi\Router::linkTo(['PostController', 'retrieveAction'], ['name' => $post->name]) ?>">
data="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>">
<param name="movie" value="<?= \Chibi\Router::linkTo(['PostController', 'retrieveAction'], ['name' => $post->name]) ?>"/>
<param name="wmode" value="opaque"/>
<param name="movie" value="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>"/>
</object>
@ -40,7 +51,9 @@
<video style="max-width: 100%" controls>
<source
type="<?= $post->mimeType ?>"
src="<?= \Chibi\Router::linkTo(['PostController', 'retrieveAction'], ['name' => $post->name]) ?>">
src="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>">
Your browser doesn't support HTML5 &lt;video&gt; tag.
</video>

View file

@ -30,7 +30,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<nav id="around">
<div class="left">
<?php if ($this->context->transport->nextPostId): ?>
<a href="<?= \Chibi\Router::linkTo(['PostController', 'viewAction'], ['id' => $this->context->transport->nextPostId]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'viewAction'],
['id' => $this->context->transport->nextPostId]) ?>">
<?php else: ?>
<a class="disabled">
<?php endif ?>
@ -41,7 +43,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<div class="right">
<?php if ($this->context->transport->prevPostId): ?>
<a href="<?= \Chibi\Router::linkTo(['PostController', 'viewAction'], ['id' => $this->context->transport->prevPostId]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'viewAction'],
['id' => $this->context->transport->prevPostId]) ?>">
<?php else: ?>
<a class="disabled">
<?php endif ?>
@ -55,8 +59,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php if (!empty($this->context->transport->lastSearchQuery)): ?>
<div class="text">
Current&nbsp;search:<br/>
<a href="<?= \Chibi\Router::linkTo(['PostController', 'listAction'], [
'query' => $this->context->transport->lastSearchQuery]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'listAction'],
['query' => $this->context->transport->lastSearchQuery]) ?>">
<?= $this->context->transport->lastSearchQuery ?>
</a>
</div>
@ -70,7 +75,11 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php uasort($tags, function($a, $b) { return strnatcasecmp($a->name, $b->name); }) ?>
<?php foreach ($tags as $tag): ?>
<li title="<?= $tag->name ?>">
<a href="<?= \Chibi\Router::linkTo(['PostController', 'listAction'], ['query' => $tag->name]) ?>"><?= $tag->name ?></a>
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'listAction'],
['query' => $tag->name]) ?>"
><?= $tag->name ?>
</a>
<span class="count"><?= TextHelper::useDecimalUnits($tag->getPostCount()) ?></span>
</li>
<?php endforeach ?>
@ -84,33 +93,39 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php $uploader = $this->context->transport->post->getUploader() ?>
<?php if ($uploader): ?>
<span class="value" title="<?= $val = $uploader->name ?>">
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $uploader->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $uploader->name]) ?>">
<img src="<?= htmlentities($uploader->getAvatarUrl(24)) ?>" alt="<?= $uploader->name ?>"/>
<?= $val ?>
</a>
</span>
<?php else: ?>
<span class="value" title="<?= UserModel::getAnonymousName() ?>">
<img src="<?= \Chibi\Util\Url::makeAbsolute('/media/img/pixel.gif') ?>" alt="<?= UserModel::getAnonymousName() ?>"/>
<img src="<?= \Chibi\Util\Url::makeAbsolute('/media/img/pixel.gif') ?>"
alt="<?= UserModel::getAnonymousName() ?>"/>
<?= UserModel::getAnonymousName() ?>
</span>
<?php endif ?>
<br>
<span class="date" title="<?= TextHelper::formatDate($this->context->transport->post->uploadDate, true) ?>">
<span class="date"
title="<?= TextHelper::formatDate($this->context->transport->post->uploadDate, true) ?>">
<?= TextHelper::formatDate($this->context->transport->post->uploadDate, false) ?>
</span>
</div>
<div class="key-value safety">
<span class="key">Safety:</span>
<span class="value safety-<?= $val = PostSafety::toDisplayString($this->context->transport->post->safety) ?>" title="<?= $val ?>">
<span class="value safety-<?= $val = PostSafety::toDisplayString($this->context->transport->post->safety) ?>"
title="<?= $val ?>">
<?= $val ?>
</span>
</div>
<div class="key-value source">
<span class="key">Source:</span>
<span class="value" title="<?= $val = htmlspecialchars($this->context->transport->post->source ?: 'unknown') ?>">
<span class="value"
title="<?= $val = htmlspecialchars($this->context->transport->post->source ?: 'unknown') ?>">
<?php if (preg_match('/^((https?|ftp):|)\/\//', $this->context->transport->post->source)): ?>
<a href="<?= $val ?>"><?= $val ?></a>
<?php else: ?>
@ -135,8 +150,17 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<span class="value">
<?= $this->context->transport->post->score ?>
<?php $scoreLink = function($score) { return \Chibi\Router::linkTo(['PostController', 'scoreAction'], ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
<?php if (Access::check(Privilege::ScorePost, Access::getIdentity($this->context->transport->post->getUploader()))): ?>
<?php
$scoreLink = function($score)
{
return \Chibi\Router::linkTo(
['PostController', 'scoreAction'],
['id' => $this->context->transport->post->id, 'score' => $score]);
}
?>
<?php if (Access::check(
Privilege::ScorePost,
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
<?php if ($this->context->score === 1): ?>
<a class="simple-action selected" href="<?= $scoreLink(0) ?>">
<?php else: ?>
@ -162,7 +186,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<div class="unit hl-options">
<?php if ($this->context->transport->post->type != PostType::Youtube): ?>
<div class="hl-option">
<a href="<?= \Chibi\Router::linkTo(['PostController', 'retrieveAction'], ['name' => $this->context->transport->post->name]) ?>" title="Download">
<a title="Download" href="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $this->context->transport->post->name]) ?>">
<i class="icon-dl"></i>
<span>
<?php
@ -176,15 +202,23 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
</div>
<?php endif ?>
<?php if (Access::check(Privilege::FavoritePost, Access::getIdentity($this->context->transport->post->getUploader()))): ?>
<?php if (Access::check(
Privilege::FavoritePost,
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
<div class="hl-option">
<?php if (!$this->context->favorite): ?>
<a class="add-fav icon simple-action" href="<?= \Chibi\Router::linkTo(['PostController', 'addFavoriteAction'], ['id' => $this->context->transport->post->id]) ?>">
<a class="add-fav icon simple-action"
href="<?= \Chibi\Router::linkTo(
['PostController', 'addFavoriteAction'],
['id' => $this->context->transport->post->id]) ?>">
<i class="icon-fav"></i>
<span>Add to favorites</span>
</a>
<?php else: ?>
<a class="rem-fav icon simple-action" href="<?= \Chibi\Router::linkTo(['PostController', 'removeFavoriteAction'], ['id' => $this->context->transport->post->id]) ?>">
<a class="rem-fav icon simple-action"
href="<?= \Chibi\Router::linkTo(
['PostController', 'removeFavoriteAction'],
['id' => $this->context->transport->post->id]) ?>">
<i class="icon-fav"></i>
<span>Remove from favorites</span>
</a>
@ -208,7 +242,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<ul>
<?php foreach ($this->context->transport->post->getFavorites() as $user): ?>
<li>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $user->name]) ?>" title="<?= $user->name ?>">
<a title="<?= $user->name ?>" href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $user->name]) ?>">
<img src="<?= htmlspecialchars($user->getAvatarUrl()) ?>" alt="<?= $user->name ?>">
</a>
</li>
@ -235,19 +271,25 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php
$options = [];
if (Access::check(Privilege::FeaturePost, Access::getIdentity($this->context->transport->post->getUploader())))
if (Access::check(
Privilege::FeaturePost,
Access::getIdentity($this->context->transport->post->getUploader())))
{
$options []=
[
'class' => 'feature',
'text' => 'Feature on main page',
'simple-action' => \Chibi\Router::linkTo(['PostController', 'featureAction'], ['id' => $this->context->transport->post->id]),
'simple-action' => \Chibi\Router::linkTo(
['PostController', 'featureAction'],
['id' => $this->context->transport->post->id]),
'data-confirm-text' => 'Are you sure you want to feature this post on the main page?',
'data-redirect-url' => \Chibi\Router::linkTo(['IndexController', 'indexAction']),
];
}
if (Access::check(Privilege::FlagPost, Access::getIdentity($this->context->transport->post->getUploader())))
if (Access::check(
Privilege::FlagPost,
Access::getIdentity($this->context->transport->post->getUploader())))
{
if ($this->context->flagged)
{
@ -264,13 +306,17 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
[
'class' => 'flag',
'text' => 'Flag for moderator attention',
'simple-action' => \Chibi\Router::linkTo(['PostController', 'flagAction'], ['id' => $this->context->transport->post->id]),
'simple-action' => \Chibi\Router::linkTo(
['PostController', 'flagAction'],
['id' => $this->context->transport->post->id]),
'data-confirm-text' => 'Are you sure you want to flag this post?',
];
}
}
if (Access::check(Privilege::HidePost, Access::getIdentity($this->context->transport->post->getUploader())))
if (Access::check(
Privilege::HidePost,
Access::getIdentity($this->context->transport->post->getUploader())))
{
if ($this->context->transport->post->hidden)
{
@ -278,7 +324,9 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
[
'class' => 'unhide',
'text' => 'Unhide',
'simple-action' => \Chibi\Router::linkTo(['PostController', 'unhideAction'], ['id' => $this->context->transport->post->id]),
'simple-action' => \Chibi\Router::linkTo(
['PostController', 'unhideAction'],
['id' => $this->context->transport->post->id]),
];
}
else
@ -287,18 +335,24 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
[
'class' => 'hide',
'text' => 'Hide',
'simple-action' => \Chibi\Router::linkTo(['PostController', 'hideAction'], ['id' => $this->context->transport->post->id]),
'simple-action' => \Chibi\Router::linkTo(
['PostController', 'hideAction'],
['id' => $this->context->transport->post->id]),
];
}
}
if (Access::check(Privilege::DeletePost, Access::getIdentity($this->context->transport->post->getUploader())))
if (Access::check(
Privilege::DeletePost,
Access::getIdentity($this->context->transport->post->getUploader())))
{
$options []=
[
'class' => 'delete',
'text' => 'Delete',
'simple-action' => \Chibi\Router::linkTo(['PostController', 'deleteAction'], ['id' => $this->context->transport->post->id]),
'simple-action' => \Chibi\Router::linkTo(
['PostController', 'deleteAction'],
['id' => $this->context->transport->post->id]),
'data-confirm-text' => 'Are you sure you want to delete this post?',
'data-redirect-url' => \Chibi\Router::linkTo(['PostController', 'listAction']),
];

View file

@ -35,7 +35,8 @@
<?php $name = $tag['name'] ?>
<?php $count = $tag['post_count'] ?>
<li class="tag" title="<?= $name ?> (<?= $count ?>)">
<a href="<?= str_replace('_query_', $name, $url) ?>" class="frequency<?php printf('%1.0f', $add + $mul * log($count)) ?>">
<a href="<?= str_replace('_query_', $name, $url) ?>"
class="frequency<?php printf('%1.0f', $add + $mul * log($count)) ?>">
<?= $name . ' (' . $count . ')' ?>
</a>
</li>

View file

@ -112,11 +112,20 @@
Privilege::ListPosts,
PostSafety::toString($safety))): ?>
<li class="safety-<?= TextCaseConverter::convert(PostSafety::toString($safety), TextCaseConverter::CAMEL_CASE, TextCaseConverter::SPINAL_CASE) ?>">
<li class="safety-<?= TextCaseConverter::convert(
PostSafety::toString($safety),
TextCaseConverter::CAMEL_CASE,
TextCaseConverter::SPINAL_CASE) ?>">
<a class="<?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>"
href="<?= \Chibi\Router::linkTo(['UserController', 'toggleSafetyAction'], ['safety' => $safety]) ?>"
title="Searching <?= PostSafety::toDisplayString($safety) ?> posts: <?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>">
href="<?= \Chibi\Router::linkTo(
['UserController', 'toggleSafetyAction'],
['safety' => $safety]) ?>"
title="<?= sprintf('Searching %s posts: %s',
PostSafety::toDisplayString($safety),
$this->context->user->hasEnabledSafety($safety)
? 'enabled'
: 'disabled') ?>">
<span><?= ucfirst(PostSafety::toDisplayString($safety)) ?></span>
@ -137,7 +146,9 @@
type="search"
name="query"
placeholder="Search&hellip;"
value="<?= isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '' ?>"/>
value="<?= isset($this->context->transport->searchQuery)
? htmlspecialchars($this->context->transport->searchQuery)
: '' ?>"/>
</form>
</li>

View file

@ -1,5 +1,7 @@
<form
action="<?= \Chibi\Router::linkTo(['UserController', 'deleteAction'], ['name' => $this->context->transport->user->name]) ?>"
action="<?= \Chibi\Router::linkTo(
['UserController', 'deleteAction'],
['name' => $this->context->transport->user->name]) ?>"
method="post"
class="delete confirmable"
autocomplete="off"

View file

@ -1,4 +1,11 @@
<form action="<?= \Chibi\Router::linkTo(['UserController', 'editAction'], ['name' => $this->context->transport->user->name]) ?>" method="post" class="edit" autocomplete="off">
<form
action="<?= \Chibi\Router::linkTo(
['UserController', 'editAction'],
['name' => $this->context->transport->user->name]) ?>"
method="post"
class="edit"
autocomplete="off">
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
<div class="form-row current-password">
<label for="current-password">Current password:</label>

View file

@ -27,7 +27,9 @@ if ($this->context->user->hasEnabledEndlessScrolling())
<?php else: ?>
<li>
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'listAction'], ['filter' => $key]) ?>"><?= $text ?></a>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'listAction'], ['filter' => $key]) ?>">
<?= $text ?>
</a>
</li>
<?php endforeach ?>
</ul>
@ -40,12 +42,16 @@ if ($this->context->user->hasEnabledEndlessScrolling())
<div class="users paginator-content">
<?php foreach ($this->context->transport->users as $user): ?>
<div class="user">
<a class="avatar" href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $user->name]) ?>">
<a class="avatar" href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $user->name]) ?>">
<img src="<?= htmlspecialchars($user->getAvatarUrl(100)) ?>" alt="<?= $user->name ?>"/>
</a>
<div class="details">
<h1>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $user->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $user->name]) ?>">
<?= $user->name ?>
</a>
</h1>

View file

@ -9,7 +9,11 @@ Assets::setSubTitle('registration form');
Assets::addStylesheet('auth.css');
?>
<form action="<?= \Chibi\Router::linkTo(['UserController', 'registrationAction']) ?>" class="auth register" method="post">
<form
action="<?= \Chibi\Router::linkTo(['UserController', 'registrationAction']) ?>"
class="auth register"
method="post">
<p>Registered users can view more content,<br/>upload files and add posts to favorites.</p>
<div class="form-row">

View file

@ -1,4 +1,10 @@
<form action="<?= \Chibi\Router::linkTo(['UserController', 'settingsAction'], ['name' => $this->context->transport->user->name]) ?>" method="post" class="settings">
<form
action="<?= \Chibi\Router::linkTo(
['UserController', 'settingsAction'],
['name' => $this->context->transport->user->name]) ?>"
method="post"
class="settings">
<div class="form-row safety">
<label>Safety:</label>
<div class="input-wrapper">

View file

@ -5,7 +5,10 @@ Assets::addStylesheet('user-view.css');
<div id="sidebar">
<div class="avatar-wrapper">
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $this->context->transport->user->name]) ?>">
<img
src="<?= htmlspecialchars($this->context->transport->user->getAvatarUrl(140)) ?>"
alt="<?= $this->context->transport->user->name ?>"/>
@ -93,8 +96,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'edit',
'text' => 'Edit account settings',
'link' => \Chibi\Router::linkTo(['UserController', 'editAction'], [
'name' => $this->context->transport->user->name, 'tab' => 'edit']),
'link' => \Chibi\Router::linkTo(
['UserController', 'editAction'],
['name' => $this->context->transport->user->name, 'tab' => 'edit']),
];
}
@ -106,8 +110,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'accept-registration',
'text' => 'Accept registration',
'simple-action' => \Chibi\Router::linkTo(['UserController', 'acceptRegistrationAction'], [
'name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\Router::linkTo(
['UserController', 'acceptRegistrationAction'],
['name' => $this->context->transport->user->name]),
];
}
@ -130,8 +135,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'flag',
'text' => 'Flag for moderator attention',
'simple-action' => \Chibi\Router::linkTo(['UserController', 'flagAction'], [
'name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\Router::linkTo(
['UserController', 'flagAction'],
['name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to flag this user?',
];
}
@ -147,8 +153,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'ban',
'text' => 'Ban user',
'simple-action' => \Chibi\Router::linkTo(['UserController', 'banAction'], [
'name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\Router::linkTo(
['UserController', 'banAction'],
['name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to ban this user?',
];
}
@ -158,8 +165,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'unban',
'text' => 'Unban user',
'simple-action' => \Chibi\Router::linkTo(['UserController', 'unbanAction'], [
'name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\Router::linkTo(
['UserController', 'unbanAction'],
['name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to unban this user?',
];
}
@ -173,8 +181,9 @@ Assets::addStylesheet('user-view.css');
[
'class' => 'delete',
'text' => 'Delete account',
'link' => \Chibi\Router::linkTo(['UserController', 'deleteAction'], [
'name' => $this->context->transport->user->name, 'tab' => 'delete']),
'link' => \Chibi\Router::linkTo(
['UserController', 'deleteAction'],
['name' => $this->context->transport->user->name, 'tab' => 'delete']),
];
}
@ -191,8 +200,9 @@ Assets::addStylesheet('user-view.css');
<?php else: ?>
<li class="favs">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], [
'name' => $this->context->transport->user->name,
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $this->context->transport->user->name,
'tab' => 'favs',
'page' => 1]) ?>">
Favs
@ -204,8 +214,9 @@ Assets::addStylesheet('user-view.css');
<?php else: ?>
<li class="uploads">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], [
'name' => $this->context->transport->user->name,
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $this->context->transport->user->name,
'tab' => 'uploads',
'page' => 1]) ?>">
Uploads
@ -221,8 +232,9 @@ Assets::addStylesheet('user-view.css');
<?php else: ?>
<li class="settings">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'settingsAction'], [
'name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'settingsAction'],
['name' => $this->context->transport->user->name]) ?>">
Browsing settings
</a>
</li>
@ -234,8 +246,9 @@ Assets::addStylesheet('user-view.css');
<?php else: ?>
<li class="edit">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'editAction'], [
'name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'editAction'],
['name' => $this->context->transport->user->name]) ?>">
Account settings
</a>
</li>
@ -249,8 +262,9 @@ Assets::addStylesheet('user-view.css');
<?php else: ?>
<li class="delete">
<?php endif ?>
<a href="<?= \Chibi\Router::linkTo(['UserController', 'deleteAction'], [
'name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'deleteAction'],
['name' => $this->context->transport->user->name]) ?>">
Delete account
</a>
</li>