Gazelle/sections/forums/edit_rules.php

75 lines
1.7 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
enforce_login();
if(!check_perms('site_moderate_forums')) {
error(403);
}
$ForumID = $_GET['forumid'];
if(!is_number($ForumID)) {
error(404);
}
if(!empty($_POST['add']) || (!empty($_POST['del']))) {
if(!empty($_POST['add'])) {
if(is_number($_POST['new_thread'])) {
$DB->query("INSERT INTO forums_specific_rules (ForumID, ThreadID) VALUES (".$ForumID.", ".$_POST['new_thread'].")");
}
}
if(!empty($_POST['del'])) {
if(is_number($_POST['threadid'])) {
$DB->query("DELETE FROM forums_specific_rules WHERE ForumID = ".$ForumID." AND ThreadID = ".$_POST['threadid']);
}
}
$Cache->delete_value('forums_list');
}
$DB->query("SELECT ThreadID FROM forums_specific_rules WHERE ForumID = ".$ForumID);
$ThreadIDs = $DB->collect('ThreadID');
2012-10-11 08:00:15 +00:00
View::show_header();
2011-03-28 14:21:28 +00:00
?>
<div class="thin box pad">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>
<a href="forums.php">Forums</a>
&gt;
<a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forums[$ForumID]['Name']?></a>
&gt;
Edit forum specific rules
</h2>
</div>
2011-03-28 14:21:28 +00:00
<table>
<tr class="colhead">
<td>Thread ID</td>
<td></td>
</tr>
<tr>
2012-09-15 08:00:25 +00:00
<form class="add_form" name="forum_rules" action="" method="post">
2011-03-28 14:21:28 +00:00
<td>
<input name="new_thread" type="text" size="8" />
</td>
<td>
<input type="submit" name="add" value="Add thread" />
</td>
</form>
<? foreach($ThreadIDs as $ThreadID) { ?>
<tr>
<td><?=$ThreadID?></td>
<td>
2012-09-15 08:00:25 +00:00
<form class="delete_form" name="forum_rules" action="" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="threadid" value="<?=$ThreadID?>" />
<input type="submit" name="del" value="Delete link" />
</form>
</td>
</tr>
<? } ?>
</table>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>