This commit is contained in:
Marcin Kurczewski 2013-11-21 15:16:27 +01:00
parent 77c0ea7f57
commit fb5e851a13
9 changed files with 135 additions and 76 deletions

View file

@ -14,6 +14,15 @@ salt = "1A2/$_4xVa"
featuredPostMaxDays=7
debugQueries=0
[help]
title=Help
subTitles[help]=Help
subTitles[rules]=Rules
subTitles[privacy]=Privacy policy
paths[help]=./data/help.md
paths[rules]=./data/rules.md
paths[privacy]=./data/privacy.md
[browsing]
usersPerPage=8
postsPerPage=20

62
data/help.md Normal file
View file

@ -0,0 +1,62 @@
# Browsing
Clicking the Browse button at the top will take you to the list of recent posts. Use the search box in the top right corner to find posts you want to see.
If you’re not a registered user, you will only see public (Safe) posts. Logging in to your account will enable you to filter content by its rating: Safe, Sketchy, and NSFW.
You can use your keyboard to navigate around the site. There are a few shortcuts:
- focus search field: `[Q]`
- scroll up/down: `[W]` and `[S]`
- go to newer/older post or page: `[A]` and `[D]`
- edit post: `[E]`
- focus first post in post list: `[P]`
# Search syntax
- contatining tag "Haruhi": [search]Haruhi[/search]
- **not** contatining tag "Kyon": [search]-Kyon[/search]
- uploaded by David: [search]submit:David[/search] (note no spaces)
- favorited by David: [search]fav:David[/search]
- favorited by at least four users: [search]favmin:4[/search]
- commented by David: [search]comment:David[/search]
- having at least three comments: [search]commentmin:3[/search]
- having minimum score of 4: [search]scoremin:4[/search]
- tagged with at least seven tags: [search]tagmin:7[/search]
- exactly from the specified date: [search]date:2001[/search], [search]date:2012-09-29[/search] (yyyy-mm-dd format)
- from the specified date onwards: [search]datemin:2001-01-01[/search]
- up to the specified date: [search]datemax:2004-07[/search]
- having specific ID: [search]id:1,2,3,8[/search]
- having ID no less than specified value: [search]idmin:28[/search]
- by content type: [search]type:img[/search], [search]type:swf[/search], [search]type:yt[/search] (images, flash files and YouTube videos, respectively)
You can combine tags and negate any of them for interesting results. [search]sea -favmin:8 type:swf submit:Pirate[/search] will show you **flash files** tagged as **sea**, that were **liked by seven people** at most, uploaded by user **Pirate**.
All of the above can be sorted using additional sorting tags:
- as random as it can get: [search]order:random[/search]
- newest to oldest: [search]order:date[/search] (pretty much default browse view)
- oldest to newest: [search]-order:date[/search]
- most commented first: [search]order:comments[/search]
- loved by most: [search]order:favs[/search]
- highest scored: [search]order:score[/search]
As shown with [search]-order:date[/search], any of them can be reversed in the same way as negating other tags: by placing a dash before the tag. If there is a "min" tag, there’s also its "max" counterpart, e.g. [search]favmax:7[/search].
# Registration
The e-mail you enter during account creation is only used to retrieve your [Gravatar](http://gravatar.com) and activate your account. Only you can see it (well, except the database staff… we won’t spam your mailbox anyway).
Oh, and you can delete your account at any time. Posts you uploaded will stay, unless some angry admin removes them.
# Comments
Registered users can post comments. Comments support [Markdown syntax](http://daringfireball.net/projects/markdown/syntax), extended by some handy tags:
- permalink to post number 426: @426
- link to tag "Dragon_Ball": #Dragon_Ball
- mark text as spoiler and hide it: [spoiler][spoiler]There is no spoon.[/spoiler][/spoiler]
# Uploads
After registering and activating your account, you gain the power to upload files to the service for everyone else to see.

11
data/privacy.md Normal file
View file

@ -0,0 +1,11 @@
# Stored information
Posts, comments, favorites and ratings linked to your account will be stored in the site’s database and publicly available.
The "Upload anonymously" option allows you to post content without linking it to your account - meaning your nickname will not be stored in the database nor shown in the "Uploader" field.
Your actions related to posts (uploading, tagging, etc.) are logged, along with your nickname and IP.
# Cookies
Cookies are used to store your session data and browsing preferences, such as endless scrolling or visibility of NSFW posts.

8
data/rules.md Normal file
View file

@ -0,0 +1,8 @@
# Site rules
- Don’t spam, [troll](http://www.urbandictionary.com/define.php?term=troll) or offend anyone. Be nice.
- You are not allowed to post any form of [cp](http://www.urbandictionary.com/define.php?term=cp). If you possess it, we ask you to leave immediately and never come back.
- Don’t use the site to host your personal images (e.g. forum avatars).
- This kind of content is not welcome and will be removed.
- If you notice such content, please flag it for moderation.
- Owners of the site are not responsible for content uploaded by users.

View file

@ -1,9 +1,3 @@
code {
margin: 0 0.5em;
}
span.comma {
margin-left: -0.5em;
}
h1 {
margin-top: 2em;
}

View file

@ -47,10 +47,19 @@ class IndexController
/**
* @route /help
* @route /help/{tab}
*/
public function helpAction()
public function helpAction($tab = null)
{
if (empty($this->config->help->paths) or empty($this->config->help->title))
throw new SimpleException('Help is disabled');
$tab = $tab ?: array_keys($this->config->help->subTitles)[0];
if (!isset($this->config->help->paths[$tab]))
throw new SimpleException('Invalid tab');
$this->context->path = $this->config->help->paths[$tab];
$this->context->stylesheets []= 'index-help.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'help';
$this->context->tab = $tab;
}
}

View file

@ -5,6 +5,7 @@ class CustomMarkdown extends \Michelf\Markdown
{
$this->no_markup = true;
$this->span_gamut += ['doSpoilers' => 71];
$this->span_gamut += ['doSearchPermalinks' => 72];
$this->span_gamut += ['doStrike' => 6];
$this->span_gamut += ['doUsers' => 7];
$this->span_gamut += ['doPosts' => 8];
@ -84,4 +85,12 @@ class CustomMarkdown extends \Michelf\Markdown
return $this->hashPart('<a href="' . \Chibi\UrlHelper::route('user', 'view', ['name' => $x[1]]) . '">') . $x[0] . $this->hashPart('</a>');
}, $text);
}
protected function doSearchPermalinks($text)
{
return preg_replace_callback('{\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]}is', function($x)
{
return $this->hashPart('<a href="' . \Chibi\UrlHelper::route('post', 'list', ['query' => $x[1]]) . '">') . $x[1] . $this->hashPart('</a>');
}, $text);
}
}

