aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-07-15 13:47:01 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-07-15 13:47:01 +0000
commitf27fa04b8c7f6d668e9cc651afaa10334f5d7067 (patch)
tree84a5422ac89d24673c073d736560ff4ff7d0fc0c /phpBB/includes/message_parser.php
parent86de92d8f0c858895adef258c6cdc64f4cf43deb (diff)
downloadforums-f27fa04b8c7f6d668e9cc651afaa10334f5d7067.tar
forums-f27fa04b8c7f6d668e9cc651afaa10334f5d7067.tar.gz
forums-f27fa04b8c7f6d668e9cc651afaa10334f5d7067.tar.bz2
forums-f27fa04b8c7f6d668e9cc651afaa10334f5d7067.tar.xz
forums-f27fa04b8c7f6d668e9cc651afaa10334f5d7067.zip
even more fixes. :o
git-svn-id: file:///svn/phpbb/trunk@7889 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e7b7edc169..c5349efabe 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -116,7 +116,7 @@ class bbcode_firstpass extends bbcode
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")),
'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),
- 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#ie' => "\$this->bbcode_img('\$1\$2')")),
+ 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#iUe' => "\$this->bbcode_img('\$1')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")),
'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#ise' => "\$this->bbcode_underline('\$1')")),
@@ -278,6 +278,20 @@ class bbcode_firstpass extends bbcode
$in = trim($in);
$error = false;
+ $in = str_replace(' ', '%20', $in);
+
+ // Checking urls
+ if (!preg_match('#^' . get_preg_expression('url') . '$#i', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#i', $in))
+ {
+ return '[img]' . $in . '[/img]';
+ }
+
+ // Try to cope with a common user error... not specifying a protocol but only a subdomain
+ if (!preg_match('#^[a-z0-9]+://#i', $in))
+ {
+ $in = 'http://' . $in;
+ }
+
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
$stats = @getimagesize($in);