Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: adminlog.php 5016 2010-06-12 00:24:02Z RyanGordon $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 33 | Zeile 33 |
---|
if($mybb->input['action'] == 'prune') { $plugins->run_hooks("admin_tools_adminlog_prune");
|
if($mybb->input['action'] == 'prune') { $plugins->run_hooks("admin_tools_adminlog_prune");
|
|
|
if(!is_super_admin($mybb->user['uid'])) { flash_message($lang->cannot_perform_action_super_admin_general, 'error');
|
if(!is_super_admin($mybb->user['uid'])) { flash_message($lang->cannot_perform_action_super_admin_general, 'error');
|
admin_redirect("index.php?module=tools-adminlog");
| admin_redirect("index.php?module=tools-adminlog");
|
} if($mybb->request_method == 'post') { $where = 'dateline < '.(TIME_NOW-(intval($mybb->input['older_than'])*86400));
|
} if($mybb->request_method == 'post') { $where = 'dateline < '.(TIME_NOW-(intval($mybb->input['older_than'])*86400));
|
|
|
// Searching for entries by a particular user if($mybb->input['uid']) { $where .= " AND uid='".intval($mybb->input['uid'])."'"; }
|
// Searching for entries by a particular user if($mybb->input['uid']) { $where .= " AND uid='".intval($mybb->input['uid'])."'"; }
|
|
|
// Searching for entries in a specific module if($mybb->input['filter_module']) { $where .= " AND module='".$db->escape_string($mybb->input['filter_module'])."'"; }
|
// Searching for entries in a specific module if($mybb->input['filter_module']) { $where .= " AND module='".$db->escape_string($mybb->input['filter_module'])."'"; }
|
|
|
$query = $db->delete_query("adminlog", $where); $num_deleted = $db->affected_rows();
|
$query = $db->delete_query("adminlog", $where); $num_deleted = $db->affected_rows();
|
|
|
$plugins->run_hooks("admin_tools_adminlog_prune_commit");
|
$plugins->run_hooks("admin_tools_adminlog_prune_commit");
|
|
|
// Log admin action log_admin_action($mybb->input['older_than'], $mybb->input['uid'], $mybb->input['filter_module'], $num_deleted);
| // Log admin action log_admin_action($mybb->input['older_than'], $mybb->input['uid'], $mybb->input['filter_module'], $num_deleted);
|
Zeile 69 | Zeile 69 |
---|
$page->add_breadcrumb_item($lang->prune_admin_logs, "index.php?module=tools-adminlog&action=prune"); $page->output_header($lang->prune_admin_logs); $page->output_nav_tabs($sub_tabs, 'prune_admin_logs');
|
$page->add_breadcrumb_item($lang->prune_admin_logs, "index.php?module=tools-adminlog&action=prune"); $page->output_header($lang->prune_admin_logs); $page->output_nav_tabs($sub_tabs, 'prune_admin_logs');
|
// Fetch filter options $sortbysel[$mybb->input['sortby']] = 'selected="selected"'; $ordersel[$mybb->input['order']] = 'selected="selected"'; $user_options[''] = $lang->all_administrators; $user_options['0'] = '----------'; $query = $db->query(" SELECT DISTINCT l.uid, u.username FROM ".TABLE_PREFIX."adminlog l LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid) ORDER BY u.username ASC "); while($user = $db->fetch_array($query)) { $user_options[$user['uid']] = $user['username']; }
$module_options = array(); $module_options[''] = $lang->all_modules; $module_options['0'] = '----------'; $query = $db->query(" SELECT DISTINCT l.module FROM ".TABLE_PREFIX."adminlog l ORDER BY l.module ASC
| // Fetch filter options $sortbysel[$mybb->input['sortby']] = 'selected="selected"'; $ordersel[$mybb->input['order']] = 'selected="selected"';
$user_options[''] = $lang->all_administrators; $user_options['0'] = '----------';
$query = $db->query(" SELECT DISTINCT l.uid, u.username FROM ".TABLE_PREFIX."adminlog l LEFT JOIN ".TABLE_PREFIX."users u ON (l.uid=u.uid) ORDER BY u.username ASC "); while($user = $db->fetch_array($query)) { $user_options[$user['uid']] = $user['username']; }
$module_options = array(); $module_options[''] = $lang->all_modules; $module_options['0'] = '----------'; $query = $db->query(" SELECT DISTINCT l.module FROM ".TABLE_PREFIX."adminlog l ORDER BY l.module ASC
|
"); while($module = $db->fetch_array($query)) { $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module'])));
|
"); while($module = $db->fetch_array($query)) { $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module'])));
|
}
| }
|
$form = new Form("index.php?module=tools-adminlog&action=prune", "post"); $form_container = new FormContainer($lang->prune_administrator_logs);
|
$form = new Form("index.php?module=tools-adminlog&action=prune", "post"); $form_container = new FormContainer($lang->prune_administrator_logs);
|
$form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module');
| $form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module');
|
$form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid'); if(!$mybb->input['older_than']) {
| $form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid'); if(!$mybb->input['older_than']) {
|
Zeile 114 | Zeile 114 |
---|
$buttons[] = $form->generate_submit_button($lang->prune_administrator_logs); $form->output_submit_wrapper($buttons); $form->end();
|
$buttons[] = $form->generate_submit_button($lang->prune_administrator_logs); $form->output_submit_wrapper($buttons); $form->end();
|
|
|
$page->output_footer(); }
if(!$mybb->input['action']) { $plugins->run_hooks("admin_tools_adminlog_start");
|
$page->output_footer(); }
if(!$mybb->input['action']) { $plugins->run_hooks("admin_tools_adminlog_start");
|
|
|
$page->output_header($lang->admin_logs); $page->output_nav_tabs($sub_tabs, 'admin_logs');
|
$page->output_header($lang->admin_logs); $page->output_nav_tabs($sub_tabs, 'admin_logs');
|
|
|
$perpage = intval($mybb->input['perpage']); if(!$perpage) {
| $perpage = intval($mybb->input['perpage']); if(!$perpage) {
|
Zeile 138 | Zeile 138 |
---|
{ $where .= " AND l.uid='".intval($mybb->input['uid'])."'"; }
|
{ $where .= " AND l.uid='".intval($mybb->input['uid'])."'"; }
|
|
|
// Searching for entries in a specific module if($mybb->input['filter_module']) {
| // Searching for entries in a specific module if($mybb->input['filter_module']) {
|
Zeile 167 | Zeile 167 |
---|
WHERE 1=1 {$where} "); $rescount = $db->fetch_field($query, "count");
|
WHERE 1=1 {$where} "); $rescount = $db->fetch_field($query, "count");
|
|
|
// Figure out if we need to display multiple pages. if($mybb->input['page'] != "last") { $pagecnt = intval($mybb->input['page']);
|
// Figure out if we need to display multiple pages. if($mybb->input['page'] != "last") { $pagecnt = intval($mybb->input['page']);
|
}
| }
|
$postcount = intval($rescount); $pages = $postcount / $perpage; $pages = ceil($pages);
|
$postcount = intval($rescount); $pages = $postcount / $perpage; $pages = ceil($pages);
|
|
|
if($mybb->input['page'] == "last") { $pagecnt = $pages;
|
if($mybb->input['page'] == "last") { $pagecnt = $pages;
|
}
| }
|
if($pagecnt > $pages)
|
if($pagecnt > $pages)
|
{ $pagecnt = 1; }
| { $pagecnt = 1; }
|
if($pagecnt) {
| if($pagecnt) {
|
Zeile 197 | Zeile 197 |
---|
$start = 0; $pagecnt = 1; }
|
$start = 0; $pagecnt = 1; }
|
|
|
$table = new Table; $table->construct_header($lang->username, array('width' => '10%')); $table->construct_header($lang->date, array('class' => 'align_center', 'width' => '15%'));
| $table = new Table; $table->construct_header($lang->username, array('width' => '10%')); $table->construct_header($lang->date, array('class' => 'align_center', 'width' => '15%'));
|
Zeile 206 | Zeile 206 |
---|
$query = $db->query(" SELECT l.*, u.username, u.usergroup, u.displaygroup
|
$query = $db->query(" SELECT l.*, u.username, u.usergroup, u.displaygroup
|
FROM ".TABLE_PREFIX."adminlog l
| FROM ".TABLE_PREFIX."adminlog l
|
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid) WHERE 1=1 {$where} ORDER BY {$sortby} {$order}
| LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=l.uid) WHERE 1=1 {$where} ORDER BY {$sortby} {$order}
|
Zeile 218 | Zeile 218 |
---|
$logitem['dateline'] = date("jS M Y, G:i", $logitem['dateline']); $trow = alt_trow(); $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']);
|
$logitem['dateline'] = date("jS M Y, G:i", $logitem['dateline']); $trow = alt_trow(); $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']);
|
$logitem['profilelink'] = build_profile_link($username, $logitem['uid']);
| $logitem['profilelink'] = build_profile_link($username, $logitem['uid'], "_blank");
|
$logitem['data'] = unserialize($logitem['data']);
|
$logitem['data'] = unserialize($logitem['data']);
|
|
|
// Get detailed information from meta $information = get_admin_log_action($logitem);
|
// Get detailed information from meta $information = get_admin_log_action($logitem);
|
|
|
$table->construct_cell($logitem['profilelink']); $table->construct_cell($logitem['dateline'], array('class' => 'align_center')); $table->construct_cell($information); $table->construct_cell($logitem['ipaddress'], array('class' => 'align_center')); $table->construct_row(); }
|
$table->construct_cell($logitem['profilelink']); $table->construct_cell($logitem['dateline'], array('class' => 'align_center')); $table->construct_cell($information); $table->construct_cell($logitem['ipaddress'], array('class' => 'align_center')); $table->construct_row(); }
|
|
|
if($table->num_rows() == 0) { $table->construct_cell($lang->no_adminlogs, array('colspan' => '4')); $table->construct_row(); }
|
if($table->num_rows() == 0) { $table->construct_cell($lang->no_adminlogs, array('colspan' => '4')); $table->construct_row(); }
|
|
|
$table->output($lang->admin_logs);
|
$table->output($lang->admin_logs);
|
|
|
// Do we need to construct the pagination? if($rescount > $perpage) { echo draw_admin_pagination($pagecnt, $perpage, $rescount, "index.php?module=tools-adminlog&perpage=$perpage&uid={$mybb->input['uid']}&fid={$mybb->input['fid']}&sortby={$mybb->input['sortby']}&order={$order}&filter_module=".htmlspecialchars_uni($mybb->input['filter_module']))."<br />"; }
|
// Do we need to construct the pagination? if($rescount > $perpage) { echo draw_admin_pagination($pagecnt, $perpage, $rescount, "index.php?module=tools-adminlog&perpage=$perpage&uid={$mybb->input['uid']}&fid={$mybb->input['fid']}&sortby={$mybb->input['sortby']}&order={$order}&filter_module=".htmlspecialchars_uni($mybb->input['filter_module']))."<br />"; }
|
|
|
// Fetch filter options $sortbysel[$mybb->input['sortby']] = 'selected="selected"'; $ordersel[$mybb->input['order']] = 'selected="selected"';
|
// Fetch filter options $sortbysel[$mybb->input['sortby']] = 'selected="selected"'; $ordersel[$mybb->input['order']] = 'selected="selected"';
|
|
|
$user_options[''] = $lang->all_administrators; $user_options['0'] = '----------';
|
$user_options[''] = $lang->all_administrators; $user_options['0'] = '----------';
|
|
|
$query = $db->query(" SELECT DISTINCT l.uid, u.username FROM ".TABLE_PREFIX."adminlog l
| $query = $db->query(" SELECT DISTINCT l.uid, u.username FROM ".TABLE_PREFIX."adminlog l
|
Zeile 275 | Zeile 275 |
---|
{ $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module']))); }
|
{ $module_options[$module['module']] = str_replace(' ', ' -> ', ucwords(str_replace('/', ' ', $module['module']))); }
|
|
|
$sort_by = array( 'dateline' => $lang->date, 'username' => $lang->username );
|
$sort_by = array( 'dateline' => $lang->date, 'username' => $lang->username );
|
|
|
$order_array = array( 'asc' => $lang->asc, 'desc' => $lang->desc
| $order_array = array( 'asc' => $lang->asc, 'desc' => $lang->desc
|
Zeile 288 | Zeile 288 |
---|
$form = new Form("index.php?module=tools-adminlog", "post"); $form_container = new FormContainer($lang->filter_administrator_logs);
|
$form = new Form("index.php?module=tools-adminlog", "post"); $form_container = new FormContainer($lang->filter_administrator_logs);
|
$form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module'); $form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid'); $form_container->output_row($lang->sort_by, "", $form->generate_select_box('sortby', $sort_by, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $order_array, $order, array('id' => 'order'))." {$lang->order}", 'order'); $form_container->output_row($lang->results_per_page, "", $form->generate_text_box('perpage', $perpage, array('id' => 'perpage')), 'perpage');
| $form_container->output_row($lang->module, "", $form->generate_select_box('filter_module', $module_options, $mybb->input['filter_module'], array('id' => 'filter_module')), 'filter_module'); $form_container->output_row($lang->administrator, "", $form->generate_select_box('uid', $user_options, $mybb->input['uid'], array('id' => 'uid')), 'uid'); $form_container->output_row($lang->sort_by, "", $form->generate_select_box('sortby', $sort_by, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $order_array, $order, array('id' => 'order'))." {$lang->order}", 'order'); $form_container->output_row($lang->results_per_page, "", $form->generate_text_box('perpage', $perpage, array('id' => 'perpage')), 'perpage');
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->filter_administrator_logs); $form->output_submit_wrapper($buttons); $form->end();
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->filter_administrator_logs); $form->output_submit_wrapper($buttons); $form->end();
|
|
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 309 | Zeile 309 |
---|
function get_admin_log_action($logitem) { global $lang, $plugins, $mybb;
|
function get_admin_log_action($logitem) { global $lang, $plugins, $mybb;
|
|
|
$logitem['module'] = str_replace('/', '-', $logitem['module']); list($module, $action) = explode('-', $logitem['module']); $lang_string = 'admin_log_'.$module.'_'.$action.'_'.$logitem['action'];
|
$logitem['module'] = str_replace('/', '-', $logitem['module']); list($module, $action) = explode('-', $logitem['module']); $lang_string = 'admin_log_'.$module.'_'.$action.'_'.$logitem['action'];
|
|
|
// Specific page overrides switch($lang_string) {
| // Specific page overrides switch($lang_string) {
|
Zeile 325 | Zeile 325 |
---|
case 1: $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_ip'; break;
|
case 1: $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_ip'; break;
|
case 2:
| case 2:
|
$lang_string = 'admin_log_config_banning_'.$logitem['action'].'_username'; break; case 3: $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_email'; break;
|
$lang_string = 'admin_log_config_banning_'.$logitem['action'].'_username'; break; case 3: $lang_string = 'admin_log_config_banning_'.$logitem['action'].'_email'; break;
|
}
| }
|
break;
|
break;
|
|
|
case 'admin_log_config_help_documents_add': // Help documents and sections case 'admin_log_config_help_documents_edit': case 'admin_log_config_help_documents_delete': $lang_string .= "_{$logitem['data'][2]}"; // adds _section or _document break;
|
case 'admin_log_config_help_documents_add': // Help documents and sections case 'admin_log_config_help_documents_edit': case 'admin_log_config_help_documents_delete': $lang_string .= "_{$logitem['data'][2]}"; // adds _section or _document break;
|
|
|
case 'admin_log_config_languages_edit': // Editing language variables $logitem['data'][1] = basename($logitem['data'][1]); if($logitem['data'][2] == 1)
| case 'admin_log_config_languages_edit': // Editing language variables $logitem['data'][1] = basename($logitem['data'][1]); if($logitem['data'][2] == 1)
|
Zeile 347 | Zeile 347 |
---|
$lang_string = 'admin_log_config_languages_edit_admin'; } break;
|
$lang_string = 'admin_log_config_languages_edit_admin'; } break;
|
|
|
case 'admin_log_config_mycode_toggle_status': // Custom MyCode toggle activation if($logitem['data'][2] == 1) {
| case 'admin_log_config_mycode_toggle_status': // Custom MyCode toggle activation if($logitem['data'][2] == 1) {
|
Zeile 388 | Zeile 388 |
---|
$lang_string .= $logitem['data'][0]; if($logitem['data'][0] == 'orders' && $logitem['data'][1]) {
|
$lang_string .= $logitem['data'][0]; if($logitem['data'][0] == 'orders' && $logitem['data'][1]) {
|
$lang_string .= '_sub'; // updating forum orders in a subforum
| $lang_string .= '_sub'; // updating forum orders in a subforum
|
} break; case 'admin_log_forum_moderation_queue_': //moderation queue
| } break; case 'admin_log_forum_moderation_queue_': //moderation queue
|
Zeile 445 | Zeile 445 |
---|
{ $lang_string = 'admin_log_tools_backupdb_backup_download'; }
|
{ $lang_string = 'admin_log_tools_backupdb_backup_download'; }
|
| $logitem['data'][1] = '...'.substr($logitem['data'][1], -20); break; case 'admin_log_tools_backupdb_dlbackup': // Download backup $logitem['data'][0] = '...'.substr($logitem['data'][0], -20); break; case 'admin_log_tools_backupdb_delete': // Delete backup $logitem['data'][0] = '...'.substr($logitem['data'][0], -20);
|
break; case 'admin_log_tools_optimizedb_': // Optimize DB $logitem['data'][0] = @implode(', ', unserialize($logitem['data'][0]));
| break; case 'admin_log_tools_optimizedb_': // Optimize DB $logitem['data'][0] = @implode(', ', unserialize($logitem['data'][0]));
|
Zeile 457 | Zeile 464 |
---|
} break; // == USERS ==
|
} break; // == USERS ==
|
case 'admin_log_user_admin_permissions_edit': // default/group/user admin permissions
| case 'admin_log_user_admin_permissions_edit': // editing default/group/user admin permissions if($logitem['data'][0] > 0) { // User $lang_string .= '_user'; } elseif($logitem['data'][0] < 0) { // Group $logitem['data'][0] = abs($logitem['data'][0]); $lang_string .= '_group'; } break; case 'admin_log_user_admin_permissions_delete': // deleting group/user admin permissions
|
if($logitem['data'][0] > 0) { // User $lang_string .= '_user'; } elseif($logitem['data'][0] < 0)
|
if($logitem['data'][0] > 0) { // User $lang_string .= '_user'; } elseif($logitem['data'][0] < 0)
|
{
| {
|
// Group $logitem['data'][0] = abs($logitem['data'][0]); $lang_string .= '_group';
| // Group $logitem['data'][0] = abs($logitem['data'][0]); $lang_string .= '_group';
|
Zeile 474 | Zeile 494 |
---|
if($logitem['data'][2] == 0) { $lang_string = 'admin_log_user_banning_add_permanent';
|
if($logitem['data'][2] == 0) { $lang_string = 'admin_log_user_banning_add_permanent';
|
} else {
| } else {
|
$logitem['data'][2] = my_date($mybb->settings['dateformat'], $logitem['data'][2]); $lang_string = 'admin_log_user_banning_add_temporary';
|
$logitem['data'][2] = my_date($mybb->settings['dateformat'], $logitem['data'][2]); $lang_string = 'admin_log_user_banning_add_temporary';
|
| } break; case 'admin_log_user_groups_join_requests': if($logitem['data'][0] == 'approve') { $lang_string = 'admin_log_user_groups_join_requests_approve'; } else { $lang_string = 'admin_log_user_groups_join_requests_deny';
|
} break; case 'admin_log_user_users_inline_banned':
| } break; case 'admin_log_user_users_inline_banned':
|
Zeile 493 | Zeile 523 |
---|
} break; }
|
} break; }
|
|
|
$plugin_array = array('logitem' => &$logitem, 'lang_string' => &$lang_string);
|
$plugin_array = array('logitem' => &$logitem, 'lang_string' => &$lang_string);
|
$plugins->run_hooks_by_ref("admin_tools_get_admin_log_action", $plugin_array);
| $plugins->run_hooks("admin_tools_get_admin_log_action", $plugin_array);
|
if(isset($lang->$lang_string)) { array_unshift($logitem['data'], $lang->$lang_string); // First parameter for sprintf is the format string
| if(isset($lang->$lang_string)) { array_unshift($logitem['data'], $lang->$lang_string); // First parameter for sprintf is the format string
|