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') ? '' : '';
- $str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? '' : '';
-
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 @@
+
+authorize();
+
+if (!check_perms('torrents_edit')) { error(403); }
+if (!empty($_POST['newartistid']) && !empty($_POST['newartistname'])) {
+ error("Please enter either an artist id OR an artist name.");
+}
+$ArtistID = (int)$_POST['artistid'];
+$NewArtistID = (int)$_POST['newartistid'];
+$NewArtistName = $_POST['newartistname'];
+
+
+if (!is_number($ArtistID) || !$ArtistID) {
+ error('Please select a valid artist to change.');
+}
+if (empty($NewArtistName) && (!$NewArtistID || !is_number($NewArtistID))) {
+ error('Please enter a valid artist ID number or a valid artist name.');
+}
+
+$DB->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
+
+
+ show_footer();
+}
+?>
\ 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
+
+
+
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 @@
$Log = $DB->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;
?>