mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
* dont add extra <br/> to the TinyMCE news forum posts
This commit is contained in:
parent
2e4321872a
commit
5475bd6b5f
@ -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 '<b>' . $topic . '</b><hr />' . $text;
|
||||
}
|
||||
|
||||
$post = '';
|
||||
if(!empty($topic))
|
||||
$post .= '<b>'.($smiles == 0 ? self::parseSmiles($topic) : $topic).'</b><hr />';
|
||||
$post .= self::parseBBCode($text, $smiles);
|
||||
|
||||
$post .= self::parseBBCode(nl2br($text), $smiles);
|
||||
return $post;
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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 '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile']).'</td></tr>
|
||||
echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.Forum::showPost(($canEditForum ? $thread['post_topic'] : htmlspecialchars($thread['post_topic'])), ($canEditForum ? $thread['post_text'] : htmlspecialchars($thread['post_text'])), $thread['post_smile'], $bb_code).'</td></tr>
|
||||
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
|
||||
if($thread['edit_date'] > 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user