diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-08 18:02:17 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-08 18:02:17 +0000 |
commit | d7735d2587e68bab42fde8753ee733de76369f72 (patch) | |
tree | dcfce4a598d89b72a8469ef4f3538a0668668bee /phpBB/includes/message_parser.php | |
parent | b9bf2fe7519aa7aab5278fb882a139f3c823feb0 (diff) | |
download | forums-d7735d2587e68bab42fde8753ee733de76369f72.tar forums-d7735d2587e68bab42fde8753ee733de76369f72.tar.gz forums-d7735d2587e68bab42fde8753ee733de76369f72.tar.bz2 forums-d7735d2587e68bab42fde8753ee733de76369f72.tar.xz forums-d7735d2587e68bab42fde8753ee733de76369f72.zip |
inline attachment capability...
git-svn-id: file:///svn/phpbb/trunk@4819 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r-- | phpBB/includes/message_parser.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index ec3f4cd841..bfd50c54cb 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -165,6 +165,7 @@ class parse_message $this->bbcodes = array( 'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#ise' => "\$this->bbcode_code('\$1', '\$2')")), 'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")), + 'attachment'=> array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")), 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#is' => '[b:' . $this->bbcode_uid . ']$1[/b:' . $this->bbcode_uid . ']')), 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#is' => '[i:' . $this->bbcode_uid . ']$1[/i:' . $this->bbcode_uid . ']')), 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url=?(.*?)?\](.*?)\[/url\]#ise' => "\$this->validate_url('\$1', '\$2')")), @@ -200,6 +201,12 @@ class parse_message } } + function bbcode_attachment($stx, $in) + { + $out = '[attachment=' . $stx . ':' . $this->bbcode_uid . ']<!-- ia' . $stx . ' -->' . $in . '<!-- ia' . $stx . ' -->[/attachment:' . $this->bbcode_uid . ']'; + return $out; + } + // Expects the argument to start right after the opening [code] tag and to end with [/code] function bbcode_code($stx, $in) { @@ -673,7 +680,8 @@ class parse_message function parse_attachments($mode, $post_id, $submit, $preview, $refresh) { - global $config, $_FILES, $_POST, $auth, $user; + global $config, $auth, $user; + global $_FILES, $_POST; $error = array(); @@ -708,6 +716,8 @@ class parse_message ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message); + $this->filename_data['filecomment'] = ''; // This Variable is set to false here, because Attachments are entered into the @@ -750,7 +760,8 @@ class parse_message } unset($this->attachment_data[$index]); - + $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "(\\1 == \$index) ? '' : ((\\1 > \$index) ? '[attachment=' . (\\1 - 1) . ']\\2[/attachment]' : '\\0')", $this->message); + // Reindex Array $this->attachment_data = array_values($this->attachment_data); } @@ -789,6 +800,7 @@ class parse_message ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message); $this->filename_data['filecomment'] = ''; } } |