Split long lines in views

This commit is contained in:
Marcin Kurczewski 2014-04-27 15:59:29 +02:00
parent 60208407ea
commit da1f5d8ab2
31 changed files with 519 additions and 157 deletions

@ -1 +1 @@
Subproject commit c660801c2b1d9dcd1807270f2a3ad18dcdcabc6f
Subproject commit b6097259d4da7f337718c1afe9a285daa7185f19

View file

@ -32,14 +32,14 @@
.comment .delete {
font-size: small;
}
.comment .edit:before,
.comment .delete:before {
.comment .edit a:before,
.comment .delete a:before {
margin-left: 0.2em;
content: ' [';
color: silver;
}
.comment .edit:after,
.comment .delete:after {
.comment .edit a:after,
.comment .delete a:after {
content: ']';
color: silver;
}

View file

@ -164,7 +164,7 @@ footer a {
#sidebar .key {
padding-right: 0.5em;
padding-right: 0.3em;
}
#sidebar .key-value {
max-width: 100%;

View file

@ -7,11 +7,11 @@
max-width: 50%;
}
pre {
code {
font-size: 11pt;
margin: 0;
}
pre strong {
code strong {
background: #fee;
}

View file

@ -88,6 +88,15 @@ embed {
font-weight: bold;
}
#sidebar .score a:first-of-type:before {
content: '[';
color: black;
}
#sidebar .score a:last-of-type:after {
content: ']';
color: black;
}
#sidebar .left a,
#sidebar .right a {
display: inline-block;
@ -140,7 +149,7 @@ i.icon-fav {
vertical-align: middle;
}
.hl-option span {
padding-left: 0.6em;
padding-left: 0.4em;
vertical-align: middle;
}
.permalink .ext:after {

View file

@ -222,13 +222,6 @@ class TextHelper
return $path;
}
public static function secureWhitespace($text)
{
$text = str_replace(["\r\n", "\r", "\n"], '
', $text);
$text = str_replace(' ', ' ', $text);
return $text;
}
const HTML_OPEN = 1;
const HTML_CLOSE = 2;
const HTML_LEAF = 3;

View file

@ -4,7 +4,10 @@ CustomAssetViewDecorator::addStylesheet('auth.css');
?>
<form action="<?= \Chibi\UrlHelper::route('auth', 'login') ?>" class="auth" method="post">
<p>If you don't have an account yet,<br/><a href="<?= \Chibi\UrlHelper::route('user', 'registration'); ?>">click here</a> to create a new one.</p>
<p>
If you don't have an account yet,<br/>
<a href="<?= \Chibi\UrlHelper::route('user', 'registration'); ?>">click here</a> to create a new one.
</p>
<div class="form-row">
<label for="name">User name:</label>
@ -22,10 +25,7 @@ CustomAssetViewDecorator::addStylesheet('auth.css');
<button class="submit" type="submit">Log in</button>
&nbsp;
<input type="hidden" name="remember" value="0"/>
<label>
<input type="checkbox" name="remember" value="1"/>
Remember me
</label>
<label><input type="checkbox" name="remember" value="1"/> Remember me</label>
</div>
</div>

View file

@ -3,7 +3,11 @@ CustomAssetViewDecorator::addStylesheet('comment-edit.css');
CustomAssetViewDecorator::addScript('comment-edit.js');
?>
<form action="<?= \Chibi\UrlHelper::route('comment', 'add', ['postId' => $this->context->transport->post->id]) ?>" method="post" class="add-comment">
<form
action="<?= \Chibi\UrlHelper::route('comment', 'add', ['postId' => $this->context->transport->post->id]) ?>"
method="post"
class="add-comment">
<h1>add comment</h1>
<div class="preview"></div>

View file

@ -3,13 +3,19 @@ CustomAssetViewDecorator::addStylesheet('comment-edit.css');
CustomAssetViewDecorator::addScript('comment-edit.js');
?>
<form action="<?= \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->transport->comment->id]) ?>" method="post" class="edit-comment">
<form
action="<?= \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->transport->comment->id]) ?>"
method="post"
class="edit-comment">
<h1>edit comment</h1>
<div class="preview"></div>
<div class="form-row text">
<div class="input-wrapper"><textarea name="text" cols="50" rows="3"><?= TextHelper::secureWhitespace($this->context->transport->comment->text) ?></textarea></div>
<div class="input-wrapper">
<textarea name="text" cols="50" rows="3"><?= $this->context->transport->comment->text ?></textarea>
</div>
</div>
<input type="hidden" name="submit" value="1"/>

View file

@ -17,17 +17,20 @@ CustomAssetViewDecorator::setSubTitle('comments');
<?php foreach ($this->context->transport->posts as $post): ?>
<div class="comment-group">
<div class="post-wrapper">
<?php $this->context->post = $post ?>
<?php
$this->context->post = $post;
$comments = array_reverse($post->getComments());
$commentsToDisplay = array_slice($comments, 0, $this->config->comments->maxCommentsInList);
?>
<?= $this->renderFile('post-small') ?>
</div>
<div class="comments">
<?php $comments = array_reverse($post->getComments()) ?>
<?php foreach (array_slice($comments, 0, $this->config->comments->maxCommentsInList) as $comment): ?>
<?php foreach ($commentsToDisplay as $comment): ?>
<?php $this->context->comment = $comment ?>
<?= $this->renderFile('comment-small') ?>
<?php endforeach ?>
<?php if (count($comments) > $this->config->comments->maxCommentsInList): ?>
<?php if (count($comments) > count($commentsToDisplay)): ?>
<a href="<?= \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<span class="hellip">(more&hellip;)</span>
</a>

View file

@ -12,7 +12,9 @@ CustomAssetViewDecorator::addScript('comment-edit.js');
<img src="<?= htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?= $commenter->name ?>"/>
</a>
<?php else: ?>
<img src="<?= \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>" alt="<?= UserModel::getAnonymousName() ?>">
<img
src="<?= \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>"
alt="<?= UserModel::getAnonymousName() ?>">
<?php endif ?>
</div>
@ -32,7 +34,9 @@ CustomAssetViewDecorator::addScript('comment-edit.js');
<?= TextHelper::formatDate($this->context->comment->commentDate, false) ?>
</span>
<?php if (PrivilegesHelper::confirm(Privilege::EditComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::EditComment,
PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<span class="edit">
<a href="<?= \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->comment->id]) ?>">
edit
@ -40,9 +44,13 @@ CustomAssetViewDecorator::addScript('comment-edit.js');
</span>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::DeleteComment,
PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<span class="delete">
<a class="simple-action confirmable" href="<?= \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
<a href="<?= \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>"
class="simple-action confirmable"
data-confirm-text="Are you sure you want to delete this comment?">
delete
</a>
</span>

View file

@ -12,8 +12,12 @@ CustomAssetViewDecorator::addStylesheet('index-index.css');
<?php if (!empty($this->context->featuredPost)): ?>
<div class="body">
<?php $this->context->imageLink = \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->featuredPost->id]) ?>
<?php $this->context->transport->post = $this->context->featuredPost ?>
<?php
$this->context->transport->post = $this->context->featuredPost;
$this->context->imageLink = \Chibi\UrlHelper::route('post', 'view', [
'id' => $this->context->featuredPost->id]);
?>
<?= $this->renderFile('post-file-render') ?>
</div>
@ -34,10 +38,14 @@ CustomAssetViewDecorator::addStylesheet('index-index.css');
</div>
<div class="right">
Featured&#32;
Featured
<?php if ($this->context->featuredPostUser): ?>
by <a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>"><?= $this->context->featuredPostUser->name ?></a>,&#32;
by
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>">
<?= $this->context->featuredPostUser->name ?>
</a>,
<?php endif ?>
<?php $x = round((time() - $this->context->featuredPostDate) / (24 * 3600.)) ?>
<?php if ($x == 0): ?>
today

View file

@ -35,6 +35,7 @@ else
'Content-Type',
$this->context->transport->mimeType);
if (strtotime($ifModifiedSince) == $lastModified or $eTagHeader == $eTag)
{
header('HTTP/1.1 304 Not Modified');

View file

@ -16,7 +16,10 @@ CustomAssetViewDecorator::addScript('core.js');
<body>
<script type="text/javascript">
var lastSearchQuery = <?= json_encode(isset($this->context->transport->lastSearchQuery) ? $this->context->transport->lastSearchQuery : '') ?>;
var lastSearchQuery = <?= json_encode(
isset($this->context->transport->lastSearchQuery)
? $this->context->transport->lastSearchQuery
:'') ?>;
</script>
<nav id="top-nav">

View file

@ -3,21 +3,28 @@ CustomAssetViewDecorator::setSubTitle('logs (' . $name . ')');
?>
<?php if (empty($this->context->transport->lines)): ?>
<p class="alert alert-warning">This log is empty. <a href="<?= \Chibi\UrlHelper::route('log', 'list') ?>">Go back</a></p>
<p class="alert alert-warning">
This log is empty. <a href="<?= \Chibi\UrlHelper::route('log', 'list') ?>">Go back</a>
</p>
<?php else: ?>
<?php
CustomAssetViewDecorator::addStylesheet('logs.css');
CustomAssetViewDecorator::addScript('logs.js');
?>
<form action="<?= \Chibi\UrlHelper::route('log', 'view', ['name' => $this->context->transport->name]) ?>" method="get">
<form method="get"
action="<?= \Chibi\UrlHelper::route('log', 'view', ['name' => $this->context->transport->name]) ?>">
Keep only lines that contain:
<input type="text" name="query" value="<?= htmlspecialchars($this->context->transport->filter) ?>" placeholder="any text&hellip;"/>
<input type="text"
name="query"
value="<?= htmlspecialchars($this->context->transport->filter) ?>"
placeholder="any text&hellip;"/>
</form>
<div class="paginator-content">
<pre><?= $this->context->transport->lines ?></pre>
<code><?= $this->context->transport->lines ?></code>
</div>
<?php $this->renderFile('paginator') ?>

View file

@ -1,12 +1,30 @@
<form action="<?= \Chibi\UrlHelper::route('post', 'edit', ['id' => $this->context->transport->post->id]) ?>" method="post" enctype="multipart/form-data" class="edit-post">
<form method="post"
action="<?= \Chibi\UrlHelper::route('post', 'edit', ['id' => $this->context->transport->post->id]) ?>"
enctype="multipart/form-data"
class="edit-post">
<h1>edit post</h1>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostSafety, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<input type="hidden"
name="edit-token"
id="edit-token"
value="<?= htmlspecialchars($this->context->transport->post->getEditToken()) ?>"/>
<?php if (PrivilegesHelper::confirm(
Privilege::EditPostSafety,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row safety">
<label>Safety:</label>
<div class="input-wrapper">
<?php foreach (PostSafety::getAll() as $safety): ?>
<label>
<input type="radio" name="safety" value="<?= $safety ?>" <?php if ($this->context->transport->post->safety == $safety) echo 'checked="checked"' ?>/>
<input type="radio"
name="safety"
<?php if ($this->context->transport->post->safety == $safety): ?>
checked="checked"
<?php endif ?>
value="<?= $safety ?>"/>
&nbsp;<?= ucfirst(PostSafety::toDisplayString($safety)) ?>
</label>
<?php endforeach ?>
@ -14,41 +32,80 @@
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostTags, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::EditPostTags,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row tags">
<label for="tags">Tags:</label>
<div class="input-wrapper"><input type="text" name="tags" id="tags" placeholder="enter some tags&hellip;" value="<?= join(',', array_map(function($tag) { return htmlspecialchars($tag->name); }, $this->context->transport->post->getTags())) ?>"/></div>
<div class="input-wrapper">
<input type="text"
name="tags"
id="tags"
placeholder="enter some tags&hellip;"
value="<?= join(',', array_map(function($tag) {
return htmlspecialchars($tag->name);
}, $this->context->transport->post->getTags())) ?>"/>
</div>
</div>
<input type="hidden" name="edit-token" id="edit-token" value="<?= htmlspecialchars($this->context->transport->post->getEditToken()) ?>"/>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostSource, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::EditPostSource,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row source">
<label for="source">Source:</label>
<div class="input-wrapper"><input type="text" name="source" id="source" value="<?= htmlspecialchars($this->context->transport->post->source) ?>"/></div>
<div class="input-wrapper">
<input type="text"
name="source"
id="source"
value="<?= htmlspecialchars($this->context->transport->post->source) ?>"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostRelations, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::EditPostRelations,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row thumb">
<label for="relations">Relations:</label>
<div class="input-wrapper"><input type="text" name="relations" id="relations" placeholder="id1,id2,&hellip;" value="<?= join(',', array_map(function($post) { return $post->id; }, $this->context->transport->post->getRelations())) ?>"/></div>
<div class="input-wrapper">
<input type="text"
name="relations"
id="relations"
placeholder="id1,id2,&hellip;"
value="<?= join(',', array_map(function($post) {
return $post->id;
}, $this->context->transport->post->getRelations())) ?>"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostFile, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::EditPostFile,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row url">
<label for="url">File:</label>
<div class="input-wrapper"><input type="text" name="url" id="url" placeholder="Some url&hellip;"/></div>
<div class="input-wrapper">
<input type="text" name="url" id="url" placeholder="Some url&hellip;"/>
</div>
</div>
<div class="form-row file">
<label for="file"></label>
<div class="input-wrapper"><input type="file" name="file" id="file"/></div>
<div class="input-wrapper">
<input type="file" name="file" id="file"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::EditPostThumb, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::EditPostThumb,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
<div class="form-row thumb">
<label for="thumb">Thumb:</label>
<div class="input-wrapper">

