From cf33d8a059c01c9713752d9a49360c28f13973ea Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 11 Dec 2015 21:49:40 +0100 Subject: [PATCH] r20151211 Signed-off-by: Flashwave --- libraries/DBWrapper/mysql.php | 3 +- libraries/Forum/Forum.php | 1 + libraries/Forum/Forums.php | 333 ---------------------- libraries/Forum/Permissions.php | 26 ++ libraries/Forum/Post.php | 37 +++ libraries/Forum/Posting.php | 23 -- libraries/Forum/Thread.php | 29 ++ libraries/Permissions.php | 32 +-- libraries/User.php | 15 +- public/content/data/misaki/css/misaki.css | 16 ++ public/content/data/yuuno/css/yuuno.css | 19 ++ public/posting.php | 50 ++-- public/support.php | 2 +- public/viewtopic.php | 2 +- sakura.php | 6 +- templates/misaki/global/master.tpl | 12 +- templates/yuuno/global/master.tpl | 19 +- 17 files changed, 199 insertions(+), 426 deletions(-) delete mode 100644 libraries/Forum/Forums.php create mode 100644 libraries/Forum/Permissions.php delete mode 100644 libraries/Forum/Posting.php diff --git a/libraries/DBWrapper/mysql.php b/libraries/DBWrapper/mysql.php index 6563160..49fdf6b 100644 --- a/libraries/DBWrapper/mysql.php +++ b/libraries/DBWrapper/mysql.php @@ -76,7 +76,8 @@ class mysql PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, ]); - } catch (PDOException $e) { + } + catch (PDOException $e) { // Catch connection errors trigger_error('SQL Driver: ' . $e->getMessage(), E_USER_ERROR); } diff --git a/libraries/Forum/Forum.php b/libraries/Forum/Forum.php index d3e3805..3752ec2 100644 --- a/libraries/Forum/Forum.php +++ b/libraries/Forum/Forum.php @@ -25,6 +25,7 @@ class Forum private $_lastPost = null; private $_forums = []; private $_threads = []; + private $_permissions; // Constructor public function __construct($forumId = 0) diff --git a/libraries/Forum/Forums.php b/libraries/Forum/Forums.php deleted file mode 100644 index e794d45..0000000 --- a/libraries/Forum/Forums.php +++ /dev/null @@ -1,333 +0,0 @@ - 0, - 'forum_name' => 'Forum', - 'forum_desc' => '', - 'forum_link' => '', - 'forum_category' => 0, - 'forum_type' => 1, - 'forum_posts' => 0, - 'forum_topics' => 0, - ]; - - // Get a forum or category - public static function getForum($id) - { - - // Get the forumlist from the database - $forums = Database::fetch('forums'); - - // Sneak the template in the array - $forums['fb'] = self::$emptyForum; - - // Create an array to store the forum once we found it - $forum = []; - - // Try to find the requested forum - foreach ($forums as $list) { - // Once found set $forum to $list and break the loop - if ($list['forum_id'] == $id) { - $forum['forum'] = $list; - break; - } - } - - // If $forum is still empty after the foreach return false - if (empty($forum)) { - return false; - } - - // Create conditions for fetching the forums - $conditions['forum_category'] = [$id, '=']; - - // If the current category is 0 (the built in fallback) prevent getting categories - if ($id == 0) { - $conditions['forum_type'] = ['1', '!=']; - } - - // Check if this forum/category has any subforums - $forum['forums'] = Database::fetch('forums', true, $conditions); - - // Get the userdata related to last posts - foreach ($forum['forums'] as $key => $sub) { - // Get last post in forum - $lastPost = Database::fetch('posts', false, [ - 'forum_id' => [$sub['forum_id'], '='], - ], ['post_id', true]); - - $forum['forums'][$key]['last_poster'] = new User($lastPost['poster_id']); - $forum['forums'][$key]['last_post'] = array_merge( - empty($lastPost) ? [] : $lastPost, - ['elapsed' => Main::timeElapsed($lastPost['post_time'])] - ); - } - - // Lastly grab the topics for this forum - $forum['topics'] = self::getTopics($forum['forum']['forum_id']); - - // Return the forum/category - return $forum; - } - - // Getting all topics from a forum - public static function getTopics($id) - { - - // Get the topics from the database - $topics = Database::fetch('topics', true, [ - 'forum_id' => [$id, '='], - ]); - - // Get the userdata related to last posts - foreach ($topics as $key => $topic) { - // Get the reply count - $topics[$key]['reply_count'] = Database::count('posts', [ - 'topic_id' => [$topic['topic_id'], '='], - ])[0]; - - // Get first post in topics - $firstPost = Database::fetch('posts', false, [ - 'topic_id' => [$topic['topic_id'], '='], - ]); - - $topics[$key]['first_poster'] = new User($firstPost['poster_id']); - - $topics[$key]['first_post'] = array_merge( - empty($firstPost) ? [] : $firstPost, - ['elapsed' => Main::timeElapsed($firstPost['post_time'])] - ); - - // Get last post in topics - $lastPost = Database::fetch('posts', false, [ - 'topic_id' => [$topic['topic_id'], '='], - ], ['post_id', true]); - - $topics[$key]['last_poster'] = new User($lastPost['poster_id']); - - $topics[$key]['last_post'] = array_merge( - empty($lastPost) ? [] : $lastPost, - ['elapsed' => Main::timeElapsed($lastPost['post_time'])] - ); - } - - return $topics; - } - - // Get posts of a thread - public static function getTopic($id, $ignoreView = false) - { - - // Get the topic data from the database - $topicInfo = Database::fetch('topics', false, [ - 'topic_id' => [$id, '='], - ]); - - // Check if there actually is anything - if (empty($topicInfo)) { - return false; - } - - // Up the view count - if (!$ignoreView) { - // Get the new count - $topicInfo['topic_views'] = $topicInfo['topic_views'] + 1; - - // Update the count - Database::update('topics', [ - [ - 'topic_views' => $topicInfo['topic_views'], - ], - [ - 'topic_id' => [$id, '='], - ], - ]); - } - - // Get the posts from the database - $rawPosts = Database::fetch('posts', true, [ - 'topic_id' => [$id, '='], - ]); - - // Create storage array - $topic = []; - - // Add forum data - $topic['forum'] = self::getForum($topicInfo['forum_id']); - - // Store the topic info - $topic['topic'] = $topicInfo; - - // Get first post in topics - $firstPost = Database::fetch('posts', false, [ - 'topic_id' => [$topic['topic']['topic_id'], '='], - ]); - - $topic['topic']['first_poster'] = new User($firstPost['poster_id']); - - $topic['topic']['first_post'] = array_merge( - empty($firstPost) ? [] : $firstPost, - ['elapsed' => Main::timeElapsed($firstPost['post_time'])] - ); - - // Get last post in topics - $lastPost = Database::fetch('posts', false, [ - 'topic_id' => [$topic['topic']['topic_id'], '='], - ], ['post_id', true]); - - $topic['topic']['last_poster'] = new User($lastPost['poster_id']); - - $topic['topic']['last_post'] = array_merge( - empty($lastPost) ? [] : $lastPost, - ['elapsed' => Main::timeElapsed($lastPost['post_time'])] - ); - - // Create space for posts - $topic['posts'] = []; - - // Parse the data of every post - foreach ($rawPosts as $post) { - // Add post and metadata to the global storage array - $topic['posts'][$post['post_id']] = array_merge($post, [ - 'user' => (new User($post['poster_id'])), - 'elapsed' => Main::timeElapsed($post['post_time']), - 'is_op' => ($post['poster_id'] == $firstPost['poster_id'] ? '1' : '0'), - 'parsed_post' => BBcode::toHTML($post['post_text']), - ]); - - // Just in case - unset($_POSTER); - } - - // Return the compiled topic data - return $topic; - } - - // Get a forum ID from a topic ID - public static function getForumIdFromTopicId($id) - { - - // Get the topic - $topic = Database::fetch('topics', false, [ - 'topic_id' => [$id, '='], - ]); - - // Return false if nothing was returned - if (empty($topic)) { - return false; - } - - // Return the forum id - return $topic['forum_id']; - } - - // Get a topic ID from a post ID - public static function getTopicIdFromPostId($id) - { - - // Get the post - $post = Database::fetch('posts', false, [ - 'post_id' => [$id, '='], - ]); - - // Return false if nothing was returned - if (empty($post)) { - return false; - } - - // Return the topic id - return $post['topic_id']; - } - - // Get forum statistics of a user - public static function getUserStats($uid) - { - - // Collect the stats - return [ - 'posts' => Database::count( - 'posts', - ['poster_id' => [$uid, '=']] - )[0], - 'topics' => count(Database::fetch( - 'posts', - true, - ['poster_id' => [$uid, '=']], - ['post_time'], - null, - ['topic_id'] - )), - ]; - } - - // Creating a new post - public static function createPost($poster, $title, $text, $forum, $topic = 0, $parse = 0, $signature = 0, $emotes = 0, $type = 0, $status = 0) - { - - // Check if we're replying to a thread - $getThread = Database::fetch('topics', false, ['topic_id' => [$topic, '=']]); - - // If nothing was returned create a new thread - if (!$getThread) { - // Insert the required data - Database::insert('topics', [ - 'forum_id' => $forum, - 'topic_title' => $title, - 'topic_time' => time(), - 'topic_status' => $status, - 'topic_type' => $type, - ]); - - // Fetch the last insert - $getThread = Database::fetch('topics', false, [ - 'topic_id' => [Database::lastInsertID(), '='], - ]); - } - - // Insert the post - Database::insert('posts', [ - 'topic_id' => $getThread['topic_id'], - 'forum_id' => $getThread['forum_id'], - 'poster_id' => $poster, - 'post_time' => time(), - 'post_signature' => $signature, - 'post_subject' => $title, - 'post_text' => $text, - ]); - - // Fetch the last insert - $getPost = Database::fetch('posts', false, [ - 'post_id' => [Database::lastInsertID(), '='], - ]); - - // Update the topic with the last details - Database::update('topics', [ - [ - 'topic_last_reply' => time(), - ], - [ - 'topic_id' => [$getPost['topic_id'], '='], - ], - ]); - - // Return success - return [1, 'SUCCESS', $getPost['forum_id'], $getPost['topic_id'], $getPost['post_id']]; - } -} diff --git a/libraries/Forum/Permissions.php b/libraries/Forum/Permissions.php new file mode 100644 index 0000000..983136d --- /dev/null +++ b/libraries/Forum/Permissions.php @@ -0,0 +1,26 @@ +parsed = BBcode::toHTML(htmlentities($this->text)); } + // Create a new post + public static function create($subject, $text, User $poster, $thread = 0, $forum = 0) + { + // If no thread is specified create a new one + if ($thread) { + $thread = new Thread($thread); + } else { + $thread = Thread::create($forum, $subject); + } + + // Stop if the thread ID is 0 + if ($thread->id == 0) { + return null; + } + + // Insert the post + Database::insert('posts', [ + 'topic_id' => $thread->id, + 'forum_id' => $thread->forum, + 'poster_id' => $poster->id(), + 'poster_ip' => Main::getRemoteIP(), + 'post_time' => time(), + 'post_signature' => '1', + 'post_subject' => $subject, + 'post_text' => $text, + ]); + + // Get post id + $id = Database::lastInsertID(); + + // Update the last post date + $thread->lastUpdate(); + + // Return the object + return new Post($id); + } + // Time elapsed since creation public function timeElapsed() { diff --git a/libraries/Forum/Posting.php b/libraries/Forum/Posting.php deleted file mode 100644 index bcde921..0000000 --- a/libraries/Forum/Posting.php +++ /dev/null @@ -1,23 +0,0 @@ - $forum, + 'topic_title' => $title, + 'topic_time' => time(), + 'topic_status' => $status, + 'topic_type' => $type, + ]); + + // Return the thread object + return new Thread(Database::lastInsertID()); + } + // Posts public function posts() { @@ -190,4 +206,17 @@ class Thread ], ]); } + + // Update last post timestamp + public function lastUpdate() + { + Database::update('topics', [ + [ + 'topic_last_reply' => time(), + ], + [ + 'topic_id' => [$this->id, '='], + ], + ]); + } } diff --git a/libraries/Permissions.php b/libraries/Permissions.php index db45871..345446c 100644 --- a/libraries/Permissions.php +++ b/libraries/Permissions.php @@ -13,22 +13,17 @@ class Permissions { // Fallback permission data private static $fallback = [ - 'rank_id' => 0, 'user_id' => 0, 'permissions_site' => 1, 'permissions_manage' => 0, - 'permissions_forums' => 0, - 'permissions_inherit' => 111, - + 'permissions_inherit' => 11, ]; // Global permissions table protected static $permissions = [ - // Site permissions 'SITE' => [ - 'DEACTIVATED' => 1, // Is a user deactivated 'RESTRICTED' => 2, // Is a user restricted 'ALTER_PROFILE' => 4, // Can alter their profile data @@ -61,29 +56,17 @@ class Permissions 'DELETE_COMMENTS' => 536870912, // User can delete own comments 'VOTE_COMMENTS' => 1073741824, // User can vote on comments 'CHANGE_SIGNATURE' => 2147483648, // User can vote on comments - - ], - - // Forum permissions - 'FORUM' => [ - - 'USE_FORUM' => 1, - ], // Site management permissions 'MANAGE' => [ - 'USE_MANAGE' => 1, - ], - ]; // Checking if a user has the permissions to do a thing public static function check($layer, $action, $operator, $mode = 0) { - // Check if the permission layer and the permission itself exists if (!array_key_exists($layer, self::$permissions) || !array_key_exists($action, self::$permissions[$layer])) { return false; @@ -108,7 +91,6 @@ class Permissions // Get permission data of a rank from the database public static function getRankPermissions($ranks) { - // Container array $getRanks = []; $perms = []; @@ -129,20 +111,14 @@ class Permissions if (empty($perms)) { // Store the data of the current rank in $perms $perms = [ - 'SITE' => $rank['permissions_site'], 'MANAGE' => $rank['permissions_manage'], - 'FORUM' => $rank['permissions_forums'], - ]; } else { // Perform a bitwise OR on the ranks $perms = [ - 'SITE' => $perms['SITE'] | $rank['permissions_site'], 'MANAGE' => $perms['MANAGE'] | $rank['permissions_manage'], - 'FORUM' => $perms['FORUM'] | $rank['permissions_forums'], - ]; } } @@ -154,7 +130,6 @@ class Permissions // Get permission data for a user public static function getUserPermissions($uid) { - // Get user data $user = new User($uid); @@ -182,11 +157,6 @@ class Permissions $rankPerms['MANAGE'] = $userPerms['permissions_manage']; } - // Override forum permissions - if (!$inheritance[2]) { - $rankPerms['FORUM'] = $userPerms['permissions_forums']; - } - // Return permissions return $rankPerms; } diff --git a/libraries/User.php b/libraries/User.php index 8ddc2b5..b39f0e0 100644 --- a/libraries/User.php +++ b/libraries/User.php @@ -191,7 +191,20 @@ class User // Get user's forum statistics public function forumStats() { - return Forum\Forums::getUserStats($this->data['user_id']); + return [ + 'posts' => Database::count( + 'posts', + ['poster_id' => [$this->id(), '=']] + )[0], + 'topics' => count(Database::fetch( + 'posts', + true, + ['poster_id' => [$this->id(), '=']], + ['post_time'], + null, + ['topic_id'] + )), + ]; } // Get amount of time since user events using the same format as dates() diff --git a/public/content/data/misaki/css/misaki.css b/public/content/data/misaki/css/misaki.css index 1bbd645..4a772b9 100644 --- a/public/content/data/misaki/css/misaki.css +++ b/public/content/data/misaki/css/misaki.css @@ -156,6 +156,22 @@ a:active { top: 0; } +/* + * Logo + */ +#banner { + height: 120px; + width: 1024px; + margin: 0 auto 5px; + box-shadow: 0 2px 6px rgba(0, 0, 0, .75); +} + +#banner > a { + display: block; + width: 100%; + height: 100%; +} + /* * Site footer */ diff --git a/public/content/data/yuuno/css/yuuno.css b/public/content/data/yuuno/css/yuuno.css index 4e1d863..5989d6d 100644 --- a/public/content/data/yuuno/css/yuuno.css +++ b/public/content/data/yuuno/css/yuuno.css @@ -640,6 +640,25 @@ a.default:active { text-align: center; } +.headerAnnouncement { + display: block; + margin: 10px auto; + text-align: center; + padding: 2px; + border: 1px solid #9475B2; + box-shadow: 0 0 3px #9475B2; + border-radius: 3px; + max-width: 1024px; + height: 120px; + background: #D3BFFF no-repeat scroll center center; +} + +.headerAnnouncement > a { + display: block; + width: 100%; + height: 100%; +} + /* * Site footer styling */ diff --git a/public/posting.php b/public/posting.php index b685487..bcebd03 100644 --- a/public/posting.php +++ b/public/posting.php @@ -20,13 +20,13 @@ $topicId = isset($_GET['t']) ? $_GET['t'] : ( isset($_GET['p']) ? - Forum\Forums::getTopicIdFromPostId($_GET['p']) : + (new Forum\Post($_GET['p']))->thread : 0 ); $forumId = isset($_GET['f']) ? $_GET['f'] : -Forum\Forums::getForumIdFromTopicId($topicId); +($thread = new Forum\Thread($topicId))->forum; $mode = isset($_GET['f']) ? 'f' : (isset($_GET['t']) ? 't' : (isset($_GET['p']) ? 'p' : null)); @@ -38,10 +38,10 @@ $posting = [ // Check if we're in reply mode if ($mode != 'f') { // Attempt to get the topic - $thread = Forum\Forums::getTopic($topicId, true); + $thread = $thread ? $thread : new Forum\Thread($topicId); // Prompt an error if the topic doesn't exist - if (!$thread) { + if (!$thread->id) { // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')), @@ -57,17 +57,17 @@ if ($mode != 'f') { } // Check if we're in quote mode - if ($mode == 'p' && isset($_GET['quote']) && $_GET['quote'] == $_GET['p'] && array_key_exists($_GET['p'], $thread['posts'])) { + if ($mode == 'p' && isset($_GET['quote']) && $_GET['quote'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) { // Reassign post for ease - $post = $thread['posts'][$_GET['p']]; + $post = $thread->posts()[$_GET['p']]; // Add subject to render data - $posting['text'] = '[quote=' . (new User($post['poster_id']))->username() . ']' . BBcode::toEditor($post['post_text']) . '[/quote]'; + $posting['text'] = '[quote=' . $post->poster->username() . ']' . BBcode::toEditor($post->text) . '[/quote]'; // Post editing - } elseif ($mode == 'p' && isset($_GET['edit']) && $_GET['edit'] == $_GET['p'] && array_key_exists($_GET['p'], $thread['posts'])) { + } elseif ($mode == 'p' && isset($_GET['edit']) && $_GET['edit'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) { // Checks - if ($thread['posts'][$_GET['p']]['poster_id'] != $currentUser->id()) { + if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id()) { // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')), @@ -83,18 +83,18 @@ if ($mode != 'f') { } // Reassign post for ease - $post = $thread['posts'][$_GET['p']]; + $post = $thread->posts()[$_GET['p']]; // Set variables $posting = array_merge($posting, [ - 'subject' => $post['post_subject'], - 'text' => BBcode::toEditor($post['post_text']), - 'id' => $post['post_id'], + 'subject' => $post->subject, + 'text' => BBcode::toEditor($post->text), + 'id' => $post->id, ]); // Post deletion - } elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $thread['posts'])) { + } elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) { // Checks - if ($thread['posts'][$_GET['p']]['poster_id'] != $currentUser->id()) { + if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id()) { // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')), @@ -119,18 +119,18 @@ if ($mode != 'f') { ]); // Reload the topic - $thread = Forum\Forums::getTopic($topicId, true); + $thread = new Forum\Thread($topicId); // If there's no more posts left in the topic delete it as well - if (!count($thread['posts'])) { + if (!$thread->replyCount()) { Database::delete('topics', [ - 'topic_id' => [$thread['topic']['topic_id'], '='], + 'topic_id' => [$thread->id, '='], ]); } // Add page specific things $renderData['page'] = [ - 'redirect' => (count($thread['posts']) ? $urls->format('FORUM_THREAD', [$thread['topic']['topic_id']]) : $urls->format('FORUM_INDEX')), + 'redirect' => ($thread->replyCount() ? $urls->format('FORUM_THREAD', [$thread->id]) : $urls->format('FORUM_INDEX')), 'message' => 'Your post has been deleted!', ]; @@ -149,9 +149,9 @@ if ($mode != 'f') { // Form mode $renderData = array_merge($renderData, [ - 'message' => 'Are you sure you want to delete your reply to ' . $thread['topic']['topic_title'] . '?', + 'message' => 'Are you sure you want to delete your reply to ' . $thread->title . '?', 'conditions' => [ - 'post_id' => $thread['posts'][$_GET['p']]['post_id'], + 'post_id' => $thread->posts()[$_GET['p']]->id, ], ]); @@ -165,20 +165,20 @@ if ($mode != 'f') { // Add subject to render data if (!isset($posting['subject'])) { - $posting['subject'] = 'Re: ' . $thread['topic']['topic_title']; + $posting['subject'] = 'Re: ' . $thread->title; } } // Check if a post is being made if (isset($_POST['post'])) { // Attempt to make the post - $makePost = Forum\Forums::createPost($currentUser->id(), $_POST['subject'], $_POST['text'], $forumId, $topicId, 1, 1, 1); + $post = Forum\Post::create($_POST['subject'], $_POST['text'], $currentUser, $topicId, $forumId); // Add page specific things $renderData['page'] = [ - 'redirect' => $urls->format('FORUM_THREAD', [$makePost[3]]), + 'redirect' => $urls->format('FORUM_POST', [$post->id]) . '#p' . $post->id, 'message' => 'Made the post!', - 'success' => $makePost[0], + 'success' => 1, ]; // Print page contents or if the AJAX request is set only display the render data diff --git a/public/support.php b/public/support.php index 8e3e23c..ce89137 100644 --- a/public/support.php +++ b/public/support.php @@ -18,7 +18,7 @@ $template->setTemplate($templateName); // Switch between modes (we only allow this to be used by logged in user) if (isset($_REQUEST['mode']) && Users::checkLogin() - && Permissions::check('SITE', 'OBTAIN_PREMIUM', $currentUser->id(), 1)) { + && $currentUser->checkPermission('SITE', 'OBTAIN_PREMIUM')) { // Initialise Payments class if (!Payments::init()) { header('Location: ' . $urls->format('SITE_PREMIUM') . '?fail=true'); diff --git a/public/viewtopic.php b/public/viewtopic.php index e1a1e2e..602e6ab 100644 --- a/public/viewtopic.php +++ b/public/viewtopic.php @@ -12,7 +12,7 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) . 'sakura.php // Attempt to get the thread $thread = new Forum\Thread( isset($_GET['p']) - ? Forum\Forums::getTopicIdFromPostId($_GET['p']) + ? (new Forum\Post($_GET['p']))->thread : (isset($_GET['t']) ? $_GET['t'] : 0) ); diff --git a/sakura.php b/sakura.php index 7758a46..d0ceb05 100644 --- a/sakura.php +++ b/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20151210'); +define('SAKURA_VERSION', '20151211'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); @@ -54,7 +54,7 @@ require_once ROOT . 'libraries/User.php'; require_once ROOT . 'libraries/Users.php'; require_once ROOT . 'libraries/Whois.php'; require_once ROOT . 'libraries/Forum/Forum.php'; -require_once ROOT . 'libraries/Forum/Forums.php'; +require_once ROOT . 'libraries/Forum/Permissions.php'; require_once ROOT . 'libraries/Forum/Post.php'; require_once ROOT . 'libraries/Forum/Thread.php'; @@ -154,6 +154,8 @@ if (!defined('SAKURA_NO_TPL')) { 'currentPage' => '//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'referrer' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null), 'onlineTimeout' => Config::get('max_online_time'), + 'announcementImage' => Config::get('header_announcement_image'), + 'announcementLink' => Config::get('header_announcement_link'), 'recaptchaPublic' => Config::get('recaptcha_public'), 'recaptchaEnabled' => Config::get('recaptcha'), diff --git a/templates/misaki/global/master.tpl b/templates/misaki/global/master.tpl index ad9acb7..ede2bbc 100644 --- a/templates/misaki/global/master.tpl +++ b/templates/misaki/global/master.tpl @@ -82,7 +82,7 @@ {% endif %} - {##} + + {% if sakura.siteLogo or sakura.announcementImage %} + + {% endif %} +
{% block content %}
@@ -128,7 +134,7 @@
-
Powered by Sakura, Flashwave 2013-2015
+
Powered by Sakura, Flashwave 2013-2015
diff --git a/templates/yuuno/global/master.tpl b/templates/yuuno/global/master.tpl index ab76bfc..b0abac5 100644 --- a/templates/yuuno/global/master.tpl +++ b/templates/yuuno/global/master.tpl @@ -222,6 +222,14 @@
+ {% if sakura.announcementImage %} +
+ {% if sakura.announcementLink %} + + {% endif %} +
+ {% endif %} + {% block content %}

{{ php.self }} is now printing!

{% endblock %} @@ -268,11 +276,12 @@ // Column colours for actions var changelogColours = [ 'inherit', // Unknown - '#2A2', // Added - '#2AA', // Updated - '#2AA', // Fixed - '#A22', // Removed - '#62C' // Exported + '#2A2', // Add + '#2AA', // Update + '#2AA', // Fix + '#A22', // Remove + '#62C', // Export + '#C44' // Revert ]; window.addEventListener("load", function() {