Empty commit

This commit is contained in:
Git 2012-06-02 08:00:16 +00:00
parent 45132ae014
commit e2284cae1c
14 changed files with 78 additions and 27 deletions

View File

@ -2046,7 +2046,8 @@ function get_requests($RequestIDs, $Return = true) {
filler.Username,
r.TorrentID,
r.TimeFilled,
r.GroupID
r.GroupID,
r.OCLC
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=r.UserID
LEFT JOIN users_main AS filler ON filler.ID=FillerID AND FillerID!=0

View File

@ -550,6 +550,7 @@ CREATE TABLE `requests` (
`Visible` binary(1) NOT NULL DEFAULT '1',
`RecordLabel` varchar(80) COLLATE utf8_bin DEFAULT NULL,
`GroupID` int(10) DEFAULT NULL,
`OCLC` varchar(55) COLLATE utf8_bin NOT NULL DEFAULT '',
PRIMARY KEY (`ID`),
KEY `Userid` (`UserID`),
KEY `Name` (`Title`),

View File

@ -4,7 +4,8 @@
if(!check_perms('torrents_edit')) { error(403); }
$ArtistID = $_POST['artistid'];
$Redirect = $_POST['redirect'];
$AliasName = db_string(normalise_artist_name($_POST['name']));
$AliasName = normalise_artist_name($_POST['name']);
$DBAliasName = db_string($AliasName);
if(!$Redirect) { $Redirect = 0; }
if(!is_number($ArtistID) || !($Redirect === 0 || is_number($Redirect)) || !$ArtistID) {
@ -23,7 +24,7 @@
* 3. For foo, there's two, same ArtistID, diff names, no redirect
*/
$DB->query("SELECT AliasID, ArtistID, Name FROM artists_alias WHERE Name LIKE '".$AliasName."'");
$DB->query("SELECT AliasID, ArtistID, Name FROM artists_alias WHERE Name = '".$DBAliasName."'");
if($DB->record_count()) {
while(list($CloneAliasID, $CloneArtistID, $CloneAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($CloneAliasName, $AliasName)) {
@ -41,13 +42,13 @@
if(!$CloneAliasID) {
$DB->query("INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID)
VALUES
(".$ArtistID.", '".$AliasName."', ".$Redirect.", ".$LoggedUser['ID'].")");
(".$ArtistID.", '".$DBAliasName."', ".$Redirect.", ".$LoggedUser['ID'].")");
$AliasID = $DB->inserted_id();
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
list($ArtistName) = $DB->next_record();
write_log("The alias ".$AliasID." (".$AliasName.") was added to the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
write_log("The alias ".$AliasID." (".$DBAliasName.") was added to the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
}
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -27,7 +27,7 @@
FROM artists_group AS a
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
WHERE a.Name LIKE '".db_string($Letters)."%'
WHERE a.Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
GROUP BY ta.ArtistID
ORDER BY Snatches DESC
LIMIT $Limit");

View File

@ -85,7 +85,7 @@
include (SERVER_ROOT.'/sections/artist/artist.php');
} elseif (!empty($_GET['artistname'])) {
$NameSearch = trim($_GET['artistname']);
$NameSearch = str_replace('\\', '\\\\', trim($_GET['artistname']));
$DB->query("SELECT ArtistID, Name FROM artists_alias WHERE Name LIKE '".db_string($NameSearch)."'");
if($DB->record_count() == 0) {
if(isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) {

View File

@ -31,7 +31,7 @@
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request;
$VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']);
@ -210,6 +210,12 @@
<input type="text" name="cataloguenumber" size="15" value="<?=(!empty($CatalogueNumber) ? display_str($CatalogueNumber) : '')?>" />
</td>
</tr>
<tr id="oclc_tr">
<td class="label">WorldCat (OCLC) ID</td>
<td>
<input type="text" name="oclc" size="15" value="<?=(!empty($OCLC) ? display_str($OCLC) : '')?>" />
</td>
</tr>
<? } ?>
<tr id="year_tr">
<td class="label">Year</td>

View File

@ -23,7 +23,7 @@
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType,
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
$BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request;
//Convenience variables
$IsFilled = !empty($TorrentID);
@ -313,8 +313,28 @@
</td>
</tr>
<? }
}
if ($GroupID) {
}
$Worldcat = "";
$OCLC = str_replace(" ", "", $OCLC);
if ($OCLC != "") {
$OCLCs = explode(",", $OCLC);
for ($i = 0; $i < count($OCLCs); $i++) {
if (!empty($Worldcat)) {
$Worldcat .= ', <a href="http://www.worldcat.org/oclc/'.$OCLCs[$i].'">'.$OCLCs[$i].'</a>';
} else {
$Worldcat = '<a href="http://www.worldcat.org/oclc/'.$OCLCs[$i].'">'.$OCLCs[$i].'</a>';
}
}
}
if (!empty($Worldcat)) { ?>
<tr>
<td class="label">WorldCat (OCLC) ID</td>
<td>
<?=$Worldcat?>
</td>
</tr>
<? }
if ($GroupID) {
/*$Groups = get_groups(array($GroupID), true, true, false);
$Group = $Groups['matches'][$GroupID];
$GroupLink = display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$GroupID.'">'.$Group['Name'].'</a>';*/

View File

@ -85,20 +85,35 @@
$Tags = explode(',', $_GET['tags']);
$TagNames = array();
foreach ($Tags as $Tag) {
$Tag = ltrim($Tag);
$Exclude = (!empty($_GET['tags_type']) && $Tag[0] == '!'); // Negations aren't supported in the "any" mode
$Tag = sanitize_tag($Tag);
if(!empty($Tag)) {
$TagNames[] = $Tag;
$TagsExclude[$Tag] = $Exclude;
}
}
$Tags = get_tags($TagNames);
// Sphinx can't handle queries consisting of only exclusions
if(!in_array(false, $TagsExclude)) {
$TagsExclude = array();
}
// Replace the ! characters that sanitize_tag removed
foreach($TagNames as &$TagName) {
if($TagsExclude[$TagName]) {
$TagName = '!'.$TagName;
}
}
unset($TagName);
}
if(empty($_GET['tags_type']) && !empty($Tags)) {
$_GET['tags_type'] = '0';
$SS->set_filter('tagid', array_keys($Tags));
} elseif(!empty($Tags)) {
foreach(array_keys($Tags) as $Tag) {
$SS->set_filter('tagid', array($Tag));
foreach($Tags as $TagID => $TagName) {
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
}
} else {
$_GET['tags_type'] = '1';

View File

@ -33,7 +33,7 @@
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID, $OCLC) = $Request;
$VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']);
@ -207,6 +207,11 @@
} else {
$RecordLabel = "";
}
if (!empty($_POST['oclc'])) {
$OCLC = trim($_POST['oclc']);
} else {
$OCLC = "";
}
}
if($CategoryName == "Music" || $CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
@ -325,10 +330,10 @@
if($NewRequest) {
$DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, RecordLabel,
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID)
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID, OCLC)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."','".db_string($RecordLabel)."',
'".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1', '$GroupID')");
'".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1', '$GroupID', '".db_string($OCLC)."')");
$RequestID = $DB->inserted_id();
} else {
@ -345,7 +350,8 @@
FormatList = '".$FormatList."',
MediaList = '".$MediaList."',
LogCue = '".$LogCue."',
GroupID = '".$GroupID."'
GroupID = '".$GroupID."',
OCLC = '".db_string($OCLC)."'
WHERE ID = ".$RequestID);
//I almost didn't think of this, we need to be able to delete artists / tags
@ -381,7 +387,7 @@
aa.Name,
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name LIKE '".db_string($Artist['name'])."'");
WHERE aa.Name = '".db_string($Artist['name'])."'");
if($DB->record_count() > 0) {
while($Result = $DB->next_record(MYSQLI_NUM, false)) {

View File

@ -21,7 +21,7 @@
}
if(strlen($AliasName) > 0) {
$DB->query("SELECT AliasID, ArtistID, Redirect, Name FROM artists_alias WHERE Name LIKE '".db_string($AliasName,true)."'");
$DB->query("SELECT AliasID, ArtistID, Redirect, Name FROM artists_alias WHERE Name = '".db_string($AliasName)."'");
if($DB->record_count() == 0) {
$AliasName = db_string($AliasName);
$DB->query("INSERT INTO artists_group (Name) VALUES ('$AliasName')");

View File

@ -21,7 +21,7 @@
error(0);
}
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name LIKE '$ArtistName'");
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'");
if($DB->record_count() == 0) {
$Redirect = 0;
$DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')");

View File

@ -484,8 +484,8 @@
FROM torrents_group AS tg
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
LEFT JOIN artists_group AS ag ON ta.ArtistID = ag.ArtistID
WHERE ag.Name LIKE '".db_string($Artist['name'])."'
AND tg.Name LIKE ".$T['Title']."
WHERE ag.Name = '".db_string($Artist['name'])."'
AND tg.Name = ".$T['Title']."
AND tg.ReleaseType = ".$T['ReleaseType']."
AND tg.Year = ".$T['Year']);
@ -514,7 +514,7 @@
aa.Name,
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name LIKE '".db_string($Artist['name'])."'");
WHERE aa.Name = '".db_string($Artist['name'])."'");
if($DB->record_count() > 0){
while($Result = $DB->next_record(MYSQLI_NUM, false)) {
list($ArtistID, $AliasID, $AliasName, $Redirect) = $Result;
@ -796,9 +796,9 @@
foreach($ArtistsUnescaped as $Importance => $Artists) {
foreach($Artists as $Artist) {
if($Importance == 1 || $Importance == 4 || $Importance == 5 || $Importance == 6) {
$ArtistNameList[] = "Artists LIKE '%|".db_string($Artist['name'])."|%'";
$ArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'";
} else {
$GuestArtistNameList[] = "Artists LIKE '%|".db_string($Artist['name'])."|%'";
$GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'";
}
}
}

View File

@ -1,6 +1,4 @@
<?
if(isset($_GET['userid']) && check_perms('users_view_invites')){
if(!is_number($_GET['userid'])){ error(403); }
@ -15,6 +13,7 @@
$UserID = $LoggedUser['ID'];
$Sneaky = false;
}
list($UserID, $Username, $PermissionID) = array_values(user_info($UserID));

View File

@ -16,6 +16,8 @@
$OwnProfile = false;
}
if(check_perms('users_mod')) { // Person viewing is a staff member
$DB->query("SELECT
m.Username,