aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCallum Macrae <callum@lynxphp.com>2011-07-11 15:17:46 +0100
committerCallum Macrae <callum@lynxphp.com>2011-07-28 16:41:04 +0100
commit381ebcf195499c2656b7fc3e49b14a665320ba4b (patch)
tree5d52c548a2cc67c73124eee3d15631a96091b3f6
parente4707a8be75263e610b00b3d600144e797f576d9 (diff)
downloadforums-381ebcf195499c2656b7fc3e49b14a665320ba4b.tar
forums-381ebcf195499c2656b7fc3e49b14a665320ba4b.tar.gz
forums-381ebcf195499c2656b7fc3e49b14a665320ba4b.tar.bz2
forums-381ebcf195499c2656b7fc3e49b14a665320ba4b.tar.xz
forums-381ebcf195499c2656b7fc3e49b14a665320ba4b.zip
[ticket/9645] Added code to repair invalid anchor names in acp_php_info.
Some of the anchor tags produced by php_info had names like "module_Zend Optimizer", which is obviously invalid. This commit adds some code that repairs the names by replacing all spaces found in the names with underscores. PHPBB3-9645
-rw-r--r--phpBB/includes/acp/acp_php_info.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php
index 0499095004..7dd345971a 100644
--- a/phpBB/includes/acp/acp_php_info.php
+++ b/phpBB/includes/acp/acp_php_info.php
@@ -67,6 +67,9 @@ class acp_php_info
$output = preg_replace('#<img border="0"#i', '<img', $output);
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
+ // Fix invalid anchor names (eg "module_Zend Optimizer")
+ $output = preg_replace_callback('#<a name="([^"]+)">#', array($this, 'remove_spaces'), $output);
+
if (empty($output))
{
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
@@ -79,6 +82,11 @@ class acp_php_info
$template->assign_var('PHPINFO', $output);
}
+
+ function remove_spaces($matches)
+ {
+ return '<a name="' . str_replace(' ', '_', $matches[1]) . '">';
+ }
}
?> \ No newline at end of file