aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_content.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_content.php')
-rw-r--r--phpBB/includes/functions_content.php61
1 files changed, 16 insertions, 45 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 5cebc54eb2..df25451266 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -420,7 +420,7 @@ function decode_message(&$message, $bbcode_uid = '')
$message = str_replace($match, $replace, $message);
$match = get_preg_expression('bbcode_htm');
- $replace = array('\1', '\1', '\2', '\1', '', '');
+ $replace = array('\1', '\1', '\3', '\1', '', '');
$message = preg_replace($match, $replace, $message);
}
@@ -564,10 +564,11 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text
* @param bool $allow_flash_bbcode
* @param bool $allow_quote_bbcode
* @param bool $allow_url_bbcode
+* @param string $mode Mode to parse text as, e.g. post or sig
*
* @return array An array of string with the errors that occurred while parsing
*/
-function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true)
+function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $mode = 'post')
{
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
@@ -586,7 +587,9 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
* @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode
* @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode
* @var bool allow_url_bbcode Whether or not to parse the [url] BBCode
+ * @var string mode Mode to parse text as, e.g. post or sig
* @since 3.1.0-a1
+ * @changed 3.2.0-a1
*/
$vars = array(
'text',
@@ -600,6 +603,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
'allow_flash_bbcode',
'allow_quote_bbcode',
'allow_url_bbcode',
+ 'mode',
);
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars)));
@@ -612,7 +616,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
}
$message_parser = new parse_message($text);
- $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode);
+ $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, true, $mode);
$text = $message_parser->message;
$uid = $message_parser->bbcode_uid;
@@ -647,7 +651,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
*/
function generate_text_for_edit($text, $uid, $flags)
{
- global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
+ global $phpbb_dispatcher;
/**
* Use this event to modify the text before it is decoded for editing
@@ -953,10 +957,10 @@ function smiley_text($text, $force_option = false)
* @param mixed $forum_id The forum id the attachments are displayed in (false if in private message)
* @param string &$message The post/private message
* @param array &$attachments The attachments to parse for (inline) display. The attachments array will hold templated data after parsing.
-* @param array &$update_count The attachment counts to be updated - will be filled
+* @param array &$update_count_ary The attachment counts to be updated - will be filled
* @param bool $preview If set to true the attachments are parsed for preview. Within preview mode the comments are fetched from the given $attachments array and not fetched from the database.
*/
-function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $preview = false)
+function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false)
{
if (!sizeof($attachments))
{
@@ -1052,7 +1056,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
// Some basics...
$attachment['extension'] = strtolower(trim($attachment['extension']));
$filename = $phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($attachment['physical_filename']);
- $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . utf8_basename($attachment['physical_filename']);
$upload_icon = '';
@@ -1094,7 +1097,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
if (!$denied)
{
- $l_downloaded_viewed = $download_link = '';
$display_cat = $extensions[$attachment['extension']]['display_cat'];
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE)
@@ -1155,7 +1157,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'U_INLINE_LINK' => $inline_link,
);
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
// Images, but display Thumbnail
@@ -1168,39 +1170,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'THUMB_IMAGE' => $thumbnail_link,
);
- $update_count[] = $attachment['attach_id'];
- break;
-
- // Windows Media Streams
- case ATTACHMENT_CATEGORY_WM:
-
- // Giving the filename directly because within the wm object all variables are in local context making it impossible
- // to validate against a valid session (all params can differ)
- // $download_link = $filename;
-
- $block_array += array(
- 'U_FORUM' => generate_board_url(),
- 'ATTACH_ID' => $attachment['attach_id'],
- 'S_WM_FILE' => true,
- );
-
- // Viewed/Heared File ... update the download count
- $update_count[] = $attachment['attach_id'];
- break;
-
- // Real Media Streams
- case ATTACHMENT_CATEGORY_RM:
- case ATTACHMENT_CATEGORY_QUICKTIME:
-
- $block_array += array(
- 'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false,
- 'S_QUICKTIME_FILE' => ($display_cat == ATTACHMENT_CATEGORY_QUICKTIME) ? true : false,
- 'U_FORUM' => generate_board_url(),
- 'ATTACH_ID' => $attachment['attach_id'],
- );
-
- // Viewed/Heared File ... update the download count
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
// Macromedia Flash Files
@@ -1215,7 +1185,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
// Viewed/Heared File ... update the download count
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
default:
@@ -1238,6 +1208,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
}
+ $update_count = $update_count_ary;
/**
* Use this event to modify the attachment template data.
*
@@ -1265,6 +1236,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'update_count',
);
extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars)));
+ $update_count_ary = $update_count;
+ unset($update_count);
$template->assign_block_vars('_file', $block_array);
@@ -1341,8 +1314,6 @@ function extension_allowed($forum_id, $extension, &$extensions)
*/
function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
{
- $chars = array();
-
$strip_reply = false;
$stripped = false;
if ($allow_reply && strpos($string, 'Re: ') === 0)