diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index f187a62b58..318a495858 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -24,7 +24,7 @@ class bbcode
var $bbcode_uid = '';
var $bbcode_bitfield = 0;
var $bbcode_cache = array();
- var $bbcode_tpl = array();
+ var $bbcode_template = array();
function bbcode($bitfield = 0)
{
@@ -257,27 +257,31 @@ class bbcode
function bbcode_tpl($tpl_name, $bbcode_id = -1)
{
- static $bbcode_hardtpl = array(
- 'b_open' => '',
- 'b_close' => '',
- 'i_open' => '',
- 'i_close' => '',
- 'u_open' => '',
- 'u_close' => '',
- 'url' => '\2',
- 'img' => '',
- 'size' => '\2',
- 'color' => '\2',
- 'email' => '\2'
- );
global $template, $user;
+ if (empty($bbcode_hardtpl))
+ {
+ static $bbcode_hardtpl = array(
+ 'b_open' => '',
+ 'b_close' => '',
+ 'i_open' => '',
+ 'i_close' => '',
+ 'u_open' => '',
+ 'u_close' => '',
+ 'url' => '\2',
+ 'img' => '
',
+ 'size' => '\2',
+ 'color' => '\2',
+ 'email' => '\2'
+ );
+ }
+
if ($bbcode_id != -1 && !($user->theme['bbcode_bitfield'] & pow(2, $bbcode_id)))
{
return $bbcode_hardtpl[$tpl_name];
}
- if (empty($this->bbcode_tpl))
+ if (empty($this->bbcode_template))
{
$tpl_filename = $template->make_filename('bbcode.html');
@@ -296,13 +300,13 @@ class bbcode
$tpl = preg_replace("/\n[\n\r\s\t]*/", '', $tpl);
// Turn template blocks into PHP assignment statements for the values of $bbcode_tpl..
- $tpl = preg_replace('#(.*?)#', "\n" . "\$this->bbcode_tpl['\\1'] = \$this->bbcode_tpl_replace('\\1','\\2');", $tpl);
+ $tpl = preg_replace('#(.*?)#', "\n" . "\$this->bbcode_template['\\1'] = \$this->bbcode_tpl_replace('\\1','\\2');", $tpl);
- $this->bbcode_tpl = array();
+ $this->bbcode_template = array();
eval($tpl);
}
- return $this->bbcode_tpl[$tpl_name];
+ return $this->bbcode_template[$tpl_name];
}
function bbcode_tpl_replace($tpl_name, $tpl)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 3b593919c3..8f89d2669b 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -84,16 +84,10 @@ function generate_smilies($mode)
}
// Format text to be displayed - from viewtopic.php - centralizing this would be nice ;)
-function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig)
+function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $url, $smilies, $sig)
{
global $auth, $forum_id, $config, $censors, $user, $bbcode, $phpbb_root_path;
- // If the board has HTML off but the post has HTML on then we process it, else leave it alone
-/* if ($html && $auth->acl_get('f_bbcode', $forum_id))
- {
- $message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message);
- }
-*/
// Second parse bbcode here
$message = $bbcode->bbcode_second_pass($message, $uid);
@@ -110,33 +104,27 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig)
$message = str_replace("\n", '
', $message);
// Signature
- $user_sig = ($sig && $config['allow_sig']) ? trim($user->data['user_sig']) : '';
-
- if ($user_sig != '' && $auth->acl_get('f_sigs', $forum_id))
+ if ($sig && $config['allow_sig'] && $signature && $auth->acl_get('f_sigs', $forum_id))
{
-/* if (!$auth->acl_get('f_html', $forum_id) && $user->data['user_allowhtml'])
- {
- $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig);
- }
-*/
- $user_sig = (empty($user->data['user_allowsmile']) || !$config['enable_smilies']) ? preg_replace('##', '\1', $signature) : str_replace('
(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $user_sig . '<'), 1, -1));
+ $signature = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature . '<'), 1, -1));
}
- $user_sig = str_replace("\n", '
', $user_sig);
+ $signature = str_replace("\n", '
', $signature);
}
else
{
- $user_sig = '';
+ $signature = '';
}
-
- // Inappropriate
- $message .= $user_sig;
- return $message;
+ return;
}
// Update Last Post Informations
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 3821f21579..c0a0ab7f53 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -454,7 +454,7 @@ class user extends session
// Set up style
$style = ($style) ? $style : ((!$config['override_user_style'] && $this->data['user_id'] != ANONYMOUS) ? $this->data['user_style'] : $config['default_style']);
- $sql = "SELECT DISTINCT t.template_path, t.poll_length, t.pm_box_length, c.css_data, c.css_external, i.*
+ $sql = "SELECT DISTINCT t.*, c.*, i.*
FROM " . STYLES_TABLE . " s, " . STYLES_TPL_TABLE . " t, " . STYLES_CSS_TABLE . " c, " . STYLES_IMAGE_TABLE . " i
WHERE s.style_id IN ($style, " . $config['default_style'] . ")
AND t.template_id = s.template_id
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 3535337a1b..902dc7da4f 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -54,6 +54,9 @@ if ($delete && !$preview && !$refresh && $submit)
$mode = 'delete';
}
+$error = array();
+
+
// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || time() - $lastclick < 2)
{
@@ -74,11 +77,10 @@ $parameters = array(
'topic_status' => 'i', 'topic_first_post_id' => 'i', 'topic_last_post_id' => 'i', 'topic_type' => 'i', 'topic_title' => 's', 'poll_last_vote' => 'i', 'poll_start' => 'i', 'poll_title' => 's', 'poll_max_options' => 'i', 'poll_length' => 'i'
),
'posts' => array(
- 'post_time' => 'i', 'poster_id' => 'i', 'post_username' => 's', 'post_text' => 's', 'post_subject' => 's', 'post_checksum' => 's', 'post_attachment' => 'i', 'bbcode_uid' => 's', 'enable_magic_url' => 'i', 'enable_sig' => 'i', 'enable_smilies' => 'i', 'enable_bbcode' => 'i', 'post_edit_locked' => 'i'
+ 'post_time' => 'i', 'poster_id' => 'i', 'post_username' => 's', 'post_text' => 's', 'post_subject' => 's', 'post_checksum' => 's', 'post_attachment' => 'i', 'bbcode_uid' => 's', 'enable_magic_url' => 'i', 'enable_sig' => 'i', 'enable_smilies' => 'i', 'enable_bbcode' => 'i', 'post_edit_locked' => 'i', 'username' => 's', 'user_sig' => 's', 'user_sig_bbcode_uid' => 's', 'user_sig_bbcode_bitfield' => 'i'
)
);
-$sql = '';
switch ($mode)
{
case 'post':
@@ -116,7 +118,7 @@ switch ($mode)
trigger_error($user->lang['NO_POST']);
}
- $sql = 'SELECT p.*, t.*, f.*, u.username
+ $sql = 'SELECT p.*, t.*, f.*, u.username, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . " u
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
@@ -140,6 +142,7 @@ switch ($mode)
break;
default:
+ $sql = '';
trigger_error($user->lang['NO_MODE']);
}
@@ -478,6 +481,7 @@ $smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $foru
$img_status = ($config['allow_img'] && $auth->acl_get('f_img', $forum_id)) ? true : false;
$flash_status = ($config['allow_flash'] && $auth->acl_get('f_flash', $forum_id)) ? true : false;
+
if ($submit || $preview || $refresh)
{
$topic_cur_post_id = (isset($_POST['topic_cur_post_id'])) ? intval($_POST['topic_cur_post_id']) : false;
@@ -490,7 +494,7 @@ if ($submit || $preview || $refresh)
$message_parser->message = (!empty($_POST['message'])) ? trim(stripslashes($_POST['message'])) : '';
- $username = (!empty($_POST['username'])) ? trim($_POST['username']) : '';
+ $username = (!empty($_POST['username'])) ? trim($_POST['username']) : ((!empty($username)) ? $username : '');
$topic_type = (!empty($_POST['topic_type'])) ? (int) $_POST['topic_type'] : (($mode != 'post') ? $topic_type : POST_NORMAL);
$icon_id = (!empty($_POST['icon'])) ? intval($_POST['icon']) : 0;
@@ -546,9 +550,10 @@ if ($submit || $preview || $refresh)
$poll_max_options = (!empty($_POST['poll_max_options'])) ? intval($_POST['poll_max_options']) : 1;
}
- $error = array();
+
$current_time = time();
+
// If replying/quoting and last post id has changed
// give user option to continue submit or return to post
// notify and show user the post made between his request and the final submit
@@ -617,6 +622,7 @@ if ($submit || $preview || $refresh)
$refresh = TRUE;
}
+
// Grab md5 'checksum' of new message
$message_md5 = md5($message_parser->message);
@@ -795,22 +801,25 @@ if (!sizeof($error) && $preview)
obtain_word_list($censors);
}
- $post_time = $current_time;
+ $post_time = ($mode == 'edit') ? $post_time : $current_time;
-
- include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
- $bbcode = new bbcode($message_parser->bbcode_bitfield);
-
-
- $preview_message = format_display($message_parser->message, $enable_html, $enable_bbcode, $message_parser->bbcode_uid, $enable_urls, $enable_smilies, $enable_sig);
$preview_subject = (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], $subject) : $subject;
+ $preview_signature = ($mode == 'edit') ? $user_sig : $user->data['user_sig'];
+ $preview_signature_uid = ($mode == 'edit') ? $user_sig_bbcode_uid : $user->data['user_sig_bbcode_uid'];
+ $preview_signature_bitfield = ($mode == 'edit') ? $user_sig_bbcode_bitfield : $user->data['user_sig_bbcode_bitfield'];
+
+ include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
+ $bbcode = new bbcode($message_parser->bbcode_bitfield | $preview_signature_bitfield);
+
+ $preview_message = $message_parser->message;
+ format_display($preview_message, $preview_signature, $message_parser->bbcode_uid, $preview_signature_uid, $enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $enable_sig);
// Poll Preview
if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && empty($poll_last_vote))) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)))
{
decode_text($poll_title, $message_parser->bbcode_uid);
- $preview_poll_title = format_display(stripslashes($poll_title), $enable_html, $enable_bbcode, $message_parser->bbcode_uid, $enable_urls, $enable_smilies, false, false);
+ $preview_poll_title = format_display(stripslashes($poll_title), $null, $message_parser->bbcode_uid, false, $enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false, false);
$template->assign_vars(array(
'S_HAS_POLL_OPTIONS' => (sizeof($poll_options)) ? true : false,
@@ -825,7 +834,6 @@ if (!sizeof($error) && $preview)
}
}
-
// Attachment Preview
if (sizeof($message_parser->attachment_data))
{
@@ -922,6 +930,7 @@ if ($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id))
'global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL')
);
+
foreach ($topic_types as $auth_key => $topic_value)
{
if ($auth->acl_get('f_' . $auth_key, $forum_id))
@@ -999,9 +1008,10 @@ $template->assign_vars(array(
'MODERATORS' => (sizeof($moderators)) ? implode(', ', $moderators[$forum_id]) : '',
'USERNAME' => (((!$preview) && ($mode != 'quote')) || ($preview)) ? stripslashes($username) : '',
'SUBJECT' => $post_subject,
- 'PREVIEW_SUBJECT' => ($preview && !sizeof($error)) ? $preview_subject : '',
'MESSAGE' => trim($post_text),
- 'PREVIEW_MESSAGE' => ($preview && !sizeof($error)) ? $preview_message : '',
+ 'PREVIEW_SUBJECT' => ($preview && !sizeof($error)) ? $preview_subject : '',
+ 'PREVIEW_MESSAGE' => ($preview && !sizeof($error)) ? $preview_message : '',
+ 'PREVIEW_SIGNATURE' => ($preview && !sizeof($error)) ? $preview_signature : '',
'HTML_STATUS' => ($html_status) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''),
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
@@ -1009,7 +1019,7 @@ $template->assign_vars(array(
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']),
'POST_DATE' => ($post_time) ? $user->format_date($post_time) : '',
- 'ERROR_MESSAGE' => (sizeof($error)) ? implode('
', $error) : '',
+ 'ERROR' => (sizeof($error)) ? implode('
', $error) : '',
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_id,
'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&$forum_id&t=$topic_id" : '',
diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html
index a12bea7767..39be6ebbea 100644
--- a/phpBB/templates/subSilver/posting_body.html
+++ b/phpBB/templates/subSilver/posting_body.html
@@ -114,11 +114,13 @@ function checkForm()
- {PREVIEW_MESSAGE} + | {PREVIEW_MESSAGE} - - - | + +