adopted md5sum
[archlinuxdevstack.git] / fluxbb / admin_reports.php
blob257b153d2bfc95b1e7d592dd4b0e59b8afbc4d3e
1 <?php
2 /***********************************************************************
4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
6 This file is part of PunBB.
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.
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.
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
23 ************************************************************************/
26 // Tell header.php to use the admin template
27 define('PUN_ADMIN_CONSOLE', 1);
29 define('PUN_ROOT', './');
30 require PUN_ROOT.'include/common.php';
31 require PUN_ROOT.'include/common_admin.php';
34 if ($pun_user['g_id'] > PUN_MOD)
35 message($lang_common['No permission']);
38 // Zap a report
39 if (isset($_POST['zap_id']))
41 confirm_referrer('admin_reports.php');
43 $zap_id = intval(key($_POST['zap_id']));
45 $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());
46 $zapped = $db->result($result);
48 if ($zapped == '')
49 $db->query('UPDATE '.$db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $db->error());
51 redirect('admin_reports.php', 'Report zapped. Redirecting &hellip;');
55 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Reports';
56 require PUN_ROOT.'header.php';
58 generate_admin_menu('reports');
61 <div class="blockform">
62 <h2><span>New reports</span></h2>
63 <div class="box">
64 <form method="post" action="admin_reports.php?action=zap">
65 <?php
67 $result = $db->query('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 FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
69 if ($db->num_rows($result))
71 while ($cur_report = $db->fetch_assoc($result))
73 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user';
74 $forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted';
75 $topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted';
76 $post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Deleted';
77 $postid = ($cur_report['post_id'] != '') ? '<a href="viewtopic.php?pid='.$cur_report['post_id'].'#p'.$cur_report['post_id'].'">Post #'.$cur_report['post_id'].'</a>' : 'Deleted';
80 <div class="inform">
81 <fieldset>
82 <legend>Reported <?php echo format_time($cur_report['created']) ?></legend>
83 <div class="infldset">
84 <table cellspacing="0">
85 <tr>
86 <th scope="row">Forum&nbsp;&raquo;&nbsp;Topic&nbsp;&raquo;&nbsp;Post</th>
87 <td><?php echo $forum ?>&nbsp;&raquo;&nbsp;<?php echo $topic ?>&nbsp;&raquo;&nbsp;<?php echo $postid ?></td>
88 </tr>
89 <tr>
90 <th scope="row">Report by <?php echo $reporter ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value=" Zap " /></div></th>
91 <td><?php echo $post ?></td>
92 </tr>
93 </table>
94 </div>
95 </fieldset>
96 </div>
97 <?php
101 else
102 echo "\t\t\t\t".'<p>There are no new reports.</p>'."\n";
105 </form>
106 </div>
107 </div>
109 <div class="blockform block2">
110 <h2><span>10 last zapped reports</span></h2>
111 <div class="box">
112 <div class="fakeform">
113 <?php
115 $result = $db->query('SELECT r.id, r.post_id, r.topic_id, r.forum_id, r.reported_by, 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 FROM '.$db->prefix.'reports AS r LEFT JOIN '.$db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$db->prefix.'users AS u2 ON r.zapped_by=u2.id WHERE r.zapped IS NOT NULL ORDER BY zapped DESC LIMIT 10') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
117 if ($db->num_rows($result))
119 while ($cur_report = $db->fetch_assoc($result))
121 $reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user';
122 $forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted';
123 $topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted';
124 $post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Post deleted';
125 $post_id = ($cur_report['post_id'] != '') ? '<a href="viewtopic.php?pid='.$cur_report['post_id'].'#p'.$cur_report['post_id'].'">Post #'.$cur_report['post_id'].'</a>' : 'Deleted';
126 $zapped_by = ($cur_report['zapped_by'] != '') ? '<a href="profile.php?id='.$cur_report['zapped_by_id'].'">'.pun_htmlspecialchars($cur_report['zapped_by']).'</a>' : 'N/A';
129 <div class="inform">
130 <fieldset>
131 <legend>Zapped <?php echo format_time($cur_report['zapped']) ?></legend>
132 <div class="infldset">
133 <table cellspacing="0">
134 <tr>
135 <th scope="row">Forum&nbsp;&raquo;&nbsp;Topic&nbsp;&raquo;&nbsp;Post</th>
136 <td><?php echo $forum ?>&nbsp;&raquo;&nbsp;<?php echo $topic ?>&nbsp;&raquo;&nbsp;<?php echo $post_id ?></td>
137 </tr>
138 <tr>
139 <th scope="row">Reported by <?php echo $reporter ?><div class="topspace">Zapped by <?php echo $zapped_by ?></div></th>
140 <td><?php echo $post ?></td>
141 </tr>
142 </table>
143 </div>
144 </fieldset>
145 </div>
146 <?php
150 else
151 echo "\t\t\t\t".'<p>There are no zapped reports.</p>'."\n";
154 </div>
155 </div>
156 </div>
157 <div class="clearer"></div>
158 </div>
159 <?php
161 require PUN_ROOT.'footer.php';