Skip to forum content

missing Forum

out of the blue edition

You are not logged in. Please login or register.

Post new reply

missing Forum → Web-Forum → punBB: HTML posting extension → Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode Images Smilies

All fields with bold label must be completed before the form is submitted.

Required information for guests

Required information

Topic review (newest first)


Which version of PunBB do you use? Could you give me a link to the forum where the problem occurs? If I have some spare time, I might have a look into it and maybe get it extended, although I currently don't use it. wink

What would help you most? Configurable groups?


Ok I tried this ! works fine. But there is a problem that guests and users cant see the messages correct. They see something like that
<p><img rc=


I really like it and i was looking for this. Please extend it! smile


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<extension engine="1.0">
    <title>HTML posting</title>
    <description>Allow HTML postings by certain user groups (currently only forum administrators)</description>
    <author>Michael Hanig</author>
    <!--This hook is used to avoid censoring and conversion of HTML entities for forum administrators -->
    <hook id="ps_parse_message_start" priority="10"><![CDATA[
            if ($forum_user['g_id'] == FORUM_ADMIN)
                // censoring REMOVED
                // convert HTML entities REMOVED
                // If the message contains a code tag we have to split it up (text within  shouldn't be touched)
                if (strpos($text, '[co de]') !== false && strpos($text, '[/co de]') !== false)
                    list($inside, $outside) = split_text($text, '[co de]', '[/co de]', $errors);
                    $text = implode("\0", $outside);
                $return = ($hook = get_hook('ps_parse_message_post_split')) ? eval($hook) : null;
                if ($return != null)
                    return $return;
                if ($forum_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false)
                    $text = do_bbcode($text);
                if ($forum_config['o_smilies'] == '1' && $forum_user['show_smilies'] == '1' && $hide_smilies == '0')
                    $text = do_smilies($text);
                $return = ($hook = get_hook('ps_parse_message_bbcode')) ? eval($hook) : null;
                if ($return != null)
                    return $return;
                // Deal with newlines, tabs and multiple spaces
                $pattern = array("\n", "\t", '  ', '  ');
                $replace = array('<br />', '&nbsp; &nbsp; ', '&nbsp; ', ' &nbsp;');
                $text = str_replace($pattern, $replace, $text);
                $return = ($hook = get_hook('ps_parse_message_pre_merge')) ? eval($hook) : null;
                if ($return != null)
                    return $return;
                // If we split up the message before we have to concatenate it together again (code tags)
                if (isset($inside))
                    $outside = explode("\0", $text);
                    $text = '';
                    $num_tokens = count($outside);
                    for ($i = 0; $i < $num_tokens; ++$i)
                        $text .= $outside[$i];
                        if (isset($inside[$i]))
                            $text .= '</p><div class="codebox"><pre><code>'.forum_trim($inside[$i], "\n\r").'</code></pre></div><p>';
                $return = ($hook = get_hook('ps_parse_message_post_merge')) ? eval($hook) : null;
                if ($return != null)
                    return $return;
                // Add paragraph tag around post, but make sure there are no empty paragraphs
                $text = preg_replace('#<br />\s*?<br />((\s*<br />)*)#i', "</p>$1<p>", $text);
                $text = str_replace('<p><br />', '<p>', $text);
                $text = str_replace('<p></p>', '', '<p>'.$text.'</p>');
                $return = ($hook = get_hook('ps_parse_message_end')) ? eval($hook) : null;
                if ($return != null)
                    return $return;
                return $text;
            } else
                return null;

(space in "co de" is only needed to avoid parsing in this post and must be removed to make this extension work - or just download the archive below)

missing Forum → Web-Forum → punBB: HTML posting extension → Post new reply