1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

Logging + fixes for user/group permission setting

git-svn-id: file:///svn/phpbb/trunk@3837 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-04-15 18:05:47 +00:00
parent 0c7c2f711f
commit 93cb1853b5
2 changed files with 82 additions and 14 deletions

View File

@ -202,8 +202,7 @@ switch ($submit)
$forum_id[$mode] = array_merge($forum_id[$mode], array_map('intval', $_POST['inherit'])); $forum_id[$mode] = array_merge($forum_id[$mode], array_map('intval', $_POST['inherit']));
} }
// Update the permission set ... we loop through each auth setting // Update the permission set ... we loop through each auth setting array
// array
foreach ($auth_settings as $auth_submode => $auth_setting) foreach ($auth_settings as $auth_submode => $auth_setting)
{ {
// Are any entries * ? If so we need to remove them since they // Are any entries * ? If so we need to remove them since they
@ -223,15 +222,14 @@ switch ($submit)
if (sizeof($auth_setting)) if (sizeof($auth_setting))
{ {
// Loop through all user/group ids
foreach ($ug_data as $id) foreach ($ug_data as $id)
{ {
$auth_admin->acl_set($ug_type, $forum_id[$auth_submode], $id, $auth_setting); $auth_admin->acl_set($ug_type, $forum_id[$auth_submode], intval($id), $auth_setting);
} }
} }
} }
}
unset($auth_submode);
unset($auth_setting);
// Do we need to recache the moderator lists? We do if the mode // Do we need to recache the moderator lists? We do if the mode
// was mod or auth_settings['mod'] is a non-zero size array // was mod or auth_settings['mod'] is a non-zero size array
@ -240,6 +238,28 @@ switch ($submit)
cache_moderators(); cache_moderators();
} }
// Logging ... first grab user or groupnames ...
$sql = ($ug_type == 'group') ? 'SELECT group_name as name FROM ' . GROUPS_TABLE . ' WHERE group_id' : 'SELECT username as name FROM ' . USERS_TABLE . ' WHERE user_id';
$sql .= ' IN (' . implode(', ', array_map('intval', $ug_data)) . ')';
$result = $db->sql_query($sql);
$l_ug_list = '';
while ($row = $db->sql_fetchrow($result))
{
$l_ug_list .= (($ug_list != '') ? ', ' : '') . $row['name'];
}
$db->sql_freeresult($result);
foreach (array_keys($auth_settings) as $submode)
{
add_log('admin', 'LOG_ACL_' . strtoupper($submode) . '_ADD', $l_ug_list);
}
unset($l_ug_list);
}
unset($auth_submode);
unset($auth_setting);
trigger_error($user->lang['AUTH_UPDATED']); trigger_error($user->lang['AUTH_UPDATED']);
break; break;
@ -267,12 +287,35 @@ switch ($submit)
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Do we need to recache the moderator lists? We do if the mode
// was mod or auth_settings['mod'] is a non-zero size array
if ($mode == 'mod' || sizeof($auth_settings['mod']))
{
cache_moderators(); cache_moderators();
}
// Logging ... first grab user or groupnames ...
$sql = ($ug_type == 'group') ? 'SELECT group_name as name FROM ' . GROUPS_TABLE . ' WHERE group_id' : 'SELECT username as name FROM ' . USERS_TABLE . ' WHERE user_id';
$sql .= ' IN (' . implode(', ', array_map('intval', $ug_data)) . ')';
$result = $db->sql_query($sql);
$l_ug_list = '';
while ($row = $db->sql_fetchrow($result))
{
$l_ug_list .= (($ug_list != '') ? ', ' : '') . $row['name'];
}
$db->sql_freeresult($result);
add_log('admin', 'LOG_ACL_' . strtoupper($which_mode) . '_DEL', $l_ug_list);
trigger_error($user->lang['AUTH_UPDATED']); trigger_error($user->lang['AUTH_UPDATED']);
break; break;
case 'presetsave': case 'presetsave':
$holding_ary = array(); $holding_ary = array();
foreach ($auth_settings as $option => $setting) foreach ($auth_settings as $option => $setting)
{ {
@ -309,15 +352,28 @@ switch ($submit)
{ {
$sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . intval($_POST['presetoption']); $sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . intval($_POST['presetoption']);
$db->sql_query($sql); $db->sql_query($sql);
add_log('admin', 'LOG_ACL_PRESET_ADD', $sql['preset_name']);
} }
break; break;
case 'presetdel': case 'presetdel':
if (!empty($_POST['presetoption'])) if (!empty($_POST['presetoption']))
{ {
$sql = "SELECT preset_name
FROM " . ACL_PRESETS_TABLE . "
WHERE preset_id = " . intval($_POST['presetoption']);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$sql = "DELETE FROM " . ACL_PRESETS_TABLE . " $sql = "DELETE FROM " . ACL_PRESETS_TABLE . "
WHERE preset_id = " . intval($_POST['presetoption']); WHERE preset_id = " . intval($_POST['presetoption']);
$db->sql_query($sql); $db->sql_query($sql);
add_log('admin', 'LOG_ACL_PRESET_DEL', $row['preset_name']);
unset($row);
} }
break; break;
} }
@ -370,7 +426,7 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
<th align="center"><?php echo $user->lang['LOOK_UP_USER']; ?></th> <th align="center"><?php echo $user->lang['LOOK_UP_USER']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" align="center"><input type="text" class="post" name="ug_data[]" maxlength="30" size="20" /> <input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_USER']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&amp;mode=searchuser&amp;field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="username" /></td> <td class="row1" align="center"><input type="text" class="post" name="ug_data[]" maxlength="30" size="20" /> <input type="submit" name="submit_add_options" value="<?php echo $user->lang['LOOK_UP_USER']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&amp;mode=searchuser&amp;field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="user" /></td>
</tr> </tr>
<?php <?php
@ -399,7 +455,7 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
<th align="center"><?php echo $user->lang['LOOK_UP_GROUP']; ?></th> <th align="center"><?php echo $user->lang['LOOK_UP_GROUP']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" align="center">&nbsp;<select name="ug_data[]"><?php echo $group_options; ?></select> &nbsp;<input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" />&nbsp;</td> <td class="row1" align="center">&nbsp;<select name="ug_data[]"><?php echo $group_options; ?></select> &nbsp;<input type="submit" name="submit_edit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" />&nbsp;</td>
</tr> </tr>
<?php <?php

