aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-08-07 14:06:45 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-08-07 14:06:45 +0200
commitf1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76 (patch)
tree38e968e109ca75cb41f17da0961f4d5e06252010 /phpBB
parentf474e33a430176fd7ef809141b258eec77993e03 (diff)
downloadforums-f1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76.tar
forums-f1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76.tar.gz
forums-f1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76.tar.bz2
forums-f1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76.tar.xz
forums-f1419ab27e5e49d177b8ff25e0ad9c3c8f6ddf76.zip
[ticket/12919] Use the modules basename as identifier for extension modules
PHPBB3-12919
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_module.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 397e6401ff..fe9bcdb9d1 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -489,6 +489,12 @@ class p_master
$id = request_var('icat', '');
}
+ // Restore the backslashes in class names
+ if (strpos($id, '-') !== false)
+ {
+ $id = str_replace('-', '\\', $id);
+ }
+
if ($id && !is_numeric($id) && !$this->is_full_class($id))
{
$id = $this->p_class . '_' . $id;
@@ -616,7 +622,7 @@ class p_master
}
// Not being able to overwrite ;)
- $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
else
{
@@ -648,7 +654,7 @@ class p_master
$this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'];
}
- $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
// Add url_extra parameter to u_action url
@@ -901,7 +907,7 @@ class p_master
else
{
// if the category has a name, then use it.
- $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']);
+ $u_title .= $this->get_module_identifier($item_ary['name']);
}
// If the item is not a category append the mode
if (!$item_ary['cat'])
@@ -1106,26 +1112,24 @@ class p_master
}
/**
- * If the basename contains a \ we dont use that for the URL.
+ * If the basename contains a \ we don't use that for the URL.
*
* Firefox is currently unable to correctly copy a urlencoded \
* so users will be unable to post links to modules.
- * However we can still fallback to the id instead of the name,
- * so we do that in this case.
+ * However we can replace them with dashes and re-replace them later
*
* @param string $basename Basename of the module
- * @param int $id Id of the module
- * @return mixed Identifier that should be used for
+ * @return string Identifier that should be used for
* module link creation
*/
- protected function get_module_identifier($basename, $id)
+ protected function get_module_identifier($basename)
{
if (strpos($basename, '\\') === false)
{
return $basename;
}
- return $id;
+ return str_replace('\\', '-', $basename);
}
/**