From 2affa894ac146f8ff810303b0dffa2534336ea16 Mon Sep 17 00:00:00 2001 From: Git Date: Mon, 2 Apr 2012 08:00:21 +0000 Subject: [PATCH] Empty commit --- classes/class_feed.php | 2 + classes/script_start.php | 4 - sections/ajax/forum/forum.php | 2 +- sections/ajax/forum/thread.php | 2 +- sections/artist/change_artistid.php | 141 +++++++++++++++++++++++++ sections/artist/edit.php | 19 ++++ sections/artist/index.php | 6 ++ sections/forums/mod_thread.php | 9 +- sections/forums/thread.php | 3 + sections/torrents/grouplog.php | 5 +- sections/user/advancedsearch.php | 36 ++++++- sections/userhistory/subscriptions.php | 3 + static/styles/global.css | 2 +- 13 files changed, 222 insertions(+), 12 deletions(-) create mode 100644 sections/artist/change_artistid.php diff --git a/classes/class_feed.php b/classes/class_feed.php index 5d472b62..072deea0 100644 --- a/classes/class_feed.php +++ b/classes/class_feed.php @@ -5,6 +5,8 @@ class FEED { function open_feed() { header("Content-type: application/xml; charset=UTF-8"); echo "\n","\n\t\n"; + echo ''."\n"; + echo ''."\n"; } function close_feed() { echo "\t\n"; diff --git a/classes/script_start.php b/classes/script_start.php index 81615db1..89467ac7 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -1122,10 +1122,6 @@ function format_username($UserID, $Badges = false, $IsWarned = true, $IsEnabled - - $str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? 'Warned' : ''; - $str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? 'Banned' : ''; - if ($Title && $Class) { $str .= ''; } diff --git a/sections/ajax/forum/forum.php b/sections/ajax/forum/forum.php index 1d9ae165..49f94fcc 100644 --- a/sections/ajax/forum/forum.php +++ b/sections/ajax/forum/forum.php @@ -48,7 +48,7 @@ t.NumPosts, t.LastPostID, t.LastPostTime, - t.LastPostAuthorID, + t.LastPostAuthorID FROM forums_topics AS t WHERE t.ForumID = '$ForumID' ORDER BY t.IsSticky DESC, t.LastPostTime DESC diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index 24c79ef9..8c7d7076 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -85,7 +85,7 @@ p.AddedTime, p.Body, p.EditedUserID, - p.EditedTime, + p.EditedTime FROM forums_posts as p WHERE p.TopicID = '$ThreadID' AND p.ID != '".$ThreadInfo['StickyPostID']."' LIMIT $CatalogueLimit"); diff --git a/sections/artist/change_artistid.php b/sections/artist/change_artistid.php new file mode 100644 index 00000000..d7c7efed --- /dev/null +++ b/sections/artist/change_artistid.php @@ -0,0 +1,141 @@ +query("SELECT Name FROM artists_group WHERE ArtistID = $ArtistID LIMIT 1"); +if(!(list($ArtistName) = $DB->next_record())) { + error('An error has occured.'); +} + +if ($NewArtistID > 0) { + // Make sure that's a real artist id number, and grab the name + $DB->query("SELECT Name FROM artists_group WHERE ArtistID = $NewArtistID LIMIT 1"); + if(!(list($NewArtistName) = $DB->next_record())) { + error('Please enter a valid artist ID number.'); + } +} else { + // Didn't give an ID, so try to grab based on the name + $DB->query("SELECT ArtistID FROM artists_alias WHERE Name = '".db_string($NewArtistName)."' LIMIT 1"); + if(!(list($NewArtistID) = $DB->next_record())) { + error('No artist by that name was found.'); + } +} + +if ($ArtistID == $NewArtistID) { + error("You cannot merge an artist with himself."); +} +if (isset($_POST['confirm'])) { + // Get the information for the cache update + $DB->query("SELECT DISTINCT GroupID FROM torrents_artists WHERE ArtistID = $ArtistID"); + $Groups = $DB->collect('GroupID'); + $DB->query("SELECT DISTINCT RequestID FROM requests_artists WHERE ArtistID = $ArtistID"); + $Requests = $DB->collect('RequestID'); + $DB->query("SELECT DISTINCT UserID FROM bookmarks_artists WHERE ArtistID = $ArtistID"); + $BookmarkUsers = $DB->collect('UserID'); + $DB->query("SELECT DISTINCT ct.CollageID + FROM collages_torrents AS ct + JOIN torrents_artists AS ta ON ta.GroupID = ct.GroupID + WHERE ta.ArtistID = $ArtistID"); + $Collages = $DB->collect('CollageID'); + + // And the info to avoid double-listing an artist if it and the target are on the same group + $DB->query("SELECT DISTINCT GroupID FROM torrents_artists WHERE ArtistID = $NewArtistID"); + $NewArtistGroups = $DB->collect('GroupID'); + $NewArtistGroups[] = '0'; + $NewArtistGroups = implode(',',$NewArtistGroups); + + $DB->query("SELECT DISTINCT RequestID FROM requests_artists WHERE ArtistID = $NewArtistID"); + $NewArtistRequests = $DB->collect('RequestID'); + $NewArtistRequests[] = '0'; + $NewArtistRequests = implode(',',$NewArtistRequests); + + $DB->query("SELECT DISTINCT UserID from bookmarks_artists WHERE ArtistID = $NewArtistID"); + $NewArtistBookmarks = $DB->collect('UserID'); + $NewArtistBookmarks[] = '0'; + $NewArtistBookmarks = implode(',',$NewArtistBookmarks); + + // Merge all of this artist's aliases onto the new artist + $DB->query("UPDATE artists_alias SET ArtistID = $NewArtistID WHERE ArtistID = $ArtistID"); + + // Update the torrent groups, requests, and bookmarks + $DB->query("UPDATE IGNORE torrents_artists SET ArtistID = $NewArtistID + WHERE ArtistID = $ArtistID + AND GroupID NOT IN ($NewArtistGroups)"); + $DB->query("DELETE FROM torrents_artists WHERE ArtistID = $ArtistID"); + $DB->query("UPDATE IGNORE requests_artists SET ArtistID = $NewArtistID + WHERE ArtistID = $ArtistID + AND RequestID NOT IN ($NewArtistRequests)"); + $DB->query("DELETE FROM requests_artists WHERE ArtistID = $ArtistID"); + $DB->query("UPDATE IGNORE bookmarks_artists SET ArtistID = $NewArtistID + WHERE ArtistID = $ArtistID + AND UserID NOT IN ($NewArtistBookmarks)"); + $DB->query("DELETE FROM bookmarks_artists WHERE ArtistID = $ArtistID"); + + // Cache clearing + if(!empty($Groups)) { + foreach($Groups as $GroupID) { + $Cache->delete_value('groups_artists_'.$GroupID); + update_hash($GroupID); + } + } + if(!empty($Requests)) { + foreach($Requests as $RequestID) { + $Cache->delete_value('request_artist_'.$RequestID); + update_sphinx_requests($RequestID); + } + } + if(!empty($BookmarkUsers)) { + foreach($BookmarkUsers as $UserID) { + $Cache->delete_value('notify_artists_'.$UserID); + } + } + if(!empty($Collages)) { + foreach($Collages as $CollageID) { + $Cache->delete_value('collage_'.$CollageID); + } + } + + $Cache->delete_value('artist_'.$ArtistID); + $Cache->delete_value('artist_'.$NewArtistID); + + // Delete the old artist + $DB->query("DELETE FROM artists_group WHERE ArtistID = $ArtistID"); + + write_log("The artist ".$ArtistID." (".$ArtistName.") was made into a non-redirecting alias of artist ".$NewArtistID." (".$NewArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")"); + + header("Location: artist.php?action=edit&artistid=$NewArtistID"); +} else { + show_header('Merging Artists'); +?> +

Confirm merge

+
+ + + + + +
+

Please confirm that you wish to make () into a non-redirecting alias of ().

+
+ +
+
+ \ No newline at end of file diff --git a/sections/artist/edit.php b/sections/artist/edit.php index 260b79a9..e0f4a331 100644 --- a/sections/artist/edit.php +++ b/sections/artist/edit.php @@ -70,6 +70,25 @@ +

Make into non-redirecting alias

+
+
+ + + +
+ Merges this artist () into the artist specified below (without redirection), so that "" (and its aliases) will appear as a non-redirecting alias of the artist entered in the text box below.

+
+  
+ OR
+   +

+ +
+ +
+
+

Aliases

diff --git a/sections/artist/index.php b/sections/artist/index.php index 7e50b843..6bf1423f 100644 --- a/sections/artist/index.php +++ b/sections/artist/index.php @@ -32,6 +32,9 @@ case 'add_alias': require(SERVER_ROOT.'/sections/artist/add_alias.php'); break; + case 'change_artistid': + require(SERVER_ROOT.'/sections/artist/change_artistid.php'); + break; default: error(0); } @@ -70,6 +73,9 @@ case 'delete_alias': require(SERVER_ROOT.'/sections/artist/delete_alias.php'); break; + case 'change_artistid': + require(SERVER_ROOT.'/sections/artist/change_artistid.php'); + break; default: error(0); } diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index dc5b9113..c971b293 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -25,10 +25,14 @@ $Sticky = (isset($_POST['sticky'])) ? 1 : 0; $Locked = (isset($_POST['locked'])) ? 1 : 0; $Title = db_string($_POST['title']); +$RawTitle = $_POST['title']; $ForumID = (int)$_POST['forumid']; $Page = (int)$_POST['page']; + + if ($Locked == 1) { + $DB->query("DELETE FROM forums_last_read_topics WHERE TopicID='$TopicID'"); } @@ -108,11 +112,12 @@ } } else { // If we're just editing it + $Cache->begin_transaction('thread_'.$TopicID.'_info'); $UpdateArray = array( 'IsSticky'=>$Sticky, 'IsLocked'=>$Locked, - 'Title'=>cut_string($_POST['title'], 150, 1, 0), + 'Title'=>cut_string($RawTitle, 150, 1, 0), 'ForumID'=>$ForumID ); $Cache->update_row(false, $UpdateArray); @@ -231,7 +236,7 @@ list($LastTopicID) = $DB->next_record(); if($LastTopicID == $TopicID) { $UpdateArray = array( - 'Title'=>$_POST['title'], + 'Title'=>$RawTitle, 'IsLocked'=>$Locked, 'IsSticky'=>$Sticky ); diff --git a/sections/forums/thread.php b/sections/forums/thread.php index 81ca57d2..4e33ba3d 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -98,7 +98,10 @@ reset($Thread); //Handle last read + + if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { + $DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'"); list($LastRead) = $DB->next_record(); if($LastRead < $LastPost) { diff --git a/sections/torrents/grouplog.php b/sections/torrents/grouplog.php index cb91041b..6ed27eda 100644 --- a/sections/torrents/grouplog.php +++ b/sections/torrents/grouplog.php @@ -25,9 +25,10 @@ query("SELECT TorrentID, UserID, Info, Time FROM group_log WHERE GroupID = ".$GroupID." ORDER BY Time DESC"); - - while (list($TorrentID, $UserID, $Info, $Time) = $DB->next_record()) + $LogEntries = $DB->to_array(false, MYSQL_NUM); + foreach ($LogEntries AS $LogEntry) { + list($TorrentID, $UserID, $Info, $Time) = $LogEntry; ?> diff --git a/sections/user/advancedsearch.php b/sections/user/advancedsearch.php index 62dd2342..00c5aefd 100644 --- a/sections/user/advancedsearch.php +++ b/sections/user/advancedsearch.php @@ -126,8 +126,13 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ $DateRegex = array('regex'=>'/\d{4}-\d{2}-\d{2}/'); $ClassIDs = array(); + $SecClassIDs = array(); foreach ($Classes as $ClassID => $Value) { - $ClassIDs[]=$ClassID; + if ($Value['Secondary']) { + $SecClassIDs[]=$ClassID; + } else { + $ClassIDs[]=$ClassID; + } } $Val->SetFields('comment','0','string','Comment is too long.', array('maxlength'=>512)); @@ -152,6 +157,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ $Val->SetFields('enabled', '0', 'inarray', 'Invalid enabled field', array('inarray'=>array('', 0, 1, 2))); $Val->SetFields('class', '0', 'inarray', 'Invalid class', array('inarray'=>$ClassIDs)); + $Val->SetFields('secclass', '0', 'inarray', 'Invalid class', array('inarray'=>$SecClassIDs)); $Val->SetFields('donor', '0', 'inarray', 'Invalid donor field', $YesNo); $Val->SetFields('warned', '0', 'inarray', 'Invalid warned field', $YesNo); $Val->SetFields('disabled_uploads', '0', 'inarray', 'Invalid disabled_uploads field', $YesNo); @@ -344,6 +350,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ if($_GET['class']!=''){ $Where[]='um1.PermissionID='.wrap($_GET['class'], '='); } + if($_GET['secclass']!=''){ + $Join['ul']=' JOIN users_levels AS ul ON um1.ID=ul.UserID '; + $Where[]='ul.PermissionID='.wrap($_GET['secclass'], '='); + } if($_GET['donor'] == 'yes'){ $Where[]='ui1.Donor=\'1\''; @@ -469,6 +479,30 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ + + + + + + Secondary Class: + + + IP: diff --git a/sections/userhistory/subscriptions.php b/sections/userhistory/subscriptions.php index b926e953..b445cb2c 100644 --- a/sections/userhistory/subscriptions.php +++ b/sections/userhistory/subscriptions.php @@ -47,8 +47,11 @@ } $sql .= ')'; if($ShowUnread) { + + $sql .= ' AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID'; + } $sql .= ' GROUP BY t.ID diff --git a/static/styles/global.css b/static/styles/global.css index addd81fa..5084c849 100644 --- a/static/styles/global.css +++ b/static/styles/global.css @@ -166,7 +166,7 @@ div#AddArtists a { max-width: 100%; } -.rippywrap { z-index:25; display: block; position: fixed; background: transparent url('../rippy/loggy.png') no-repeat bottom center; color: black; text-align: center; width: 190px; height: 180px; bottom: 0px; right: 0px; } +.rippywrap { z-index:25; display: block; position: fixed; background: transparent url('../rippy/rippy.png') no-repeat bottom center; color: black; text-align: center; width: 190px; height: 180px; bottom: 0px; right: 0px; } .rippywrap div.rippy { z-index: 25; height: 111px; width: 190px; position: fixed; bottom: 0px; right: 0px; } span.rbt { display: block; padding: 8px 0 0; background: url('../rippy/rippy_top.gif') no-repeat top; } span.rbm { display: block; background: url('../rippy/rippy_middle.gif') repeat bottom; padding: 2px; }