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/db | |
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/db')
-rw-r--r-- | phpBB/includes/db/migration/data/30x/local_url_bbcode.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/includes/db/migration/data/30x/local_url_bbcode.php new file mode 100644 index 0000000000..f324b8880d --- /dev/null +++ b/phpBB/includes/db/migration/data/30x/local_url_bbcode.php @@ -0,0 +1,57 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration +{ + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_12_rc1'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_local_url_bbcode'))), + ); + } + + /** + * Update BBCodes that currently use the LOCAL_URL tag + * + * To fix http://tracker.phpbb.com/browse/PHPBB3-8319 we changed + * the second_pass_replace value, so that needs updating for existing ones + */ + public function update_local_url_bbcode() + { + $sql = 'SELECT * + FROM ' . BBCODES_TABLE . ' + WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (!class_exists('acp_bbcodes')) + { + global $phpEx; + phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx); + } + $bbcode_match = $row['bbcode_match']; + $bbcode_tpl = $row['bbcode_tpl']; + + $acp_bbcodes = new acp_bbcodes(); + $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl); + + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE bbcode_id = ' . (int) $row['bbcode_id']; + $this->sql_query($sql); + } + $this->db->sql_freeresult($result); + } +} |