mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 06:18:52 +00:00
[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
This commit is contained in:
parent
e4707a8be7
commit
381ebcf195
1 changed files with 8 additions and 0 deletions
|
@ -67,6 +67,9 @@ class acp_php_info
|
||||||
$output = preg_replace('#<img border="0"#i', '<img', $output);
|
$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);
|
$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))
|
if (empty($output))
|
||||||
{
|
{
|
||||||
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
||||||
|
@ -79,6 +82,11 @@ class acp_php_info
|
||||||
|
|
||||||
$template->assign_var('PHPINFO', $output);
|
$template->assign_var('PHPINFO', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_spaces($matches)
|
||||||
|
{
|
||||||
|
return '<a name="' . str_replace(' ', '_', $matches[1]) . '">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue