Gazelle/sections/tools/managers/forum_list.php

191 lines
4.6 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-04-17 08:00:58 +00:00
function class_list($Selected = 0) {
2011-03-28 14:21:28 +00:00
global $Classes;
$Return = '';
foreach ($Classes as $ID => $Class) {
2013-04-17 08:00:58 +00:00
if ($Class['Secondary']) {
continue;
}
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$Name = $Class['Name'];
$Level = $Class['Level'];
2013-07-04 08:00:56 +00:00
$Return .= "<option value=\"$Level\"";
2013-04-17 08:00:58 +00:00
if ($Selected == $Level) {
2013-07-04 08:00:56 +00:00
$Return .= ' selected="selected"';
2011-03-28 14:21:28 +00:00
}
2013-07-04 08:00:56 +00:00
$Return .= '>'.Format::cut_string($Name, 20, 1)."</option>\n";
2011-03-28 14:21:28 +00:00
}
reset($Classes);
return $Return;
}
2013-04-17 08:00:58 +00:00
if (!check_perms('admin_manage_forums')) {
error(403);
}
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
View::show_header('Forum Management');
2013-07-04 08:00:56 +00:00
$DB->query('
SELECT ID, Name
FROM forums
ORDER BY Sort');
2011-03-28 14:21:28 +00:00
$ForumArray = $DB->to_array(); // used for generating the 'parent' drop down list
2012-02-13 08:00:23 +00:00
// Replace the old hard-coded forum categories
unset($ForumCats);
$ForumCats = $Cache->get_value('forums_categories');
if ($ForumCats === false) {
2013-07-04 08:00:56 +00:00
$DB->query('
SELECT ID, Name
FROM forums_categories');
2012-02-13 08:00:23 +00:00
$ForumCats = array();
2013-04-17 08:00:58 +00:00
while (list($ID, $Name) = $DB->next_record()) {
2012-02-13 08:00:23 +00:00
$ForumCats[$ID] = $Name;
}
$Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache.
}
2011-03-28 14:21:28 +00:00
2013-04-17 08:00:58 +00:00
$DB->query('
SELECT
ID,
CategoryID,
Sort,
Name,
Description,
MinClassRead,
MinClassWrite,
MinClassCreate,
AutoLock,
AutoLockWeeks
2011-03-28 14:21:28 +00:00
FROM forums
ORDER BY CategoryID, Sort ASC');
?>
2012-08-19 08:00:19 +00:00
<div class="header">
2013-07-04 08:00:56 +00:00
<script type="text/javacript">document.getElementByID('content').style.overflow = 'visible';</script>
2012-08-19 08:00:19 +00:00
<h2>Forum control panel</h2>
</div>
2011-03-28 14:21:28 +00:00
<table width="100%">
<tr class="colhead">
<td>Category</td>
<td>Sort</td>
<td>Name</td>
<td>Description</td>
<td>Min class read</td>
<td>Min class write</td>
<td>Min class create</td>
2013-07-04 08:00:56 +00:00
<td>Auto-lock</td>
<td>Auto-lock weeks</td>
2011-03-28 14:21:28 +00:00
<td>Submit</td>
</tr>
<?
$Row = 'b';
2013-04-17 08:00:58 +00:00
while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinClassWrite, $MinClassCreate, $AutoLock, $AutoLockWeeks) = $DB->next_record()) {
2013-10-25 08:00:59 +00:00
$Row = $Row === 'a' ? 'b' : 'a';
2011-03-28 14:21:28 +00:00
?>
<tr class="row<?=$Row?>">
2012-09-15 08:00:25 +00:00
<form class="manage_form" name="forums" action="" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="id" value="<?=$ID?>" />
<input type="hidden" name="action" value="forum_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<td>
<select name="categoryid">
<? reset($ForumCats);
foreach ($ForumCats as $CurCat => $CatName) {
?>
2013-07-04 08:00:56 +00:00
<option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
2011-03-28 14:21:28 +00:00
<? } ?>
</select>
</td>
<td>
<input type="text" size="3" name="sort" value="<?=$Sort?>" />
</td>
<td>
<input type="text" size="10" name="name" value="<?=$Name?>" />
</td>
<td>
<input type="text" size="20" name="description" value="<?=$Description?>" />
</td>
<td>
<select name="minclassread">
2013-02-22 08:00:24 +00:00
<?=class_list($MinClassRead)?>
2011-03-28 14:21:28 +00:00
</select>
</td>
<td>
<select name="minclasswrite">
2013-02-22 08:00:24 +00:00
<?=class_list($MinClassWrite)?>
2011-03-28 14:21:28 +00:00
</select>
</td>
<td>
<select name="minclasscreate">
2013-02-22 08:00:24 +00:00
<?=class_list($MinClassCreate)?>
2011-03-28 14:21:28 +00:00
</select>
</td>
2012-01-25 08:00:20 +00:00
<td>
2013-04-17 08:00:58 +00:00
<input type="checkbox" name="autolock"<?=($AutoLock == '1') ? ' checked="checked"' : ''?> />
2012-01-25 08:00:20 +00:00
</td>
2012-12-30 08:00:23 +00:00
<td>
<input type="text" name="autolockweeks" value="<?=$AutoLockWeeks?>" />
</td>
2011-03-28 14:21:28 +00:00
<td>
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Delete" />
</td>
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
</form>
</tr>
<?
}
?>
2012-09-01 08:00:24 +00:00
<tr class="colhead">
<td colspan="8">Create forum</td>
2011-03-28 14:21:28 +00:00
</tr>
<tr class="rowa">
2012-09-15 08:00:25 +00:00
<form class="create_form" name="forum" action="" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="forum_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<td>
<select name="categoryid">
<? reset($ForumCats);
2013-04-17 08:00:58 +00:00
while (list($CurCat, $CatName) = each($ForumCats)) { ?>
<option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
2011-03-28 14:21:28 +00:00
<? } ?>
</select>
</td>
<td>
<input type="text" size="3" name="sort" />
</td>
<td>
<input type="text" size="10" name="name" />
</td>
<td>
<input type="text" size="20" name="description" />
</td>
<td>
<select name="minclassread">
2013-02-22 08:00:24 +00:00
<?=class_list()?>
2011-03-28 14:21:28 +00:00
</select>
</td>
<td>
<select name="minclasswrite">
2013-02-22 08:00:24 +00:00
<?=class_list()?>
2011-03-28 14:21:28 +00:00
</select>
</td>
<td>
<select name="minclasscreate">
2013-02-22 08:00:24 +00:00
<?=class_list()?>
2011-03-28 14:21:28 +00:00
</select>
</td>
2012-01-25 08:00:20 +00:00
<td>
2013-04-17 08:00:58 +00:00
<input type="checkbox" name="autolock" checked="checked" />
2012-01-25 08:00:20 +00:00
</td>
2012-12-30 08:00:23 +00:00
<td>
<input type="text" name="autolockweeks" value="4" />
</td>
2011-03-28 14:21:28 +00:00
<td>
<input type="submit" value="Create" />
</td>
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
</form>
</tr>
</table>
2013-04-17 08:00:58 +00:00
<? View::show_footer(); ?>