Empty commit

This commit is contained in:
Git 2013-04-15 08:00:54 +00:00
parent bef01d5177
commit e601761312
23 changed files with 861 additions and 802 deletions

View File

@ -48,9 +48,9 @@ public function encode($Arg = false, $Keys = false) {
}
if ($Keys === true) {
$this->Data = $Data;
} else if ($Keys === false) {
} elseif ($Keys === false) {
$this->Data = array_intersect_key($Data, array_flip($this->DefaultKeys));
} else if (is_array($Keys)) {
} elseif (is_array($Keys)) {
$this->Data = array_intersect_key($Data, array_flip($Keys));
} else {
$this->Data = isset($Data[$Keys]) ? $Data[$Keys] : false;

View File

@ -57,7 +57,7 @@ public function bdec_file($Path = false) {
public function decode($Arg = false) {
if ($Arg !== false) {
$this->Data = $Arg;
} else if (!$this->Data) {
} elseif (!$this->Data) {
$this->Data = $this->Enc;
}
if (!$this->Data) {

View File

@ -38,7 +38,7 @@ function TORRENT_FORM($Torrent = false, $Error = false, $NewTorrent = true) {
$this->Media = $Media;
$this->TorrentID = $TorrentID;
if($this->Torrent && $this->Torrent['GroupID']) {
if ($this->Torrent && $this->Torrent['GroupID']) {
$this->Disabled = ' disabled="disabled"';
$this->DisabledFlag = true;
}
@ -49,13 +49,13 @@ function head() {
global $LoggedUser;
?>
<div class="thin">
<? if($this->NewTorrent) { ?>
<? if ($this->NewTorrent) { ?>
<p style="text-align: center;">
Your personal announce URL is:<br />
<input type="text" value="<?= ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'?>" size="71" onclick="this.select()" readonly="readonly" />
</p>
<? }
if($this->Error) {
if ($this->Error) {
echo '<p style="color: red; text-align: center;">'.$this->Error.'</p>';
}
?>
@ -63,21 +63,21 @@ function head() {
<div>
<input type="hidden" name="submit" value="true" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if(!$this->NewTorrent) { ?>
<? if (!$this->NewTorrent) { ?>
<input type="hidden" name="action" value="takeedit" />
<input type="hidden" name="torrentid" value="<?=display_str($this->TorrentID)?>" />
<input type="hidden" name="type" value="<?=display_str($this->Torrent['CategoryID'])?>" />
<? } else {
if($this->Torrent && $this->Torrent['GroupID']) { ?>
if ($this->Torrent && $this->Torrent['GroupID']) { ?>
<input type="hidden" name="groupid" value="<?=display_str($this->Torrent['GroupID'])?>" />
<input type="hidden" name="type" value="Music" />
<? }
if($this->Torrent && $this->Torrent['RequestID']) { ?>
if ($this->Torrent && $this->Torrent['RequestID']) { ?>
<input type="hidden" name="requestid" value="<?=display_str($this->Torrent['RequestID'])?>" />
<? }
} ?>
</div>
<? if($this->NewTorrent) { ?>
<? if ($this->NewTorrent) { ?>
<table cellpadding="3" cellspacing="1" border="0" class="layout border" width="100%">
<tr>
<td class="label">Torrent file:</td>
@ -87,9 +87,9 @@ function head() {
<td class="label">Type:</td>
<td>
<select id="categories" name="type" onchange="Categories()"<?=$this->Disabled?>>
<? foreach(Misc::display_array($this->Categories) as $Index => $Cat) {
<? foreach (Misc::display_array($this->Categories) as $Index => $Cat) {
echo '<option value="'.$Index.'"';
if($Cat == $this->Torrent['CategoryName']) { echo ' selected="selected"'; }
if ($Cat == $this->Torrent['CategoryName']) { echo ' selected="selected"'; }
echo '>';
echo $Cat;
echo "</option>\n";
@ -110,22 +110,22 @@ function foot() {
</div>
<table cellpadding="3" cellspacing="1" border="0" class="layout border slice" width="100%">
<? if(!$this->NewTorrent) {
if(check_perms('torrents_freeleech')) {
<? if (!$this->NewTorrent) {
if (check_perms('torrents_freeleech')) {
?>
<tr id="freetorrent">
<td class="label">Freeleech</td>
<td>
<select name="freeleech">
<? $FL = array("Normal", "Free", "Neutral");
foreach($FL as $Key => $Name) { ?>
foreach ($FL as $Key => $Name) { ?>
<option value="<?=$Key?>"<?=($Key == $Torrent['FreeTorrent'] ? ' selected="selected"' : '')?>><?=$Name?></option>
<? } ?>
</select>
because
<select name="freeleechtype">
<? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House");
foreach($FL as $Key => $Name) { ?>
foreach ($FL as $Key => $Name) { ?>
<option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?></option>
<? } ?>
</select>
@ -138,10 +138,10 @@ function foot() {
<tr>
<td colspan="2" style="text-align: center;">
<p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>
<? if($this->NewTorrent) { ?>
<? if ($this->NewTorrent) { ?>
<p>After uploading the torrent, you will have a one hour grace period during which no one other than you can fill requests with this torrent. Make use of this time wisely, and <a href="requests.php">search the list of requests</a>.</p>
<? } ?>
<input id="post" type="submit" <? if($this->NewTorrent) { echo 'value="Upload torrent"'; } else { echo 'value="Edit torrent"';} ?> />
<input id="post" type="submit"<? if ($this->NewTorrent) { echo ' value="Upload torrent"'; } else { echo ' value="Edit torrent"';} ?> />
</td>
</tr>
</table>
@ -155,7 +155,7 @@ function music_form($GenreTags) {
$IsRemaster = !empty($Torrent['Remastered']);
$UnknownRelease = !$this->NewTorrent && $IsRemaster && !$Torrent['RemasterYear'];
if($Torrent['GroupID']) {
if ($Torrent['GroupID']) {
global $DB;
$DB->query("SELECT ID,
RemasterYear,
@ -171,7 +171,7 @@ function music_form($GenreTags) {
RemasterRecordLabel DESC,
RemasterCatalogueNumber DESC");
if($DB->record_count() > 0) {
if ($DB->record_count() > 0) {
$GroupRemasters = $DB->to_array(false, MYSQLI_BOTH, false);
}
}
@ -187,16 +187,16 @@ function music_form($GenreTags) {
$LossywebApproved = $Torrent['LossywebApproved'];
global $ReleaseTypes;
?>
<table cellpadding="3" cellspacing="1" border="0" class="layout border<? if($this->NewTorrent) { echo ' slice'; }?>" width="100%">
<? if($this->NewTorrent) { ?>
<table cellpadding="3" cellspacing="1" border="0" class="layout border<? if ($this->NewTorrent) { echo ' slice'; }?>" width="100%">
<? if ($this->NewTorrent) { ?>
<tr id="artist_tr">
<td class="label">Artist(s):</td>
<td id="artistfields">
<p id="vawarning" class="hidden">Please use the multiple artists feature rather than adding "Various Artists" as an artist; read <a href="wiki.php?action=article&amp;id=369" target="_blank">this</a> for more information.</p>
<? if(!empty($Torrent['Artists'])) {
<? if (!empty($Torrent['Artists'])) {
$FirstArtist = true;
foreach($Torrent['Artists'] as $Importance => $Artists) {
foreach($Artists as $Artist) {
foreach ($Torrent['Artists'] as $Importance => $Artists) {
foreach ($Artists as $Artist) {
?>
<input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" onblur="CheckVA();"<?=$this->Disabled?> />
<select id="importance" name="importance[]"<?=$this->Disabled?>>
@ -258,12 +258,12 @@ function music_form($GenreTags) {
<script type="text/javascript">
//<![CDATA[
hide();
if(document.getElementById("categories").disabled == false){
if(navigator.appName == 'Opera') {
if (document.getElementById("categories").disabled == false){
if (navigator.appName == 'Opera') {
var useragent = navigator.userAgent;
var match = useragent.split('Version/');
var version = parseFloat(match[1]);
if(version >= 12.00) {
if (version >= 12.00) {
show();
}
}
@ -289,8 +289,8 @@ function show() {
<tr id="year_tr">
<td class="label">
<span id="year_label_not_remaster"<? if($IsRemaster) { echo ' class="hidden"';}?>>Year:</span>
<span id="year_label_remaster"<? if(!$IsRemaster) { echo ' class="hidden"';}?>>Year of original release</span>
<span id="year_label_not_remaster"<? if ($IsRemaster) { echo ' class="hidden"';} ?>>Year:</span>
<span id="year_label_remaster"<? if (!$IsRemaster) { echo ' class="hidden"';} ?>>Year of original release</span>
</td>
<td>
<p id="yearwarning" class="hidden">You have entered a year for a release which predates the medium's availability. You will need to change the year and enter additional edition information. If this information cannot be provided, check the &quot;Unknown Release&quot; checkbox below</p>
@ -318,7 +318,7 @@ function show() {
<?
foreach ($ReleaseTypes as $Key => $Val) {
echo '<option value="'.$Key.'"';
if($Key == $Torrent['ReleaseType']) { echo ' selected="selected"'; }
if ($Key == $Torrent['ReleaseType']) { echo ' selected="selected"'; }
echo '>';
echo $Val;
echo "</option>\n";
@ -331,28 +331,28 @@ 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') || $LoggedUser['ID'] == $Torrent['UserID']) { ?>
<div id="remaster_true"<? if (!$IsRemaster) { echo ' class="hidden"';} ?>>
<? if (check_perms('edit_unknowns') || $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)) { ?>
<? 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 = "";
$LastLine = '';
foreach($GroupRemasters as $Index => $Remaster) {
foreach ($GroupRemasters as $Index => $Remaster) {
$Line = $Remaster['RemasterYear']." / ".$Remaster['RemasterTitle']." / ".$Remaster['RemasterRecordLabel']." / ".$Remaster['RemasterCatalogueNumber'];
if($Line != $LastLine) {
if ($Line != $LastLine) {
$LastLine = $Line;
?>
<option value="<?=$Index?>"<?=($Remaster['ID'] == $this->TorrentID) ? ' selected="selected"' : ''?>><?=$Line?></option>
<option value="<?=$Index?>"<?=($Remaster['ID'] == $this->TorrentID) ? ' selected="selected"' : '' ?>><?=$Line?></option>
<?
}
}
@ -365,26 +365,26 @@ function show() {
<tr id="edition_year">
<td class="label">Year (required):</td>
<td>
<input type="text" id="remaster_year" name="remaster_year" size="5" value="<? if($Torrent['RemasterYear']) { echo display_str($Torrent['RemasterYear']);} ?>"<? if($UnknownRelease) { echo ' disabled="disabled"';}?> />
<input type="text" id="remaster_year" name="remaster_year" size="5" value="<? if ($Torrent['RemasterYear']) { echo display_str($Torrent['RemasterYear']); } ?>"<? if ($UnknownRelease) { echo ' disabled="disabled"';} ?> />
</td>
</tr>
<tr id="edition_title">
<td class="label">Title:</td>
<td>
<input type="text" id="remaster_title" name="remaster_title" size="50" value="<?=display_str($Torrent['RemasterTitle']) ?>"<? if($UnknownRelease) { echo ' disabled="disabled"';}?> />
<input type="text" id="remaster_title" name="remaster_title" size="50" value="<?=display_str($Torrent['RemasterTitle']) ?>"<? if ($UnknownRelease) { echo ' disabled="disabled"';} ?> />
<p class="min_padding">Title of the release (e.g. <span style="font-style: italic;">'Deluxe Edition' or 'Remastered'</span>).</p>
</td>
</tr>
<tr id="edition_record_label">
<td class="label">Record label:</td>
<td>
<input type="text" id="remaster_record_label" name="remaster_record_label" size="50" value="<?=display_str($Torrent['RemasterRecordLabel']) ?>"<? if($UnknownRelease) { echo ' disabled="disabled"';}?> />
<input type="text" id="remaster_record_label" name="remaster_record_label" size="50" value="<?=display_str($Torrent['RemasterRecordLabel']) ?>"<? if ($UnknownRelease) { echo ' disabled="disabled"';} ?> />
<p class="min_padding">This is for the record label of the <strong>release</strong> (It may differ from the original).</p>
</td>
</tr>
<tr id="edition_catalogue_number">
<td class="label">Catalogue number:</td>
<td><input type="text" id="remaster_catalogue_number" name="remaster_catalogue_number" size="50" value="<?=display_str($Torrent['RemasterCatalogueNumber']) ?>"<? if($UnknownRelease) { echo ' disabled="disabled"';}?> />
<td><input type="text" id="remaster_catalogue_number" name="remaster_catalogue_number" size="50" value="<?=display_str($Torrent['RemasterCatalogueNumber']) ?>"<? if ($UnknownRelease) { echo ' disabled="disabled"';}?> />
<p class="min_padding">This is for the catalogue number of the <strong>release</strong>.</p>
</td>
</tr>
@ -396,7 +396,7 @@ function show() {
<tr>
<td class="label">Scene:</td>
<td>
<input type="checkbox" id="scene" name="scene" <? if($Torrent['Scene']) { echo 'checked="checked" ';}?>/>
<input type="checkbox" id="scene" name="scene" <? if ($Torrent['Scene']) { echo 'checked="checked" ';}?>/>
<label for="scene">Check this only if this is a 'scene release'.<br />If you ripped it yourself, it is <strong>not</strong> a scene release. If you are not sure, <strong class="important_text">do not</strong> check it; you will be penalized. For information on the scene, visit <a href="http://en.wikipedia.org/wiki/Scene_%28software%29" target="_blank">Wikipedia</a>.</label>
</td>
</tr>
@ -405,9 +405,9 @@ function show() {
<td>
<select id="format" name="format" onchange="Format()">
<option>---</option>
<? foreach(Misc::display_array($this->Formats) as $Format) {
<? foreach (Misc::display_array($this->Formats) as $Format) {
echo '<option value="'.$Format.'"';
if($Format == $Torrent['Format']) { echo ' selected="selected"'; }
if ($Format == $Torrent['Format']) { echo ' selected="selected"'; }
echo '>';
echo $Format;
echo "</option>\n";
@ -423,9 +423,9 @@ function show() {
<td>
<select id="bitrate" name="bitrate" onchange="Bitrate()">
<option value="">---</option>
<? if($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) {
<? if ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates)) {
$OtherBitrate = true;
if(substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate'])-6);
$VBR = true;
}
@ -439,9 +439,9 @@ function show() {
$SimpleBitrate = $SimpleBitrate[0];
foreach(Misc::display_array($this->Bitrates) as $Bitrate) {
foreach (Misc::display_array($this->Bitrates) as $Bitrate) {
echo '<option value="'.$Bitrate.'"';
if(($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == "Other")) {
if (($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == "Other")) {
echo ' selected="selected"';
}
echo '>';
@ -449,14 +449,14 @@ function show() {
echo "</option>\n";
} ?>
</select>
<span id="other_bitrate_span"<? if(!$OtherBitrate) { echo ' class="hidden"'; } ?>>
<input type="text" name="other_bitrate" size="5" id="other_bitrate"<? if($OtherBitrate) { echo ' value="'.display_str($Torrent['Bitrate']).'"';} ?> onchange="AltBitrate()" />
<input type="checkbox" id="vbr" name="vbr"<? if(isset($VBR)) { echo ' checked="checked"'; } ?> /><label for="vbr"> (VBR)</label>
<span id="other_bitrate_span"<? if (!$OtherBitrate) { echo ' class="hidden"'; } ?>>
<input type="text" name="other_bitrate" size="5" id="other_bitrate"<? if ($OtherBitrate) { echo ' value="'.display_str($Torrent['Bitrate']).'"';} ?> onchange="AltBitrate()" />
<input type="checkbox" id="vbr" name="vbr"<? if (isset($VBR)) { echo ' checked="checked"'; } ?> /><label for="vbr"> (VBR)</label>
</span>
</td>
</tr>
<?
if($this->NewTorrent) { ?>
if ($this->NewTorrent) { ?>
<tr id="upload_logs" class="hidden">
<td class="label">
Log files:
@ -468,7 +468,7 @@ function show() {
</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>
@ -479,7 +479,7 @@ function show() {
<tr>
<td class="label">Vanity House:</td>
<td>
<label><input type="checkbox" id="vanity_house" name="vanity_house"<? if($Torrent['GroupID']) { echo ' disabled="disabled"'; }?><? if($Torrent['VanityHouse']){ echo ' checked="checked"';} ?> />
<label><input type="checkbox" id="vanity_house" name="vanity_house"<? if ($Torrent['GroupID']) { echo ' disabled="disabled"'; } ?><? if ($Torrent['VanityHouse']){ echo ' checked="checked"';} ?> />
Check this only if you are submitting your own work or submitting on behalf of the artist, and this is intended to be a Vanity House release. Checking this will also automatically add the group as a recommendation.
</label>
</td>
@ -490,9 +490,9 @@ function show() {
<td>
<select name="media" onchange="CheckYear();" id="media">
<option>---</option>
<? foreach($this->Media as $Media) {
<? foreach ($this->Media as $Media) {
echo '<option value="'.$Media.'"';
if(isset($Torrent['Media']) && $Media == $Torrent['Media']) { echo ' selected="selected"'; }
if (isset($Torrent['Media']) && $Media == $Torrent['Media']) { echo ' selected="selected"'; }
echo '>';
echo $Media;
echo "</option>\n";
@ -501,12 +501,12 @@ function show() {
</select>
</td>
</tr>
<? if(!$this->NewTorrent && check_perms('users_mod')) { ?>
<? if (!$this->NewTorrent && check_perms('users_mod')) { ?>
<tr>
<td class="label">Log/Cue:</td>
<td>
<input type="checkbox" id="flac_log" name="flac_log"<? if($HasLog) { echo ' checked="checked"';}?> /> <label for="flac_log">Check this box if the torrent has, or should have, a log file.</label><br />
<input type="checkbox" id="flac_cue" name="flac_cue"<? if($HasCue) { echo ' checked="checked"';}?> /> <label for="flac_cue">Check this box if the torrent has, or should have, a cue file.</label><br />
<input type="checkbox" id="flac_log" name="flac_log"<? if ($HasLog) { echo ' checked="checked"';} ?> /> <label for="flac_log">Check this box if the torrent has, or should have, a log file.</label><br />
<input type="checkbox" id="flac_cue" name="flac_cue"<? if ($HasCue) { echo ' checked="checked"';} ?> /> <label for="flac_cue">Check this box if the torrent has, or should have, a cue file.</label><br />
<?
}
global $LoggedUser;
@ -532,10 +532,10 @@ function show() {
}
}
}
if(!$this->NewTorrent && check_perms('users_mod')) {?>
if (!$this->NewTorrent && check_perms('users_mod')) { ?>
</td>
</tr>
<?/* if($HasLog) { ?>
<?/* if ($HasLog) { ?>
<tr>
<td class="label">Log score</td>
<td><input type="text" name="log_score" size="5" id="log_score" value="<?=display_str($Torrent['LogScore']) ?>" /></td>
@ -550,37 +550,37 @@ function show() {
<? }*/?>
<tr>
<td class="label">Bad tags:</td>
<td><input type="checkbox" id="bad_tags" name="bad_tags"<? if($BadTags) { echo ' checked="checked"';}?> /> <label for="bad_tags">Check this box if the torrent has bad tags.</label></td>
<td><input type="checkbox" id="bad_tags" name="bad_tags"<? if ($BadTags) { echo ' checked="checked"';} ?> /> <label for="bad_tags">Check this box if the torrent has bad tags.</label></td>
</tr>
<tr>
<td class="label">Bad folder names:</td>
<td><input type="checkbox" id="bad_folders" name="bad_folders"<? if($BadFolders) { echo ' checked="checked"';}?> /> <label for="bad_folders">Check this box if the torrent has bad folder names.</label></td>
<td><input type="checkbox" id="bad_folders" name="bad_folders"<? if ($BadFolders) { echo ' checked="checked"';} ?> /> <label for="bad_folders">Check this box if the torrent has bad folder names.</label></td>
</tr>
<tr>
<td class="label">Bad file names:</td>
<td><input type="checkbox" id="bad_files" name="bad_files"<? if ($BadFiles) {echo ' checked="checked"';}?> /> <label for="bad_files">Check this box if the torrent has bad file names.</label></td>
<td><input type="checkbox" id="bad_files" name="bad_files"<? if ($BadFiles) {echo ' checked="checked"';} ?> /> <label for="bad_files">Check this box if the torrent has bad file names.</label></td>
</tr>
<tr>
<td class="label">Cassette approved:</td>
<td><input type="checkbox" id="cassette_approved" name="cassette_approved"<? if ($CassetteApproved) {echo ' checked="checked"';}?> /> <label for="cassette_approved">Check this box if the torrent is an approved cassette rip.</label></td>
<td><input type="checkbox" id="cassette_approved" name="cassette_approved"<? if ($CassetteApproved) {echo ' checked="checked"';} ?> /> <label for="cassette_approved">Check this box if the torrent is an approved cassette rip.</label></td>
</tr>
<tr>
<td class="label">Lossy master approved:</td>
<td><input type="checkbox" id="lossymaster_approved" name="lossymaster_approved"<? if ($LossymasterApproved) {echo ' checked="checked"';}?> /> <label for="lossymaster_approved">Check this box if the torrent is an approved lossy master.</label></td>
<td><input type="checkbox" id="lossymaster_approved" name="lossymaster_approved"<? if ($LossymasterApproved) {echo ' checked="checked"';} ?> /> <label for="lossymaster_approved">Check this box if the torrent is an approved lossy master.</label></td>
</tr>
<tr>
<td class="label">Lossy web approved:</td>
<td><input type="checkbox" id="lossyweb_approved" name="lossyweb_approved"<? if ($LossywebApproved) { echo ' checked="checked"';}?> /> <label for="lossyweb_approved">Check this box if the torrent is an approved lossy WEB release.</label></td>
<td><input type="checkbox" id="lossyweb_approved" name="lossyweb_approved"<? if ($LossywebApproved) { echo ' checked="checked"';} ?> /> <label for="lossyweb_approved">Check this box if the torrent is an approved lossy WEB release.</label></td>
</tr>
<? }?>
<? if($this->NewTorrent) { ?>
<? } ?>
<? if ($this->NewTorrent) { ?>
<tr>
<td class="label">Tags:</td>
<td>
<? if($GenreTags) { ?>
<? if ($GenreTags) { ?>
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;"<?=$this->Disabled?>>
<option>---</option>
<? foreach(Misc::display_array($GenreTags) as $Genre) { ?>
<? foreach (Misc::display_array($GenreTags) as $Genre) { ?>
<option value="<?=$Genre ?>"><?=$Genre ?></option>
<? } ?>
</select>
@ -637,7 +637,7 @@ function audiobook_form() {
$Torrent = $this->Torrent;
?>
<table cellpadding="3" cellspacing="1" border="0" class="layout border slice" width="100%">
<? if($this->NewTorrent){ ?>
<? if ($this->NewTorrent){ ?>
<tr id="title_tr">
<td class="label">Author - Title:</td>
<td>
@ -656,9 +656,9 @@ function audiobook_form() {
<select name="format" onchange="Format()">
<option value="">---</option>
<?
foreach(Misc::display_array($this->Formats) as $Format) {
foreach (Misc::display_array($this->Formats) as $Format) {
echo '<option value="'.$Format.'"';
if($Format == $Torrent['Format']) { echo ' selected="selected"'; }
if ($Format == $Torrent['Format']) { echo ' selected="selected"'; }
echo '>';
echo $Format;
echo "</option>\n";
@ -673,18 +673,18 @@ function audiobook_form() {
<select id="bitrate" name="bitrate" onchange="Bitrate()">
<option value="">---</option>
<?
if(!$Torrent['Bitrate'] || ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates))) {
if (!$Torrent['Bitrate'] || ($Torrent['Bitrate'] && !in_array($Torrent['Bitrate'], $this->Bitrates))) {
$OtherBitrate = true;
if(substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
if (substr($Torrent['Bitrate'], strlen($Torrent['Bitrate']) - strlen(" (VBR)")) == " (VBR)") {
$Torrent['Bitrate'] = substr($Torrent['Bitrate'], 0, strlen($Torrent['Bitrate'])-6);
$VBR = true;
}
} else {
$OtherBitrate = false;
}
foreach(Misc::display_array($this->Bitrates) as $Bitrate) {
foreach (Misc::display_array($this->Bitrates) as $Bitrate) {
echo '<option value="'.$Bitrate.'"';
if($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
if ($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
echo ' selected="selected"';
}
echo '>';
@ -693,13 +693,13 @@ function audiobook_form() {
}
?>
</select>
<span id="other_bitrate_span"<? if(!$OtherBitrate) { echo ' class="hidden"'; } ?>>
<input type="text" name="other_bitrate" size="5" id="other_bitrate"<? if($OtherBitrate) { echo ' value="'.display_str($Torrent['Bitrate']).'"';} ?> onchange="AltBitrate()" />
<input type="checkbox" id="vbr" name="vbr"<? if(isset($VBR)) { echo ' checked="checked"'; } ?> /><label for="vbr"> (VBR)</label>
<span id="other_bitrate_span"<? if (!$OtherBitrate) { echo ' class="hidden"'; } ?>>
<input type="text" name="other_bitrate" size="5" id="other_bitrate"<? if ($OtherBitrate) { echo ' value="'.display_str($Torrent['Bitrate']).'"';} ?> onchange="AltBitrate()" />
<input type="checkbox" id="vbr" name="vbr"<? if (isset($VBR)) { echo ' checked="checked"'; } ?> /><label for="vbr"> (VBR)</label>
</span>
</td>
</tr>
<? if($this->NewTorrent) { ?>
<? if ($this->NewTorrent) { ?>
<tr>
<td class="label">Tags:</td>
<td>

View File

@ -697,7 +697,7 @@ public static function has_snatched($TorrentID, $AllUsers = false) {
if (empty($SnatchedTorrents)) {
$SnatchedTorrents = array_fill(0, $Buckets, false);
$LastUpdate = $Cache->get_value('users_snatched_'.$UserID.'_lastupdate') ?: 0;
} else if (isset($SnatchedTorrents[$BucketID][$TorrentID])) {
} elseif (isset($SnatchedTorrents[$BucketID][$TorrentID])) {
return true;
}

View File

@ -198,14 +198,14 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
$TorrentInfo[] = $Encoding;
}
if (!empty($TorrentInfo)) {
$TorrentInfo = " (" . Misc::file_string(implode(" - ", $TorrentInfo)) . ")";
$TorrentInfo = ' (' . Misc::file_string(implode(' - ', $TorrentInfo)) . ')';
} else {
$TorrentInfo = "";
$TorrentInfo = '';
}
if (!$TorrentName) {
$TorrentName = "No Name";
} else if (mb_strlen($TorrentArtist . $TorrentName . $TorrentInfo, 'UTF-8') <= $MaxLength) {
$TorrentName = 'No Name';
} elseif (mb_strlen($TorrentArtist . $TorrentName . $TorrentInfo, 'UTF-8') <= $MaxLength) {
$TorrentName = $TorrentArtist . $TorrentName;
}
@ -222,7 +222,7 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
/**
* Convert a stored torrent into a binary file that can be loaded in a torrent client
*
* @param mixed $TorrentData bencoded torrent without announce url (new format) or TORRENT object (old format)
* @param mixed $TorrentData bencoded torrent without announce URL (new format) or TORRENT object (old format)
* @return bencoded string
*/
public static function get_file(&$TorrentData, $AnnounceURL) {

View File

@ -5,14 +5,19 @@
include(SERVER_ROOT.'/sections/torrents/functions.php');
// The "order by x" links on columns headers
function header_link($SortKey,$DefaultWay="desc") {
function header_link($SortKey,$DefaultWay = 'desc') {
global $OrderBy,$OrderWay;
if($SortKey==$OrderBy) {
if($OrderWay=="desc") { $NewWay="asc"; }
else { $NewWay="desc"; }
} else { $NewWay=$DefaultWay; }
if ($SortKey == $OrderBy) {
if ($OrderWay == 'desc') {
$NewWay = 'asc';
} else {
$NewWay = 'desc';
}
} else {
$NewWay = $DefaultWay;
}
return "torrents.php?order_way=".$NewWay."&amp;order_by=".$SortKey."&amp;".Format::get_url(array('order_way','order_by'));
return 'torrents.php?order_way='.$NewWay.'&amp;order_by='.$SortKey.'&amp;'.Format::get_url(array('order_way','order_by'));
}
/** Start default parameters and validation **/
@ -97,7 +102,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$OrderBy = $_GET['order_by'];
}
if(!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
$OrderWay = 'asc';
} else {
$_GET['order_way'] = 'desc';
@ -126,7 +131,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$SphQL->select('id, groupid, categoryid')
->order_by('RAND()', '');
$Random = true;
} else if ($GroupResults) {
} elseif ($GroupResults) {
$OrderProperties = $SortOrders[$OrderBy];
$SphQL->select('groupid, categoryid' . (isset($AggregateExp[$OrderProperties[0]]) ? ', '.$AggregateExp[$OrderProperties[0]] : ''))
->group_by('groupid')
@ -281,9 +286,7 @@ function header_link($SortKey,$DefaultWay="desc") {
if (!empty($Tags)) {
$QueryParts[] = implode(' ', $Tags);
}
}
// 'Any' tags
else {
} else { // 'Any' tags
$_GET['tags_type'] = '0';
if (!empty($Tags['include'])) {
$QueryParts[] = '( '.implode(' | ', $Tags['include']).' )';
@ -487,27 +490,27 @@ function header_link($SortKey,$DefaultWay="desc") {
}
/** End run search query and collect results **/
if($TorrentCount == 0) {
if ($TorrentCount == 0) {
$DB->query("SELECT
tags.Name,
((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score
FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
INNER JOIN tags ON tags.ID=tt.TagID
INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
INNER JOIN tags ON tags.ID=tt.TagID
WHERE s.uid='$LoggedUser[ID]'
AND tt.TagID<>'13679'
AND tt.TagID<>'4820'
AND tt.TagID<>'2838'
AND g.CategoryID='1'
AND tags.Uses > '10'
AND tt.TagID<>'13679'
AND tt.TagID<>'4820'
AND tt.TagID<>'2838'
AND g.CategoryID='1'
AND tags.Uses > '10'
GROUP BY tt.TagID
ORDER BY Score DESC
LIMIT 8");
$JsonYouMightLike = array();
while(list($Tag)=$DB->next_record()) {
while (list($Tag) = $DB->next_record()) {
$JsonYouMightLike[] = $Tag;
}
@ -570,7 +573,7 @@ function header_link($SortKey,$DefaultWay="desc") {
'aliasid' => (int) $Artist['id']
);
}
} elseif(!empty($Artists)) {
} elseif (!empty($Artists)) {
$DisplayName = Artists::display_artists(array(1=>$Artists), false, false, true);
foreach ($Artists as $Artist) {
$JsonArtists[] = array(
@ -594,7 +597,7 @@ function header_link($SortKey,$DefaultWay="desc") {
unset($FirstUnknown);
$JsonTorrents = array();
foreach($Torrents as $TorrentID => $Data) {
foreach ($Torrents as $TorrentID => $Data) {
// All of the individual torrents in the group
// If they're using the advanced search and have chosen enabled grouping, we just skip the torrents that don't check out
@ -667,8 +670,7 @@ function header_link($SortKey,$DefaultWay="desc") {
'totalLeechers' => (int) $TotalLeechers,
'torrents' => $JsonTorrents
);
}
else {
} else {
// Viewing a type that does not require grouping
list($TorrentID, $Data) = each($Torrents);

View File

@ -14,15 +14,14 @@
// Check for lame SQL injection attempts
$ForumID = $_GET['forumid'];
if(!is_number($ForumID)) {
if (!is_number($ForumID)) {
print json_encode(array('status' => 'failure'));
die();
}
if (isset($_GET['pp'])) {
$PerPage = $_GET['pp'];
}
else if (isset($LoggedUser['PostsPerPage'])) {
} elseif (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
@ -34,10 +33,10 @@
// Caching anything beyond the first page of any given forum is just wasting ram
// users are more likely to search then to browse to page 2
if($Page==1) {
if ($Page == 1) {
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
}
if(!isset($Forum) || !is_array($Forum)) {
if (!isset($Forum) || !is_array($Forum)) {
$DB->query("SELECT
t.ID,
t.Title,
@ -53,22 +52,26 @@
ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
if($Page==1) {
if ($Page == 1) {
$DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
list($Stickies) = $DB->next_record();
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
}
}
if(!isset($Forums[$ForumID])) {
if (!isset($Forums[$ForumID])) {
print json_encode(array('status' => 'failure'));
die();
}
// Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) {
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); }
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
error(403);
}
}
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
error(403);
}
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
$ForumName = display_str($Forums[$ForumID]['Name']);
$JsonSpecificRules = array();
@ -91,8 +94,7 @@
'threads' => array()
)
);
}
else {
} else {
// forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
$DB->query('SELECT
l.TopicID,
@ -113,7 +115,7 @@
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
// handle read/unread posts - the reason we can't cache the whole page
if((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID']<$LastID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
if ((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID'] < $LastID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
$Read = 'unread';
} else {
$Read = 'read';
@ -134,7 +136,7 @@
'lastID' => $LastID == null ? 0 : (int) $LastID,
'lastTime' => $LastTime,
'lastAuthorId' => $LastAuthorID == null ? 0 : (int) $LastAuthorID,
'lastAuthorName' => $LastAuthorName == null ? "" : $LastAuthorName,
'lastAuthorName' => $LastAuthorName == null ? '' : $LastAuthorName,
'lastReadPage' => $LastRead[$TopicID]['Page'] == null ? 0 : (int) $LastRead[$TopicID]['Page'],
'lastReadPostId' => $LastRead[$TopicID]['PostID'] == null ? 0 : (int) $LastRead[$TopicID]['PostID'],
'read' => $Read == "read"

View File

@ -1,9 +1,8 @@
<?
if(empty($_GET['type']) || $_GET['type'] == 'inbox' || $_GET['type'] == 'sentbox') {
if (empty($_GET['type']) || $_GET['type'] == 'inbox' || $_GET['type'] == 'sentbox') {
require(SERVER_ROOT.'/sections/ajax/inbox/inbox.php');
} else if ($_GET['type'] == 'viewconv') {
} elseif ($_GET['type'] == 'viewconv') {
require(SERVER_ROOT.'/sections/ajax/inbox/viewconv.php');
} else {
print json_encode(array('status' => 'failure'));

View File

@ -17,7 +17,7 @@
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
if(empty($_GET['id']) || !is_number($_GET['id'])) {
if (empty($_GET['id']) || !is_number($_GET['id'])) {
print
json_encode(
array(
@ -33,7 +33,7 @@
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if(empty($Request)) {
if (empty($Request)) {
print
json_encode(
array(
@ -50,44 +50,44 @@
$IsFilled = !empty($TorrentID);
$CanVote = (empty($TorrentID) && check_perms('site_vote'));
if($CategoryID == 0) {
$CategoryName = "Unknown";
if ($CategoryID == 0) {
$CategoryName = 'Unknown';
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
//Do we need to get artists?
if($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
if($IsFilled) {
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>".$Title."</a> [".$Year."]";
if ($IsFilled) {
$DisplayLink = $ArtistLink."<a href=\"torrents.php?torrentid=".$TorrentID."\">".$Title."</a> [$Year]";
} else {
$DisplayLink = $ArtistLink.$Title." [".$Year."]";
$DisplayLink = $ArtistLink.$Title." [$Year]";
}
$FullName = $ArtistName.$Title." [".$Year."]";
$FullName = $ArtistName.$Title." [$Year]";
if($BitrateList != "") {
$BitrateString = implode(", ", explode("|", $BitrateList));
$FormatString = implode(", ", explode("|", $FormatList));
$MediaString = implode(", ", explode("|", $MediaList));
if ($BitrateList != '') {
$BitrateString = implode(', ', explode('|', $BitrateList));
$FormatString = implode(', ', explode('|', $FormatList));
$MediaString = implode(', ', explode('|', $MediaList));
} else {
$BitrateString = "Unknown, please read the description.";
$FormatString = "Unknown, please read the description.";
$MediaString = "Unknown, please read the description.";
$BitrateString = 'Unknown, please read the description.';
$FormatString = 'Unknown, please read the description.';
$MediaString = 'Unknown, please read the description.';
}
if(empty($ReleaseType)) {
$ReleaseName = "Unknown";
if (empty($ReleaseType)) {
$ReleaseName = 'Unknown';
} else {
$ReleaseName = $ReleaseTypes[$ReleaseType];
}
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = $Title." [".$Year."]";
$DisplayLink = $Title." [".$Year."]";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = $Title." [$Year]";
$DisplayLink = $Title." [$Year]";
} else {
$FullName = $Title;
$DisplayLink = $Title;
@ -132,7 +132,7 @@
reset($RequestVotes['Voters']);
$Results = $Cache->get_value('request_comments_'.$RequestID);
if($Results === false) {
if ($Results === false) {
$DB->query("SELECT
COUNT(c.ID)
FROM requests_comments as c
@ -144,24 +144,25 @@
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
//Get the cache catalogue
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
//---------- Get some data to start processing
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
if($Catalogue === false) {
$DB->query("SELECT
c.ID,
c.AuthorID,
c.AddedTime,
c.Body,
c.EditedUserID,
c.EditedTime,
u.Username
if ($Catalogue === false) {
$DB->query("
SELECT
c.ID,
c.AuthorID,
c.AddedTime,
c.Body,
c.EditedUserID,
c.EditedTime,
u.Username
FROM requests_comments as c
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID
WHERE c.RequestID = '$RequestID'
ORDER BY c.ID
LIMIT $CatalogueLimit");
@ -170,10 +171,10 @@
}
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
$JsonRequestComments = array();
foreach($Thread as $Key => $Post){
foreach ($Thread as $Key => $Post){
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
$JsonRequestComments[] = array(
@ -194,7 +195,7 @@
}
$JsonTags = array();
foreach($Request['Tags'] as $Tag) {
foreach ($Request['Tags'] as $Tag) {
$JsonTags[] = $Tag;
}

View File

@ -2,15 +2,18 @@
authorize();
if ($UserID != $LoggedUser['ID'] || !Bookmarks::can_bookmark('torrent')) error(403);
if ($UserID != $LoggedUser['ID'] || !Bookmarks::can_bookmark('torrent')) {
error(403);
}
if ($_POST['type'] === 'torrents') {
// require_once SERVER_ROOT.'/classes/class_mass_user_bookmarks_editor.php'; //Bookmark Updater Class
$BU = new MASS_USER_BOOKMARKS_EDITOR;
if ($_POST['delete'])
if ($_POST['delete']) {
$BU->mass_remove();
else if ($_POST['update'])
} elseif ($_POST['update']) {
$BU->mass_update();
}
}
header('Location: bookmarks.php?type=torrents');
header('Location: bookmarks.php?type=torrents');

View File

@ -21,11 +21,11 @@
}
if(isset($_POST['thread']) && !is_number($_POST['thread'])) {
if (isset($_POST['thread']) && !is_number($_POST['thread'])) {
error(0);
}
if(isset($_POST['forum']) && !is_number($_POST['forum'])) {
if (isset($_POST['forum']) && !is_number($_POST['forum'])) {
error(0);
}
@ -37,7 +37,7 @@
$Body = $_POST['body'];
if($LoggedUser['DisablePosting']) {
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed');
}
@ -48,7 +48,7 @@
if (!isset($Forums[$ForumID])) { error(404); }
if(!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
error(403);
}
@ -82,23 +82,23 @@
LastPostTime = '".sqltime()."'
WHERE ID = '$TopicID'");
if(isset($_POST['subscribe'])) {
if (isset($_POST['subscribe'])) {
$DB->query("INSERT INTO users_subscriptions VALUES ($LoggedUser[ID], $TopicID)");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
}
//auto subscribe
/*
if(check_perms('users_mod')) {
$DB->query("SELECT SubscriberID FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID <> '$LoggedUser[ID]'");
while(list($SubscriberID) = $DB->next_record()) {
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
if (check_perms('users_mod')) {
$DB->query("SELECT SubscriberID FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID <> '$LoggedUser[ID]'");
while (list($SubscriberID) = $DB->next_record()) {
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
// $DB->query("INSERT INTO forums_last_read_topics
// (UserID, TopicID, PostID) VALUES
// ('$SubscriberID', '".$TopicID ."', '".db_string($PostID)."')
// ON DUPLICATE KEY UPDATE PostID='$LastPost'");
$Cache->delete_value('subscriptions_user_'.$SubscriberID);
}
}
}
*/
@ -113,20 +113,20 @@
//This can cause polls to have answer ids of 1 3 4 if the second box is empty
foreach ($_POST['answers'] as $i => $Answer) {
if ($Answer == '') { continue; }
$Answers[$i+1] = $Answer;
$Votes[$i+1] = 0;
$Answers[$i + 1] = $Answer;
$Votes[$i + 1] = 0;
}
if (count($Answers) < 2) {
error('You cannot create a poll with only one answer.');
} else if(count($Answers) > 25) {
error('You cannot create a poll with greater than 25 answers');
} elseif (count($Answers) > 25) {
error('You cannot create a poll with greater than 25 answers.');
}
$DB->query('INSERT INTO forums_polls (TopicID, Question, Answers) VALUES (\''.$TopicID.'\',\''.db_string($Question).'\',\''.db_string(serialize($Answers)).'\')');
$Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,'0000-00-00 00:00:00','0'), 0);
if($ForumID == STAFF_FORUM) {
if ($ForumID == STAFF_FORUM) {
send_irc("PRIVMSG ".ADMIN_CHAN." :!mod Poll created by ".$LoggedUser['Username'].": '".$Question."' https://".SSL_SITE_URL."/forums.php?action=viewthread&threadid=".$TopicID);
}
}
@ -141,7 +141,7 @@
}
if ($Stickies > 0) {
$Part1 = array_slice($Forum,0,$Stickies,true); //Stikys
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickies
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page
} else {
$Part1 = array();

View File

@ -1,21 +1,21 @@
<?
authorize();
if((!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) || (empty($_POST['reportid']) && !is_number($_POST['reportid']))) {
if ((!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) || (empty($_POST['reportid']) && !is_number($_POST['reportid']))) {
ajax_error();
}
$ReportID = $_POST['reportid'];
$DB->query("SELECT Type FROM reports WHERE ID = ".$ReportID);
$DB->query('SELECT Type FROM reports WHERE ID = '.$ReportID);
list($Type) = $DB->next_record();
if(!check_perms('admin_reports')) {
if(check_perms('site_moderate_forums')) {
if(!in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
if (!check_perms('admin_reports')) {
if (check_perms('site_moderate_forums')) {
if (!in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
ajax_error();
}
} else if(check_perms('project_team')) {
if($Type != "request_update") {
} elseif (check_perms('project_team')) {
if ($Type != 'request_update') {
ajax_error();
}
}
@ -30,13 +30,13 @@
$Channels = array();
if($Type == "request_update") {
$Channels[] = "#requestedits";
if ($Type == 'request_update') {
$Channels[] = '#requestedits';
$Cache->decrement('num_update_reports');
}
if(in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
$Channels[] = "#forumreports";
if (in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
$Channels[] = '#forumreports';
$Cache->decrement('num_forum_reports');
}
@ -44,16 +44,16 @@
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status = 'New'");
list($Remaining) = $DB->next_record();
foreach($Channels as $Channel) {
send_irc("PRIVMSG ".$Channel." :Report ".$ReportID." resolved by ".preg_replace("/^(.{2})/", "$", $LoggedUser['Username'])." on site (".(int)$Remaining." remaining).");
foreach ($Channels as $Channel) {
send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace("/^(.{2})/", "$", $LoggedUser['Username'])." on site (".(int)$Remaining." remaining).");
}
$Cache->delete_value('num_other_reports');
ajax_success();
function ajax_error($Error = "error") {
echo json_encode(array("status"=>$Error));
function ajax_error($Error = 'error') {
echo json_encode(array('status'=>$Error));
die();
}

View File

@ -1,11 +1,11 @@
<?
authorize();
if(!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) {
if (!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) {
error(403);
}
if(empty($_POST['reportid']) && !is_number($_POST['reportid'])) {
if (empty($_POST['reportid']) && !is_number($_POST['reportid'])) {
error(403);
}
@ -13,13 +13,13 @@
$DB->query("SELECT Type FROM reports WHERE ID = ".$ReportID);
list($Type) = $DB->next_record();
if(!check_perms('admin_reports')) {
if(check_perms('site_moderate_forums')) {
if(!in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
if (!check_perms('admin_reports')) {
if (check_perms('site_moderate_forums')) {
if (!in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
error($Type);
}
} else if(check_perms('project_team')) {
if($Type != "request_update") {
} elseif (check_perms('project_team')) {
if ($Type != 'request_update') {
error(403);
}
}
@ -34,13 +34,13 @@
$Channels = array();
if($Type == "request_update") {
$Channels[] = "#requestedits";
if ($Type == 'request_update') {
$Channels[] = '#requestedits';
$Cache->decrement('num_update_reports');
}
if(in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
$Channels[] = "#forumreports";
if (in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
$Channels[] = '#forumreports';
$Cache->decrement('num_forum_reports');
}
@ -48,7 +48,7 @@
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status = 'New'");
list($Remaining) = $DB->next_record();
foreach($Channels as $Channel) {
foreach ($Channels as $Channel) {
send_irc("PRIVMSG ".$Channel." :Report ".$ReportID." resolved by ".preg_replace("/^(.{2})/", "$", $LoggedUser['Username'])." on site (".(int)$Remaining." remaining).");
}

View File

@ -9,7 +9,7 @@
* replicated on the auto page (reports.php).
*/
if(!check_perms('admin_reports')){
if (!check_perms('admin_reports')){
error(403);
}
@ -20,14 +20,14 @@
list($Page,$Limit) = Format::page_limit(REPORTS_PER_PAGE);
if(isset($_GET['view'])){
if (isset($_GET['view'])){
$View = $_GET['view'];
} else {
error(404);
}
if(isset($_GET['id'])) {
if(!is_number($_GET['id']) && $View != "type") {
if (isset($_GET['id'])) {
if (!is_number($_GET['id']) && $View != "type") {
error(404);
} else {
$ID = db_string($_GET['id']);
@ -38,15 +38,15 @@
$Order = "ORDER BY r.ReportedTime ASC";
if(!$ID) {
if (!$ID) {
switch($View) {
case "resolved" :
$Title = "All the old smelly reports";
case 'resolved' :
$Title = 'All the old smelly reports';
$Where = "WHERE r.Status = 'Resolved'";
$Order = "ORDER BY r.LastChangeTime DESC";
$Order = 'ORDER BY r.LastChangeTime DESC';
break;
case "unauto" :
$Title = "New reports, not auto assigned!";
case 'unauto' :
$Title = 'New reports, not auto assigned!';
$Where = "WHERE r.Status = 'New'";
break;
default :
@ -55,62 +55,62 @@
}
} else {
switch($View) {
case "staff" :
case 'staff' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
list($Username) = $DB->next_record();
if($Username) {
if ($Username) {
$Title = $Username."'s in-progress reports";
} else {
$Title = $ID."'s in-progress reports";
}
$Where = "WHERE r.Status = 'InProgress' AND r.ResolverID = ".$ID;
break;
case "resolver" :
case 'resolver' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
list($Username) = $DB->next_record();
if($Username) {
if ($Username) {
$Title = $Username."'s resolved reports";
} else {
$Title = $ID."'s resolved reports";
}
$Where = "WHERE r.Status = 'Resolved' AND r.ResolverID = ".$ID;
$Order = "ORDER BY r.LastChangeTime DESC";
$Order = 'ORDER BY r.LastChangeTime DESC';
break;
case "group" :
$Title = "Unresolved reports for the group ".$ID;
case 'group' :
$Title = "Unresolved reports for the group $ID";
$Where = "WHERE r.Status != 'Resolved' AND tg.ID = ".$ID;
break;
case "torrent" :
$Title = "All reports for the torrent ".$ID;
$Where = "WHERE r.TorrentID = ".$ID;
case 'torrent' :
$Title = 'All reports for the torrent '.$ID;
$Where = 'WHERE r.TorrentID = '.$ID;
break;
case "report" :
$Title = "Viewing resolution of report ".$ID;
$Where = "WHERE r.ID = ".$ID;
case 'report' :
$Title = 'Viewing resolution of report '.$ID;
$Where = 'WHERE r.ID = '.$ID;
break;
case "reporter" :
case 'reporter' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
list($Username) = $DB->next_record();
if($Username) {
$Title = "All torrents reported by ".$Username;
if ($Username) {
$Title = 'All torrents reported by '.$Username;
} else {
$Title = "All torrents reported by user ".$ID;
$Title = 'All torrents reported by user '.$ID;
}
$Where = "WHERE r.ReporterID = ".$ID;
$Order = "ORDER BY r.ReportedTime DESC";
$Where = 'WHERE r.ReporterID = '.$ID;
$Order = 'ORDER BY r.ReportedTime DESC';
break;
case "uploader" :
case 'uploader' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
list($Username) = $DB->next_record();
if($Username) {
$Title = "All reports for torrents uploaded by ".$Username;
if ($Username) {
$Title = 'All reports for torrents uploaded by '.$Username;
} else {
$Title = "All reports for torrents uploaded by user ".$ID;
$Title = 'All reports for torrents uploaded by user '.$ID;
}
$Where = "WHERE r.Status != 'Resolved' AND t.UserID = ".$ID;
break;
case "type":
$Title = "All new reports for the chosen type";
case 'type':
$Title = 'All new reports for the chosen type';
$Where = "WHERE r.Status = 'New' AND r.Type = '".$ID."'";
break;
break;
@ -168,13 +168,13 @@
t.UserID AS UploaderID,
uploader.Username
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID "
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID "
.$Where."
GROUP BY r.ID "
.$Order."
@ -191,23 +191,24 @@
?>
<div class="header">
<h2><?=$Title?></h2>
<? include('header.php'); ?>
<? include('header.php'); ?>
</div>
<div class="buttonbox thin center">
<? if($View != "resolved") { ?>
<? if ($View != 'resolved') { ?>
<span title="Resolves *all* checked reports with their respective resolutions"><input type="button" onclick="MultiResolve();" value="Multi-resolve" /></span>
<span title="Assigns all of the reports on the page to you!"><input type="button" onclick="Grab();" value="Claim all" /></span>
<? } ?>
<? if($View == "staff" && $LoggedUser['ID'] == $ID) { ?>| <span title="Unclaim all of the reports currently displayed"><input type="button" onclick="GiveBack();" value="Unclaim all" /></span><? } ?>
<? }
if ($View == 'staff' && $LoggedUser['ID'] == $ID) { ?>
| <span title="Unclaim all of the reports currently displayed"><input type="button" onclick="GiveBack();" value="Unclaim all" /></span>
<? } ?>
</div>
<br />
<div class="linkbox">
<?=$PageLinks?>
</div>
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto">
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto;">
<?
if(count($Reports) == 0) {
if (count($Reports) == 0) {
?>
<div>
<table class="layout">
@ -220,14 +221,14 @@
</div>
<?
} else {
foreach($Reports as $Report) {
foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = Misc::display_array($Report, array("ModComment"));
if(!$GroupID && $Status != "Resolved") {
if (!$GroupID && $Status != 'Resolved') {
//Torrent already deleted
$DB->query("UPDATE reportsv2 SET
Status='Resolved',
@ -247,12 +248,12 @@
</div>
<?
} else {
if(!$CategoryID) {
if (!$CategoryID) {
//Torrent was deleted
} else {
if (array_key_exists($Type, $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$Type];
} else if(array_key_exists($Type,$Types['master'])) {
} elseif (array_key_exists($Type,$Types['master'])) {
$ReportType = $Types['master'][$Type];
} else {
//There was a type but it wasn't an option!
@ -261,17 +262,23 @@
}
}
if ($ArtistID == 0 && empty($ArtistName)) {
$RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'>".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '').($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "<a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\">".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '').($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'</a> '.($HasCue ? ' (Cue)' : '').($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: $LogScore %)</a>" : '')." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "Various Artists - <a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "Various Artists - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'</a> '.($HasCue ? ' (Cue)' : '').($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: $LogScore %)</a>" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
} else {
$RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "").($HasCue ? " (Cue)" : '').($HasLog ? " (Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "<a href='artist.php?id=$ArtistID'>$ArtistName</a> - <a href='torrents.php?id=$GroupID'>$GroupName".($Year ? " ($Year)" : "")."</a> <a href='torrents.php?torrentid=$TorrentID'> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."</a> ".($HasCue ? " (Cue)" : '').($HasLog ? " <a href='torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'>(Log: $LogScore %)</a>" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : "")."[/url] ".($HasCue ? " (Cue)" : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: $LogScore %)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "<a href='artist.php?id=$ArtistID'>$ArtistName</a> - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'</a> '.($HasCue ? ' (Cue)' : '').($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: $LogScore %)</a>" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " &lt;$RemasterTitle - $RemasterYear&gt;" : '').'[/url] '.($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: $LogScore %)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
}
?>
<div id="report<?=$ReportID?>">
@ -298,108 +305,106 @@
<tr>
<td class="label"><a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Reported</a> torrent:</td>
<td colspan="3">
<? if(!$GroupID) { ?>
<? if (!$GroupID) { ?>
<a href="log.php?search=Torrent+<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)
<? } else {?>
<? } else { ?>
<?=$LinkName?>
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
<br />
<? if ($ReporterName == "") { $ReporterName = "System"; } ?>
<? if ($ReporterName == '') {
$ReporterName = 'System';
} ?>
<div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
<? if($Status != 'Resolved') {
<? if ($Status != 'Resolved') {
$DB->query("SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
$GroupOthers = ($DB->record_count() - 1);
if($GroupOthers > 0) { ?>
if ($GroupOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrent(s) in this group</a>
</div>
<? }
<? }
$DB->query("SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
AND t.UserID=$UploaderID");
$UploaderOthers = ($DB->record_count() - 1);
if($UploaderOthers > 0) { ?>
if ($UploaderOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=uploader&amp;id=<?=$UploaderID?>">There <?=(($UploaderOthers > 1) ? "are $UploaderOthers other reports" : "is 1 other report")?> for torrent(s) uploaded by this user</a>
</div>
<? }
<? }
$DB->query("SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
req.FillerID,
um.Username,
req.TimeFilled
FROM requests AS req
LEFT JOIN torrents AS t ON t.ID=req.TorrentID
LEFT JOIN reportsv2 AS rep ON rep.TorrentID=t.ID
JOIN users_main AS um ON um.ID=req.FillerID
LEFT JOIN torrents AS t ON t.ID=req.TorrentID
LEFT JOIN reportsv2 AS rep ON rep.TorrentID=t.ID
JOIN users_main AS um ON um.ID=req.FillerID
WHERE rep.Status != 'Resolved'
AND req.TimeFilled > '2010-03-04 02:31:49'
AND req.TorrentID = $TorrentID");
AND req.TimeFilled > '2010-03-04 02:31:49'
AND req.TorrentID = $TorrentID");
$Requests = ($DB->record_count());
if($Requests > 0) {
while(list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
if ($Requests > 0) {
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
?>
<div style="text-align: right;">
<strong class="important_text"><a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=view&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?></strong>
</div>
<? }
<? }
}
}
}
?>
</td>
</tr>
<? if($Tracks) { ?>
<? if ($Tracks) { ?>
<tr>
<td class="label">Relevant tracks:</td>
<td colspan="3">
<?=str_replace(" ", ", ", $Tracks)?>
<?=str_replace(' ', ', ', $Tracks)?>
</td>
</tr>
<? }
<? }
if($Links) {
?>
if ($Links) { ?>
<tr>
<td class="label">Relevant links:</td>
<td colspan="3">
<?
$Links = explode(" ", $Links);
foreach($Links as $Link) {
<?
$Links = explode(' ', $Links);
foreach ($Links as $Link) {
if ($local_url = $Text->local_url($Link)) {
$Link = $local_url;
}
?>
} ?>
<a href="<?=$Link?>"><?=$Link?></a>
<?
}
?>
<?
} ?>
</td>
</tr>
<?
<?
}
if($ExtraIDs) {
?>
if ($ExtraIDs) { ?>
<tr>
<td class="label">Relevant other torrents:</td>
<td colspan="3">
<?
<?
$First = true;
$Extras = explode(" ", $ExtraIDs);
foreach($Extras as $ExtraID) {
$Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) {
$DB->query("SELECT
@ -430,75 +435,68 @@
t.UserID AS UploaderID,
uploader.Username
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID='$ExtraID'
GROUP BY tg.ID");
list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle,
$ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record());
if($ExtraGroupName) {
if ($ExtraGroupName) {
if ($ArtistID == 0 && empty($ArtistName)) {
$ExtraLinkName = "<a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasCue == '1' ? " (Cue)" : '').($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "<a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '').'</a> '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$ExtraLinkName = "Various Artists - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasCue == '1' ? " (Cue)" : '').($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "Various Artists - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '').'</a> '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} else {
$ExtraLinkName = "<a href='artist.php?id=$ExtraArtistID'>$ExtraArtistName</a> - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasCue == '1' ? " (Cue)" : '').($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "<a href=\"artist.php?id=$ExtraArtistID\">$ExtraArtistName</a> - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '').'</a> '.($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
}
?>
<?=($First ? "" : "<br />")?>
<?=($First ? '' : '<br />')?>
<?=$ExtraLinkName?>
<a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a>
<?
<?
$First = false;
}
}
?>
} ?>
</td>
</tr>
<?
<?
}
if($Images) {
?>
if ($Images) { ?>
<tr>
<td class="label">Relevant images:</td>
<td colspan="3">
<?
$Images = explode(" ", $Images);
foreach($Images as $Image) {
<?
$Images = explode(' ', $Images);
foreach ($Images as $Image) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Image);
?>
<img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=$Image?>" alt="Relevant image" />
<?
}
?>
<?
} ?>
</td>
</tr>
<?
}
?>
<?
} ?>
<tr>
<td class="label">User comment:</td>
<td colspan="3" class="wrap_overflow"><?=$Text->full_format($UserComment)?></td>
</tr>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
<?
if($Status == "InProgress") {
?>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF
if ($Status == 'InProgress') { ?>
<tr>
<td class="label">In progress by:</td>
<td colspan="3">
<a href="user.php?id=<?=$ResolverID?>"><?=$ResolverName?></a>
</td>
</tr>
<? }
if($Status != "Resolved") {
?>
<? }
if ($Status != 'Resolved') { ?>
<tr>
<td class="label">Report comment:</td>
<td colspan="3">
@ -512,7 +510,7 @@
</td>
<td colspan="3">
<select name="resolve_type" id="resolve_type<?=$ReportID?>" onchange="ChangeResolve(<?=$ReportID?>)">
<?
<?
$TypeList = $Types['master'] + $Types[$CategoryID];
$Priorities = array();
foreach ($TypeList as $Key => $Value) {
@ -520,28 +518,25 @@
}
array_multisort($Priorities, SORT_ASC, $TypeList);
foreach($TypeList as $Type => $Data) {
?>
foreach ($TypeList as $Type => $Data) { ?>
<option value="<?=$Type?>"><?=$Data['title']?></option>
<? } ?>
<? } ?>
</select>
<span id="options<?=$ReportID?>">
<? if(check_perms('users_mod')) { ?>
<? if (check_perms('users_mod')) { ?>
<span title="Delete torrent?">
<label for="delete<?=$ReportID?>"><strong>Delete</strong></label>
<input type="checkbox" name="delete" id="delete<?=$ReportID?>" />
</span>
<? } ?>
<? } ?>
<span title="Warning length in weeks">
<strong>Warning</strong>
<select name="warning" id="warning<?=$ReportID?>">
<?
for($i = 0; $i < 9; $i++) {
?>
<?
for($i = 0; $i < 9; $i++) { ?>
<option value="<?=$i?>"><?=$i?></option>
<?
}
?>
<?
} ?>
</select>
</span>
<span title="Remove upload privileges?">
@ -573,10 +568,10 @@
<tr>
<td class="label"><strong>Extra</strong> log message:</td>
<td>
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40" <? if($ExtraIDs) {
$Extras = explode(" ", $ExtraIDs);
$Value = "";
foreach($Extras as $ExtraID) {
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40" <? if ($ExtraIDs) {
$Extras = explode(' ', $ExtraIDs);
$Value = '';
foreach ($Extras as $ExtraID) {
$Value .= 'https://'.SSL_SITE_URL.'/torrents.php?torrentid='.$ExtraID.' ';
}
echo 'value="'.trim($Value).'"';
@ -591,7 +586,7 @@
<td colspan="4" style="text-align: center;">
<input type="button" value="Invalidate report" onclick="Dismiss(<?=$ReportID?>);" />
<input type="button" value="Resolve report manually" onclick="ManualResolve(<?=$ReportID?>);" />
<? if($Status == "InProgress" && $LoggedUser['ID'] == $ResolverID) { ?>
<? if ($Status == 'InProgress' && $LoggedUser['ID'] == $ResolverID) { ?>
| <input type="button" value="Unclaim" onclick="GiveBack(<?=$ReportID?>);" />
<? } else { ?>
| <input id="grab<?=$ReportID?>" type="button" value="Claim" onclick="Grab(<?=$ReportID?>);" />
@ -627,7 +622,7 @@
<?=$LogMessage?>
</td>
</tr>
<? if($GroupID) { ?>
<? if ($GroupID) { ?>
<tr>
<td colspan="4" style="text-align: center;">
<input id="grab<?=$ReportID?>" type="button" value="Claim" onclick="Grab(<?=$ReportID?>);" />

View File

@ -9,7 +9,7 @@
$Text = new TEXT;
if(empty($_GET['id']) || !is_number($_GET['id'])) {
if (empty($_GET['id']) || !is_number($_GET['id'])) {
error(0);
}
@ -19,7 +19,7 @@
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if(empty($Request)) {
if (empty($Request)) {
error(404);
}
@ -30,44 +30,44 @@
$IsFilled = !empty($TorrentID);
$CanVote = (empty($TorrentID) && check_perms('site_vote'));
if($CategoryID == 0) {
$CategoryName = "Unknown";
if ($CategoryID == 0) {
$CategoryName = 'Unknown';
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
//Do we need to get artists?
if($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
if($IsFilled) {
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>".$Title."</a> [".$Year."]";
if ($IsFilled) {
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>$Title</a> [$Year]";
} else {
$DisplayLink = $ArtistLink.$Title." [".$Year."]";
$DisplayLink = $ArtistLink.$Title." [$Year]";
}
$FullName = $ArtistName.$Title." [".$Year."]";
$FullName = $ArtistName.$Title." [$Year]";
if($BitrateList != "") {
$BitrateString = implode(", ", explode("|", $BitrateList));
$FormatString = implode(", ", explode("|", $FormatList));
$MediaString = implode(", ", explode("|", $MediaList));
if ($BitrateList != '') {
$BitrateString = implode(', ', explode('|', $BitrateList));
$FormatString = implode(', ', explode('|', $FormatList));
$MediaString = implode(', ', explode('|', $MediaList));
} else {
$BitrateString = "Unknown, please read the description.";
$FormatString = "Unknown, please read the description.";
$MediaString = "Unknown, please read the description.";
$BitrateString = 'Unknown, please read the description.';
$FormatString = 'Unknown, please read the description.';
$MediaString = 'Unknown, please read the description.';
}
if(empty($ReleaseType)) {
$ReleaseName = "Unknown";
if (empty($ReleaseType)) {
$ReleaseName = 'Unknown';
} else {
$ReleaseName = $ReleaseTypes[$ReleaseType];
}
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = $Title." [".$Year."]";
$DisplayLink = $Title." [".$Year."]";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "$Title [$Year]";
$DisplayLink = "$Title [$Year]";
} else {
$FullName = $Title;
$DisplayLink = $Title;
@ -76,7 +76,7 @@
//Votes time
$RequestVotes = get_votes_array($RequestID);
$VoteCount = count($RequestVotes['Voters']);
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0)));
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == 'Music' && $Year == 0)));
$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2);
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests'));
@ -87,22 +87,22 @@
<div class="header">
<h2><a href="requests.php">Requests</a> &gt; <?=$CategoryName?> &gt; <?=$DisplayLink?></h2>
<div class="linkbox">
<? if($CanEdit) { ?>
<? if ($CanEdit) { ?>
<a href="requests.php?action=edit&amp;id=<?=$RequestID?>" class="brackets">Edit</a>
<? }
if($UserCanEdit || check_perms('users_mod')) { //check_perms('site_moderate_requests')) { ?>
<? }
if ($UserCanEdit || check_perms('users_mod')) { //check_perms('site_moderate_requests')) { ?>
<a href="requests.php?action=delete&amp;id=<?=$RequestID?>" class="brackets">Delete</a>
<? } ?>
<? if(Bookmarks::has_bookmarked('request', $RequestID)) { ?>
<? }
if (Bookmarks::has_bookmarked('request', $RequestID)) { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Unbookmark('request', <?=$RequestID?>,'Bookmark');return false;" class="brackets">Remove bookmark</a>
<? } else { ?>
<a href="#" id="bookmarklink_request_<?=$RequestID?>" onclick="Bookmark('request', <?=$RequestID?>,'Remove bookmark');return false;" class="brackets">Bookmark</a>
<? } ?>
<a href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>" class="brackets">Report request</a>
<? if(!$IsFilled) { ?>
<? if (!$IsFilled) { ?>
<a href="upload.php?requestid=<?=$RequestID?><?= ($GroupID ? "&amp;groupid=$GroupID" : '') ?>" class="brackets">Upload request</a>
<? }
if(!$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))) { ?>
if (!$IsFilled && (($CategoryID == 0) || ($CategoryName == 'Music' && $Year == 0))) { ?>
<a href="reports.php?action=report&amp;type=request_update&amp;id=<?=$RequestID?>" class="brackets">Request update</a>
<? } ?>
@ -123,12 +123,12 @@
</div>
</div>
<div class="sidebar">
<? if($CategoryID != 0) { ?>
<? if ($CategoryID != 0) { ?>
<div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated -->
<div class="head"><strong>Cover</strong></div>
<?
if (!empty($Image)) {
if(check_perms('site_proxy_images')) {
if (check_perms('site_proxy_images')) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?>
@ -138,25 +138,25 @@
<? } ?>
</div>
<? }
if($CategoryName == "Music") { ?>
if ($CategoryName == 'Music') { ?>
<div class="box box_artists">
<div class="head"><strong>Artists</strong></div>
<ul class="stats nobullet">
<?
if(!empty($ArtistForm[4]) && count($ArtistForm[4]) > 0) {
if (!empty($ArtistForm[4]) && count($ArtistForm[4]) > 0) {
?>
<li class="artists_composer"><strong>Composers:</strong></li>
<? foreach($ArtistForm[4] as $Artist) {
<? foreach ($ArtistForm[4] as $Artist) {
?>
<li class="artists_composer">
<?=Artists::display_artist($Artist)?>
</li>
<? }
}
if(!empty($ArtistForm[6]) && count($ArtistForm[6]) > 0) {
if (!empty($ArtistForm[6]) && count($ArtistForm[6]) > 0) {
?>
<li class="artists_dj"><strong>DJ / Compiler:</strong></li>
<? foreach($ArtistForm[6] as $Artist) {
<? foreach ($ArtistForm[6] as $Artist) {
?>
<li class="artists_dj">
<?=Artists::display_artist($Artist)?>
@ -169,36 +169,36 @@
} elseif ((count($ArtistForm[4]) > 0) && (count($ArtistForm[1]) > 0)) {
print ' <li class="artists_main"><strong>Performers:</strong></li>';
}
foreach($ArtistForm[1] as $Artist) {
foreach ($ArtistForm[1] as $Artist) {
?>
<li class="artists_main">
<?=Artists::display_artist($Artist)?>
</li>
<? }
if(!empty($ArtistForm[2]) && count($ArtistForm[2]) > 0) {
if (!empty($ArtistForm[2]) && count($ArtistForm[2]) > 0) {
?>
<li class="artists_with"><strong>With:</strong></li>
<? foreach($ArtistForm[2] as $Artist) {
<? foreach ($ArtistForm[2] as $Artist) {
?>
<li class="artists_with">
<?=Artists::display_artist($Artist)?>
</li>
<? }
}
if(!empty($ArtistForm[5]) && count($ArtistForm[5]) > 0) {
if (!empty($ArtistForm[5]) && count($ArtistForm[5]) > 0) {
?>
<li class="artists_conductor"><strong>Conducted by:</strong></li>
<? foreach($ArtistForm[5] as $Artist) {
<? foreach ($ArtistForm[5] as $Artist) {
?>
<li class="artist_guest">
<?=Artists::display_artist($Artist)?>
</li>
<? }
}
if(!empty($ArtistForm[3]) && count($ArtistForm[3]) > 0) {
if (!empty($ArtistForm[3]) && count($ArtistForm[3]) > 0) {
?>
<li class="artists_remix"><strong>Remixed by:</strong></li>
<? foreach($ArtistForm[3] as $Artist) {
<? foreach ($ArtistForm[3] as $Artist) {
?>
<li class="artists_remix">
<?=Artists::display_artist($Artist)?>
@ -206,10 +206,10 @@
<?
}
}
if(!empty($ArtistForm[7]) && count($ArtistForm[7]) > 0) {
if (!empty($ArtistForm[7]) && count($ArtistForm[7]) > 0) {
?>
<li class="artists_producer"><strong>Produced by:</strong></li>
<? foreach($ArtistForm[7] as $Artist) {
<? foreach ($ArtistForm[7] as $Artist) {
?>
<li class="artists_remix">
<?=Artists::display_artist($Artist)?>
@ -224,7 +224,7 @@
<div class="box box_tags">
<div class="head"><strong>Tags</strong></div>
<ul class="stats nobullet">
<? foreach($Request['Tags'] as $TagID => $TagName) { ?>
<? foreach ($Request['Tags'] as $TagID => $TagName) { ?>
<li>
<a href="torrents.php?taglist=<?=$TagName?>"><?=display_str($TagName)?></a>
<br style="clear:both" />
@ -281,8 +281,8 @@
<?=time_diff($TimeAdded)?> by <strong><?=Users::format_username($RequestorID, false, false, false)?></strong>
</td>
</tr>
<? if($CategoryName == "Music") {
if(!empty($RecordLabel)) { ?>
<? if ($CategoryName == "Music") {
if (!empty($RecordLabel)) { ?>
<tr>
<td class="label">Record label</td>
<td>
@ -290,7 +290,7 @@
</td>
</tr>
<? }
if(!empty($CatalogueNumber)) { ?>
if (!empty($CatalogueNumber)) { ?>
<tr>
<td class="label">Catalogue number</td>
<td>
@ -322,7 +322,7 @@
<?=$MediaString?>
</td>
</tr>
<? if(!empty($LogCue)) { ?>
<? if (!empty($LogCue)) { ?>
<tr>
<td class="label">Required CD FLAC only extras</td>
<td>
@ -365,7 +365,7 @@
<td class="label">Votes</td>
<td>
<span id="votecount"><?=number_format($VoteCount)?></span>
<? if($CanVote) { ?>
<? if ($CanVote) { ?>
&nbsp;&nbsp;<a href="javascript:Vote(0)" class="brackets"><strong>+</strong></a>
<strong>Costs <?=Format::get_size($MinimumVote, 0)?></strong>
<? } ?>
@ -378,8 +378,8 @@
<?=time_diff($LastVote)?>
</td>
</tr>
<? } ?>
<? if($CanVote) { ?>
<? }
if ($CanVote) { ?>
<tr id="voting">
<td class="label" title="These units are in base 2, not base 10. For example, there are 1,024 MB in 1 GB.">Custom vote (MB)</td>
<td>
@ -419,7 +419,7 @@
<td id="formatted_bounty"><?=Format::get_size($RequestVotes['TotalBounty'])?></td>
</tr>
<?
if($IsFilled) {
if ($IsFilled) {
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
?>
<tr>
@ -427,7 +427,7 @@
<td>
<strong><a href="torrents.php?<?=(strtotime($TimeFilled)<$TimeCompare?'id=':'torrentid=').$TorrentID?>">Yes</a></strong>,
by user <?=Users::format_username($FillerID, false, false, false)?>
<? if($LoggedUser['ID'] == $RequestorID || $LoggedUser['ID'] == $FillerID || check_perms('site_moderate_requests')) { ?>
<? if ($LoggedUser['ID'] == $RequestorID || $LoggedUser['ID'] == $FillerID || check_perms('site_moderate_requests')) { ?>
<strong><a href="requests.php?action=unfill&amp;id=<?=$RequestID?>" class="brackets">Unfill</a></strong> Unfilling a request without a valid, nontrivial reason will result in a warning.
<? } ?>
</td>
@ -445,9 +445,10 @@
<strong>Should be the permalink (PL) to the torrent (e.g. https://<?=SSL_SITE_URL?>/torrents.php?torrentid=xxxx).</strong>
<br />
<br />
<? if(check_perms('site_moderate_requests')) { ?> For user: <input type="text" size="25" name="user" <?=(!empty($FillerUsername) ? "value='$FillerUsername' " : '')?>/>
<? if (check_perms('site_moderate_requests')) { ?>
For user: <input type="text" size="25" name="user"<?=(!empty($FillerUsername) ? " value=\"$FillerUsername\"" : '')?> />
<br />
<? } ?>
<? } ?>
<input type="submit" value="Fill request" />
<br />
</div>
@ -465,7 +466,7 @@
<?
$Results = $Cache->get_value('request_comments_'.$RequestID);
if($Results === false) {
if ($Results === false) {
$DB->query("SELECT
COUNT(c.ID)
FROM requests_comments as c
@ -474,7 +475,7 @@
$Cache->cache_value('request_comments_'.$RequestID, $Results, 0);
}
if(isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
$DB->query("SELECT COUNT(ID) FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
@ -490,7 +491,7 @@
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
if($Catalogue === false) {
if ($Catalogue === false) {
$DB->query("SELECT
c.ID,
c.AuthorID,
@ -520,20 +521,20 @@
<?
//---------- Begin printing
foreach($Thread as $Key => $Post) {
foreach ($Thread as $Key => $Post) {
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
?>
<table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : ''?>" id="post<?=$PostID?>">
<colgroup>
<? if(Users::has_avatars_enabled()) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<tr class="colhead_dark">
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
<div style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a>
<div style="float: left;"><a href="#post<?=$PostID?>">#<?=$PostID?></a>
by <strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a>
<? if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?>
@ -545,10 +546,10 @@
</div>
<div id="bar<?=$PostID?>" style="float:right;">
<a href="reports.php?action=report&amp;type=requests_comment&amp;id=<?=$PostID?>" class="brackets">Report</a>
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
$AuthorInfo = Users::user_info($AuthorID);
if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
?>
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
$AuthorInfo = Users::user_info($AuthorID);
if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
?>
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
<input type="hidden" name="action" value="warn" />
<input type="hidden" name="groupid" value="<?=$RequestID?>" />
@ -556,10 +557,10 @@
<input type="hidden" name="userid" value="<?=$AuthorID?>" />
<input type="hidden" name="key" value="<?=$Key?>" />
</form>
- <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;">[Warn]</a>
<? }
}
?>
- <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;" class="brackets">Warn</a>
<? }
}
?>
<a href="#">&uarr;</a>
</div>
</td>
@ -576,7 +577,7 @@
<? if ($EditedUserID) { ?>
<br />
<br />
<? if(check_perms('site_moderate_forums')) { ?>
<? if (check_perms('site_moderate_forums')) { ?>
<a href="#content<?=$PostID?>" onclick="LoadEdit('requests', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?>
Last edited by
@ -586,7 +587,7 @@
</td>
</tr>
</table>
<? } ?>
<? } ?>
<div class="linkbox">
<?=$Pages?>
</div>

View File

@ -13,9 +13,9 @@
$BookmarkView = false;
if(empty($_GET['type'])) {
if (empty($_GET['type'])) {
$Title = 'Requests';
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
if (!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
$SS->set_filter('visible', array(1));
}
} else {
@ -25,8 +25,8 @@
$SS->set_filter('userid', array($LoggedUser['ID']));
break;
case 'voted':
if(!empty($_GET['userid'])) {
if(is_number($_GET['userid'])) {
if (!empty($_GET['userid'])) {
if (is_number($_GET['userid'])) {
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); }
$Title = "Requests voted for by ".$UserInfo['Username'];
$SS->set_filter('voter', array($_GET['userid']));
@ -39,7 +39,7 @@
}
break;
case 'filled':
if(empty($_GET['userid']) || !is_number($_GET['userid'])) {
if (empty($_GET['userid']) || !is_number($_GET['userid'])) {
error(404);
} else {
if (!check_paranoia('requestsfilled_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) { error(403); }
@ -57,24 +57,24 @@
}
}
if($Submitted && empty($_GET['show_filled'])) {
if ($Submitted && empty($_GET['show_filled'])) {
$SS->set_filter('torrentid', array(0));
}
$EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator
if(!empty($_GET['formats'])) {
if (!empty($_GET['formats'])) {
$FormatArray = $_GET['formats'];
if(count($FormatArray) != count($Formats)) {
if (count($FormatArray) != count($Formats)) {
$FormatNameArray = array();
foreach($FormatArray as $Index => $MasterIndex) {
if(isset($Formats[$MasterIndex])) {
foreach ($FormatArray as $Index => $MasterIndex) {
if (isset($Formats[$MasterIndex])) {
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
}
}
if(count($FormatNameArray) >= 1) {
if (count($FormatNameArray) >= 1) {
$EnableNegation = true;
if(!empty($_GET['formats_strict'])) {
if (!empty($_GET['formats_strict'])) {
$Queries[]='@formatlist ('.implode(' | ', $FormatNameArray).')';
} else {
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
@ -83,19 +83,19 @@
}
}
if(!empty($_GET['media'])) {
if (!empty($_GET['media'])) {
$MediaArray = $_GET['media'];
if(count($MediaArray) != count($Media)) {
if (count($MediaArray) != count($Media)) {
$MediaNameArray = array();
foreach($MediaArray as $Index => $MasterIndex) {
if(isset($Media[$MasterIndex])) {
foreach ($MediaArray as $Index => $MasterIndex) {
if (isset($Media[$MasterIndex])) {
$MediaNameArray[$Index] = '"'.strtr($Media[$MasterIndex], '-.', ' ').'"';
}
}
if(count($MediaNameArray) >= 1) {
if (count($MediaNameArray) >= 1) {
$EnableNegation = true;
if(!empty($_GET['media_strict'])) {
if (!empty($_GET['media_strict'])) {
$Queries[]='@medialist ('.implode(' | ', $MediaNameArray).')';
} else {
$Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')';
@ -104,19 +104,19 @@
}
}
if(!empty($_GET['bitrates'])) {
if (!empty($_GET['bitrates'])) {
$BitrateArray = $_GET['bitrates'];
if(count($BitrateArray) != count($Bitrates)) {
if (count($BitrateArray) != count($Bitrates)) {
$BitrateNameArray = array();
foreach($BitrateArray as $Index => $MasterIndex) {
if(isset($Bitrates[$MasterIndex])) {
foreach ($BitrateArray as $Index => $MasterIndex) {
if (isset($Bitrates[$MasterIndex])) {
$BitrateNameArray[$Index] = '"'.strtr($SS->EscapeString($Bitrates[$MasterIndex]), '-.', ' ').'"';
}
}
if(count($BitrateNameArray) >= 1) {
if (count($BitrateNameArray) >= 1) {
$EnableNegation = true;
if(!empty($_GET['bitrate_strict'])) {
if (!empty($_GET['bitrate_strict'])) {
$Queries[]='@bitratelist ('.implode(' | ', $BitrateNameArray).')';
} else {
$Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
@ -125,63 +125,63 @@
}
}
if(!empty($_GET['search'])) {
if (!empty($_GET['search'])) {
$SearchString = trim($_GET['search']);
if($SearchString != '') {
if ($SearchString != '') {
$SearchWords = array('include' => array(), 'exclude' => array());
$Words = explode(' ', $SearchString);
foreach($Words as $Word) {
foreach ($Words as $Word) {
$Word = trim($Word);
// Skip isolated hyphens to enable "Artist - Title" searches
if ($Word == '-') {
continue;
}
if($Word[0] == '!' && strlen($Word) >= 2) {
if(strpos($Word,'!',1) === false) {
if ($Word[0] == '!' && strlen($Word) >= 2) {
if (strpos($Word,'!',1) === false) {
$SearchWords['exclude'][] = $Word;
} else {
$SearchWords['include'][] = $Word;
$EnableNegation = true;
}
} elseif($Word != '') {
} elseif ($Word != '') {
$SearchWords['include'][] = $Word;
$EnableNegation = true;
}
}
$QueryParts = array();
if(!$EnableNegation && !empty($SearchWords['exclude'])) {
if (!$EnableNegation && !empty($SearchWords['exclude'])) {
$SearchWords['include'] = array_merge($SearchWords['include'], $SearchWords['exclude']);
unset($SearchWords['exclude']);
}
foreach($SearchWords['include'] as $Word) {
foreach ($SearchWords['include'] as $Word) {
$QueryParts[] = $SS->EscapeString($Word);
}
if(!empty($SearchWords['exclude'])) {
foreach($SearchWords['exclude'] as $Word) {
if (!empty($SearchWords['exclude'])) {
foreach ($SearchWords['exclude'] as $Word) {
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
}
}
if(!empty($QueryParts)) {
if (!empty($QueryParts)) {
$Queries[] = "@* ".implode(' ', $QueryParts);
}
}
}
if(!empty($_GET['tags'])){
if (!empty($_GET['tags'])){
$Tags = explode(',', $_GET['tags']);
$TagNames = array();
if(!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
if (!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
$TagType = 1;
$_GET['tags_type'] = '1';
} else {
$TagType = 0;
$_GET['tags_type'] = '0';
}
foreach($Tags as $Tag) {
foreach ($Tags as $Tag) {
$Tag = ltrim($Tag);
$Exclude = ($Tag[0] == '!');
$Tag = Misc::sanitize_tag($Tag);
if(!empty($Tag)) {
if (!empty($Tag)) {
$TagNames[] = $Tag;
$TagsExclude[$Tag] = $Exclude;
}
@ -190,75 +190,75 @@
$Tags = Misc::get_tags($TagNames);
// Replace the ! characters that sanitize_tag removed
if($TagType == 1 || $AllNegative) {
foreach($TagNames as &$TagName) {
if($TagsExclude[$TagName]) {
if ($TagType == 1 || $AllNegative) {
foreach ($TagNames as &$TagName) {
if ($TagsExclude[$TagName]) {
$TagName = '!'.$TagName;
}
}
unset($TagName);
}
} elseif(!isset($_GET['tags_type']) || $_GET['tags_type'] != 0) {
} elseif (!isset($_GET['tags_type']) || $_GET['tags_type'] != 0) {
$_GET['tags_type'] = 1;
} else {
$_GET['tags_type'] = 0;
}
// 'All' tags
if($TagType == 1 && !empty($Tags)) {
foreach($Tags as $TagID => $TagName) {
if ($TagType == 1 && !empty($Tags)) {
foreach ($Tags as $TagID => $TagName) {
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
}
} elseif(!empty($Tags)) {
} elseif (!empty($Tags)) {
$SS->set_filter('tagid', array_keys($Tags), $AllNegative);
}
if(!empty($_GET['filter_cat'])) {
if (!empty($_GET['filter_cat'])) {
$CategoryArray = array_keys($_GET['filter_cat']);
$Debug->log_var(array($CategoryArray, $Categories));
if(count($CategoryArray) != count($Categories)) {
foreach($CategoryArray as $Key => $Index) {
if(!isset($Categories[$Index-1])) {
if (count($CategoryArray) != count($Categories)) {
foreach ($CategoryArray as $Key => $Index) {
if (!isset($Categories[$Index-1])) {
unset($CategoryArray[$Key]);
}
}
if(count($CategoryArray) >= 1) {
if (count($CategoryArray) >= 1) {
$SS->set_filter('categoryid', $CategoryArray);
}
}
}
if(!empty($_GET['releases'])) {
if (!empty($_GET['releases'])) {
$ReleaseArray = $_GET['releases'];
if(count($ReleaseArray) != count($ReleaseTypes)) {
foreach($ReleaseArray as $Index => $Value) {
if(!isset($ReleaseTypes[$Value])) {
if (count($ReleaseArray) != count($ReleaseTypes)) {
foreach ($ReleaseArray as $Index => $Value) {
if (!isset($ReleaseTypes[$Value])) {
unset($ReleaseArray[$Index]);
}
}
if(count($ReleaseArray) >= 1) {
if (count($ReleaseArray) >= 1) {
$SS->set_filter('releasetype', $ReleaseArray);
}
}
}
if(!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
if(is_number($_GET['requestor'])) {
if (!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
if (is_number($_GET['requestor'])) {
$SS->set_filter('userid', array($_GET['requestor']));
} else {
error(404);
}
}
if(isset($_GET['year'])) {
if(is_number($_GET['year']) || $_GET['year'] == 0) {
if (isset($_GET['year'])) {
if (is_number($_GET['year']) || $_GET['year'] == 0) {
$SS->set_filter('year', array($_GET['year']));
} else {
error(404);
}
}
if(!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
$Page = $_GET['page'];
$SS->limit(($Page - 1) * REQUESTS_PER_PAGE, REQUESTS_PER_PAGE);
} else {
@ -266,15 +266,15 @@
$SS->limit(0, REQUESTS_PER_PAGE);
}
if(empty($_GET['order'])) {
if (empty($_GET['order'])) {
$CurrentOrder = 'created';
$CurrentSort = 'desc';
$Way = SPH_SORT_ATTR_DESC;
$NewSort = 'asc';
} else {
if(in_array($_GET['order'], $OrderWays)) {
if (in_array($_GET['order'], $OrderWays)) {
$CurrentOrder = $_GET['order'];
if($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
$CurrentSort = $_GET['sort'];
$Way = ($CurrentSort == 'asc' ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC);
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
@ -312,7 +312,7 @@
//print($Way); print($OrderBy); die();
$SS->SetSortMode($Way, $OrderBy);
if(count($Queries) > 0) {
if (count($Queries) > 0) {
$Query = implode(' ',$Queries);
} else {
$Query='';
@ -321,7 +321,7 @@
$SS->set_index('requests requests_delta');
$SphinxResults = $SS->search($Query, '', 0, array(), '', '');
$NumResults = $SS->TotalResults;
if($NumResults && $NumResults < ($Page - 1) * REQUESTS_PER_PAGE + 1) {
if ($NumResults && $NumResults < ($Page - 1) * REQUESTS_PER_PAGE + 1) {
$PageLinks = Format::get_pages(0, $NumResults, REQUESTS_PER_PAGE);
} else {
$PageLinks = Format::get_pages($Page, $NumResults, REQUESTS_PER_PAGE);
@ -360,35 +360,35 @@
<input type="hidden" name="type" value="<?=$_GET['type']?>" />
<? } ?>
<input type="hidden" name="submit" value="true" />
<? if(!empty($_GET['userid']) && is_number($_GET['userid'])) { ?>
<? if (!empty($_GET['userid']) && is_number($_GET['userid'])) { ?>
<input type="hidden" name="userid" value="<?=$_GET['userid']?>" />
<? } ?>
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
<tr id="search_terms">
<td class="label">Search terms:</td>
<td>
<input type="text" name="search" size="75" value="<?if(isset($_GET['search'])) { echo display_str($_GET['search']); } ?>" />
<input type="text" name="search" size="75" value="<? if (isset($_GET['search'])) { echo display_str($_GET['search']); } ?>" />
</td>
</tr>
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td>
<input type="text" name="tags" size="60" value="<?= (!empty($TagNames) ? display_str(implode(', ', $TagNames)) : '') ?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0" <?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1" <?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
<input type="radio" name="tags_type" id="tags_type0" value="0" <? Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1" <? Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td>
</tr>
<tr id="include_filled">
<td class="label">Include filled:</td>
<td>
<input type="checkbox" name="show_filled" <? if(!$Submitted || !empty($_GET['show_filled']) || (!$Submitted && !empty($_GET['type']) && $_GET['type'] == "filled")) { ?>checked="checked"<? } ?> />
<input type="checkbox" name="show_filled"<? if (!$Submitted || !empty($_GET['show_filled']) || (!$Submitted && !empty($_GET['type']) && $_GET['type'] == 'filled')) { ?> checked="checked"<? } ?> />
</td>
</tr>
<? if(check_perms('site_see_old_requests')){ ?>
<? if (check_perms('site_see_old_requests')){ ?>
<tr id="include_old">
<td class="label">Include old:</td>
<td>
<input type="checkbox" name="showall" <? if(!empty($_GET['showall'])) {?>checked="checked"<? } ?> />
<input type="checkbox" name="showall"<? if (!empty($_GET['showall'])) { ?> checked="checked"<? } ?> />
</td>
</tr>
<? /* ?>
@ -402,19 +402,19 @@
</table>
<table class="layout cat_list">
<?
$x=1;
$x = 1;
reset($Categories);
foreach($Categories as $CatKey => $CatName) {
if($x%8==0 || $x==1) {
foreach ($Categories as $CatKey => $CatName) {
if ($x % 8 == 0 || $x == 1) {
?>
<tr class="cat_list">
<? } ?>
<td>
<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1" <? if(isset($_GET['filter_cat'][$CatKey+1])) { ?>checked="checked"<? } ?> />
<label for="cat_<?=($CatKey+1)?>"><?=$CatName?></label>
<input type="checkbox" name="filter_cat[<?=($CatKey + 1) ?>]" id="cat_<?=($CatKey + 1) ?>" value="1"<? if (isset($_GET['filter_cat'][$CatKey + 1])) { ?> checked="checked"<? } ?> />
<label for="cat_<?=($CatKey + 1) ?>"><?=$CatName?></label>
</td>
<?
if($x%7==0) {
if ($x % 7 == 0) {
?>
</tr>
<?
@ -427,30 +427,34 @@
<tr id="release_list">
<td class="label">Release types</td>
<td>
<input type="checkbox" id="toggle_releases" onchange="Toggle('releases', 0)" <?=(!$Submitted || !empty($ReleaseArray) && count($ReleaseArray) == count($ReleaseTypes) ? ' checked="checked"' : '')?>/> <label for="toggle_releases">All</label>
<input type="checkbox" id="toggle_releases" onchange="Toggle('releases', 0)"<?=(!$Submitted || !empty($ReleaseArray) && count($ReleaseArray) == count($ReleaseTypes) ? ' checked="checked"' : '') ?> /> <label for="toggle_releases">All</label>
<? $i = 0;
foreach ($ReleaseTypes as $Key => $Val) {
if($i % 8 == 0) echo "<br />";?>
if ($i % 8 == 0) {
echo '<br />';
} ?>
<input type="checkbox" name="releases[]" value="<?=$Key?>" id="release_<?=$Key?>"
<?=(((!$Submitted) || !empty($ReleaseArray) && in_array($Key, $ReleaseArray)) ? ' checked="checked" ' : '')?>
/> <label for="release_<?=$Key?>"><?=$Val?></label>
<? $i++;
}?>
} ?>
</td>
</tr>
<tr id="format_list">
<td class="label">Formats</td>
<td>
<input type="checkbox" id="toggle_formats" onchange="Toggle('formats', 0);" <?=(!$Submitted || !empty($FormatArray) && count($FormatArray) == count($Formats) ? ' checked="checked"' : '')?>/>
<input type="checkbox" id="toggle_formats" onchange="Toggle('formats', 0);"<?=(!$Submitted || !empty($FormatArray) && count($FormatArray) == count($Formats) ? ' checked="checked"' : '') ?> />
<label for="toggle_formats">All</label>
<input type="checkbox" id="formats_strict" name="formats_strict"<?=(!empty($_GET['formats_strict']) ? ' checked="checked"' : '')?> />
<label for="formats_strict">Only specified</label>
<? foreach ($Formats as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) {
echo '<br />';
} ?>
<input type="checkbox" name="formats[]" value="<?=$Key?>" id="format_<?=$Key?>"
<?=(((!$Submitted) || !empty($FormatArray) && in_array($Key, $FormatArray)) ? ' checked="checked" ' : '')?>
/> <label for="format_<?=$Key?>"><?=$Val?></label>
<? }?>
<? } ?>
</td>
</tr>
<tr id="bitrate_list">
@ -458,14 +462,16 @@
<td>
<input type="checkbox" id="toggle_bitrates" onchange="Toggle('bitrates', 0);"<?=(!$Submitted || !empty($BitrateArray) && count($BitrateArray) == count($Bitrates) ? ' checked="checked"' : '')?> />
<label for="toggle_bitrates">All</label>
<input type="checkbox" id="bitrate_strict" name="bitrate_strict"<?=(!empty($_GET['bitrate_strict']) ? ' checked="checked"' : '')?>/>
<input type="checkbox" id="bitrate_strict" name="bitrate_strict"<?=(!empty($_GET['bitrate_strict']) ? ' checked="checked"' : '') ?> />
<label for="bitrate_strict">Only specified</label>
<? foreach ($Bitrates as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) {
echo '<br />';
} ?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
<?=(((!$Submitted) || !empty($BitrateArray) && in_array($Key, $BitrateArray)) ? ' checked="checked" ' : '')?>
/> <label for="bitrate_<?=$Key?>"><?=$Val?></label>
<? }?>
<? } ?>
</td>
</tr>
<tr id="media_list">
@ -476,11 +482,13 @@
<input type="checkbox" id="media_strict" name="media_strict"<?=(!empty($_GET['media_strict']) ? ' checked="checked"' : '')?> />
<label for="media_strict">Only specified</label>
<? foreach ($Media as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) {
echo '<br />';
} ?>
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
<?=(((!$Submitted) || !empty($MediaArray) && in_array($Key, $MediaArray)) ? ' checked="checked" ' : '')?>
/> <label for="media_<?=$Key?>"><?=$Val?></label>
<? }?>
<? } ?>
</td>
</tr>
<tr>
@ -491,7 +499,7 @@
</table>
</form>
<? if($NumResults) { ?>
<? if ($NumResults) { ?>
<div class="linkbox">
<?=$PageLinks?>
</div>
@ -523,13 +531,13 @@
<a href="?order=lastvote&amp;sort=<?=(($CurrentOrder == 'lastvote') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
</td>
</tr>
<? if($NumResults == 0) { ?>
<? if ($NumResults == 0) { ?>
<tr class="rowb">
<td colspan="8">
Nothing found!
</td>
</tr>
<? } elseif($NumResults < ($Page - 1) * REQUESTS_PER_PAGE + 1) { ?>
<? } elseif ($NumResults < ($Page - 1) * REQUESTS_PER_PAGE + 1) { ?>
<tr class="rowb">
<td colspan="8">
The requested page contains no matches!
@ -538,19 +546,19 @@
<? } else {
//We don't use sphinxapi's default cache searcher, we use our own functions
if(!empty($SphinxResults['notfound'])) {
if (!empty($SphinxResults['notfound'])) {
$SQLResults = Requests::get_requests($SphinxResults['notfound']);
if(is_array($SQLResults['notfound'])) {
if (is_array($SQLResults['notfound'])) {
//Something wasn't found in the db, remove it from results
reset($SQLResults['notfound']);
foreach($SQLResults['notfound'] as $ID) {
foreach ($SQLResults['notfound'] as $ID) {
unset($SQLResults['matches'][$ID]);
unset($SphinxResults['matches'][$ID]);
}
}
// Merge SQL results with memcached results
foreach($SQLResults['matches'] as $ID => $SQLResult) {
foreach ($SQLResults['matches'] as $ID => $SQLResult) {
$SphinxResults['matches'][$ID] = $SQLResult;
//$Requests['matches'][$ID] = array_merge($Requests['matches'][$ID], $SQLResult);
@ -576,22 +584,22 @@
$VoteCount = count($RequestVotes['Voters']);
if($CategoryID == 0) {
$CategoryName = "Unknown";
if ($CategoryID == 0) {
$CategoryName = 'Unknown';
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
$IsFilled = ($TorrentID != 0);
if($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = "<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>";
} else {
$FullName ="<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title."</a>";
$FullName ="<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title</a>";
}
$Row = ($Row == 'a') ? 'b' : 'a';
@ -604,8 +612,8 @@
<div class="tags">
<?
$TagList = array();
foreach($Tags as $TagID => $TagName) {
$TagList[] = "<a href='?tags=".$TagName.($BookmarkView ? "&amp;type=requests" : "")."'>".display_str($TagName)."</a>";
foreach ($Tags as $TagID => $TagName) {
$TagList[] = '<a href="?tags='.$TagName.($BookmarkView ? '&amp;type=requests' : '').'\">'.display_str($TagName).'</a>';
}
$TagList = implode(', ', $TagList);
?>
@ -614,7 +622,7 @@
</td>
<td class="nobr">
<span id="vote_count_<?=$RequestID?>"><?=number_format($VoteCount)?></span>
<? if(!$IsFilled && check_perms('site_vote')){ ?>
<? if (!$IsFilled && check_perms('site_vote')) { ?>
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
<? } ?>
</td>
@ -622,14 +630,14 @@
<?=Format::get_size($RequestVotes['TotalBounty'])?>
</td>
<td>
<? if($IsFilled){ ?>
<a href="torrents.php?<?=(strtotime($TimeFilled)<$TimeCompare?'id=':'torrentid=').$TorrentID?>"><strong><?=time_diff($TimeFilled)?></strong></a>
<? if ($IsFilled) { ?>
<a href="torrents.php?<?=(strtotime($TimeFilled) < $TimeCompare ? 'id=' : 'torrentid=').$TorrentID?>"><strong><?=time_diff($TimeFilled)?></strong></a>
<? } else { ?>
<strong>No</strong>
<? } ?>
</td>
<td>
<? if($IsFilled){ ?>
<? if ($IsFilled) { ?>
<a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a>
<? } else { ?>
--

View File

@ -423,7 +423,7 @@ foreach($Categories as $CatKey => $CatName) {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
} elseif($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = "<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else {
$FullName ="<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title."</a>";

View File

@ -3,34 +3,34 @@
//--------------- Fill a request -----------------------------------------------//
$RequestID = $_REQUEST['requestid'];
if(!is_number($RequestID)) {
if (!is_number($RequestID)) {
error(0);
}
authorize();
//VALIDATION
if(!empty($_GET['torrentid']) && is_number($_GET['torrentid'])) {
if (!empty($_GET['torrentid']) && is_number($_GET['torrentid'])) {
$TorrentID = $_GET['torrentid'];
} else {
if(empty($_POST['link'])) {
if (empty($_POST['link'])) {
$Err = "You forgot to supply a link to the filling torrent";
} else {
$Link = $_POST['link'];
if(preg_match("/".TORRENT_REGEX."/i", $Link, $Matches) < 1) {
if (preg_match("/".TORRENT_REGEX."/i", $Link, $Matches) < 1) {
$Err = "Your link didn't seem to be a valid torrent link";
} else {
$TorrentID = $Matches[0];
}
}
if(!empty($Err)) {
if (!empty($Err)) {
error($Err);
}
preg_match("/torrentid=([0-9]+)/i", $Link, $Matches);
$TorrentID = $Matches[1];
if(!$TorrentID || !is_number($TorrentID)) {
if (!$TorrentID || !is_number($TorrentID)) {
error(404);
}
}
@ -53,7 +53,7 @@
LIMIT 1");
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($UploaderID, $UploadTime, $TorrentReleaseType, $Bitrate, $Format, $Media, $HasLog, $HasCue, $LogScore, $TorrentCategoryID, $TorrentCatalogueNumber) = $DB->next_record();
@ -61,17 +61,17 @@
$FillerID = $LoggedUser['ID'];
$FillerUsername = $LoggedUser['Username'];
if(!empty($_POST['user']) && check_perms('site_moderate_requests')) {
if (!empty($_POST['user']) && check_perms('site_moderate_requests')) {
$FillerUsername = $_POST['user'];
$DB->query("SELECT ID FROM users_main WHERE Username LIKE '".db_string($FillerUsername)."'");
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
$Err = "No such user to fill for!";
} else {
list($FillerID) = $DB->next_record();
}
}
if(time_ago($UploadTime) < 3600 && $UploaderID != $FillerID && !check_perms('site_moderate_requests')) {
if (time_ago($UploadTime) < 3600 && $UploaderID != $FillerID && !check_perms('site_moderate_requests')) {
$Err = "There is a one hour grace period for new uploads to allow the torrent's uploader to fill the request.";
}
@ -93,70 +93,70 @@
list($Title, $RequesterID, $OldTorrentID, $RequestCategoryID, $RequestReleaseType, $RequestCatalogueNumber, $BitrateList, $FormatList, $MediaList, $LogCue) = $DB->next_record();
if(!empty($OldTorrentID)) {
$Err = "This request has already been filled.";
if (!empty($OldTorrentID)) {
$Err = 'This request has already been filled.';
}
if($RequestCategoryID != 0 && $TorrentCategoryID != $RequestCategoryID) {
$Err = "This torrent is of a different category than the request. If the request is actually miscategorized, please contact staff.";
if ($RequestCategoryID != 0 && $TorrentCategoryID != $RequestCategoryID) {
$Err = 'This torrent is of a different category than the request. If the request is actually miscategorized, please contact staff.';
}
$CategoryName = $Categories[$RequestCategoryID - 1];
if($CategoryName == "Music") {
if ($CategoryName == 'Music') {
//Commenting out as it's causing some issues with some users being unable to fill, unsure what it is, etc
/*if($RequestCatalogueNumber) {
if($TorrentCatalogueNumber != $RequestCatalogueNumber) {
$Err = "This request requires the catalogue number ".$RequestCatalogueNumber;
/*if ($RequestCatalogueNumber) {
if ($TorrentCatalogueNumber != $RequestCatalogueNumber) {
$Err = "This request requires the catalogue number $RequestCatalogueNumber";
}
}*/
//WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD
//$WEBOverride = ((strpos($MediaList, "WEB") !== false) && $Media == "WEB");
//$VinylOverride = ((strpos($MediaList, "Vinyl") !== false) && $Media == "Vinyl");
//if($Format == "FLAC" && $LogCue && !$WEBOverride && !$VinylOverride) {
if($Format == "FLAC" && $LogCue && $Media == 'CD') {
if(strpos($LogCue, "Log") && !$HasLog) {
$Err = "This request requires a log.";
//$WEBOverride = ((strpos($MediaList, 'WEB') !== false) && $Media == "WEB");
//$VinylOverride = ((strpos($MediaList, 'Vinyl') !== false) && $Media == "Vinyl");
//if ($Format == 'FLAC' && $LogCue && !$WEBOverride && !$VinylOverride) {
if ($Format == 'FLAC' && $LogCue && $Media == 'CD') {
if (strpos($LogCue, 'Log') && !$HasLog) {
$Err = 'This request requires a log.';
}
/*
* Removed due to rule 2.2.15.6 rendering some requests unfillable
*/
//if(strpos($LogCue, "Cue") && !$HasCue) {
//if (strpos($LogCue, "Cue") && !$HasCue) {
// $Err = "This request requires a cue.";
//}
if(strpos($LogCue, "%")) {
preg_match("/\d+/", $LogCue, $Matches);
if((int) $LogScore < (int) $Matches[0]) {
$Err = "This torrent's log score is too low.";
if (strpos($LogCue, '%')) {
preg_match('/\d+/', $LogCue, $Matches);
if ((int) $LogScore < (int) $Matches[0]) {
$Err = 'This torrent\'s log score is too low.';
}
}
}
if ($BitrateList === "Other") {
if ($Bitrate === "Lossless" || $Bitrate === "APS (VBR)" || $Bitrate === "V2 (VBR)" || $Bitrate === "V1 (VBR)" || $Bitrate === "256" || $Bitrate === "APX (VBR)" || $Bitrate === "V0 (VBR)" || $Bitrate === "q8.x (VBR)" || $Bitrate === "320" || $Bitrate === "24bit Lossless")
$Err = $Bitrate." is not an allowed bitrate for this request.";
} else if($BitrateList && $BitrateList != "Any") {
if(strpos($BitrateList, $Bitrate) === false) {
$Err = $Bitrate." is not an allowed bitrate for this request.";
if ($BitrateList === 'Other') {
if ($Bitrate === 'Lossless' || $Bitrate === 'APS (VBR)' || $Bitrate === 'V2 (VBR)' || $Bitrate === 'V1 (VBR)' || $Bitrate === '256' || $Bitrate === 'APX (VBR)' || $Bitrate === 'V0 (VBR)' || $Bitrate === 'q8.x (VBR)' || $Bitrate === '320' || $Bitrate === '24bit Lossless')
$Err = "$Bitrate is not an allowed bitrate for this request.";
} elseif ($BitrateList && $BitrateList != 'Any') {
if (strpos($BitrateList, $Bitrate) === false) {
$Err = "$Bitrate is not an allowed bitrate for this request.";
}
}
if($FormatList && $FormatList != "Any") {
if(strpos($FormatList, $Format) === false) {
$Err = $Format." is not an allowed format for this request.";
if ($FormatList && $FormatList != "Any") {
if (strpos($FormatList, $Format) === false) {
$Err = "$Format is not an allowed format for this request.";
}
}
if($MediaList && $MediaList != "Any") {
if(strpos($MediaList, $Media) === false) {
$Err = $Media." is not allowed media for this request.";
if ($MediaList && $MediaList != "Any") {
if (strpos($MediaList, $Media) === false) {
$Err = "$Media is not allowed media for this request.";
}
}
}
// Fill request
if(!empty($Err)) {
if (!empty($Err)) {
error($Err);
}
@ -164,12 +164,12 @@
//We're all good! Fill!
$DB->query("UPDATE requests SET
FillerID = ".$FillerID.",
TorrentID = ".$TorrentID.",
FillerID = $FillerID,
TorrentID = $TorrentID,
TimeFilled = '".sqltime()."'
WHERE ID = ".$RequestID);
WHERE ID = $RequestID");
if($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$FullName = $ArtistName.$Title;
@ -177,20 +177,20 @@
$FullName = $Title;
}
$DB->query("SELECT UserID FROM requests_votes WHERE RequestID = ".$RequestID);
$DB->query("SELECT UserID FROM requests_votes WHERE RequestID = $RequestID");
$UserIDs = $DB->to_array();
foreach ($UserIDs as $User) {
list($VoterID) = $User;
Misc::send_pm($VoterID, 0, "The request '".$FullName."' has been filled", "One of your requests - [url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."]".$FullName."[/url] - has been filled. You can view it at [url]https://".SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."[/url]");
Misc::send_pm($VoterID, 0, "The request \"$FullName\" has been filled", 'One of your requests &mdash; [url=https://'.SSL_SITE_URL.'/requests.php?action=view&amp;id='.$RequestID.']'.$FullName.'[/url] &mdash; has been filled. You can view it here: [url]https://'.SSL_SITE_URL.'/torrents.php?torrentid='.$TorrentID.'[/url]');
}
$RequestVotes = get_votes_array($RequestID);
Misc::write_log("Request ".$RequestID." (".$FullName.") was filled by user ".$FillerID." (".$FillerUsername.") with the torrent ".$TorrentID.", for a ".Format::get_size($RequestVotes['TotalBounty'])." bounty.");
Misc::write_log("Request $RequestID (".$FullName.") was filled by user $FillerID (".$FillerUsername.") with the torrent $TorrentID for a ".Format::get_size($RequestVotes['TotalBounty']).' bounty.');
// Give bounty
$DB->query("UPDATE users_main
SET Uploaded = (Uploaded + ".$RequestVotes['TotalBounty'].")
WHERE ID = ".$FillerID);
WHERE ID = $FillerID");
@ -202,10 +202,10 @@
$DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID);
$DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = $RequestID");
$ArtistIDs = $DB->to_array();
foreach($ArtistIDs as $ArtistID) {
$Cache->delete_value('artists_requests_'.$ArtistID);
foreach ($ArtistIDs as $ArtistID) {
$Cache->delete_value("artists_requests_$ArtistID");
}
$SS->UpdateAttributes('requests', array('torrentid','fillerid'), array($RequestID => array((int)$TorrentID,(int)$FillerID)));

View File

@ -1,16 +1,18 @@
<?
if(!check_perms('users_view_invites')) { error(403); }
if (!check_perms('users_view_invites')) {
error(403);
}
View::show_header('Invite Pool');
define('INVITES_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(INVITES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(INVITES_PER_PAGE);
if(!empty($_POST['invitekey']) && check_perms('users_edit_invites')) {
if (!empty($_POST['invitekey']) && check_perms('users_edit_invites')) {
authorize();
$DB->query("DELETE FROM invites WHERE InviteKey='".db_string($_POST['invitekey'])."'");
}
if(!empty($_GET['search'])) {
if (!empty($_GET['search'])) {
$Search = db_string($_GET['search']);
} else {
$Search = "";
@ -19,12 +21,13 @@
$sql = "SELECT
SQL_CALC_FOUND_ROWS
um.ID,
um.IP,
i.InviteKey,
i.Expires,
i.Email
FROM invites as i
JOIN users_main AS um ON um.ID=i.InviterID ";
if($Search) {
JOIN users_main AS um ON um.ID = i.InviterID ";
if ($Search) {
$sql .= "WHERE i.Email LIKE '%$Search%' ";
}
$sql .= "ORDER BY i.Expires DESC LIMIT $Limit";
@ -36,7 +39,7 @@
$DB->set_query_id($RS);
?>
<div class="box pad">
<p><?=number_format($Results)?> unused invites have been sent. </p>
<p><?=number_format($Results)?> unused invites have been sent.</p>
</div>
<br />
<div>
@ -56,7 +59,7 @@
</div>
<div class="linkbox">
<?
$Pages=Format::get_pages($Page,$Results,INVITES_PER_PAGE,11) ;
$Pages = Format::get_pages($Page, $Results, INVITES_PER_PAGE, 11) ;
echo $Pages;
?>
</div>
@ -64,6 +67,7 @@
<tr class="colhead">
<td>Inviter</td>
<td>Email</td>
<td>IP</td>
<td>InviteCode</td>
<td>Expires</td>
<? if(check_perms('users_edit_invites')){ ?>
@ -72,15 +76,16 @@
</tr>
<?
$Row = 'b';
while(list($UserID, $InviteKey, $Expires, $Email)=$DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
while (list($UserID, $IP, $InviteKey, $Expires, $Email) = $DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?></td>
<td><?=display_str($Email)?></td>
<td><?=Tools::display_ip($IP)?></td>
<td><?=display_str($InviteKey)?></td>
<td><?=time_diff($Expires)?></td>
<? if(check_perms('users_edit_invites')){ ?>
<? if (check_perms('users_edit_invites')) { ?>
<td>
<form class="delete_form" name="invite" action="" method="post">
<input type="hidden" name="action" value="invite_pool" />
@ -89,7 +94,7 @@
<input type="submit" value="Delete" />
</form>
</td>
<? } ?>
<? } ?>
</tr>
<? } ?>
</table>

View File

@ -135,7 +135,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$OrderBy = $_GET['order_by'];
}
if(!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
if (!empty($_GET['order_way']) && $_GET['order_way'] == 'asc') {
$OrderWay = 'asc';
} else {
$_GET['order_way'] = 'desc';
@ -164,7 +164,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$SphQL->select('id, groupid, categoryid')
->order_by('RAND()', '');
$Random = true;
} else if ($GroupResults) {
} elseif ($GroupResults) {
$OrderProperties = $SortOrders[$OrderBy];
$SphQL->select('groupid, categoryid' . (isset($AggregateExp[$OrderProperties[0]]) ? ', '.$AggregateExp[$OrderProperties[0]] : ''))
->group_by('groupid')
@ -1053,7 +1053,7 @@ function header_link($SortKey,$DefaultWay="desc") {
if ($GroupYear) {
$DisplayName .= " [".$GroupYear."]";
}
if($CategoryID == 1 && $ReleaseType > 0) {
if ($CategoryID == 1 && $ReleaseType > 0) {
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
}
$ExtraInfo = Torrents::torrent_info($Data, true, true);

View File

@ -1,12 +1,14 @@
<?
$TorrentID = $_GET['torrentid'];
if (!$TorrentID || !is_number($TorrentID)) { error(404); }
if (!$TorrentID || !is_number($TorrentID)) {
error(404);
}
$DB->query("SELECT t.UserID, t.Time, COUNT(x.uid) FROM torrents AS t LEFT JOIN xbt_snatched AS x ON x.fid=t.ID WHERE t.ID=".$TorrentID." GROUP BY t.UserID");
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error('Torrent already deleted.');
}
@ -15,19 +17,19 @@
list($UserID, $Time, $Snatches) = $DB->next_record();
if ($LoggedUser['ID']!=$UserID && !check_perms('torrents_delete')) {
if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_delete')) {
error(403);
}
if(isset($_SESSION['logged_user']['multi_delete']) && $_SESSION['logged_user']['multi_delete']>=3 && !check_perms('torrents_delete_fast')) {
if (isset($_SESSION['logged_user']['multi_delete']) && $_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) {
error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.');
}
if(time_ago($Time) > 3600*24*7 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
if (time_ago($Time) > 3600 * 24 * 7 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
error('You can no longer delete this torrent as it has been uploaded for over a week with no problems. If you now think there is a problem, please report it instead.');
}
if($Snatches > 4 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
if ($Snatches > 4 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
error('You can no longer delete this torrent as it has been snatched by 5 or more users. If you believe there is a problem with the torrent please report it instead.');
}
@ -61,7 +63,7 @@
</div>
</div>
<?
if(check_perms('admin_reports')) {
if (check_perms('admin_reports')) {
?>
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto">
<?
@ -103,7 +105,7 @@
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID=".$TorrentID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
die();
}
list($GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
@ -113,7 +115,7 @@
if (array_key_exists($Type, $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$Type];
} else if(array_key_exists($Type,$Types['master'])) {
} elseif (array_key_exists($Type,$Types['master'])) {
$ReportType = $Types['master'][$Type];
} else {
//There was a type but it wasn't an option!
@ -159,60 +161,60 @@
<tr>
<td class="label">Torrent:</td>
<td colspan="3">
<? if(!$GroupID) { ?>
<? if (!$GroupID) { ?>
<a href="log.php?search=Torrent+<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)
<? } else {?>
<? } else { ?>
<?=$LinkName?>
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="brackets" title="Download">DL</a>
uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
<br />
<? $DB->query("SELECT r.ID
<? $DB->query("SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
AND t.GroupID=$GroupID");
$GroupOthers = ($DB->record_count());
if($GroupOthers > 0) { ?>
if ($GroupOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers reports" : "is 1 other report")?> for torrent(s) in this group</a>
</div>
<? }
<? }
$DB->query("SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
AND t.UserID=$UploaderID");
$UploaderOthers = ($DB->record_count());
if($UploaderOthers > 0) { ?>
if ($UploaderOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=uploader&amp;id=<?=$UploaderID?>">There <?=(($UploaderOthers > 1) ? "are $UploaderOthers reports" : "is 1 other report")?> for torrent(s) uploaded by this user</a>
</div>
<? }
<? }
$DB->query("SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
req.FillerID,
um.Username,
req.TimeFilled
FROM requests AS req
JOIN users_main AS um ON um.ID=req.FillerID
JOIN users_main AS um ON um.ID=req.FillerID
AND req.TorrentID=$TorrentID");
$Requests = ($DB->record_count());
if($Requests > 0) {
if ($Requests > 0) {
while(list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
?>
<div style="text-align: right;">
<a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=viewrequest&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?>
</div>
<? }
<? }
}
}
?>
</td>
</tr>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
<tr>
<td class="label">
<a href="javascript:Load('<?=$ReportID?>')">Resolve</a>
@ -227,27 +229,29 @@
}
array_multisort($Priorities, SORT_ASC, $TypeList);
foreach($TypeList as $IType => $Data) {
foreach ($TypeList as $IType => $Data) {
?>
<option value="<?=$IType?>"<?=(($Type == $IType) ? ' selected="selected"' : '') ?>><?=$Data['title']?></option>
<?
}
?>
<option value="<?=$IType?>"<?=(($Type == $IType)?' selected="selected"':'')?>><?=$Data['title']?></option>
<? } ?>
</select>
<span id="options<?=$ReportID?>">
<span title="Delete torrent?">
<strong>Delete</strong>
<input type="checkbox" name="delete" id="delete<?=$ReportID?>"<?=($ReportType['resolve_options']['delete']?' checked="checked"':'')?> />
<input type="checkbox" name="delete" id="delete<?=$ReportID?>"<?=($ReportType['resolve_options']['delete'] ? ' checked="checked"' : '')?> />
</span>
<span title="Warning length in weeks">
<strong>Warning</strong>
<select name="warning" id="warning<?=$ReportID?>">
<? for($i = 0; $i < 9; $i++) { ?>
<option value="<?=$i?>"<?=(($ReportType['resolve_options']['warn'] == $i)?' selected="selected"':'')?>><?=$i?></option>
<? } ?>
<? for($i = 0; $i < 9; $i++) { ?>
<option value="<?=$i?>"<?=(($ReportType['resolve_options']['warn'] == $i) ? ' selected="selected"' : '')?>><?=$i?></option>
<? } ?>
</select>
</span>
<span title="Remove upload privileges?">
<strong>Upload</strong>
<input type="checkbox" name="upload" id="upload<?=$ReportID?>"<?=($ReportType['resolve_options']['upload']?' checked="checked"':'')?> />
<input type="checkbox" name="upload" id="upload<?=$ReportID?>"<?=($ReportType['resolve_options']['upload'] ? ' checked="checked"' : '')?> />
</span>
</span>
</td>

View File

@ -36,14 +36,14 @@
$Properties['CategoryName'] = $Type;
$Properties['Title'] = $_POST['title'];
$Properties['Remastered'] = (isset($_POST['remaster'])) ? 1 : 0;
if($Properties['Remastered'] || isset($_POST['unknown'])) {
if ($Properties['Remastered'] || isset($_POST['unknown'])) {
$Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
$Properties['RemasterYear'] = $_POST['remaster_year'];
$Properties['RemasterTitle'] = $_POST['remaster_title'];
$Properties['RemasterRecordLabel'] = $_POST['remaster_record_label'];
$Properties['RemasterCatalogueNumber'] = $_POST['remaster_catalogue_number'];
}
if(!$Properties['Remastered'] || $Properties['UnknownRelease']) {
if (!$Properties['Remastered'] || $Properties['UnknownRelease']) {
$Properties['UnknownRelease'] = 1;
$Properties['RemasterYear'] = '';
$Properties['RemasterTitle'] = '';
@ -70,13 +70,13 @@
$Properties['VanityHouse'] = 0;
}
$Properties['TorrentDescription'] = $_POST['release_desc'];
if($_POST['album_desc']) {
if ($_POST['album_desc']) {
$Properties['GroupDescription'] = trim($_POST['album_desc']);
} elseif($_POST['desc']){
} elseif ($_POST['desc']){
$Properties['GroupDescription'] = trim($_POST['desc']);
}
$Properties['GroupID'] = $_POST['groupid'];
if(empty($_POST['artists'])) {
if (empty($_POST['artists'])) {
$Err = "You didn't enter any artists";
} else {
$Artists = $_POST['artists'];
@ -89,7 +89,7 @@
$Validate->SetFields('type','1','inarray','Please select a valid type.',array('inarray'=>array_keys($Categories)));
switch ($Type) {
case 'Music':
if(!$_POST['groupid']) {
if (!$_POST['groupid']) {
$Validate->SetFields('title',
'1','string','Title must be between 1 and 200 characters.',array('maxlength'=>200, 'minlength'=>1));
@ -116,7 +116,7 @@
}
}
if($Properties['Remastered'] && !$Properties['UnknownRelease']){
if ($Properties['Remastered'] && !$Properties['UnknownRelease']){
$Validate->SetFields('remaster_year',
'1','number','Year of remaster/re-issue must be entered.');
} else {
@ -144,7 +144,7 @@
'1','inarray','Please select a valid format.',array('inarray'=>$Formats));
// Handle 'other' bitrates
if($Properties['Encoding'] == 'Other') {
if ($Properties['Encoding'] == 'Other') {
if ($Properties['Format'] == 'FLAC') {
$Validate->SetFields('bitrate',
'1','string','FLAC bitrate must be lossless.', array('regex'=>'/Lossless/'));
@ -153,7 +153,7 @@
$Validate->SetFields('other_bitrate',
'1','string','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; }
if (isset($_POST['vbr'])) { $enc.=' (VBR)'; }
$Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc;
@ -186,11 +186,11 @@
$Validate->SetFields('format',
'1','inarray','Please select a valid format.',array('inarray'=>$Formats));
if($Properties['Encoding'] == 'Other') {
if ($Properties['Encoding'] == 'Other') {
$Validate->SetFields('other_bitrate',
'1','string','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; }
if (isset($_POST['vbr'])) { $enc.=' (VBR)'; }
$Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc;
@ -241,33 +241,34 @@
if (!is_uploaded_file($TorrentName) || !filesize($TorrentName)) {
$Err='No torrent file uploaded, or file is empty.';
} else if(substr(strtolower($File['name']), strlen($File['name']) - strlen(".torrent")) !== ".torrent") {
} elseif (substr(strtolower($File['name']), strlen($File['name']) - strlen('.torrent')) !== '.torrent') {
$Err = "You seem to have put something other than a torrent file into the upload field. (".$File['name'].").";
}
if($Type == 'Music') {
if ($Type == 'Music') {
include(SERVER_ROOT.'/sections/upload/get_extra_torrents.php');
}
$LogScoreAverage = 0;
$SendPM = 0;
$LogMessage = "";
$CheckStamp="";
$LogMessage = '';
$CheckStamp='';
if(!$Err && $Properties['Format'] == 'FLAC') {
if (!$Err && $Properties['Format'] == 'FLAC') {
foreach ($_FILES['logfiles']['name'] as $FileName) {
if(!empty($FileName) && substr(strtolower($FileName), strlen($FileName) - strlen(".log")) !== ".log") {
$Err = "You seem to have put something other than an EAC or XLD log file into an upload field. (".$FileName.").";
if (!empty($FileName) && substr(strtolower($FileName), strlen($FileName) - strlen('.log')) !== '.log') {
$Err = 'You seem to have put something other than an EAC or XLD log file into an upload field. ('.$FileName.').';
break;
}
}
//There is absolutely no point in checking the type of the file upload as its interpretation of the type is decided by the client.
/* foreach($_FILES['logfiles']['type'] as $FileType) {
if(!empty($FileType) && $FileType != "text/plain" && $FileType != "text/x-log" && $FileType != "application/octet-stream" && $FileType != "text/richtext") {
$Err = "You seem to have put something other than an EAC or XLD log file into an upload field. (".$FileType.")";
break;
}
}*/
/* foreach ($_FILES['logfiles']['type'] as $FileType) {
if (!empty($FileType) && $FileType != "text/plain" && $FileType != "text/x-log" && $FileType != "application/octet-stream" && $FileType != "text/richtext") {
$Err = "You seem to have put something other than an EAC or XLD log file into an upload field. (".$FileType.")";
break;
}
}
*/
}
@ -275,7 +276,7 @@
//Multiple artists!
$LogName = '';
if(empty($Properties['GroupID']) && empty($ArtistForm) && $Type == "Music") {
if (empty($Properties['GroupID']) && empty($ArtistForm) && $Type == "Music") {
$MainArtistCount = 0;
$ArtistNames = array();
$ArtistForm = array(
@ -287,24 +288,24 @@
6 => array()
);
for($i = 0, $il = count($Artists); $i < $il; $i++) {
if(trim($Artists[$i]) != "") {
if(!in_array($Artists[$i], trim($ArtistNames))) {
if (trim($Artists[$i]) != '') {
if (!in_array($Artists[$i], trim($ArtistNames))) {
$ArtistForm[$Importance[$i]][] = array('name' => Artists::normalise_artist_name($Artists[$i]));
if($Importance[$i] == 1) {
if ($Importance[$i] == 1) {
$MainArtistCount++;
}
$ArtistNames[] = trim($Artists[$i]);
}
}
}
if($MainArtistCount < 1) {
$Err = "Please enter at least one main artist";
if ($MainArtistCount < 1) {
$Err = 'Please enter at least one main artist';
$ArtistForm = array();
}
$LogName .= Artists::display_artists($ArtistForm, false, true, false);
} elseif($Type == "Music" && empty($ArtistForm)) {
} elseif ($Type == 'Music' && empty($ArtistForm)) {
$DB->query("SELECT ta.ArtistID,aa.Name,ta.Importance FROM torrents_artists AS ta 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);
}
@ -312,7 +313,7 @@
}
if($Err) { // Show the upload form, with the data the user entered
if ($Err) { // Show the upload form, with the data the user entered
$UploadForm=$Type;
include(SERVER_ROOT.'/sections/upload/upload.php');
die();
@ -333,7 +334,7 @@
$T = array();
foreach ($Properties as $Key => $Value) {
$T[$Key]="'".db_string(trim($Value))."'";
if(!$T[$Key]) {
if (!$T[$Key]) {
$T[$Key] = NULL;
}
}
@ -417,66 +418,66 @@
$Body = $Properties['GroupDescription'];
// Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Properties['Image'])) { $Properties['Image'] = ''; $T['Image'] = "''"; }
if (!preg_match("/^".IMAGE_REGEX."$/i", $Properties['Image'])) { $Properties['Image'] = ''; $T['Image'] = "''"; }
if($Type == 'Music') {
if ($Type == 'Music') {
// Does it belong in a group?
if($Properties['GroupID']) {
if ($Properties['GroupID']) {
$DB->query("
SELECT
tg.id,
tg.WikiImage,
tg.WikiBody,
tg.RevisionID,
tg.Name,
tg.Year,
tg.ReleaseType,
tg.TagList
tg.id,
tg.WikiImage,
tg.WikiBody,
tg.RevisionID,
tg.Name,
tg.Year,
tg.ReleaseType,
tg.TagList
FROM torrents_group AS tg
WHERE tg.id = ".$Properties['GroupID']);
if($DB->record_count() > 0) {
if ($DB->record_count() > 0) {
// Don't escape tg.Name. It's written directly to the log table
list($GroupID, $WikiImage, $WikiBody, $RevisionID, $Properties['Title'], $Properties['Year'], $Properties['ReleaseType'], $Properties['TagList']) = $DB->next_record(MYSQLI_NUM, array(4));
$Properties['TagList'] = str_replace(array(" ",".","_"), array(", ",".","."), $Properties['TagList']);
if(!$Properties['Image'] && $WikiImage){
if (!$Properties['Image'] && $WikiImage){
$Properties['Image'] = $WikiImage;
$T['Image'] = "'".db_string($WikiImage)."'";
}
if(strlen($WikiBody) > strlen($Body)){
if (strlen($WikiBody) > strlen($Body)){
$Body = $WikiBody;
if(!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
if (!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
$NoRevision = true;
}
}
$Properties['Artist'] = Artists::display_artists(Artists::get_artist($GroupID), false, false);
}
}
if(!$GroupID) {
foreach($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) {
if (!$GroupID) {
foreach ($ArtistForm as $Importance => $Artists) {
foreach ($Artists as $Num => $Artist) {
$DB->query("
SELECT
tg.id,
tg.WikiImage,
tg.WikiBody,
tg.RevisionID
tg.id,
tg.WikiImage,
tg.WikiBody,
tg.RevisionID
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
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 = '".db_string($Artist['name'])."'
AND tg.Name = ".$T['Title']."
AND tg.ReleaseType = ".$T['ReleaseType']."
AND tg.Year = ".$T['Year']);
AND tg.Name = ".$T['Title']."
AND tg.ReleaseType = ".$T['ReleaseType']."
AND tg.Year = ".$T['Year']);
if($DB->record_count() > 0) {
if ($DB->record_count() > 0) {
list($GroupID, $WikiImage, $WikiBody, $RevisionID) = $DB->next_record();
if(!$Properties['Image'] && $WikiImage) {
if (!$Properties['Image'] && $WikiImage) {
$Properties['Image'] = $WikiImage;
$T['Image'] = "'".db_string($WikiImage)."'";
}
if(strlen($WikiBody) > strlen($Body)){
if (strlen($WikiBody) > strlen($Body)){
$Body = $WikiBody;
if(!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
if (!$Properties['Image'] || $Properties['Image'] == $WikiImage) {
$NoRevision = true;
}
}
@ -488,16 +489,16 @@
// The album hasn't been uploaded. Try to get the artist ids
$DB->query("
SELECT
aa.ArtistID,
aa.AliasID,
aa.Name,
aa.Redirect
aa.ArtistID,
aa.AliasID,
aa.Name,
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'");
if($DB->record_count() > 0) {
while(list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($Artist['name'], $AliasName)) {
if($Redirect) {
if ($DB->record_count() > 0) {
while (list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if (!strcasecmp($Artist['name'], $AliasName)) {
if ($Redirect) {
$AliasID = $Redirect;
}
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
@ -518,13 +519,13 @@
$IsNewGroup = !$GroupID;
//----- Start inserts
if(!$GroupID && $Type == 'Music') {
if (!$GroupID && $Type == 'Music') {
//array to store which artists we have added already, to prevent adding an artist twice
$ArtistsAdded = array();
foreach($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) {
if(!$Artist['id']) {
if(isset($ArtistsAdded[strtolower($Artist['name'])])) {
foreach ($ArtistForm as $Importance => $Artists) {
foreach ($Artists as $Num => $Artist) {
if (!$Artist['id']) {
if (isset($ArtistsAdded[strtolower($Artist['name'])])) {
$ArtistForm[$Importance][$Num] = $ArtistsAdded[strtolower($Artist['name'])];
} else {
// Create artist
@ -545,16 +546,16 @@
unset($ArtistsAdded);
}
if(!$GroupID) {
if (!$GroupID) {
// Create torrent group
$DB->query("
INSERT INTO torrents_group
(ArtistID, CategoryID, Name, Year, RecordLabel, CatalogueNumber, Time, WikiBody, WikiImage, SearchText, ReleaseType, VanityHouse) VALUES
(0, ".$TypeID.", ".$T['Title'].", $T[Year], $T[RecordLabel], $T[CatalogueNumber], '".sqltime()."', '".db_string($Body)."', $T[Image], '$SearchText', $T[ReleaseType], $T[VanityHouse])");
$GroupID = $DB->inserted_id();
if($Type == 'Music') {
foreach($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) {
if ($Type == 'Music') {
foreach ($ArtistForm as $Importance => $Artists) {
foreach ($Artists as $Num => $Artist) {
$DB->query("INSERT IGNORE INTO torrents_artists (GroupID, ArtistID, AliasID, UserID, Importance) VALUES (".$GroupID.", ".$Artist['id'].", ".$Artist['aliasid'].", ".$LoggedUser['ID'].", '".$Importance."')");
$Cache->increment('stats_album_count');
}
@ -569,14 +570,14 @@
$Cache->delete_value('torrent_group_'.$GroupID);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('detail_files_'.$GroupID);
if($Type == 'Music') {
if ($Type == 'Music') {
$DB->query("SELECT ReleaseType FROM torrents_group WHERE ID='$GroupID'");
list($Properties['ReleaseType']) = $DB->next_record();
}
}
// Description
if(!$NoRevision) {
if (!$NoRevision) {
$DB->query("
INSERT INTO wiki_torrents
(PageID, Body, UserID, Summary, Time, Image) VALUES
@ -590,10 +591,10 @@
// Tags
$Tags = explode(',', $Properties['TagList']);
if(!$Properties['GroupID']) {
foreach($Tags as $Tag) {
if (!$Properties['GroupID']) {
foreach ($Tags as $Tag) {
$Tag = Misc::sanitize_tag($Tag);
if(!empty($Tag)) {
if (!empty($Tag)) {
$Tag = Misc::get_alias_tag($Tag);
$DB->query("INSERT INTO tags
(Name, UserID) VALUES
@ -644,7 +645,7 @@
Torrents::update_hash($GroupID);
$Debug->set_flag('upload: sphinx updated');
if($Type == 'Music') {
if ($Type == 'Music') {
include(SERVER_ROOT.'/sections/upload/insert_extra_torrents.php');
}
@ -668,16 +669,18 @@
//******************************************************************************//
//--------------- Stupid Recent Uploads ----------------------------------------//
if(trim($Properties['Image']) != "") {
if (trim($Properties['Image']) != '') {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if(is_array($RecentUploads)) {
if (is_array($RecentUploads)) {
do {
foreach($RecentUploads as $Item) {
if ($Item['ID'] == $GroupID) { break 2; }
foreach ($RecentUploads as $Item) {
if ($Item['ID'] == $GroupID) {
break 2;
}
}
// Only reached if no matching GroupIDs in the cache already.
if(count($RecentUploads) == 5) {
if (count($RecentUploads) == 5) {
array_pop($RecentUploads);
}
array_unshift($RecentUploads, array('ID'=>$GroupID,'Name'=>trim($Properties['Title']),'Artist'=>Artists::display_artists($ArtistForm, false, true),'WikiImage'=>trim($Properties['Image'])));
@ -688,9 +691,9 @@
//******************************************************************************//
//--------------- Contest ------------------------------------------------------//
if ($Properties['LibraryImage'] != "") {
if ($Properties['LibraryImage'] != '') {
$DB->query("INSERT INTO reportsv2 (ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
VALUES (0, ".$TorrentID.", 'library', '".db_string(($Properties['MultiDisc'] ? "Multi-disc" : ""))."', 'New', '".sqltime()."', '', '".db_string($Properties['LibraryImage'])."', '', '')");
VALUES (0, ".$TorrentID.", 'library', '".db_string(($Properties['MultiDisc'] ? 'Multi-disc' : ''))."', 'New', '".sqltime()."', '', '".db_string($Properties['LibraryImage'])."', '', '')");
}
//******************************************************************************//
@ -707,7 +710,7 @@
<p><strong>Your torrent has been uploaded; however, you must download your torrent from <a href="torrents.php?id=<?=$GroupID?>">here</a> because you didn't make your torrent using the "private" option.</strong></p>
<?
View::show_footer();
} else if ($RequestID) {
} elseif ($RequestID) {
header("Location: requests.php?action=takefill&requestid=".$RequestID."&torrentid=".$TorrentID."&auth=".$LoggedUser['AuthKey']);
} else {
header("Location: torrents.php?id=$GroupID");
@ -723,21 +726,35 @@
//******************************************************************************//
//--------------- IRC announce and feeds ---------------------------------------//
$Announce = "";
$Announce = '';
if($Type == 'Music'){ $Announce .= Artists::display_artists($ArtistForm, false); }
if ($Type == 'Music') {
$Announce .= Artists::display_artists($ArtistForm, false);
}
$Announce .= trim($Properties['Title'])." ";
if($Type == 'Music'){
if ($Type == 'Music') {
$Announce .= '['.trim($Properties['Year']).']';
if (($Type == 'Music') && ($Properties['ReleaseType'] > 0)) { $Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']'; }
$Announce .= " - ";
if (($Type == 'Music') && ($Properties['ReleaseType'] > 0)) {
$Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']';
}
$Announce .= ' - ';
$Announce .= trim($Properties['Format'])." / ".trim($Properties['Bitrate']);
if ($HasLog == 1) { $Announce .= " / Log"; }
if ($LogInDB) { $Announce .= " / ".$LogScoreAverage.'%'; }
if ($HasCue == 1) { $Announce .= " / Cue"; }
$Announce .= " / ".trim($Properties['Media']);
if ($Properties['Scene'] == "1") { $Announce .= " / Scene"; }
if ($T['FreeLeech'] == "1") { $Announce .= " / Freeleech!"; }
if ($HasLog == 1) {
$Announce .= ' / Log';
}
if ($LogInDB) {
$Announce .= ' / '.$LogScoreAverage.'%';
}
if ($HasCue == 1) {
$Announce .= ' / Cue';
}
$Announce .= ' / '.trim($Properties['Media']);
if ($Properties['Scene'] == '1') {
$Announce .= ' / Scene';
}
if ($T['FreeLeech'] == '1') {
$Announce .= ' / Freeleech!';
}
}
$Title = $Announce;
@ -755,7 +772,7 @@
// Manage notifications
$UsedFormatBitrates = array();
if(!$IsNewGroup) {
if (!$IsNewGroup) {
// maybe there are torrents in the same release as the new torrent. Let's find out (for notifications)
$GroupInfo = get_group_info($GroupID, true, 0, false);
@ -766,7 +783,7 @@
$ThisRemasterRecordLabel = display_str($Properties['RemasterRecordLabel']);
$ThisRemasterCatalogueNumber = display_str($Properties['RemasterCatalogueNumber']);
foreach($GroupInfo[1] as $TorrentInfo) {
foreach ($GroupInfo[1] as $TorrentInfo) {
if (($TorrentInfo['Media'] == $ThisMedia)
&& ($TorrentInfo['Remastered'] == $ThisRemastered)
&& ($TorrentInfo['RemasterYear'] == (int)$ThisRemasterYear)
@ -786,17 +803,17 @@
//Notifications
$SQL = "SELECT unf.ID, unf.UserID, torrent_pass
FROM users_notify_filters AS unf
JOIN users_main AS um ON um.ID=unf.UserID
JOIN users_main AS um ON um.ID=unf.UserID
WHERE um.Enabled='1'";
if(empty($ArtistsUnescaped)) {
if (empty($ArtistsUnescaped)) {
$ArtistsUnescaped = $ArtistForm;
}
if(!empty($ArtistsUnescaped)) {
if (!empty($ArtistsUnescaped)) {
$ArtistNameList = array();
$GuestArtistNameList = array();
foreach($ArtistsUnescaped as $Importance => $Artists) {
foreach($Artists as $Artist) {
if($Importance == 1 || $Importance == 4 || $Importance == 5 || $Importance == 6) {
foreach ($ArtistsUnescaped as $Importance => $Artists) {
foreach ($Artists as $Artist) {
if ($Importance == 1 || $Importance == 4 || $Importance == 5 || $Importance == 6) {
$ArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'";
} else {
$GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'";
@ -804,13 +821,13 @@
}
}
// Don't add notification if >2 main artists or if tracked artist isn't a main artist
if(count($ArtistNameList) > 2 || $Artist['name'] == 'Various Artists') {
if (count($ArtistNameList) > 2 || $Artist['name'] == 'Various Artists') {
$SQL.= " AND (ExcludeVA='0' AND (";
$SQL.= implode(" OR ", array_merge($ArtistNameList,$GuestArtistNameList));
$SQL.= " OR Artists='')) AND (";
} else {
$SQL.= " AND (";
if(!empty($GuestArtistNameList)) {
if (!empty($GuestArtistNameList)) {
$SQL.= "(ExcludeVA='0' AND (";
$SQL.= implode(" OR ", $GuestArtistNameList);
$SQL.= ")) OR ";
@ -826,7 +843,7 @@
reset($Tags);
$TagSQL = array();
$NotTagSQL = array();
foreach($Tags as $Tag) {
foreach ($Tags as $Tag) {
$TagSQL[]=" Tags LIKE '%|".db_string(trim($Tag))."|%' ";
$NotTagSQL[]=" NotTags LIKE '%|".db_string(trim($Tag))."|%' ";
}
@ -837,7 +854,7 @@
$SQL.=" AND (Categories LIKE '%|".db_string(trim($Type))."|%' OR Categories='') ";
if($Properties['ReleaseType']) {
if ($Properties['ReleaseType']) {
$SQL.=" AND (ReleaseTypes LIKE '%|".db_string(trim($ReleaseTypes[$Properties['ReleaseType']]))."|%' OR ReleaseTypes='') ";
} else {
$SQL.=" AND (ReleaseTypes='') ";
@ -850,19 +867,19 @@
*/
if($Properties['Format']) {
if ($Properties['Format']) {
$SQL.=" AND (Formats LIKE '%|".db_string(trim($Properties['Format']))."|%' OR Formats='') ";
} else {
$SQL.=" AND (Formats='') ";
}
if($_POST['bitrate']) {
if ($_POST['bitrate']) {
$SQL.=" AND (Encodings LIKE '%|".db_string(trim($_POST['bitrate']))."|%' OR Encodings='') ";
} else {
$SQL.=" AND (Encodings='') ";
}
if($Properties['Media']) {
if ($Properties['Media']) {
$SQL.=" AND (Media LIKE '%|".db_string(trim($Properties['Media']))."|%' OR Media='') ";
} else {
$SQL.=" AND (Media='') ";
@ -880,14 +897,14 @@
$SQL .= "AND (NOT($FormatReq AND $BitrateReq)) ";
}
$SQL .= "))";
$SQL .= '))';
if($Properties['Year'] && $Properties['RemasterYear']) {
if ($Properties['Year'] && $Properties['RemasterYear']) {
$SQL.=" AND (('".db_string(trim($Properties['Year']))."' BETWEEN FromYear AND ToYear)
OR ('".db_string(trim($Properties['RemasterYear']))."' BETWEEN FromYear AND ToYear)
OR (FromYear=0 AND ToYear=0)) ";
} elseif($Properties['Year'] || $Properties['RemasterYear']) {
} elseif ($Properties['Year'] || $Properties['RemasterYear']) {
$SQL.=" AND (('".db_string(trim(Max($Properties['Year'],$Properties['RemasterYear'])))."' BETWEEN FromYear AND ToYear)
OR (FromYear=0 AND ToYear=0)) ";
} else {
@ -899,11 +916,11 @@
$DB->query($SQL);
$Debug->set_flag('upload: notification query finished');
if($DB->record_count()>0){
if ($DB->record_count()>0){
$UserArray = $DB->to_array('UserID');
$FilterArray = $DB->to_array('ID');
$InsertSQL = "INSERT IGNORE INTO users_notify_torrents (UserID, GroupID, TorrentID, FilterID) VALUES ";
$InsertSQL = 'INSERT IGNORE INTO users_notify_torrents (UserID, GroupID, TorrentID, FilterID) VALUES ';
$Rows = array();
foreach ($UserArray as $User) {
list($FilterID, $UserID, $Passkey) = $User;
@ -924,7 +941,7 @@
// RSS for bookmarks
$DB->query("SELECT u.ID, u.torrent_pass
FROM users_main AS u
JOIN bookmarks_torrents AS b ON b.UserID = u.ID
JOIN bookmarks_torrents AS b ON b.UserID = u.ID
WHERE b.GroupID = $GroupID");
while (list($UserID, $Passkey) = $DB->next_record()) {
$Feed->populate('torrents_bookmarks_t_'.$Passkey, $Item);
@ -932,20 +949,42 @@
$Feed->populate('torrents_all',$Item);
$Debug->set_flag('upload: notifications handled');
if($Type == 'Music'){
if ($Type == 'Music'){
$Feed->populate('torrents_music',$Item);
if($Properties['Media'] == 'Vinyl') { $Feed->populate('torrents_vinyl',$Item); }
if($Properties['Bitrate'] == 'Lossless') { $Feed->populate('torrents_lossless',$Item); }
if($Properties['Bitrate'] == '24bit Lossless') { $Feed->populate('torrents_lossless24',$Item); }
if($Properties['Format'] == 'MP3') { $Feed->populate('torrents_mp3',$Item); }
if($Properties['Format'] == 'FLAC') { $Feed->populate('torrents_flac',$Item); }
if ($Properties['Media'] == 'Vinyl') {
$Feed->populate('torrents_vinyl',$Item);
}
if ($Properties['Bitrate'] == 'Lossless') {
$Feed->populate('torrents_lossless',$Item);
}
if ($Properties['Bitrate'] == '24bit Lossless') {
$Feed->populate('torrents_lossless24',$Item);
}
if ($Properties['Format'] == 'MP3') {
$Feed->populate('torrents_mp3',$Item);
}
if ($Properties['Format'] == 'FLAC') {
$Feed->populate('torrents_flac',$Item);
}
}
if ($Type == 'Applications') {
$Feed->populate('torrents_apps',$Item);
}
if ($Type == 'E-Books') {
$Feed->populate('torrents_ebooks',$Item);
}
if ($Type == 'Audiobooks') {
$Feed->populate('torrents_abooks',$Item);
}
if ($Type == 'E-Learning Videos') {
$Feed->populate('torrents_evids',$Item);
}
if ($Type == 'Comedy') {
$Feed->populate('torrents_comedy',$Item);
}
if ($Type == 'Comics') {
$Feed->populate('torrents_comics',$Item);
}
if($Type == 'Applications') { $Feed->populate('torrents_apps',$Item); }
if($Type == 'E-Books') { $Feed->populate('torrents_ebooks',$Item); }
if($Type == 'Audiobooks') { $Feed->populate('torrents_abooks',$Item); }
if($Type == 'E-Learning Videos'){ $Feed->populate('torrents_evids',$Item); }
if($Type == 'Comedy') { $Feed->populate('torrents_comedy',$Item); }
if($Type == 'Comics') { $Feed->populate('torrents_comics',$Item); }
// Clear Cache
$Cache->delete('torrents_details_'.$GroupID);

View File

@ -704,14 +704,14 @@ function check_paranoia_here($Setting) {
$CategoryName = $Categories[$CategoryID - 1];
if ($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else if ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = "<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>";
} else {
$FullName ="<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title."</a>";
$FullName ="<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title</a>";
}
$Row = (empty($Row) || $Row == 'a') ? 'b' : 'a';