diff --git a/system/libs/forum.php b/system/libs/forum.php
index 01e66c4b..b5588992 100644
--- a/system/libs/forum.php
+++ b/system/libs/forum.php
@@ -235,13 +235,17 @@ class Forum
return ($smiles == 0 ? Forum::parseSmiles($text) : $text);
}
- public static function showPost($topic, $text, $smiles)
+ public static function showPost($topic, $text, $smiles, $bb_code = true)
{
- $text = nl2br($text);
+ if(!$bb_code) {
+ return '' . $topic . '
' . $text;
+ }
+
$post = '';
if(!empty($topic))
$post .= ''.($smiles == 0 ? self::parseSmiles($topic) : $topic).'
';
- $post .= self::parseBBCode($text, $smiles);
+
+ $post .= self::parseBBCode(nl2br($text), $smiles);
return $post;
}
diff --git a/system/pages/forum/new_post.php b/system/pages/forum/new_post.php
index 7196e69a..26602ad0 100644
--- a/system/pages/forum/new_post.php
+++ b/system/pages/forum/new_post.php
@@ -88,8 +88,11 @@ if(Forum::canPost($account_logged))
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` DESC LIMIT 5")->fetchAll();
+ // check if its news written in tinymce
+ $bb_code = ($thread['post_text'] == strip_tags($thread['post_text'])) || (!$player_account->hasFlag(FLAG_CONTENT_NEWS) && !$player_account->isSuperAdmin());
+
foreach($threads as &$thread) {
- $thread['post'] = Forum::showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']);
+ $thread['post'] = Forum::showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile'], $bb_code);
}
echo $twig->render('forum.new_post.html.twig', array(
diff --git a/system/pages/forum/show_thread.php b/system/pages/forum/show_thread.php
index 9cfebc4f..c322984f 100644
--- a/system/pages/forum/show_thread.php
+++ b/system/pages/forum/show_thread.php
@@ -59,8 +59,11 @@ foreach($threads as $thread)
$player_account = $player->getAccount();
$canEditForum = $player_account->hasFlag(FLAG_CONTENT_FORUM) || $player_account->isAdmin();
+ // check if its news written in tinymce
+ $bb_code = ($thread['post_text'] == strip_tags($thread['post_text'])) || (!$player_account->hasFlag(FLAG_CONTENT_NEWS) && !$player_account->isSuperAdmin());
+
$posts = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $thread['account_id'])->fetch();
- echo '
Posts: '.(int) $posts['posts'].'
'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).' |
+ echo '
Posts: '.(int) $posts['posts'].'
'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'], $bb_code).' |
'.date('d.m.y H:i:s', $thread['post_date']);
if($thread['edit_date'] > 0)
{
|