aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-10-02 22:37:16 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-10-02 22:37:16 +0200
commit2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8 (patch)
tree9fb752d4ddadf3a06fe11cb088ceba43e39bdf7e /phpBB
parente0adb15074cf7f6776af29376ed205d8d4948949 (diff)
downloadforums-2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8.tar
forums-2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8.tar.gz
forums-2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8.tar.bz2
forums-2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8.tar.xz
forums-2ab3ee7d67f99f1e6b7702b22e79c3a5af85adf8.zip
[ticket/11871] Fallback to int ID of the module, when creating links
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. PHPBB3-11871
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_module.php31
1 files changed, 27 insertions, 4 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index b33f3d6866..dca720c36e 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -519,7 +519,7 @@ class p_master
}
// Not being able to overwrite ;)
- $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($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, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
else
{
@@ -551,7 +551,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->p_name}") . (($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, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
// Add url_extra parameter to u_action url
@@ -799,12 +799,12 @@ class p_master
// if the item has a name use it, else use its id
if (empty($item_ary['name']))
{
- $u_title .= $item_ary['id'];
+ $u_title .= $item_ary['id'];
}
else
{
// if the category has a name, then use it.
- $u_title .= $item_ary['name'];
+ $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']);
}
// If the item is not a category append the mode
if (!$item_ary['cat'])
@@ -983,6 +983,29 @@ class p_master
}
/**
+ * If the basename contains a \ we dont 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.
+ *
+ * @param string $basename Basename of the module
+ * @param int $id Id of the module
+ * @return mixed Identifier that should be used for
+ * module link creation
+ */
+ protected function get_module_identifier($basename, $id)
+ {
+ if (strpos($basename, '\\') === false)
+ {
+ return $basename;
+ }
+
+ return $id;
+ }
+
+ /**
* Checks whether the given module basename is a correct class name
*
* @param string $basename A module basename