author | Dan |
Thu, 12 Jul 2007 01:04:01 -0400 | |
changeset 2 | a8a21e1c7afa |
parent 0 | f9ffdbd96607 |
child 3 | c0c445d4a13e |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/*********************************************************************** |
|
3 |
||
4 |
Copyright (C) 2002-2005 Rickard Andersson (rickard@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 |
// Tell header.php to use the admin template |
|
27 |
define('PUN_ADMIN_CONSOLE', 1); |
|
28 |
||
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
29 |
//define('PUN_ROOT', './'); |
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
30 |
//require PUN_ROOT.'include/common.php'; |
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
31 |
|
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
32 |
global $pun_db, $pun_user, $pun_config, $lang_common; |
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
33 |
|
0 | 34 |
require PUN_ROOT.'include/common_admin.php'; |
35 |
||
36 |
||
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
37 |
if ($pun_user['g_id'] < PUN_MOD) |
0 | 38 |
message($lang_common['No permission']); |
39 |
||
40 |
||
41 |
// Zap a report |
|
42 |
if (isset($_POST['zap_id'])) |
|
43 |
{ |
|
44 |
confirm_referrer('admin_reports.php'); |
|
45 |
||
46 |
$zap_id = intval(key($_POST['zap_id'])); |
|
47 |
||
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
48 |
$result = $pun_db->query('SELECT zapped FROM '.$pun_db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $pun_db->error()); |
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
49 |
$zapped = $pun_db->result($result); |
0 | 50 |
|
51 |
if ($zapped == '') |
|
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
52 |
$pun_db->query('UPDATE '.$pun_db->prefix.'reports SET zapped='.time().', zapped_by='.$pun_user['id'].' WHERE id='.$zap_id) or error('Unable to zap report', __FILE__, __LINE__, $pun_db->error()); |
0 | 53 |
|
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
54 |
pun_redirect('admin_reports.php', 'Report zapped. Redirecting …'); |
0 | 55 |
} |
56 |
||
57 |
||
58 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Reports'; |
|
59 |
require PUN_ROOT.'header.php'; |
|
60 |
||
61 |
generate_admin_menu('reports'); |
|
62 |
||
63 |
?> |
|
64 |
<div class="blockform"> |
|
65 |
<h2><span>New reports</span></h2> |
|
66 |
<div class="box"> |
|
67 |
<form method="post" action="admin_reports.php?action=zap"> |
|
68 |
<?php |
|
69 |
||
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
70 |
$result = $pun_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 '.$pun_db->prefix.'reports AS r LEFT JOIN '.$pun_db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$pun_db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$pun_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__, $pun_db->error()); |
0 | 71 |
|
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
72 |
if ($pun_db->num_rows($result)) |
0 | 73 |
{ |
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
74 |
while ($cur_report = $pun_db->fetch_assoc($result)) |
0 | 75 |
{ |
76 |
$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user'; |
|
77 |
$forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted'; |
|
78 |
$topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted'; |
|
79 |
$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Deleted'; |
|
80 |
$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'; |
|
81 |
||
82 |
?> |
|
83 |
<div class="inform"> |
|
84 |
<fieldset> |
|
85 |
<legend>Reported <?php echo format_time($cur_report['created']) ?></legend> |
|
86 |
<div class="infldset"> |
|
87 |
<table cellspacing="0"> |
|
88 |
<tr> |
|
89 |
<th scope="row">Forum » Topic » Post</th> |
|
90 |
<td><?php echo $forum ?> » <?php echo $topic ?> » <?php echo $postid ?></td> |
|
91 |
</tr> |
|
92 |
<tr> |
|
93 |
<th scope="row">Report by <?php echo $reporter ?><div><input type="submit" name="zap_id[<?php echo $cur_report['id'] ?>]" value=" Zap " /></div></th> |
|
94 |
<td><?php echo $post ?></td> |
|
95 |
</tr> |
|
96 |
</table> |
|
97 |
</div> |
|
98 |
</fieldset> |
|
99 |
</div> |
|
100 |
<?php |
|
101 |
||
102 |
} |
|
103 |
} |
|
104 |
else |
|
105 |
echo "\t\t\t\t".'<p>There are no new reports.</p>'."\n"; |
|
106 |
||
107 |
?> |
|
108 |
</form> |
|
109 |
</div> |
|
110 |
</div> |
|
111 |
||
112 |
<div class="blockform block2"> |
|
113 |
<h2><span>10 last zapped reports</span></h2> |
|
114 |
<div class="box"> |
|
115 |
<div class="fakeform"> |
|
116 |
<?php |
|
117 |
||
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
118 |
$result = $pun_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 '.$pun_db->prefix.'reports AS r LEFT JOIN '.$pun_db->prefix.'topics AS t ON r.topic_id=t.id LEFT JOIN '.$pun_db->prefix.'forums AS f ON r.forum_id=f.id LEFT JOIN '.$pun_db->prefix.'users AS u ON r.reported_by=u.id LEFT JOIN '.$pun_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__, $pun_db->error()); |
0 | 119 |
|
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
120 |
if ($pun_db->num_rows($result)) |
0 | 121 |
{ |
2
a8a21e1c7afa
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents:
0
diff
changeset
|
122 |
while ($cur_report = $pun_db->fetch_assoc($result)) |
0 | 123 |
{ |
124 |
$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user'; |
|
125 |
$forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted'; |
|
126 |
$topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted'; |
|
127 |
$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Post deleted'; |
|
128 |
$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'; |
|
129 |
$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'; |
|
130 |
||
131 |
?> |
|
132 |
<div class="inform"> |
|
133 |
<fieldset> |
|
134 |
<legend>Zapped <?php echo format_time($cur_report['zapped']) ?></legend> |
|
135 |
<div class="infldset"> |
|
136 |
<table cellspacing="0"> |
|
137 |
<tr> |
|
138 |
<th scope="row">Forum » Topic » Post</th> |
|
139 |
<td><?php echo $forum ?> » <?php echo $topic ?> » <?php echo $post_id ?></td> |
|
140 |
</tr> |
|
141 |
<tr> |
|
142 |
<th scope="row">Reported by <?php echo $reporter ?><div class="topspace">Zapped by <?php echo $zapped_by ?></div></th> |
|
143 |
<td><?php echo $post ?></td> |
|
144 |
</tr> |
|
145 |
</table> |
|
146 |
</div> |
|
147 |
</fieldset> |
|
148 |
</div> |
|
149 |
<?php |
|
150 |
||
151 |
} |
|
152 |
} |
|
153 |
else |
|
154 |
echo "\t\t\t\t".'<p>There are no zapped reports.</p>'."\n"; |
|
155 |
||
156 |
?> |
|
157 |
</div> |
|
158 |
</div> |
|
159 |
</div> |
|
160 |
<div class="clearer"></div> |
|
161 |
</div> |
|
162 |
<?php |
|
163 |
||
164 |
require PUN_ROOT.'footer.php'; |