View file

@ -15,19 +15,33 @@
<?php elseif ($post->type == PostType::Flash): ?>
<object type="<?= $post->mimeType ?>" width="<?= $post->imageWidth ?>" height="<?= $post->imageHeight ?>" data="<?= \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>">
<object
type="<?= $post->mimeType ?>"
width="<?= $post->imageWidth ?>"
height="<?= $post->imageHeight ?>"
data="<?= \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>">
<param name="movie" value="<?= \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>"/>
<param name="wmode" value="opaque"/>
</object>
<?php elseif ($post->type == PostType::Youtube): ?>
<iframe style="width: 800px; height: 600px; border: 0;" src="//www.youtube.com/embed/<?= $post->fileHash ?>?wmode=opaque" allowfullscreen></iframe>
<iframe
style="width: 800px; height: 600px; border: 0;"
src="//www.youtube.com/embed/<?= $post->fileHash ?>?wmode=opaque"
allowfullscreen>
</iframe>
<?php elseif ($post->type == PostType::Video): ?>
<video style="max-width: 100%" controls>
<source type="<?= $post->mimeType ?>" src="<?= \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>">
<source
type="<?= $post->mimeType ?>"
src="<?= \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $post->name]) ?>">
Your browser doesn't support HTML5 &lt;video&gt; tag.
</video>

