diff --git a/app/BBCode/Parser.php b/app/BBCode/Parser.php index 1dc7f00..375427b 100644 --- a/app/BBCode/Parser.php +++ b/app/BBCode/Parser.php @@ -48,6 +48,7 @@ class Parser Tags\Code::class, Tags\ListTag::class, Tags\User::class, + Tags\Markdown::class, // Newline must always be last Tags\Newline::class, diff --git a/app/BBCode/Tags/Markdown.php b/app/BBCode/Tags/Markdown.php new file mode 100644 index 0000000..70d984d --- /dev/null +++ b/app/BBCode/Tags/Markdown.php @@ -0,0 +1,49 @@ + + */ +class Markdown extends TagBase +{ + /** + * Contains the parser. + * @var Parsedown + */ + private static $parser = null; + + /** + * Parses the bbcode. + * @param string $text + * @return string + */ + public static function parse($text) + { + return preg_replace_callback( + '/\[md\](.*?)\[\/md\]/s', + function ($matches) { + if (self::$parser === null) { + self::$parser = new Parsedown; + } + + $parsed = self::$parser + ->setBreaksEnabled(false) + ->setMarkupEscaped(true) + ->text($matches[1]); + + return "
{$parsed}
"; + }, + $text + ); + } +} diff --git a/app/Controllers/Settings/Controller.php b/app/Controllers/Settings/Controller.php index 5bfd711..fa997c9 100644 --- a/app/Controllers/Settings/Controller.php +++ b/app/Controllers/Settings/Controller.php @@ -54,9 +54,6 @@ class Controller extends BaseController $nav["Friends"]["Requests"] = route('settings.friends.requests'); } - // Notifications - $nav["Notifications"]["History"] = route('settings.notifications.history'); - // Appearance if (CurrentSession::$user->permission(Site::CHANGE_AVATAR)) { $nav["Appearance"]["Avatar"] = route('settings.appearance.avatar'); diff --git a/composer.json b/composer.json index 444ef39..ffb6ea6 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "nesbot/carbon": "^1.21", "swiftmailer/swiftmailer": "^5.4", "corneltek/cliframework": "^3.0", - "illuminate/filesystem": "^5.2" + "illuminate/filesystem": "^5.2", + "erusev/parsedown": "^1.6" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index e79b71f..961ae34 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": "54f46a3b04683e9c4a3a7e8ecda23612", - "content-hash": "82a4dc685e1ed81d5b76869d9946899f", + "hash": "b52ed9a48bc73bde0940da07200c9f92", + "content-hash": "ee30eebf11e0d54fe7b19abbd4f134ea", "packages": [ { "name": "corneltek/class-template", @@ -725,6 +725,45 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "erusev/parsedown", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "shasum": "" + }, + "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": "2015-10-04 16:44:32" + }, { "name": "illuminate/container", "version": "v5.2.37", diff --git a/resources/assets/less/yuuno/master.less b/resources/assets/less/yuuno/master.less index eef5fe7..e0ed89e 100644 --- a/resources/assets/less/yuuno/master.less +++ b/resources/assets/less/yuuno/master.less @@ -1689,7 +1689,17 @@ a.default:active { text-align: center; } -.settings .friends-list > div:not(:last-child) { +.settings .friends-list button { + background: transparent; + border: 0; + cursor: pointer; + display: block; + box-sizing: border-box; + width: 100%; +} + +.settings .friends-list > div:not(:last-child), +.settings .friends-list > form { display: inline-block; border: 1px solid #9475B2; text-align: center; @@ -1701,28 +1711,42 @@ a.default:active { transition: background .2s, box-shadow .2s; } -.settings .friends-list > div:not(:last-child):hover { +.settings .friends-list > div:not(:last-child):hover, +.settings .friends-list > form:hover { margin-bottom: 6px; background: #C2AFFE; box-shadow: inset 0 0 2px #9475B2; } -.settings .friends-list > div > .friends-list-data { +.settings .friends-list > form:hover { + margin-bottom: 4px; +} + +.settings .friends-list > .active { + background: #C2AFFE; + box-shadow: inset 0 0 2px #9475B2; +} + +.settings .friends-list > div > .friends-list-data, +.settings .friends-list > form > .friends-list-data { display: block; } -.settings .friends-list > div > .friends-list-data > .friends-list-name { +.settings .friends-list > div > .friends-list-data > .friends-list-name, +.settings .friends-list > form > .friends-list-data > .friends-list-name { font-size: 1.2em; line-height: 1.5em; padding-bottom: 4px; } -.settings .friends-list > div > .friends-list-actions { +.settings .friends-list > div > .friends-list-actions, +.settings .friends-list > form > .friends-list-actions { display: none; background: linear-gradient(0deg, #9475B2, transparent) transparent; } -.settings .friends-list > div > .friends-list-actions > a { +.settings .friends-list > div > .friends-list-actions > a, +.settings .friends-list > form > .friends-list-actions > button { color: #222; font-size: 2em; line-height: 1em; @@ -1732,31 +1756,38 @@ a.default:active { float: left; } -.settings .friends-list > div:hover > .friends-list-actions { +.settings .friends-list > div:hover > .friends-list-actions, +.settings .friends-list > form:hover > .friends-list-actions { display: block; } -.settings .friends-list > div > .friends-list-actions > .remove:hover { +.settings .friends-list > div > .friends-list-actions > .remove:hover, +.settings .friends-list > form > .friends-list-actions > .remove:hover { color: #D00; } -.settings .friends-list > div > .friends-list-actions > .remove:active { +.settings .friends-list > div > .friends-list-actions > .remove:active, +.settings .friends-list > form > .friends-list-actions > .remove:active { color: #A00; } -.settings .friends-list > div > .friends-list-actions > .add:hover { +.settings .friends-list > div > .friends-list-actions > .add:hover, +.settings .friends-list > form > .friends-list-actions > .add:hover { color: #0D0; } -.settings .friends-list > div > .friends-list-actions > .add:active { +.settings .friends-list > div > .friends-list-actions > .add:active, +.settings .friends-list > form > .friends-list-actions > .add:active { color: #0A0; } -.settings .friends-list > div > .friends-list-actions > a { +.settings .friends-list > div > .friends-list-actions > a, +.settings .friends-list > form > .friends-list-actions > button { width: 50%; } -.settings .friends-list > div > .friends-list-actions > .fill { +.settings .friends-list > div > .friends-list-actions > .fill, +.settings .friends-list > form > .friends-list-actions > .fill { width: 100%; } @@ -1766,7 +1797,12 @@ a.default:active { margin-bottom: 6px; } - .settings .friends-list > div > .friends-list-actions { + .settings .friends-list > form { + margin-bottom: 4px; + } + + .settings .friends-list > div > .friends-list-actions, + .settings .friends-list > form > .friends-list-actions { display: block; } diff --git a/resources/views/yuuno/settings/account/ranks.twig b/resources/views/yuuno/settings/account/ranks.twig index 9dc369c..beddcad 100644 --- a/resources/views/yuuno/settings/account/ranks.twig +++ b/resources/views/yuuno/settings/account/ranks.twig @@ -7,23 +7,19 @@ {% endblock %} {% block settingsContent %} - - - {% for rank in user.ranks %} - - - - - {% endfor %} - -
- {{ rank.name }} - -
- - - - -
-
+
+ {% for rank in user.ranks %} +
+ + + +
+ +
+
+
+ {% endfor %} +
{% endblock %} diff --git a/routes.php b/routes.php index 10731dd..64e84ae 100644 --- a/routes.php +++ b/routes.php @@ -9,22 +9,18 @@ namespace Sakura; // Check if logged out Router::filter('logoutCheck', function () { if (CurrentSession::$user->isActive()) { - $message = "You must be logged out to do that!"; - - Template::vars(compact('message')); - - return Template::render('global/information'); + return view('global/information', [ + 'message' => "You must be logged out to do that!", + ]); } }); // Check if logged in Router::filter('loginCheck', function () { if (!CurrentSession::$user->isActive()) { - $message = "You must be logged in to do that!"; - - Template::vars(compact('message')); - - return Template::render('global/information'); + return view('global/information', [ + 'message' => "You must be logged in to do that!", + ]); } }); @@ -32,10 +28,8 @@ Router::filter('loginCheck', function () { Router::filter('maintenance', function () { if (config('general.maintenance')) { CurrentSession::stop(); - http_response_code(503); - - return Template::render('global/maintenance'); + return view('global/maintenance'); } });