diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-11 10:11:11 -0500 |
|---|---|---|
| committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-11 10:11:11 -0500 |
| commit | 8f87fd7bf49499d0325795130ae32fc63d6fd3d6 (patch) | |
| tree | 1754c64976a6f22ba7a856c7dafd1bbc0755abb8 /phpBB/includes/acp/acp_bbcodes.php | |
| parent | 2fcae1ca16d096d2839b487e8c1bcbe0f313d91f (diff) | |
| parent | 19f7d12328fe1f100cd723fa808a291e634d8737 (diff) | |
| download | forums-8f87fd7bf49499d0325795130ae32fc63d6fd3d6.tar forums-8f87fd7bf49499d0325795130ae32fc63d6fd3d6.tar.gz forums-8f87fd7bf49499d0325795130ae32fc63d6fd3d6.tar.bz2 forums-8f87fd7bf49499d0325795130ae32fc63d6fd3d6.tar.xz forums-8f87fd7bf49499d0325795130ae32fc63d6fd3d6.zip | |
Merge remote-tracking branch 'remotes/nickv/ticket/8319-develop' into develop
# By Joas Schilling
# Via Joas Schilling
* remotes/nickv/ticket/8319-develop:
[ticket/8319] Add migration file for update change
[ticket/8319] Do not repeat the replacement
[ticket/8319] Add explanation for RELATIVE_URL and update LOCAL_URL
[ticket/8319] Update BBCodes that currently use the LOCAL_URL tag on update
[ticket/8319] Add new token RELATIVE_URL to allow foreign relative URL parts
[ticket/8319] Prepend Board URL to LOCAL_URL links to prevent abuse
Diffstat (limited to 'phpBB/includes/acp/acp_bbcodes.php')
| -rw-r--r-- | phpBB/includes/acp/acp_bbcodes.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index e537d7a8b9..9c430b5a0b 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -112,8 +112,8 @@ class acp_bbcodes { $template->assign_block_vars('token', array( 'TOKEN' => '{' . $token . '}', - 'EXPLAIN' => $token_explain) - ); + 'EXPLAIN' => ($token === 'LOCAL_URL') ? sprintf($token_explain, generate_board_url() . '/') : $token_explain, + )); } return; @@ -347,6 +347,9 @@ class acp_bbcodes 'LOCAL_URL' => array( '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" ), + 'RELATIVE_URL' => array( + '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" + ), 'EMAIL' => array( '!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')" ), @@ -373,6 +376,7 @@ class acp_bbcodes $sp_tokens = array( 'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)', 'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', + 'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', @@ -429,7 +433,11 @@ class acp_bbcodes $fp_replace = str_replace($token, $replace, $fp_replace); $sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match); - $sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace); + + // Prepend the board url to local relative links + $replace_prepend = ($token_type === 'LOCAL_URL') ? generate_board_url() . '/' : ''; + + $sp_replace = str_replace($token, $replace_prepend . '${' . ($n + 1) . '}', $sp_replace); } $fp_match = '!' . $fp_match . '!' . $modifiers; |
