Gazelle/sections/forums/edit_rules.php

83 lines
1.7 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
enforce_login();
2013-05-05 08:00:31 +00:00
if (!check_perms('site_moderate_forums')) {
2011-03-28 14:21:28 +00:00
error(403);
}
$ForumID = $_GET['forumid'];
2013-05-05 08:00:31 +00:00
if (!is_number($ForumID)) {
2011-03-28 14:21:28 +00:00
error(404);
}
2013-05-05 08:00:31 +00:00
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'].')');
2011-03-28 14:21:28 +00:00
}
}
2013-05-05 08:00:31 +00:00
if (!empty($_POST['del'])) {
if (is_number($_POST['threadid'])) {
$DB->query("
DELETE FROM forums_specific_rules
WHERE ForumID = $ForumID
AND ThreadID = ".$_POST['threadid']);
2011-03-28 14:21:28 +00:00
}
}
$Cache->delete_value('forums_list');
}
2013-06-04 08:00:34 +00:00
$DB->query("
SELECT ThreadID
FROM forums_specific_rules
WHERE ForumID = $ForumID");
2011-03-28 14:21:28 +00:00
$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>
2013-06-04 08:00:34 +00:00
<? foreach ($ThreadIDs as $ThreadID) { ?>
2011-03-28 14:21:28 +00:00
<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>
2013-06-04 08:00:34 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</table>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>