Empty commit

This commit is contained in:
Git 2012-10-19 08:00:17 +00:00
parent 89a5553560
commit 9b52af5dc1
4 changed files with 89 additions and 64 deletions

View File

@ -235,5 +235,18 @@ public static function warn_user($UserID, $Duration, $Reason) {
WHERE UserID=\''.db_string($UserID).'\'');
}
}
/**
* Update the notes of a user
* @param unknown $UserID ID of user
* @param unknown $AdminComment Comment to update with
*/
public static function update_user_notes($UserID, $AdminComment) {
global $DB;
$DB->query('UPDATE users_info SET
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\'');
}
}
?>

View File

@ -1425,10 +1425,12 @@ CREATE TABLE `users_votes` (
`UserID` int(10) unsigned NOT NULL,
`GroupID` int(10) NOT NULL,
`Type` enum('Up','Down') DEFAULT NULL,
`Time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`UserID`,`GroupID`),
KEY `GroupID` (`GroupID`),
KEY `UserID` (`UserID`),
KEY `Type` (`Type`),
KEY `Time` (`Time`),
CONSTRAINT `users_votes_ibfk_1` FOREIGN KEY (`GroupID`) REFERENCES `torrents_group` (`ID`) ON DELETE CASCADE,
CONSTRAINT `users_votes_ibfk_2` FOREIGN KEY (`UserID`) REFERENCES `users_main` (`ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,6 @@
<?php
if (!check_perms('users_warn')) { error(404);
if (!check_perms('users_warn')) {
error(404);
}
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'postid', 'userid'));
@ -35,6 +36,7 @@
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Tools::update_user_notes($UserID, $AdminComment);
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
//edit the post
@ -46,7 +48,8 @@
CEIL((SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= '$PostID')/" . POSTS_PER_PAGE . ")
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
@ -68,7 +71,8 @@
$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.
$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);
}

View File

@ -1,5 +1,6 @@
<?php
if (!check_perms('users_warn')) { error(404);
if (!check_perms('users_warn')) {
error(404);
}
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'groupid', 'postid', 'userid'));
@ -29,8 +30,10 @@
$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("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment)
. "')
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Tools::update_user_notes($UserID, $AdminComment);
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
// Mainly
@ -57,11 +60,14 @@
$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->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) . "')");
VALUES ('torrents', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody)
. "')");
header("Location: torrents.php?id=$GroupID&postid=$PostID#post$PostID");
?>;
?>
;