mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-02-20 20:29:03 +00:00
Empty commit
This commit is contained in:
parent
1acb471715
commit
82a17daa21
@ -2431,6 +2431,28 @@ function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if keys in $_POST and $_GET are all set
|
||||
* This reduces if statement redundancy for alot of variables
|
||||
*/
|
||||
function isset_request($Request, $Keys=NULL, $AllowEmpty = False, $Error=0) {
|
||||
if(isset($Keys)) {
|
||||
foreach($Keys as $K) {
|
||||
if(!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) {
|
||||
error($Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach($Request as $R) {
|
||||
if(!isset($R) || ($AllowEmpty == False && $R == '')) {
|
||||
error($Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Debug->set_flag('ending function definitions');
|
||||
//Include /sections/*/index.php
|
||||
|
@ -75,6 +75,9 @@
|
||||
case 'add_poll_option':
|
||||
require(SERVER_ROOT.'/sections/forums/add_poll_option.php');
|
||||
break;
|
||||
case 'take_warn':
|
||||
require(SERVER_ROOT.'/sections/forums/take_warn.php');
|
||||
break;
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
@ -131,7 +134,10 @@
|
||||
require(SERVER_ROOT.'/sections/forums/edit_rules.php');
|
||||
break;
|
||||
case 'thread_subscribe':
|
||||
break;
|
||||
break;
|
||||
case 'warn':
|
||||
require(SERVER_ROOT.'/sections/forums/warn.php');
|
||||
break;
|
||||
default:
|
||||
error(404);
|
||||
}
|
||||
|
81
sections/forums/take_warn.php
Normal file
81
sections/forums/take_warn.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);
|
||||
}
|
||||
isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'postid', 'userid'));
|
||||
|
||||
$Reason = db_string($_POST['reason']);
|
||||
$PrivateMessage = db_string($_POST['privatemessage']);
|
||||
$Body = db_string($_POST['body']);
|
||||
$Length = $_POST['length'];
|
||||
$PostID = (int)$_POST['postid'];
|
||||
$UserID = (int)$_POST['userid'];
|
||||
$Key = (int)$_POST['key'];
|
||||
$SQLTime = sqltime();
|
||||
$URL = "https://".SSL_SITE_URL."/forums.php?action=viewthread&postid=$PostID#post$PostID";
|
||||
if ($Length != 'verbal') {
|
||||
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
||||
warn_user($UserID, $Time, "$URL - " . $Reason);
|
||||
$Subject = "You have received a warning";
|
||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
} else {
|
||||
$Subject = "You have received a verbal warning";
|
||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
|
||||
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
$DB -> query('UPDATE users_info SET
|
||||
Warned=\'' . db_string($WarnTime) . '\',
|
||||
WarnedTimes=WarnedTimes+1,
|
||||
AdminComment=CONCAT(\'' . db_string($AdminComment) . '\',AdminComment)
|
||||
WHERE UserID=\'' . db_string($UserID) . '\'');
|
||||
}
|
||||
send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
//edit the post
|
||||
$DB -> query("SELECT
|
||||
p.Body,
|
||||
p.AuthorID,
|
||||
p.TopicID,
|
||||
t.ForumID,
|
||||
CEIL((SELECT COUNT(ID)
|
||||
FROM forums_posts
|
||||
WHERE forums_posts.TopicID = p.TopicID
|
||||
AND forums_posts.ID <= '$PostID')/" . POSTS_PER_PAGE . ")
|
||||
AS Page
|
||||
FROM forums_posts as p
|
||||
JOIN forums_topics as t on p.TopicID = t.ID
|
||||
JOIN forums as f ON t.ForumID=f.ID
|
||||
WHERE p.ID='$PostID'");
|
||||
list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB -> next_record();
|
||||
|
||||
// Perform the update
|
||||
$DB -> query("UPDATE forums_posts SET
|
||||
Body = '$Body',
|
||||
EditedUserID = '$UserID',
|
||||
EditedTime = '" . $SQLTime . "'
|
||||
WHERE ID='$PostID'");
|
||||
|
||||
$CatalogueID = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache -> begin_transaction('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
|
||||
if ($Cache -> MemcacheDBArray[$Key]['ID'] != $PostID) {
|
||||
$Cache -> cancel_transaction();
|
||||
$Cache -> delete('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
|
||||
//just clear the cache for would be cache-screwer-uppers
|
||||
} else {
|
||||
$Cache -> update_row($Key, array('ID' => $Cache -> MemcacheDBArray[$Key]['ID'], 'AuthorID' => $Cache -> MemcacheDBArray[$Key]['AuthorID'], 'AddedTime' => $Cache -> MemcacheDBArray[$Key]['AddedTime'], 'Body' => $_POST['body'], //Don't url decode.
|
||||
'EditedUserID' => $LoggedUser['ID'], 'EditedTime' => $SQLTime, 'Username' => $LoggedUser['Username']));
|
||||
$Cache -> commit_transaction(3600 * 24 * 5);
|
||||
}
|
||||
$ThreadInfo = get_thread_info($TopicID);
|
||||
if ($ThreadInfo['StickyPostID'] == $PostID) {
|
||||
$ThreadInfo['StickyPost']['Body'] = $_POST['body'];
|
||||
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];
|
||||
$ThreadInfo['StickyPost']['EditedTime'] = $SQLTime;
|
||||
$Cache -> cache_value('thread_' . $TopicID . '_info', $ThreadInfo, 0);
|
||||
}
|
||||
|
||||
$DB -> query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('forums', " . $PostID . ", " . $UserID . ", '" . $SQLTime . "', '" . db_string($OldBody) . "')");
|
||||
$Cache -> delete_value("forums_edits_$PostID");
|
||||
|
||||
header("Location: forums.php?action=viewthread&postid=$PostID#post$PostID");
|
||||
?>
|
@ -72,7 +72,7 @@
|
||||
$PostNum = 1;
|
||||
}
|
||||
list($Page,$Limit) = page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
||||
if(($Page-1)*$PerPage >= $ThreadInfo['Posts']) {
|
||||
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
||||
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
||||
}
|
||||
list($CatalogueID,$CatalogueLimit) = catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
||||
@ -408,7 +408,15 @@
|
||||
</span>
|
||||
<span id="bar<?=$PostID?>" style="float:right;">
|
||||
<a href="reports.php?action=report&type=post&id=<?=$PostID?>">[Report]</a>
|
||||
|
||||
<?
|
||||
if(check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||
$AuthorInfo = user_info($AuthorID);
|
||||
if($LoggedUser['Class'] >= $AuthorInfo['Class']) { ?>
|
||||
- <a href="forums.php?action=warn&postid=<?=$PostID?>&userid=<?=$AuthorID?>&key=<?=$Key?>">[Warn]</a>
|
||||
<? }
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="#">↑</a>
|
||||
</span>
|
||||
</td>
|
||||
|
62
sections/forums/warn.php
Normal file
62
sections/forums/warn.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);}
|
||||
isset_request($_GET, array('postid', 'userid', 'key'));
|
||||
$PostID = (int) $_GET['postid'];
|
||||
$UserID = (int)$_GET['userid'];
|
||||
$Key = (int)$_GET['key'];
|
||||
$UserInfo = user_info($UserID);
|
||||
$DB -> query("SELECT
|
||||
p.Body, t.ForumID
|
||||
FROM forums_posts as p JOIN forums_topics as t on p.TopicID = t.ID
|
||||
WHERE p.ID='$PostID'");
|
||||
list($PostBody, $ForumID) = $DB -> next_record();
|
||||
show_header('Warn User');
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<form action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>"/>
|
||||
<input type="hidden" name="userid" value="<?=$UserID?>"/>
|
||||
<input type="hidden" name="key" value="<?=$Key?>"/>
|
||||
<input type="hidden" name="action" value="take_warn"/>
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td class="label">Reason:</td>
|
||||
<td>
|
||||
<input type="text" name="reason" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Length:</td>
|
||||
<td>
|
||||
<select name="length">
|
||||
<option value="verbal">Verbal</option>
|
||||
<option value="1">1 week</option>
|
||||
<option value="2">2 week</option>
|
||||
<option value="4">4 week</option>
|
||||
<? if(check_perms("users_mod")) { ?>
|
||||
<option value="8">8 week</option>
|
||||
<? } ?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Private Message:</td>
|
||||
<td/>
|
||||
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label">Edit Post:</td>
|
||||
<td>
|
||||
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
|
||||
<br />
|
||||
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
@ -296,6 +296,7 @@
|
||||
if(check_perms('site_vote')){?>
|
||||
<a href="requests.php?type=voted">[Requests I've voted on]</a>
|
||||
<? } ?>
|
||||
<a href="bookmarks.php?type=requests">[Bookmarked requests]</a>
|
||||
<? } else { ?>
|
||||
<a href="bookmarks.php?type=torrents">[Torrents]</a>
|
||||
<a href="bookmarks.php?type=artists">[Artists]</a>
|
||||
|
@ -802,6 +802,12 @@ function filelist($Str) {
|
||||
<td colspan="2">
|
||||
<span style="float:left;"><a class="post_id" href='torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
|
||||
<strong><?=format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&type=torrents_comment&id=<?=$PostID?>">[Report]</a>
|
||||
<? if(check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||
$AuthorInfo = user_info($AuthorID);
|
||||
if($LoggedUser['Class'] >= $AuthorInfo['Class']) { ?>
|
||||
- <a href="torrents.php?action=warn&groupid=<?=$GroupID?>&postid=<?=$PostID?>&userid=<?=$AuthorID?>&key=<?=$Key?>">[Warn]</a>
|
||||
<? }
|
||||
} ?>
|
||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
|
||||
<?if ($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')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
|
||||
|
@ -382,6 +382,12 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
error(403);
|
||||
}
|
||||
break;
|
||||
case 'warn' :
|
||||
include(SERVER_ROOT.'/sections/torrents/warn.php');
|
||||
break;
|
||||
case 'take_warn' :
|
||||
include(SERVER_ROOT.'/sections/torrents/take_warn.php');
|
||||
break;
|
||||
default:
|
||||
enforce_login();
|
||||
|
||||
|
65
sections/torrents/take_warn.php
Normal file
65
sections/torrents/take_warn.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);
|
||||
}
|
||||
isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'groupid', 'postid', 'userid'));
|
||||
|
||||
$Reason = db_string($_POST['reason']);
|
||||
$PrivateMessage = db_string($_POST['privatemessage']);
|
||||
$Body = db_string($_POST['body']);
|
||||
$Length = $_POST['length'];
|
||||
$GroupID = (int)$_POST['groupid'];
|
||||
$PostID = (int)$_POST['postid'];
|
||||
$UserID = (int)$_POST['userid'];
|
||||
$Key = (int)$_POST['key'];
|
||||
$SQLTime = sqltime();
|
||||
$URL = "https://". SSL_SITE_URL."/torrents.php?id=$GroupID&postid=$PostID#post$PostID";
|
||||
if ($Length != 'verbal') {
|
||||
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
||||
warn_user($UserID, $Time, "$URL - ". $Reason);
|
||||
$Subject = "You have received a warning";
|
||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
} else {
|
||||
$Subject = "You have received a verbal warning";
|
||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
|
||||
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
$DB -> query('UPDATE users_info SET
|
||||
Warned=\'' . db_string($WarnTime) . '\',
|
||||
WarnedTimes=WarnedTimes+1,
|
||||
AdminComment=CONCAT(\'' . db_string($AdminComment) . '\',AdminComment)
|
||||
WHERE UserID=\'' . db_string($UserID) . '\'');
|
||||
}
|
||||
send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
// Mainly
|
||||
$DB -> query("SELECT
|
||||
tc.Body,
|
||||
tc.AuthorID,
|
||||
tc.GroupID,
|
||||
tc.AddedTime
|
||||
FROM torrents_comments AS tc
|
||||
WHERE tc.ID='$PostID'");
|
||||
list($OldBody, $AuthorID, $GroupID, $AddedTime) = $DB -> next_record();
|
||||
|
||||
$DB -> query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $PostID");
|
||||
list($Page) = $DB -> next_record();
|
||||
|
||||
// Perform the update
|
||||
$DB -> query("UPDATE torrents_comments SET
|
||||
Body = '$Body',
|
||||
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
||||
EditedTime = '" . sqltime() . "'
|
||||
WHERE ID='$PostID'");
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache -> begin_transaction('torrent_comments_' . $GroupID . '_catalogue_' . $CatalogueID);
|
||||
|
||||
$Cache -> update_row($_POST['key'], array('ID' => $_POST['postid'], 'AuthorID' => $AuthorID, 'AddedTime' => $AddedTime, 'Body' => $_POST['body'], 'EditedUserID' => db_string($LoggedUser['ID']), 'EditedTime' => sqltime(), 'Username' => $LoggedUser['Username']));
|
||||
$Cache -> commit_transaction(0);
|
||||
|
||||
$DB -> query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('torrents', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
|
||||
|
||||
header("Location: torrents.php?id=$GroupID&postid=$PostID#post$PostID");
|
||||
?>;
|
66
sections/torrents/warn.php
Normal file
66
sections/torrents/warn.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);}
|
||||
isset_request($_GET, array('groupid', 'postid', 'userid', 'key'));
|
||||
|
||||
$GroupID = (int) $_GET['groupid'];
|
||||
$PostID = (int) $_GET['postid'];
|
||||
$UserID = (int) $_GET['userid'];
|
||||
$Key = (int) $_GET['key'];
|
||||
$UserInfo = user_info($UserID);
|
||||
$DB -> query("SELECT
|
||||
tc.Body,
|
||||
tc.AddedTime
|
||||
FROM torrents_comments AS tc
|
||||
WHERE tc.ID='" . db_string($PostID) . "'");
|
||||
list($PostBody) = $DB -> next_record();
|
||||
|
||||
show_header('Warn User');
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<form action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>"/>
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>"/>
|
||||
<input type="hidden" name="userid" value="<?=$UserID?>"/>
|
||||
<input type="hidden" name="key" value="<?=$Key?>"/>
|
||||
<input type="hidden" name="action" value="take_warn"/>
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td class="label">Reason:</td>
|
||||
<td>
|
||||
<input type="text" name="reason" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Length:</td>
|
||||
<td>
|
||||
<select name="length">
|
||||
<option value="verbal">Verbal</option>
|
||||
<option value="1">1 week</option>
|
||||
<option value="2">2 week</option>
|
||||
<option value="4">4 week</option>
|
||||
<? if(check_perms("users_mod")) {
|
||||
?>
|
||||
<option value="8">8 week</option>
|
||||
<? }?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Private Message:</td>
|
||||
<td/>
|
||||
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Edit Post:</td>
|
||||
<td> <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
|
||||
<br />
|
||||
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user