From a4e817e32286125ccc3d85a11b0c8e990ab8697a Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Thu, 18 Jun 2009 11:43:16 +0000 Subject: [PATCH] Fix bug #10519 - "View user notes" and "Warn user" links shown even if modules disabled Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9617 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/memberlist.php | 26 +++++++++++-------- .../prosilver/template/memberlist_view.html | 2 +- .../subsilver2/template/memberlist_view.html | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e42d5b6d0c..afa25c6548 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -116,6 +116,7 @@
  • [Fix] Do not display birthdays of banned users (Bug #20625 - Patch by nickvergessen)
  • [Fix] Fix function to recalculate Nested Sets (Bug #41555 - Patch by EXreaction)
  • [Fix] Display and highlight already used rank images while assigning new rank (Bug #22665 - Patch by nickvergessen)
  • +
  • [Fix] Do not display "View user notes" and "Warn user" links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)
  • [Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)
  • [Fix] Wrong description in UCP group managment implicates missing feature (Bug #19945 - Patch by nickvergessen)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 298164be9e..d8e6d99471 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -512,20 +512,22 @@ switch ($mode) $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); } - // We need to check if the module 'zebra' is accessible - $zebra_enabled = false; + // We need to check if the modules 'zebra', 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $user_notes_enabled = $warn_user_enabled = false; - if ($user->data['user_id'] != $user_id && $user->data['is_registered']) + if (!class_exists('p_master')) { - include_once($phpbb_root_path . 'includes/functions_module.' . $phpEx); - $module = new p_master(); - $module->list_modules('ucp'); - $module->set_active('zebra'); - - $zebra_enabled = ($module->active_module === false) ? false : true; - - unset($module); + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); } + $module = new p_master(); + + $module->list_modules('ucp'); + $module->list_modules('mcp'); + $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('zebra')) ? true : false; + + unset($module); // If the user has m_approve permission or a_user permission, then list then display unapproved posts if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) @@ -575,6 +577,8 @@ switch ($mode) 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}") : '', + 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, + 'S_WARN_USER' => ($warn_user_enabled) ? true : false, 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, 'U_ADD_FRIEND' => (!$friend) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 8f2e1734a4..8352583d2a 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -80,7 +80,7 @@
    {L_VISITED}:
    {VISITED}
    {L_WARNINGS}:
    -
    {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
    +
    {WARNINGS} [ {L_VIEW_NOTES} | {L_WARN_USER} ]
    {L_TOTAL_POSTS}:
    {POSTS} | {L_SEARCH_USER_POSTS} diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 15d43e60c1..8cfe4d9276 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -69,7 +69,7 @@ {L_WARNINGS}: - {WARNINGS}
    [ {L_VIEW_NOTES} | {L_WARN_USER} ] + {WARNINGS}
    [ {L_VIEW_NOTES} | {L_WARN_USER} ]