36 $cache_serial =
$PHORUM[
'mod_htmlpurifier'][
'body_cache_serial'];
45 if (isset(
$message[
'meta'][
'htmlpurifier_light'])) {
48 $data[$message_id][
'body'] = $purifier->purify(
$message[
'body']);
52 if (!empty(
$PHORUM[
'args'][
'purge'])) {
54 unset(
$message[
'meta'][
'body_cache']);
58 isset(
$message[
'meta'][
'body_cache']) &&
59 isset(
$message[
'meta'][
'body_cache_serial']) &&
60 $message[
'meta'][
'body_cache_serial'] == $cache_serial
63 $data[$message_id][
'body'] = base64_decode(
$message[
'meta'][
'body_cache']);
70 $updated_message =
array();
75 !isset(
$message[
'meta'][
'body_cache_serial'])
82 $body = $fake_data[$message_id][
'body'];
83 $body = str_replace(
"<phorum break>\n",
"\n", $body);
84 $updated_message[
'body'] = $body;
85 $body .= $signature . $edit_message;
90 $body = str_replace(
"<phorum break>\n",
"\n", $body);
91 $body = str_replace(
array(
'<',
'>',
'&',
'"'),
array(
'<',
'>',
'&',
'"'), $body);
92 if (!$message_id &&
defined(
'PHORUM_CONTROL_CENTER')) {
94 $body = str_replace(
array(
'<',
'>',
'&',
'"'),
array(
'<',
'>',
'&',
'"'), $body);
98 $body = $purifier->purify($body);
106 $updated_message[
'meta'] =
$message[
'meta'];
107 $updated_message[
'meta'][
'body_cache'] = base64_encode($body);
108 $updated_message[
'meta'][
'body_cache_serial'] = $cache_serial;
109 phorum_db_update_message($message_id, $updated_message);
114 $data[$message_id][
'body'] = $body;
132 if(isset(
$row[
"user"][
"signature"])
133 && isset(
$row[
'meta'][
'show_signature']) &&
$row[
'meta'][
'show_signature']==1){
134 $phorum_sig=trim(
$row[
"user"][
"signature"]);
135 if(!empty($phorum_sig)){
136 $phorum_sig=
"\n\n$phorum_sig";
149 if(isset(
$row[
'meta'][
'edit_count']) &&
$row[
'meta'][
'edit_count'] > 0) {
150 $editmessage = str_replace (
"%count%",
$row[
'meta'][
'edit_count'],
$PHORUM[
"DATA"][
"LANG"][
"EditedMessage"]);
151 $editmessage = str_replace (
"%lastedit%", phorum_date(
$PHORUM[
"short_date_time"],
$row[
'meta'][
'edit_date']), $editmessage);
152 $editmessage = str_replace (
"%lastuser%",
$row[
'meta'][
'edit_username'], $editmessage);
153 $editmessage =
"\n\n\n\n$editmessage";
169 $replacements =
array();
172 if ($signature) $replacements[str_replace(
"\n",
"<phorum break>\n", $signature)] =
'';
173 if ($editmessage) $replacements[str_replace(
"\n",
"<phorum break>\n", $editmessage)] =
'';
174 $row[
'body'] = strtr(
$row[
'body'], $replacements);
175 return array($signature, $editmessage);
187 unset(
$message[
'meta'][
'body_cache']);
188 $message[
'meta'][
'body_cache_serial'] =
$PHORUM[
'mod_htmlpurifier'][
'body_cache_serial'];
199 $text = $purifier->purify($array[1]);
200 $source = htmlspecialchars($array[0]);
201 return "<blockquote cite=\"$source\">\n$text\n</blockquote>";
210 require_once(dirname(__FILE__).
'/htmlpurifier/HTMLPurifier.auto.php');
211 require(dirname(__FILE__).
'/init-config.php');
217 $GLOBALS[
'PHORUM'][
'mod_htmlpurifier'][
'body_cache_serial'] =
$config->getSerial();
220 if (file_exists(dirname(__FILE__) .
'/migrate.php')) {
221 include(dirname(__FILE__) .
'/migrate.php');
223 echo
'<strong>Error:</strong> No migration path specified for HTML Purifier, please check 224 <tt>modes/htmlpurifier/migrate.bbcode.php</tt> for instructions on 225 how to migrate from your previous markup language.';
229 if (!function_exists(
'phorum_htmlpurifier_migrate')) {
242 if (!empty(
$GLOBALS[
'PHORUM'][
'mod_htmlpurifier'][
'wysiwyg'])) {
246 $body = str_replace(
array(
'<',
'>',
'&'),
array(
'<',
'>',
'&'), $body);
248 $body = $purifier->purify($body);
250 $body = htmlspecialchars($body, ENT_QUOTES,
$GLOBALS[
'PHORUM'][
'DATA'][
'CHARSET']);
261 if (!empty(
$GLOBALS[
'PHORUM'][
'mod_htmlpurifier'][
'wysiwyg'])) {
263 if (
$i ==
'quote' ||
$i ==
'edit' ||
$i ==
'moderation') {
267 <strong>Notice:</strong> HTML has been scrubbed
for your safety.
268 If you would like
to see the original, turn off WYSIWYG mode
269 (consult your administrator
for details.)
276 if (!empty(
$GLOBALS[
'PHORUM'][
'mod_htmlpurifier'][
'suppress_message']))
return;
277 ?><div
class=
"htmlpurifier-help">
279 <strong>HTML input</strong>
is enabled. Make sure you escape all HTML and
280 angled brackets with <code>&lt;</code> and <code>&gt;</code>.
284 if (
$config->get(
'AutoFormat.AutoParagraph')) {
286 <strong>Auto-paragraphing</strong>
is enabled. Double
287 newlines will be converted
to paragraphs;
for single
288 newlines, use the <code>pre</code> tag.
291 $html_definition =
$config->getDefinition(
'HTML');
293 foreach ($html_definition->info as
$name =>
$x) $allowed[] =
"<code>$name</code>";
295 $allowed_text = implode(
', ', $allowed);
296 ?><p><strong>Allowed tags:</strong> <?php
302 For inputting literal code such as HTML and
PHP for display, use
303 CDATA tags
to auto-escape your angled brackets, and <code>pre</code>
304 to preserve newlines:
306 <pre><pre><![CDATA[
307 <em>Place code here</em>
308 ]]></pre></pre>
310 Power users, you can hide
this notice with:
311 <pre>.htmlpurifier-help {display:none;}</pre>
phorum_htmlpurifier_generate_editmessage($row)
Generates an edit message based on a message array.
phorum_htmlpurifier_migrate($data)
'format' hook style function that will be called to convert legacy markup into HTML.
$PHORUM['mod_htmlpurifier']['directives']
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
phorum_htmlpurifier_quote($array)
Overload quoting mechanism to prevent default, mail-style quote from happening.
phorum_htmlpurifier_get_config($default=false)
Initializes the appropriate configuration from either a PHP file or a module configuration value...
phorum_htmlpurifier_editor_after_subject()
catch(Exception $e) $message
phorum_htmlpurifier_common()
Ensure that our format hook is processed last.
phorum_htmlpurifier_posting($message)
Indicate that data is fully HTML and not from migration, invalidate previous caches.
static getInstance($prototype=null)
Singleton for enforcing just one HTML Purifier in your system.
phorum_htmlpurifier_remove_sig_and_editmessage(&$row)
Removes the signature and edit message from a message.
phorum_htmlpurifier_generate_sig($row)
Generates a signature based on a message array.
Create styles array
The data for the language used.
phorum_htmlpurifier_before_editor($message)
Pre-emptively performs purification if it looks like a WYSIWYG editor is being used.
phorum_htmlpurifier_format($data)
HTML Purifier Phorum Mod.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'