diff --git a/app/Http/Middleware/CheckSessionUserValid.php b/app/Http/Middleware/CheckSessionUserValid.php index 31635f9b..6ba543c5 100644 --- a/app/Http/Middleware/CheckSessionUserValid.php +++ b/app/Http/Middleware/CheckSessionUserValid.php @@ -23,6 +23,8 @@ class CheckSessionUserValid if ($user && $user->getToken() == session('token')) { // push user instance to repository app('users')->set($user->uid, $user); + // bind current user to container + app()->instance('user.current', $user); } else { // remove sessions & cookies delete_sessions(); diff --git a/app/helpers.php b/app/helpers.php index 801e070e..dcadb863 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -202,6 +202,16 @@ if (! function_exists('bs_custom_copyright')) { } } +if (! function_exists('bs_announcement')) { + + function bs_announcement() + { + $parser = new Parsedown(); + + return $parser->text(option('announcement')); + } +} + if (! function_exists('bs_nickname')) { function bs_nickname(\App\Models\User $user) diff --git a/composer.json b/composer.json index c7cbe1a7..2b974d68 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "gregwar/captcha": "^1.1", "devitek/yaml-translation": "^2.0", "filp/whoops": "^2.1", - "swiggles/memcache": "^2.0" + "swiggles/memcache": "^2.0", + "erusev/parsedown": "^1.6" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 2f5afad1..48dbd4ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "3f60d4698fec917a5fee5854b1ce5fed", - "content-hash": "1440843c226635c446993c00027c50ac", + "hash": "ff0e4c4559e77429c861ab50fedc8687", + "content-hash": "a2a5139be6747c19447f7f1feb023e1c", "packages": [ { "name": "classpreloader/classpreloader", @@ -199,6 +199,48 @@ ], "time": "2015-11-06 14:35:42" }, + { + "name": "erusev/parsedown", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/erusev/parsedown/20ff8bbb57205368b4b42d094642a3e52dac85fb.zip", + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2016-11-02 15:56:58" + }, { "name": "filp/whoops", "version": "2.1.4", diff --git a/resources/views/admin/options.tpl b/resources/views/admin/options.tpl index e587c6ac..698743ec 100644 --- a/resources/views/admin/options.tpl +++ b/resources/views/admin/options.tpl @@ -37,7 +37,7 @@ } ?> -
站点公告内容不会被转义,因此您可以使用 HTML 进行排版
+可使用 Markdown 进行排版