1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-18 22:58:10 +01:00

fixed: message post storage. We do not hold the parsed message, only the decoded one for displaying within the textarea.

git-svn-id: file:///svn/phpbb/trunk@4094 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-06-07 16:37:16 +00:00
parent 7dd1ec0070
commit f31b414220
2 changed files with 9 additions and 8 deletions

View File

@ -154,7 +154,7 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig)
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $message . '<'), 1, -1));
}
$message = nl2br($message);
$message = str_replace("\n", '<br />', $message);
// Signature
$user_sig = ($sig && $config['allow_sig']) ? trim($user->data['user_sig']) : '';
@ -166,22 +166,22 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig)
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
}
$user_sig = (empty($user->data['user_allowsmile']) || empty($config['enable_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $user_sig) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $user_sig);
$user_sig = (empty($user->data['user_allowsmile']) || empty($config['enable_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $user_sig) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $user_sig);
if (sizeof($censors))
{
$user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $user_sig . '<'), 1, -1));
}
$user_sig = '<br />_________________<br />' . nl2br($user_sig);
$user_sig = '<br />_________________<br />' . str_replace("\n", '<br />', $user_sig);
}
else
{
$user_sig = '';
}
$message = (empty($smilies) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
// $message = (empty($smilies) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
$message .= $user_sig;
return $message;
@ -959,7 +959,8 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
'enable_magic_url' => $post_data['enable_urls'],
'bbcode_uid' => $bbcode_uid,
'bbcode_bitfield' => $post_data['bbcode_bitfield'],
'post_edit_locked' => $post_data['post_edit_locked']
'post_edit_locked' => $post_data['post_edit_locked'],
'post_text' => $message
);
if ($mode != 'edit')
@ -971,7 +972,6 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
{
$post_sql = array_merge($post_sql, array(
'post_checksum' => $post_data['message_md5'],
'post_text' => $message,
'post_encoding' => $user->lang['ENCODING'])
);
}

View File

@ -646,7 +646,7 @@ if ($submit || $preview || $refresh)
$message_md5 = md5($message_parser->message);
// Check checksum ... don't re-parse message if the same
if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch)
if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview)
{
// Parse message
if ($result = $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status))
@ -802,6 +802,7 @@ if ($submit || $preview || $refresh)
'bbcode_bitfield' => $message_parser->bbcode_bitfield
);
echo ";<pre>".$message_parser->message."</pre>";
submit_post($mode, $message_parser->message, $subject, $username, $topic_type, $message_parser->bbcode_uid, $poll, $message_parser->attachment_data, $message_parser->filename_data, $post_data);
}