mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 04:01:35 +00:00
Empty commit
This commit is contained in:
parent
df1de3ebad
commit
f1e4a4c6e7
@ -19,11 +19,11 @@ public static function post($Page, $PageID, $Body) {
|
||||
SELECT
|
||||
CEIL(
|
||||
(
|
||||
SELECT COUNT(ID)+1
|
||||
SELECT COUNT(ID) + 1
|
||||
FROM comments
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID
|
||||
)/" . TORRENT_COMMENTS_PER_PAGE . "
|
||||
) / " . TORRENT_COMMENTS_PER_PAGE . "
|
||||
) AS Pages");
|
||||
list($Pages) = G::$DB->next_record();
|
||||
|
||||
@ -126,7 +126,8 @@ public static function delete($PostID) {
|
||||
CEIL(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
|
||||
CEIL(SUM(IF(ID <= $PostID, 1, 0)) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
||||
FROM comments
|
||||
WHERE Page = '$Page' AND PageID = $PageID
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID
|
||||
GROUP BY PageID");
|
||||
if (!G::$DB->has_results()) {
|
||||
// the comment $PostID was probably not posted on $Page
|
||||
@ -139,10 +140,18 @@ public static function delete($PostID) {
|
||||
// $CommPage = which page the post is on
|
||||
// These are set for cache clearing.
|
||||
|
||||
G::$DB->query("DELETE FROM comments WHERE ID = $PostID");
|
||||
G::$DB->query("DELETE FROM comments_edits WHERE Page = '$Page' AND PostID = $PostID");
|
||||
G::$DB->query("
|
||||
DELETE FROM comments
|
||||
WHERE ID = $PostID");
|
||||
G::$DB->query("
|
||||
DELETE FROM comments_edits
|
||||
WHERE Page = '$Page'
|
||||
AND PostID = $PostID");
|
||||
|
||||
G::$DB->query("DELETE FROM users_notify_quoted WHERE Page = '$Page' AND PostID = $PostID");
|
||||
G::$DB->query("
|
||||
DELETE FROM users_notify_quoted
|
||||
WHERE Page = '$Page'
|
||||
AND PostID = $PostID");
|
||||
|
||||
Subscriptions::flush_subscriptions($Page, $PageID);
|
||||
Subscriptions::flush_quote_notifications($Page, $PageID);
|
||||
@ -158,7 +167,7 @@ public static function delete($PostID) {
|
||||
|
||||
if ($Page == 'collages') {
|
||||
// On collages, we also need to clear the collage key (collage_$CollageID), because it has the comments in it... (why??)
|
||||
G::$Cache->delete_value('collage_' . $PageID);
|
||||
G::$Cache->delete_value("collage_$PageID");
|
||||
}
|
||||
|
||||
G::$DB->set_query_id($QueryID);
|
||||
@ -197,7 +206,10 @@ public static function get_url($Page, $PageID, $PostID = null) {
|
||||
public static function get_url_query($PostID) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
|
||||
G::$DB->query("SELECT Page, PageID FROM comments WHERE ID = $PostID");
|
||||
G::$DB->query("
|
||||
SELECT Page, PageID
|
||||
FROM comments
|
||||
WHERE ID = $PostID");
|
||||
if (!G::$DB->has_results()) {
|
||||
error(404);
|
||||
}
|
||||
@ -225,7 +237,7 @@ public static function load($Page, $PageID, $HandleSubscriptions = true) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
|
||||
// Get the total number of comments
|
||||
$NumComments = G::$Cache->get_value($Page.'_comments_'.$PageID);
|
||||
$NumComments = G::$Cache->get_value($Page."_comments_$PageID");
|
||||
if ($NumComments === false) {
|
||||
G::$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
@ -233,7 +245,7 @@ public static function load($Page, $PageID, $HandleSubscriptions = true) {
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
list($NumComments) = G::$DB->next_record();
|
||||
G::$Cache->cache_value($Page.'_comments_'.$PageID, $NumComments, 0);
|
||||
G::$Cache->cache_value($Page."_comments_$PageID", $NumComments, 0);
|
||||
}
|
||||
|
||||
// If a postid was passed, we need to determine which page that comment is on.
|
||||
@ -269,7 +281,8 @@ public static function load($Page, $PageID, $HandleSubscriptions = true) {
|
||||
u.Username
|
||||
FROM comments AS c
|
||||
LEFT JOIN users_main AS u ON u.ID = c.EditedUserID
|
||||
WHERE c.Page = '$Page' AND c.PageID = $PageID
|
||||
WHERE c.Page = '$Page'
|
||||
AND c.PageID = $PageID
|
||||
ORDER BY c.ID
|
||||
LIMIT $CatalogueLimit");
|
||||
$Catalogue = G::$DB->to_array(false, MYSQLI_ASSOC);
|
||||
@ -298,13 +311,21 @@ public static function load($Page, $PageID, $HandleSubscriptions = true) {
|
||||
}
|
||||
|
||||
// last read
|
||||
G::$DB->query("SELECT PostID FROM users_comments_last_read WHERE UserID = " . G::$LoggedUser['ID'] . " AND Page = '$Page' AND PageID = $PageID");
|
||||
G::$DB->query("
|
||||
SELECT PostID
|
||||
FROM users_comments_last_read
|
||||
WHERE UserID = " . G::$LoggedUser['ID'] . "
|
||||
AND Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
list($LastRead) = G::$DB->next_record();
|
||||
if($LastRead < $LastPost) {
|
||||
G::$DB->query("INSERT INTO users_comments_last_read
|
||||
(UserID, Page, PageID, PostID) VALUES
|
||||
(" . G::$LoggedUser['ID'] . ", '$Page', $PageID, $LastPost)
|
||||
ON DUPLICATE KEY UPDATE PostID = $LastPost");
|
||||
if ($LastRead < $LastPost) {
|
||||
G::$DB->query("
|
||||
INSERT INTO users_comments_last_read
|
||||
(UserID, Page, PageID, PostID)
|
||||
VALUES
|
||||
(" . G::$LoggedUser['ID'] . ", '$Page', $PageID, $LastPost)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = $LastPost");
|
||||
G::$Cache->delete_value('subscriptions_user_new_' . G::$LoggedUser['ID']);
|
||||
}
|
||||
} else {
|
||||
@ -325,10 +346,18 @@ public static function load($Page, $PageID, $HandleSubscriptions = true) {
|
||||
public static function merge($Page, $PageID, $TargetPageID) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
|
||||
G::$DB->query("UPDATE comments SET PageID = $TargetPageID WHERE Page = '$Page' AND PageID = $PageID");
|
||||
G::$DB->query("
|
||||
UPDATE comments
|
||||
SET PageID = $TargetPageID
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
|
||||
// quote notifications
|
||||
G::$DB->query("UPDATE users_notify_quoted SET PageID = $TargetPageID WHERE Page = '$Page' AND PageID = $PageID");
|
||||
G::$DB->query("
|
||||
UPDATE users_notify_quoted
|
||||
SET PageID = $TargetPageID
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
|
||||
// comment subscriptions
|
||||
Subscriptions::move_subscriptions($Page, $PageID, $TargetPageID);
|
||||
@ -344,9 +373,9 @@ public static function merge($Page, $PageID, $TargetPageID) {
|
||||
list($CommPages) = G::$DB->next_record();
|
||||
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $CommPages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
for ($i = 0; $i <= $LastCatalogue; ++$i) {
|
||||
G::$Cache->delete_value($Page . '_comments_' . $TargetPageID . '_catalogue_' . $i);
|
||||
G::$Cache->delete_value($Page . "_comments_$TargetPageID" . "_catalogue_$i");
|
||||
}
|
||||
G::$Cache->delete_value($Page.'_comments_'.$TargetPageID);
|
||||
G::$Cache->delete_value($Page."_comments_$TargetPageID");
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
@ -364,7 +393,8 @@ public static function delete_page($Page, $PageID) {
|
||||
SELECT
|
||||
CEIL(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Pages
|
||||
FROM comments
|
||||
WHERE Page = '$Page' AND PageID = $PageID
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID
|
||||
GROUP BY PageID");
|
||||
if (!G::$DB->has_results()) {
|
||||
return false;
|
||||
@ -372,11 +402,17 @@ public static function delete_page($Page, $PageID) {
|
||||
list($CommPages) = G::$DB->next_record();
|
||||
|
||||
// Delete comments
|
||||
G::$DB->query("DELETE FROM comments WHERE Page = '$Page' AND PageID = $PageID");
|
||||
G::$DB->query("
|
||||
DELETE FROM comments
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
|
||||
// Delete quote notifications
|
||||
Subscriptions::flush_quote_notifications($Page, $PageID);
|
||||
G::$DB->query("DELETE FROM users_notify_quoted WHERE Page = '$Page' AND PageID = $PageID");
|
||||
G::$DB->query("
|
||||
DELETE FROM users_notify_quoted
|
||||
WHERE Page = '$Page'
|
||||
AND PageID = $PageID");
|
||||
|
||||
// Deal with subscriptions
|
||||
Subscriptions::move_subscriptions($Page, $PageID, null);
|
||||
|
@ -9,7 +9,7 @@ public static function render_mod_donations($UserID) { ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Value</td>
|
||||
<td class="label">Value:</td>
|
||||
<td>
|
||||
<input type="text" name="donation_value" onkeypress="return isNumberKey(event);" />
|
||||
<select name="donation_currency">
|
||||
@ -20,7 +20,7 @@ public static function render_mod_donations($UserID) { ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Reason</td>
|
||||
<td class="label">Reason:</td>
|
||||
<td><input type="text" class="wide_input_text" name="donation_reason" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -37,15 +37,15 @@ public static function render_mod_donations($UserID) { ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label tooltip" title="Active points determine a user's Donor Rank and do expire.">Active points</td>
|
||||
<td class="label tooltip" title="Active points determine a user's Donor Rank and do expire.">Active points:</td>
|
||||
<td><input type="text" name="donor_rank" onkeypress="return isNumberKey(event);" value="<?=Donations::get_rank($UserID)?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label tooltip" title="Total points represent a user's overall total and never expire. Total points determines a user's Special Rank and Donor Leaderboard placement.">Total points</td>
|
||||
<td class="label tooltip" title="Total points represent a user's overall total and never expire. Total points determines a user's Special Rank and Donor Leaderboard placement.">Total points:</td>
|
||||
<td><input type="text" name="total_donor_rank" onkeypress="return isNumberKey(event);" value="<?=Donations::get_total_rank($UserID)?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Reason</td>
|
||||
<td class="label">Reason:</td>
|
||||
<td><input type="text" class="wide_input_text" name="reason" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
class MASS_USER_BOOKMARKS_EDITOR extends MASS_USER_TORRENTS_EDITOR {
|
||||
public function __construct ($Table = 'bookmarks_torrents') {
|
||||
public function __construct($Table = 'bookmarks_torrents') {
|
||||
$this->set_table($Table);
|
||||
}
|
||||
|
||||
@ -20,10 +20,11 @@ public function __construct ($Table = 'bookmarks_torrents') {
|
||||
*
|
||||
* @param string $sql
|
||||
*/
|
||||
protected function query_and_clear_cache ($sql) {
|
||||
protected function query_and_clear_cache($sql) {
|
||||
$QueryID = G::$DB->get_query_id();
|
||||
if (is_string($sql) && G::$DB->query($sql))
|
||||
if (is_string($sql) && G::$DB->query($sql)) {
|
||||
G::$Cache->delete_value('bookmarks_group_ids_' . G::$LoggedUser['ID']);
|
||||
}
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
@ -32,15 +33,19 @@ protected function query_and_clear_cache ($sql) {
|
||||
*
|
||||
* Uses an IN() to match multiple items in one query.
|
||||
*/
|
||||
public function mass_remove () {
|
||||
public function mass_remove() {
|
||||
$SQL = array();
|
||||
foreach ($_POST['remove'] as $GroupID => $K) {
|
||||
if (is_number($GroupID))
|
||||
if (is_number($GroupID)) {
|
||||
$SQL[] = sprintf('%d', $GroupID);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($SQL)) {
|
||||
$SQL = sprintf('DELETE FROM %s WHERE UserID = %d AND GroupID IN (%s)',
|
||||
$SQL = sprintf('
|
||||
DELETE FROM %s
|
||||
WHERE UserID = %d
|
||||
AND GroupID IN (%s)',
|
||||
$this->Table,
|
||||
G::$LoggedUser['ID'],
|
||||
implode(', ', $SQL)
|
||||
@ -52,18 +57,24 @@ public function mass_remove () {
|
||||
/**
|
||||
* Uses $_POST['sort'] values to update the DB.
|
||||
*/
|
||||
public function mass_update () {
|
||||
public function mass_update() {
|
||||
$SQL = array();
|
||||
foreach ($_POST['sort'] as $GroupID => $Sort) {
|
||||
if (is_number($Sort) && is_number($GroupID))
|
||||
if (is_number($Sort) && is_number($GroupID)) {
|
||||
$SQL[] = sprintf('(%d, %d, %d)', $GroupID, $Sort, G::$LoggedUser['ID']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($SQL)) {
|
||||
$SQL = sprintf('INSERT INTO %s (GroupID, Sort, UserID) VALUES %s
|
||||
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)',
|
||||
$this->Table,
|
||||
implode(', ', $SQL));
|
||||
$SQL = sprintf('
|
||||
INSERT INTO %s
|
||||
(GroupID, Sort, UserID)
|
||||
VALUES
|
||||
%s
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Sort = VALUES (Sort)',
|
||||
$this->Table,
|
||||
implode(', ', $SQL));
|
||||
$this->query_and_clear_cache($SQL);
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
||||
G::$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID=".$AuthorID);
|
||||
WHERE ID = $AuthorID");
|
||||
if (!G::$DB->has_results()) {
|
||||
G::$DB->set_query_id($QueryID);
|
||||
return -2;
|
||||
@ -183,8 +183,8 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
||||
G::$DB->query("
|
||||
UPDATE forums
|
||||
SET
|
||||
NumPosts = NumPosts+1,
|
||||
NumTopics = NumTopics+1,
|
||||
NumPosts = NumPosts + 1,
|
||||
NumTopics = NumTopics + 1,
|
||||
LastPostID = '$PostID',
|
||||
LastPostAuthorID = '$AuthorID',
|
||||
LastPostTopicID = '$TopicID',
|
||||
@ -194,14 +194,14 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
||||
G::$DB->query("
|
||||
UPDATE forums_topics
|
||||
SET
|
||||
NumPosts = NumPosts+1,
|
||||
NumPosts = NumPosts + 1,
|
||||
LastPostID = '$PostID',
|
||||
LastPostAuthorID = '$AuthorID',
|
||||
LastPostTime = '".sqltime()."'
|
||||
WHERE ID = '$TopicID'");
|
||||
|
||||
// Bump this topic to head of the cache
|
||||
list($Forum,,, $Stickies) = G::$Cache->get_value('forums_'.$ForumID);
|
||||
list($Forum,,, $Stickies) = G::$Cache->get_value("forums_$ForumID");
|
||||
if (!empty($Forum)) {
|
||||
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
|
||||
array_pop($Forum);
|
||||
@ -236,7 +236,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
||||
if (is_null($Part1)) { $Part1 = array(); }
|
||||
if (is_null($Part3)) { $Part3 = array(); }
|
||||
$Forum = $Part1 + $Part2 + $Part3;
|
||||
G::$Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0);
|
||||
G::$Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
|
||||
}
|
||||
|
||||
//Update the forum root
|
||||
|
@ -583,8 +583,8 @@ public static function clear_subscriptions() {
|
||||
SELECT '" . G::$LoggedUser['ID'] . "', ID, LastPostID
|
||||
FROM forums_topics
|
||||
WHERE ID IN (".implode(',', $UserSubscriptions).')
|
||||
ON DUPLICATE KEY
|
||||
UPDATE PostID = LastPostID');
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = LastPostID');
|
||||
}
|
||||
G::$Cache->delete_value('subscriptions_user_new_' . G::$LoggedUser['ID']);
|
||||
G::$DB->set_query_id($QueryID);
|
||||
|
@ -207,14 +207,17 @@ function music_form($GenreTags) {
|
||||
<option value="3"<?=($Importance == '3' ? ' selected="selected"' : '')?>>Remixer</option>
|
||||
<option value="7"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option>
|
||||
</select>
|
||||
<? if ($FirstArtist) {
|
||||
if (!$this->DisabledFlag) { ?>
|
||||
<?
|
||||
if ($FirstArtist) {
|
||||
if (!$this->DisabledFlag) { ?>
|
||||
<a href="javascript:AddArtistField()" class="brackets">+</a> <a href="javascript:RemoveArtistField()" class="brackets">−</a>
|
||||
<? }
|
||||
$FirstArtist = false;
|
||||
} ?>
|
||||
<?
|
||||
}
|
||||
$FirstArtist = false;
|
||||
} ?>
|
||||
<br />
|
||||
<? }
|
||||
<?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
@ -228,7 +231,7 @@ function music_form($GenreTags) {
|
||||
<option value="3">Remixer</option>
|
||||
<option value="7">Producer</option>
|
||||
</select>
|
||||
<a href="#" onclick="AddArtistField();return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField();return false;" class="brackets">−</a>
|
||||
<a href="#" onclick="AddArtistField(); return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField(); return false;" class="brackets">−</a>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
@ -273,15 +276,15 @@ function music_form($GenreTags) {
|
||||
}
|
||||
|
||||
function hide() {
|
||||
document.getElementById("musicbrainz_tr").style.display="none";
|
||||
document.getElementById("musicbrainz_popup").style.display="none";
|
||||
document.getElementById("popup_background").style.display="none";
|
||||
document.getElementById("musicbrainz_tr").style.display = "none";
|
||||
document.getElementById("musicbrainz_popup").style.display = "none";
|
||||
document.getElementById("popup_background").style.display = "none";
|
||||
}
|
||||
|
||||
function show() {
|
||||
document.getElementById("musicbrainz_tr").style.display="";
|
||||
document.getElementById("musicbrainz_popup").style.display="";
|
||||
document.getElementById("popup_background").style.display="";
|
||||
document.getElementById("musicbrainz_tr").style.display = "";
|
||||
document.getElementById("musicbrainz_popup").style.display = "";
|
||||
document.getElementById("popup_background").style.display = "";
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
@ -331,17 +334,17 @@ function show() {
|
||||
<tr>
|
||||
<td class="label">Edition information:</td>
|
||||
<td>
|
||||
<input type="checkbox" id="remaster" name="remaster"<? if ($IsRemaster) { echo ' checked="checked"';} ?> onclick="Remaster();<? if ($this->NewTorrent) { ?> CheckYear();<? } ?>" />
|
||||
<input type="checkbox" id="remaster" name="remaster"<? if ($IsRemaster) { echo ' checked="checked"'; } ?> onclick="Remaster();<? if ($this->NewTorrent) { ?> CheckYear();<? } ?>" />
|
||||
<label for="remaster">Check this box if this torrent is a different release to the original, for example a limited or country specific edition or a release that includes additional bonus tracks or is a bonus disc.</label>
|
||||
<div id="remaster_true"<? if (!$IsRemaster) { echo ' class="hidden"';} ?>>
|
||||
<? if (check_perms('edit_unknowns') || G::$LoggedUser['ID'] == $Torrent['UserID']) { ?>
|
||||
<br />
|
||||
<input type="checkbox" id="unknown" name="unknown"<? if ($UnknownRelease) { echo ' checked="checked"';} ?> onclick="<? if ($this->NewTorrent) { ?> CheckYear();<? } ?>ToggleUnknown();" /> <label for="unknown">Unknown Release</label>
|
||||
<input type="checkbox" id="unknown" name="unknown"<? if ($UnknownRelease) { echo ' checked="checked"'; } ?> onclick="<? if ($this->NewTorrent) { ?>CheckYear(); <? } ?>ToggleUnknown();" /> <label for="unknown">Unknown Release</label>
|
||||
<? } ?>
|
||||
<br /><br />
|
||||
<? if (!empty($GroupRemasters)) { ?>
|
||||
<input type="hidden" id="json_remasters" value="<?=display_str(json_encode($GroupRemasters))?>" />
|
||||
<select id="groupremasters" name="groupremasters" onchange="GroupRemaster()"<? if ($UnknownRelease) { echo ' disabled="disabled"';} ?>>
|
||||
<select id="groupremasters" name="groupremasters" onchange="GroupRemaster()"<? if ($UnknownRelease) { echo ' disabled="disabled"'; } ?>>
|
||||
<option value="">-------</option>
|
||||
<?
|
||||
$LastLine = '';
|
||||
@ -454,8 +457,7 @@ function show() {
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
if ($this->NewTorrent) { ?>
|
||||
<? if ($this->NewTorrent) { ?>
|
||||
<tr id="upload_logs" class="hidden">
|
||||
<td class="label">
|
||||
Log files:
|
||||
@ -466,8 +468,8 @@ function show() {
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
} ?>
|
||||
<? if ($this->NewTorrent) { ?>
|
||||
}
|
||||
if ($this->NewTorrent) { ?>
|
||||
<tr>
|
||||
<td class="label">Multi-format uploader:</td>
|
||||
<td><input type="button" value="+" id="add_format" /><input type="button" style="display: none;" value="-" id="remove_format" /></td>
|
||||
|
@ -546,7 +546,8 @@ public static function update_hash($GroupID) {
|
||||
GROUP BY ta.GroupID
|
||||
) AS artists
|
||||
JOIN torrents USING(GroupID)
|
||||
ON DUPLICATE KEY UPDATE ArtistName = VALUES(ArtistName)");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
ArtistName = VALUES(ArtistName)");
|
||||
*/
|
||||
G::$Cache->delete_value("torrents_details_$GroupID");
|
||||
G::$Cache->delete_value("torrent_group_$GroupID");
|
||||
|
@ -128,7 +128,8 @@
|
||||
(UserID, TopicID, PostID)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
|
||||
ON DUPLICATE KEY UPDATE PostID = '$LastPost'");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = '$LastPost'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,16 +39,20 @@
|
||||
if ($Type == 'Up') {
|
||||
$GroupVotes['Ups'] += 1;
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
$Cache->cache_value("votes_$GroupID", $GroupVotes);
|
||||
|
||||
// If the group has no votes yet, we need an insert, otherwise an update
|
||||
// so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE...
|
||||
// to accomplish both in one query
|
||||
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
|
||||
VALUES ($GroupID, 1, ".($Type == 'Up' ? 1 : 0).", 0)
|
||||
ON DUPLICATE KEY UPDATE Total = Total + 1,
|
||||
Score = IFNULL(binomial_ci(Ups".($Type == 'Up' ? '+1' : '').",Total),0)".
|
||||
($Type == 'Up' ? ', Ups = Ups+1' : ''));
|
||||
$DB->query("
|
||||
INSERT INTO torrents_votes
|
||||
(GroupID, Total, Ups, Score)
|
||||
VALUES
|
||||
($GroupID, 1, ".($Type == 'Up' ? 1 : 0).", 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Total = Total + 1,
|
||||
Score = IFNULL(binomial_ci(Ups".($Type == 'Up' ? '+1' : '').", Total), 0)".
|
||||
($Type == 'Up' ? ', Ups = Ups + 1' : ''));
|
||||
|
||||
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
|
||||
|
||||
@ -59,7 +63,7 @@
|
||||
// First update this album's paired votes. If this keys is magically not set,
|
||||
// our life just got a bit easier. We're only tracking paired votes on upvotes.
|
||||
if ($Type == 'Up') {
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
|
||||
$VotePairs = $Cache->get_value("vote_pairs_$GroupID", true);
|
||||
if ($VotePairs !== false) {
|
||||
foreach ($UserVotes as $Vote) {
|
||||
if ($Vote['GroupID'] == $GroupID) {
|
||||
@ -73,13 +77,14 @@
|
||||
$VotePairs[$Vote['GroupID']]['Ups'] += 1;
|
||||
}
|
||||
} else {
|
||||
$VotePairs[$Vote['GroupID']] = array('GroupID'=>$Vote['GroupID'],
|
||||
'Total' => 1,
|
||||
'Ups'=>($Type == 'Up') ? 1 : 0);
|
||||
$VotePairs[$Vote['GroupID']] = array(
|
||||
'GroupID' => $Vote['GroupID'],
|
||||
'Total' => 1,
|
||||
'Ups' => ($Type == 'Up') ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
||||
$Cache->cache_value("vote_pairs_$GroupID", $VotePairs);
|
||||
}
|
||||
|
||||
// Now do the paired votes keys for all of this guy's other votes
|
||||
@ -92,7 +97,7 @@
|
||||
continue;
|
||||
}
|
||||
// Again, if the cache key is not set, move along
|
||||
$VotePairs = $Cache->get_value('vote_pairs_'.$VGID, true);
|
||||
$VotePairs = $Cache->get_value("vote_pairs_$VGID", true);
|
||||
if ($VotePairs !== false) {
|
||||
// Go through all of the other albums paired to this one, and update
|
||||
// this group's entry in their vote_pairs keys
|
||||
@ -102,11 +107,12 @@
|
||||
$VotePairs[$GroupID]['Ups']++;
|
||||
}
|
||||
} else {
|
||||
$VotePairs[$GroupID] = array('GroupID' => $GroupID,
|
||||
'Total' => 1,
|
||||
'Ups'=>($Type == 'Up') ? 1 : 0);
|
||||
$VotePairs[$GroupID] = array(
|
||||
'GroupID' => $GroupID,
|
||||
'Total' => 1,
|
||||
'Ups' => ($Type == 'Up') ? 1 : 0);
|
||||
}
|
||||
$Cache->cache_value('vote_pairs_'.$VGID, $VotePairs);
|
||||
$Cache->cache_value("vote_pairs_$VGID", $VotePairs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +127,8 @@
|
||||
|
||||
$DB->query("
|
||||
DELETE FROM users_votes
|
||||
WHERE UserID=$UserID
|
||||
AND GroupID=$GroupID");
|
||||
WHERE UserID = $UserID
|
||||
AND GroupID = $GroupID");
|
||||
|
||||
// Update personal cache key
|
||||
unset($UserVotes[$GroupID]);
|
||||
@ -133,12 +139,13 @@
|
||||
if ($Type == 'Up') {
|
||||
$GroupVotes['Ups'] -= 1;
|
||||
}
|
||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||
$Cache->cache_value("votes_$GroupID", $GroupVotes);
|
||||
|
||||
$DB->query('
|
||||
UPDATE torrents_votes
|
||||
SET Total = GREATEST(0, Total - 1),
|
||||
Score = IFNULL(binomial_ci(GREATEST(0, Ups'.($Type == 'Up' ? '-1' : '').'),GREATEST(0, Total)), 0)'.
|
||||
SET
|
||||
Total = GREATEST(0, Total - 1),
|
||||
Score = IFNULL(binomial_ci(GREATEST(0, Ups'.($Type == 'Up' ? '-1' : '').'), GREATEST(0, Total)), 0)'.
|
||||
($Type == 'Up' ? ', Ups = GREATEST(0, Ups - 1)' : '')."
|
||||
WHERE GroupID=$GroupID");
|
||||
// Update paired cache keys
|
||||
|
@ -346,7 +346,7 @@ function compare($X, $Y) {
|
||||
<tr class="colhead_dark">
|
||||
<td><!-- expand/collapse --></td>
|
||||
<td><!-- Category --></td>
|
||||
<td width="70%"><strong>Torrents</strong> (<a href="#" onclick="return false;">View</a>)</td>
|
||||
<td width="70%"><strong>Torrents</strong></td>
|
||||
<td>Size</td>
|
||||
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
|
||||
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
|
||||
|
@ -54,7 +54,8 @@
|
||||
(ArtistID, Sort, CollageID)
|
||||
VALUES
|
||||
' . implode(', ', $SQL) . '
|
||||
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Sort = VALUES (Sort)';
|
||||
|
||||
$DB->query($SQL);
|
||||
}
|
||||
|
@ -53,7 +53,8 @@
|
||||
(GroupID, Sort, CollageID)
|
||||
VALUES
|
||||
' . implode(', ', $SQL) . '
|
||||
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Sort = VALUES (Sort)';
|
||||
|
||||
$DB->query($SQL);
|
||||
}
|
||||
|
@ -39,9 +39,12 @@
|
||||
Tools::update_user_notes($AuthorID, $AdminComment);
|
||||
}
|
||||
$DB->query("
|
||||
INSERT INTO users_warnings_forums (UserID, Comment)
|
||||
VALUES('$AuthorID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
INSERT INTO users_warnings_forums
|
||||
(UserID, Comment)
|
||||
VALUES
|
||||
('$AuthorID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
Misc::send_pm($AuthorID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
Comments::edit($PostID, $Body);
|
||||
|
@ -7,8 +7,8 @@
|
||||
if ($_GET['forumid'] == 'all') {
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET CatchupTime=NOW()
|
||||
WHERE UserID=$LoggedUser[ID]");
|
||||
SET CatchupTime = NOW()
|
||||
WHERE UserID = $LoggedUser[ID]");
|
||||
$Cache->delete_value('user_info_'.$LoggedUser['ID']);
|
||||
header('Location: forums.php');
|
||||
|
||||
@ -18,9 +18,10 @@
|
||||
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
|
||||
SELECT '$LoggedUser[ID]', ID, LastPostID
|
||||
FROM forums_topics
|
||||
WHERE (LastPostTime>'".time_minus(3600 * 24 * 30)."' OR IsSticky='1')
|
||||
WHERE (LastPostTime > '".time_minus(3600 * 24 * 30)."' OR IsSticky = '1')
|
||||
AND ForumID = ".$_GET['forumid']."
|
||||
ON DUPLICATE KEY UPDATE PostID=LastPostID");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = LastPostID");
|
||||
|
||||
header('Location: forums.php?action=viewforum&forumid='.$_GET['forumid']);
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
$PrivateMessage = $_POST['privatemessage'];
|
||||
$Body = $_POST['body'];
|
||||
$Length = $_POST['length'];
|
||||
$PostID = (int) $_POST['postid'];
|
||||
$UserID = (int) $_POST['userid'];
|
||||
$Key = (int) $_POST['key'];
|
||||
$PostID = (int)$_POST['postid'];
|
||||
$UserID = (int)$_POST['userid'];
|
||||
$Key = (int)$_POST['key'];
|
||||
$SQLTime = sqltime();
|
||||
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
@ -36,9 +36,12 @@
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO users_warnings_forums (UserID, Comment)
|
||||
VALUES('$UserID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
INSERT INTO users_warnings_forums
|
||||
(UserID, Comment)
|
||||
VALUES
|
||||
('$UserID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
//edit the post
|
||||
@ -55,8 +58,8 @@
|
||||
. ") 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'");
|
||||
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
|
||||
@ -65,7 +68,7 @@
|
||||
SET Body = '" . db_string($Body) . "',
|
||||
EditedUserID = '$UserID',
|
||||
EditedTime = '$SQLTime'
|
||||
WHERE ID='$PostID'");
|
||||
WHERE ID = '$PostID'");
|
||||
|
||||
$CatalogueID = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
|
||||
|
@ -130,9 +130,12 @@
|
||||
list($LastRead) = $DB->next_record();
|
||||
if ($LastRead < $LastPost) {
|
||||
$DB->query("
|
||||
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
|
||||
VALUES ('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
|
||||
ON DUPLICATE KEY UPDATE PostID='$LastPost'");
|
||||
INSERT INTO forums_last_read_topics
|
||||
(UserID, TopicID, PostID)
|
||||
VALUES
|
||||
('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = '$LastPost'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
$DB->query("
|
||||
SELECT ConvID
|
||||
FROM pm_conversations_users
|
||||
WHERE UserID='$UserID'
|
||||
AND InInbox='1'
|
||||
AND (ForwardedTo=0 OR ForwardedTo=UserID)
|
||||
AND ConvID='$ConvID'");
|
||||
WHERE UserID = '$UserID'
|
||||
AND InInbox = '1'
|
||||
AND (ForwardedTo = 0 OR ForwardedTo = UserID)
|
||||
AND ConvID = '$ConvID'");
|
||||
if (!$DB->has_results()) {
|
||||
error(403);
|
||||
}
|
||||
@ -24,25 +24,28 @@
|
||||
$DB->query("
|
||||
SELECT ConvID
|
||||
FROM pm_conversations_users
|
||||
WHERE UserID='$ReceiverID'
|
||||
WHERE UserID = '$ReceiverID'
|
||||
AND (ForwardedTo = 0 OR ForwardedTo = UserID)
|
||||
AND InInbox='1'
|
||||
AND ConvID='$ConvID'");
|
||||
AND InInbox = '1'
|
||||
AND ConvID = '$ConvID'");
|
||||
if (!$DB->has_results()) {
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, ReceivedDate)
|
||||
VALUES ('$ReceiverID', '$ConvID', '1', '0', NOW())
|
||||
ON DUPLICATE KEY UPDATE ForwardedTo = 0, UnRead = 1");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
ForwardedTo = 0,
|
||||
UnRead = 1");
|
||||
$DB->query("
|
||||
UPDATE pm_conversations_users
|
||||
SET ForwardedTo='$ReceiverID'
|
||||
WHERE ConvID='$ConvID' AND UserID='$UserID'");
|
||||
$Cache->delete_value('inbox_new_'.$ReceiverID);
|
||||
SET ForwardedTo = '$ReceiverID'
|
||||
WHERE ConvID = '$ConvID'
|
||||
AND UserID = '$UserID'");
|
||||
$Cache->delete_value("inbox_new_$ReceiverID");
|
||||
header('Location: ' . Inbox::get_inbox_link());
|
||||
} else {
|
||||
error("$StaffIDs[$ReceiverID] already has this conversation in their inbox.");
|
||||
header('Location: inbox.php?action=viewconv&id='.$ConvID);
|
||||
header("Location: inbox.php?action=viewconv&id=$ConvID");
|
||||
}
|
||||
//View::show_footer();
|
||||
?>
|
||||
|
@ -550,7 +550,8 @@
|
||||
(Name, UserID)
|
||||
VALUES
|
||||
('$Tag', ".$LoggedUser['ID'].")
|
||||
ON DUPLICATE KEY UPDATE Uses = Uses + 1");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Uses = Uses + 1");
|
||||
|
||||
$TagID = $DB->inserted_id();
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
(UserID, Time)
|
||||
VALUES
|
||||
(".$LoggedUser['ID'].", NOW())
|
||||
ON DUPLICATE KEY UPDATE Time = NOW()");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Time = NOW()");
|
||||
$Cache->delete_value('staff_blog_read_'.$LoggedUser['ID']);
|
||||
|
||||
define('ANNOUNCEMENT_FORUM_ID', 19);
|
||||
|
@ -52,7 +52,8 @@
|
||||
(TagID, GroupID, PositiveVotes, UserID)
|
||||
VALUES
|
||||
('$TagID', '$GroupID', '3', '$UserID')
|
||||
ON DUPLICATE KEY UPDATE PositiveVotes = PositiveVotes + 2");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PositiveVotes = PositiveVotes + 2");
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO torrents_tags_votes
|
||||
|
@ -33,7 +33,7 @@
|
||||
// This is used if the form doesn't validate, and when the time comes to enter //
|
||||
// it into the database. //
|
||||
|
||||
$Properties=array();
|
||||
$Properties = array();
|
||||
$Type = $Categories[(int)$_POST['type']];
|
||||
$TypeID = $_POST['type'] + 1;
|
||||
$Properties['CategoryName'] = $Type;
|
||||
@ -89,7 +89,7 @@
|
||||
//******************************************************************************//
|
||||
//--------------- Validate data in upload form ---------------------------------//
|
||||
|
||||
$Validate->SetFields('type','1','inarray','Please select a valid type.', array('inarray'=>array_keys($Categories)));
|
||||
$Validate->SetFields('type', '1', 'inarray', 'Please select a valid type.', array('inarray'=>array_keys($Categories)));
|
||||
switch ($Type) {
|
||||
case 'Music':
|
||||
if (!$_POST['groupid']) {
|
||||
@ -314,7 +314,7 @@
|
||||
JOIN artists_alias AS aa ON ta.AliasID = aa.AliasID
|
||||
WHERE ta.GroupID = ".$Properties['GroupID']."
|
||||
ORDER BY ta.Importance ASC, aa.Name ASC;");
|
||||
while (list($ArtistID,$ArtistName,$ArtistImportance) = $DB->next_record(MYSQLI_BOTH, false)) {
|
||||
while (list($ArtistID, $ArtistName, $ArtistImportance) = $DB->next_record(MYSQLI_BOTH, false)) {
|
||||
$ArtistForm[$ArtistImportance][] = array('id' => $ArtistID, 'name' => display_str($ArtistName));
|
||||
$ArtistsUnescaped[$ArtistImportance][] = array('name' => $ArtistName);
|
||||
}
|
||||
@ -636,7 +636,8 @@
|
||||
(Name, UserID)
|
||||
VALUES
|
||||
('$Tag', $LoggedUser[ID])
|
||||
ON DUPLICATE KEY UPDATE Uses = Uses + 1;
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Uses = Uses + 1;
|
||||
");
|
||||
$TagID = $DB->inserted_id();
|
||||
|
||||
@ -645,7 +646,8 @@
|
||||
(TagID, GroupID, UserID, PositiveVotes)
|
||||
VALUES
|
||||
($TagID, $GroupID, $LoggedUser[ID], 10)
|
||||
ON DUPLICATE KEY UPDATE PositiveVotes = PositiveVotes + 1;
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PositiveVotes = PositiveVotes + 1;
|
||||
");
|
||||
}
|
||||
}
|
||||
|
@ -257,8 +257,8 @@
|
||||
unset($Options['ShowQueryList']);
|
||||
unset($Options['ShowCacheList']);
|
||||
|
||||
$DownloadAlt = (isset($_POST['downloadalt'])) ? 1 : 0;
|
||||
$UnseededAlerts = (isset($_POST['unseededalerts'])) ? 1 : 0;
|
||||
$DownloadAlt = isset($_POST['downloadalt']) ? 1 : 0;
|
||||
$UnseededAlerts = isset($_POST['unseededalerts']) ? 1 : 0;
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
SELECT '$LoggedUser[ID]', ID, LastPostID
|
||||
FROM forums_topics
|
||||
WHERE ID IN (".implode(',', $UserSubscriptions).')
|
||||
ON DUPLICATE KEY UPDATE PostID = LastPostID');
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = LastPostID');
|
||||
}
|
||||
$DB->query("
|
||||
INSERT INTO users_comments_last_read (UserID, Page, PageID, PostID)
|
||||
@ -18,9 +19,16 @@
|
||||
s.PageID,
|
||||
IFNULL(c.ID, 0) AS LastPostID
|
||||
FROM users_subscriptions_comments AS s
|
||||
LEFT JOIN comments AS c ON c.Page = s.Page AND c.ID = (SELECT MAX(ID) FROM comments WHERE Page = s.Page AND PageID = s.PageID)
|
||||
LEFT JOIN comments AS c ON c.Page = s.Page
|
||||
AND c.ID = (
|
||||
SELECT MAX(ID)
|
||||
FROM comments
|
||||
WHERE Page = s.Page
|
||||
AND PageID = s.PageID
|
||||
)
|
||||
) AS t
|
||||
ON DUPLICATE KEY UPDATE PostID = LastPostID");
|
||||
ON DUPLICATE KEY UPDATE
|
||||
PostID = LastPostID");
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
header('Location: userhistory.php?action=subscriptions');
|
||||
?>
|
||||
|
@ -192,6 +192,12 @@
|
||||
}
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>">
|
||||
<colgroup>
|
||||
<? if (Users::has_avatars_enabled()) { ?>
|
||||
<col class="col_avatar" />
|
||||
<? } ?>
|
||||
<col class="col_post_body" />
|
||||
</colgroup>
|
||||
<tr class="colhead_dark notify_<?=$Result['Page']?>">
|
||||
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
|
||||
<span style="float:left;">
|
||||
|
Loading…
Reference in New Issue
Block a user