Empty commit

This commit is contained in:
Git 2013-07-11 08:00:55 +00:00
parent 1f843e116c
commit 205cbc3630
15 changed files with 276 additions and 263 deletions

View File

@ -175,7 +175,9 @@ function __construct($Database = SQLDB, $User = SQLLOGIN, $Pass = SQLPASS, $Serv
function halt($Msg) {
global $LoggedUser, $Cache, $Debug, $argv;
$DBError = 'MySQL: '.strval($Msg).' SQL error: '.strval($this->Errno).' ('.strval($this->Error).')';
if ($this->Errno == 1194) { send_irc('PRIVMSG '.ADMIN_CHAN.' :'.$this->Error); }
if ($this->Errno == 1194) {
send_irc('PRIVMSG '.ADMIN_CHAN.' :'.$this->Error);
}
/*if ($this->Errno == 1194) {
preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches);
} */
@ -232,22 +234,22 @@ function query($Query, $AutoHandle = 1) {
}
$QueryEndTime = microtime(true);
$this->Queries[] = array(display_str($Query), ($QueryEndTime - $QueryStartTime) * 1000, null);
$this->Time += ($QueryEndTime-$QueryStartTime) * 1000;
$this->Time += ($QueryEndTime - $QueryStartTime) * 1000;
if (!$this->QueryID) {
$this->Errno = mysqli_errno($this->LinkID);
$this->Error = mysqli_error($this->LinkID);
if ($AutoHandle) {
$this->halt('Invalid Query: '.$Query);
$this->halt("Invalid Query: $Query");
} else {
return $this->Errno;
}
}
/*
$QueryType = substr($Query,0, 6);
if ($QueryType == 'DELETE' || $QueryType == 'UPDATE') {
$QueryType = substr($Query, 0, 6);
if ($QueryType === 'DELETE' || $QueryType === 'UPDATE') {
if ($this->affected_rows() > 50) {
$Debug->analysis($this->affected_rows().' rows altered:', $Query, 3600 * 24);
}

View File

@ -22,7 +22,7 @@ public static function update_sphinx_requests($RequestID) {
UNIX_TIMESTAMP(TimeFilled) AS TimeFilled, Visible,
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 10 AS Bounty
FROM requests AS r
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
WHERE ID = $RequestID
GROUP BY r.ID");
@ -31,13 +31,13 @@ public static function update_sphinx_requests($RequestID) {
SET ArtistList = (
SELECT GROUP_CONCAT(aa.Name SEPARATOR ' ')
FROM requests_artists AS ra
JOIN artists_alias AS aa ON aa.AliasID=ra.AliasID
JOIN artists_alias AS aa ON aa.AliasID = ra.AliasID
WHERE ra.RequestID = $RequestID
GROUP BY NULL
)
WHERE ID = $RequestID");
$Cache->delete_value('requests_'.$RequestID);
$Cache->delete_value("requests_$RequestID");
}
@ -62,14 +62,14 @@ public static function get_requests($RequestIDs, $Return = true) {
$NotFound = array_flip($RequestIDs);
foreach ($RequestIDs as $RequestID) {
$Data = $Cache->get_value('request_'.$RequestID);
$Data = $Cache->get_value("request_$RequestID");
if (!empty($Data)) {
unset($NotFound[$RequestID]);
$Found[$RequestID] = $Data;
}
}
$IDs = implode(',',array_flip($NotFound));
$IDs = implode(',', array_flip($NotFound));
/*
Don't change without ensuring you change everything else that uses get_requests()
@ -102,8 +102,8 @@ public static function get_requests($RequestIDs, $Return = true) {
r.GroupID,
r.OCLC
FROM requests AS r
LEFT JOIN users_main AS u ON u.ID=r.UserID
LEFT JOIN users_main AS filler ON filler.ID=FillerID AND FillerID!=0
LEFT JOIN users_main AS u ON u.ID = r.UserID
LEFT JOIN users_main AS filler ON filler.ID = FillerID AND FillerID != 0
WHERE r.ID IN ($IDs)
ORDER BY ID");
@ -117,28 +117,28 @@ public static function get_requests($RequestIDs, $Return = true) {
}
if ($Return) { // If we're interested in the data, and not just caching it
$Matches = array('matches'=>$Found, 'notfound'=>array_flip($NotFound));
$Matches = array('matches' => $Found, 'notfound' => array_flip($NotFound));
return $Matches;
}
}
public static function get_comment_count($RequestID) {
global $Cache, $DB;
$NumComments = $Cache->get_value('request_comments_'.$RequestID);
$NumComments = $Cache->get_value("request_comments_$RequestID");
if ($NumComments === false) {
$DB->query("
SELECT COUNT(ID)
FROM requests_comments
WHERE RequestID = '$RequestID'");
list($NumComments) = $DB->next_record();
$Cache->cache_value('request_comments_'.$RequestID, $NumComments, 0);
$Cache->cache_value("request_comments_$RequestID", $NumComments, 0);
}
return $NumComments;
}
public static function get_comment_catalogue($RequestID, $CatalogueID) {
global $Cache, $DB;
$Catalogue = $Cache->get_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
$Catalogue = $Cache->get_value("request_comments_$RequestID"."_catalogue_$CatalogueID");
if ($Catalogue === false) {
$CatalogueLimit = $CatalogueID * THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
$DB->query("
@ -151,19 +151,19 @@ public static function get_comment_catalogue($RequestID, $CatalogueID) {
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");
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
$Cache->cache_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
$Cache->cache_value("request_comments_$RequestID"."_catalogue_$CatalogueID", $Catalogue, 0);
}
return $Catalogue;
}
public static function get_artists($RequestID) {
global $Cache, $DB;
$Artists = $Cache->get_value('request_artists_'.$RequestID);
$Artists = $Cache->get_value("request_artists_$RequestID");
if (is_array($Artists)) {
$Results = $Artists;
} else {
@ -183,7 +183,7 @@ public static function get_artists($RequestID) {
list($ArtistID, $ArtistName, $ArtistImportance) = $ArtistRow;
$Results[$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName);
}
$Cache->cache_value('request_artists_'.$RequestID, $Results);
$Cache->cache_value("request_artists_$RequestID", $Results);
}
return $Results;
}
@ -195,14 +195,14 @@ public static function get_tags($RequestID) {
rt.TagID,
t.Name
FROM requests_tags AS rt
JOIN tags AS t ON rt.TagID=t.ID
JOIN tags AS t ON rt.TagID = t.ID
WHERE rt.RequestID = $RequestID
ORDER BY rt.TagID ASC");
$Tags = $DB->to_array();
$Results = array();
foreach ($Tags as $TagsRow) {
list($TagID, $TagName) = $TagsRow;
$Results[$TagID]= $TagName;
$Results[$TagID] = $TagName;
}
return $Results;
}
@ -210,7 +210,7 @@ public static function get_tags($RequestID) {
public static function get_votes_array($RequestID) {
global $Cache, $DB;
$RequestVotes = $Cache->get_value('request_votes_'.$RequestID);
$RequestVotes = $Cache->get_value("request_votes_$RequestID");
if (!is_array($RequestVotes)) {
$DB->query("
SELECT
@ -218,7 +218,7 @@ public static function get_votes_array($RequestID) {
rv.Bounty,
u.Username
FROM requests_votes as rv
LEFT JOIN users_main AS u ON u.ID=rv.UserID
LEFT JOIN users_main AS u ON u.ID = rv.UserID
WHERE rv.RequestID = $RequestID
ORDER BY rv.Bounty DESC");
if (!$DB->has_results()) {
@ -236,7 +236,7 @@ public static function get_votes_array($RequestID) {
}
$RequestVotes['Voters'] = $VotesArray;
$Cache->cache_value('request_votes_'.$RequestID, $RequestVotes);
$Cache->cache_value("request_votes_$RequestID", $RequestVotes);
}
}
return $RequestVotes;

View File

@ -138,7 +138,7 @@
AND ID <= $_POST[post]");
list($Page) = $DB->next_record();
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
if ($LoggedUser['ID'] !== $AuthorID && !check_perms('site_moderate_forums')) {
error(404);
}
if (!$DB->has_results()) {

View File

@ -4,7 +4,7 @@
}
$Action = $_GET['action'];
if ($Action != 'unfill' && $Action != 'delete') {
if ($Action !== 'unfill' && $Action !== 'delete') {
error(404);
}
@ -14,12 +14,12 @@
WHERE ID = ".$_GET['id']);
list($RequestorID, $FillerID) = $DB->next_record();
if ($Action == 'unfill') {
if ($LoggedUser['ID'] != $RequestorID && $LoggedUser['ID'] != $FillerID && !check_perms('site_moderate_requests')) {
if ($Action === 'unfill') {
if ($LoggedUser['ID'] !== $RequestorID && $LoggedUser['ID'] !== $FillerID && !check_perms('site_moderate_requests')) {
error(403);
}
} elseif ($Action == 'delete') {
if ($LoggedUser['ID'] != $RequestorID && !check_perms('site_moderate_requests')) {
} elseif ($Action === 'delete') {
if ($LoggedUser['ID'] !== $RequestorID && !check_perms('site_moderate_requests')) {
error(403);
}
}
@ -32,11 +32,11 @@
<?=ucwords($Action)?> Request
</div>
<div class="pad">
<form class="<?=(($Action == 'delete') ? 'delete_form' : 'edit_form')?>" name="request" action="requests.php" method="post">
<form class="<?=(($Action === 'delete') ? 'delete_form' : 'edit_form')?>" name="request" action="requests.php" method="post">
<input type="hidden" name="action" value="take<?=$Action?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$_GET['id']?>" />
<? if ($Action == 'delete') { ?>
<? if ($Action === 'delete') { ?>
<div class="warning">You will <strong>not</strong> get your bounty back if you delete this request.</div>
<? } ?>
<strong>Reason:</strong>

View File

@ -7,7 +7,7 @@
*/
$NewRequest = ($_GET['action'] == 'new' ? true : false);
$NewRequest = ($_GET['action'] === 'new' ? true : false);
if (!$NewRequest) {
$RequestID = $_GET['id'];
@ -47,14 +47,14 @@
$IsFilled = !empty($TorrentID);
$CategoryName = $Categories[$CategoryID - 1];
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == 'Music' && $Year == 0)));
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID === '0') || ($CategoryName === 'Music' && $Year === '0')));
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] === $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
if (!$CanEdit) {
error(403);
}
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$BitrateArray = array();
@ -153,7 +153,7 @@
<td>
<select id="categories" name="type" onchange="Categories()">
<? foreach (Misc::display_array($Categories) as $Cat) { ?>
<option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName == $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option>
<option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName === $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option>
<? } ?>
</select>
</td>
@ -171,15 +171,15 @@
?>
<input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" />
<select id="importance" name="importance[]" >
<option value="1"<?=($Importance == '1' ? ' selected="selected"' : '')?>>Main</option>
<option value="2"<?=($Importance == '2' ? ' selected="selected"' : '')?>>Guest</option>
<option value="4"<?=($Importance == '4' ? ' selected="selected"' : '')?>>Composer</option>
<option value="5"<?=($Importance == '5' ? ' selected="selected"' : '')?>>Conductor</option>
<option value="6"<?=($Importance == '6' ? ' selected="selected"' : '')?>>DJ / Compiler</option>
<option value="3"<?=($Importance == '3' ? ' selected="selected"' : '')?>>Remixer</option>
<option value="7"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option>
<option value="1"<?=($Importance === '1' ? ' selected="selected"' : '')?>>Main</option>
<option value="2"<?=($Importance === '2' ? ' selected="selected"' : '')?>>Guest</option>
<option value="4"<?=($Importance === '4' ? ' selected="selected"' : '')?>>Composer</option>
<option value="5"<?=($Importance === '5' ? ' selected="selected"' : '')?>>Conductor</option>
<option value="6"<?=($Importance === '6' ? ' selected="selected"' : '')?>>DJ / Compiler</option>
<option value="3"<?=($Importance === '3' ? ' selected="selected"' : '')?>>Remixer</option>
<option value="7"<?=($Importance === '7' ? ' selected="selected"' : '')?>>Producer</option>
</select>
<? if ($First) { ?><a href="#" onclick="AddArtistField();return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField();return false;" class="brackets">&minus;</a><? } $First = false; ?>
<? if ($First) { ?><a href="#" onclick="AddArtistField(); return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField(); return false;" class="brackets">&minus;</a><? } $First = false; ?>
<br />
<? }
}
@ -286,10 +286,10 @@
<tr id="formats_tr">
<td class="label">Allowed formats</td>
<td>
<input type="checkbox" name="all_formats" id="toggle_formats" onchange="Toggle('formats', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($FormatArray) && (count($FormatArray) == count($Formats)) ? ' checked="checked"' : '')?> /><label for="toggle_formats"> All</label>
<input type="checkbox" name="all_formats" id="toggle_formats" onchange="Toggle('formats', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($FormatArray) && (count($FormatArray) === count($Formats)) ? ' checked="checked"' : '')?> /><label for="toggle_formats"> All</label>
<span style="float: right;"><strong>NB: You cannot require a log or cue unless FLAC is an allowed format</strong></span>
<? foreach ($Formats as $Key => $Val) {
if ($Key % 8 == 0) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="formats[]" value="<?=$Key?>" onchange="ToggleLogCue(); if (!this.checked) { $('#toggle_formats').raw().checked = false; }" id="format_<?=$Key?>"
@ -300,9 +300,9 @@
<tr id="bitrates_tr">
<td class="label">Allowed bitrates</td>
<td>
<input type="checkbox" name="all_bitrates" id="toggle_bitrates" onchange="Toggle('bitrates', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($BitrateArray) && (count($BitrateArray) == count($Bitrates)) ? ' checked="checked"' : '')?> /><label for="toggle_bitrates"> All</label>
<input type="checkbox" name="all_bitrates" id="toggle_bitrates" onchange="Toggle('bitrates', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($BitrateArray) && (count($BitrateArray) === count($Bitrates)) ? ' checked="checked"' : '')?> /><label for="toggle_bitrates"> All</label>
<? foreach ($Bitrates as $Key => $Val) {
if ($Key % 8 == 0) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
@ -314,9 +314,9 @@
<tr id="media_tr">
<td class="label">Allowed media</td>
<td>
<input type="checkbox" name="all_media" id="toggle_media" onchange="Toggle('media', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($MediaArray) && (count($MediaArray) == count($Media)) ? ' checked="checked"' : '')?> /><label for="toggle_media"> All</label>
<input type="checkbox" name="all_media" id="toggle_media" onchange="Toggle('media', <?=($NewRequest ? 1 : 0)?>);"<?=(!empty($MediaArray) && (count($MediaArray) === count($Media)) ? ' checked="checked"' : '')?> /><label for="toggle_media"> All</label>
<? foreach ($Media as $Key => $Val) {
if ($Key % 8 == 0) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
@ -350,14 +350,13 @@
If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here.
</td>
</tr>
<? } elseif ($GroupID && ($CategoryID == 1)) {
?>
<? } elseif ($GroupID && ($CategoryID == 1)) { ?>
<tr>
<td class="label">Torrent group</td>
<td>
<a href="torrents.php?id=<?=$GroupID?>">https://<?=SSL_SITE_URL?>/torrents.php?id=<?=$GroupID?></a><br />
This request <?=($NewRequest ? 'will be' : 'is')?> associated with the above torrent group.
<? if (!$NewRequest) { ?>
<? if (!$NewRequest) { ?>
If this is incorrect, please <a href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>">report this request</a> so that staff can fix it.
<? } ?>
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
@ -370,8 +369,8 @@
<td>
<input type="text" id="amount_box" size="8" value="<?=(!empty($Bounty) ? $Bounty : '100')?>" onchange="Calculate();" />
<select id="unit" name="unit" onchange="Calculate();">
<option value="mb"<?=(!empty($_POST['unit']) && $_POST['unit'] == 'mb' ? ' selected="selected"' : '') ?>>MB</option>
<option value="gb"<?=(!empty($_POST['unit']) && $_POST['unit'] == 'gb' ? ' selected="selected"' : '') ?>>GB</option>
<option value="mb"<?=(!empty($_POST['unit']) && $_POST['unit'] === 'mb' ? ' selected="selected"' : '') ?>>MB</option>
<option value="gb"<?=(!empty($_POST['unit']) && $_POST['unit'] === 'gb' ? ' selected="selected"' : '') ?>>GB</option>
</select>
<input type="button" value="Preview" onclick="Calculate();" />
<strong><?=($RequestTax * 100)?>% of this is deducted as tax by the system.</strong>

View File

@ -30,20 +30,20 @@
$IsFilled = !empty($TorrentID);
$CanVote = (empty($TorrentID) && check_perms('site_vote'));
if ($CategoryID == 0) {
if ($CategoryID === '0') {
$CategoryName = 'Unknown';
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
//Do we need to get artists?
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_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]";
$DisplayLink = "$ArtistLink<a href=\"torrents.php?torrentid=$TorrentID\">$Title</a> [$Year]";
} else {
$DisplayLink = $ArtistLink.$Title." [$Year]";
}
@ -65,7 +65,7 @@
$ReleaseName = $ReleaseTypes[$ReleaseType];
}
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
} elseif ($CategoryName === 'Audiobooks' || $CategoryName === 'Comedy') {
$FullName = "$Title [$Year]";
$DisplayLink = "$Title [$Year]";
} else {
@ -76,11 +76,11 @@
//Votes time
$RequestVotes = Requests::get_votes_array($RequestID);
$VoteCount = count($RequestVotes['Voters']);
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == 'Music' && $Year == 0)));
$UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2);
$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'));
View::show_header('View request: '.$FullName, 'comments,requests,bbcode');
View::show_header("View request: $FullName", 'comments,requests,bbcode');
?>
<div class="thin">
@ -102,7 +102,7 @@
<? 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>
<? } ?>
@ -122,38 +122,36 @@
</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 (!empty($Image)) {
?>
<p align="center"><img style="max-width: 220px;" src="<?=ImageTools::process($Image, true)?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=ImageTools::process($Image)?>', 220);" /></p>
<? } else { ?>
<? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID - 1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p>
<? } ?>
<? } ?>
</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) {
?>
<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)?>
</li>
@ -170,32 +168,32 @@
<li class="artists_main">
<?=Artists::display_artist($Artist)?>
</li>
<? }
<?
}
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) {
?>
<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) {
?>
<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)?>
</li>
@ -205,8 +203,7 @@
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)?>
</li>
@ -231,12 +228,13 @@
<div class="box box_votes">
<div class="head"><strong>Top contributors</strong></div>
<table class="layout">
<? $VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
<?
$VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
$ViewerVote = false;
for ($i = 0; $i < $VoteMax; $i++) {
$User = array_shift($RequestVotes['Voters']);
$Boldify = false;
if ($User['UserID'] == $LoggedUser['ID']) {
if ($User['UserID'] === $LoggedUser['ID']) {
$ViewerVote = true;
$Boldify = true;
}
@ -253,7 +251,7 @@
reset($RequestVotes['Voters']);
if (!$ViewerVote) {
foreach ($RequestVotes['Voters'] as $User) {
if ($User['UserID'] == $LoggedUser['ID']) { ?>
if ($User['UserID'] === $LoggedUser['ID']) { ?>
<tr>
<td>
<a href="user.php?id=<?=$User['UserID']?>"><strong><?=display_str($User['Username'])?></strong></a>
@ -277,7 +275,7 @@
<?=time_diff($TimeAdded)?> by <strong><?=Users::format_username($RequestorID, false, false, false)?></strong>
</td>
</tr>
<? if ($CategoryName == 'Music') {
<? if ($CategoryName === 'Music') {
if (!empty($RecordLabel)) { ?>
<tr>
<td class="label">Record label</td>
@ -329,7 +327,7 @@
}
$Worldcat = '';
$OCLC = str_replace(' ', '', $OCLC);
if ($OCLC != '') {
if ($OCLC !== '') {
$OCLCs = explode(',', $OCLC);
for ($i = 0; $i < count($OCLCs); $i++) {
if (!empty($Worldcat)) {
@ -410,7 +408,7 @@
</form>
</td>
</tr>
<? } ?>
<? } ?>
<tr id="bounty">
<td class="label">Bounty</td>
<td id="formatted_bounty"><?=Format::get_size($RequestVotes['TotalBounty'])?></td>
@ -424,7 +422,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>

View File

@ -81,7 +81,7 @@
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])) {
@ -91,9 +91,9 @@
if (count($FormatNameArray) >= 1) {
$EnableNegation = true;
if (!empty($_GET['formats_strict'])) {
$Queries[]='@formatlist ('.implode(' | ', $FormatNameArray).')';
$Queries[] = '@formatlist ('.implode(' | ', $FormatNameArray).')';
} else {
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
$Queries[] = '@formatlist (any | '.implode(' | ', $FormatNameArray).')';
}
}
}
@ -101,7 +101,7 @@
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])) {
@ -112,9 +112,9 @@
if (count($MediaNameArray) >= 1) {
$EnableNegation = true;
if (!empty($_GET['media_strict'])) {
$Queries[]='@medialist ('.implode(' | ', $MediaNameArray).')';
$Queries[] = '@medialist ('.implode(' | ', $MediaNameArray).')';
} else {
$Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')';
$Queries[] = '@medialist (any | '.implode(' | ', $MediaNameArray).')';
}
}
}
@ -122,7 +122,7 @@
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])) {
@ -133,9 +133,9 @@
if (count($BitrateNameArray) >= 1) {
$EnableNegation = true;
if (!empty($_GET['bitrate_strict'])) {
$Queries[]='@bitratelist ('.implode(' | ', $BitrateNameArray).')';
$Queries[] = '@bitratelist ('.implode(' | ', $BitrateNameArray).')';
} else {
$Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
$Queries[] = '@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
}
}
}
@ -143,23 +143,23 @@
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) {
$Word = trim($Word);
// Skip isolated hyphens to enable "Artist - Title" searches
if ($Word == '-') {
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;
}
@ -174,7 +174,7 @@
}
if (!empty($SearchWords['exclude'])) {
foreach ($SearchWords['exclude'] as $Word) {
$QueryParts[] = '!'.$SS->EscapeString(substr($Word,1));
$QueryParts[] = '!'.$SS->EscapeString(substr($Word, 1));
}
}
if (!empty($QueryParts)) {
@ -186,7 +186,7 @@
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 {
@ -195,7 +195,7 @@
}
foreach ($Tags as $Tag) {
$Tag = ltrim($Tag);
$Exclude = ($Tag[0] == '!');
$Exclude = ($Tag[0] === '!');
$Tag = Misc::sanitize_tag($Tag);
if (!empty($Tag)) {
$TagNames[] = $Tag;
@ -206,22 +206,22 @@
$Tags = Misc::get_tags($TagNames);
// Replace the ! characters that sanitize_tag removed
if ($TagType == 1 || $AllNegative) {
if ($TagType === 1 || $AllNegative) {
foreach ($TagNames as &$TagName) {
if ($TagsExclude[$TagName]) {
$TagName = '!'.$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)) {
if ($TagType === 1 && !empty($Tags)) {
foreach ($Tags as $TagID => $TagName) {
$SS->set_filter('tagid', array($TagID), $TagsExclude[$TagName]);
}
@ -232,9 +232,9 @@
if (!empty($_GET['filter_cat'])) {
$CategoryArray = array_keys($_GET['filter_cat']);
$Debug->log_var(array($CategoryArray, $Categories));
if (count($CategoryArray) != count($Categories)) {
if (count($CategoryArray) !== count($Categories)) {
foreach ($CategoryArray as $Key => $Index) {
if (!isset($Categories[$Index-1])) {
if (!isset($Categories[$Index - 1])) {
unset($CategoryArray[$Key]);
}
}
@ -246,7 +246,7 @@
if (!empty($_GET['releases'])) {
$ReleaseArray = $_GET['releases'];
if (count($ReleaseArray) != count($ReleaseTypes)) {
if (count($ReleaseArray) !== count($ReleaseTypes)) {
foreach ($ReleaseArray as $Index => $Value) {
if (!isset($ReleaseTypes[$Value])) {
unset($ReleaseArray[$Index]);
@ -267,7 +267,7 @@
}
if (isset($_GET['year'])) {
if (is_number($_GET['year']) || $_GET['year'] == 0) {
if (is_number($_GET['year']) || $_GET['year'] === '0') {
$SS->set_filter('year', array($_GET['year']));
} else {
error(404);
@ -290,10 +290,10 @@
} else {
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');
$Way = ($CurrentSort === 'asc' ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC);
$NewSort = ($_GET['sort'] === 'asc' ? 'desc' : 'asc');
} else {
error(404);
}
@ -303,25 +303,25 @@
}
switch ($CurrentOrder) {
case 'votes' :
case 'votes':
$OrderBy = 'Votes';
break;
case 'bounty' :
case 'bounty':
$OrderBy = 'Bounty';
break;
case 'created' :
case 'created':
$OrderBy = 'TimeAdded';
break;
case 'lastvote' :
case 'lastvote':
$OrderBy = 'LastVote';
break;
case 'filled' :
case 'filled':
$OrderBy = 'TimeFilled';
break;
case 'year' :
case 'year':
$OrderBy = 'Year';
break;
default :
default:
$OrderBy = 'TimeAdded';
break;
}
@ -329,7 +329,7 @@
$SS->SetSortMode($Way, $OrderBy);
if (count($Queries) > 0) {
$Query = implode(' ',$Queries);
$Query = implode(' ', $Queries);
} else {
$Query = '';
}
@ -397,7 +397,7 @@
<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')) { ?>
@ -421,7 +421,7 @@
$x = 1;
reset($Categories);
foreach ($Categories as $CatKey => $CatName) {
if ($x % 8 == 0 || $x == 1) {
if ($x % 8 === 0 || $x === 1) {
?>
<tr class="cat_list">
<? } ?>
@ -430,7 +430,7 @@
<label for="cat_<?=($CatKey + 1) ?>"><?=$CatName?></label>
</td>
<?
if ($x % 7 == 0) {
if ($x % 7 === 0) {
?>
</tr>
<?
@ -443,10 +443,10 @@
<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) {
if ($i % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="releases[]" value="<?=$Key?>" id="release_<?=$Key?>"
@ -459,12 +459,12 @@
<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) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="formats[]" value="<?=$Key?>" id="format_<?=$Key?>"
@ -476,12 +476,12 @@
<tr id="bitrate_list">
<td class="label">Bitrates</td>
<td>
<input type="checkbox" id="toggle_bitrates" onchange="Toggle('bitrates', 0);"<?=(!$Submitted || !empty($BitrateArray) && count($BitrateArray) == count($Bitrates) ? ' checked="checked"' : '')?> />
<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"' : '') ?> />
<label for="bitrate_strict">Only specified</label>
<? foreach ($Bitrates as $Key => $Val) {
if ($Key % 8 == 0) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
@ -493,12 +493,12 @@
<tr id="media_list">
<td class="label">Media</td>
<td>
<input type="checkbox" id="toggle_media" onchange="Toggle('media', 0);"<?=(!$Submitted || !empty($MediaArray) && count($MediaArray) == count($Media) ? ' checked="checked"' : '')?> />
<input type="checkbox" id="toggle_media" onchange="Toggle('media', 0);"<?=(!$Submitted || !empty($MediaArray) && count($MediaArray) === count($Media) ? ' checked="checked"' : '')?> />
<label for="toggle_media">All</label>
<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) {
if ($Key % 8 === 0) {
echo '<br />';
} ?>
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
@ -523,16 +523,16 @@
<table id="request_table" class="request_table border" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr class="colhead_dark">
<td style="width: 38%;" class="nobr">
<strong>Request name</strong> / <a href="?order=year&amp;sort=<?=(($CurrentOrder == 'year') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Year</strong></a>
<strong>Request name</strong> / <a href="?order=year&amp;sort=<?=(($CurrentOrder === 'year') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Year</strong></a>
</td>
<td class="nobr">
<a href="?order=votes&amp;sort=<?=(($CurrentOrder == 'votes') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Votes</strong></a>
<a href="?order=votes&amp;sort=<?=(($CurrentOrder === 'votes') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Votes</strong></a>
</td>
<td class="nobr">
<a href="?order=bounty&amp;sort=<?=(($CurrentOrder == 'bounty') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Bounty</strong></a>
<a href="?order=bounty&amp;sort=<?=(($CurrentOrder === 'bounty') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Bounty</strong></a>
</td>
<td class="nobr">
<a href="?order=filled&amp;sort=<?=(($CurrentOrder == 'filled') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Filled</strong></a>
<a href="?order=filled&amp;sort=<?=(($CurrentOrder === 'filled') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Filled</strong></a>
</td>
<td class="nobr">
<strong>Filled by</strong>
@ -541,10 +541,10 @@
<strong>Requested by</strong>
</td>
<td class="nobr">
<a href="?order=created&amp;sort=<?=(($CurrentOrder == 'created') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Created</strong></a>
<a href="?order=created&amp;sort=<?=(($CurrentOrder === 'created') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Created</strong></a>
</td>
<td class="nobr">
<a href="?order=lastvote&amp;sort=<?=(($CurrentOrder == 'lastvote') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
<a href="?order=lastvote&amp;sort=<?=(($CurrentOrder === 'lastvote') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
</td>
</tr>
<? if ($NumResults == 0) { ?>
@ -608,17 +608,17 @@
$IsFilled = ($TorrentID != 0);
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>";
} elseif ($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>";
}
$Row = ($Row == 'a') ? 'b' : 'a';
$Row = ($Row === 'a') ? 'b' : 'a';
$Tags = $Request['Tags'];
?>

View File

@ -15,7 +15,7 @@ if (!empty($_GET['search'])) {
}
}
$TagMatcher = (!empty($_GET['tagmatcher']) && $_GET['tagmatcher'] == "any") ? "any" : "all";
$TagMatcher = (!empty($_GET['tagmatcher']) && $_GET['tagmatcher'] === 'any') ? 'any' : 'all';
if (!empty($_GET['tags'])) {
$Tags = explode(',', $_GET['tags']);
@ -27,7 +27,7 @@ if (!empty($_GET['tags'])) {
}
}
if ($TagMatcher == "any") {
if ($TagMatcher === 'any') {
$ExtraJoins[] = "LEFT JOIN requests_tags AS rt ON r.ID=rt.RequestID";
$ExtraJoins[] = "LEFT JOIN tags AS t ON t.ID=rt.TagID";
$Wheres[] = "t.Name IN ('".implode("', '", $TagNames)."')";
@ -47,10 +47,10 @@ if (!empty($_GET['filter_cat'])) {
if (!empty($_GET['releases'])) {
$ReleaseArray = $_GET['releases'];
if (count($ReleaseArray) != count($ReleaseTypes)) {
if (count($ReleaseArray) !== count($ReleaseTypes)) {
foreach ($ReleaseArray as $Index => $Value) {
if (is_number($Value)) {
$Wheres[] = "r.ReleaseType = ".$Value;
$Wheres[] = "r.ReleaseType = $Value";
} else {
error(0);
}
@ -60,7 +60,7 @@ if (!empty($_GET['releases'])) {
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 (array_key_exists($Index, $Formats)) {
@ -78,7 +78,7 @@ if (!empty($_GET['formats'])) {
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 (array_key_exists($Index, $Media)) {
@ -96,7 +96,7 @@ if (!empty($_GET['media'])) {
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 (array_key_exists($Index, $Bitrates)) {
@ -148,9 +148,9 @@ if (empty($_GET['order'])) {
} else {
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'];
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
$NewSort = ($_GET['sort'] === 'asc') ? 'desc' : 'asc';
} else {
error(404);
}
@ -162,31 +162,31 @@ if (empty($_GET['order'])) {
$CurrentURL = get_url(array('order', 'sort'));
switch ($CurrentOrder) {
case 'name' :
case 'name':
$OrderBy = "r.Title";
break;
case 'votes' :
case 'votes':
$OrderBy = "Votes";
break;
case 'bounty' :
case 'bounty':
$OrderBy = "Bounty";
break;
case 'filler' :
case 'filler':
$OrderBy = "r.FillerID";
break;
case 'requestor' :
case 'requestor':
$OrderBy = "r.UserID";
break;
case 'created' :
case 'created':
$OrderBy = "r.ID";
break;
case 'lastvote' :
case 'lastvote':
$OrderBy = "r.LastVote";
break;
case 'filled' :
case 'filled':
$OrderBy = "r.TimeFilled";
break;
default :
default:
$OrderBy = "r.ID";
break;
}
@ -239,9 +239,6 @@ $DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$PageLinks = get_pages($Page, $Results, REQUESTS_PER_PAGE, 11);
show_header($Title, 'requests');
?>
@ -272,8 +269,8 @@ show_header($Title, 'requests');
<td class="label">Tags (comma-separated):</td>
<td>
<input type="text" name="tags" size="60" value="<?=display_str(implode(', ', $TagNames))?>" />
<input type="radio" name="tagmatcher" value="any"<?=((empty($TagMatcher) || $TagMatcher == 'any') ? ' checked="checked"' : '') ?> />Any &nbsp;
<input type="radio" name="tagmatcher" value="all"<?=((!empty($TagMatcher) && $TagMatcher == 'all') ? ' checked="checked"' : '') ?> />All
<input type="radio" name="tagmatcher" value="any"<?=((empty($TagMatcher) || $TagMatcher === 'any') ? ' checked="checked"' : '') ?> />Any &nbsp;
<input type="radio" name="tagmatcher" value="all"<?=((!empty($TagMatcher) && $TagMatcher === 'all') ? ' checked="checked"' : '') ?> />All
</td>
</tr>
@ -298,7 +295,7 @@ show_header($Title, 'requests');
$x = 1;
reset($Categories);
foreach ($Categories as $CatKey => $CatName) {
if ($x % 8 == 0 || $x == 1) {
if ($x % 8 === 0 || $x === 1) {
?>
<tr class="cat_list">
<? } ?>
@ -306,9 +303,7 @@ foreach ($Categories as $CatKey => $CatName) {
<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>
<?
}
@ -321,13 +316,17 @@ foreach ($Categories as $CatKey => $CatName) {
<td class="label">Release Types</td>
<td>
<input type="checkbox" id="toggle_releases" onchange="Toggle('releases');" /> Toggle All
<? $i = 0;
<?
$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?>"
<?=(((!$Submitted) || !empty($ReleaseArray) && in_array($Key, $ReleaseArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
<? $i++;
<?
$i++;
} ?>
</td>
</tr>
@ -335,8 +334,11 @@ foreach ($Categories as $CatKey => $CatName) {
<td class="label">Formats</td>
<td>
<input type="checkbox" id="toggle_formats" onchange="Toggle('formats');" /> Toggle All
<? foreach ($Formats as $Key => $Val) {
if ($Key % 8 == 0) echo "<br />";?>
<?
foreach ($Formats as $Key => $Val) {
if ($Key % 8 === 0) {
echo "<br />";
} ?>
<input type="checkbox" name="formats[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($FormatArray) && in_array($Key, $FormatArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -347,8 +349,11 @@ foreach ($Categories as $CatKey => $CatName) {
<td class="label">Bitrates</td>
<td>
<input type="checkbox" id="toggle_bitrates" onchange="Toggle('bitrates');" /> Toggle All
<? foreach ($Bitrates as $Key => $Val) {
if ($Key % 8 == 0) echo "<br />";?>
<?
foreach ($Bitrates as $Key => $Val) {
if ($Key % 8 === 0) {
echo "<br />";
} ?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($BitrateArray) && in_array($Key, $BitrateArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -359,8 +364,11 @@ foreach ($Categories as $CatKey => $CatName) {
<td class="label">Media</td>
<td>
<input type="checkbox" id="toggle_media" onchange="Toggle('media');" /> Toggle All
<? foreach ($Media as $Key => $Val) {
if ($Key % 8 == 0) echo "<br />";?>
<?
foreach ($Media as $Key => $Val) {
if ($Key % 8 === 0) {
echo "<br />";
} ?>
<input type="checkbox" name="media[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($MediaArray) && in_array($Key, $MediaArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -381,26 +389,26 @@ foreach ($Categories as $CatKey => $CatName) {
<table id="request_table" class="request_table" cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
<tr class="colhead_dark">
<td style="width: 38%;">
<a href="requests.php?order=name&amp;sort=<?=(($CurrentOrder == 'name') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Request name</strong></a>
<a href="requests.php?order=name&amp;sort=<?=(($CurrentOrder === 'name') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Request name</strong></a>
</td>
<td>
<strong><a href="requests.php?order=votes&amp;sort=<?=(($CurrentOrder == 'votes') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>">Vote (20MB)</a></strong></td>
<strong><a href="requests.php?order=votes&amp;sort=<?=(($CurrentOrder === 'votes') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>">Vote (20MB)</a></strong></td>
<td>
<a href="requests.php?order=bounty&amp;sort=<?=(($CurrentOrder == 'bounty') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Bounty</strong></a>
<a href="requests.php?order=bounty&amp;sort=<?=(($CurrentOrder === 'bounty') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Bounty</strong></a>
</td>
<td>
<a href="requests.php?order=filled&amp;sort=<?=(($CurrentOrder == 'filled') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Filled</strong></a>
<a href="requests.php?order=filled&amp;sort=<?=(($CurrentOrder === 'filled') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Filled</strong></a>
<td>
<a href="requests.php?order=filler&amp;sort=<?=(($CurrentOrder == 'filler') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Filled by</strong></a>
<a href="requests.php?order=filler&amp;sort=<?=(($CurrentOrder === 'filler') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Filled by</strong></a>
</td>
<td>
<a href="requests.php?order=requestor&amp;sort=<?=(($CurrentOrder == 'requestor') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Requested by</strong></a>
<a href="requests.php?order=requestor&amp;sort=<?=(($CurrentOrder === 'requestor') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Requested by</strong></a>
</td>
<td>
<a href="requests.php?order=created&amp;sort=<?=(($CurrentOrder == 'created') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Created</strong></a>
<a href="requests.php?order=created&amp;sort=<?=(($CurrentOrder === 'created') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Created</strong></a>
</td>
<td>
<a href="requests.php?order=lastvote&amp;sort=<?=(($CurrentOrder == 'lastvote') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
<a href="requests.php?order=lastvote&amp;sort=<?=(($CurrentOrder === 'lastvote') ? $NewSort : 'asc')?>&amp;<?=$CurrentURL ?>"><strong>Last vote</strong></a>
</td>
</tr>
@ -410,7 +418,8 @@ foreach ($Categories as $CatKey => $CatName) {
Nothing found!
</td>
</tr>
<? } else {
<?
} else {
$Row = 'a';
foreach ($Requests as $Request) {
list($RequestID, $CategoryID, $Title, $Year, $Bounty, $Votes, $FillerID, $FillerName, $TorrentID, $TimeFilled, $RequestorID, $RequestorName, $TimeAdded, $LastVote) = $Request;
@ -418,17 +427,17 @@ foreach ($Categories as $CatKey => $CatName) {
$CategoryName = $Categories[$CategoryID - 1];
$IsFilled = ($TorrentID != 0);
if ($CategoryName == "Music") {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$ArtistLink = display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title [$Year]</a>";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$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');
$Row = (($Row === 'a') ? 'b' : 'a');
$Tags = Requests::get_tags($RequestID);
?>
@ -448,7 +457,8 @@ foreach ($Categories as $CatKey => $CatName) {
</td>
<td>
<?=$Votes?>
<? if (!$IsFilled && check_perms('site_vote')) { ?>
<?
if (!$IsFilled && check_perms('site_vote')) { ?>
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
&nbsp;&nbsp; <a href="javascript:Vote()" class="brackets"><strong>+</strong></a>
<? } ?>

View File

@ -18,21 +18,24 @@
error(403);
}
$URL = "https://" . SSL_SITE_URL . "/requests.php?action=view&id=$GroupID&postid=$PostID#post$PostID";
if ($Length != 'verbal') {
if ($Length !== 'verbal') {
$Time = ((int) $Length) * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - " . $Reason);
Tools::warn_user($UserID, $Time, "$URL - $Reason");
$Subject = 'You have received a warning';
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n$PrivateMessage";
$WarnTime = time_plus($Time);
$AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} else {
$Subject = 'You have received a verbal warning';
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n$PrivateMessage";
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
Tools::update_user_notes($UserID, $AdminComment);
}
$DB->query("
INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
INSERT INTO users_warnings_forums
(UserID, Comment)
VALUES
('$UserID', '" . db_string($AdminComment) . "')
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
@ -43,8 +46,8 @@
rc.RequestID,
rc.AddedTime
FROM requests_comments AS rc
WHERE rc.ID='".db_string($_POST['post'])."'");
list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record();
WHERE rc.ID = '".db_string($_POST['post'])."'");
list($OldBody, $AuthorID, $RequestID, $AddedTime) = $DB->next_record();
$DB->query("
SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page
@ -52,7 +55,7 @@
WHERE RequestID = $GroupID AND ID <= $PostID");
list($Page) = $DB->next_record();
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
if ($LoggedUser['ID'] !== $AuthorID && !check_perms('site_moderate_forums')) {
error(404);
}
if (!$DB->has_results()) {
@ -66,11 +69,11 @@
Body = '" . db_string($Body) . "',
EditedUserID = '".$LoggedUser['ID']."',
EditedTime = '".sqltime()."'
WHERE ID='".$PostID."'");
WHERE ID = '$PostID'");
// Update the cache
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
$Cache->begin_transaction("request_comments_$RequestID"."_catalogue_$CatalogueID");
$Cache->update_row($Key, array(
'ID'=>$PostID,
@ -84,10 +87,11 @@
$Cache->commit_transaction(0);
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('requests', $PostID, " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
INSERT INTO comments_edits
(Page, PostID, EditUser, EditTime, Body)
VALUES
('requests', $PostID, " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
header("Location: requests.php?id=$GroupID&postid=$PostID#post$PostID");
?>
;

View File

@ -26,7 +26,7 @@
$CategoryName = $Categories[$CategoryID - 1];
//Do we need to get artists?
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$FullName = $ArtistName.$Title;
@ -37,9 +37,9 @@
// Delete request, votes and tags
$DB->query("DELETE FROM requests WHERE ID='$RequestID'");
$DB->query("DELETE FROM requests_votes WHERE RequestID='$RequestID'");
$DB->query("DELETE FROM requests_tags WHERE RequestID='$RequestID'");
$DB->query("DELETE FROM requests WHERE ID = '$RequestID'");
$DB->query("DELETE FROM requests_votes WHERE RequestID = '$RequestID'");
$DB->query("DELETE FROM requests_tags WHERE RequestID = '$RequestID'");
$DB->query("
SELECT ArtistID
FROM requests_artists

View File

@ -68,7 +68,7 @@
}
}
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,25 +93,25 @@
if (!empty($OldTorrentID)) {
$Err = 'This request has already been filled.';
}
if ($RequestCategoryID != 0 && $TorrentCategoryID != $RequestCategoryID) {
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) {
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') {
//$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') !== false && !$HasLog) {
$Err = 'This request requires a log.';
}
@ -160,7 +160,7 @@
TimeFilled = '".sqltime()."'
WHERE ID = $RequestID");
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$FullName = $ArtistName.$Title;
@ -189,10 +189,10 @@
$Cache->delete_value('user_stats_'.$FillerID);
$Cache->delete_value('request_'.$RequestID);
$Cache->delete_value("user_stats_$FillerID");
$Cache->delete_value("request_$RequestID");
if ($GroupID) {
$Cache->delete_value('requests_group_'.$GroupID);
$Cache->delete_value("requests_group_$GroupID");
}
@ -209,5 +209,5 @@
$SS->UpdateAttributes('requests', array('torrentid', 'fillerid'), array($RequestID => array((int)$TorrentID, (int)$FillerID)));
Requests::update_sphinx_requests($RequestID);
header('Location: requests.php?action=view&id='.$RequestID);
header("Location: requests.php?action=view&id=$RequestID");
?>

View File

@ -5,11 +5,11 @@
authorize();
if ($_POST['action'] != 'takenew' && $_POST['action'] != 'takeedit') {
if ($_POST['action'] !== 'takenew' && $_POST['action'] !== 'takeedit') {
error(0);
}
$NewRequest = ($_POST['action'] == 'takenew');
$NewRequest = ($_POST['action'] === 'takenew');
if (!$NewRequest) {
$ReturnEdit = true;
@ -40,8 +40,8 @@
$CategoryName = $Categories[$CategoryID - 1];
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == 'Music' && $Year == 0)));
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID === '0') || ($CategoryName === 'Music' && $Year === '0')));
$CanEdit = ((!$IsFilled && $LoggedUser['ID'] === $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
if (!$CanEdit) {
error(403);
@ -103,7 +103,7 @@
$Description = trim($_POST['description']);
}
if ($CategoryName == "Music") {
if ($CategoryName === 'Music') {
if (empty($_POST['artists'])) {
$Err = 'You did not enter any artists.';
} else {
@ -117,7 +117,7 @@
$ReleaseType = $_POST['releasetype'];
if (empty($_POST['all_formats']) && count($_POST['formats']) != count($Formats)) {
if (empty($_POST['all_formats']) && count($_POST['formats']) !== count($Formats)) {
$FormatArray = $_POST['formats'];
if (count($FormatArray) < 1) {
$Err = 'You must require at least one format';
@ -126,7 +126,7 @@
$AllFormats = true;
}
if (empty($_POST['all_bitrates']) && count($_POST['bitrates']) != count($Bitrates)) {
if (empty($_POST['all_bitrates']) && count($_POST['bitrates']) !== count($Bitrates)) {
$BitrateArray = $_POST['bitrates'];
if (count($BitrateArray) < 1) {
$Err = 'You must require at least one bitrate';
@ -135,7 +135,7 @@
$AllBitrates = true;
}
if (empty($_POST['all_media']) && count($_POST['media']) != count($Media)) {
if (empty($_POST['all_media']) && count($_POST['media']) !== count($Media)) {
$MediaArray = $_POST['media'];
if (count($MediaArray) < 1) {
$Err = 'You must require at least one medium.';
@ -192,7 +192,7 @@
} else {
$Err = 'The torrent group, if entered, must correspond to a music torrent group on the site.';
}
} elseif ($_POST['groupid'] == '0') {
} elseif ($_POST['groupid'] === '0') {
$GroupID = 0;
}
@ -214,7 +214,7 @@
}
}
if ($CategoryName == 'Music' || $CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
if ($CategoryName === 'Music' || $CategoryName === 'Audiobooks' || $CategoryName === 'Comedy') {
if (empty($_POST['year'])) {
$Err = 'You forgot to enter the year!';
} else {
@ -234,7 +234,7 @@
//For refilling on error
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$MainArtistCount = 0;
$ArtistNames = array();
$ArtistForm = array(
@ -243,10 +243,10 @@
3 => array()
);
for ($i = 0, $il = count($Artists); $i < $il; $i++) {
if (trim($Artists[$i]) != '') {
if (trim($Artists[$i]) !== '') {
if (!in_array($Artists[$i], $ArtistNames)) {
$ArtistForm[$Importance[$i]][] = array('name' => trim($Artists[$i]));
if (in_array($Importance[$i], array(1,4,5,6))) {
if (in_array($Importance[$i], array(1, 4, 5, 6))) {
$MainArtistCount++;
}
$ArtistNames[] = trim($Artists[$i]);
@ -263,14 +263,14 @@
if (!empty($Err)) {
error($Err);
$Div = $_POST['unit'] == 'mb' ? 1024 * 1024 : 1024 * 1024 * 1024;
$Div = $_POST['unit'] === 'mb' ? 1024 * 1024 : 1024 * 1024 * 1024;
$Bounty /= $Div;
include(SERVER_ROOT.'/sections/requests/new_edit.php');
die();
}
//Databasify the input
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
if (empty($AllBitrates)) {
foreach ($BitrateArray as $Index => $MasterIndex) {
if (array_key_exists($Index, $Bitrates)) {
@ -325,7 +325,7 @@
}
}
if ($NeedCue) {
if ($LogCue != '') {
if ($LogCue !== '') {
$LogCue .= ' + Cue';
} else {
$LogCue = 'Cue';
@ -334,7 +334,7 @@
}
//Query time!
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
if ($NewRequest) {
$DB->query('
INSERT INTO requests (
@ -363,7 +363,7 @@
LogCue = '$LogCue',
GroupID = '$GroupID',
OCLC = '".db_string($OCLC)."'
WHERE ID = ".$RequestID);
WHERE ID = $RequestID");
// We need to be able to delete artists / tags
$DB->query("
@ -489,7 +489,7 @@
WHERE RequestID = $RequestID");
}
if ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
if ($CategoryName === 'Audiobooks' || $CategoryName === 'Comedy') {
//These types require a year field.
if ($NewRequest) {
$DB->query("INSERT INTO requests (
@ -577,7 +577,7 @@
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$Announce = "\"$Title\" - ".Artists::display_artists($ArtistForm, false, false).' https://'.SSL_SITE_URL."/requests.php?action=view&id=$RequestID - ".implode(' ', $Tags);
} else {
$Announce = "\"$Title\" - https://".SSL_SITE_URL."/requests.php?action=view&id=$RequestID - ".implode(' ', $Tags);

View File

@ -22,8 +22,8 @@
WHERE r.ID = $RequestID");
list($CategoryID, $UserID, $FillerID, $Title, $Uploaded, $GroupID) = $DB->next_record();
if ((($LoggedUser['ID'] != $UserID && $LoggedUser['ID'] != $FillerID) && !check_perms('site_moderate_requests')) || $FillerID == 0) {
error(403);
if ((($LoggedUser['ID'] !== $UserID && $LoggedUser['ID'] !== $FillerID) && !check_perms('site_moderate_requests')) || $FillerID === '0') {
error(403);
}
// Unfill
@ -37,7 +37,7 @@
$CategoryName = $Categories[$CategoryID - 1];
if ($CategoryName == 'Music') {
if ($CategoryName === 'Music') {
$ArtistForm = Requests::get_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$FullName = $ArtistName.$Title;
@ -67,7 +67,7 @@
$Cache->delete_value("user_stats_$FillerID");
if ($UserID != $LoggedUser['ID']) {
if ($UserID !== $LoggedUser['ID']) {
Misc::send_pm($UserID, 0, 'A request you created has been unfilled', "The request \"[url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=$RequestID]".$FullName."[/url]\" was unfilled by [url=https://".SSL_SITE_URL.'/user.php?id='.$LoggedUser['ID'].']'.$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']);
}

View File

@ -29,7 +29,7 @@
WHERE ID = $RequestID");
list($Filled) = $DB->next_record();
if ($LoggedUser['BytesUploaded'] >= $Amount && $Filled == 0) {
if ($LoggedUser['BytesUploaded'] >= $Amount && $Filled === '0') {
// Create vote!
$DB->query("

View File

@ -16,7 +16,7 @@
rc.RequestID,
rc.AddedTime
FROM requests_comments AS rc
WHERE rc.ID='$PostID'");
WHERE rc.ID = '$PostID'");
list($PostBody) = $DB -> next_record();
View::show_header('Warn User');
@ -27,7 +27,7 @@
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
</div>
<div class="thin box pad">
<form class="create_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
<form class="create_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled = true;" method="post">
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="hidden" name="postid" value="<?=$PostID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />