6
|
1 |
<?php
|
|
2 |
/***********************************************************************
|
|
3 |
|
|
4 |
Copyright (C) 2002-2008 PunBB.org
|
|
5 |
|
|
6 |
This file is part of PunBB.
|
|
7 |
|
|
8 |
PunBB is free software; you can redistribute it and/or modify it
|
|
9 |
under the terms of the GNU General Public License as published
|
|
10 |
by the Free Software Foundation; either version 2 of the License,
|
|
11 |
or (at your option) any later version.
|
|
12 |
|
|
13 |
PunBB is distributed in the hope that it will be useful, but
|
|
14 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 |
GNU General Public License for more details.
|
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License
|
|
19 |
along with this program; if not, write to the Free Software
|
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
21 |
MA 02111-1307 USA
|
|
22 |
|
|
23 |
************************************************************************/
|
|
24 |
|
|
25 |
|
|
26 |
// if (!defined('PUN_ROOT'))
|
|
27 |
// define('PUN_ROOT', '../');
|
|
28 |
// require PUN_ROOT.'include/common.php';
|
|
29 |
require PUN_ROOT.'include/common_admin.php';
|
|
30 |
|
|
31 |
// import globals (I really hope this isn't dangerous)
|
|
32 |
foreach ( $GLOBALS as $key => $_ )
|
|
33 |
{
|
|
34 |
$$key =& $GLOBALS[$key];
|
|
35 |
}
|
|
36 |
|
|
37 |
($hook = get_hook('arp_start')) ? eval($hook) : null;
|
|
38 |
|
|
39 |
if (!$pun_user['is_admmod'])
|
|
40 |
message($lang_common['No permission']);
|
|
41 |
|
|
42 |
// Load the admin.php language file
|
|
43 |
require PUN_ROOT.'lang/'.$pun_user['language'].'/admin.php';
|
|
44 |
$GLOBALS['lang_admin'] = $lang_admin;
|
|
45 |
|
|
46 |
|
|
47 |
// Mark reports as read
|
|
48 |
if (isset($_POST['mark_as_read']))
|
|
49 |
{
|
|
50 |
if (empty($_POST['reports']))
|
|
51 |
message($lang_admin['No reports selected']);
|
|
52 |
|
|
53 |
($hook = get_hook('arp_mark_as_read_form_submitted')) ? eval($hook) : null;
|
|
54 |
|
|
55 |
$reports_to_mark = array_map('intval', array_keys($_POST['reports']));
|
|
56 |
|
|
57 |
$query = array(
|
|
58 |
'UPDATE' => 'reports',
|
|
59 |
'SET' => 'zapped='.time().', zapped_by='.$pun_user['id'],
|
|
60 |
'WHERE' => 'id IN('.implode(',', $reports_to_mark).') AND zapped IS NULL'
|
|
61 |
);
|
|
62 |
|
|
63 |
($hook = get_hook('arp_qr_mark_reports_as_read')) ? eval($hook) : null;
|
|
64 |
$pun_db->query_build($query) or error(__FILE__, __LINE__);
|
|
65 |
|
|
66 |
pun_redirect(pun_link($pun_url['admin_reports']), $lang_admin['Reports marked read'].' '.$lang_admin['Redirect']);
|
|
67 |
}
|
|
68 |
|
|
69 |
$pun_page['fld_count'] = $pun_page['set_count'] = 0;
|
|
70 |
|
|
71 |
// Setup breadcrumbs
|
|
72 |
$pun_page['crumbs'] = array(
|
|
73 |
array($pun_config['o_board_title'], pun_link($pun_url['index'])),
|
|
74 |
array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])),
|
|
75 |
$lang_admin['Reports']
|
|
76 |
);
|
|
77 |
|
|
78 |
($hook = get_hook('arp_pre_header_load')) ? eval($hook) : null;
|
|
79 |
|
|
80 |
define('PUN_PAGE_SECTION', 'management');
|
|
81 |
define('PUN_PAGE', 'admin-reports');
|
|
82 |
require PUN_ROOT.'header.php';
|
|
83 |
|
|
84 |
?>
|
|
85 |
<div id="pun-main" class="main sectioned admin">
|
|
86 |
|
|
87 |
<?php echo generate_admin_menu(); ?>
|
|
88 |
|
|
89 |
<div class="main-head">
|
|
90 |
<h1><span>{ <?php echo end($pun_page['crumbs']) ?> }</span></h1>
|
|
91 |
</div>
|
|
92 |
|
|
93 |
<div class="main-content frm">
|
|
94 |
<div class="frm-head">
|
|
95 |
<h2><span><?php echo $lang_admin['New reports heading'] ?></span></h2>
|
|
96 |
</div>
|
|
97 |
<?php
|
|
98 |
|
|
99 |
// Fetch any unread reports
|
|
100 |
$query = array(
|
|
101 |
'SELECT' => 'r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, t.subject, f.forum_name, u.username AS reporter',
|
|
102 |
'FROM' => 'reports AS r',
|
|
103 |
'JOINS' => array(
|
|
104 |
array(
|
|
105 |
'LEFT JOIN' => 'topics AS t',
|
|
106 |
'ON' => 'r.topic_id=t.id'
|
|
107 |
),
|
|
108 |
array(
|
|
109 |
'LEFT JOIN' => 'forums AS f',
|
|
110 |
'ON' => 'r.forum_id=f.id'
|
|
111 |
),
|
|
112 |
array(
|
|
113 |
'LEFT JOIN' => 'users AS u',
|
|
114 |
'ON' => 'r.reported_by=u.id'
|
|
115 |
)
|
|
116 |
),
|
|
117 |
'WHERE' => 'r.zapped IS NULL',
|
|
118 |
'ORDER BY' => 'r.created DESC'
|
|
119 |
);
|
|
120 |
|
|
121 |
($hook = get_hook('arp_qr_get_new_reports')) ? eval($hook) : null;
|
|
122 |
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
|
|
123 |
if ($pun_db->num_rows($result))
|
|
124 |
{
|
|
125 |
|
|
126 |
?>
|
|
127 |
<form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo pun_link($pun_url['admin_reports']) ?>&action=zap">
|
|
128 |
<div class="hidden">
|
|
129 |
<input type="hidden" name="csrf_token" value="<?php echo generate_form_token(pun_link($pun_url['admin_reports']).'&action=zap') ?>" />
|
|
130 |
</div>
|
|
131 |
<?php
|
|
132 |
|
|
133 |
$pun_page['num_items'] = 0;
|
|
134 |
|
|
135 |
while ($cur_report = $pun_db->fetch_assoc($result))
|
|
136 |
{
|
|
137 |
$reporter = ($cur_report['reporter'] != '') ? '<a href="'.pun_link($pun_url['user'], $cur_report['reported_by']).'">'.htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin['Deleted user'];
|
|
138 |
$forum = ($cur_report['forum_name'] != '') ? '<a href="'.pun_link($pun_url['forum'], $cur_report['forum_id']).'">'.htmlspecialchars($cur_report['forum_name']).'</a>' : $lang_admin['Deleted forum'];
|
|
139 |
$topic = ($cur_report['subject'] != '') ? '<a href="'.pun_link($pun_url['topic'], $cur_report['topic_id']).'">'.htmlspecialchars($cur_report['subject']).'</a>' : $lang_admin['Deleted topic'];
|
|
140 |
$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', htmlspecialchars($cur_report['message'])) : $lang_admin['Deleted post'];
|
|
141 |
$post_id = ($cur_report['post_id'] != '') ? '<a href="'.pun_link($pun_url['post'], $cur_report['post_id']).'">Post #'.$cur_report['post_id'].'</a>' : $lang_admin['Deleted post'];
|
|
142 |
|
|
143 |
?>
|
|
144 |
<div class="rep-item databox">
|
|
145 |
<h3 class="legend"><span><?php printf($lang_admin['Reported by'], format_time($cur_report['created']), $reporter) ?></span></h3>
|
|
146 |
<div class="radbox checkbox item-select"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><span class="fld-label"><?php echo $lang_admin['Select report'] ?></span><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="reports[<?php echo $cur_report['id'] ?>]" value="1" /> <?php echo ++$pun_page['num_items'] ?></label></div>
|
|
147 |
<p><?php echo $forum ?> » <?php echo $topic ?> » <?php echo $post_id ?></p>
|
|
148 |
<p><?php echo $post ?></p>
|
|
149 |
<?php ($hook = get_hook('arp_new_report_new_block')) ? eval($hook) : null; ?>
|
|
150 |
</div>
|
|
151 |
<?php
|
|
152 |
|
|
153 |
}
|
|
154 |
|
|
155 |
?>
|
|
156 |
<div class="frm-buttons">
|
|
157 |
<span class="submit"><input type="submit" name="mark_as_read" value="<?php echo $lang_admin['Mark read'] ?>" /></span>
|
|
158 |
</div>
|
|
159 |
</form>
|
|
160 |
<?php
|
|
161 |
|
|
162 |
}
|
|
163 |
else
|
|
164 |
{
|
|
165 |
|
|
166 |
?>
|
|
167 |
<div class="frm-info">
|
|
168 |
<p><?php echo $lang_admin['No new reports'] ?></p>
|
|
169 |
</div>
|
|
170 |
<?php
|
|
171 |
|
|
172 |
}
|
|
173 |
|
|
174 |
?>
|
|
175 |
</div>
|
|
176 |
|
|
177 |
<div class="main-content frm">
|
|
178 |
<div class="frm-head">
|
|
179 |
<h2><span><?php echo $lang_admin['Read reports heading'] ?></span></h2>
|
|
180 |
</div>
|
|
181 |
<?php
|
|
182 |
|
|
183 |
// Fetch the last 10 reports marked as read
|
|
184 |
$query = array(
|
|
185 |
'SELECT' => 'r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, r.created, r.message, r.zapped, r.zapped_by AS zapped_by_id, t.subject, f.forum_name, u.username AS reporter, u2.username AS zapped_by',
|
|
186 |
'FROM' => 'reports AS r',
|
|
187 |
'JOINS' => array(
|
|
188 |
array(
|
|
189 |
'LEFT JOIN' => 'topics AS t',
|
|
190 |
'ON' => 'r.topic_id=t.id'
|
|
191 |
),
|
|
192 |
array(
|
|
193 |
'LEFT JOIN' => 'forums AS f',
|
|
194 |
'ON' => 'r.forum_id=f.id'
|
|
195 |
),
|
|
196 |
array(
|
|
197 |
'LEFT JOIN' => 'users AS u',
|
|
198 |
'ON' => 'r.reported_by=u.id'
|
|
199 |
),
|
|
200 |
array(
|
|
201 |
'LEFT JOIN' => 'users AS u2',
|
|
202 |
'ON' => 'r.zapped_by=u2.id'
|
|
203 |
)
|
|
204 |
),
|
|
205 |
'WHERE' => 'r.zapped IS NOT NULL',
|
|
206 |
'ORDER BY' => 'r.zapped DESC',
|
|
207 |
'LIMIT' => '10'
|
|
208 |
);
|
|
209 |
|
|
210 |
($hook = get_hook('arp_qr_get_last_zapped_reports')) ? eval($hook) : null;
|
|
211 |
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__);
|
|
212 |
if ($pun_db->num_rows($result))
|
|
213 |
{
|
|
214 |
$i = 1;
|
|
215 |
$pun_page['num_items'] = 0;
|
|
216 |
while ($cur_report = $pun_db->fetch_assoc($result))
|
|
217 |
{
|
|
218 |
$reporter = ($cur_report['reporter'] != '') ? '<a href="'.pun_link($pun_url['user'], $cur_report['reported_by']).'">'.htmlspecialchars($cur_report['reporter']).'</a>' : $lang_admin['Deleted user'];
|
|
219 |
$forum = ($cur_report['forum_name'] != '') ? '<a href="'.pun_link($pun_url['forum'], $cur_report['forum_id']).'">'.htmlspecialchars($cur_report['forum_name']).'</a>' : $lang_admin['Deleted forum'];
|
|
220 |
$topic = ($cur_report['subject'] != '') ? '<a href="'.pun_link($pun_url['topic'], $cur_report['topic_id']).'">'.htmlspecialchars($cur_report['subject']).'</a>' : $lang_admin['Deleted topic'];
|
|
221 |
$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', htmlspecialchars($cur_report['message'])) : $lang_admin['Deleted post'];
|
|
222 |
$post_id = ($cur_report['post_id'] != '') ? '<a href="'.pun_link($pun_url['post'], $cur_report['post_id']).'">Post #'.$cur_report['post_id'].'</a>' : $lang_admin['Deleted post'];
|
|
223 |
$zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="'.pun_link($pun_url['user'], $cur_report['zapped_by_id']).'">'.htmlspecialchars($cur_report['zapped_by']).'</a>' : $lang_admin['Deleted user'];
|
|
224 |
|
|
225 |
?>
|
|
226 |
<div class="rep-item databox">
|
|
227 |
<h3 class="legend"><span><strong><?php echo ++$pun_page['num_items'] ?></strong> <?php printf($lang_admin['Reported by'], format_time($cur_report['created']), $reporter) ?></span></h3>
|
|
228 |
<p><?php echo $forum ?> » <?php echo $topic ?> » <?php echo $post_id ?></p>
|
|
229 |
<p><?php echo $post ?></p>
|
|
230 |
<p><?php printf($lang_admin['Marked read by'], format_time($cur_report['zapped']), $zapped_by) ?></p>
|
|
231 |
<?php ($hook = get_hook('arp_report_new_block')) ? eval($hook) : null; ?>
|
|
232 |
</div>
|
|
233 |
<?php
|
|
234 |
|
|
235 |
}
|
|
236 |
}
|
|
237 |
else
|
|
238 |
{
|
|
239 |
|
|
240 |
?>
|
|
241 |
<div class="frm-info">
|
|
242 |
<p><?php echo $lang_admin['No read reports'] ?></p>
|
|
243 |
</div>
|
|
244 |
<?php
|
|
245 |
|
|
246 |
}
|
|
247 |
|
|
248 |
?>
|
|
249 |
</div>
|
|
250 |
|
|
251 |
</div>
|
|
252 |
<?php
|
|
253 |
|
|
254 |
require PUN_ROOT.'footer.php';
|