aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-03-18 17:24:14 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-03-18 17:24:14 +0000
commit17ed78c14df3f03ff8e5370bbdb5b72004b85020 (patch)
tree97265770e01ecd382459859f99d900798f983d9a /phpBB/includes/message_parser.php
parent9699d62901ede3b2b84593bc04c5b045e42301bf (diff)
downloadforums-17ed78c14df3f03ff8e5370bbdb5b72004b85020.tar
forums-17ed78c14df3f03ff8e5370bbdb5b72004b85020.tar.gz
forums-17ed78c14df3f03ff8e5370bbdb5b72004b85020.tar.bz2
forums-17ed78c14df3f03ff8e5370bbdb5b72004b85020.tar.xz
forums-17ed78c14df3f03ff8e5370bbdb5b72004b85020.zip
Problem with url matching + spaces
git-svn-id: file:///svn/phpbb/trunk@3667 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 91c9005615..464fb367b2 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -33,7 +33,7 @@ class parse_message
function parse(&$message, $html, $bbcode, $uid, $url, $smilies, $attach = false)
{
- global $config, $db, $user, $_FILE;
+ global $config, $db, $user;
$warn_msg = '';
@@ -132,20 +132,20 @@ class parse_message
$replace = array();
// relative urls for this board
- $match[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^\t\n\r <"\']+)#i';
+ $match[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^ \t\n\r <"\']+)#i';
$replace[] = '<!-- l --><a href="\1" target="_blank">\1</a><!-- l -->';
// matches a xxxx://aaaaa.bbb.cccc. ...
- $match[] = '#(^|[\n ])([\w]+?://.*?[^\t\n\r<"]*)#ie';
- $replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ( ( strlen(str_replace(' ', '%20', '\\2')) > 55 ) ?substr(str_replace(' ', '%20', '\\2'), 0, 39) . ' ... ' . substr(str_replace(' ', '%20', '\\2'), -10) : str_replace(' ', '%20', '\\2') ) . '</a><!-- m -->'";
+ $match[] = '#(^|[\n ])([\w]+?://.*?[^ \t\n\r<"]*)#ie';
+ $replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ((strlen('\\2') > 55) ? substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2') . '</a><!-- m -->'";
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
- $match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r<"]*)?)#ie';
- $replace[] = "'\\1<!-- w --><a href=\"http://\\2\" target=\"_blank\">' . ( ( strlen(str_replace(' ', '%20', '\\2')) > 55 ) ? substr(str_replace(' ', '%20', '\\2'), 0, 39) . ' ... ' . substr(str_replace(' ', '%20', '\\2'), -10) : str_replace(' ', '%20', '\\2') ) . '</a><!-- w -->'";
+ $match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^ \t\n\r<"]*)?)#ie';
+ $replace[] = "'\\1<!-- w --><a href=\"http://\\2\" target=\"_blank\">' . ((strlen('\\2') > 55) ? substr(str_replace(' ', '%20', '\\2'), 0, 39) . ' ... ' . substr('\\2', -10) : '\\2') . '</a><!-- w -->'";
// matches an email@domain type address at the start of a line, or after a space.
$match[] = '#(^|[\n ])([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)#ie';
- $replace[] = "'\\1<!-- e --><a href=\"mailto:\\2\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- e -->'";
+ $replace[] = "'\\1<!-- e --><a href=\"mailto:\\2\">' . ((strlen('\\2') > 55) ? substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2') . '</a><!-- e -->'";
$message = preg_replace($match, $replace, $message);
}