From b555608f1165201290df0b9f53519e8da62f9d18 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 31 Jul 2016 03:32:37 +0200 Subject: [PATCH] the forum actually works somehow --- app/Controllers/AuthController.php | 4 +- app/Controllers/ChatController.php | 27 ++ app/Controllers/Controller.php | 8 +- app/Controllers/Forum/Controller.php | 20 ++ app/Controllers/Forum/TopicController.php | 309 ++++++++++++++++++ app/Controllers/ForumController.php | 265 --------------- app/Controllers/InfoController.php | 44 +++ app/Controllers/MetaController.php | 41 --- app/Forum/Forum.php | 12 +- app/Forum/Post.php | 10 +- app/Forum/Topic.php | 20 +- config/config.example.ini | 8 + database/2013_01_27_221444_base_tables.php | 5 +- resources/assets/less/yuuno/master.less | 17 +- resources/views/yuuno/auth/login.twig | 2 +- resources/views/yuuno/auth/reactivate.twig | 2 +- resources/views/yuuno/auth/register.twig | 4 +- resources/views/yuuno/auth/resetpassword.twig | 4 +- .../yuuno/forum/elements/forumEntry.twig | 2 +- .../views/yuuno/forum/elements/forumMod.twig | 33 +- .../views/yuuno/forum/elements/replyForm.twig | 8 +- resources/views/yuuno/forum/forum.twig | 2 - resources/views/yuuno/forum/index.twig | 2 - resources/views/yuuno/forum/topic.twig | 6 +- resources/views/yuuno/global/confirm.twig | 2 +- resources/views/yuuno/global/information.twig | 2 +- resources/views/yuuno/global/master.twig | 8 +- resources/views/yuuno/global/notfound.twig | 2 +- resources/views/yuuno/global/restricted.twig | 2 +- resources/views/yuuno/info/contact.twig | 26 ++ resources/views/yuuno/info/master.twig | 9 + resources/views/yuuno/info/privacy.twig | 8 + resources/views/yuuno/info/rules.twig | 7 + resources/views/yuuno/info/terms.twig | 8 + resources/views/yuuno/info/welcome.twig | 9 + resources/views/yuuno/meta/banned.twig | 2 +- resources/views/yuuno/meta/faq.twig | 2 +- resources/views/yuuno/meta/infopage.twig | 11 - resources/views/yuuno/meta/search.twig | 2 +- resources/views/yuuno/meta/settings.twig | 2 +- resources/views/yuuno/news/category.twig | 2 +- resources/views/yuuno/news/post.twig | 2 +- resources/views/yuuno/premium/complete.twig | 2 +- resources/views/yuuno/premium/index.twig | 2 +- resources/views/yuuno/settings/master.twig | 2 - resources/views/yuuno/user/members.twig | 2 +- resources/views/yuuno/user/profile.twig | 2 +- routes.php | 58 +++- utility.php | 14 + 49 files changed, 629 insertions(+), 414 deletions(-) create mode 100644 app/Controllers/ChatController.php create mode 100644 app/Controllers/Forum/Controller.php create mode 100644 app/Controllers/Forum/TopicController.php create mode 100644 app/Controllers/InfoController.php create mode 100644 resources/views/yuuno/info/contact.twig create mode 100644 resources/views/yuuno/info/master.twig create mode 100644 resources/views/yuuno/info/privacy.twig create mode 100644 resources/views/yuuno/info/rules.twig create mode 100644 resources/views/yuuno/info/terms.twig create mode 100644 resources/views/yuuno/info/welcome.twig delete mode 100644 resources/views/yuuno/meta/infopage.twig diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index 037f846..059ac5d 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -177,8 +177,8 @@ class AuthController extends Controller $redirect = $user->lastOnline ? (isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] - : Router::route('main.index')) - : Router::route('main.infopage', 'welcome'); + : route('main.index')) + : route('info.welcome'); $message = 'Welcome' . ($user->lastOnline ? ' back' : '') . '!'; diff --git a/app/Controllers/ChatController.php b/app/Controllers/ChatController.php new file mode 100644 index 0000000..1cd0045 --- /dev/null +++ b/app/Controllers/ChatController.php @@ -0,0 +1,27 @@ + + */ +class ChatController extends Controller +{ + public function redirect() + { + return; + } + + public function settings() + { + return; + } +} diff --git a/app/Controllers/Controller.php b/app/Controllers/Controller.php index 6766999..3d0c94a 100644 --- a/app/Controllers/Controller.php +++ b/app/Controllers/Controller.php @@ -34,13 +34,9 @@ class Controller } } - public function json($object) + public function json($object, $operators = JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK | JSON_BIGINT_AS_STRING) { header('Content-Type: application/json; charset=utf-8'); - - return json_encode( - $object, - JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK | JSON_BIGINT_AS_STRING - ); + return json_encode($object, $operators); } } diff --git a/app/Controllers/Forum/Controller.php b/app/Controllers/Forum/Controller.php new file mode 100644 index 0000000..396edc7 --- /dev/null +++ b/app/Controllers/Forum/Controller.php @@ -0,0 +1,20 @@ + + */ +class Controller extends BaseController +{ +} diff --git a/app/Controllers/Forum/TopicController.php b/app/Controllers/Forum/TopicController.php new file mode 100644 index 0000000..021eaeb --- /dev/null +++ b/app/Controllers/Forum/TopicController.php @@ -0,0 +1,309 @@ + + */ +class TopicController extends Controller +{ + public function view($id = 0) + { + // Attempt to get the topic + $topic = new Topic($id); + + // And attempt to get the forum + $forum = new Forum($topic->forum); + + // Check if the forum exists + if ($topic->id === 0 || !$forum->permission(ForumPerms::VIEW, ActiveUser::$user->id)) { + // Set render data + Template::vars([ + 'message' => "This topic doesn't exist or you don't have access to it!", + 'redirect' => route('forums.index'), + ]); + + // Print page contents + return Template::render('global/information'); + } + + // Update the tracking status + $topic->trackUpdate(ActiveUser::$user->id); + + // Update views + $topic->viewsUpdate(); + + // Set parse variables + Template::vars(compact('forum', 'topic')); + + // Print page contents + return Template::render('forum/topic'); + } + + private function modBase($id) + { + $topic = new Topic($id); + $forum = new Forum($topic->forum); + + if ($topic->id !== 0 || $forum->permission(ForumPerms::VIEW, ActiveUser::$user->id) || session_check()) { + return compact('topic', 'forum'); + } + + return false; + } + + public function sticky($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::STICKY, ActiveUser::$user->id)) { + $topic->type = $topic->type !== 1 ? 1 : 0; + $topic->update(); + $message = $topic->type + ? 'Changed the topic to sticky!' : 'Reverted the topic back to normal!'; + } else { + $message = "You aren't allowed to sticky topics!"; + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function announce($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::ANNOUNCEMENT, ActiveUser::$user->id)) { + $topic->type = $topic->type !== 2 ? 2 : 0; + $topic->update(); + $message = $topic->type + ? 'Changed the topic to an announcement!' : 'Reverted the topic back to normal!'; + } else { + $message = "You aren't allowed to announce topics!"; + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function lock($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::LOCK, ActiveUser::$user->id)) { + $topic->status = $topic->status !== 1 ? 1 : 0; + $topic->update(); + $message = ($topic->status ? 'Locked' : 'Unlocked') . ' the topic!'; + } else { + $message = "You aren't allowed to lock topics!"; + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function delete($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $trash = config('forum.trash'); + + // Check if we're operating from the trash + if ($topic->forum === $trash) { + if ($forum->permission(ForumPerms::DELETE_ANY, ActiveUser::$user->id)) { + $topic->delete(); + $message = "Deleted the topic!"; + $redirect = route('forums.forum', $trash); + } else { + $message = "You aren't allowed to delete topics!"; + } + } else { + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::MOVE, ActiveUser::$user->id)) { + $topic->move($trash); + $message = "Moved the topic to the trash!"; + } else { + $message = "You're not allowed to do this!"; + } + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function restore($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::MOVE, ActiveUser::$user->id)) { + if ($topic->oldForum) { + $topic->move($topic->oldForum, false); + + $message = "Moved the topic back to it's old location!"; + } else { + $message = "This topic has never been moved!"; + } + } else { + $message = "You aren't allowed to move threads!"; + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function move($id) + { + $modBase = $this->modBase($id); + $redirect = route('forums.index'); + $message = "This forum doesn't exist or you don't have access to it."; + + if ($modBase !== false) { + extract($modBase); + $redirect = route('forums.topic', $topic->id); + + if ($forum->permission(ForumPerms::MOVE, ActiveUser::$user->id)) { + $dest_forum = new Forum($_REQUEST['forum_id'] ?? 0); + + if ($dest_forum->id === 0 + || $dest_forum->permission(ForumPerms::VIEW, ActiveUser::$user->id)) { + $topic->move($dest_forum->id); + + $message = "Moved to the topic to {$dest_forum->name}!"; + } else { + $message = "The destination forum doesn't exist or you don't have access to it."; + } + } else { + $message = "You aren't allowed to move threads!"; + } + } + + return view('global/information', compact('message', 'redirect')); + } + + public function reply($id = 0) + { + $text = $_POST['text'] ?? null; + + // Attempt to get the forum + $topic = new Topic($id); + + // And attempt to get the forum + $forum = new Forum($topic->forum); + + // Check if the topic exists + if ($topic->id === 0 + || $forum->type !== 0 + || !$forum->permission(ForumPerms::VIEW, ActiveUser::$user->id)) { + $message = "This post doesn't exist or you don't have access to it!"; + $redirect = route('forums.index'); + + Template::vars(compact('message', 'redirect')); + + return Template::render('global/information'); + } + + // Check if the topic exists + if (!$forum->permission(ForumPerms::REPLY, ActiveUser::$user->id) + || ( + $topic->status === 1 + && !$forum->permission(ForumPerms::LOCK, ActiveUser::$user->id) + )) { + $message = "You are not allowed to post in this topic!"; + $redirect = route('forums.topic', $topic->id); + + Template::vars(compact('message', 'redirect')); + + return Template::render('global/information'); + } + + // Length + $length = strlen($text); + $minLen = config('forum.min_post_length'); + $maxLen = config('forum.max_post_length'); + $tooShort = $length < $minLen; + $tooLong = $length > $maxLen; + + // Check requirments + if ($tooShort + || $tooLong) { + $route = Router::route('forums.topic', $topic->id); + + $message = "Your post is " . ( + $tooShort + ? "too short, add some more text! Make it at least {$minLen}." + : "too long, you're gonna have to cut a little! Keep it under {$maxLen}." + ); + $redirect = "{$route}#reply"; + + Template::vars(compact('message', 'redirect')); + + if (!isset($_SESSION['replyText'])) { + $_SESSION['replyText'] = []; + } + + $_SESSION['replyText']["t{$topic->id}"] = $text; + + return Template::render('global/information'); + } + + unset($_SESSION['replyText']["t{$topic->id}"]); + + // Create the post + $post = Post::create( + "Re: {$topic->title}", + $text, + ActiveUser::$user, + $topic->id, + $forum->id + ); + + // Go to the post + $postLink = route('forums.post', $post->id); + + // Head to the post + return header("Location: {$postLink}"); + } +} diff --git a/app/Controllers/ForumController.php b/app/Controllers/ForumController.php index 88c11d6..23f9246 100644 --- a/app/Controllers/ForumController.php +++ b/app/Controllers/ForumController.php @@ -255,182 +255,6 @@ class ForumController extends Controller return Template::render('global/information'); } - /** - * View a topic. - * - * @return string - */ - public function topic($id = 0) - { - // Attempt to get the topic - $topic = new Topic($id); - - // And attempt to get the forum - $forum = new Forum($topic->forum); - - // Check if the forum exists - if ($topic->id == 0 || !$forum->permission(ForumPerms::VIEW, ActiveUser::$user->id)) { - // Set render data - Template::vars([ - 'page' => [ - 'message' => 'This topic doesn\'t exist or you don\'t have access to it!', - 'redirect' => Router::route('forums.index'), - ], - ]); - - // Print page contents - return Template::render('global/information'); - } - - // Update the tracking status - $topic->trackUpdate(ActiveUser::$user->id); - - // Update views - $topic->viewsUpdate(); - - // Set parse variables - Template::vars(compact('forum', 'topic')); - - // Print page contents - return Template::render('forum/topic'); - } - - /** - * Moderate a topic. - * - * @return string - */ - public function topicModerate($id = 0) - { - // Attempt to get the topic - $topic = new Topic($id); - - // And attempt to get the forum - $forum = new Forum($topic->forum); - - // Default stuff - $message = 'Unknown moderation action.'; - $redirect = Router::route('forums.topic', $topic->id); - - // Check if the forum exists - if ($topic->id == 0 - || !$forum->permission(ForumPerms::VIEW, ActiveUser::$user->id) - || !isset($_POST['session']) - || $_POST['session'] != session_id()) { - $message = 'This topic doesn\'t exist or you don\'t have access to it!'; - $redirect = Router::route('forums.index'); - } else { - // Take the action - $action = isset($_POST['action']) ? $_POST['action'] : null; - - // Switch - switch ($action) { - case 'sticky': - // Check permission - if (!$forum->permission(ForumPerms::STICKY, ActiveUser::$user->id)) { - $message = "You're not allowed to do this!"; - break; - } - - // Update the type - $topic->type = $topic->type !== 1 ? 1 : 0; - - $topic->update(); - - // Add page variable stuff - $message = $topic->type - ? 'Changed the topic to sticky!' - : 'Reverted the topic back to normal!'; - break; - - case 'announce': - // Check permission - if (!$forum->permission(ForumPerms::ANNOUNCEMENT, ActiveUser::$user->id)) { - $message = "You're not allowed to do this!"; - break; - } - - // Update the type - $topic->type = $topic->type !== 2 ? 2 : 0; - - $topic->update(); - - // Add page variable stuff - $message = $topic->type - ? 'Changed the topic to into an announcement!' - : 'Reverted the topic back to normal!'; - break; - - case 'lock': - // Check permission - if (!$forum->permission(ForumPerms::LOCK, ActiveUser::$user->id)) { - $message = "You're not allowed to do this!"; - break; - } - - // Update the status - $topic->status = $topic->status !== 1 ? 1 : 0; - - $topic->update(); - - // Add page variable stuff - $message = ($topic->status ? 'Locked' : 'Unlocked') . ' the topic!'; - break; - - case 'delete': - // Get the id of the trash forum - $trash = config('forum.trash'); - - // Check if we're operating from the trash - if ($topic->forum == $trash) { - // Check permission - if (!$forum->permission(ForumPerms::DELETE_ANY, ActiveUser::$user->id)) { - $message = "You're not allowed to do this!"; - break; - } - - // Delete the topic - $topic->delete(); - - // Set message - $message = "Deleted the topic!"; - $redirect = Router::route('forums.forum', $trash); - } else { - // Check permission - if (!$forum->permission(ForumPerms::MOVE, ActiveUser::$user->id)) { - $message = "You're not allowed to do this!"; - break; - } - - // Move the topic - $topic->move($trash); - - // Trashed! - $message = "Moved the topic to the trash!"; - } - break; - - case 'restore': - // Check if this topic has record of being in a previous forum - if ($topic->oldForum) { - // Move the topic back - $topic->move($topic->oldForum, false); - - $message = "Moved the topic back to it's old location!"; - } else { - $message = "This topic has never been moved!"; - } - break; - } - } - - // Set the variables - Template::vars(compact('message', 'redirect')); - - // Print page contents - return Template::render('global/information'); - } - /** * Redirect to the position of a post in a topic. * @@ -505,95 +329,6 @@ class ForumController extends Controller return $post->text; } - /** - * Reply to a topic. - * - * @return string - */ - public function topicReply($id = 0) - { - $text = isset($_POST['text']) ? $_POST['text'] : null; - - // Attempt to get the forum - $topic = new Topic($id); - - // And attempt to get the forum - $forum = new Forum($topic->forum); - - // Check if the topic exists - if ($topic->id == 0 - || $forum->type !== 0 - || !$forum->permission(ForumPerms::VIEW, ActiveUser::$user->id)) { - $message = "This post doesn't exist or you don't have access to it!"; - $redirect = Router::route('forums.index'); - - Template::vars(compact('message', 'redirect')); - - return Template::render('global/information'); - } - - // Check if the topic exists - if (!$forum->permission(ForumPerms::REPLY, ActiveUser::$user->id) - || ( - $topic->status === 1 - && !$forum->permission(ForumPerms::LOCK, ActiveUser::$user->id) - )) { - $message = "You are not allowed to post in this topic!"; - $redirect = Router::route('forums.topic', $topic->id); - - Template::vars(compact('message', 'redirect')); - - return Template::render('global/information'); - } - - // Length - $length = strlen($text); - $minLen = config('forum.min_post_length'); - $maxLen = config('forum.max_post_length'); - $tooShort = $length < $minLen; - $tooLong = $length > $maxLen; - - // Check requirments - if ($tooShort - || $tooLong) { - $route = Router::route('forums.topic', $topic->id); - - $message = "Your post is " . ( - $tooShort - ? "too short, add some more text!" - : "too long, you're gonna have to cut a little!" - ); - $redirect = "{$route}#reply"; - - Template::vars(compact('message', 'redirect')); - - if (!isset($_SESSION['replyText'])) { - $_SESSION['replyText'] = []; - } - - $_SESSION['replyText']["t{$topic->id}"] = $text; - - return Template::render('global/information'); - } - - unset($_SESSION['replyText']["t{$topic->id}"]); - - // Create the post - $post = Post::create( - "Re: {$topic->title}", - $text, - ActiveUser::$user, - $topic->id, - $forum->id - ); - - // Go to the post - $postLink = Router::route('forums.post', $post->id); - - // Head to the post - return header("Location: {$postLink}"); - } - /** * Create a topic. * diff --git a/app/Controllers/InfoController.php b/app/Controllers/InfoController.php new file mode 100644 index 0000000..9d98296 --- /dev/null +++ b/app/Controllers/InfoController.php @@ -0,0 +1,44 @@ + + */ +class InfoController extends Controller +{ + public function terms() + { + return view('info/terms'); + } + + public function privacy() + { + return view('info/privacy'); + } + + public function contact() + { + $contact = config('contact'); + + return view('info/contact', compact('contact')); + } + + public function rules() + { + return view('info/rules'); + } + + public function welcome() + { + return view('info/welcome'); + } +} diff --git a/app/Controllers/MetaController.php b/app/Controllers/MetaController.php index d95d94f..70b33d3 100644 --- a/app/Controllers/MetaController.php +++ b/app/Controllers/MetaController.php @@ -108,47 +108,6 @@ class MetaController extends Controller return Template::render('meta/faq'); } - /** - * Handles the info pages. - * Deprecate this!! - * - * @param string $id The page ID from the database. - * - * @return mixed HTML for the info page. - */ - public function infoPage($id = null) - { - // Set default variables - Template::vars([ - 'page' => [ - 'content' => '

Unable to load the requested info page.

Check the URL and try again.

', - ], - ]); - - // Set page id - $id = strtolower($id); - - // Get the page from the database - $ipData = DB::table('infopages') - ->where('page_shorthand', $id) - ->get(); - - // Get info page data from the database - if ($ipData) { - // Assign new proper variable - Template::vars([ - 'page' => [ - 'id' => $id, - 'title' => $ipData[0]->page_title, - 'content' => $ipData[0]->page_content, - ], - ]); - } - - // Return the compiled page - return Template::render('meta/infopage'); - } - /** * Search page * diff --git a/app/Forum/Forum.php b/app/Forum/Forum.php index 22f2b5f..6f439a1 100644 --- a/app/Forum/Forum.php +++ b/app/Forum/Forum.php @@ -113,7 +113,7 @@ class Forum * * @param int $forumId The ID of the forum that should be constructed. */ - public function __construct($forumId = 0) + public function __construct(int $forumId = 0) { // Get the row from the database $forumRow = DB::table('forums') @@ -126,15 +126,15 @@ class Forum // Populate the variables if ($forumRow) { $forumRow = $forumRow[0]; - $this->id = $forumRow->forum_id; - $this->order = $forumRow->forum_order; + $this->id = intval($forumRow->forum_id); + $this->order = intval($forumRow->forum_order); $this->name = $forumRow->forum_name; $this->description = $forumRow->forum_desc; $this->link = $forumRow->forum_link; - $this->category = $forumRow->forum_category; - $this->type = $forumRow->forum_type; + $this->category = intval($forumRow->forum_category); + $this->type = intval($forumRow->forum_type); $this->icon = $forumRow->forum_icon; - } elseif ($forumId != 0) { + } elseif ($forumId !== 0) { $this->id = -1; } } diff --git a/app/Forum/Post.php b/app/Forum/Post.php index 500c8d3..54a452a 100644 --- a/app/Forum/Post.php +++ b/app/Forum/Post.php @@ -120,14 +120,14 @@ class Post // Assign data if a row was returned if ($postRow) { $postRow = $postRow[0]; - $this->id = $postRow->post_id; - $this->topic = $postRow->topic_id; - $this->forum = $postRow->forum_id; + $this->id = intval($postRow->post_id); + $this->topic = intval($postRow->topic_id); + $this->forum = intval($postRow->forum_id); $this->poster = User::construct($postRow->poster_id); - $this->time = $postRow->post_time; + $this->time = intval($postRow->post_time); $this->subject = $postRow->post_subject; $this->text = $postRow->post_text; - $this->editTime = $postRow->post_edit_time; + $this->editTime = intval($postRow->post_edit_time); $this->editReason = $postRow->post_edit_reason; $this->editUser = User::construct($postRow->post_edit_user); diff --git a/app/Forum/Topic.php b/app/Forum/Topic.php index 24b4da9..c1c3859 100644 --- a/app/Forum/Topic.php +++ b/app/Forum/Topic.php @@ -135,17 +135,17 @@ class Topic // Assign data if a row was returned if ($topicRow) { $topicRow = $topicRow[0]; - $this->id = $topicRow->topic_id; - $this->forum = $topicRow->forum_id; - $this->hidden = (bool) $topicRow->topic_hidden; + $this->id = intval($topicRow->topic_id); + $this->forum = intval($topicRow->forum_id); + $this->hidden = boolval($topicRow->topic_hidden); $this->title = $topicRow->topic_title; - $this->time = $topicRow->topic_time; - $this->timeLimit = $topicRow->topic_time_limit; - $this->views = $topicRow->topic_views; - $this->status = $topicRow->topic_status; - $this->statusChange = $topicRow->topic_status_change; - $this->type = $topicRow->topic_type; - $this->oldForum = $topicRow->topic_old_forum; + $this->time = intval($topicRow->topic_time); + $this->timeLimit = intval($topicRow->topic_time_limit); + $this->views = intval($topicRow->topic_views); + $this->status = intval($topicRow->topic_status); + $this->statusChange = intval($topicRow->topic_status_change); + $this->type = intval($topicRow->topic_type); + $this->oldForum = intval($topicRow->topic_old_forum); } } diff --git a/config/config.example.ini b/config/config.example.ini index 830322e..46efcfa 100644 --- a/config/config.example.ini +++ b/config/config.example.ini @@ -190,3 +190,11 @@ trash = 4 [comments] min_length = 500 min_length = 1 + +; Content for the contact page, the variables function like a normal associative array +[contact] +mail['Administrator'] = sakura@localghost + +twit['smugwave'] = Sakura's main developer + +repo['Sakura'] = https://github.com/flashwave/sakura diff --git a/database/2013_01_27_221444_base_tables.php b/database/2013_01_27_221444_base_tables.php index 41751a8..4ed9336 100644 --- a/database/2013_01_27_221444_base_tables.php +++ b/database/2013_01_27_221444_base_tables.php @@ -268,7 +268,9 @@ class BaseTables extends Migration ->unsigned() ->default(0); - $table->string('post_edit_reason', 255); + $table->string('post_edit_reason', 255) + ->nullable() + ->default(null); $table->integer('post_edit_user') ->unsigned() @@ -559,6 +561,7 @@ class BaseTables extends Migration $schema->drop('comment_votes'); $schema->drop('comments'); $schema->drop('emoticons'); + $schema->drop('error_log'); $schema->drop('faq'); $schema->drop('forum_permissions'); $schema->drop('forums'); diff --git a/resources/assets/less/yuuno/master.less b/resources/assets/less/yuuno/master.less index 6791f3f..05d2f59 100644 --- a/resources/assets/less/yuuno/master.less +++ b/resources/assets/less/yuuno/master.less @@ -4,7 +4,7 @@ */ /* Import bbcode specific style */ -@import('bbcode'); +@import "bbcode"; /* * Animation Keyframes @@ -1915,7 +1915,8 @@ a.default:active { input[type="submit"].inputStyling, input[type="button"].inputStyling, input[type="reset"].inputStyling, -button.inputStyling { +button.inputStyling, +a.button { padding: 3px 10px; cursor: pointer; border: 0; @@ -1933,7 +1934,8 @@ button.inputStyling { input[type="submit"].inputStyling.small, input[type="button"].inputStyling.small, input[type="reset"].inputStyling.small, -button.inputStyling.small { +button.inputStyling.small, +a.button.small { padding: 0 4px 1px; margin: -2px 0 0; font-size: 16px; @@ -1944,7 +1946,8 @@ button.inputStyling.small { input[type="submit"].inputStyling:hover, input[type="button"].inputStyling:hover, input[type="reset"].inputStyling:hover, -button.inputStyling:hover { +button.inputStyling:hover, +a.button:hover { box-shadow: inset #222 0 0 3px; text-shadow: #F1F1F1 0 0 5px; } @@ -1952,7 +1955,8 @@ button.inputStyling:hover { input[type="submit"].inputStyling:active, input[type="button"].inputStyling:active, input[type="reset"].inputStyling:active, -button.inputStyling:active { +button.inputStyling:active, +a.button:active { box-shadow: inset #222 0 0 5px; text-shadow: #F1F1F1 0 0 3px; transition: text-shadow .2s, box-shadow .2s; @@ -1961,7 +1965,8 @@ button.inputStyling:active { input[type="submit"][disabled=disabled].inputStyling, input[type="button"][disabled=disabled].inputStyling, input[type="reset"][disabled=disabled].inputStyling, -button[disabled=disabled].inputStyling { +button[disabled=disabled].inputStyling, +a.button[disabled=disabled] { background: linear-gradient(180deg, #858585 0%, #858585 50%, #787878 50%) #858585 !important; box-shadow: inset #222 0 0 1px !important; text-shadow: #888 0 0 2px !important; diff --git a/resources/views/yuuno/auth/login.twig b/resources/views/yuuno/auth/login.twig index b4c7194..913e702 100644 --- a/resources/views/yuuno/auth/login.twig +++ b/resources/views/yuuno/auth/login.twig @@ -1,6 +1,6 @@ {% extends 'global/master.twig' %} -{% block title %}Login{% endblock %} +{% set title = 'Login' %} {% block content %}
diff --git a/resources/views/yuuno/auth/reactivate.twig b/resources/views/yuuno/auth/reactivate.twig index c5a7b2a..9054a4f 100644 --- a/resources/views/yuuno/auth/reactivate.twig +++ b/resources/views/yuuno/auth/reactivate.twig @@ -1,6 +1,6 @@ {% extends 'global/master.twig' %} -{% block title %}Reactivate account{% endblock %} +{% set title = 'Reactivate account' %} {% block content %}
diff --git a/resources/views/yuuno/auth/register.twig b/resources/views/yuuno/auth/register.twig index 2d6bb98..edba845 100644 --- a/resources/views/yuuno/auth/register.twig +++ b/resources/views/yuuno/auth/register.twig @@ -1,6 +1,6 @@ {% extends 'global/master.twig' %} -{% block title %}Register{% endblock %} +{% set title = 'Register' %} {% block content %} {% if config('user.disable_registration') %} @@ -40,7 +40,7 @@
diff --git a/resources/views/yuuno/auth/resetpassword.twig b/resources/views/yuuno/auth/resetpassword.twig index 399bbea..ffaae4e 100644 --- a/resources/views/yuuno/auth/resetpassword.twig +++ b/resources/views/yuuno/auth/resetpassword.twig @@ -1,6 +1,6 @@ {% extends 'global/master.twig' %} -{% block title %}Reset Password{% endblock %} +{% set title = 'Reset Password' %} {% block content %}
@@ -39,7 +39,7 @@
{% endif %} diff --git a/resources/views/yuuno/forum/elements/forumEntry.twig b/resources/views/yuuno/forum/elements/forumEntry.twig index 8662f7a..d238497 100644 --- a/resources/views/yuuno/forum/elements/forumEntry.twig +++ b/resources/views/yuuno/forum/elements/forumEntry.twig @@ -24,7 +24,7 @@
{% if forum.lastPost.id %} {{ forum.lastPost.subject|slice(0, 30) }}{% if forum.lastPost.subject|length > 30 %}...{% endif %}
- by {% if forum.lastPost.poster.id %}{{ forum.lastPost.poster.username }}{% else %}[deleted user]{% endif %} + by {% if forum.lastPost.poster.id %}{{ forum.lastPost.poster.username }}{% else %}[deleted user]{% endif %} {% else %} There are no posts in this forum.
  {% endif %} diff --git a/resources/views/yuuno/forum/elements/forumMod.twig b/resources/views/yuuno/forum/elements/forumMod.twig index c5fd598..45269ff 100644 --- a/resources/views/yuuno/forum/elements/forumMod.twig +++ b/resources/views/yuuno/forum/elements/forumMod.twig @@ -1,18 +1,15 @@ -
- - {% if forumSticky is defined %} - - {% endif %} - {% if forumAnnounce is defined %} - - {% endif %} - {% if forumLock is defined %} - - {% endif %} - {% if forumRestore is defined %} - - {% endif %} - {% if forumTrash is defined or forumPrune is defined %} - - {% endif %} -
+{% if forumSticky is defined %} + +{% endif %} +{% if forumAnnounce is defined %} + +{% endif %} +{% if forumLock is defined %} + +{% endif %} +{% if forumRestore is defined %} + +{% endif %} +{% if forumTrash is defined or forumPrune is defined %} + +{% endif %} diff --git a/resources/views/yuuno/forum/elements/replyForm.twig b/resources/views/yuuno/forum/elements/replyForm.twig index c4eb23e..b8d95af 100644 --- a/resources/views/yuuno/forum/elements/replyForm.twig +++ b/resources/views/yuuno/forum/elements/replyForm.twig @@ -37,10 +37,10 @@