View File

@ -126,6 +126,18 @@ $lang = array_merge($lang, array(
'LOG_RESYNC_STATS' => '<b>Post, topic and user stats reset</b>', 'LOG_RESYNC_STATS' => '<b>Post, topic and user stats reset</b>',
'LOG_RESET_DATE' => '<b>Board start date reset</b>', 'LOG_RESET_DATE' => '<b>Board start date reset</b>',
'LOG_RESET_ONLINE' => '<b>Most users online reset</b>', 'LOG_RESET_ONLINE' => '<b>Most users online reset</b>',
'LOG_ACL_MOD_DEL' => '<b>Removed Moderators</b><br />%s',
'LOG_ACL_MOD_ADD' => '<b>Added or edited Moderators</b><br />%s',
'LOG_ACL_SUPERMOD_DEL' => '<b>Removed Super Moderators</b><br />%s',
'LOG_ACL_SUPERMOD_ADD' => '<b>Added or edited Super Moderators</b><br />%s',
'LOG_ACL_ADMIN_DEL' => '<b>Removed Administrators</b><br />%s',
'LOG_ACL_ADMIN_ADD' => '<b>Added or edited Administrators</b><br />%s',
'LOG_ACL_FORUM_DEL' => '<b>Removed Forum access</b><br />%s',
'LOG_ACL_FORUM_ADD' => '<b>Added or edited Forum access</b><br />%s',
'LOG_ACL_USER_ADD' => '<b>Edited User permissions</b><br />%s',
'LOG_ACL_GROUP_ADD' => '<b>Edited Group permissions</b><br />%s',
'LOG_ACL_PRESET_ADD' => '<b>Added or edited permission preset</b><br />%s',
'LOG_ACL_PRESET_DEL' => '<b>Deleted permission preset</b><br />%s',
'RUN_HOW' => 'When to run', 'RUN_HOW' => 'When to run',
'RUN_AS_NOW'=> 'Run now', 'RUN_AS_NOW'=> 'Run now',