diff --git a/_sakura/components/Forum.php b/_sakura/components/Forum.php index e5a0742..138e411 100755 --- a/_sakura/components/Forum.php +++ b/_sakura/components/Forum.php @@ -264,12 +264,6 @@ class Forum 'elapsed' => Main::timeElapsed($post['post_time']), 'is_op' => ($post['poster_id'] == $firstPost['poster_id'] ? '1' : '0'), 'parsed_post' => self::parseMarkUp($post['post_text'], $post['post_parse'], $post['post_emotes']), - 'signature' => empty($_POSTER['userData']['signature']) ? - '' : - self::parseMarkUp( - $_POSTER['userData']['signature']['text'], - $_POSTER['userData']['signature']['mode'] - ), ]); // Just in case diff --git a/_sakura/components/Trick.php b/_sakura/components/Trick.php new file mode 100644 index 0000000..a48d080 --- /dev/null +++ b/_sakura/components/Trick.php @@ -0,0 +1,15 @@ +data['user_data']['signature']) ? + Main::bbParse( + Main::parseEmotes( + base64_decode( + $this->data['user_data']['signature'] + ) + ) + ) : + null; + + } + // Get username change history public function getUsernameHistory() { diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index 63368fb..19446d0 100755 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -15,8 +15,8 @@ class Users // Empty user template public static $emptyUser = [ 'user_id' => 0, - 'username' => 'Sakura User', - 'username_clean' => 'sakura user', + 'username' => 'User', + 'username_clean' => 'user', 'password_hash' => '', 'password_salt' => '', 'password_algo' => 'nologin', @@ -29,7 +29,7 @@ class Users 'user_colour' => '', 'register_ip' => '127.0.0.1', 'last_ip' => '127.0.0.1', - 'user_title' => 'Internal fallback account', + 'user_title' => '', 'user_registered' => 0, 'user_last_online' => 0, 'user_birthday' => '', @@ -40,11 +40,12 @@ class Users // Empty rank template public static $emptyRank = [ 'rank_id' => 0, - 'rank_name' => 'Sakura Rank', + 'rank_name' => 'Rank', + 'rank_hierarchy' => 0, 'rank_multiple' => null, 'rank_hidden' => 1, 'rank_colour' => '#444', - 'rank_description' => 'A hardcoded dummy rank for fallback.', + 'rank_description' => '', 'rank_title' => '', ]; diff --git a/_sakura/sakura.php b/_sakura/sakura.php index ae136c2..e2b3102 100755 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20151022'); +define('SAKURA_VERSION', '20151024'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_STABLE', false); @@ -47,6 +47,7 @@ require_once ROOT . '_sakura/components/Manage.php'; require_once ROOT . '_sakura/components/Bans.php'; require_once ROOT . '_sakura/components/Whois.php'; require_once ROOT . '_sakura/components/Payments.php'; +require_once ROOT . '_sakura/components/Trick.php'; // Include database extensions foreach (glob(ROOT . '_sakura/components/database/*.php') as $driver) { diff --git a/_sakura/templates/yuuno/forum/viewtopic.tpl b/_sakura/templates/yuuno/forum/viewtopic.tpl index bfc5226..c15d5a6 100755 --- a/_sakura/templates/yuuno/forum/viewtopic.tpl +++ b/_sakura/templates/yuuno/forum/viewtopic.tpl @@ -49,10 +49,10 @@
{{ post.parsed_post|raw }}
- {% if post.post_signature and post.signature %} + {% if post.user.signature and post.post_signature %}
- {{ post.signature|raw }} + {{ post.user.signature|raw }}
{% endif %} diff --git a/_sakura/templates/yuuno/settings/appearance.signature.tpl b/_sakura/templates/yuuno/settings/appearance.signature.tpl index e69de29..5484ac2 100755 --- a/_sakura/templates/yuuno/settings/appearance.signature.tpl +++ b/_sakura/templates/yuuno/settings/appearance.signature.tpl @@ -0,0 +1,15 @@ +
+ + + +
+
+ + +
+
+ diff --git a/public/content/data/yuuno/css/yuuno.css b/public/content/data/yuuno/css/yuuno.css index f05a083..52f2bc9 100755 --- a/public/content/data/yuuno/css/yuuno.css +++ b/public/content/data/yuuno/css/yuuno.css @@ -1973,11 +1973,11 @@ textarea.inputStyling { .forum.viewtopic .posts .post-content .signature { border-top: 1px solid #B19EED; - margin-top: 16px; - padding-top: 4px; + padding-top: 2px; + margin-top: 20px; display: block; - min-width: 300px; - max-height: 180px; + width: 100%; + max-height: 200px; overflow: auto; } diff --git a/public/posting.php b/public/posting.php index b711e47..4a281ea 100755 --- a/public/posting.php +++ b/public/posting.php @@ -36,7 +36,7 @@ if ($mode != 'f') { $topic = Forum::getTopic($topicId, true); // Prompt an error if the topic doesn't exist - if(!$topic) { + if (!$topic) { // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')), @@ -56,7 +56,7 @@ if ($mode != 'f') { // Add subject to render data $posting['text'] = '[quote]' . $post['post_text'] . '[/quote]'; - // Post editing + // Post editing } elseif ($mode == 'p' && isset($_GET['edit']) && $_GET['edit'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) { // Checks if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->data['user_id']) { @@ -78,9 +78,9 @@ if ($mode != 'f') { $posting = array_merge($posting, [ 'subject' => $post['post_subject'], 'text' => $post['post_text'], - 'id' => $post['post_id'] + 'id' => $post['post_id'], ]); - // Post deletion + // Post deletion } elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) { // Checks if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->data['user_id']) { @@ -123,9 +123,9 @@ if ($mode != 'f') { // Render information page print Templates::render('global/information.tpl', $renderData); exit; - // Return to previous page + // Return to previous page } else { - header('Location: '. $urls->format('FORUM_POST', [$_POST['post_id']])); + header('Location: ' . $urls->format('FORUM_POST', [$_POST['post_id']])); exit; } } @@ -134,8 +134,8 @@ if ($mode != 'f') { $renderData = array_merge($renderData, [ 'message' => 'Are you sure you want to delete your reply to ' . $topic['topic']['topic_title'] . '?', 'conditions' => [ - 'post_id' => $topic['posts'][$_GET['p']]['post_id'] - ] + 'post_id' => $topic['posts'][$_GET['p']]['post_id'], + ], ]); // Render confirmation form @@ -144,7 +144,7 @@ if ($mode != 'f') { } // Add subject to render data - if(!isset($posting['subject'])) { + if (!isset($posting['subject'])) { $posting['subject'] = 'Re: ' . $topic['topic']['topic_title']; } } @@ -152,7 +152,7 @@ if ($mode != 'f') { // Check if a post is being made if (isset($_POST['post'])) { // Set post mode - switch($_POST['parseMode']) { + switch ($_POST['parseMode']) { // BBcode case '1': $parse = '1'; @@ -167,7 +167,7 @@ if (isset($_POST['post'])) { } // Attempt to make the post - $makePost = Forum::createPost($currentUser->data['user_id'], $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse); + $makePost = Forum::createPost($currentUser->data['user_id'], $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse, 1, 1); // Add page specific things $renderData['page'] = [ @@ -178,12 +178,12 @@ if (isset($_POST['post'])) { // Print page contents or if the AJAX request is set only display the render data print isset($_REQUEST['ajax']) ? - ( - $renderData['page']['message'] . '|' . - $renderData['page']['success'] . '|' . - $renderData['page']['redirect'] - ) : - Templates::render('global/information.tpl', $renderData); + ( + $renderData['page']['message'] . '|' . + $renderData['page']['success'] . '|' . + $renderData['page']['redirect'] + ) : + Templates::render('global/information.tpl', $renderData); exit; } diff --git a/public/settings.php b/public/settings.php index c356d21..6f61453 100755 --- a/public/settings.php +++ b/public/settings.php @@ -948,6 +948,24 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification ]; break; + // Signature + case 'signature': + // Base64 encode the signature + $signature = base64_encode($_POST['signature']); + + // Update database + Users::updateUserDataField($currentUser->data['user_id'], ['signature' => $signature]); + + // Set render data + $renderData['page'] = [ + + 'redirect' => $redirect, + 'message' => 'Your signature has been updated!', + 'success' => 1, + + ]; + break; + // Fallback default: // Set render data @@ -1465,11 +1483,16 @@ if (Users::checkLogin()) { ]; break; - // Profile + // User page case 'appearance.userpage': $renderData['userPage'] = isset($currentUser->data['user_data']['userPage']) ? base64_decode($currentUser->data['user_data']['userPage']) : ''; break; + // Signature + case 'appearance.signature': + $renderData['signature'] = isset($currentUser->data['user_data']['signature']) ? base64_decode($currentUser->data['user_data']['signature']) : ''; + break; + // Username changing case 'account.username': $renderData['difference'] = $currentUser->getUsernameHistory() ? Main::timeElapsed($currentUser->getUsernameHistory()[0]['change_time']) : 0;