punbb/admin_prune.php
author Dan
Thu, 12 Jul 2007 15:00:35 -0400
changeset 3 c0c445d4a13e
parent 2 a8a21e1c7afa
permissions -rw-r--r--
Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
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_ADMIN)
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
if (isset($_GET['action']) || isset($_POST['prune']) || isset($_POST['prune_comply']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
	if (isset($_POST['prune_comply']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
		confirm_referrer('admin_prune.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
		$prune_from = $_POST['prune_from'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
		$prune_days = intval($_POST['prune_days']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
		$prune_date = ($prune_days) ? time() - ($prune_days*86400) : -1;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
		@set_time_limit(0);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
		if ($prune_from == 'all')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
		{
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
    55
			$result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'forums') or error('Unable to fetch forum list', __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
    56
			$num_forums = $pun_db->num_rows($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
			for ($i = 0; $i < $num_forums; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
			{
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
    60
				$fid = $pun_db->result($result, $i);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
				prune($fid, $_POST['prune_sticky'], $prune_date);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
				update_forum($fid);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
			$prune_from = intval($prune_from);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
			prune($prune_from, $_POST['prune_sticky'], $prune_date);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
			update_forum($prune_from);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
		// Locate any "orphaned redirect topics" and delete them
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
		$result = $pun_db->query('SELECT t1.id FROM '.$pun_db->prefix.'topics AS t1 LEFT JOIN '.$pun_db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __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
    75
		$num_orphans = $pun_db->num_rows($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
		if ($num_orphans)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
			for ($i = 0; $i < $num_orphans; ++$i)
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
    80
				$orphans[] = $pun_db->result($result, $i);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
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
    82
			$pun_db->query('DELETE FROM '.$pun_db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
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
    85
		pun_redirect('admin_prune.php', 'Posts pruned. Redirecting &hellip;');
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
	$prune_days = $_POST['req_prune_days'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
	if (!@preg_match('#^\d+$#', $prune_days))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
		message('Days to prune must be a positive integer.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
	$prune_date = time() - ($prune_days*86400);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
	$prune_from = $_POST['prune_from'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
	// Concatenate together the query for counting number or topics to prune
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
    97
	$sql = 'SELECT COUNT(id) FROM '.$pun_db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
	if ($_POST['prune_sticky'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
		$sql .= ' AND sticky=\'0\'';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
	if ($prune_from != 'all')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
		$prune_from = intval($prune_from);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
		$sql .= ' AND forum_id='.$prune_from;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
		// Fetch the forum name (just for cosmetic reasons)
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
   108
		$result = $pun_db->query('SELECT forum_name FROM '.$pun_db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __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
   109
		$forum = '"'.pun_htmlspecialchars($pun_db->result($result)).'"';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
		$forum = 'all forums';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
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
   114
	$result = $pun_db->query($sql) or error('Unable to fetch topic prune count', __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
   115
	$num_topics = $pun_db->result($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
	if (!$num_topics)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
		message('There are no topics that are '.$prune_days.' days old. Please decrease the value of "Days old" and try again.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Prune';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
	generate_admin_menu('prune');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
		<h2><span>Prune</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
		<div class="box">
3
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
   130
			<form method="post" action="<?php echo makeUrlNS('Special', 'Forum/Admin_prune', 'action=foo', true); ?>">
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
					<input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
					<input type="hidden" name="prune_sticky" value="<?php echo $_POST['prune_sticky'] ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
					<input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
						<legend>Confirm prune posts</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
							<p>Are you sure that you want to prune all topics older than <?php echo $prune_days ?> days from <?php echo $forum ?>? (<?php echo $num_topics ?> topics)</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
							<p>WARNING! Pruning posts deletes them permanently.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
				<p><input type="submit" name="prune_comply" value="Prune" /><a href="javascript:history.go(-1)">Go back</a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
	<div class="clearer"></div>
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
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Prune';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
	$required_fields = array('req_prune_days' => 'Days old');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
	$focus_element = array('prune', 'req_prune_days');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
	generate_admin_menu('prune');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
		<h2><span>Prune</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
		<div class="box">
3
c0c445d4a13e Got some basic security in there, admin panel works now, and most admin panel forms work (used regex mass search + replace)
Dan
parents: 2
diff changeset
   168
			<form id="prune" method="post" action="<?php echo makeUrlNS('Special', 'Forum/Admin_prune', 'action=foo', true); ?>" onsubmit="return process_form(this)">
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
				<input type="hidden" name="form_sent" value="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
						<legend>Prune old posts</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
									<th scope="row">Days old</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
										<input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
										<span>The number of days "old" a topic must be to be pruned. E.g. if you were to enter 30, every topic that didn't contain a post dated less than 30 days old would be deleted.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
									<th scope="row">Prune sticky topics</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
										<input type="radio" name="prune_sticky" value="1" tabindex="2" checked="checked" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="prune_sticky" value="0" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
										<span>When enabled sticky topics will also be pruned.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
									<th scope="row">Prune from forum</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
										<select name="prune_from" tabindex="3">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
											<option value="all">All forums</option>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
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
   196
	$result = $pun_db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$pun_db->prefix.'categories AS c INNER JOIN '.$pun_db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
	$cur_category = 0;
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
   199
	while ($forum = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
		if ($forum['cid'] != $cur_category)	// Are we still in the same category?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
			if ($cur_category)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
				echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
			echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
			$cur_category = $forum['cid'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
		echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
											</optgroup>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
										</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
										<span>The forum from which you want to prune posts.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
							<p class="topspace">Use this feature with caution. Pruned posts can <strong>never</strong> be recovered. For best performance you should put the forum in maintenance mode during pruning.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
							<div class="fsetsubmit"><input type="submit" name="prune" value="Prune" tabindex="5" /></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
}