set_filenames(array( "body" => "admin/logs_body.tpl") ); $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; if ( isset($HTTP_POST_VARS['order']) ) { $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC'; } else if ( isset($HTTP_GET_VARS['order']) ) { $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC'; } else { $sort_order = 'ASC'; } if ( file_exists($phpbb_root_path . 'log_actions_db_update.' . $phpEx) ) { message_die(GENERAL_MESSAGE, $lang['File_not_deleted']); } $sql = "SELECT config_value AS all_admin FROM " . LOGS_CONFIG_TABLE . " WHERE config_name = 'all_admin' "; if(!$result = $db->sql_query($sql)) { message_die(CRITICAL_ERROR, "Could not query log config informations", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $all_admin_authorized = $row['all_admin']; //if ( $all_admin_authorized == '0' && $userdata['user_id'] <> '2' && $userdata['user_view_log'] <> '1' ) //{ // message_die(GENERAL_MESSAGE, $lang['Admin_not_authorized']); //} // // Logs sorting // $mode_types_text = array('Time', 'Member', 'Action', 'Id'); $mode_types = array('time', 'username', 'mode', 'id'); $select_sort_mode = ''; $select_sort_order = ''; $template->assign_vars(array( 'L_LOG_ACTIONS_TITLE' => $lang['Log_action_title'], 'L_LOG_ACTION_EXPLAIN' => $lang['Log_action_explain'], 'L_CHOOSE_SORT' => $lang['Choose_sort_method'], 'L_ORDER' => $lang['Order'], 'L_GO' => $lang['Go'], 'L_CANCEL' => $lang['Cancel'], 'L_DELETE' => $lang['Delete'], 'L_DELETE_LOG' => $lang['Choose_log'], 'L_ID_LOG' => $lang['Id_log'], 'L_ACTION' => $lang['Action'], 'L_TOPIC' => $lang['Topic'], 'L_DONE_BY' => $lang['Done_by'], 'L_USER_IP' => $lang['User_ip'], 'L_DATE' => $lang['Date'], 'L_MARK_ALL' => $lang['Select_all'], 'L_UNMARK_ALL' => $lang['Unselect_all'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, 'S_MODE_ACTION' => append_sid("admin_logs.$phpEx"), 'S_CANCEL_ACTION' => append_sid("admin_logs.$phpEx")) ); if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) { $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; switch( $mode ) { case 'mode' : $order_by = "mode $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; case 'username' : $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; case 'time' : $order_by = "time $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; case 'id' : $order_by = "id_log $sort_order LIMIT $start, " . $board_config['topics_per_page']; break; default: $order_by = "time DESC LIMIT $start, " . $board_config['topics_per_page']; break; } } else { $order_by = "time DESC LIMIT $start, " . $board_config['topics_per_page']; } $sql = "SELECT * FROM " . LOGS_TABLE . " ORDER BY $order_by "; if(!$result = $db->sql_query($sql)) { message_die(CRITICAL_ERROR, "Could not query log informations", "", __LINE__, __FILE__, $sql); } $rows = $db->sql_fetchrowset($result); $numrows = $db->sql_numrows($result); for ($i = 0; $i < $numrows; $i++) { $id_log = $rows[$i]['id_log']; $action = ucfirst($rows[$i]['mode']); $topic = $rows[$i]['topic_id']; $user_id = $rows[$i]['user_id']; $username = $rows[$i]['username']; $user_ip = decode_ip($rows[$i]['user_ip']); $date = $rows[$i]['time']; $sql = "SELECT user_level FROM " . USERS_TABLE . " WHERE user_id = $user_id"; if(!$result = $db->sql_query($sql)) { message_die(CRITICAL_ERROR, "Could not query user_level informations", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $level = $row['user_level']; $style_color = ''; if ( $level == ADMIN ) { $style_color = 'style="color:#' . $theme['fontcolor3'] . '"'; } else if ( $level == MOD ) { $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; } $temp_url = append_sid('admin_users.'.$phpEx.'?mode=edit&u=' . $user_id); $temp2_url = ('./../../../modules.php?name=Forums&file=viewtopic&t=' . $topic); $template->assign_block_vars('record_row', array( 'ID_LOG' => $id_log, 'ACTION' => $action, 'TOPIC' => $topic, 'TOPIC_IMG' => '' . $lang['See_topic'] . '', 'USER_ID' => $user_id, 'USERNAME' => '' . $username . '', 'USER_IP' => $user_ip, 'U_WHOIS_IP' => 'http://network-tools.com/default.asp?prog=express&Netnic=whois.arin.net&host=' . $user_ip, 'DATE' => create_date($board_config['default_dateformat'], $date, $board_config['board_timezone'])) ); } $db->sql_freeresult($result); $log_list = ( isset($HTTP_POST_VARS['log_list']) ) ? $HTTP_POST_VARS['log_list'] : array(); $delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE ; $log_list_sql = implode(', ', $log_list); if ( $log_list_sql != '' ) { if ( $delete ) { $sql = "DELETE FROM " . LOGS_TABLE . " WHERE id_log IN (" . $log_list_sql . ")"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete Logs', '', __LINE__, __FILE__, $sql); } else { $redirect_page = append_sid("admin_logs.$phpEx"); $l_redirect = sprintf($lang['Click_return_admin_log'], '', ''); message_die(GENERAL_MESSAGE, $lang['Log_delete'] . '

' . $l_redirect); } } } if ( $board_config['topics_per_page'] > 10 ) { $sql = "SELECT count(*) AS total FROM " . LOGS_TABLE; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error getting total informations for logs', '', __LINE__, __FILE__, $sql); } if ( $total = $db->sql_fetchrow($result) ) { $total_records = $total['total']; $pagination = generate_pagination("admin_logs.$phpEx?mode=$mode&order=$sort_order", $total_records, $board_config['topics_per_page'], $start). ' '; } } else { $pagination = ' '; $total_records = 10; } $template->assign_vars(array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => ( $total_records == '0' ) ? ' ' : sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_records / $board_config['topics_per_page'] )), 'L_GOTO_PAGE' => $lang['Goto_page'], 'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '', ''), 'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '', ''),) ); $template->pparse("body"); include('./page_footer_admin.'.$phpEx); ?>