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
This commit is contained in:
Ruslan Uzdenov 2009-06-18 11:43:16 +00:00
parent 7bee180a78
commit a4e817e322
4 changed files with 18 additions and 13 deletions

View file

@ -116,6 +116,7 @@
<li>[Fix] Do not display birthdays of banned users (Bug #20625 - Patch by nickvergessen)</li>
<li>[Fix] Fix function to recalculate Nested Sets (Bug #41555 - Patch by EXreaction)</li>
<li>[Fix] Display and highlight already used rank images while assigning new rank (Bug #22665 - Patch by nickvergessen)</li>
<li>[Fix] Do not display &quot;View user notes&quot; and &quot;Warn user&quot; links in user profile if corresponding MCP modules are disabled. (Bug #10519 - Patch by rxu)</li>
<li>[Fix] Empty error message in UCP folder management when creating folder without name (Bug #39875 - Patch by nickvergessen)</li>
<li>[Fix] Wrong description in UCP group managment implicates missing feature (Bug #19945 - Patch by nickvergessen)</li>
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>

View file

@ -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);
include($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;
$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&amp;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&amp;add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
'U_ADD_FOE' => (!$foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&amp;mode=foes&amp;add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',

View file

@ -80,7 +80,7 @@
<dt>{L_VISITED}:</dt> <dd>{VISITED}</dd>
<!-- IF U_NOTES or U_WARN -->
<dt>{L_WARNINGS}: </dt>
<dd><strong>{WARNINGS}</strong> [ <a href="{U_NOTES}">{L_VIEW_NOTES}</a> <!-- IF U_WARN --> | <a href="{U_WARN}">{L_WARN_USER}</a> <!-- ENDIF -->]</dd>
<dd><strong>{WARNINGS}</strong><!-- IF S_USER_NOTES or S_WARN_USER --> [ <!-- IF S_USER_NOTES --><a href="{U_NOTES}">{L_VIEW_NOTES}</a><!-- ENDIF --> <!-- IF U_WARN and S_WARN_USER --><!-- IF S_USER_NOTES --> | <!-- ENDIF --><a href="{U_WARN}">{L_WARN_USER}</a><!-- ENDIF --> ]<!-- ENDIF --><!-- ENDIF --></dd>
<!-- ENDIF -->
<dt>{L_TOTAL_POSTS}:</dt>
<dd>{POSTS} | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></strong>

View file

@ -69,7 +69,7 @@
<!-- IF U_NOTES or U_WARN -->
<tr>
<td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_WARNINGS}: </td>
<td width="100%"><b class="gen">{WARNINGS}</b><br /><span class="genmed">[ <a href="{U_NOTES}">{L_VIEW_NOTES}</a> <!-- IF U_WARN --> | <a href="{U_WARN}">{L_WARN_USER}</a> <!-- ENDIF -->]</span></td>
<td width="100%"><b class="gen">{WARNINGS}</b><br /><span class="genmed"><!-- IF S_USER_NOTES or S_WARN_USER --> [ <!-- IF S_USER_NOTES --><a href="{U_NOTES}">{L_VIEW_NOTES}</a><!-- ENDIF --> <!-- IF U_WARN and S_WARN_USER --><!-- IF S_USER_NOTES --> | <!-- ENDIF --><a href="{U_WARN}">{L_WARN_USER}</a><!-- ENDIF --> ]<!-- ENDIF --></span></td>
</tr>
<!-- ENDIF -->
<tr>