Added forum admin perm

Fixed staff.php line break

Fixed staff.php
This commit is contained in:
What.CD 2011-06-15 08:00:05 +00:00
parent 0e856a43f3
commit ebf22b6955
7 changed files with 70 additions and 58 deletions

View File

@ -28,6 +28,7 @@
'site_moderate_requests' => 'Request moderation access.',
'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).',
'site_moderate_forums' => 'Forum moderation access.',
'site_admin_forums' => 'Forum administrator access.',
'site_forums_double_post' => 'Can double post in the forums.',
'site_view_flow' => 'Can view stats and data pools.',
'site_view_full_log' => 'Can view old log entries.',
@ -133,6 +134,7 @@ function permissions_form(){ ?>
<? display_perm('site_moderate_requests', 'Can moderate any request.'); ?>
<? display_perm('site_delete_artist', 'Can delete artists (must be able to delete torrents+requests).'); ?>
<? display_perm('site_moderate_forums', 'Can moderate the forums.'); ?>
<? display_perm('site_admin_forums', 'Can administrate the forums.'); ?>
<? display_perm('site_view_flow', 'Can view site stats and data pools.'); ?>
<? display_perm('site_view_full_log', 'Can view the full site log.'); ?>
<? display_perm('site_view_torrent_snatchlist', 'Can view torrent snatchlists.'); ?>

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<?
if(!check_perms('site_moderate_forums')) {
if(!check_perms('site_admin_forums')) {
error(403);
}

View File

@ -5,7 +5,7 @@
$PostID = $_GET['postid'];
// Make sure they are moderators
if(!check_perms('site_moderate_forums')) {
if(!check_perms('site_admin_forums')) {
error(403);
}

View File

@ -51,58 +51,62 @@
// If we're deleting a thread
if(isset($_POST['delete'])) {
$DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'");
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'");
$DB->query("SELECT
t.ID,
t.LastPostID,
t.Title,
p.AuthorID,
um.Username,
p.AddedTime,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID'),
t.IsLocked,
t.IsSticky
FROM forums_topics AS t
JOIN forums_posts AS p ON p.ID=t.LastPostID
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$ForumID'
GROUP BY t.ID
ORDER BY t.LastPostID DESC LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_BOTH, false);
$DB->query("UPDATE forums SET
NumTopics=NumTopics-1,
NumPosts=NumPosts-'$Posts',
LastPostTopicID='$NewLastTopic',
LastPostID='$NewLastPostID',
LastPostAuthorID='$NewLastAuthorID',
LastPostTime='$NewLastAddedTime'
WHERE ID='$ForumID'");
$Cache->delete('thread_'.$TopicID);
$Cache->begin_transaction('forums_list');
$UpdateArray = array(
'NumPosts'=>$NumPosts,
'NumTopics'=>'-1',
'LastPostID'=>$NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID,
'Username'=>$NewLastAuthorName,
'LastPostTopicID'=>$NewLastTopic,
'LastPostTime'=>$NewLastAddedTime,
'Title'=>$NewLastTitle,
'IsLocked'=>$NewLocked,
'IsSticky'=>$NewSticky
);
$Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0);
$Cache->delete_value('thread_'.$TopicID.'_info');
if(check_perms('site_admin_forums')) {
$DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'");
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'");
$DB->query("SELECT
t.ID,
t.LastPostID,
t.Title,
p.AuthorID,
um.Username,
p.AddedTime,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID'),
t.IsLocked,
t.IsSticky
FROM forums_topics AS t
JOIN forums_posts AS p ON p.ID=t.LastPostID
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$ForumID'
GROUP BY t.ID
ORDER BY t.LastPostID DESC LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_BOTH, false);
$DB->query("UPDATE forums SET
NumTopics=NumTopics-1,
NumPosts=NumPosts-'$Posts',
LastPostTopicID='$NewLastTopic',
LastPostID='$NewLastPostID',
LastPostAuthorID='$NewLastAuthorID',
LastPostTime='$NewLastAddedTime'
WHERE ID='$ForumID'");
$Cache->delete('thread_'.$TopicID);
$Cache->begin_transaction('forums_list');
$UpdateArray = array(
'NumPosts'=>$NumPosts,
'NumTopics'=>'-1',
'LastPostID'=>$NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID,
'Username'=>$NewLastAuthorName,
'LastPostTopicID'=>$NewLastTopic,
'LastPostTime'=>$NewLastAddedTime,
'Title'=>$NewLastTitle,
'IsLocked'=>$NewLocked,
'IsSticky'=>$NewSticky
);
$Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0);
$Cache->delete_value('thread_'.$TopicID.'_info');
header('Location: forums.php?action=viewforum&forumid='.$ForumID);
header('Location: forums.php?action=viewforum&forumid='.$ForumID);
} else {
error(403);
}
} else { // If we're just editing it
$Cache->begin_transaction('thread_'.$TopicID.'_info');

View File

@ -344,7 +344,7 @@
if (((!$ThreadInfo['IsLocked'] && $LoggedUser['Class'] >= $Forums[$ForumID]['MinClassWrite']) && ($AuthorID == $LoggedUser['ID']) || check_perms('site_moderate_forums'))) { ?>
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a>
<? }
if(check_perms('site_moderate_forums') && $ThreadInfo['Posts'] > 1) { ?>
if(check_perms('site_admin_forums') && $ThreadInfo['Posts'] > 1) { ?>
- <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a>
<? }
if($PostID == $ThreadInfo['StickyPostID']) { ?>
@ -382,7 +382,7 @@
<? if($EditedUserID){ ?>
<br />
<br />
<? if(check_perms('site_moderate_forums')) { ?>
<? if(check_perms('site_admin_forums')) { ?>
<a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?>
Last edited by
@ -517,12 +517,14 @@
</select>
</td>
</tr>
<? if(check_perms('site_admin_forums')) { ?>
<tr>
<td class="label">Delete thread</td>
<td>
<input type="checkbox" name="delete" tabindex="2" />
</td>
</tr>
<? } ?>
<tr>
<td colspan="2" class="center">
<input type="submit" value="Edit thread" tabindex="2" />

View File

@ -11,6 +11,7 @@
<div class="thin">
<h2><?=SITE_NAME?> Staff</h2>
<div class="box pad" style="padding:0px 10px 10px 10px;">
<br />
<h3>Contact Staff</h3>
<div id="staff_inbox" class="hidden">
<form action="staffpm.php" method="post">
@ -65,8 +66,8 @@
<? } ?>
</table>
</div>
<br />
<div class="box pad" style="padding:0px 10px 10px 10px;">
<?
$CurClass = 0;
$CloseTable = false;
@ -80,8 +81,11 @@
}
$CurClass = $Class;
$CloseTable = true;
echo '<h3>'.$ClassName.'s</h3>';
echo '<br /><h3>'.$ClassName.'s</h3>';
?>
<? if($CurClass == 28) { ?>
<p>Forum Mods are users who have been promoted to help moderate the forums. They can only help with forum oriented questions</p>
<? } ?>
<table class="staff" width="100%">
<tr class="colhead">
<td style="width:130px;">Username</td>