View file

@ -31,8 +31,13 @@ if (PrivilegesHelper::confirm(Privilege::MassTag))
{
$tabs []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', [
'source' => 'mass-tag',
'query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '',
'page' => isset($this->context->transport->paginator) ? $this->context->transport->paginator->page : 1])];
'query' => isset($this->context->transport->searchQuery)
? htmlspecialchars($this->context->transport->searchQuery)
: '',
'page' => isset($this->context->transport->paginator)
? $this->context->transport->paginator->page
: 1])];
if ($this->context->source == 'mass-tag')
$activeTab = count($tabs) - 1;
}
@ -42,12 +47,17 @@ if (PrivilegesHelper::confirm(Privilege::MassTag))
<nav class="tabs">
<ul>
<?php foreach ($tabs as $i => $tab): ?>
<?php list($name, $url) = $tab ?>
<?php if ($i == $activeTab): ?>
<li class="selected <?= TextCaseConverter::convert($name, TextCaseConverter::BLANK_CASE, TextCaseConverter::SPINAL_CASE) ?>">
<?php else: ?>
<li class="<?= TextCaseConverter::convert($name, TextCaseConverter::BLANK_CASE, TextCaseConverter::SPINAL_CASE) ?>">
<?php endif ?>
<?php
list($name, $url) = $tab;
$classes = [];
$classes []= TextCaseConverter::convert($name,
TextCaseConverter::BLANK_CASE,
TextCaseConverter::SPINAL_CASE);
if ($i == $activeTab)
$classes []= 'selected';
?>
<li class="<?= join(' ', $classes) ?>">
<a href="<?= $url ?>">
<?= $name ?>
</a>

View file

