punbb/admin_reports.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 3 c0c445d4a13e
permissions -rw-r--r--
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    26
// Tell header.php to use the admin template
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
define('PUN_ADMIN_CONSOLE', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
require PUN_ROOT.'include/common_admin.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
	message($lang_common['No permission']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
// Zap a report
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
if (isset($_POST['zap_id']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	confirm_referrer('admin_reports.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
	$zap_id = intval(key($_POST['zap_id']));
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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 &hellip;');
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Reports';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
generate_admin_menu('reports');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
		<h2><span>New reports</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
			<form method="post" action="admin_reports.php?action=zap">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
		$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
		$forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
		$topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
		$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
						<legend>Reported <?php echo format_time($cur_report['created']) ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
							<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
									<th scope="row">Forum&nbsp;&raquo;&nbsp;Topic&nbsp;&raquo;&nbsp;Post</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
									<td><?php echo $forum ?>&nbsp;&raquo;&nbsp;<?php echo $topic ?>&nbsp;&raquo;&nbsp;<?php echo $postid ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    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>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
									<td><?php echo $post ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
	echo "\t\t\t\t".'<p>There are no new reports.</p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
	<div class="blockform block2">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
		<h2><span>10 last zapped reports</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
			<div class="fakeform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
		$reporter = ($cur_report['reporter'] != '') ? '<a href="profile.php?id='.$cur_report['reported_by'].'">'.pun_htmlspecialchars($cur_report['reporter']).'</a>' : 'Deleted user';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
		$forum = ($cur_report['forum_name'] != '') ? '<a href="viewforum.php?id='.$cur_report['forum_id'].'">'.pun_htmlspecialchars($cur_report['forum_name']).'</a>' : 'Deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
		$topic = ($cur_report['subject'] != '') ? '<a href="viewtopic.php?id='.$cur_report['topic_id'].'">'.pun_htmlspecialchars($cur_report['subject']).'</a>' : 'Deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
		$post = ($cur_report['post_id'] != '') ? str_replace("\n", '<br />', pun_htmlspecialchars($cur_report['message'])) : 'Post deleted';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   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';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   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';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
						<legend>Zapped <?php echo format_time($cur_report['zapped']) ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
							<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
									<th scope="row">Forum&nbsp;&raquo;&nbsp;Topic&nbsp;&raquo;&nbsp;Post</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
									<td><?php echo $forum ?>&nbsp;&raquo;&nbsp;<?php echo $topic ?>&nbsp;&raquo;&nbsp;<?php echo $post_id ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
									<th scope="row">Reported by <?php echo $reporter ?><div class="topspace">Zapped by <?php echo $zapped_by ?></div></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
									<td><?php echo $post ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
	echo "\t\t\t\t".'<p>There are no zapped reports.</p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
require PUN_ROOT.'footer.php';