mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-14 12:40:13 +01:00
[ticket/16904] Fix regression in MCP for topics selection
Regression introduced in #5760 PHPBB3-16904
This commit is contained in:
parent
8246023e0f
commit
337d876df7
@ -35,7 +35,7 @@ function phpbb_module_notes_url($mode, $module_row)
|
||||
}
|
||||
|
||||
global $user_id;
|
||||
return ($user_id) ? "&u=$user_id" : '';
|
||||
return phpbb_extra_url();
|
||||
}
|
||||
|
||||
function phpbb_module_warn_url($mode, $module_row)
|
||||
@ -43,34 +43,18 @@ function phpbb_module_warn_url($mode, $module_row)
|
||||
if ($mode == 'front' || $mode == 'list')
|
||||
{
|
||||
global $forum_id;
|
||||
|
||||
return ($forum_id) ? "&f=$forum_id" : '';
|
||||
return phpbb_extra_url();
|
||||
}
|
||||
|
||||
if ($mode == 'warn_post')
|
||||
{
|
||||
global $forum_id, $post_id;
|
||||
|
||||
if ($post_id)
|
||||
{
|
||||
$url_extra = "&p=$post_id";
|
||||
}
|
||||
else if ($forum_id)
|
||||
{
|
||||
$url_extra = "&f=$forum_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_extra = '';
|
||||
}
|
||||
|
||||
return $url_extra;
|
||||
return phpbb_extra_url();
|
||||
}
|
||||
else
|
||||
{
|
||||
global $user_id;
|
||||
|
||||
return ($user_id) ? "&u=$user_id" : '';
|
||||
return phpbb_extra_url();
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,30 +83,34 @@ function phpbb_module_reports_url($mode, $module_row)
|
||||
return phpbb_extra_url();
|
||||
}
|
||||
|
||||
function phpbb_extra_url()
|
||||
/**
|
||||
* Generate URL parameters for MCP modules
|
||||
*
|
||||
* @param array $additional_parameters Array with additional parameters in format of ['key' => 'parameter_name']
|
||||
*
|
||||
* @return string String with URL parameters (empty string if not any)
|
||||
*/
|
||||
function phpbb_extra_url($additional_parameters = [])
|
||||
{
|
||||
global $forum_id, $topic_id, $post_id, $report_id, $user_id;
|
||||
$url_extra = [];
|
||||
$url_parameters = array_merge([
|
||||
'f' => 'forum_id',
|
||||
't' => 'topic_id',
|
||||
'p' => 'post_id',
|
||||
'r' => 'report_id',
|
||||
'u' => 'user_id',
|
||||
], $additional_parameters);
|
||||
|
||||
if ($post_id)
|
||||
foreach ($url_parameters as $key => $value)
|
||||
{
|
||||
$url_extra = "&p=$post_id";
|
||||
global $$value;
|
||||
if (isset($$value) && $parameter = $$value)
|
||||
{
|
||||
$url_extra[] = "$key=$parameter";
|
||||
}
|
||||
}
|
||||
else if ($topic_id)
|
||||
{
|
||||
$url_extra = "&t=$topic_id";
|
||||
}
|
||||
else if ($forum_id)
|
||||
{
|
||||
$url_extra = "&f=$forum_id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_extra = '';
|
||||
}
|
||||
$url_extra .= ($user_id) ? "&u=$user_id" : '';
|
||||
$url_extra .= ($report_id) ? "&r=$report_id" : '';
|
||||
|
||||
return $url_extra;
|
||||
return implode('&', $url_extra);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -662,7 +662,7 @@ class p_master
|
||||
// Add url_extra parameter to u_action url
|
||||
if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra'])
|
||||
{
|
||||
$this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra'];
|
||||
$this->module->u_action .= '&' . $this->module_ary[$this->active_module_row_id]['url_extra'];
|
||||
}
|
||||
|
||||
// Assign the module path for re-usage
|
||||
@ -920,7 +920,7 @@ class p_master
|
||||
}
|
||||
|
||||
// Was not allowed in categories before - /*!$item_ary['cat'] && */
|
||||
$u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : '';
|
||||
$u_title .= (isset($item_ary['url_extra']) && $item_ary['url_extra']) ? '&' . $item_ary['url_extra'] : '';
|
||||
|
||||
// Only output a categories items if it's currently selected
|
||||
if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($this->module_cache['parents'])) || $item_ary['parent'] == $this->p_parent)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user