@ -3,8 +3,12 @@ CustomAssetViewDecorator::addStylesheet('post-list.css');
CustomAssetViewDecorator::addScript('post-list.js');
?>
<?php if (isset($this->context->source) and $this->context->source == 'mass-tag' and PrivilegesHelper::confirm(Privilege::MassTag)): ?>
<?php if (isset($this->context->source)
and $this->context->source == 'mass-tag'
and PrivilegesHelper::confirm(Privilege::MassTag)): ?>
<?php $this->renderFile('tag-mass-tag') ?>
<?php endif ?>

View file

@ -27,17 +27,30 @@ if ($masstag)
<div class="<?= implode(' ', $classNames) ?>">
<?php if ($masstag): ?>
<a class="toggle-tag" href="<?= \Chibi\UrlHelper::route('post', 'toggle-tag', ['id' => $this->context->post->id, 'tag' => $this->context->additionalInfo, 'enable' => '_enable_']) ?>" data-text-tagged="Tagged" data-text-untagged="Untagged">
<a class="toggle-tag"
href="<?= \Chibi\UrlHelper::route('post', 'toggle-tag', [
'id' => $this->context->post->id,
'tag' => $this->context->additionalInfo,
'enable' => '_enable_']) ?>"
data-text-tagged="Tagged"
data-text-untagged="Untagged">
<?= in_array('tagged', $classNames) ? 'Tagged' : 'Untagged' ?>
</a>
<?php endif ?>
<?php if ($this->context->user->hasEnabledPostTagTitles()): ?>
<a title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>" class="link" href="<?= \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<?php else: ?>
<a class="link" href="<?= \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<?php endif ?>
<img class="thumb" src="<?= \Chibi\UrlHelper::route('post', 'thumb', ['name' => $this->context->post->name]) ?>" alt="@<?= $this->context->post->id ?>"/>
<a class="link"
<?php if ($this->context->user->hasEnabledPostTagTitles()): ?>
title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>"
<?php endif ?>
href="<?= \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<img
class="thumb"
src="<?= \Chibi\UrlHelper::route('post', 'thumb', ['name' => $this->context->post->name]) ?>"
alt="@<?= $this->context->post->id ?>"/>
<?php
$x =
[
@ -46,6 +59,7 @@ if ($masstag)
'favs' => $this->context->post->favCount,
];
?>
<?php if (!empty($x)): ?>
<div class="info-bar">
<?php foreach ($x as $key => $val): ?>
@ -55,7 +69,7 @@ if ($masstag)
<span>
<?php endif ?>
<i class="icon-<?= $key ?>"></i>
&nbsp;<?= $val ?>
<?= $val ?>
</span>
<?php endforeach ?>
</div>

View file

@ -9,6 +9,7 @@ CustomAssetViewDecorator::addScript('../lib/tagit/jquery.tagit.js');
<div id="sidebar">
<div class="unit">
<h1>file upload</h1>
<p>Use tags to describe uploaded images. Try to specify characters, their look and shows they are from.</p>
<p>Set proper visibility setting if the image isn&rsquo;t safe for work or you&rsquo;re not sure it&rsquo;s 100% <span class="safety-safe">safe</span>.</p>
<p>Only registered users can view <span class="safety-sketchy">sketchy</span> or <span class="safety-unsafe">NSFW</span> content.</p>
@ -79,8 +80,16 @@ CustomAssetViewDecorator::addScript('../lib/tagit/jquery.tagit.js');
<?php $checked = false ?>
<?php foreach (PostSafety::getAll() as $safety): ?>
<label>
<input type="radio" name="safety" value="<?= $safety ?>"<?php if (!$checked) echo ' checked="checked"' ?>/>
<input
type="radio"
name="safety"
<?php if (!$checked): ?>
checked="checked"
<?php endif ?>
value="<?= $safety ?>" />
<?= ucfirst(PostSafety::toDisplayString($safety)) ?>
<?php $checked = true ?>
</label>
<?php endforeach ?>
@ -94,12 +103,16 @@ CustomAssetViewDecorator::addScript('../lib/tagit/jquery.tagit.js');
<div class="form-row tags">
<label>Tags:</label>
<div class="input-wrapper"><input type="text" name="tags" placeholder="enter some tags&hellip;"/></div>
<div class="input-wrapper">
<input type="text" name="tags" placeholder="enter some tags&hellip;"/>
</div>
</div>
<div class="form-row source">
<label>Source:</label>
<div class="input-wrapper"><input type="text" name="source" placeholder="where did you get this from? (optional)"/></div>
<div class="input-wrapper">
<input type="text" name="source" placeholder="where did you get this from? (optional)"/>
</div>
</div>
<input type="hidden" name="submit" value="1"/>

View file

