diff --git a/data/config.ini b/data/config.ini index b8b0cd35..0430a206 100644 --- a/data/config.ini +++ b/data/config.ini @@ -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 diff --git a/data/help.md b/data/help.md new file mode 100644 index 00000000..6593e963 --- /dev/null +++ b/data/help.md @@ -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. diff --git a/data/privacy.md b/data/privacy.md new file mode 100644 index 00000000..21ebc3e2 --- /dev/null +++ b/data/privacy.md @@ -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. diff --git a/data/rules.md b/data/rules.md new file mode 100644 index 00000000..73f31194 --- /dev/null +++ b/data/rules.md @@ -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. diff --git a/public_html/media/css/index-help.css b/public_html/media/css/index-help.css index 54242fc3..e277c785 100644 --- a/public_html/media/css/index-help.css +++ b/public_html/media/css/index-help.css @@ -1,9 +1,3 @@ code { margin: 0 0.5em; } -span.comma { - margin-left: -0.5em; -} -h1 { - margin-top: 2em; -} diff --git a/src/Controllers/IndexController.php b/src/Controllers/IndexController.php index 399d5f38..bc96f343 100644 --- a/src/Controllers/IndexController.php +++ b/src/Controllers/IndexController.php @@ -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; } } diff --git a/src/CustomMarkdown.php b/src/CustomMarkdown.php index 6b8e3e5c..3eb87bf7 100644 --- a/src/CustomMarkdown.php +++ b/src/CustomMarkdown.php @@ -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('') . $x[0] . $this->hashPart(''); }, $text); } + + protected function doSearchPermalinks($text) + { + return preg_replace_callback('{\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]}is', function($x) + { + return $this->hashPart('') . $x[1] . $this->hashPart(''); + }, $text); + } } diff --git a/src/Views/index-help.phtml b/src/Views/index-help.phtml index e8da7adc..f4093364 100644 --- a/src/Views/index-help.phtml +++ b/src/Views/index-help.phtml @@ -1,70 +1,26 @@ -
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.
+ 1): ?> +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:
- -[Q]
[W]
, [S]
[A]
, [D]
[E]
[P]
Haruhi
-Kyon
submit:David
(note no spaces)fav:David
favmin:4
comment:David
commentmin:3
scoremin:4
tagmin:7
date:2001
, date:2012-09-29
(yyyy-mm-dd format)datemin:2001-01-01
datemax:2004-07
id:1,2,3,8
idmin:28
type:img
, type:swf
, type:yt
(images, flash files and Youtube videos, respectively)You can combine tags and negate any of them for interesting results. sea -favmin:8 type:swf submit:Pirate
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:
- -order:random
order:date
(pretty much default browse view)-order:date
order:comments
order:favs
order:score
As shown with -order:date
, any of them can be reversed in the same way as negating other tags: by placing a dash before the tag.
The e-mail you enter during account creation is only used to retrieve your Gravatar 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.
- -Registered users can post comments. Comments support Markdown syntax, extended by some handy tags:
- -@426
#Dragon_Ball
[spoiler]There is no spoon.[/spoiler]
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 cp. If you possess it, we ask you to leave immediately and never come back.
+context->path)) ?> diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index b4078de8..5c9d7d04 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -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) {