diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/bbcode.php | 40 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 34 | ||||
-rw-r--r-- | phpBB/includes/session.php | 2 |
3 files changed, 34 insertions, 42 deletions
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' => '<span style="font-weight: bold">', - 'b_close' => '</span>', - 'i_open' => '<span style="font-style: italic">', - 'i_close' => '</span>', - 'u_open' => '<span style="text-decoration: underline">', - 'u_close' => '</span>', - 'url' => '<a href="\1" target="_blank">\2</a>', - 'img' => '<img src="\1" border="0" />', - 'size' => '<span style="font-size: \1px; line-height: normal">\2</span>', - 'color' => '<span style="color: \1">\2</span>', - 'email' => '<a href="mailto:\1">\2</a>' - ); global $template, $user; + if (empty($bbcode_hardtpl)) + { + static $bbcode_hardtpl = array( + 'b_open' => '<span style="font-weight: bold">', + 'b_close' => '</span>', + 'i_open' => '<span style="font-style: italic">', + 'i_close' => '</span>', + 'u_open' => '<span style="text-decoration: underline">', + 'u_close' => '</span>', + 'url' => '<a href="\1" target="_blank">\2</a>', + 'img' => '<img src="\1" border="0" />', + 'size' => '<span style="font-size: \1px; line-height: normal">\2</span>', + 'color' => '<span style="color: \1">\2</span>', + 'email' => '<a href="mailto:\1">\2</a>' + ); + } + 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('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\n" . "\$this->bbcode_tpl['\\1'] = \$this->bbcode_tpl_replace('\\1','\\2');", $tpl); + $tpl = preg_replace('#<!-- BEGIN (.*?) -->(.*?)<!-- END (.*?) -->#', "\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", '<br />', $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('#<!\-\- 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); + $signature = trim($signature); + + $signature = $bbcode->bbcode_second_pass($signature, $siguid); + + $signature = (!$config['enable_smilies']) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $signature) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $signature); if (sizeof($censors)) { - $user_sig = str_replace('\"', '"', substr(preg_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", '<br />', $user_sig); + $signature = str_replace("\n", '<br />', $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 |