View file

@ -1,70 +1,26 @@
<h1>Browsing</h1>
<?php
$tabs = $this->config->help->subTitles;
$firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
?>
<p>Clicking the <a href="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>">Browse</a> button at the top will take you to the list of recent posts. Use the search box in the top right corner to find posts you want to see.</p>
<?php if (count($tabs) > 1): ?>
<div class="tabs">
<nav>
<ul>
<?php foreach ($tabs as $tab => $text): ?>
<?php if ($tab == $this->context->tab): ?>
<li class="selected <?php echo $tab ?>">
<?php else: ?>
<li class="<?php echo $tab ?>">
<?php endif ?>
<a href="<?php echo \Chibi\UrlHelper::route('index', 'help', $tab == $firstTab ? [] : ['tab' => $tab]) ?>">
<?php echo $text ?>
</a>
</li>
<?php endforeach ?>
</ul>
</nav>
</div>
<?php endif ?>
<p>If you&rsquo;re not a registered user, you will only see public (Safe) posts. Logging in to your account will enable you to filter content by its rating: Safe, Sketchy, and NSFW.</p>
<p>You can use your keyboard to navigate around the site. There are a few shortcuts:</p>
<ul>
<li>focus search field: <code>[Q]</code></li>
<li>scroll up/down: <code>[W]</code><span class="comma">, </span><code>[S]</code></li>
<li>go to newer/older post or page: <code>[A]</code><span class="comma">, </span><code>[D]</code></li>
<li>edit post: <code>[E]</code></li>
<li>focus first post in post list: <code>[P]</code></li>
</ul>
<h1>Search syntax</h1>
<ul>
<li>contatining tag "Haruhi": <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'Haruhi']) ?>"><code>Haruhi</code></a></li>
<li><strong>not</strong> contatining tag "Kyon": <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => '-Kyon']) ?>"><code>-Kyon</code></a></li>
<li>uploaded by David: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'submit:David']) ?>"><code>submit:David</code></a> (note no spaces)</li>
<li>favorited by David: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'fav:David']) ?>"><code>fav:David</code></a></li>
<li>favorited by at least four users: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'favmin:4']) ?>"><code>favmin:4</code></a></li>
<li>commented by David: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'comment:David']) ?>"><code>comment:David</code></a></li>
<li>commented by at least three users: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'commentmin:3']) ?>"><code>commentmin:3</code></a></li>
<li>having minimum score of 4: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'scoremin:4']) ?>"><code>scoremin:4</code></a></li>
<li>tagged with at least seven tags: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'tagmin:7']) ?>"><code>tagmin:7</code></a></li>
<li>exactly from the specified date: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'date:2001']) ?>"><code>date:2001</code></a><span class="comma">, </span><a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'date:2012-09-29']) ?>"><code>date:2012-09-29</code></a> (yyyy-mm-dd format)</li>
<li>from the specified date onwards: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'datemin:2001-01-01']) ?>"><code>datemin:2001-01-01</code></a></li>
<li>up to the specified date: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'datemax:2004-07']) ?>"><code>datemax:2004-07</code></a></li>
<li>having specific ID: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'id:1,2,3,8']) ?>"><code>id:1,2,3,8</code></a></li>
<li>having ID no less than specified value: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'idmin:28']) ?>"><code>idmin:28</code></a></li>
<li>by content type: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'type:img']) ?>"><code>type:img</code></a><span class="comma">, </span><a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'type:swf']) ?>"><code>type:swf</code></a><span class="comma">, </span><a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'type:yt'] )?>"><code>type:yt</code></a> (images, flash files and Youtube videos, respectively)</li>
</ul>
<p>You can combine tags and negate any of them for interesting results. <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'sea -favmin:8 type:swf submit:Pirate']) ?>"><code>sea -favmin:8 type:swf submit:Pirate</code></a> will show you <strong>flash files</strong> tagged as <strong>sea</strong>, that were <strong>liked by seven people</strong> at most, uploaded by user <strong>Pirate</strong>.</p>
<p>All of the above can be sorted using additional sorting tags:</p>
<ul>
<li>as random as it can get: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'order:random']) ?>"><code>order:random</code></a></li>
<li>newest to oldest: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'order:date']) ?>"><code>order:date</code></a> (pretty much default browse view)</li>
<li>oldest to newest: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => '-order:date']) ?>"><code>-order:date</code></a></li>
<li>most commented first: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'order:comments']) ?>"><code>order:comments</code></a></li>
<li>loved by most: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'order:favs']) ?>"><code>order:favs</code></a></li>
<li>highest scored: <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'order:score']) ?>"><code>order:score</code></a></li>
</ul>
<p>As shown with <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => '-order:date']) ?>"><code>-order:date</code></a><span class="comma">, </span>any of them can be reversed in the same way as negating other tags: by placing a dash before the tag.</p>
<h1>Registration</h1>
<p>The e-mail you enter during account creation is only used to retrieve your <a href="http://gravatar.com">Gravatar</a> and activate your account. Only you can see it (well, except the database staff&hellip; we won&rsquo;t spam your mailbox anyway).</p>
<p>Oh, and you can delete your account at any time. Posts you uploaded will stay, unless some angry admin removes them.</p>
<h1>Comments</h1>
<p>Registered users can post comments. Comments support <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a>, extended by some handy tags:</p>
<ul>
<li>permalink to post number 426: <a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => 426]) ?>"><code>@426</code></a></li>
<li>link to tag "Dragon_Ball": <a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'Dragon_Ball']) ?>"><code>#Dragon_Ball</code></a></li>
<li>mark text as spoiler and hide it: <code class="spoiler">[spoiler]There is no spoon.[/spoiler]</code></li>
</ul>
<h1>Uploads</h1>
<p>After registering and activating your account, you gain the power to upload files to the service, for everyone else to see. Owners of the site are not responsible for content uploaded by users. You are not allowed to post any form of <a href="http://www.urbandictionary.com/define.php?term=cp">cp</a>. If you possess it, we ask you to leave immediately and never come back.</p>
<?php echo TextHelper::parseMarkdown(file_get_contents($this->context->path)) ?>

View file

@ -57,7 +57,8 @@
$nav []= ['Log out', \Chibi\UrlHelper::route('auth', 'logout')];
}
$nav []= ['Help', \Chibi\UrlHelper::route('index', 'help')];
if (!empty($this->config->help->title))
$nav []= [$this->config->help->title, \Chibi\UrlHelper::route('index', 'help')];
foreach ($nav as $navItem)
{