punbb/admin_categories.php
author Dan
Wed, 11 Jul 2007 21:01:48 -0400
changeset 0 f9ffdbd96607
child 2 a8a21e1c7afa
permissions -rw-r--r--
Initial population
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
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    29
define('PUN_ROOT', './');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
require PUN_ROOT.'include/common.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
require PUN_ROOT.'include/common_admin.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
if ($pun_user['g_id'] > PUN_ADMIN)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
	message($lang_common['No permission']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
// Add a new category
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
if (isset($_POST['add_cat']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
	confirm_referrer('admin_categories.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
	$new_cat_name = trim($_POST['new_cat_name']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	if ($new_cat_name == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
		message('You must enter a name for the category.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
	$db->query('INSERT INTO '.$db->prefix.'categories (cat_name) VALUES(\''.$db->escape($new_cat_name).'\')') or error('Unable to create category', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
	redirect('admin_categories.php', 'Category added. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
// Delete a category
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
else if (isset($_POST['del_cat']) || isset($_POST['del_cat_comply']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
	confirm_referrer('admin_categories.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
	$cat_to_delete = intval($_POST['cat_to_delete']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
	if ($cat_to_delete < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
	if (isset($_POST['del_cat_comply']))	// Delete a category with all forums and posts
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
		@set_time_limit(0);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
		$result = $db->query('SELECT id FROM '.$db->prefix.'forums WHERE cat_id='.$cat_to_delete) or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
		$num_forums = $db->num_rows($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
		for ($i = 0; $i < $num_forums; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
			$cur_forum = $db->result($result, $i);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
			// Prune all posts and topics
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
			prune($cur_forum, 1, -1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
			// Delete the forum
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
			$db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$cur_forum) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
		// Locate any "orphaned redirect topics" and delete them
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
		$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$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__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
		$num_orphans = $db->num_rows($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
		if ($num_orphans)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
			for ($i = 0; $i < $num_orphans; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
				$orphans[] = $db->result($result, $i);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
			$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
		// Delete the category
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
		$db->query('DELETE FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to delete category', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
		// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
		require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
		generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
		redirect('admin_categories.php', 'Category deleted. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
	else	// If the user hasn't comfirmed the delete
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
		$result = $db->query('SELECT cat_name FROM '.$db->prefix.'categories WHERE id='.$cat_to_delete) or error('Unable to fetch category info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
		$cat_name = $db->result($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
		$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Categories';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
		require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
		generate_admin_menu('categories');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
		<h2><span>Category delete</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
			<form method="post" action="admin_categories.php">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
				<input type="hidden" name="cat_to_delete" value="<?php echo $cat_to_delete ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
						<legend>Confirm delete category</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
							<p>Are you sure that you want to delete the category "<?php echo pun_htmlspecialchars($cat_name) ?>"?</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
							<p>WARNING! Deleting a category will delete all forums and posts (if any) in that category!</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
				<p><input type="submit" name="del_cat_comply" value="Delete" /><a href="javascript:history.go(-1)">Go back</a></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
		require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
else if (isset($_POST['update']))	// Change position and name of the categories
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
	confirm_referrer('admin_categories.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
	$cat_order = $_POST['cat_order'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
	$cat_name = $_POST['cat_name'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
	$result = $db->query('SELECT id, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
	$num_cats = $db->num_rows($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
	for ($i = 0; $i < $num_cats; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
		if ($cat_name[$i] == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
			message('You must enter a category name.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
		if (!@preg_match('#^\d+$#', $cat_order[$i]))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
			message('Position must be an integer value.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
		list($cat_id, $position) = $db->fetch_row($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
		$db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
	// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
	require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
	generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
	redirect('admin_categories.php', 'Categories updated. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
// Generate an array with all categories
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
$result = $db->query('SELECT id, cat_name, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
$num_cats = $db->num_rows($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
for ($i = 0; $i < $num_cats; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
	$cat_list[] = $db->fetch_row($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Categories';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
generate_admin_menu('categories');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
		<h2><span>Add/remove/edit categories</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
		<form method="post" action="admin_categories.php?action=foo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
					<legend>Add/delete categories</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
						<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
							<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
								<th scope="row">Add a new category<div><input type="submit" name="add_cat" value="Add New" tabindex="2" /></div></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
								<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
									<input type="text" name="new_cat_name" size="35" maxlength="80" tabindex="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
									<span>The name of the new category you want to add. You can edit the name of the category later (see below).Go to <a href="admin_forums.php">Forums</a> to add forums to your new category.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
								</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
							</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
<?php if ($num_cats): ?>							<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
								<th scope="row">Delete a category<div><input type="submit" name="del_cat" value="Delete" tabindex="4" /></div></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
								<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
									<select name="cat_to_delete" tabindex="3">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
	while (list(, list($cat_id, $cat_name, ,)) = @each($cat_list))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
		echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cat_id.'">'.pun_htmlspecialchars($cat_name).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
									</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
									<span>Select the name of the category you want to delete. You will be asked to confirm your choice of category for deletion before it is deleted.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
								</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
							</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
<?php endif; ?>						</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
<?php if ($num_cats): ?>			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
					<legend>Edit categories</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
					<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
						<table id="categoryedit" cellspacing="0" >
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
						<thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
							<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
								<th class="tcl" scope="col">Name</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
								<th scope="col">Position</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
								<th>&nbsp;</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
							</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
						</thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
						<tbody>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
	@reset($cat_list);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
	for ($i = 0; $i < $num_cats; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
		list(, list($cat_id, $cat_name, $position)) = @each($cat_list);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
							<tr><td><input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($cat_name) ?>" size="35" maxlength="80" /></td><td><input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $position ?>" size="3" maxlength="3" /></td><td>&nbsp;</td></tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
						</tbody>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
						</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
						<div class="fsetsubmit"><input type="submit" name="update" value="Update" /></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
<?php endif; ?>		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
require PUN_ROOT.'footer.php';