diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-03-01 21:48:02 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-03-01 21:48:02 +0000 |
commit | f9a451cce21686c19e0c725efc2edbfadabc4d3a (patch) | |
tree | 97179308cbf8b09fff4a94a860692e060650ba47 /phpBB/includes/message_parser.php | |
parent | cbfe138cdc505511f0f91288afe8da548b93c3bd (diff) | |
download | forums-f9a451cce21686c19e0c725efc2edbfadabc4d3a.tar forums-f9a451cce21686c19e0c725efc2edbfadabc4d3a.tar.gz forums-f9a451cce21686c19e0c725efc2edbfadabc4d3a.tar.bz2 forums-f9a451cce21686c19e0c725efc2edbfadabc4d3a.tar.xz forums-f9a451cce21686c19e0c725efc2edbfadabc4d3a.zip |
- some bugfixes
- committed coding guidelines as they are at area51
- removed script_path (needs a close inspection later)
- removed the need for server_name and server_port
- able to define server port/name/protocol and force the user-defined server vars (very handy for proxy setups)
git-svn-id: file:///svn/phpbb/trunk@5595 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r-- | phpBB/includes/message_parser.php | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index eb37168fdd..dc206d1ba1 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -667,11 +667,8 @@ class bbcode_firstpass extends bbcode return ''; } - $server_protocol = ( $config['cookie_secure'] ) ? 'https://' : 'http://'; - $server_port = ( $config['server_port'] <> 80 ) ? ':' . trim($config['server_port']) . '/' : '/'; - // relative urls for this board - if (preg_match('#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '$1', trim($config['script_path'])) . '/([^ \t\n\r<"\']+)#i', $url) || + if (preg_match('#' . preg_quote(generate_board_url(), '#') . '/([^ \t\n\r<"\']+)#i', $url) || preg_match('#([\w]+?://.*?[^ \t\n\r<"\']*)#i', $url) || preg_match('#(www\.[\w\-]+\.[\w\-.\~]+(?:/[^ \t\n\r<"\']*)?)#i', $url)) { @@ -803,7 +800,7 @@ class parse_message extends bbcode_firstpass // Parse URL's if ($allow_magic_url) { - $this->magic_url((($config['cookie_secure']) ? 'https://' : 'http://'), $config['server_name'], $config['server_port'], $config['script_path']); + $this->magic_url(generate_board_url()); if ($config['max_' . $mode . '_urls']) { @@ -908,20 +905,18 @@ class parse_message extends bbcode_firstpass // Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. // Cuts down displayed size of link if over 50 chars, turns absolute links // into relative versions when the server/script path matches the link - function magic_url($server_protocol, $server_name, $server_port, $script_path) + function magic_url($server_url) { static $match; static $replace; - $server_port = ($server_port <> 80 ) ? ':' . trim($server_port) . '/' : '/'; - if (!is_array($match)) { $match = $replace = array(); // Be sure to not let the matches cross over. ;) // relative urls for this board - $match[] = '#(^|[\n ]|\()(' . preg_quote($server_protocol . trim($server_name) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '$1', trim($script_path)), '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*)#i'; + $match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*)#i'; $replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->'; // matches a xxxx://aaaaa.bbb.cccc. ... @@ -1011,7 +1006,7 @@ class parse_message extends bbcode_firstpass // Parse Attachments function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { - global $config, $auth, $user, $phpbb_root_path; + global $config, $auth, $user, $phpbb_root_path, $phpEx; $error = array(); @@ -1075,6 +1070,8 @@ class parse_message extends bbcode_firstpass // Perform actions on temporary attachments if ($delete_file) { + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + $index = (int) key($_POST['delete_file']); // delete selected attachment @@ -1089,10 +1086,6 @@ class parse_message extends bbcode_firstpass } else { - if (!function_exists('delete_attachments')) - { - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id']))); } |