Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 231 lines (177 sloc) 7.97 kb
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
1 <?php
2
e5f7b2a Jamie Furness Updating copyright notices in all files
reines authored
3 /**
7c5edc2 Jamie Furness Updating copyright notices for 2012
reines authored
4 * Copyright (C) 2008-2012 FluxBB
e5f7b2a Jamie Furness Updating copyright notices in all files
reines authored
5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
7 */
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
8
9 // Tell header.php to use the admin template
10 define('PUN_ADMIN_CONSOLE', 1);
11
f5ee836 Jamie Furness Changing PUN_ROOT to use absolute paths, this solves some issues with AP...
reines authored
12 define('PUN_ROOT', dirname(__FILE__).'/');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
13 require PUN_ROOT.'include/common.php';
14 require PUN_ROOT.'include/common_admin.php';
15
16
5ca8498 Jamie Furness Updating trunk to version 1.4. These changes have all kindly been done b...
reines authored
17 if (!$pun_user['is_admmod'])
664cb8b Franz Liedke #367: Add Gettext file common.po (and .mo, too) and use that in all the ...
franzliedke authored
18 message($lang->t('No permission'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
19
de90cd5 Jamie Furness Merging the changes for localized admin panel.
reines authored
20 // Load the admin_reports.php language file
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
21 $lang->load('admin_reports');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
22
23 // Zap a report
24 if (isset($_POST['zap_id']))
25 {
26 confirm_referrer('admin_reports.php');
27
28 $zap_id = intval(key($_POST['zap_id']));
29
7c97871 daris Updating to use new db layer
daris authored
30 $query = $db->update(array('zapped' => ':now', 'zapped_by' => ':user_id'), 'reports');
d1807fa Jamie Furness Converting some more queries
reines authored
31 $query->where = 'zapped IS NULL AND :zid';
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
32
d1807fa Jamie Furness Converting some more queries
reines authored
33 $params = array(':now' => time(), ':user_id' => $pun_user['id'], ':zid' => $zap_id);
34
7c97871 daris Updating to use new db layer
daris authored
35 $query->run($params);
d1807fa Jamie Furness Converting some more queries
reines authored
36 unset ($query, $params);
1ec137d Jeff Roberson Removed trailing whitespace from all files.
ridgerunner authored
37
e814001 Franz Liedke #195: Delete old reports that are not displayed anyway.
franzliedke authored
38 // Delete old reports (which cannot be viewed anyway)
7c97871 daris Updating to use new db layer
daris authored
39 $query = $db->delete('reports AS r');
d1807fa Jamie Furness Converting some more queries
reines authored
40 $query->where = 'r.zapped IS NOT NULL';
4906d49 Jamie Furness Changing $query->order_by to use the correct $query->order construct.
reines authored
41 $query->order = array('zapped' => 'r.zapped DESC');
d1807fa Jamie Furness Converting some more queries
reines authored
42 $query->offset = 10;
43
44 $params = array();
45
7c97871 daris Updating to use new db layer
daris authored
46 $query->run($params);
d1807fa Jamie Furness Converting some more queries
reines authored
47 unset ($query, $params);
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
48
f466eef Jamie Furness Caching the number of unzapped reports.
reines authored
49 $cache->delete('num_reports');
50
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
51 redirect('admin_reports.php', $lang->t('Report zapped redirect'));
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
52 }
53
54
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
55 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang->t('Admin'), $lang->t('Reports'));
a43f248 Quy Changed prefix to PUN for consistency.
Quy authored
56 define('PUN_ACTIVE_PAGE', 'admin');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
57 require PUN_ROOT.'header.php';
58
59 generate_admin_menu('reports');
60
61 ?>
62 <div class="blockform">
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
63 <h2><span><?php echo $lang->t('New reports head') ?></span></h2>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
64 <div class="box">
65 <form method="post" action="admin_reports.php?action=zap">
66 <?php
67
7c97871 daris Updating to use new db layer
daris authored
68 $query = $db->select(array('rid' => 'r.id', 'topic_id' => 'r.topic_id', 'forum_id' => 'r.forum_id', 'reported_by' => 'r.reported_by', 'created' => 'r.created', 'message' => 'r.message', 'pid' => 'p.id AS pid', 'subject' => 't.subject', 'forum_name' => 'f.forum_name', 'reporter' => 'u.username AS reporter'), 'reports AS r');
d1807fa Jamie Furness Converting some more queries
reines authored
69
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
70 $query->leftJoin('f', 'forums AS f', 'r.forum_id = f.id');
d1807fa Jamie Furness Converting some more queries
reines authored
71
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
72 $query->leftJoin('p', 'posts AS p', 'r.post_id = p.id');
d1807fa Jamie Furness Converting some more queries
reines authored
73
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
74 $query->leftJoin('t', 'topics AS t', 'r.topic_id = t.id');
d1807fa Jamie Furness Converting some more queries
reines authored
75
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
76 $query->leftJoin('u', 'users AS u', 'r.reported_by = u.id');
d1807fa Jamie Furness Converting some more queries
reines authored
77
78 $query->where = 'r.zapped IS NULL';
4906d49 Jamie Furness Changing $query->order_by to use the correct $query->order construct.
reines authored
79 $query->order = array('created' => 'r.created DESC');
d1807fa Jamie Furness Converting some more queries
reines authored
80
81 $params = array();
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
82
7c97871 daris Updating to use new db layer
daris authored
83 $result = $query->run($params);
d1807fa Jamie Furness Converting some more queries
reines authored
84 unset ($query, $params);
85
86 if (!empty($result))
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
87 {
d1807fa Jamie Furness Converting some more queries
reines authored
88 foreach ($result as $cur_report)
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
89 {
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
90 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang->t('Deleted user');
91 $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang->t('Deleted').'</span>';
92 $topic = ($cur_report['subject'] != '') ? '<span>»&#160;<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>»&#160;'.$lang->t('Deleted').'</span>';
2d1b001 Quy Fixed delete status of post in admin_reports.
Quy authored
93 $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
94 $post_id = ($cur_report['pid'] != '') ? '<span>»&#160;<a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.$lang->t('Post ID', $cur_report['pid']).'</a></span>' : '<span>»&#160;'.$lang->t('Deleted').'</span>';
a3aabbb Quy Changed a variable name for consistency in admin_reports.php. Noticed by...
Quy authored
95 $report_location = array($forum, $topic, $post_id);
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
96
97 ?>
98 <div class="inform">
99 <fieldset>
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
100 <legend><?php echo $lang->t('Report subhead', format_time($cur_report['created'])) ?></legend>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
101 <div class="infldset">
1c9032d Fixing some inconsistencies in the markup and removing some pointless ma...
Paul Sullivan authored
102 <table class="aligntop" cellspacing="0">
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
103 <tr>
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
104 <th scope="row"><?php echo $lang->t('Reported by', $reporter) ?></th>
6a889bc Admin/Reports used a separator character. I modified the markup so as to...
Paul authored
105 <td class="location"><?php echo implode(' ', $report_location) ?></td>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
106 </tr>
107 <tr>
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
108 <th scope="row"><?php echo $lang->t('Reason') ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value="<?php echo $lang->t('Zap') ?>" /></div></th>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
109 <td><?php echo $post ?></td>
110 </tr>
111 </table>
112 </div>
113 </fieldset>
114 </div>
115 <?php
116
117 }
118 }
119 else
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
120 {
121
122 ?>
123 <div class="inform">
124 <fieldset>
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
125 <legend><?php echo $lang->t('None') ?></legend>
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
126 <div class="infldset">
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
127 <p><?php echo $lang->t('No new reports') ?></p>
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
128 </div>
129 </fieldset>
130 </div>
131 <?php
132
133 }
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
134
d1807fa Jamie Furness Converting some more queries
reines authored
135 unset ($result);
136
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
137 ?>
138 </form>
139 </div>
140 </div>
141
142 <div class="blockform block2">
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
143 <h2><span><?php echo $lang->t('Last 10 head') ?></span></h2>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
144 <div class="box">
145 <div class="fakeform">
146 <?php
147
7c97871 daris Updating to use new db layer
daris authored
148 $query = $db->select(array('rid' => 'r.id', 'topic_id' => 'r.topic_id', 'forum_id' => 'r.forum_id', 'reported_by' => 'r.reported_by', 'message' => 'r.message', 'zapped' => 'r.zapped', 'zapped_by_id' => 'r.zapped_by AS zapped_by_id', 'pid' => 'p.id AS pid', 'subject' => 't.subject', 'forum_name' => 'f.forum_name', 'reporter' => 'u.username AS reporter', 'zapped_by' => 'u2.username AS zapped_by'), 'reports AS r');
d1807fa Jamie Furness Converting some more queries
reines authored
149
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
150 $query->leftJoin('p', 'posts AS p', 'r.post_id = p.id');
d1807fa Jamie Furness Converting some more queries
reines authored
151
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
152 $query->leftJoin('t', 'topics AS t', 'r.topic_id = t.id');
d1807fa Jamie Furness Converting some more queries
reines authored
153
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
154 $query->leftJoin('f', 'forums AS f', 'r.forum_id = f.id');
d1807fa Jamie Furness Converting some more queries
reines authored
155
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
156 $query->leftJoin('u', 'users AS u', 'r.reported_by = u.id');
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
157
861460d daris PHP methods are not case sensitive, but replace InnerJoin and LeftJoin f...
daris authored
158 $query->leftJoin('u2', 'users AS u2', 'r.zapped_by = u2.id');
d1807fa Jamie Furness Converting some more queries
reines authored
159
160 $query->where = 'r.zapped IS NOT NULL';
4906d49 Jamie Furness Changing $query->order_by to use the correct $query->order construct.
reines authored
161 $query->order = array('zapped' => 'r.zapped DESC');
d1807fa Jamie Furness Converting some more queries
reines authored
162 $query->limit = 10;
163
164 $params = array();
165
7c97871 daris Updating to use new db layer
daris authored
166 $result = $query->run($params);
d1807fa Jamie Furness Converting some more queries
reines authored
167 unset ($query, $params);
168
169 if (!empty($result))
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
170 {
d1807fa Jamie Furness Converting some more queries
reines authored
171 foreach ($result as $cur_report)
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
172 {
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
173 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : $lang->t('Deleted user');
174 $forum = ($cur_report['forum_name'] != '') ? '<span><a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a></span>' : '<span>'.$lang->t('Deleted').'</span>';
175 $topic = ($cur_report['subject'] != '') ? '<span>»&#160;<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a></span>' : '<span>»&#160;'.$lang->t('Deleted').'</span>';
2d1b001 Quy Fixed delete status of post in admin_reports.
Quy authored
176 $post = str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message']));
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
177 $post_id = ($cur_report['pid'] != '') ? '<span>»&#160;<a href="viewtopic.php?pid='.$cur_report['pid'].'#p'.$cur_report['pid'].'">'.$lang->t('Post ID', $cur_report['pid']).'</a></span>' : '<span>»&#160;'.$lang->t('Deleted').'</span>';
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
178 $zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : $lang->t('NA');
179 $zapped_by = ($cur_report['zapped_by'] != '') ? '<strong>'.pun_htmlspecialchars($cur_report['zapped_by']).'</strong>' : $lang->t('NA');
de90cd5 Jamie Furness Merging the changes for localized admin panel.
reines authored
180 $report_location = array($forum, $topic, $post_id);
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
181
182 ?>
183 <div class="inform">
184 <fieldset>
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
185 <legend><?php echo $lang->t('Zapped subhead', format_time($cur_report['zapped']), $zapped_by) ?></legend>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
186 <div class="infldset">
1c9032d Fixing some inconsistencies in the markup and removing some pointless ma...
Paul Sullivan authored
187 <table class="aligntop" cellspacing="0">
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
188 <tr>
a5a577f daris Use $lang->t() instead of sprintf/printf
daris authored
189 <th scope="row"><?php echo $lang->t('Reported by', $reporter) ?></th>
6a889bc Admin/Reports used a separator character. I modified the markup so as to...
Paul authored
190 <td class="location"><?php echo implode(' ', $report_location) ?></td>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
191 </tr>
192 <tr>
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
193 <th scope="row"><?php echo $lang->t('Reason') ?></th>
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
194 <td><?php echo $post ?></td>
195 </tr>
196 </table>
197 </div>
198 </fieldset>
199 </div>
200 <?php
201
202 }
203 }
204 else
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
205 {
206
207 ?>
208 <div class="inform">
209 <fieldset>
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
210 <legend><?php echo $lang->t('None') ?></legend>
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
211 <div class="infldset">
fff4fe1 Franz Liedke #498: Convert admin backend files to use new language system, too.
franzliedke authored
212 <p><?php echo $lang->t('No zapped reports') ?></p>
eccf7bb Tidying up a few more inconsistencies in the markup and simplifying a co...
Paul Sullivan authored
213 </div>
214 </fieldset>
215 </div>
216 <?php
217
218 }
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
219
d1807fa Jamie Furness Converting some more queries
reines authored
220 unset ($result);
221
9d65336 Initial import based on revision 1613 of PunBB.
Connor Dunn authored
222 ?>
223 </div>
224 </div>
225 </div>
226 <div class="clearer"></div>
227 </div>
228 <?php
229
f5ee836 Jamie Furness Changing PUN_ROOT to use absolute paths, this solves some issues with AP...
reines authored
230 require PUN_ROOT.'footer.php';
Something went wrong with that request. Please try again.