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_moderate_requests' => 'Request moderation access.',
'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).', 'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).',
'site_moderate_forums' => 'Forum moderation access.', 'site_moderate_forums' => 'Forum moderation access.',
'site_admin_forums' => 'Forum administrator access.',
'site_forums_double_post' => 'Can double post in the forums.', 'site_forums_double_post' => 'Can double post in the forums.',
'site_view_flow' => 'Can view stats and data pools.', 'site_view_flow' => 'Can view stats and data pools.',
'site_view_full_log' => 'Can view old log entries.', '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_moderate_requests', 'Can moderate any request.'); ?>
<? display_perm('site_delete_artist', 'Can delete artists (must be able to delete torrents+requests).'); ?> <? 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_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_flow', 'Can view site stats and data pools.'); ?>
<? display_perm('site_view_full_log', 'Can view the full site log.'); ?> <? display_perm('site_view_full_log', 'Can view the full site log.'); ?>
<? display_perm('site_view_torrent_snatchlist', 'Can view torrent snatchlists.'); ?> <? 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); error(403);
} }

View File

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

View File

@ -51,58 +51,62 @@
// If we're deleting a thread // If we're deleting a thread
if(isset($_POST['delete'])) { if(isset($_POST['delete'])) {
$DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'"); if(check_perms('site_admin_forums')) {
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'"); $DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'");
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'");
$DB->query("SELECT
t.ID, $DB->query("SELECT
t.LastPostID, t.ID,
t.Title, t.LastPostID,
p.AuthorID, t.Title,
um.Username, p.AuthorID,
p.AddedTime, um.Username,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID'), p.AddedTime,
t.IsLocked, (SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID'),
t.IsSticky t.IsLocked,
FROM forums_topics AS t t.IsSticky
JOIN forums_posts AS p ON p.ID=t.LastPostID FROM forums_topics AS t
LEFT JOIN users_main AS um ON um.ID=p.AuthorID JOIN forums_posts AS p ON p.ID=t.LastPostID
WHERE t.ForumID='$ForumID' LEFT JOIN users_main AS um ON um.ID=p.AuthorID
GROUP BY t.ID WHERE t.ForumID='$ForumID'
ORDER BY t.LastPostID DESC LIMIT 1"); GROUP BY t.ID
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_BOTH, false); 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, $DB->query("UPDATE forums SET
NumPosts=NumPosts-'$Posts', NumTopics=NumTopics-1,
LastPostTopicID='$NewLastTopic', NumPosts=NumPosts-'$Posts',
LastPostID='$NewLastPostID', LastPostTopicID='$NewLastTopic',
LastPostAuthorID='$NewLastAuthorID', LastPostID='$NewLastPostID',
LastPostTime='$NewLastAddedTime' LastPostAuthorID='$NewLastAuthorID',
WHERE ID='$ForumID'"); LastPostTime='$NewLastAddedTime'
WHERE ID='$ForumID'");
$Cache->delete('thread_'.$TopicID);
$Cache->delete('thread_'.$TopicID);
$Cache->begin_transaction('forums_list');
$UpdateArray = array( $Cache->begin_transaction('forums_list');
'NumPosts'=>$NumPosts, $UpdateArray = array(
'NumTopics'=>'-1', 'NumPosts'=>$NumPosts,
'LastPostID'=>$NewLastPostID, 'NumTopics'=>'-1',
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostID'=>$NewLastPostID,
'Username'=>$NewLastAuthorName, 'LastPostAuthorID'=>$NewLastAuthorID,
'LastPostTopicID'=>$NewLastTopic, 'Username'=>$NewLastAuthorName,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTopicID'=>$NewLastTopic,
'Title'=>$NewLastTitle, 'LastPostTime'=>$NewLastAddedTime,
'IsLocked'=>$NewLocked, 'Title'=>$NewLastTitle,
'IsSticky'=>$NewSticky 'IsLocked'=>$NewLocked,
); 'IsSticky'=>$NewSticky
);
$Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0); $Cache->update_row($ForumID, $UpdateArray);
$Cache->delete_value('thread_'.$TopicID.'_info'); $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 } else { // If we're just editing it
$Cache->begin_transaction('thread_'.$TopicID.'_info'); $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'))) { ?> 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> - <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> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a>
<? } <? }
if($PostID == $ThreadInfo['StickyPostID']) { ?> if($PostID == $ThreadInfo['StickyPostID']) { ?>
@ -382,7 +382,7 @@
<? if($EditedUserID){ ?> <? if($EditedUserID){ ?>
<br /> <br />
<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> <a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
@ -517,12 +517,14 @@
</select> </select>
</td> </td>
</tr> </tr>
<? if(check_perms('site_admin_forums')) { ?>
<tr> <tr>
<td class="label">Delete thread</td> <td class="label">Delete thread</td>
<td> <td>
<input type="checkbox" name="delete" tabindex="2" /> <input type="checkbox" name="delete" tabindex="2" />
</td> </td>
</tr> </tr>
<? } ?>
<tr> <tr>
<td colspan="2" class="center"> <td colspan="2" class="center">
<input type="submit" value="Edit thread" tabindex="2" /> <input type="submit" value="Edit thread" tabindex="2" />

View File

@ -11,6 +11,7 @@
<div class="thin"> <div class="thin">
<h2><?=SITE_NAME?> Staff</h2> <h2><?=SITE_NAME?> Staff</h2>
<div class="box pad" style="padding:0px 10px 10px 10px;"> <div class="box pad" style="padding:0px 10px 10px 10px;">
<br />
<h3>Contact Staff</h3> <h3>Contact Staff</h3>
<div id="staff_inbox" class="hidden"> <div id="staff_inbox" class="hidden">
<form action="staffpm.php" method="post"> <form action="staffpm.php" method="post">
@ -65,8 +66,8 @@
<? } ?> <? } ?>
</table> </table>
</div> </div>
<br />
<div class="box pad" style="padding:0px 10px 10px 10px;"> <div class="box pad" style="padding:0px 10px 10px 10px;">
<? <?
$CurClass = 0; $CurClass = 0;
$CloseTable = false; $CloseTable = false;
@ -80,8 +81,11 @@
} }
$CurClass = $Class; $CurClass = $Class;
$CloseTable = true; $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%"> <table class="staff" width="100%">
<tr class="colhead"> <tr class="colhead">
<td style="width:130px;">Username</td> <td style="width:130px;">Username</td>