Empty commit

This commit is contained in:
Git 2012-04-02 08:00:21 +00:00
parent 137ae4f883
commit 2affa894ac
13 changed files with 222 additions and 12 deletions

View File

@ -5,6 +5,8 @@ class FEED {
function open_feed() {
header("Content-type: application/xml; charset=UTF-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n","<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n\t<channel>\n";
echo '<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />'."\n";
echo '<meta xmlns="http://pipes.yahoo.com" name="pipes" content="noprocess" />'."\n";
}
function close_feed() {
echo "\t</channel>\n</rss>";

View File

@ -1122,10 +1122,6 @@ function format_username($UserID, $Badges = false, $IsWarned = true, $IsEnabled
$str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned" />' : '';
$str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" />' : '';
if ($Title && $Class) {
$str .= '<strong>';
}

View File

@ -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

View File

@ -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");

View File

@ -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');
?>
<h2>Confirm merge</h2>
<form action="artist.php" method="post">
<input type="hidden" name="action" value="change_artistid" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
<input type="hidden" name="newartistid" value="<?=$NewArtistID?>" />
<input type="hidden" name="confirm" value="1" />
<div style="text-align: center;">
<p>Please confirm that you wish to make <a href="artist.php?id=<?=$ArtistID?>"><?=display_str($ArtistName)?> (<?=$ArtistID?>)</a> into a non-redirecting alias of <a href="artist.php?id=<?=$NewArtistID?>"><?=display_str($NewArtistName)?> (<?=$NewArtistID?>)</a>.</p>
<br>
<input type="submit" value="Confirm" />
</div>
</form>
<?
show_footer();
}
?>

View File

@ -70,6 +70,25 @@
</form>
</div>
<h2>Make into non-redirecting alias</h2>
<div class="box pad">
<form action="artist.php" method="post">
<input type="hidden" name="action" value="change_artistid" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
<div>
<em>Merges this artist (<?=Name?>) into the artist specified below (without redirection), so that "<?=Name?>" (and its aliases) will appear as a non-redirecting alias of the artist entered in the text box below.</em><br /><br />
<div style="text-align: center;">
<label for="newartistid">ArtistID:</label>&nbsp;<input type="text" id="newartistid" name="newartistid" size="40" value="" /><br />
<strong>OR</strong><br />
<label for="newartistid">Artist Name:</label>&nbsp;<input type="text" id="newartistname" name="newartistname" size="40" value="" />
<br /><br />
<input type="submit" value="Change ArtistID" />
</div>
</div>
</form>
</div>
<h2>Aliases</h2>
<div class="box pad">

View File

@ -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);
}

View File

@ -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
);

View File

@ -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) {

View File

@ -25,9 +25,10 @@
</tr>
<?
$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;
?>
<tr class="rowa">
<td><?=$Time?></td>

View File

@ -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 = ''){
</select>
</td>
</tr>
<tr>
<td class="label nobr"></td>
<td></td>
<td class="label nobr"></td>
<td></td>
<td class="label nobr">Secondary Class:</td>
<td>
<select name="secclass">
<option value="" <? if($_GET['secclass']==='') {echo ' selected="selected"';}?>>Any</option>
<? $Secondaries = array();
// Neither level nor ID is particularly useful when search secondary classes, so let's do some
// kung-fu to sort them alphabetically.
$fnc = function($Class1, $Class2) { return strcmp($Class1['Name'], $Class2['Name']);};
foreach($ClassLevels as $Class) {
if (!$Class['Secondary']) { continue; }
$Secondaries[] = $Class;
}
usort($Secondaries, $fnc);
foreach($Secondaries as $Class) {
?>
<option value="<?=$Class['ID'] ?>" <? if($_GET['secclass']===$Class['ID']) {echo ' selected="selected"';}?>><?=cut_string($Class['Name'], 20, 1, 1)?></option>
<? } ?>
</select>
</td>
<tr>
<td class="label nobr">IP:</td>
<td>

View File

@ -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

View File

@ -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; }