diff --git a/libraries/BBcodeDefinitions/Align.php b/libraries/BBcodeDefinitions/Align.php index 7956797..4250992 100644 --- a/libraries/BBcodeDefinitions/Align.php +++ b/libraries/BBcodeDefinitions/Align.php @@ -40,7 +40,7 @@ class Align extends CodeDefinition $alignments = [ 'left', 'center', - 'right' + 'right', ]; $content = ""; @@ -55,6 +55,6 @@ class Align extends CodeDefinition return $el->getAsBBCode(); } - return '
' . $content . '
'; + return "
{$content}
"; } } diff --git a/libraries/BBcodeDefinitions/Code.php b/libraries/BBcodeDefinitions/Code.php index f0e8395..73e1718 100644 --- a/libraries/BBcodeDefinitions/Code.php +++ b/libraries/BBcodeDefinitions/Code.php @@ -36,6 +36,10 @@ class Code extends CodeDefinition */ public function asHtml(ElementNode $el) { - return preg_replace("#\n*\[code\]\n*(.*?)\n*\[/code\]\n*#s", '
\\1
', $el->getAsBBCode()); + return preg_replace( + "#\n*\[code\]\n*(.*?)\n*\[/code\]\n*#s", + '
\\1
', + $el->getAsBBCode() + ); } } diff --git a/libraries/BBcodeDefinitions/Lists.php b/libraries/BBcodeDefinitions/Lists.php index 3c85542..06e5dba 100644 --- a/libraries/BBcodeDefinitions/Lists.php +++ b/libraries/BBcodeDefinitions/Lists.php @@ -45,15 +45,21 @@ class Lists extends CodeDefinition public function asHtml(ElementNode $el) { $bodyHtml = ''; + foreach ($el->getChildren() as $child) { $bodyHtml .= $child->getAsHTML(); } $listPieces = explode('[*]', $bodyHtml); + unset($listPieces[0]); + $listPieces = array_map(function ($li) { - return '
  • '.$li.'
  • '; + return "
  • {$li}
  • "; }, $listPieces); - return ''; + + $list = implode('', $listPieces); + + return ""; } } diff --git a/libraries/BBcodeDefinitions/Size.php b/libraries/BBcodeDefinitions/Size.php index aa17fb1..dc7c950 100644 --- a/libraries/BBcodeDefinitions/Size.php +++ b/libraries/BBcodeDefinitions/Size.php @@ -52,6 +52,8 @@ class Size extends CodeDefinition return $el->getAsBBCode(); } - return '' . $content . ''; + $size = $size / 100; + + return "{$content}"; } } diff --git a/libraries/BBcodeDefinitions/YouTube.php b/libraries/BBcodeDefinitions/YouTube.php index 564f59c..c3f429c 100644 --- a/libraries/BBcodeDefinitions/YouTube.php +++ b/libraries/BBcodeDefinitions/YouTube.php @@ -47,7 +47,8 @@ class YouTube extends CodeDefinition if (!$foundMatch) { return $el->getAsBBCode(); } else { - return ""; + return ""; } } } diff --git a/libraries/Controllers/ForumController.php b/libraries/Controllers/ForumController.php index 9d3d4d2..68b7410 100644 --- a/libraries/Controllers/ForumController.php +++ b/libraries/Controllers/ForumController.php @@ -403,8 +403,4 @@ class ForumController extends Controller return header("Location: {$threadLink}#p{$post->id}"); } - - protected function postingBase($title, $text, $forum, $thread = 0, $post = 0) - { - } } diff --git a/public/posting.php b/public/posting.php index 635ab31..0bcfa48 100644 --- a/public/posting.php +++ b/public/posting.php @@ -36,7 +36,8 @@ $thread->forum; $forum = new Forum($forumId); // Check if the user has access to the forum -if (!$forum->permission(ForumPerms::VIEW, $currentUser->id) || !$forum->permission(ForumPerms::REPLY, $currentUser->id)) { +if (!$forum->permission(ForumPerms::VIEW, $currentUser->id) + || !$forum->permission(ForumPerms::REPLY, $currentUser->id)) { // Set render data $renderData['page'] = [ 'title' => 'Information', @@ -52,7 +53,8 @@ if (!$forum->permission(ForumPerms::VIEW, $currentUser->id) || !$forum->permissi } // Check if the user has access to the forum -if (!isset($thread) && !$forum->permission(ForumPerms::CREATE_THREADS, $currentUser->id)) { +if (!isset($thread) + && !$forum->permission(ForumPerms::CREATE_THREADS, $currentUser->id)) { // Set render data $renderData['page'] = [ 'title' => 'Information', @@ -112,7 +114,9 @@ if ($mode != 'f') { } // Prompt an error if the topic doesn't exist - if ($thread->status == 1 && !$forum->permission(ForumPerms::LOCK, $currentUser->id)) { + if ($thread->status == 1 + && !$forum->permission(ForumPerms::LOCK, $currentUser->id)) { + // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Router::route('forums.index')), @@ -128,7 +132,11 @@ 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']]; @@ -137,7 +145,11 @@ if ($mode != 'f') { $posting['text'] = "[quote={$post->poster->username}]{$quotedPost}[/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())) { + // Permissions if (!$currentUser->permission(ForumPerms::EDIT_OWN, Perms::FORUM)) { // Add page specific things @@ -153,8 +165,11 @@ if ($mode != 'f') { echo Template::render('global/information'); exit; } + // Checks - if ($thread->posts()[$_GET['p']]->poster->id != $currentUser->id && !$forum->permission(ForumPerms::EDIT_ANY, $currentUser->id)) { + if ($thread->posts()[$_GET['p']]->poster->id != $currentUser->id + && !$forum->permission(ForumPerms::EDIT_ANY, $currentUser->id)) { + // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Router::route('forums.index')), @@ -179,7 +194,11 @@ if ($mode != 'f') { '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())) { + // Permissions if (!$currentUser->permission(ForumPerms::DELETE_OWN, Perms::FORUM)) { // Add page specific things @@ -197,7 +216,8 @@ if ($mode != 'f') { } // Checks - if ($thread->posts()[$_GET['p']]->poster->id != $currentUser->id && !$forum->permission(ForumPerms::DELETE_ANY, $currentUser->id)) { + if ($thread->posts()[$_GET['p']]->poster->id != $currentUser->id + && !$forum->permission(ForumPerms::DELETE_ANY, $currentUser->id)) { // Add page specific things $renderData['page'] = [ 'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Router::route('forums.index')),