@ -1,5 +1,8 @@
<?php
CustomAssetViewDecorator::setSubTitle('showing ' . TextHelper::reprPost($this->context->transport->post) . ' &ndash; ' . TextHelper::reprTags($this->context->transport->post->getTags()));
$subTitle = sprintf('showing %s&nbsp;&ndash;%s',
TextHelper::reprPost($this->context->transport->post),
TextHelper::reprTags($this->context->transport->post->getTags()));
CustomAssetViewDecorator::setSubTitle($subTitle);
CustomAssetViewDecorator::addStylesheet('post-view.css');
CustomAssetViewDecorator::addScript('post-view.js');
CustomAssetViewDecorator::addStylesheet('../lib/tagit/jquery.tagit.css');
@ -14,7 +17,10 @@ $editPostPrivileges = [
$editPostPrivileges = array_fill_keys($editPostPrivileges, false);
foreach (array_keys($editPostPrivileges) as $privilege)
{
if (PrivilegesHelper::confirm($privilege, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
if (PrivilegesHelper::confirm(
$privilege,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
$editPostPrivileges[$privilege] = true;
}
$canEditAnything = count(array_filter($editPostPrivileges)) > 0;
@ -49,7 +55,10 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php if (!empty($this->context->transport->lastSearchQuery)): ?>
<div class="text">
Current&nbsp;search:<br/>
<a href="<?= \Chibi\UrlHelper::route('post', 'list', ['query' => $this->context->transport->lastSearchQuery]) ?>"><?= $this->context->transport->lastSearchQuery ?></a>
<a href="<?= \Chibi\UrlHelper::route('post', 'list', [
'query' => $this->context->transport->lastSearchQuery]) ?>">
<?= $this->context->transport->lastSearchQuery ?>
</a>
</div>
<?php endif ?>
</nav>
@ -61,12 +70,8 @@ $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\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>">
<?= $tag->name ?>
</a>
<span class="count">
<?= TextHelper::useDecimalUnits($tag->getPostCount()) ?>
</span>
<a href="<?= \Chibi\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>"><?= $tag->name ?></a>
<span class="count"><?= TextHelper::useDecimalUnits($tag->getPostCount()) ?></span>
</li>
<?php endforeach ?>
</ul>
@ -130,10 +135,8 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<span class="value">
<?= $this->context->transport->post->score ?>
<?php $scoreLink = function($score) { return \Chibi\UrlHelper::route('post', 'score', ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
<?php if (PrivilegesHelper::confirm(Privilege::ScorePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
&nbsp;[
<?php $scoreLink = function($score) { return \Chibi\UrlHelper::route('post', 'score', ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
<?php if ($this->context->score === 1): ?>
<a class="simple-action selected" href="<?= $scoreLink(0) ?>">
<?php else: ?>
@ -150,7 +153,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<a class="simple-action" href="<?= $scoreLink(-1) ?>">
<?php endif ?>
down
</a>]
</a>
<?php endif ?>
</span>
</div>

View file

@ -4,17 +4,50 @@
<div class="form-row">
<label for="mass-tag-query">Search query:</label>
<div class="input-wrapper"><input class="autocomplete" type="text" name="query" id="mass-tag-query" value="<?= isset($this->context->massTagQuery) ? htmlspecialchars($this->context->massTagQuery) : '' ?>"/></div>
<div class="input-wrapper">
<input
class="autocomplete"
type="text"
name="query"
id="mass-tag-query"
value="<?= isset($this->context->massTagQuery)
? htmlspecialchars($this->context->massTagQuery)
: '' ?>"/>
</div>
</div>
<div class="form-row">
<label for="mass-tag-tag">Tag:</label>
<div class="input-wrapper"><input class="autocomplete" type="text" name="tag" id="mass-tag-tag" value="<?= isset($this->context->massTagTag) ? htmlspecialchars($this->context->massTagTag) : '' ?>"/></div>
<div class="input-wrapper">
<input
class="autocomplete"
type="text"
name="tag"
id="mass-tag-tag"
value="<?= isset($this->context->massTagTag)
? htmlspecialchars($this->context->massTagTag)
: '' ?>"/>
</div>
</div>
<input type="hidden" name="old-page" value="<?= isset($this->context->transport->paginator) ? htmlspecialchars($this->context->transport->paginator->page) : '' ?>"/>
<input type="hidden" name="old-query" value="<?= isset($this->context->massTagQuery) ? htmlspecialchars($this->context->massTagQuery) : '' ?>"/>
<input type="hidden" name="submit" value="1"/>
<input
type="hidden"
name="old-page"
value="<?= isset($this->context->transport->paginator)
? htmlspecialchars($this->context->transport->paginator->page)
: '' ?>"/>
<input
type="hidden"
name="old-query"
value="<?= isset($this->context->massTagQuery)
? htmlspecialchars($this->context->massTagQuery)
: '' ?>"/>
<input
type="hidden"
name="submit"
value="1"/>
<div class="form-row">
<label></label>

View file

@ -4,12 +4,16 @@
<div class="form-row">
<label for="merge-source-tag">Source tag:</label>
<div class="input-wrapper"><input class="autocomplete" type="text" name="source-tag" id="merge-source-tag"/></div>
<div class="input-wrapper">
<input class="autocomplete" type="text" name="source-tag" id="merge-source-tag"/>
</div>
</div>
<div class="form-row">
<label for="merge-target-tag">Target tag:</label>
<div class="input-wrapper"><input class="autocomplete" type="text" name="target-tag" id="merge-target-tag"/></div>
<div class="input-wrapper">
<input class="autocomplete" type="text" name="target-tag" id="merge-target-tag"/>
</div>
</div>
<input type="hidden" name="submit" value="1"/>

View file

@ -4,12 +4,16 @@
<div class="form-row">
<label for="rename-source-tag">Source tag:</label>
<div class="input-wrapper"><input class="autocomplete" type="text" name="source-tag" id="rename-source-tag"/></div>
<div class="input-wrapper">
<input class="autocomplete" type="text" name="source-tag" id="rename-source-tag"/>
</div>
</div>
<div class="form-row">
<label for="rename-target-tag">Target tag:</label>
<div class="input-wrapper"><input type="text" name="target-tag" id="rename-target-tag"/></div>
<div class="input-wrapper">
<input type="text" name="target-tag" id="rename-target-tag"/>
</div>
</div>
<input type="hidden" name="submit" value="1"/>

View file

@ -63,7 +63,9 @@
$registerNavItem(
'Users',
\Chibi\UrlHelper::route('user', 'list'),
$activeController == 'user' and $activeAction != 'registration' and (!isset($this->context->route->arguments['name']) or $this->context->route->arguments['name'] != $this->context->user->name));
$activeController == 'user' and $activeAction != 'registration' and
(!isset($this->context->route->arguments['name']) or
$this->context->route->arguments['name'] != $this->context->user->name));
}
if (!$this->context->loggedIn)
@ -83,7 +85,8 @@
$registerNavItem(
'My account',
\Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->user->name]),
$activeController == 'user' and isset($this->context->route->arguments['name']) and $this->context->route->arguments['name'] == $this->context->user->name);
$activeController == 'user' and isset($this->context->route->arguments['name']) and
$this->context->route->arguments['name'] == $this->context->user->name);
$registerNavItem(
'Log out',
@ -113,12 +116,21 @@
<li class="safety">
<ul>
<?php foreach (PostSafety::getAll() as $safety): ?>
<?php if (PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ListPosts,
PostSafety::toString($safety))): ?>
<li class="safety-<?= TextCaseConverter::convert(PostSafety::toString($safety), TextCaseConverter::CAMEL_CASE, TextCaseConverter::SPINAL_CASE) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'toggle-safety', ['safety' => $safety]) ?>" class="<?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>" title="Searching <?= PostSafety::toDisplayString($safety) ?> posts: <?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>">
<a class="<?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>"
href="<?= \Chibi\UrlHelper::route('user', 'toggle-safety', ['safety' => $safety]) ?>"
title="Searching <?= PostSafety::toDisplayString($safety) ?> posts: <?= $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>">
<span><?= ucfirst(PostSafety::toDisplayString($safety)) ?></span>
</a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
@ -127,7 +139,14 @@
<li class="search">
<form name="search" action="<?= \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
<input class="autocomplete" type="search" name="query" placeholder="Search&hellip;" value="<?= isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '' ?>"/>
<input
class="autocomplete"
type="search"
name="query"
placeholder="Search&hellip;"
value="<?= isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '' ?>"/>
</form>
</li>
</ul>

View file

@ -1,8 +1,16 @@
<form action="<?= \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>" method="post" class="delete confirmable" autocomplete="off" data-confirm-text="Are you sure you want to delete your account?">
<form
action="<?= \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>"
method="post"
class="delete confirmable"
autocomplete="off"
data-confirm-text="Are you sure you want to delete your account?">
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
<div class="form-row current-password">
<label for="current-password">Current password:</label>
<div class="input-wrapper"><input type="password" name="current-password" id="current-password" placeholder="Current password"/></div>
<div class="input-wrapper">
<input type="password" name="current-password" id="current-password" placeholder="Current password"/>
</div>
</div>
<?php endif ?>

View file

@ -2,51 +2,100 @@
<?php if ($this->context->user->id == $this->context->transport->user->id): ?>
<div class="form-row current-password">
<label for="current-password">Current password:</label>
<div class="input-wrapper"><input type="password" name="current-password" id="current-password" placeholder="Current password"/></div>
<div class="input-wrapper">
<input
type="password"
name="current-password"
id="current-password"
placeholder="Current password"/>
</div>
</div>
<hr>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserName, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ChangeUserName,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<div class="form-row nickname">
<label for="name">Name:</label>
<div class="input-wrapper"><input type="text" name="name" id="name" placeholder="New name&hellip;" value="<?= htmlspecialchars($this->context->suppliedName) ?>"/></div>
<div class="input-wrapper">
<input
type="text"
name="name"
id="name"
placeholder="New name&hellip;"
value="<?= htmlspecialchars($this->context->suppliedName) ?>"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserEmail, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ChangeUserEmail,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<div class="form-row email">
<label for="name">E-mail:</label>
<div class="input-wrapper"><input type="text" name="email" id="email" placeholder="New e-mail&hellip;" value="<?= htmlspecialchars($this->context->suppliedEmail) ?>"/></div>
<div class="input-wrapper">
<input
type="text"
name="email"
id="email"
placeholder="New e-mail&hellip;"
value="<?= htmlspecialchars($this->context->suppliedEmail) ?>"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserPassword, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (
PrivilegesHelper::confirm(Privilege::ChangeUserPassword,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<div class="form-row password1">
<label for="password1">New password:</label>
<div class="input-wrapper"><input type="password" name="password1" id="password1" placeholder="New password&hellip;" value="<?= htmlspecialchars($this->context->suppliedPassword1) ?>"/></div>
<div class="input-wrapper">
<input
type="password"
name="password1"
id="password1"
placeholder="New password&hellip;"
value="<?= htmlspecialchars($this->context->suppliedPassword1) ?>"/>
</div>
</div>
<div class="form-row password2">
<label for="password2"></label>
<div class="input-wrapper"><input type="password" name="password2" id="password2" placeholder="New password&hellip; (repeat)" value="<?= htmlspecialchars($this->context->suppliedPassword2) ?>"/></div>
<div class="input-wrapper">
<input
type="password"
name="password2"
id="password2"
placeholder="New password&hellip; (repeat)"
value="<?= htmlspecialchars($this->context->suppliedPassword2) ?>"/>
</div>
</div>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserAccessRank, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ChangeUserAccessRank,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<div class="form-row access-rank">
<label for="access-rank">Access rank:</label>
<div class="input-wrapper"><select name="access-rank" id="access-rank">
<?php foreach (AccessRank::getAll() as $rank): ?>
<?php if ($rank == AccessRank::Nobody) continue ?>
<?php if (($this->context->suppliedAccessRank != '' and $rank == $this->context->suppliedAccessRank) or ($this->context->suppliedAccessRank == '' and $rank == $this->context->transport->user->accessRank)): ?>
<option value="<?= $rank ?>" selected="selected">
<?php else: ?>
<option value="<?= $rank ?>">
<?php endif ?>
<?= AccessRank::toDisplayString($rank) ?>
</option>
<?php endforeach ?>
</select></div>
<div class="input-wrapper">
<select name="access-rank" id="access-rank">
<?php foreach (AccessRank::getAll() as $rank): ?>
<?php if ($rank == AccessRank::Nobody) continue ?>
<?php if (($this->context->suppliedAccessRank != '' and $rank == $this->context->suppliedAccessRank)
or ($this->context->suppliedAccessRank == '' and $rank == $this->context->transport->user->accessRank)): ?>
<option value="<?= $rank ?>" selected="selected">
<?php else: ?>
<option value="<?= $rank ?>">
<?php endif ?>
<?= AccessRank::toDisplayString($rank) ?>
</option>
<?php endforeach ?>
</select>
</div>
</div>
<?php endif ?>

View file

@ -14,25 +14,59 @@ CustomAssetViewDecorator::setSubTitle('registration form');
<div class="form-row">
<label for="name">User name:</label>
<div class="input-wrapper"><input type="text" id="name" name="name" value="<?= htmlspecialchars($this->context->suppliedName) ?>" placeholder="e.g. darth_vader" autocomplete="off"/></div>
<div class="input-wrapper">
<input
type="text"
id="name"
name="name"
value="<?= htmlspecialchars($this->context->suppliedName) ?>"
placeholder="e.g. darth_vader"
autocomplete="off"/>
</div>
</div>
<div class="form-row">
<label for="password1">Password:</label>
<div class="input-wrapper"><input type="password" id="password1" name="password1" value="<?= htmlspecialchars($this->context->suppliedPassword1) ?>" placeholder="e.g. <?= str_repeat('&#x25cf;', 8) ?>" autocomplete="off"/></div>
<div class="input-wrapper">
<input
type="password"
id="password1"
name="password1"
value="<?= htmlspecialchars($this->context->suppliedPassword1) ?>"
placeholder="e.g. <?= str_repeat('&#x25cf;', 8) ?>"
autocomplete="off"/>
</div>
</div>
<div class="form-row">
<label for="password2">Password (repeat):</label>
<div class="input-wrapper"><input type="password" id="password2" name="password2" value="<?= htmlspecialchars($this->context->suppliedPassword2) ?>" placeholder="e.g. <?= str_repeat('&#x25cf;', 8) ?>" autocomplete="off"/></div>
<div class="input-wrapper">
<input
type="password"
id="password2"
name="password2"
value="<?= htmlspecialchars($this->context->suppliedPassword2) ?>"
placeholder="e.g. <?= str_repeat('&#x25cf;', 8) ?>"
autocomplete="off"/>
</div>
</div>
<div class="form-row">
<label for="email">E-mail address:</label>
<div class="input-wrapper"><input type="text" id="email" name="email" value="<?= htmlspecialchars($this->context->suppliedEmail) ?>" placeholder="e.g. vader@empire.gov" autocomplete="off"/></div>
<div class="input-wrapper">
<input
type="text"
id="email"
name="email"
value="<?= htmlspecialchars($this->context->suppliedEmail) ?>"
placeholder="e.g. vader@empire.gov" autocomplete="off"/>
</div>
</div>
<p id="email-info">Your e-mail will be used to show your <a href="http://gravatar.com/">Gravatar</a>.<br/>Leave blank for random Gravatar.</p>
<p id="email-info">
Your e-mail will be used to show your <a href="http://gravatar.com/">Gravatar</a>.<br/>
Leave blank for random Gravatar.
</p>
<?php $this->renderFile('message') ?>

View file

@ -5,7 +5,12 @@
CustomAssetViewDecorator::addStylesheet('auth.css');
?>
<form action="<?= \Chibi\UrlHelper::route($this->context->route->simpleControllerName, $this->context->route->simpleActionName) ?>" method="post" class="auth" autocomplete="off">
<form
method="post"
action="<?= \Chibi\UrlHelper::route($this->context->route->simpleControllerName, $this->context->route->simpleActionName) ?>"
class="auth"
autocomplete="off">
<div class="form-row">
<label>User:</label>
<div class="input-wrapper">

View file

@ -6,7 +6,9 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
<div id="sidebar">
<div class="avatar-wrapper">
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name]) ?>">
<img src="<?= htmlspecialchars($this->context->transport->user->getAvatarUrl(140)) ?>" alt="<?= $this->context->transport->user->name ?>">
<img
src="<?= htmlspecialchars($this->context->transport->user->getAvatarUrl(140)) ?>"
alt="<?= $this->context->transport->user->name ?>"/>
</a>
<h1><?= $this->context->transport->user->name ?></h1>
</div>
@ -16,26 +18,41 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
<div class="key-value join-date">
<span class="key">Joined:</span>
<span class="value" title="<?= TextHelper::formatDate($this->context->transport->user->joinDate, true) ?>">
<span
class="value"
title="<?= TextHelper::formatDate($this->context->transport->user->joinDate, true) ?>">
<?= TextHelper::formatDate($this->context->transport->user->joinDate, false) ?>
</span>
</div>
<div class="key-value last-login">
<span class="key">Last login:</span>
<span class="value" title="<?= TextHelper::formatDate($this->context->transport->user->lastLoginDate, true) ?>">
<span
class="value"
title="<?= TextHelper::formatDate($this->context->transport->user->lastLoginDate, true) ?>">
<?= TextHelper::formatDate($this->context->transport->user->lastLoginDate, false) ?>
</span>
</div>
<div class="key-value access-rank">
<span class="key">Access rank:</span>
<span class="value" title="<?= $val = AccessRank::toDisplayString($this->context->transport->user->accessRank) ?>">
<span
class="value"
title="<?= $val = AccessRank::toDisplayString($this->context->transport->user->accessRank) ?>">
<?= $val ?>
</span>
</div>
<?php if (PrivilegesHelper::confirm(Privilege::ViewUserEmail, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ViewUserEmail,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<div class="key-value email">
<span class="key">E-mail:</span>
<span class="value" title="<?= $val = ($this->context->transport->user->emailUnconfirmed
@ -59,8 +76,12 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
foreach (array_keys($userModificationPrivileges) as $privilege)
{
if (PrivilegesHelper::confirm($privilege, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
if (PrivilegesHelper::confirm(
$privilege,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
{
$userModificationPrivileges[$privilege] = true;
}
}
$canModifyAnything = count(array_filter($userModificationPrivileges)) > 0;
@ -72,21 +93,27 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
[
'class' => 'edit',
'text' => 'Edit account settings',
'link' => \Chibi\UrlHelper::route('user', 'edit', ['name' => $this->context->transport->user->name, 'tab' => 'edit']),
'link' => \Chibi\UrlHelper::route('user', 'edit', [
'name' => $this->context->transport->user->name, 'tab' => 'edit']),
];
}
if (PrivilegesHelper::confirm(Privilege::AcceptUserRegistration) and !$this->context->transport->user->staffConfirmed and $this->config->registration->staffActivation)
if (PrivilegesHelper::confirm(Privilege::AcceptUserRegistration)
and !$this->context->transport->user->staffConfirmed
and $this->config->registration->staffActivation)
{
$options []=
[
'class' => 'accept-registration',
'text' => 'Accept registration',
'simple-action' => \Chibi\UrlHelper::route('user', 'accept-registration', ['name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\UrlHelper::route('user', 'accept-registration', [
'name' => $this->context->transport->user->name]),
];
}
if (PrivilegesHelper::confirm(Privilege::FlagUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
if (PrivilegesHelper::confirm(
Privilege::FlagUser,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
{
if ($this->context->flagged)
{
@ -103,13 +130,16 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
[
'class' => 'flag',
'text' => 'Flag for moderator attention',
'simple-action' => \Chibi\UrlHelper::route('user', 'flag', ['name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\UrlHelper::route('user', 'flag', [
'name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to flag this user?',
];
}
}
if (PrivilegesHelper::confirm(Privilege::BanUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
if (PrivilegesHelper::confirm(
Privilege::BanUser,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
{
if (!$this->context->transport->user->banned)
{
@ -117,7 +147,8 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
[
'class' => 'ban',
'text' => 'Ban user',
'simple-action' => \Chibi\UrlHelper::route('user', 'ban', ['name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\UrlHelper::route('user', 'ban', [
'name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to ban this user?',
];
}
@ -127,19 +158,23 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
[
'class' => 'unban',
'text' => 'Unban user',
'simple-action' => \Chibi\UrlHelper::route('user', 'unban', ['name' => $this->context->transport->user->name]),
'simple-action' => \Chibi\UrlHelper::route('user', 'unban', [
'name' => $this->context->transport->user->name]),
'data-confirm-text' => 'Are you sure you want to unban this user?',
];
}
}
if (PrivilegesHelper::confirm(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
if (PrivilegesHelper::confirm(
Privilege::DeleteUser,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
{
$options []=
[
'class' => 'delete',
'text' => 'Delete account',
'link' => \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name, 'tab' => 'delete']),
'link' => \Chibi\UrlHelper::route('user', 'delete', [
'name' => $this->context->transport->user->name, 'tab' => 'delete']),
];
}
@ -156,7 +191,10 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
<?php else: ?>
<li class="favs">
<?php endif ?>
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'favs', 'page' => 1]) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'view', [
'name' => $this->context->transport->user->name,
'tab' => 'favs',
'page' => 1]) ?>">
Favs
</a>
</li>
@ -166,18 +204,25 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
<?php else: ?>
<li class="uploads">
<?php endif ?>
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name, 'tab' => 'uploads', 'page' => 1]) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'view', [
'name' => $this->context->transport->user->name,
'tab' => 'uploads',
'page' => 1]) ?>">
Uploads
</a>
</li>
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::ChangeUserSettings,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if ($this->context->transport->tab == 'settings'): ?>
<li class="selected settings">
<?php else: ?>
<li class="settings">
<?php endif ?>
<a href="<?= \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'settings', [
'name' => $this->context->transport->user->name]) ?>">
Browsing settings
</a>
</li>
@ -189,19 +234,23 @@ CustomAssetViewDecorator::addStylesheet('user-view.css');
<?php else: ?>
<li class="edit">
<?php endif ?>
<a href="<?= \Chibi\UrlHelper::route('user', 'edit', ['name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'edit', [
'name' => $this->context->transport->user->name]) ?>">
Account settings
</a>
</li>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if (PrivilegesHelper::confirm(
Privilege::DeleteUser,
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
<?php if ($this->context->transport->tab == 'delete'): ?>
<li class="selected delete">
<?php else: ?>
<li class="delete">
<?php endif ?>
<a href="<?= \Chibi\UrlHelper::route('user', 'delete', ['name' => $this->context->transport->user->name]) ?>">
<a href="<?= \Chibi\UrlHelper::route('user', 'delete', [
'name' => $this->context->transport->user->name]) ?>">
Delete account
</a>
</li>