Example #1
0
$Reason = $_POST['reason'];
$PrivateMessage = $_POST['privatemessage'];
$Body = $_POST['body'];
$WarningLength = $_POST['length'];
$PostID = (int) $_POST['postid'];
$UserID = (int) $_POST['userid'];
$Key = (int) $_POST['key'];
$SQLTime = sqltime();
$UserInfo = Users::user_info($UserID);
if ($UserInfo['Class'] > $LoggedUser['Class']) {
    error(403);
}
$URL = site_url() . "forums.php?action=viewthread&postid={$PostID}#post{$PostID}";
if ($WarningLength !== 'verbal') {
    $Time = (int) $WarningLength * (7 * 24 * 60 * 60);
    Tools::warn_user($UserID, $Time, "{$URL} - {$Reason}");
    $Subject = 'You have received a warning';
    $PrivateMessage = "You have received a {$WarningLength} week warning for [url={$URL}]this post[/url].\n\n" . $PrivateMessage;
    $WarnTime = time_plus($Time);
    $AdminComment = date('Y-m-d') . " - Warned until {$WarnTime} by " . $LoggedUser['Username'] . " for {$URL}\nReason: {$Reason}\n\n";
} 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";
    Tools::update_user_notes($UserID, $AdminComment);
}
$DB->query("\n\tINSERT INTO users_warnings_forums\n\t\t(UserID, Comment)\n\tVALUES\n\t\t('{$UserID}', '" . db_string($AdminComment) . "')\n\tON DUPLICATE KEY UPDATE\n\t\tComment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
//edit the post
$DB->query("\n\tSELECT\n\t\tp.Body,\n\t\tp.AuthorID,\n\t\tp.TopicID,\n\t\tt.ForumID,\n\t\tCEIL(\n\t\t\t(\n\t\t\t\tSELECT COUNT(p2.ID)\n\t\t\t\tFROM forums_posts AS p2\n\t\t\t\tWHERE p2.TopicID = p.TopicID\n\t\t\t\t\tAND p2.ID <= '{$PostID}'\n\t\t\t) / " . POSTS_PER_PAGE . "\n\t\t) AS Page\n\tFROM forums_posts AS p\n\t\tJOIN forums_topics AS t ON p.TopicID = t.ID\n\t\tJOIN forums AS f ON t.ForumID = f.ID\n\tWHERE p.ID = '{$PostID}'");
list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB->next_record();
Example #2
0
 if ($Upload) {
     $Cache->begin_transaction("user_info_heavy_{$UploaderID}");
     $Cache->update_row(false, array('DisableUpload' => '1'));
     $Cache->commit_transaction(0);
     $DB->query("\n\t\t\tUPDATE users_info\n\t\t\tSET DisableUpload = '1'\n\t\t\tWHERE UserID = {$UploaderID}");
 }
 if ($Warning > 0) {
     $WarnLength = $Warning * (7 * 24 * 60 * 60);
     $Reason = "Uploader of torrent ({$TorrentID}) {$RawName} which was resolved with the preset: " . $ResolveType['title'] . '.';
     if ($Escaped['admin_message']) {
         $Reason .= ' (' . $Escaped['admin_message'] . ').';
     }
     if ($Upload) {
         $Reason .= ' (Upload privileges removed).';
     }
     Tools::warn_user($UploaderID, $WarnLength, $Reason);
 } else {
     //This is a bitch for people that don't warn but do other things, it makes me sad.
     $AdminComment = '';
     if ($Upload) {
         //They removed upload
         $AdminComment .= 'Upload privileges removed by ' . $LoggedUser['Username'];
         $AdminComment .= "\nReason: Uploader of torrent ({$TorrentID}) " . db_string($RawName) . ' which was resolved with the preset: ' . $ResolveType['title'] . ". (Report ID: {$ReportID})";
     }
     if ($Escaped['admin_message']) {
         //They did nothing of note, but still want to mark it (Or upload and mark)
         $AdminComment .= ' (' . $Escaped['admin_message'] . ')';
     }
     if ($AdminComment) {
         $AdminComment = date('Y-m-d') . " - {$AdminComment}\n\n";
         $DB->query("\n\t\t\t\tUPDATE users_info\n\t\t\t\tSET AdminComment = CONCAT('" . db_string($AdminComment) . "', AdminComment)\n\t\t\t\tWHERE UserID = '" . db_string($UploaderID) . "'");