~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/acp/acp_logs.php

  • Committer: William Grant
  • Date: 2009-02-23 23:47:02 UTC
  • mfrom: (1099.1.211 new-dispatch)
  • Revision ID: grantw@unimelb.edu.au-20090223234702-db4b1llly46ignwo
Merge from lp:~ivle-dev/ivle/new-dispatch.

Pretty much everything changes. Reread the setup docs. Backup your databases.
Every file is now in a different installed location, the configuration system
is rewritten, the dispatch system is rewritten, URLs are different, the
database is different, worksheets and exercises are no longer on the
filesystem, we use a templating engine, jail service protocols are rewritten,
we don't repeat ourselves, we have authorization rewritten, phpBB is gone,
and probably lots of other things that I cannot remember.

This is certainly the biggest commit I have ever made, and hopefully
the largest I ever will.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
*
4
 
* @package acp
5
 
* @version $Id: acp_logs.php,v 1.17 2007/10/05 14:36:32 acydburn Exp $
6
 
* @copyright (c) 2005 phpBB Group
7
 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8
 
*
9
 
*/
10
 
 
11
 
/**
12
 
* @ignore
13
 
*/
14
 
if (!defined('IN_PHPBB'))
15
 
{
16
 
        exit;
17
 
}
18
 
 
19
 
/**
20
 
* @package acp
21
 
*/
22
 
class acp_logs
23
 
{
24
 
        var $u_action;
25
 
 
26
 
        function main($id, $mode)
27
 
        {
28
 
                global $db, $user, $auth, $template, $cache;
29
 
                global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
30
 
 
31
 
                $user->add_lang('mcp');
32
 
 
33
 
                // Set up general vars
34
 
                $action         = request_var('action', '');
35
 
                $forum_id       = request_var('f', 0);
36
 
                $start          = request_var('start', 0);
37
 
                $deletemark = (!empty($_POST['delmarked'])) ? true : false;
38
 
                $deleteall      = (!empty($_POST['delall'])) ? true : false;
39
 
                $marked         = request_var('mark', array(0));
40
 
 
41
 
                // Sort keys
42
 
                $sort_days      = request_var('st', 0);
43
 
                $sort_key       = request_var('sk', 't');
44
 
                $sort_dir       = request_var('sd', 'd');
45
 
 
46
 
                $this->tpl_name = 'acp_logs';
47
 
                $this->log_type = constant('LOG_' . strtoupper($mode));
48
 
 
49
 
                // Delete entries if requested and able
50
 
                if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
51
 
                {
52
 
                        if (confirm_box(true))
53
 
                        {
54
 
                                $where_sql = '';
55
 
 
56
 
                                if ($deletemark && sizeof($marked))
57
 
                                {
58
 
                                        $sql_in = array();
59
 
                                        foreach ($marked as $mark)
60
 
                                        {
61
 
                                                $sql_in[] = $mark;
62
 
                                        }
63
 
                                        $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in);
64
 
                                        unset($sql_in);
65
 
                                }
66
 
 
67
 
                                if ($where_sql || $deleteall)
68
 
                                {
69
 
                                        $sql = 'DELETE FROM ' . LOG_TABLE . "
70
 
                                                WHERE log_type = {$this->log_type}
71
 
                                                $where_sql";
72
 
                                        $db->sql_query($sql);
73
 
 
74
 
                                        add_log('admin', 'LOG_CLEAR_' . strtoupper($mode));
75
 
                                }
76
 
                        }
77
 
                        else
78
 
                        {
79
 
                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
80
 
                                        'f'                     => $forum_id,
81
 
                                        'start'         => $start,
82
 
                                        'delmarked'     => $deletemark,
83
 
                                        'delall'        => $deleteall,
84
 
                                        'mark'          => $marked,
85
 
                                        'st'            => $sort_days,
86
 
                                        'sk'            => $sort_key,
87
 
                                        'sd'            => $sort_dir,
88
 
                                        'i'                     => $id,
89
 
                                        'mode'          => $mode,
90
 
                                        'action'        => $action))
91
 
                                );
92
 
                        }
93
 
                }
94
 
 
95
 
                // Sorting
96
 
                $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
97
 
                $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
98
 
                $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
99
 
 
100
 
                $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
101
 
                gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
102
 
 
103
 
                // Define where and sort sql for use in displaying logs
104
 
                $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
105
 
                $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
106
 
 
107
 
                $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
108
 
                $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
109
 
 
110
 
                $this->page_title = $l_title;
111
 
 
112
 
                // Define forum list if we're looking @ mod logs
113
 
                if ($mode == 'mod')
114
 
                {
115
 
                        $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
116
 
                        
117
 
                        $template->assign_vars(array(
118
 
                                'S_SHOW_FORUMS'                 => true,
119
 
                                'S_FORUM_BOX'                   => $forum_box)
120
 
                        );
121
 
                }
122
 
 
123
 
                // Grab log data
124
 
                $log_data = array();
125
 
                $log_count = 0;
126
 
                view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
127
 
 
128
 
                $template->assign_vars(array(
129
 
                        'L_TITLE'               => $l_title,
130
 
                        'L_EXPLAIN'             => $l_title_explain,
131
 
                        'U_ACTION'              => $this->u_action,
132
 
 
133
 
                        'S_ON_PAGE'             => on_page($log_count, $config['topics_per_page'], $start),
134
 
                        'PAGINATION'    => generate_pagination($this->u_action . "&amp;$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
135
 
 
136
 
                        'S_LIMIT_DAYS'  => $s_limit_days,
137
 
                        'S_SORT_KEY'    => $s_sort_key,
138
 
                        'S_SORT_DIR'    => $s_sort_dir,
139
 
                        'S_CLEARLOGS'   => $auth->acl_get('a_clearlogs'),
140
 
                        )
141
 
                );
142
 
 
143
 
                foreach ($log_data as $row)
144
 
                {
145
 
                        $data = array();
146
 
                                
147
 
                        $checks = array('viewtopic', 'viewlogs', 'viewforum');
148
 
                        foreach ($checks as $check)
149
 
                        {
150
 
                                if (isset($row[$check]) && $row[$check])
151
 
                                {
152
 
                                        $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
153
 
                                }
154
 
                        }
155
 
 
156
 
                        $template->assign_block_vars('log', array(
157
 
                                'USERNAME'                      => $row['username_full'],
158
 
                                'REPORTEE_USERNAME'     => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username_full'] : '',
159
 
 
160
 
                                'IP'                            => $row['ip'],
161
 
                                'DATE'                          => $user->format_date($row['time']),
162
 
                                'ACTION'                        => $row['action'],
163
 
                                'DATA'                          => (sizeof($data)) ? implode(' | ', $data) : '',
164
 
                                'ID'                            => $row['id'],
165
 
                                )
166
 
                        );
167
 
                }
168
 
        }
169
 
}
170
 
 
171
 
?>
 
 
b'\\ No newline at end of file'