Empty commit

This commit is contained in:
Git 2013-04-19 08:00:55 +00:00
parent 792f5077cb
commit ba33634e19
77 changed files with 2361 additions and 1853 deletions

51
api.php
View File

@ -1,10 +1,10 @@
<? <?
/*-- API Start Class -----------------------------------*/ /*-- API Start Class -------------------------------*/
/*------------------------------------------------------*/ /*--------------------------------------------------*/
/* Simplified version of script_start, used for the */ /* Simplified version of script_start, used for the */
/* site API calls */ /* site API calls */
/*------------------------------------------------------*/ /*--------------------------------------------------*/
/********************************************************/ /****************************************************/
$ScriptStartTime=microtime(true); //To track how long a page takes to create $ScriptStartTime=microtime(true); //To track how long a page takes to create
@ -41,47 +41,58 @@ function error($Code) {
function make_secret($Length = 32) { function make_secret($Length = 32) {
$Secret = ''; $Secret = '';
$Chars='abcdefghijklmnopqrstuvwxyz0123456789'; $Chars='abcdefghijklmnopqrstuvwxyz0123456789';
for($i=0; $i<$Length; $i++) { for ($i = 0; $i < $Length; $i++) {
$Rand = mt_rand(0, strlen($Chars)-1); $Rand = mt_rand(0, strlen($Chars) - 1);
$Secret .= substr($Chars, $Rand, 1); $Secret .= substr($Chars, $Rand, 1);
} }
return str_shuffle($Secret); return str_shuffle($Secret);
} }
function is_number($Str) { function is_number($Str) {
if ($Str < 0) { return false; } if ($Str < 0) {
return false;
}
// We're converting input to a int, then string and comparing to original // We're converting input to a int, then string and comparing to original
return ($Str == strval(intval($Str)) ? true : false); return ($Str == strval(intval($Str)) ? true : false);
} }
function display_str($Str) { function display_str($Str) {
if ($Str!="") { if ($Str != '') {
$Str=make_utf8($Str); $Str = make_utf8($Str);
$Str=mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8"); $Str = mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
$Str=preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&amp;",$Str); $Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&amp;",$Str);
$Replace = array( $Replace = array(
"'",'"',"<",">", "'",'"',"<",">",
'&#128;','&#130;','&#131;','&#132;','&#133;','&#134;','&#135;','&#136;','&#137;','&#138;','&#139;','&#140;','&#142;','&#145;','&#146;','&#147;','&#148;','&#149;','&#150;','&#151;','&#152;','&#153;','&#154;','&#155;','&#156;','&#158;','&#159;' '&#128;','&#130;','&#131;','&#132;','&#133;','&#134;','&#135;','&#136;','&#137;','&#138;','&#139;','&#140;','&#142;','&#145;','&#146;','&#147;','&#148;','&#149;','&#150;','&#151;','&#152;','&#153;','&#154;','&#155;','&#156;','&#158;','&#159;'
); );
$With=array( $With = array(
'&#39;','&quot;','&lt;','&gt;', '&#39;','&quot;','&lt;','&gt;',
'&#8364;','&#8218;','&#402;','&#8222;','&#8230;','&#8224;','&#8225;','&#710;','&#8240;','&#352;','&#8249;','&#338;','&#381;','&#8216;','&#8217;','&#8220;','&#8221;','&#8226;','&#8211;','&#8212;','&#732;','&#8482;','&#353;','&#8250;','&#339;','&#382;','&#376;' '&#8364;','&#8218;','&#402;','&#8222;','&#8230;','&#8224;','&#8225;','&#710;','&#8240;','&#352;','&#8249;','&#338;','&#381;','&#8216;','&#8217;','&#8220;','&#8221;','&#8226;','&#8211;','&#8212;','&#732;','&#8482;','&#353;','&#8250;','&#339;','&#382;','&#376;'
); );
$Str=str_replace($Replace,$With,$Str); $Str = str_replace($Replace,$With,$Str);
} }
return $Str; return $Str;
} }
function make_utf8($Str) { function make_utf8($Str) {
if ($Str!="") { if ($Str != '') {
if (is_utf8($Str)) { $Encoding="UTF-8"; } if (is_utf8($Str)) {
if (empty($Encoding)) { $Encoding=mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); } $Encoding = 'UTF-8';
if (empty($Encoding)) { $Encoding="ISO-8859-1"; } }
if ($Encoding=="UTF-8") { return $Str; } if (empty($Encoding)) {
else { return @mb_convert_encoding($Str,"UTF-8",$Encoding); } $Encoding = mb_detect_encoding($Str,'UTF-8, ISO-8859-1');
}
if (empty($Encoding)) {
$Encoding = 'ISO-8859-1';
}
if ($Encoding == 'UTF-8') {
return $Str;
} else {
return @mb_convert_encoding($Str,'UTF-8',$Encoding);
}
} }
} }
@ -101,7 +112,7 @@ function is_utf8($Str) {
function display_array($Array, $Escape = array()) { function display_array($Array, $Escape = array()) {
foreach ($Array as $Key => $Val) { foreach ($Array as $Key => $Val) {
if((!is_array($Escape) && $Escape == true) || !in_array($Key, $Escape)) { if ((!is_array($Escape) && $Escape == true) || !in_array($Key, $Escape)) {
$Array[$Key] = display_str($Val); $Array[$Key] = display_str($Val);
} }
} }

View File

@ -3,7 +3,7 @@ class IRC_DB extends DB_MYSQL {
function halt($Msg) { function halt($Msg) {
global $Bot; global $Bot;
global $DB; global $DB;
$Bot->send_to($Bot->get_channel(),'The database is currently unavailable try again later'); $Bot->send_to($Bot->get_channel(),'The database is currently unavailable; try again later.');
} }
} }

View File

@ -113,7 +113,7 @@
} }
//Handles escaping //Handles escaping
function db_string($String,$DisableWildcards=false) { function db_string($String, $DisableWildcards = false) {
global $DB; global $DB;
//Escape //Escape
$String = $DB->escape_str($String); $String = $DB->escape_str($String);
@ -167,12 +167,12 @@ function __construct($Database = SQLDB, $User = SQLLOGIN, $Pass = SQLPASS, $Serv
function halt($Msg) { function halt($Msg) {
global $LoggedUser, $Cache, $Debug, $argv; global $LoggedUser, $Cache, $Debug, $argv;
$DBError='MySQL: '.strval($Msg).' SQL error: '.strval($this->Errno).' ('.strval($this->Error).')'; $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) { /*if ($this->Errno == 1194) {
preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches); preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches);
} */ } */
$Debug->analysis('!dev DB Error',$DBError,3600*24); $Debug->analysis('!dev DB Error', $DBError, 3600 * 24);
if (DEBUG_MODE || check_perms('site_debug') || isset($argv[1])) { if (DEBUG_MODE || check_perms('site_debug') || isset($argv[1])) {
echo '<pre>'.display_str($DBError).'</pre>'; echo '<pre>'.display_str($DBError).'</pre>';
if (DEBUG_MODE || check_perms('site_debug')) { if (DEBUG_MODE || check_perms('site_debug')) {
@ -195,24 +195,24 @@ function connect() {
} }
} }
function query($Query,$AutoHandle=1) { function query($Query, $AutoHandle = 1) {
global $LoggedUser, $Debug; global $LoggedUser, $Debug;
$QueryStartTime=microtime(true); $QueryStartTime = microtime(true);
$this->connect(); $this->connect();
//In the event of a mysql deadlock, we sleep allowing mysql time to unlock then attempt again for a maximum of 5 tries // In the event of a MySQL deadlock, we sleep allowing MySQL time to unlock, then attempt again for a maximum of 5 tries
for($i = 1; $i < 6; $i++) { for ($i = 1; $i < 6; $i++) {
$this->QueryID = mysqli_query($this->LinkID,$Query); $this->QueryID = mysqli_query($this->LinkID, $Query);
if (!in_array(mysqli_errno($this->LinkID), array(1213, 1205))) { if (!in_array(mysqli_errno($this->LinkID), array(1213, 1205))) {
break; break;
} }
$Debug->analysis('Non-Fatal Deadlock:',$Query,3600*24); $Debug->analysis('Non-Fatal Deadlock:', $Query, 3600 * 24);
trigger_error("Database deadlock, attempt $i"); trigger_error("Database deadlock, attempt $i");
sleep($i*rand(2, 5)); // Wait longer as attempts increase sleep($i * rand(2, 5)); // Wait longer as attempts increase
} }
$QueryEndTime=microtime(true); $QueryEndTime = microtime(true);
$this->Queries[]=array(display_str($Query),($QueryEndTime-$QueryStartTime)*1000); $this->Queries[] = array(display_str($Query), ($QueryEndTime - $QueryStartTime) * 1000);
$this->Time+=($QueryEndTime-$QueryStartTime)*1000; $this->Time += ($QueryEndTime-$QueryStartTime) * 1000;
if (!$this->QueryID) { if (!$this->QueryID) {
$this->Errno = mysqli_errno($this->LinkID); $this->Errno = mysqli_errno($this->LinkID);
@ -229,12 +229,14 @@ function query($Query,$AutoHandle=1) {
/* /*
if ($QueryType == 'DELETE' || $QueryType == 'UPDATE') { if ($QueryType == 'DELETE' || $QueryType == 'UPDATE') {
if ($this->affected_rows() > 50) { if ($this->affected_rows() > 50) {
$Debug->analysis($this->affected_rows().' rows altered:',$Query,3600*24); $Debug->analysis($this->affected_rows().' rows altered:', $Query, 3600 * 24);
} }
} }
*/ */
$this->Row = 0; $this->Row = 0;
if ($AutoHandle) { return $this->QueryID; } if ($AutoHandle) {
return $this->QueryID;
}
} }
function query_unb($Query) { function query_unb($Query) {

View File

@ -34,7 +34,7 @@ public static function site_ban_ip($IP) {
* @return string the long it represents. * @return string the long it represents.
*/ */
public static function ip_to_unsigned($IP) { public static function ip_to_unsigned($IP) {
return sprintf("%u", ip2long($IP)); return sprintf('%u', ip2long($IP));
} }
/** /**
@ -71,13 +71,12 @@ public static function geoip($IP) {
* @param $IP the IP to get the hostname for * @param $IP the IP to get the hostname for
* @return hostname fetched * @return hostname fetched
*/ */
public static function get_host_by_ip($IP) public static function get_host_by_ip($IP) {
{
$testar = explode('.',$IP); $testar = explode('.',$IP);
if (count($testar)!=4) { if (count($testar) != 4) {
return $IP; return $IP;
} }
for ($i=0;$i<4;++$i) { for ($i = 0; $i < 4; ++$i) {
if (!is_numeric($testar[$i])) { if (!is_numeric($testar[$i])) {
return $IP; return $IP;
} }
@ -206,7 +205,9 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
public static function warn_user($UserID, $Duration, $Reason) { public static function warn_user($UserID, $Duration, $Reason) {
global $LoggedUser, $DB, $Cache, $Time; global $LoggedUser, $DB, $Cache, $Time;
$DB->query("SELECT Warned FROM users_info $DB->query("
SELECT Warned
FROM users_info
WHERE UserID=".$UserID." WHERE UserID=".$UserID."
AND Warned <> '0000-00-00 00:00:00'"); AND Warned <> '0000-00-00 00:00:00'");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
@ -215,10 +216,10 @@ public static function warn_user($UserID, $Duration, $Reason) {
$NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration); $NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration);
Misc::send_pm($UserID, 0, Misc::send_pm($UserID, 0,
"You have received multiple warnings.", 'You have received multiple warnings.',
"When you received your latest warning (Set to expire on ".date("Y-m-d", (time() + $Duration))."), you already had a different warning (Set to expire on ".date("Y-m-d", strtotime($OldDate)).").\n\n Due to this collision, your warning status will now expire at ".$NewExpDate."."); "When you received your latest warning (set to expire on ".date('Y-m-d', (time() + $Duration)).'), you already had a different warning (set to expire on '.date('Y-m-d', strtotime($OldDate)).").\n\n Due to this collision, your warning status will now expire at ".$NewExpDate.'.');
$AdminComment = date("Y-m-d").' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n"; $AdminComment = date('Y-m-d').' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET $DB->query('UPDATE users_info SET
Warned=\''.db_string($NewExpDate).'\', Warned=\''.db_string($NewExpDate).'\',
@ -233,7 +234,7 @@ public static function warn_user($UserID, $Duration, $Reason) {
$Cache->update_row(false, array('Warned' => $WarnTime)); $Cache->update_row(false, array('Warned' => $WarnTime));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n"; $AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
$DB->query('UPDATE users_info SET $DB->query('UPDATE users_info SET
Warned=\''.db_string($WarnTime).'\', Warned=\''.db_string($WarnTime).'\',
@ -254,6 +255,5 @@ public static function update_user_notes($UserID, $AdminComment) {
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment) AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
WHERE UserID=\''.db_string($UserID).'\''); WHERE UserID=\''.db_string($UserID).'\'');
} }
} }
?> ?>

View File

@ -534,7 +534,7 @@ public static function get_bookmarks ($UserID)
} }
/** /**
* Generate HTML for a user's avatar or just return the avatar url * Generate HTML for a user's avatar or just return the avatar URL
* @param unknown $Avatar * @param unknown $Avatar
* @param unknown $Username * @param unknown $Username
* @param unknown $Setting * @param unknown $Setting
@ -544,62 +544,62 @@ public static function get_bookmarks ($UserID)
*/ */
public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $ReturnHTML = True) { public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $ReturnHTML = True) {
global $LoggedUser; global $LoggedUser;
//case 1 is avatars disabled // case 1 is avatars disabled
switch($Setting) { switch ($Setting) {
case 0: case 0:
if (!empty($Avatar)) { if (!empty($Avatar)) {
$ToReturn = $ReturnHTML ? "<img src='$Avatar' width='$Size' style='max-height:400px;' alt='$Username avatar' />" : $Avatar; $ToReturn = $ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar;
} else { } else {
$URL = STATIC_SERVER."common/avatars/default.png"; $URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = $ReturnHTML ? "<img src='$URL' width='$Size' style='max-height:400px;' alt='Default Avatar'/>" : $URL; $ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
} }
break; break;
case 2: case 2:
$ShowAvatar = True; $ShowAvatar = True;
case 3: case 3:
switch($LoggedUser['Identicons']) { switch ($LoggedUser['Identicons']) {
case 0: case 0:
$Type = "identicon"; $Type = 'identicon';
break; break;
case 1: case 1:
$Type = "monsterid"; $Type = 'monsterid';
break; break;
case 2: case 2:
$Type = "wavatar"; $Type = 'wavatar';
break; break;
case 3: case 3:
$Type = "retro"; $Type = 'retro';
break; break;
case 4: case 4:
$Type = "1"; $Type = '1';
$Robot = True; $Robot = True;
break; break;
case 5: case 5:
$Type = "2"; $Type = '2';
$Robot = True; $Robot = True;
break; break;
case 6: case 6:
$Type = "3"; $Type = '3';
$Robot = True; $Robot = True;
break; break;
default: default:
$Type = "identicon"; $Type = 'identicon';
} }
$Rating = "pg"; $Rating = 'pg';
if (!$Robot) { if (!$Robot) {
$URL = "https://secure.gravatar.com/avatar/".md5(strtolower(trim($Username)))."?s=$Size&d=$Type&r=$Rating"; $URL = 'https://secure.gravatar.com/avatar/'.md5(strtolower(trim($Username)))."?s=$Size&amp;d=$Type&amp;r=$Rating";
} else { } else {
$URL = "https://static1.robohash.org/".md5($Username)."?set=set".$Type."&size=".$Size."x".$Size; $URL = 'https://robohash.org/'.md5($Username).'?set=set'.$Type.'&amp;size='.$Size.'x'.$Size;
} }
if ($ShowAvatar == True && !empty($Avatar)) { if ($ShowAvatar == True && !empty($Avatar)) {
$ToReturn = $ReturnHTML ? "<img src='$Avatar' width='$Size' style='max-height:400px;' alt='$Username avatar' />" : $Avatar; $ToReturn = $ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar;
} else { } else {
$ToReturn = $ReturnHTML ? "<img src='$URL' width='$Size' style='max-height:400px;' alt='Default Avatar'/>" : $URL; $ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
} }
break; break;
default: default:
$URL = STATIC_SERVER."common/avatars/default.png"; $URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = $ReturnHTML ? "<img src='$URL' width='$Size' style='max-height:400px;' alt='Default Avatar'/>" : $URL; $ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
} }
return $ToReturn; return $ToReturn;
} }

View File

@ -7,7 +7,7 @@
** user custom permissions form. ** ** user custom permissions form. **
********************************************************************************/ ********************************************************************************/
$PermissionsArray = array( $PermissionsArray = array(
'site_leech' => 'Can leech (Does this work?).', 'site_leech' => 'Can leech (Does this work?).',
'site_upload' => 'Upload torrent access.', 'site_upload' => 'Upload torrent access.',
'site_vote' => 'Request vote access.', 'site_vote' => 'Request vote access.',
@ -113,7 +113,7 @@
'artist_edit_vanityhouse' => 'Can mark artists as part of Vanity House.', 'artist_edit_vanityhouse' => 'Can mark artists as part of Vanity House.',
'site_tag_aliases_read' => 'Can view the list of tag aliases.' 'site_tag_aliases_read' => 'Can view the list of tag aliases.'
); );
function permissions_form(){ ?> function permissions_form(){ ?>
<div class="permissions"> <div class="permissions">

View File

@ -539,7 +539,7 @@ function _Send ( $handle, $data, $length )
/// enter mbstring workaround mode /// enter mbstring workaround mode
function _MBPush () function _MBPush ()
{ {
$this->_mbenc = ""; $this->_mbenc = '';
if ( ini_get ( "mbstring.func_overload" ) & 2 ) if ( ini_get ( "mbstring.func_overload" ) & 2 )
{ {
$this->_mbenc = mb_internal_encoding(); $this->_mbenc = mb_internal_encoding();
@ -931,10 +931,10 @@ function ResetFilters ()
/// clear groupby settings (for multi-queries) /// clear groupby settings (for multi-queries)
function ResetGroupBy () function ResetGroupBy ()
{ {
$this->_groupby = ""; $this->_groupby = '';
$this->_groupfunc = SPH_GROUPBY_DAY; $this->_groupfunc = SPH_GROUPBY_DAY;
$this->_groupsort = "@group desc"; $this->_groupsort = "@group desc";
$this->_groupdistinct= ""; $this->_groupdistinct= '';
} }
/// clear all attribute value overrides (for multi-queries) /// clear all attribute value overrides (for multi-queries)

View File

@ -4,14 +4,14 @@ function compare($X, $Y){
return($Y['count'] - $X['count']); return($Y['count'] - $X['count']);
} }
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/sections/requests/functions.php'); include(SERVER_ROOT.'/sections/requests/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT; $Text = new TEXT;
$ArtistID = $_GET['id']; $ArtistID = $_GET['id'];
if(!is_number($ArtistID)) { if (!is_number($ArtistID)) {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die(); die();
} }
@ -29,7 +29,7 @@ function compare($X, $Y){
} }
} }
if(!empty($_GET['revisionid'])) { // if they're viewing an old revision if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
$RevisionID=$_GET['revisionid']; $RevisionID=$_GET['revisionid'];
if (!is_number($RevisionID)) { if (!is_number($RevisionID)) {
error(0); error(0);
@ -39,7 +39,7 @@ function compare($X, $Y){
$Data = $Cache->get_value('artist_'.$ArtistID); $Data = $Cache->get_value('artist_'.$ArtistID);
$RevisionID = false; $RevisionID = false;
} }
if($Data) { if ($Data) {
if (!is_array($Data)) { if (!is_array($Data)) {
$Data = unserialize($Data); $Data = unserialize($Data);
} }
@ -47,7 +47,8 @@ function compare($X, $Y){
} else { } else {
if ($RevisionID) { if ($RevisionID) {
$sql = "SELECT $sql = "
SELECT
a.Name, a.Name,
wiki.Image, wiki.Image,
wiki.body, wiki.body,
@ -56,7 +57,8 @@ function compare($X, $Y){
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
WHERE wiki.RevisionID='$RevisionID' "; WHERE wiki.RevisionID='$RevisionID' ";
} else { } else {
$sql = "SELECT $sql = "
SELECT
a.Name, a.Name,
wiki.Image, wiki.Image,
wiki.body, wiki.body,
@ -68,7 +70,7 @@ function compare($X, $Y){
$sql .= " GROUP BY a.ArtistID"; $sql .= " GROUP BY a.ArtistID";
$DB->query($sql); $DB->query($sql);
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
} }
@ -78,7 +80,8 @@ function compare($X, $Y){
// Requests // Requests
$Requests = $Cache->get_value('artists_requests_'.$ArtistID); $Requests = $Cache->get_value('artists_requests_'.$ArtistID);
if (!is_array($Requests)) { if (!is_array($Requests)) {
$DB->query("SELECT $DB->query("
SELECT
r.ID, r.ID,
r.CategoryID, r.CategoryID,
r.Title, r.Title,
@ -94,7 +97,7 @@ function compare($X, $Y){
GROUP BY r.ID GROUP BY r.ID
ORDER BY Votes DESC"); ORDER BY Votes DESC");
if($DB->record_count() > 0) { if ($DB->record_count() > 0) {
$Requests = $DB->to_array(); $Requests = $DB->to_array();
} else { } else {
$Requests = array(); $Requests = array();
@ -104,7 +107,8 @@ function compare($X, $Y){
$NumRequests = count($Requests); $NumRequests = count($Requests);
if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) { if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) {
$DB->query("SELECT $DB->query("
SELECT
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
FROM torrents_artists AS ta FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID JOIN torrents_group AS tg ON tg.ID=ta.GroupID
@ -129,38 +133,38 @@ function compare($X, $Y){
//Get list of used release types //Get list of used release types
$UsedReleases = array(); $UsedReleases = array();
foreach($TorrentList as $GroupID=>$Group) { foreach ($TorrentList as $GroupID=>$Group) {
if($Importances[$GroupID]['Importance'] == '2') { if ($Importances[$GroupID]['Importance'] == '2') {
$TorrentList[$GroupID]['ReleaseType'] = 1024; $TorrentList[$GroupID]['ReleaseType'] = 1024;
$GuestAlbums = true; $GuestAlbums = true;
} }
if($Importances[$GroupID]['Importance'] == '3') { if ($Importances[$GroupID]['Importance'] == '3') {
$TorrentList[$GroupID]['ReleaseType'] = 1023; $TorrentList[$GroupID]['ReleaseType'] = 1023;
$RemixerAlbums = true; $RemixerAlbums = true;
} }
if($Importances[$GroupID]['Importance'] == '4') { if ($Importances[$GroupID]['Importance'] == '4') {
$TorrentList[$GroupID]['ReleaseType'] = 1022; $TorrentList[$GroupID]['ReleaseType'] = 1022;
$ComposerAlbums = true; $ComposerAlbums = true;
} }
if($Importances[$GroupID]['Importance'] == '7') { if ($Importances[$GroupID]['Importance'] == '7') {
$TorrentList[$GroupID]['ReleaseType'] = 1021; $TorrentList[$GroupID]['ReleaseType'] = 1021;
$ProducerAlbums = true; $ProducerAlbums = true;
} }
if(!in_array($TorrentList[$GroupID]['ReleaseType'], $UsedReleases)) { if (!in_array($TorrentList[$GroupID]['ReleaseType'], $UsedReleases)) {
$UsedReleases[] = $TorrentList[$GroupID]['ReleaseType']; $UsedReleases[] = $TorrentList[$GroupID]['ReleaseType'];
} }
} }
if(!empty($GuestAlbums)) { if (!empty($GuestAlbums)) {
$ReleaseTypes[1024] = "Guest Appearance"; $ReleaseTypes[1024] = "Guest Appearance";
} }
if(!empty($RemixerAlbums)) { if (!empty($RemixerAlbums)) {
$ReleaseTypes[1023] = "Remixed By"; $ReleaseTypes[1023] = "Remixed By";
} }
if(!empty($ComposerAlbums)) { if (!empty($ComposerAlbums)) {
$ReleaseTypes[1022] = "Composition"; $ReleaseTypes[1022] = "Composition";
} }
if(!empty($ProducerAlbums)) { if (!empty($ProducerAlbums)) {
$ReleaseTypes[1021] = "Produced By"; $ReleaseTypes[1021] = "Produced By";
} }
@ -176,8 +180,8 @@ function compare($X, $Y){
$TagList = explode(' ',str_replace('_','.',$TagList)); $TagList = explode(' ',str_replace('_','.',$TagList));
// $Tags array is for the sidebar on the right // $Tags array is for the sidebar on the right
foreach($TagList as $Tag) { foreach ($TagList as $Tag) {
if(!isset($Tags[$Tag])) { if (!isset($Tags[$Tag])) {
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1); $Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
} else { } else {
$Tags[$Tag]['count']++; $Tags[$Tag]['count']++;
@ -231,7 +235,7 @@ function compare($X, $Y){
} }
$JsonSimilar = array(); $JsonSimilar = array();
if(empty($SimilarArray)) { if (empty($SimilarArray)) {
$DB->query(" $DB->query("
SELECT SELECT
s2.ArtistID, s2.ArtistID,

View File

@ -583,9 +583,9 @@ function header_link($SortKey,$DefaultWay = 'desc') {
); );
} }
} else { } else {
$DisplayName=''; $DisplayName = '';
} }
if ($GroupResults && (count($Torrents)>1 || isset($GroupedCategories[$CategoryID-1]))) { if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID-1]))) {
// These torrents are in a group // These torrents are in a group
$LastRemasterYear = '-'; $LastRemasterYear = '-';
$LastRemasterTitle = ''; $LastRemasterTitle = '';
@ -702,7 +702,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
'status' => 'success', 'status' => 'success',
'response' => array( 'response' => array(
'currentPage' => intval($Page), 'currentPage' => intval($Page),
'pages' => ceil($TorrentCount/TORRENTS_PER_PAGE), 'pages' => ceil($TorrentCount / TORRENTS_PER_PAGE),
'results' => $JsonGroups 'results' => $JsonGroups
) )
) )

View File

@ -146,8 +146,7 @@
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
} }
function pullmediainfo($Array) function pullmediainfo($Array) {
{
$NewArray = array(); $NewArray = array();
foreach ($Array as $Item) { foreach ($Array as $Item) {
$NewArray[] = array( $NewArray[] = array(

View File

@ -1,7 +1,6 @@
<? <?
//calculate ratio //calculate ratio
//returns 0 for DNE and -1 for infiinity, because we dont want strings being returned for a numeric value in our java //returns 0 for DNE and -1 for infinity, because we don't want strings being returned for a numeric value in our java
$Ratio = 0; $Ratio = 0;
if ($LoggedUser['BytesUploaded'] == 0 && $LoggedUser['BytesDownloaded'] == 0) { if ($LoggedUser['BytesUploaded'] == 0 && $LoggedUser['BytesDownloaded'] == 0) {
$Ratio = 0; $Ratio = 0;
@ -23,7 +22,6 @@
$Cache->cache_value('news_latest_id', $CurrentNews, 0); $Cache->cache_value('news_latest_id', $CurrentNews, 0);
} }
$NewMessages = $Cache->get_value('inbox_new_' . $LoggedUser['ID']); $NewMessages = $Cache->get_value('inbox_new_' . $LoggedUser['ID']);
if ($NewMessages === false) { if ($NewMessages === false) {
$DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='" . $LoggedUser['ID'] . "' AND UnRead = '1' AND InInbox = '1'"); $DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='" . $LoggedUser['ID'] . "' AND UnRead = '1' AND InInbox = '1'");
@ -36,7 +34,7 @@
if ($NewNotifications === false) { if ($NewNotifications === false) {
$DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'"); $DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'");
list($NewNotifications) = $DB->next_record(); list($NewNotifications) = $DB->next_record();
/* if($NewNotifications && !check_perms('site_torrents_notify')) { /* if ($NewNotifications && !check_perms('site_torrents_notify')) {
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'"); $DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'"); $DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
} */ } */
@ -78,7 +76,8 @@
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
} }
$DB->query("SELECT COUNT(s.TopicID) $DB->query("
SELECT COUNT(s.TopicID)
FROM users_subscriptions AS s FROM users_subscriptions AS s
JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID
JOIN forums_topics AS t ON l.TopicID = t.ID JOIN forums_topics AS t ON l.TopicID = t.ID
@ -87,7 +86,7 @@
AND l.PostID < t.LastPostID AND l.PostID < t.LastPostID
AND s.UserID = " . $LoggedUser['ID'] . AND s.UserID = " . $LoggedUser['ID'] .
(!empty($RestrictedForums) ? " (!empty($RestrictedForums) ? "
AND f.ID NOT IN ('" . $RestrictedForums . "')" : "")); AND f.ID NOT IN ('" . $RestrictedForums . "')" : ''));
list($NewSubscriptions) = $DB->next_record(); list($NewSubscriptions) = $DB->next_record();
$Cache->cache_value('subscriptions_user_new_' . $LoggedUser['ID'], $NewSubscriptions, 0); $Cache->cache_value('subscriptions_user_new_' . $LoggedUser['ID'], $NewSubscriptions, 0);
} }

View File

@ -1,11 +1,10 @@
<? <?
$RequestTax = 0.1; $RequestTax = 0.1;
// Minimum and default amount of upload to remove from the user when they vote. // Minimum and default amount of upload to remove from the user when they vote.
// Also change in static/functions/requests.js // Also change in static/functions/requests.js
$MinimumVote = 20*1024*1024; $MinimumVote = 20 * 1024 * 1024;
/* /*
* This is the page that displays the request to the end user after being created. * This is the page that displays the request to the end user after being created.
@ -13,7 +12,7 @@
include(SERVER_ROOT.'/sections/requests/functions.php'); include(SERVER_ROOT.'/sections/requests/functions.php');
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT; $Text = new TEXT;
@ -96,7 +95,7 @@
//Votes time //Votes time
$RequestVotes = get_votes_array($RequestID); $RequestVotes = get_votes_array($RequestID);
$VoteCount = count($RequestVotes['Voters']); $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); $UserCanEdit = (!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2);
$CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests')); $CanEdit = ($UserCanEdit || $ProjectCanEdit || check_perms('site_moderate_requests'));
@ -121,7 +120,7 @@
$JsonTopContributors = array(); $JsonTopContributors = array();
$VoteMax = ($VoteCount < 5 ? $VoteCount : 5); $VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
for($i = 0; $i < $VoteMax; $i++) { for ($i = 0; $i < $VoteMax; $i++) {
$User = array_shift($RequestVotes['Voters']); $User = array_shift($RequestVotes['Voters']);
$JsonTopContributors[] = array( $JsonTopContributors[] = array(
'userId' => (int) $User['UserID'], 'userId' => (int) $User['UserID'],

View File

@ -4,31 +4,34 @@
$ID = (int) $_POST['id']; $ID = (int) $_POST['id'];
$Note = $_POST['note']; $Note = $_POST['note'];
if(empty($FriendID) || empty($Type) || empty($ID)) { if (empty($FriendID) || empty($Type) || empty($ID)) {
echo json_encode(array("status" => "error", "response" => "Error.")); echo json_encode(array("status" => "error", "response" => "Error."));
die(); die();
} }
// Make sure the recipient is on your friends list and not some random dude. // Make sure the recipient is on your friends list and not some random dude.
$DB->query("SELECT $DB->query("
f.FriendID, u.Username SELECT
f.FriendID,
u.Username
FROM friends AS f FROM friends AS f
RIGHT JOIN users_enable_recommendations AS r RIGHT JOIN users_enable_recommendations AS r
ON r.ID = f.FriendID AND r.Enable = 1 ON r.ID = f.FriendID AND r.Enable = 1
RIGHT JOIN users_main AS u RIGHT JOIN users_main AS u
ON u.ID = f.FriendID ON u.ID = f.FriendID
WHERE f.UserID = '$LoggedUser[ID]' AND f.FriendID = '$FriendID'"); WHERE f.UserID = '$LoggedUser[ID]'
AND f.FriendID = '$FriendID'");
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
echo json_encode(array("status" => "error", "response" => "Not on friend list.")); echo json_encode(array("status" => "error", "response" => "Not on friend list."));
die(); die();
} }
$Type = strtolower($Type); $Type = strtolower($Type);
$Link = ""; $Link = '';
// "a" vs "an", english language is so confusing. // "a" vs "an", english language is so confusing.
// http://en.wikipedia.org/wiki/English_articles#Distinction_between_a_and_an // http://en.wikipedia.org/wiki/English_articles#Distinction_between_a_and_an
$Article = "a"; $Article = 'a';
switch($Type) { switch ($Type) {
case 'torrent': case 'torrent':
$Link = "torrents.php?id=".$ID; $Link = "torrents.php?id=".$ID;
$DB->query("SELECT Name FROM torrents_group WHERE ID = '$ID'"); $DB->query("SELECT Name FROM torrents_group WHERE ID = '$ID'");
@ -45,8 +48,8 @@
} }
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
$Subject = $LoggedUser['Username'] . " recommended you $Article " . $Type . "!"; $Subject = $LoggedUser['Username'] . " recommended you $Article " . $Type . "!";
$Body = $LoggedUser['Username'] . " recommended you the ".$Type." [url=https://".NONSSL_SITE_URL."/".$Link."]".$Name."[/url]."; $Body = $LoggedUser['Username'] . " recommended you the ".$Type." [url=https://".SSL_SITE_URL."/$Link]$Name".'[/url].';
if(!empty($Note)) { if (!empty($Note)) {
$Body = $Body . "\n\n". $Note; $Body = $Body . "\n\n". $Note;
} }

View File

@ -1,8 +1,8 @@
<? <?
if(isset($_GET['details'])) { if (isset($_GET['details'])) {
if(in_array($_GET['details'], array('day','week','overall','snatched','data','seeded'))) { if (in_array($_GET['details'], array('day','week','overall','snatched','data','seeded'))) {
$Details = $_GET['details']; $Details = $_GET['details'];
} else { } else {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
@ -45,7 +45,7 @@
$OuterResults = array(); $OuterResults = array();
if($Details == 'all' || $Details == 'day') { if ($Details == 'all' || $Details == 'day') {
if (!$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum)) { if (!$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$DayAgo = time_minus(86400); $DayAgo = time_minus(86400);
@ -65,7 +65,7 @@
} }
$OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit); $OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
} }
if($Details == 'all' || $Details == 'week') { if ($Details == 'all' || $Details == 'week') {
if (!$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum)) { if (!$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$WeekAgo = time_minus(604800); $WeekAgo = time_minus(604800);
@ -86,7 +86,7 @@
$OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit); $OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
} }
if($Details == 'all' || $Details == 'overall') { if ($Details == 'all' || $Details == 'overall') {
if (!$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum)) { if (!$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it! // IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
@ -107,7 +107,7 @@
$OuterResults[] = generate_torrent_json('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit); $OuterResults[] = generate_torrent_json('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
} }
if(($Details == 'all' || $Details == 'snatched') && empty($Where)) { if (($Details == 'all' || $Details == 'snatched') && empty($Where)) {
if (!$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum)) { if (!$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery; $Query = $BaseQuery;
@ -125,7 +125,7 @@
$OuterResults[] = generate_torrent_json('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit); $OuterResults[] = generate_torrent_json('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
} }
if(($Details == 'all' || $Details == 'data') && empty($Where)) { if (($Details == 'all' || $Details == 'data') && empty($Where)) {
if (!$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum)) { if (!$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it! // IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
@ -145,7 +145,7 @@
$OuterResults[] = generate_torrent_json('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit); $OuterResults[] = generate_torrent_json('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
} }
if(($Details == 'all' || $Details == 'seeded') && empty($Where)) { if (($Details == 'all' || $Details == 'seeded') && empty($Where)) {
if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) { if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery." $Query = $BaseQuery."
@ -191,13 +191,13 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
$Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true); $Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
$TruncArtist = substr($Artist, 0, strlen($Artist)-3); $TruncArtist = substr($Artist, 0, strlen($Artist)-3);
$TagList=array(); $TagList = array();
if($TorrentTags!='') { if ($TorrentTags != '') {
$TorrentTags=explode(' ',$TorrentTags); $TorrentTags = explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) { foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName); $TagName = str_replace('_','.',$TagName);
$TagList[]=$TagName; $TagList[] = $TagName;
} }
} }

View File

@ -1,6 +1,5 @@
<?php <?php
require(SERVER_ROOT.'/sections/torrents/functions.php'); require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
@ -11,19 +10,21 @@
$GroupID = (int)$_GET['id']; $GroupID = (int)$_GET['id'];
if ($GroupID == 0) { error('bad id parameter', true); } if ($GroupID == 0) {
error('bad id parameter', true);
}
$TorrentCache = get_group_info($GroupID, true, 0); $TorrentCache = get_group_info($GroupID, true, 0);
list($TorrentDetails, $TorrentList) = $TorrentCache; list($TorrentDetails, $TorrentList) = $TorrentCache;
$ArtistForm = Artists::get_artist($GroupID); $ArtistForm = Artists::get_artist($GroupID);
if($TorrentDetails['CategoryID'] == 0) { if ($TorrentDetails['CategoryID'] == 0) {
$CategoryName = "Unknown"; $CategoryName = 'Unknown';
} else { } else {
$CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1]; $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
} }
$JsonMusicInfo = array(); $JsonMusicInfo = array();
if ($CategoryName == "Music") { if ($CategoryName == 'Music') {
$JsonMusicInfo = array( $JsonMusicInfo = array(
'composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]),
'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]),
@ -33,8 +34,7 @@
'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]),
'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]) 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7])
); );
} } else {
else {
$JsonMusicInfo = NULL; $JsonMusicInfo = NULL;
} }

View File

@ -6,7 +6,7 @@ function compare($X, $Y) {
return($Y['count'] - $X['count']); return($Y['count'] - $X['count']);
} }
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT; $Text = new TEXT;
@ -501,8 +501,7 @@ function compare($X, $Y) {
<? <?
} }
?> ?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
-->
<? <?
if (check_perms('site_edit_wiki')) { if (check_perms('site_edit_wiki')) {
?> ?>

View File

@ -1,5 +1,5 @@
<? <?
if(($GroupIDs = $Cache->get_value('better_single_groupids')) === false) { if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) {
$DB->query("SELECT t.ID AS TorrentID, $DB->query("SELECT t.ID AS TorrentID,
t.GroupID AS GroupID t.GroupID AS GroupID
FROM xbt_files_users AS x FROM xbt_files_users AS x
@ -7,7 +7,8 @@
WHERE t.Format='FLAC' WHERE t.Format='FLAC'
GROUP BY x.fid GROUP BY x.fid
HAVING COUNT(x.uid) = 1 HAVING COUNT(x.uid) = 1
ORDER BY t.LogScore DESC, t.Time ASC LIMIT 30"); ORDER BY t.LogScore DESC, t.Time ASC
LIMIT 30");
$GroupIDs = $DB->to_array('GroupID'); $GroupIDs = $DB->to_array('GroupID');
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60); $Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
@ -41,11 +42,15 @@
$FlacID = $GroupIDs[$GroupID]['TorrentID']; $FlacID = $GroupIDs[$GroupID]['TorrentID'];
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if ($GroupYear > 0) {
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; } $DisplayName.=" [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]";
}
$ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]); $ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]);
if($ExtraInfo) { if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;
} }
?> ?>

View File

@ -6,11 +6,11 @@
require(SERVER_ROOT.'/classes/class_text.php'); require(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT; $Text = new TEXT;
if(check_perms('admin_manage_blog')) { if (check_perms('admin_manage_blog')) {
if(!empty($_REQUEST['action'])) { if (!empty($_REQUEST['action'])) {
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'deadthread' : case 'deadthread' :
if(is_number($_GET['id'])){ if (is_number($_GET['id'])){
$DB->query("UPDATE blog SET ThreadID=NULL WHERE ID=".$_GET['id']); $DB->query("UPDATE blog SET ThreadID=NULL WHERE ID=".$_GET['id']);
$Cache->delete_value('blog'); $Cache->delete_value('blog');
$Cache->delete_value('feed_blog'); $Cache->delete_value('feed_blog');
@ -19,7 +19,7 @@
break; break;
case 'takeeditblog': case 'takeeditblog':
authorize(); authorize();
if(is_number($_POST['blogid']) && is_number($_POST['thread'])){ if (is_number($_POST['blogid']) && is_number($_POST['thread'])){
$DB->query("UPDATE blog SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."', ThreadID=".$_POST['thread']." WHERE ID='".db_string($_POST['blogid'])."'"); $DB->query("UPDATE blog SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."', ThreadID=".$_POST['thread']." WHERE ID='".db_string($_POST['blogid'])."'");
$Cache->delete_value('blog'); $Cache->delete_value('blog');
$Cache->delete_value('feed_blog'); $Cache->delete_value('feed_blog');
@ -27,14 +27,14 @@
header('Location: blog.php'); header('Location: blog.php');
break; break;
case 'editblog': case 'editblog':
if(is_number($_GET['id'])){ if (is_number($_GET['id'])){
$BlogID = $_GET['id']; $BlogID = $_GET['id'];
$DB->query("SELECT Title, Body, ThreadID FROM blog WHERE ID=$BlogID"); $DB->query("SELECT Title, Body, ThreadID FROM blog WHERE ID=$BlogID");
list($Title, $Body, $ThreadID) = $DB->next_record(); list($Title, $Body, $ThreadID) = $DB->next_record();
} }
break; break;
case 'deleteblog': case 'deleteblog':
if(is_number($_GET['id'])){ if (is_number($_GET['id'])){
authorize(); authorize();
$DB->query("DELETE FROM blog WHERE ID='".db_string($_GET['id'])."'"); $DB->query("DELETE FROM blog WHERE ID='".db_string($_GET['id'])."'");
$Cache->delete_value('blog'); $Cache->delete_value('blog');
@ -48,15 +48,15 @@
$Title = db_string($_POST['title']); $Title = db_string($_POST['title']);
$Body = db_string($_POST['body']); $Body = db_string($_POST['body']);
$ThreadID = $_POST['thread']; $ThreadID = $_POST['thread'];
if($ThreadID && is_number($ThreadID)) { if ($ThreadID && is_number($ThreadID)) {
$DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID); $DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error("No such thread exists!"); error("No such thread exists!");
header('Location: blog.php'); header('Location: blog.php');
} }
} else { } else {
$ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body); $ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body);
if($ThreadID < 1) { if ($ThreadID < 1) {
error(0); error(0);
} }
} }
@ -66,13 +66,13 @@
'".db_string($_POST['title'])."', '".db_string($_POST['title'])."',
'".db_string($_POST['body'])."', '".db_string($_POST['body'])."',
'".sqltime()."', '".sqltime()."',
".$ThreadID.", $ThreadID,
'".(($_POST['important']=='1')?'1':'0')."')"); '".(($_POST['important'] == '1') ? '1' : '0')."')");
$Cache->delete_value('blog'); $Cache->delete_value('blog');
if ($_POST['important']=='1') { if ($_POST['important'] == '1') {
$Cache->delete_value('blog_latest_id'); $Cache->delete_value('blog_latest_id');
} }
if(isset($_POST['subscribe'])) { if (isset($_POST['subscribe'])) {
$DB->query("INSERT IGNORE INTO users_subscriptions VALUES ('$LoggedUser[ID]', $ThreadID)"); $DB->query("INSERT IGNORE INTO users_subscriptions VALUES ('$LoggedUser[ID]', $ThreadID)");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']); $Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
} }
@ -91,19 +91,19 @@
<div class="pad"> <div class="pad">
<input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" /> <input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if(!empty($_GET['action']) && $_GET['action'] == 'editblog'){?> <? if (!empty($_GET['action']) && $_GET['action'] == 'editblog'){?>
<input type="hidden" name="blogid" value="<?=$BlogID; ?>" /> <input type="hidden" name="blogid" value="<?=$BlogID; ?>" />
<? }?> <? } ?>
<h3>Title</h3> <h3>Title</h3>
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br /> <input type="text" name="title" size="95"<? if (!empty($Title)) { echo ' value="'.display_str($Title).'"'; } ?> /><br />
<h3>Body</h3> <h3>Body</h3>
<textarea name="body" cols="95" rows="15"><? if(!empty($Body)) { echo display_str($Body); } ?></textarea> <br /> <textarea name="body" cols="95" rows="15"><? if (!empty($Body)) { echo display_str($Body); } ?></textarea> <br />
<input type="checkbox" value='1' name="important" id="important" <?=$Important?'checked="checked" ':''?>/><label for="important">Important</label><br /> <input type="checkbox" value="1" name="important" id="important"<?=$Important ? ' checked="checked"' : '' ?> /><label for="important">Important</label><br />
<h3>Thread ID</h3> <h3>Thread ID</h3>
<input type="text" name="thread" size="8"<? if(!empty($ThreadID)) { echo 'value="'.display_str($ThreadID).'"'; } ?> /> <input type="text" name="thread" size="8"<? if (!empty($ThreadID)) { echo ' value="'.display_str($ThreadID).'"'; } ?> />
(Leave blank to create thread automatically) (Leave blank to create thread automatically)
<br /><br /> <br /><br />
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> tabindex="2" /> <input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : '' ?> tabindex="2" />
<label for="subscribebox">Subscribe</label> <label for="subscribebox">Subscribe</label>
<div class="center"> <div class="center">
@ -126,7 +126,8 @@
b.Body, b.Body,
b.Time, b.Time,
b.ThreadID b.ThreadID
FROM blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID FROM blog AS b
LEFT JOIN users_main AS um ON b.UserID=um.ID
ORDER BY Time DESC ORDER BY Time DESC
LIMIT 20"); LIMIT 20");
$Blog = $DB->to_array(); $Blog = $DB->to_array();
@ -147,19 +148,19 @@
<div id="blog<?=$BlogID?>" class="box"> <div id="blog<?=$BlogID?>" class="box">
<div class="head"> <div class="head">
<strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?> <strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?>
<? if(check_perms('admin_manage_blog')) { ?> <? if (check_perms('admin_manage_blog')) { ?>
- <a href="blog.php?action=editblog&amp;id=<?=$BlogID?>" class="brackets">Edit</a> - <a href="blog.php?action=editblog&amp;id=<?=$BlogID?>" class="brackets">Edit</a>
<a href="blog.php?action=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a> <a href="blog.php?action=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
<? } ?> <? } ?>
</div> </div>
<div class="pad"> <div class="pad">
<?=$Text->full_format($Body)?> <?=$Text->full_format($Body)?>
<? if($ThreadID) { ?> <? if ($ThreadID) { ?>
<br /><br /> <br /><br />
<em><a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadID?>">Discuss this post here</a></em> <em><a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadID?>">Discuss this post here</a></em>
<? if(check_perms('admin_manage_blog')) { ?> <? if (check_perms('admin_manage_blog')) { ?>
<a href="blog.php?action=deadthread&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a> <a href="blog.php?action=deadthread&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a>
<? } <? }
} ?> } ?>
</div> </div>
</div> </div>

View File

@ -13,33 +13,35 @@
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC'); $WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');
// Are we searching in bodies, or just names? // Are we searching in bodies, or just names?
if(!empty($_GET['type'])) { if (!empty($_GET['type'])) {
$Type = $_GET['type']; $Type = $_GET['type'];
if(!in_array($Type, array('c.name', 'description'))) { if (!in_array($Type, array('c.name', 'description'))) {
$Type = 'c.name'; $Type = 'c.name';
} }
} else { } else {
$Type = 'c.name'; $Type = 'c.name';
} }
if(!empty($_GET['search'])) { if (!empty($_GET['search'])) {
// What are we looking for? Let's make sure it isn't dangerous. // What are we looking for? Let's make sure it isn't dangerous.
$Search = db_string(trim($_GET['search'])); $Search = db_string(trim($_GET['search']));
// Break search string down into individual words // Break search string down into individual words
$Words = explode(' ', $Search); $Words = explode(' ', $Search);
} }
if(!empty($_GET['tags'])) { if (!empty($_GET['tags'])) {
$Tags = explode(',',db_string(trim($_GET['tags']))); $Tags = explode(',',db_string(trim($_GET['tags'])));
foreach($Tags as $ID=>$Tag) { foreach ($Tags as $ID=>$Tag) {
$Tags[$ID] = Misc::sanitize_tag($Tag); $Tags[$ID] = Misc::sanitize_tag($Tag);
} }
} }
if(!empty($_GET['cats'])) { if (!empty($_GET['cats'])) {
$Categories = $_GET['cats']; $Categories = $_GET['cats'];
foreach($Categories as $Cat=>$Accept) { foreach ($Categories as $Cat=>$Accept) {
if(empty($CollageCats[$Cat]) || !$Accept) { unset($Categories[$Cat]); } if (empty($CollageCats[$Cat]) || !$Accept) {
unset($Categories[$Cat]);
}
} }
$Categories = array_keys($Categories); $Categories = array_keys($Categories);
} else { } else {
@ -47,13 +49,13 @@
} }
// Ordering // Ordering
if(!empty($_GET['order_by']) && !empty($OrderTable[$_GET['order_by']])) { if (!empty($_GET['order_by']) && !empty($OrderTable[$_GET['order_by']])) {
$Order = $OrderTable[$_GET['order_by']]; $Order = $OrderTable[$_GET['order_by']];
} else { } else {
$Order = 'ID'; $Order = 'ID';
} }
if(!empty($_GET['order_way']) && !empty($WayTable[$_GET['order_way']])) { if (!empty($_GET['order_way']) && !empty($WayTable[$_GET['order_way']])) {
$Way = $WayTable[$_GET['order_way']]; $Way = $WayTable[$_GET['order_way']];
} else { } else {
$Way = 'DESC'; $Way = 'DESC';
@ -85,7 +87,7 @@
if(!empty($Search)) { if (!empty($Search)) {
$SQL .= " AND $Type LIKE '%"; $SQL .= " AND $Type LIKE '%";
$SQL .= implode("%' AND $Type LIKE '%", $Words); $SQL .= implode("%' AND $Type LIKE '%", $Words);
$SQL .= "%'"; $SQL .= "%'";
@ -97,7 +99,7 @@
$_GET['tags_type'] = 1; $_GET['tags_type'] = 1;
} }
if(!empty($Tags)) { if (!empty($Tags)) {
$SQL.= " AND (TagList LIKE '%"; $SQL.= " AND (TagList LIKE '%";
if ($_GET['tags_type'] == 0) { if ($_GET['tags_type'] == 0) {
$SQL .= implode("%' OR TagList LIKE '%", $Tags); $SQL .= implode("%' OR TagList LIKE '%", $Tags);
@ -107,9 +109,9 @@
$SQL .= "%')"; $SQL .= "%')";
} }
if(!empty($_GET['userid'])) { if (!empty($_GET['userid'])) {
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if(!is_number($UserID)) { if (!is_number($UserID)) {
error(404); error(404);
} }
$User = Users::user_info($UserID); $User = Users::user_info($UserID);
@ -117,11 +119,13 @@
$UserClass = $Perms['Class']; $UserClass = $Perms['Class'];
$UserLink = '<a href="user.php?id='.$UserID.'">'.$User['Username'].'</a>'; $UserLink = '<a href="user.php?id='.$UserID.'">'.$User['Username'].'</a>';
if(!empty($_GET['contrib'])) { if (!empty($_GET['contrib'])) {
if (!check_paranoia('collagecontribs', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('collagecontribs', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$DB->query("SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = $UserID"); $DB->query("SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = $UserID");
$CollageIDs = $DB->collect('CollageID'); $CollageIDs = $DB->collect('CollageID');
if(empty($CollageIDs)) { if (empty($CollageIDs)) {
$SQL .= " AND 0"; $SQL .= " AND 0";
} else { } else {
$SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")"; $SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")";
@ -133,7 +137,7 @@
$Categories[] = 0; $Categories[] = 0;
} }
if(!empty($Categories)) { if (!empty($Categories)) {
$SQL.=" AND CategoryID IN(".db_string(implode(',',$Categories)).")"; $SQL.=" AND CategoryID IN(".db_string(implode(',',$Categories)).")";
} }
@ -180,8 +184,8 @@
<tr id="categories"> <tr id="categories">
<td class="label">Categories:</td> <td class="label">Categories:</td>
<td> <td>
<? foreach($CollageCats as $ID=>$Cat) { ?> <? foreach ($CollageCats as $ID=>$Cat) { ?>
<input type="checkbox" value="1" name="cats[<?=$ID?>]" id="cats_<?=$ID?>"<?if(in_array($ID, $Categories)) { echo ' checked="checked"'; }?> /> <input type="checkbox" value="1" name="cats[<?=$ID?>]" id="cats_<?=$ID?>"<? if (in_array($ID, $Categories)) { echo ' checked="checked"'; }?> />
<label for="cats_<?=$ID?>"><?=$Cat?></label>&nbsp;&nbsp; <label for="cats_<?=$ID?>"><?=$Cat?></label>&nbsp;&nbsp;
<? } ?> <? } ?>
</td> </td>
@ -189,21 +193,21 @@
<tr id="search_name_description"> <tr id="search_name_description">
<td class="label">Search in:</td> <td class="label">Search in:</td>
<td> <td>
<input type="radio" name="type" value="c.name" <? if($Type == 'c.name') { echo 'checked="checked" '; }?>/> Names&nbsp;&nbsp; <input type="radio" name="type" value="c.name" <? if ($Type == 'c.name') { echo 'checked="checked" '; }?>/> Names&nbsp;&nbsp;
<input type="radio" name="type" value="description" <? if($Type == 'description') { echo 'checked="checked" '; }?>/> Descriptions <input type="radio" name="type" value="description" <? if ($Type == 'description') { echo 'checked="checked" '; }?>/> Descriptions
</td> </td>
</tr> </tr>
<tr id="order_by"> <tr id="order_by">
<td class="label">Order by:</td> <td class="label">Order by:</td>
<td> <td>
<select name="order_by" class="ft_order_by"> <select name="order_by" class="ft_order_by">
<? foreach($OrderVals as $Cur){ ?> <? foreach ($OrderVals as $Cur) { ?>
<option value="<?=$Cur?>"<? if(isset($_GET['order_by']) && $_GET['order_by'] == $Cur || (!isset($_GET['order_by']) && $Cur == 'Time')) { echo ' selected="selected"'; } ?>><?=$Cur?></option> <option value="<?=$Cur?>"<? if (isset($_GET['order_by']) && $_GET['order_by'] == $Cur || (!isset($_GET['order_by']) && $Cur == 'Time')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? } ?> <? } ?>
</select> </select>
<select name="order_way" class="ft_order_way"> <select name="order_way" class="ft_order_way">
<? foreach($WayVals as $Cur){ ?> <? foreach ($WayVals as $Cur) { ?>
<option value="<?=$Cur?>"<? if(isset($_GET['order_way']) && $_GET['order_way'] == $Cur || (!isset($_GET['order_way']) && $Cur == 'Descending')) { echo ' selected="selected"'; } ?>><?=$Cur?></option> <option value="<?=$Cur?>"<? if (isset($_GET['order_way']) && $_GET['order_way'] == $Cur || (!isset($_GET['order_way']) && $Cur == 'Descending')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? } ?> <? } ?>
</select> </select>
</td> </td>
@ -219,10 +223,10 @@
<? } // if (!$BookmarkView) ?> <? } // if (!$BookmarkView) ?>
<div class="linkbox"> <div class="linkbox">
<? if (!$BookmarkView) { <? if (!$BookmarkView) {
if (check_perms('site_collages_create')) { ?> if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new" class="brackets">New collage</a> <a href="collages.php?action=new" class="brackets">New collage</a>
<? } <? }
if (check_perms('site_collages_personal')) { if (check_perms('site_collages_personal')) {
$DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'"); $DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
$CollageCount = $DB->record_count(); $CollageCount = $DB->record_count();
@ -234,22 +238,19 @@
<? } elseif ($CollageCount > 1) { ?> <? } elseif ($CollageCount > 1) { ?>
<a href="collages.php?action=mine" class="brackets">Personal collages</a> <a href="collages.php?action=mine" class="brackets">Personal collages</a>
<? } <? }
} }
if (check_perms('site_collages_subscribe')) { ?> if (check_perms('site_collages_subscribe')) { ?>
<a href="userhistory.php?action=subscribed_collages" class="brackets">Subscribed collages</a> <a href="userhistory.php?action=subscribed_collages" class="brackets">Subscribed collages</a>
<? } ?> <? } ?>
<a href="bookmarks.php?type=collages" class="brackets">Bookmarked collages</a> <a href="bookmarks.php?type=collages" class="brackets">Bookmarked collages</a>
<? <?
if (check_perms('site_collages_recover')) { ?> if (check_perms('site_collages_recover')) { ?>
<a href="collages.php?action=recover" class="brackets">Recover collage</a> <a href="collages.php?action=recover" class="brackets">Recover collage</a>
<? <? }
} if (check_perms('site_collages_create') || check_perms('site_collages_personal') || check_perms('site_collages_recover')) {
if (check_perms('site_collages_create') || check_perms('site_collages_personal') || check_perms('site_collages_recover')) {
?> ?>
<br /> <br />
<? <? } ?>
}
?>
<a href="collages.php?userid=<?=$LoggedUser['ID']?>" class="brackets">Collages you started</a> <a href="collages.php?userid=<?=$LoggedUser['ID']?>" class="brackets">Collages you started</a>
<a href="collages.php?userid=<?=$LoggedUser['ID']?>&amp;contrib=1" class="brackets">Collages you contributed to</a> <a href="collages.php?userid=<?=$LoggedUser['ID']?>&amp;contrib=1" class="brackets">Collages you contributed to</a>
<? } else { ?> <? } else { ?>
@ -260,7 +261,7 @@
<? } ?> <? } ?>
<br /><br /> <br /><br />
<? <?
$Pages=Format::get_pages($Page,$NumResults,COLLAGES_PER_PAGE,9); $Pages = Format::get_pages($Page,$NumResults,COLLAGES_PER_PAGE,9);
echo $Pages; echo $Pages;
?> ?>
</div> </div>
@ -274,8 +275,9 @@
<? } ?> <? } ?>
</div><!--box--> </div><!--box-->
</div><!--content--> </div><!--content-->
<? View::show_footer(); die(); <? View::show_footer();
} ?> die();
} ?>
<table width="100%" class="collage_table"> <table width="100%" class="collage_table">
<tr class="colhead"> <tr class="colhead">
<td>Category</td> <td>Category</td>
@ -299,7 +301,7 @@
<td> <td>
<a href="collages.php?id=<?=$ID?>"><?=$Name?></a> <a href="collages.php?id=<?=$ID?>"><?=$Name?></a>
<? if ($BookmarkView) { ?> <? if ($BookmarkView) { ?>
<span style="float:right"> <span style="float: right;">
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a> <a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
</span> </span>
<? } ?> <? } ?>
@ -308,7 +310,8 @@
<td><?=number_format((int)$NumTorrents)?></td> <td><?=number_format((int)$NumTorrents)?></td>
<td><?=Users::format_username($UserID, false, false, false)?></td> <td><?=Users::format_username($UserID, false, false, false)?></td>
</tr> </tr>
<? } ?> <?
} ?>
</table> </table>
<div class="linkbox"><?=$Pages?></div> <div class="linkbox"><?=$Pages?></div>
</div> </div>

View File

@ -7,7 +7,7 @@ function compare($X, $Y){
return($Y['count'] - $X['count']); return($Y['count'] - $X['count']);
} }
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT; $Text = new TEXT;
@ -30,8 +30,8 @@ function compare($X, $Y){
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'"); $DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record(); list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
$TorrentList=''; $TorrentList = '';
$CollageList=''; $CollageList = '';
} else { } else {
$Deleted = '1'; $Deleted = '1';
} }
@ -258,7 +258,7 @@ function compare($X, $Y){
</td> </td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td> <td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td> <td><?=number_format($Torrent['Leechers'])?></td>
</tr> </tr>
<? <?
@ -279,7 +279,7 @@ function compare($X, $Y){
} }
$DisplayName .= $GroupName; $DisplayName .= $GroupName;
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName = $DisplayName. ' ['. $GroupYear .']'; $DisplayName = $DisplayName. " [$GroupYear]";
} }
?> ?>
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
@ -296,7 +296,7 @@ function compare($X, $Y){
</a> </a>
</li> </li>
<? <?
$Collage[]=ob_get_clean(); $Collage[] = ob_get_clean();
} }
if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) { if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
@ -350,10 +350,9 @@ function compare($X, $Y){
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a> <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a>
<? } <? }
?> ?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
-->
<? <?
if (check_perms('site_collages_manage') && !$Locked) { ?> if (check_perms('site_collages_manage') && !$Locked) { ?>
<a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a> <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
<? } ?> <? } ?>
<a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a> <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
@ -395,20 +394,20 @@ function compare($X, $Y){
<input type="hidden" name="list[]" value="<?=$ListItem?>" /> <input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span> <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span> <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span>
<br style="clear:all;" /> <br style="clear: all;" />
</li> </li>
<? } ?> <? } ?>
</ul> </ul>
<select id="formats" style="width:180px"> <select id="formats" style="width:180px">
<? <?
$OpenGroup = false; $OpenGroup = false;
$LastGroupID=-1; $LastGroupID = -1;
foreach ($ZIPOptions as $Option) { foreach ($ZIPOptions as $Option) {
list($GroupID,$OptionID,$OptName) = $Option; list($GroupID,$OptionID,$OptName) = $Option;
if ($GroupID!=$LastGroupID) { if ($GroupID != $LastGroupID) {
$LastGroupID=$GroupID; $LastGroupID = $GroupID;
if ($OpenGroup) { ?> if ($OpenGroup) { ?>
</optgroup> </optgroup>
<? } ?> <? } ?>
@ -446,7 +445,7 @@ function compare($X, $Y){
<div class="box box_tags"> <div class="box box_tags">
<div class="head"><strong>Top tags</strong></div> <div class="head"><strong>Top tags</strong></div>
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left: 5px;">
<? <?
Tags::format_top(5, 'collages.php?action=search&amp;tags='); Tags::format_top(5, 'collages.php?action=search&amp;tags=');
?> ?>
@ -457,7 +456,7 @@ function compare($X, $Y){
<div class="box box_artists"> <div class="box box_artists">
<div class="head"><strong>Top artists</strong></div> <div class="head"><strong>Top artists</strong></div>
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left: 5px;">
<? <?
uasort($TopArtists, 'compare'); uasort($TopArtists, 'compare');
$i = 0; $i = 0;

View File

@ -1,36 +1,52 @@
<? <?
enforce_login(); enforce_login();
if(empty($_REQUEST['action'])) { $_REQUEST['action']=''; } if (empty($_REQUEST['action'])) {
$_REQUEST['action'] = '';
}
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'new': case 'new':
if(!check_perms('site_collages_create')) { error(403); } if (!check_perms('site_collages_create')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/new.php'); require(SERVER_ROOT.'/sections/collages/new.php');
break; break;
case 'new_handle': case 'new_handle':
if(!check_perms('site_collages_create')) { error(403); } if (!check_perms('site_collages_create')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/new_handle.php'); require(SERVER_ROOT.'/sections/collages/new_handle.php');
break; break;
case 'add_torrent': case 'add_torrent':
case 'add_torrent_batch': case 'add_torrent_batch':
if(!check_perms('site_collages_manage')) { error(403); } if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/add_torrent.php'); require(SERVER_ROOT.'/sections/collages/add_torrent.php');
break; break;
case 'manage': case 'manage':
if(!check_perms('site_collages_manage')) { error(403); } if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/manage.php'); require(SERVER_ROOT.'/sections/collages/manage.php');
break; break;
case 'manage_handle': case 'manage_handle':
if(!check_perms('site_collages_manage')) { error(403); } if (!check_perms('site_collages_manage')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/manage_handle.php'); require(SERVER_ROOT.'/sections/collages/manage_handle.php');
break; break;
case 'edit': case 'edit':
if(!check_perms('site_edit_wiki')) { error(403); } if (!check_perms('site_edit_wiki')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/edit.php'); require(SERVER_ROOT.'/sections/collages/edit.php');
break; break;
case 'edit_handle': case 'edit_handle':
if(!check_perms('site_edit_wiki')) { error(403); } if (!check_perms('site_edit_wiki')) {
error(403);
}
require(SERVER_ROOT.'/sections/collages/edit_handle.php'); require(SERVER_ROOT.'/sections/collages/edit_handle.php');
break; break;
case 'delete': case 'delete':
@ -59,30 +75,42 @@
require(SERVER_ROOT.'/sections/collages/download.php'); require(SERVER_ROOT.'/sections/collages/download.php');
break; break;
case 'recover': case 'recover':
//if(!check_perms('')) { error(403); } //if (!check_perms('')) {
// error(403);
//}
require(SERVER_ROOT.'/sections/collages/recover.php'); require(SERVER_ROOT.'/sections/collages/recover.php');
break; break;
case 'create_personal': case 'create_personal':
if(!check_perms('site_collages_personal')) { if (!check_perms('site_collages_personal')) {
error(403); error(403);
} }
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'"); $DB->query("
SELECT
COUNT(ID)
FROM collages
WHERE UserID='$LoggedUser[ID]'
AND CategoryID='0'
AND Deleted='0'");
list($CollageCount) = $DB->next_record(); list($CollageCount) = $DB->next_record();
if($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) { if ($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
list($CollageID) = $DB->next_record(); list($CollageID) = $DB->next_record();
header('Location: collage.php?id='.$CollageID); header('Location: collage.php?id='.$CollageID);
die(); die();
} }
$NameStr = ($CollageCount > 0)?" no. " . ($CollageCount + 1):''; $NameStr = ($CollageCount > 0)?" no. " . ($CollageCount + 1):'';
$DB->query("INSERT INTO collages (Name, Description, CategoryID, UserID) VALUES ('$LoggedUser[Username]\'s personal collage$NameStr', 'Personal collage for $LoggedUser[Username]. The first 5 albums will appear on his or her [url=http:\/\/".NONSSL_SITE_URL."\/user.php?id=$LoggedUser[ID]]profile[\/url].', '0', $LoggedUser[ID])"); $DB->query("
INSERT INTO collages
(Name, Description, CategoryID, UserID)
VALUES
('$LoggedUser[Username]\'s personal collage$NameStr', 'Personal collage for $LoggedUser[Username]. The first 5 albums will appear on his or her [url=https:\/\/".SSL_SITE_URL."\/user.php?id=$LoggedUser[ID]]profile[\/url].', '0', $LoggedUser[ID])");
$CollageID = $DB->inserted_id(); $CollageID = $DB->inserted_id();
header('Location: collage.php?id='.$CollageID); header('Location: collage.php?id='.$CollageID);
die(); die();
default: default:
if(!empty($_GET['id'])) { if (!empty($_GET['id'])) {
require(SERVER_ROOT.'/sections/collages/collage.php'); require(SERVER_ROOT.'/sections/collages/collage.php');
} else { } else {
require(SERVER_ROOT.'/sections/collages/browse.php'); require(SERVER_ROOT.'/sections/collages/browse.php');

View File

@ -20,7 +20,8 @@
if (!empty($Error)) { ?> if (!empty($Error)) { ?>
<div class="save_message error"><?=$Error?></div> <div class="save_message error"><?=$Error?></div>
<br /> <br />
<? } ?> <?
} ?>
<form class="create_form" name="collage" action="collages.php" method="post"> <form class="create_form" name="collage" action="collages.php" method="post">
<input type="hidden" name="action" value="new_handle" /> <input type="hidden" name="action" value="new_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -28,8 +29,8 @@
<tr id="collagename"> <tr id="collagename">
<td class="label"><strong>Name</strong></td> <td class="label"><strong>Name</strong></td>
<td> <td>
<input type="text" class="<?=$NoName?'hidden':''?>" name="name" size="60" id="namebox" value="<?=display_str($Name)?>" /> <input type="text"<?=$NoName ? ' class="hidden"' : '' ?> name="name" size="60" id="namebox" value="<?=display_str($Name)?>" />
<span id="personal" class="<?=$NoName?'':'hidden'?>" style="font-style: oblique"><strong><?=$LoggedUser['Username']?>'s personal collage</strong></span> <span id="personal"<?=$NoName ? '' : ' class="hidden"' ?> style="font-style: oblique;"><strong><?=$LoggedUser['Username']?>'s personal collage</strong></span>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -39,26 +40,29 @@
<? <?
array_shift($CollageCats); array_shift($CollageCats);
foreach($CollageCats as $CatID=>$CatName) { ?> foreach ($CollageCats as $CatID=>$CatName) : ?>
<option value="<?=$CatID+1?>"<?=(($CatID+1 == $Category) ? ' selected="selected"' : '')?>><?=$CatName?></option> <option value="<?=$CatID + 1 ?>"<?=(($CatID + 1 == $Category) ? ' selected="selected"' : '')?>><?=$CatName?></option>
<? } <?
endforeach;
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'"); $DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
list($CollageCount) = $DB->next_record(); list($CollageCount) = $DB->next_record();
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?> if (($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
<option value="0"<?=(($Category === '0') ? ' selected="selected"' : '')?>>Personal</option> <option value="0"<?=(($Category === '0') ? ' selected="selected"' : '')?>>Personal</option>
<? } ?> <?
} ?>
</select> </select>
<br /> <br />
<ul> <ul>
<li><strong>Theme</strong> - A collage containing releases that all relate to a certain theme (e.g. "Searching for the Perfect Beat", "Concept Albums", "Funky Groove", etc.).</li> <li><strong>Theme</strong> - A collage containing releases that all relate to a certain theme (e.g. "Searching for the Perfect Beat", "Concept Albums", "Funky Groove", etc.).</li>
<li><strong>Genre introduction</strong> - A subjective introduction to a genre composed by our own users.</li> <li><strong>Genre introduction</strong> - A subjective introduction to a genre composed by our own users.</li>
<li><strong>Discography</strong> - A collage containing all the releases of an artist. Useful for keeping track of side-projects.</li> <li><strong>Discography</strong> - A collage containing all the releases of an artist, which can be useful for keeping track of side projects.</li>
<li><strong>Label</strong> - A collage containing all the releases of a particular record label.</li> <li><strong>Label</strong> - A collage containing all the releases of a particular record label.</li>
<li><strong>Staff picks</strong> - A listing of recommendations picked by the staff on special occasions.</li> <li><strong>Staff picks</strong> - A listing of recommendations picked by the staff on special occasions.</li>
<li><strong>Charts</strong> - Contains all the releases that comprise a certain type of chart (e.g. Billboard Top 100, Pitchfork Top 100, What.cd Top 10, etc.).</li> <li><strong>Charts</strong> - Contains all the releases that comprise a certain type of chart (e.g. Billboard Top 100, Pitchfork Top 100, What.CD Top 10, etc.).</li>
<? <?
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?> if (($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
<li><strong>Personal</strong> - You can put whatever you want here. It's your own personal collage.</li> <li><strong>Personal</strong> - You can put whatever you want here. It is your own personal collage.</li>
<? } ?> <? } ?>
</ul> </ul>
</td> </td>

View File

@ -35,11 +35,11 @@
} }
} }
if(!$Err) { if (!$Err) {
$DB->query("SELECT ID,Deleted FROM collages WHERE Name='$P[name]'"); $DB->query("SELECT ID,Deleted FROM collages WHERE Name='$P[name]'");
if($DB->record_count()) { if ($DB->record_count()) {
list($ID, $Deleted) = $DB->next_record(); list($ID, $Deleted) = $DB->next_record();
if($Deleted) { if ($Deleted) {
$Err = "That collection already exists but needs to be recovered; please <a href=\"staffpm.php\">contact</a> the staff team!"; $Err = "That collection already exists but needs to be recovered; please <a href=\"staffpm.php\">contact</a> the staff team!";
} else { } else {
$Err = "That collection already exists: <a href=\"/collages.php?id=$ID\">$ID</a>."; $Err = "That collection already exists: <a href=\"/collages.php?id=$ID\">$ID</a>.";
@ -47,13 +47,13 @@
} }
} }
if(!$Err) { if (!$Err) {
if(empty($CollageCats[$P['category']])) { if (empty($CollageCats[$P['category']])) {
$Err = 'Please select a category'; $Err = 'Please select a category';
} }
} }
if($Err) { if ($Err) {
//error($Err); //error($Err);
$Err = urlencode($Err); $Err = urlencode($Err);
$Name = urlencode($_POST['name']); $Name = urlencode($_POST['name']);
@ -65,7 +65,7 @@
} }
$TagList = explode(',',$_POST['tags']); $TagList = explode(',',$_POST['tags']);
foreach($TagList as $ID=>$Tag) { foreach ($TagList as $ID=>$Tag) {
$TagList[$ID] = Misc::sanitize_tag($Tag); $TagList[$ID] = Misc::sanitize_tag($Tag);
} }
$TagList = implode(' ',$TagList); $TagList = implode(' ',$TagList);

View File

@ -2,10 +2,11 @@
$OtherLink = ''; $OtherLink = '';
$Title = 'Artist comments made by '.($Self?'you':$Username); $Title = 'Artist comments made by '.($Self ? 'you' : $Username);
$Header = 'Artist comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).''; $Header = 'Artist comments left by '.($Self ? 'you' : Users::format_username($UserID, false, false, false)).'';
$Comments = $DB->query("SELECT $Comments = $DB->query("
SELECT
SQL_CALC_FOUND_ROWS SQL_CALC_FOUND_ROWS
ac.AuthorID, ac.AuthorID,
a.ArtistID, a.ArtistID,
@ -15,16 +16,11 @@
ac.AddedTime, ac.AddedTime,
ac.EditedTime, ac.EditedTime,
ac.EditedUserID as EditorID ac.EditedUserID as EditorID
FROM artists_group as a FROM artists_group as a
JOIN artist_comments as ac ON ac.ArtistID = a.ArtistID JOIN artist_comments as ac ON ac.ArtistID = a.ArtistID
WHERE ac.AuthorId = $UserID WHERE ac.AuthorId = $UserID
GROUP BY ac.ID GROUP BY ac.ID
ORDER BY ac.AddedTime DESC ORDER BY ac.AddedTime DESC
LIMIT $Limit; LIMIT $Limit;
"); ");
@ -53,9 +49,9 @@
</div> </div>
<? <?
while(list($UserID, $ArtistID, $ArtistName, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) { while (list($UserID, $ArtistID, $ArtistName, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
$permalink = "artist.php?id=$ArtistID&amp;postid=$PostID#post$PostID"; $permalink = "artist.php?id=$ArtistID&amp;postid=$PostID#post$PostID";
$postheader = " on " . "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a>"; $postheader = ' on ' . "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a>";
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime); comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
@ -63,6 +59,5 @@
<div class="linkbox"><?= $Pages; ?></div> <div class="linkbox"><?= $Pages; ?></div>
</div> </div>
<? <?
View::show_footer();
View::show_footer();

View File

@ -15,41 +15,41 @@
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) { function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
global $Text,$HeavyInfo; global $Text,$HeavyInfo;
$UserInfo = Users::user_info($UserID); $UserInfo = Users::user_info($UserID);
$postheader = "by <strong>" . Users::format_username($UserID, true, true, true, true, false) . "</strong> " $postheader = 'by <strong>' . Users::format_username($UserID, true, true, true, true, false) . '</strong> '
. time_diff($AddedTime) . $postheader; . time_diff($AddedTime) . $postheader;
?> ?>
<table class='forum_post box vertical_margin<?=$noavatar ? ' noavatar' : ''?>' id="post<?=$PostID?>"> <table class="forum_post box vertical_margin<?=$noavatar ? ' noavatar' : '' ?>" id="post<?=$PostID?>">
<colgroup> <colgroup>
<? if(empty($UserInfo['DisableAvatars'])) { ?> <? if (empty($UserInfo['DisableAvatars'])) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class='colhead_dark'> <tr class="colhead_dark">
<td colspan="<?=empty($UserInfo['DisableAvatars']) ? 2 : 1?>"> <td colspan="<?=empty($UserInfo['DisableAvatars']) ? 2 : 1 ?>">
<span style="float:left;"><a href='<?=$permalink ?>'>#<?=$PostID?></a> <span style="float: left;"><a href="<?=$permalink ?>">#<?=$PostID?></a>
<?=$postheader ?> <?=$postheader ?>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<? if(empty($HeavyInfo['DisableAvatars'])) { ?> <? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<td class='avatar' valign="top"> <td class="avatar" valign="top">
<? if($UserInfo['Avatar']){ ?> <? if ($UserInfo['Avatar']) { ?>
<img src='<?=$UserInfo['Avatar']?>' width='150' alt="<?=$UserInfo['Username']?>'s avatar" /> <img src="<?=$UserInfo['Avatar']?>" width="150" alt="<?=$UserInfo['Username']?>'s avatar" />
<? } else { ?> <? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" /> <img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
<? } ?> <? } ?>
</td> </td>
<? } ?> <? } ?>
<td class='body' valign="top"> <td class="body" valign="top">
<?=$Text->full_format($Body) ?> <?=$Text->full_format($Body) ?>
<? if($EditorID){ ?> <? if ($EditorID) { ?>
<br /><br /> <br /><br />
Last edited by Last edited by
<?=Users::format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?> <?=Users::format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
<? } ?> <? } ?>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -1,7 +1,7 @@
<?php <?php
if(!empty($_REQUEST['action'])) { if (!empty($_REQUEST['action'])) {
if($_REQUEST['action'] == 'my_torrents') { if ($_REQUEST['action'] == 'my_torrents') {
$MyTorrents = true; $MyTorrents = true;
} elseif ($_REQUEST['action'] == 'torrents') { } elseif ($_REQUEST['action'] == 'torrents') {
$MyTorrents = false; $MyTorrents = false;
@ -14,19 +14,18 @@
$OtherLink = '<a href="comments.php?action=requests" class="brackets">Request comments</a> <a href="comments.php?action=artists" class="brackets">Artist comments</a><br/>'; $OtherLink = '<a href="comments.php?action=requests" class="brackets">Request comments</a> <a href="comments.php?action=artists" class="brackets">Artist comments</a><br/>';
if($MyTorrents) { if ($MyTorrents) {
$Conditions = "WHERE t.UserID = $UserID AND tc.AuthorID != t.UserID AND tc.AddedTime > t.Time"; $Conditions = "WHERE t.UserID = $UserID AND tc.AuthorID != t.UserID AND tc.AddedTime > t.Time";
$Title = 'Comments left on your torrents'; $Title = 'Comments left on your torrents';
$Header = 'Comments left on your uploads'; $Header = 'Comments left on your uploads';
if($Self) { if ($Self) {
$OtherLink .= '<a href="comments.php?action=torrents" class="brackets">Display comments you have made</a>'; $OtherLink .= '<a href="comments.php?action=torrents" class="brackets">Display comments you have made</a>';
} }
} } else {
else {
$Conditions = "WHERE tc.AuthorID = $UserID"; $Conditions = "WHERE tc.AuthorID = $UserID";
$Title = 'Comments made by '.($Self?'you':$Username); $Title = 'Comments made by '.($Self?'you':$Username);
$Header = 'Torrent comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).''; $Header = 'Torrent comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).'';
if($Self) { if ($Self) {
$OtherLink .= '<a href="comments.php?action=my_torrents" class="brackets">Display comments left on your uploads</a>'; $OtherLink .= '<a href="comments.php?action=my_torrents" class="brackets">Display comments left on your uploads</a>';
} }
} }
@ -42,17 +41,12 @@
tc.AddedTime, tc.AddedTime,
tc.EditedTime, tc.EditedTime,
tc.EditedUserID as EditorID tc.EditedUserID as EditorID
FROM torrents as t FROM torrents as t
JOIN torrents_comments as tc ON tc.GroupID = t.GroupID JOIN torrents_comments as tc ON tc.GroupID = t.GroupID
JOIN torrents_group as tg ON t.GroupID = tg.ID JOIN torrents_group as tg ON t.GroupID = tg.ID
$Conditions $Conditions
GROUP BY tc.ID GROUP BY tc.ID
ORDER BY tc.AddedTime DESC ORDER BY tc.AddedTime DESC
LIMIT $Limit; LIMIT $Limit;
"); ");
@ -81,10 +75,9 @@
<?=$Pages?> <?=$Pages?>
</div> </div>
<? <?
while (list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
$permalink = "torrents.php?id=$GroupID&amp;postid=$PostID#post$PostID"; $permalink = "torrents.php?id=$GroupID&amp;postid=$PostID#post$PostID";
$postheader = " on " . Artists::display_artists($Artists[$GroupID]) . " <a href=\"torrents.php?id=$GroupID\">$Title</a>"; $postheader = ' on ' . Artists::display_artists($Artists[$GroupID]) . " <a href=\"torrents.php?id=$GroupID\">$Title</a>";
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime); comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
@ -93,5 +86,5 @@
</div> </div>
<? <?
View::show_footer(); View::show_footer();

View File

@ -46,7 +46,7 @@
<div class="header"> <div class="header">
<h2>Donate</h2> <h2>Donate</h2>
</div> </div>
<div class="box pad" style="padding:10px 10px 10px 20px;"> <div class="box pad" style="padding: 10px 10px 10px 20px;">
<p>We accept donations to cover the costs associated with running the site and tracker. These costs come from the rental and purchase of the hardware the site runs on (servers, components, etc.), in addition to operating expenses (bandwidth, power, etc.).</p> <p>We accept donations to cover the costs associated with running the site and tracker. These costs come from the rental and purchase of the hardware the site runs on (servers, components, etc.), in addition to operating expenses (bandwidth, power, etc.).</p>
<p>Because we do not have any advertisements or sponsorships and this service is provided free of charge, we are entirely reliant upon user donations. If you are financially able, please consider making a donation to help us pay the bills!</p> <p>Because we do not have any advertisements or sponsorships and this service is provided free of charge, we are entirely reliant upon user donations. If you are financially able, please consider making a donation to help us pay the bills!</p>
<p>We currently only accept one payment method: PayPal. Because of the fees they charge, there is a <strong>minimum donation amount of <?=PAYPAL_SYMBOL?> <?=PAYPAL_MINIMUM?></strong> (Please note, this is only a minimum amount and we greatly appreciate any extra you can afford.).</p> <p>We currently only accept one payment method: PayPal. Because of the fees they charge, there is a <strong>minimum donation amount of <?=PAYPAL_SYMBOL?> <?=PAYPAL_MINIMUM?></strong> (Please note, this is only a minimum amount and we greatly appreciate any extra you can afford.).</p>
@ -55,9 +55,9 @@
<input type="hidden" name="rm" value="2" /> <input type="hidden" name="rm" value="2" />
<input type="hidden" name="cmd" value="_donations" /> <input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="<?=PAYPAL_ADDRESS?>" /> <input type="hidden" name="business" value="<?=PAYPAL_ADDRESS?>" />
<input type="hidden" name="return" value="http://<?=SITE_URL?>/donate.php?action=complete" /> <input type="hidden" name="return" value="https://<?=SSL_SITE_URL?>/donate.php?action=complete" />
<input type="hidden" name="cancel_return" value="http://<?=SITE_URL?>/donate.php?action=cancel" /> <input type="hidden" name="cancel_return" value="https://<?=SSL_SITE_URL?>/donate.php?action=cancel" />
<input type="hidden" name="notify_url" value="http://<?=NONSSL_SITE_URL?>/donate.php?action=ipn" /> <input type="hidden" name="notify_url" value="https://<?=SSL_SITE_URL?>/donate.php?action=ipn" />
<input type="hidden" name="item_name" value="Donation" /> <input type="hidden" name="item_name" value="Donation" />
<input type="hidden" name="amount" value="" /> <input type="hidden" name="amount" value="" />
<input type="hidden" name="custom" value="<?=$LoggedUser['ID']?>" /> <input type="hidden" name="custom" value="<?=$LoggedUser['ID']?>" />
@ -71,7 +71,7 @@
</div> </div>
<h3>What you will receive for a 5&euro; or 0.5 BTC minimum donation</h3> <h3>What you will receive for a 5&euro; or 0.5 BTC minimum donation</h3>
<div class="box pad" style="padding:10px 10px 10px 20px;"> <div class="box pad" style="padding: 10px 10px 10px 20px;">
<ul> <ul>
<? <?
if ($LoggedUser['Donor']) { ?> if ($LoggedUser['Donor']) { ?>
@ -92,7 +92,7 @@
<p>Please be aware that by making a donation you aren't purchasing donor status or invites. You are helping us pay the bills and cover the costs of running the site. We are doing our best to give our love back to donors, but sometimes it might take more than 48 hours. Feel free to contact us by sending us a <a href="staffpm.php">Staff PM</a> regarding any matter. We will answer as quickly as possible.</p> <p>Please be aware that by making a donation you aren't purchasing donor status or invites. You are helping us pay the bills and cover the costs of running the site. We are doing our best to give our love back to donors, but sometimes it might take more than 48 hours. Feel free to contact us by sending us a <a href="staffpm.php">Staff PM</a> regarding any matter. We will answer as quickly as possible.</p>
</div> </div>
<h3>What you will <strong>not</strong> receive</h3> <h3>What you will <strong>not</strong> receive</h3>
<div class="box pad" style="padding:10px 10px 10px 20px;"> <div class="box pad" style="padding: 10px 10px 10px 20px;">
<ul> <ul>
<? if ($LoggedUser['Donor']) { ?> <? if ($LoggedUser['Donor']) { ?>
<li>2 more invitations; these are one time only.</li> <li>2 more invitations; these are one time only.</li>

View File

@ -47,7 +47,7 @@
<div class="header"> <div class="header">
<h2>Donate</h2> <h2>Donate</h2>
</div> </div>
<div class="box pad" style="padding:10px 10px 10px 20px;"> <div class="box pad" style="padding: 10px 10px 10px 20px;">
<p>We accept donations to cover the costs associated with running the site and tracker. These costs come from the rental and purchase of the hardware the site runs on (servers, components, etc.), in addition to operating expenses (bandwidth, power, etc.).</p> <p>We accept donations to cover the costs associated with running the site and tracker. These costs come from the rental and purchase of the hardware the site runs on (servers, components, etc.), in addition to operating expenses (bandwidth, power, etc.).</p>
<p>Because we do not have any advertisements or sponsorships and this service is provided free of charge, we are entirely reliant upon user donations. If you are financially able, please consider making a donation to help us pay the bills!</p> <p>Because we do not have any advertisements or sponsorships and this service is provided free of charge, we are entirely reliant upon user donations. If you are financially able, please consider making a donation to help us pay the bills!</p>
<p>We currently only accept one payment method: PayPal. Because of the fees they charge, there is a <strong>minimum donation amount of <?=PAYPAL_SYMBOL?> <?=PAYPAL_MINIMUM?></strong> (Please note, this is only a minimum amount and we greatly appreciate any extra you can afford.).</p> <p>We currently only accept one payment method: PayPal. Because of the fees they charge, there is a <strong>minimum donation amount of <?=PAYPAL_SYMBOL?> <?=PAYPAL_MINIMUM?></strong> (Please note, this is only a minimum amount and we greatly appreciate any extra you can afford.).</p>
@ -56,9 +56,9 @@
<input type="hidden" name="rm" value="2" /> <input type="hidden" name="rm" value="2" />
<input type="hidden" name="cmd" value="_donations" /> <input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="<?=PAYPAL_ADDRESS?>" /> <input type="hidden" name="business" value="<?=PAYPAL_ADDRESS?>" />
<input type="hidden" name="return" value="http://<?=SITE_URL?>/donate.php?action=complete" /> <input type="hidden" name="return" value="https://<?=SSL_SITE_URL?>/donate.php?action=complete" />
<input type="hidden" name="cancel_return" value="http://<?=SITE_URL?>/donate.php?action=cancel" /> <input type="hidden" name="cancel_return" value="https://<?=SSL_SITE_URL?>/donate.php?action=cancel" />
<input type="hidden" name="notify_url" value="http://<?=NONSSL_SITE_URL?>/donate.php?action=ipn" /> <input type="hidden" name="notify_url" value="https://<?=SSL_SITE_URL?>/donate.php?action=ipn" />
<input type="hidden" name="item_name" value="Donation" /> <input type="hidden" name="item_name" value="Donation" />
<input type="hidden" name="amount" value="" /> <input type="hidden" name="amount" value="" />
<input type="hidden" name="custom" value="<?=$LoggedUser['ID']?>" /> <input type="hidden" name="custom" value="<?=$LoggedUser['ID']?>" />

View File

@ -63,7 +63,7 @@
Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.'); Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.');
} else { } else {
//Failed pending donation //Failed pending donation
$Message = "User http://".NONSSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned."; $Message = "User https://".SSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned.";
$DB->query('SELECT SUM(Amount), MIN(Time) FROM donations WHERE UserID=\''.$_POST['custom'].'\';'); $DB->query('SELECT SUM(Amount), MIN(Time) FROM donations WHERE UserID=\''.$_POST['custom'].'\';');
list($TotalDonated,$DonationTime) = $DB->next_record(); list($TotalDonated,$DonationTime) = $DB->next_record();
if ($TotalDonated+$_POST['mc_gross'] == 0) { if ($TotalDonated+$_POST['mc_gross'] == 0) {

View File

@ -22,7 +22,7 @@
$User = (int)$_GET['user']; $User = (int)$_GET['user'];
if(!$Enabled = $Cache->get_value('enabled_'.$User)){ if (!$Enabled = $Cache->get_value('enabled_'.$User)) {
require(SERVER_ROOT.'/classes/class_mysql.php'); require(SERVER_ROOT.'/classes/class_mysql.php');
$DB=NEW DB_MYSQL; //Load the database wrapper $DB=NEW DB_MYSQL; //Load the database wrapper
$DB->query("SELECT Enabled FROM users_main WHERE ID='$User'"); $DB->query("SELECT Enabled FROM users_main WHERE ID='$User'");
@ -40,7 +40,7 @@
} }
$Feed->open_feed(); $Feed->open_feed();
switch($_GET['feed']) { switch ($_GET['feed']) {
case 'feed_news': case 'feed_news':
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT; $Text = new TEXT;

View File

@ -12,7 +12,7 @@
// Check for lame SQL injection attempts // Check for lame SQL injection attempts
$ForumID = $_GET['forumid']; $ForumID = $_GET['forumid'];
if(!is_number($ForumID)) { if (!is_number($ForumID)) {
error(0); error(0);
} }
@ -28,11 +28,12 @@
// Caching anything beyond the first page of any given forum is just wasting ram // 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 // 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); list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
} }
if(!isset($Forum) || !is_array($Forum)) { if (!isset($Forum) || !is_array($Forum)) {
$DB->query("SELECT $DB->query("
SELECT
t.ID, t.ID,
t.Title, t.Title,
t.AuthorID, t.AuthorID,
@ -48,7 +49,7 @@
LIMIT $Limit"); // Can be cached until someone makes a new post LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false); $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'"); $DB->query("SELECT COUNT(ID) FROM forums_topics WHERE ForumID='$ForumID' AND IsSticky='1'");
list($Stickies) = $DB->next_record(); list($Stickies) = $DB->next_record();
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0); $Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
@ -56,16 +57,22 @@
} }
if(!isset($Forums[$ForumID])) { error(404); } if (!isset($Forums[$ForumID])) {
error(404);
}
// Make sure they're allowed to look at the page // Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) { 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);
}
} }
$ForumName = display_str($Forums[$ForumID]['Name']); $ForumName = display_str($Forums[$ForumID]['Name']);
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); } if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
error(403);
}
// Start printing // Start printing
View::show_header('Forums > '. $Forums[$ForumID]['Name']); View::show_header('Forums > '. $Forums[$ForumID]['Name']);
@ -73,10 +80,10 @@
<div class="thin"> <div class="thin">
<h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2> <h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2>
<div class="linkbox"> <div class="linkbox">
<? if(check_forumperm($ForumID, 'Write') && check_forumperm($ForumID, 'Create')){ ?> <? if (check_forumperm($ForumID, 'Write') && check_forumperm($ForumID, 'Create')) { ?>
<a href="forums.php?action=new&amp;forumid=<?=$ForumID?>" class="brackets">New thread</a> <a href="forums.php?action=new&amp;forumid=<?=$ForumID?>" class="brackets">New thread</a>
<? } ?> <? } ?>
<a href="#" onclick="$('#searchforum').toggle(); this.innerHTML = (this.innerHTML == 'Search this forum'?'Hide search':'Search this forum'); return false;" class="brackets">Search this forum</a> <a href="#" onclick="$('#searchforum').toggle(); this.innerHTML = (this.innerHTML == 'Search this forum' ? 'Hide search' : 'Search this forum'); return false;" class="brackets">Search this forum</a>
<div id="searchforum" class="hidden center"> <div id="searchforum" class="hidden center">
<div style="display: inline-block;"> <div style="display: inline-block;">
<h3>Search this forum:</h3> <h3>Search this forum:</h3>
@ -106,7 +113,7 @@
<td><input type="text" id="username" name="user" size="70" /></td> <td><input type="text" id="username" name="user" size="70" /></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" style="text-align: center"><input type="submit" name="submit" value="Search" /></td> <td colspan="2" style="text-align: center;"><input type="submit" name="submit" value="Search" /></td>
</tr> </tr>
</table> </table>
</form> </form>
@ -117,9 +124,9 @@
<? <?
/* /*
if(check_perms('users_mod')) { if (check_perms('users_mod')) {
$DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'"); $DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'");
if($DB->record_count() == 0) { ?> if ($DB->record_count() == 0) { ?>
<a href="forums.php?action=forum_subscribe&amp;perform=add&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a> <a href="forums.php?action=forum_subscribe&amp;perform=add&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
<? } else { ?> <? } else { ?>
<a href="forums.php?action=forum_subscribe&amp;perform=remove&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Unsubscribe from forum</a> <a href="forums.php?action=forum_subscribe&amp;perform=remove&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Unsubscribe from forum</a>
@ -129,15 +136,15 @@
?> ?>
</div> </div>
<? if(check_perms('site_moderate_forums')) { ?> <? if (check_perms('site_moderate_forums')) { ?>
<div class="linkbox"> <div class="linkbox">
<a href="forums.php?action=edit_rules&amp;forumid=<?=$ForumID?>" class="brackets">Change specific rules</a> <a href="forums.php?action=edit_rules&amp;forumid=<?=$ForumID?>" class="brackets">Change specific rules</a>
</div> </div>
<? } ?> <? } ?>
<? if(!empty($Forums[$ForumID]['SpecificRules'])) { ?> <? if (!empty($Forums[$ForumID]['SpecificRules'])) { ?>
<div class="linkbox"> <div class="linkbox">
<strong>Forum Specific Rules</strong> <strong>Forum Specific Rules</strong>
<? foreach($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) { <? foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = get_thread_info($ThreadIDs); $Thread = get_thread_info($ThreadIDs);
?> ?>
<br /> <br />
@ -147,16 +154,16 @@
<? } ?> <? } ?>
<div class="linkbox pager"> <div class="linkbox pager">
<? <?
$Pages=Format::get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9); $Pages = Format::get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9);
echo $Pages; echo $Pages;
?> ?>
</div> </div>
<table class="forum_index" width="100%"> <table class="forum_index" width="100%">
<tr class="colhead"> <tr class="colhead">
<td style="width:2%;"></td> <td style="width: 2%;"></td>
<td>Latest</td> <td>Latest</td>
<td style="width:7%;">Replies</td> <td style="width: 7%;">Replies</td>
<td style="width:14%;">Author</td> <td style="width: 14%;">Author</td>
</tr> </tr>
<? <?
// Check that we have content to process // Check that we have content to process
@ -170,13 +177,18 @@
<? <?
} 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 // 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 $DB->query('
SELECT
l.TopicID, l.TopicID,
l.PostID, l.PostID,
CEIL((SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = l.TopicID AND forums_posts.ID<=l.PostID)/'.$PerPage.') AS Page CEIL(( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID<=l.PostID)/'.$PerPage.'
) AS Page
FROM forums_last_read_topics AS l FROM forums_last_read_topics AS l
WHERE TopicID IN('.implode(', ', array_keys($Forum)).') AND WHERE TopicID IN('.implode(', ', array_keys($Forum)).')
UserID=\''.$LoggedUser['ID'].'\''); AND UserID=\''.$LoggedUser['ID'].'\'');
// Turns the result set into a multi-dimensional array, with // Turns the result set into a multi-dimensional array, with
// forums_last_read_topics.TopicID as the key. // forums_last_read_topics.TopicID as the key.
@ -186,8 +198,8 @@
//---------- Begin printing //---------- Begin printing
$Row='a'; $Row = 'a';
foreach($Forum as $Topic){ foreach ($Forum as $Topic) {
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic); list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
// Build list of page links // Build list of page links
@ -197,37 +209,41 @@
$PagesText = ''; $PagesText = '';
$TopicPages = ceil($PostCount/$PerPage); $TopicPages = ceil($PostCount/$PerPage);
if($TopicPages > 1){ if ($TopicPages > 1) {
$PagesText=' ('; $PagesText = ' (';
for($i = 1; $i <= $TopicPages; $i++){ for ($i = 1; $i <= $TopicPages; $i++) {
if($TopicPages>4 && ($i > 2 && $i <= $TopicPages-2)) { if ($TopicPages > 4 && ($i > 2 && $i <= $TopicPages - 2)) {
if(!$ShownEllipses) { if (!$ShownEllipses) {
$PageLinks[]='-'; $PageLinks[] = '-';
$ShownEllipses = true; $ShownEllipses = true;
} }
continue; continue;
} }
$PageLinks[]='<a href="forums.php?action=viewthread&amp;threadid='.$TopicID.'&amp;page='.$i.'">'.$i.'</a>'; $PageLinks[] = '<a href="forums.php?action=viewthread&amp;threadid='.$TopicID.'&amp;page='.$i.'">'.$i.'</a>';
} }
$PagesText.=implode(' ', $PageLinks); $PagesText.=implode(' ', $PageLinks);
$PagesText.=')'; $PagesText.=')';
} }
// handle read/unread posts - the reason we can't cache the whole page // 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'; $Read = 'unread';
} else { } else {
$Read = 'read'; $Read = 'read';
} }
if($Locked) { $Read .= "_locked"; } if ($Locked) {
if($Sticky) { $Read .= "_sticky"; } $Read .= '_locked';
}
if ($Sticky) {
$Read .= '_sticky';
}
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td class="<?=$Read?>" title="<?=ucwords(str_replace('_',' ',$Read))?>"></td> <td class="<?=$Read?>" title="<?=ucwords(str_replace('_',' ',$Read))?>"></td>
<td> <td>
<span style="float:left;" class="last_topic"> <span style="float: left;" class="last_topic">
<? <?
$TopicLength=75-(2*count($PageLinks)); $TopicLength = 75 - (2 * count($PageLinks));
unset($PageLinks); unset($PageLinks);
$Title = display_str($Title); $Title = display_str($Title);
$DisplayTitle = $Title; $DisplayTitle = $Title;
@ -238,16 +254,16 @@
</strong> </strong>
<?=$PagesText?> <?=$PagesText?>
</span> </span>
<? if(!empty($LastRead[$TopicID])) { ?> <? if (!empty($LastRead[$TopicID])) { ?>
<span style="float: left;" class="last_read" title="Jump to last read"> <span style="float: left;" class="last_read" title="Jump to last read">
<a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;page=<?=$LastRead[$TopicID]['Page']?>#post<?=$LastRead[$TopicID]['PostID']?>"></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;page=<?=$LastRead[$TopicID]['Page']?>#post<?=$LastRead[$TopicID]['PostID']?>"></a>
</span> </span>
<? } ?> <? } ?>
<span style="float:right;" class="last_poster"> <span style="float: right;" class="last_poster">
by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?> by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?>
</span> </span>
</td> </td>
<td><?=number_format($PostCount-1)?></td> <td><?=number_format($PostCount - 1)?></td>
<td><?=Users::format_username($AuthorID, false, false, false)?></td> <td><?=Users::format_username($AuthorID, false, false, false)?></td>
</tr> </tr>
<? } <? }

View File

@ -2,7 +2,7 @@
enforce_login(); enforce_login();
if(!empty($LoggedUser['DisableForums'])) { if (!empty($LoggedUser['DisableForums'])) {
error(403); error(403);
} }
@ -12,7 +12,7 @@
unset($ForumCats); unset($ForumCats);
$ForumCats = $Cache->get_value('forums_categories'); $ForumCats = $Cache->get_value('forums_categories');
if ($ForumCats === false) { if ($ForumCats === false) {
$DB->query("SELECT ID, Name FROM forums_categories"); $DB->query('SELECT ID, Name FROM forums_categories');
$ForumCats = array(); $ForumCats = array();
while (list($ID, $Name) = $DB->next_record()) { while (list($ID, $Name) = $DB->next_record()) {
$ForumCats[$ID] = $Name; $ForumCats[$ID] = $Name;
@ -21,8 +21,9 @@
} }
//This variable contains all our lovely forum data //This variable contains all our lovely forum data
if(!$Forums = $Cache->get_value('forums_list')) { if (!$Forums = $Cache->get_value('forums_list')) {
$DB->query("SELECT $DB->query('
SELECT
f.ID, f.ID,
f.CategoryID, f.CategoryID,
f.Name, f.Name,
@ -45,11 +46,11 @@
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
GROUP BY f.ID GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort');
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false); $Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
foreach($Forums as $ForumID => $Forum) { foreach ($Forums as $ForumID => $Forum) {
if(count($Forum['SpecificRules'])) { if (count($Forum['SpecificRules'])) {
$DB->query("SELECT ThreadID FROM forums_specific_rules WHERE ForumID = ".$ForumID); $DB->query('SELECT ThreadID FROM forums_specific_rules WHERE ForumID = '.$ForumID);
$ThreadIDs = $DB->collect('ThreadID'); $ThreadIDs = $DB->collect('ThreadID');
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs; $Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
} }
@ -58,7 +59,7 @@
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache. $Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
} }
if(!empty($_POST['action'])){ if (!empty($_POST['action'])) {
switch ($_POST['action']) { switch ($_POST['action']) {
case 'reply': case 'reply':
require(SERVER_ROOT.'/sections/forums/take_reply.php'); require(SERVER_ROOT.'/sections/forums/take_reply.php');
@ -85,7 +86,7 @@
default: default:
error(0); error(0);
} }
} elseif(!empty($_GET['action'])) { } elseif (!empty($_GET['action'])) {
switch ($_GET['action']) { switch ($_GET['action']) {
case 'viewforum': case 'viewforum':
// Page that lists all the topics in a forum // Page that lists all the topics in a forum

View File

@ -12,11 +12,17 @@
\*********************************************************************/ \*********************************************************************/
// Quick SQL injection check // Quick SQL injection check
if(!is_number($_POST['threadid'])) { error(404); } if (!is_number($_POST['threadid'])) {
if($_POST['title'] == ''){ error(0); } error(404);
}
if ($_POST['title'] == ''){
error(0);
}
// End injection check // End injection check
// Make sure they are moderators // Make sure they are moderators
if(!check_perms('site_moderate_forums')) { error(403); } if (!check_perms('site_moderate_forums')) {
error(403);
}
authorize(); authorize();
// Variables for database input // Variables for database input
@ -36,7 +42,8 @@
$DB->query("DELETE FROM forums_last_read_topics WHERE TopicID='$TopicID'"); $DB->query("DELETE FROM forums_last_read_topics WHERE TopicID='$TopicID'");
} }
$DB->query("SELECT $DB->query("
SELECT
t.ForumID, t.ForumID,
f.MinClassWrite, f.MinClassWrite,
COUNT(p.ID) AS Posts COUNT(p.ID) AS Posts
@ -47,26 +54,32 @@
GROUP BY p.TopicID"); GROUP BY p.TopicID");
list($OldForumID, $MinClassWrite, $Posts) = $DB->next_record(); list($OldForumID, $MinClassWrite, $Posts) = $DB->next_record();
if($MinClassWrite > $LoggedUser['Class']) { error(403); } if ($MinClassWrite > $LoggedUser['Class']) {
error(403);
}
// If we're moving // If we're moving
$Cache->delete_value('forums_'.$ForumID); $Cache->delete_value('forums_'.$ForumID);
$Cache->delete_value('forums_'.$OldForumID); $Cache->delete_value('forums_'.$OldForumID);
// If we're deleting a thread // If we're deleting a thread
if(isset($_POST['delete'])) { if (isset($_POST['delete'])) {
if(check_perms('site_admin_forums')) { if (check_perms('site_admin_forums')) {
$DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'"); $DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'");
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'"); $DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'");
$DB->query("SELECT $DB->query("
SELECT
t.ID, t.ID,
t.LastPostID, t.LastPostID,
t.Title, t.Title,
p.AuthorID, p.AuthorID,
um.Username, um.Username,
p.AddedTime, p.AddedTime,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID'), ( SELECT COUNT(pp.ID)
FROM forums_posts AS pp
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
WHERE tt.ForumID='$ForumID'),
t.IsLocked, t.IsLocked,
t.IsSticky t.IsSticky
FROM forums_topics AS t FROM forums_topics AS t
@ -74,10 +87,13 @@
LEFT JOIN users_main AS um ON um.ID=p.AuthorID LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$ForumID' WHERE t.ForumID='$ForumID'
GROUP BY t.ID GROUP BY t.ID
ORDER BY t.LastPostID DESC LIMIT 1"); ORDER BY t.LastPostID DESC
LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false); list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("UPDATE forums SET $DB->query("
UPDATE forums
SET
NumTopics=NumTopics-1, NumTopics=NumTopics-1,
NumPosts=NumPosts-'$Posts', NumPosts=NumPosts-'$Posts',
LastPostTopicID='$NewLastTopic', LastPostTopicID='$NewLastTopic',
@ -91,15 +107,15 @@
$Cache->begin_transaction('forums_list'); $Cache->begin_transaction('forums_list');
$UpdateArray = array( $UpdateArray = array(
'NumPosts'=>$NumPosts, 'NumPosts' => $NumPosts,
'NumTopics'=>'-1', 'NumTopics' => '-1',
'LastPostID'=>$NewLastPostID, 'LastPostID' => $NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID' => $NewLastAuthorID,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID' => $NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime' => $NewLastAddedTime,
'Title'=>$NewLastTitle, 'Title' => $NewLastTitle,
'IsLocked'=>$NewLocked, 'IsLocked' => $NewLocked,
'IsSticky'=>$NewSticky 'IsSticky' => $NewSticky
); );
$Cache->update_row($ForumID, $UpdateArray); $Cache->update_row($ForumID, $UpdateArray);
@ -115,15 +131,17 @@
$Cache->begin_transaction('thread_'.$TopicID.'_info'); $Cache->begin_transaction('thread_'.$TopicID.'_info');
$UpdateArray = array( $UpdateArray = array(
'IsSticky'=>$Sticky, 'IsSticky' => $Sticky,
'IsLocked'=>$Locked, 'IsLocked' => $Locked,
'Title'=>Format::cut_string($RawTitle, 150, 1, 0), 'Title' => Format::cut_string($RawTitle, 150, 1, 0),
'ForumID'=>$ForumID 'ForumID' => $ForumID
); );
$Cache->update_row(false, $UpdateArray); $Cache->update_row(false, $UpdateArray);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
$DB->query("UPDATE forums_topics SET $DB->query("
UPDATE forums_topics
SET
IsSticky = '$Sticky', IsSticky = '$Sticky',
IsLocked = '$Locked', IsLocked = '$Locked',
Title = '$Title', Title = '$Title',
@ -131,41 +149,48 @@
WHERE ID='$TopicID'"); WHERE ID='$TopicID'");
if($ForumID!=$OldForumID) { // If we're moving a thread, change the forum stats if ($ForumID != $OldForumID) { // If we're moving a thread, change the forum stats
$DB->query("SELECT MinClassRead, MinClassWrite, Name FROM forums WHERE ID='$ForumID'"); $DB->query("SELECT MinClassRead, MinClassWrite, Name FROM forums WHERE ID='$ForumID'");
list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record(MYSQLI_NUM, false); list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record(MYSQLI_NUM, false);
$Cache->begin_transaction('thread_'.$TopicID.'_info'); $Cache->begin_transaction('thread_'.$TopicID.'_info');
$UpdateArray = array( $UpdateArray = array(
'ForumName'=>$ForumName, 'ForumName' => $ForumName,
'MinClassRead'=>$MinClassRead, 'MinClassRead' => $MinClassRead,
'MinClassWrite'=>$MinClassWrite 'MinClassWrite' => $MinClassWrite
); );
$Cache->update_row(false, $UpdateArray); $Cache->update_row(false, $UpdateArray);
$Cache->commit_transaction(3600*24*5); $Cache->commit_transaction(3600 * 24 * 5);
$Cache->begin_transaction('forums_list'); $Cache->begin_transaction('forums_list');
// Forum we're moving from // Forum we're moving from
$DB->query("SELECT $DB->query("
SELECT
t.ID, t.ID,
t.LastPostID, t.LastPostID,
t.Title, t.Title,
p.AuthorID, p.AuthorID,
um.Username, um.Username,
p.AddedTime, p.AddedTime,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$OldForumID'), ( SELECT COUNT(pp.ID)
FROM forums_posts AS pp
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
WHERE tt.ForumID='$OldForumID'),
t.IsLocked, t.IsLocked,
t.IsSticky t.IsSticky
FROM forums_topics AS t FROM forums_topics AS t
JOIN forums_posts AS p ON p.ID=t.LastPostID JOIN forums_posts AS p ON p.ID=t.LastPostID
LEFT JOIN users_main AS um ON um.ID=p.AuthorID LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$OldForumID' WHERE t.ForumID='$OldForumID'
ORDER BY t.LastPostID DESC LIMIT 1"); ORDER BY t.LastPostID DESC
LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false); list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("UPDATE forums SET $DB->query("
UPDATE forums
SET
NumTopics=NumTopics-1, NumTopics=NumTopics-1,
NumPosts=NumPosts-'$Posts', NumPosts=NumPosts-'$Posts',
LastPostTopicID='$NewLastTopic', LastPostTopicID='$NewLastTopic',
@ -176,15 +201,15 @@
$UpdateArray = array( $UpdateArray = array(
'NumPosts'=>$NumPosts, 'NumPosts' => $NumPosts,
'NumTopics'=>'-1', 'NumTopics' => '-1',
'LastPostID'=>$NewLastPostID, 'LastPostID' => $NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID' => $NewLastAuthorID,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID' => $NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime' => $NewLastAddedTime,
'Title'=>$NewLastTitle, 'Title' => $NewLastTitle,
'IsLocked'=>$NewLocked, 'IsLocked' => $NewLocked,
'IsSticky'=>$NewSticky 'IsSticky' => $NewSticky
); );
@ -192,22 +217,29 @@
// Forum we're moving to // Forum we're moving to
$DB->query("SELECT $DB->query("
SELECT
t.ID, t.ID,
t.LastPostID, t.LastPostID,
t.Title, t.Title,
p.AuthorID, p.AuthorID,
um.Username, um.Username,
p.AddedTime, p.AddedTime,
(SELECT COUNT(pp.ID) FROM forums_posts AS pp JOIN forums_topics AS tt ON pp.TopicID=tt.ID WHERE tt.ForumID='$ForumID') ( SELECT COUNT(pp.ID)
FROM forums_posts AS pp
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
WHERE tt.ForumID='$ForumID')
FROM forums_topics AS t FROM forums_topics AS t
JOIN forums_posts AS p ON p.ID=t.LastPostID JOIN forums_posts AS p ON p.ID=t.LastPostID
LEFT JOIN users_main AS um ON um.ID=p.AuthorID LEFT JOIN users_main AS um ON um.ID=p.AuthorID
WHERE t.ForumID='$ForumID' WHERE t.ForumID='$ForumID'
ORDER BY t.LastPostID DESC LIMIT 1"); ORDER BY t.LastPostID DESC
LIMIT 1");
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts) = $DB->next_record(MYSQLI_NUM, false); list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("UPDATE forums SET $DB->query("
UPDATE forums
SET
NumTopics=NumTopics+1, NumTopics=NumTopics+1,
NumPosts=NumPosts+'$Posts', NumPosts=NumPosts+'$Posts',
LastPostTopicID='$NewLastTopic', LastPostTopicID='$NewLastTopic',
@ -218,39 +250,38 @@
$UpdateArray = array( $UpdateArray = array(
'NumPosts'=>($NumPosts+$Posts), 'NumPosts' => ($NumPosts + $Posts),
'NumTopics'=>'+1', 'NumTopics' => '+1',
'LastPostID'=>$NewLastPostID, 'LastPostID' => $NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID' => $NewLastAuthorID,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID' => $NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime' => $NewLastAddedTime,
'Title'=>$NewLastTitle 'Title' => $NewLastTitle
); );
$Cache->update_row($ForumID, $UpdateArray); $Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
} else { // Editing } else { // Editing
$DB->query("SELECT LastPostTopicID FROM forums WHERE ID='$ForumID'"); $DB->query("SELECT LastPostTopicID FROM forums WHERE ID='$ForumID'");
list($LastTopicID) = $DB->next_record(); list($LastTopicID) = $DB->next_record();
if($LastTopicID == $TopicID) { if ($LastTopicID == $TopicID) {
$UpdateArray = array( $UpdateArray = array(
'Title'=>$RawTitle, 'Title' => $RawTitle,
'IsLocked'=>$Locked, 'IsLocked' => $Locked,
'IsSticky'=>$Sticky 'IsSticky' => $Sticky
); );
$Cache->begin_transaction('forums_list'); $Cache->begin_transaction('forums_list');
$Cache->update_row($ForumID, $UpdateArray); $Cache->update_row($ForumID, $UpdateArray);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
} }
} }
if($Locked) { if ($Locked) {
$CatalogueID = floor($NumPosts/THREAD_CATALOGUE); $CatalogueID = floor($NumPosts / THREAD_CATALOGUE);
for($i=0;$i<=$CatalogueID;$i++) { for ($i = 0; $i <= $CatalogueID; $i++) {
$Cache->expire_value('thread_'.$TopicID.'_catalogue_'.$i,3600*24*7); $Cache->expire_value('thread_'.$TopicID.'_catalogue_'.$i, 3600 * 24 * 7); // 7 days
} }
$Cache->expire_value('thread_'.$TopicID.'_info',3600*24*7); $Cache->expire_value('thread_'.$TopicID.'_info', 3600 * 24 * 7); // 7 days
$DB->query('UPDATE forums_polls SET Closed=\'0\' WHERE TopicID=\''.$TopicID.'\''); $DB->query('UPDATE forums_polls SET Closed=\'0\' WHERE TopicID=\''.$TopicID.'\'');
$Cache->delete_value('polls_'.$TopicID); $Cache->delete_value('polls_'.$TopicID);

View File

@ -10,16 +10,18 @@
*/ */
$ForumID = $_GET['forumid']; $ForumID = $_GET['forumid'];
if(!is_number($ForumID)) { if (!is_number($ForumID)) {
error(404); error(404);
} }
$Forum = get_forum_info($ForumID); $Forum = get_forum_info($ForumID);
if($Forum === false) { if ($Forum === false) {
error(404); error(404);
} }
if(!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { error(403); } if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
error(403);
}
View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode'); View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode');
?> ?>
<div class="thin"> <div class="thin">
@ -42,16 +44,16 @@
</div> </div>
</div> </div>
<? } ?> <? } ?>
<table class="forum_post box vertical_margin" style="text-align:left;"> <table class="forum_post box vertical_margin" style="text-align: left;">
<colgroup> <colgroup>
<? if(empty($HeavyInfo['DisableAvatars'])) { ?> <? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1?>"> <td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>">
<span style="float:left;"><a href='#newthreadpreview'>#XXXXXX</a> <span style="float: left;"><a href="#newthreadpreview">#XXXXXX</a>
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong> by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
Just now Just now
</span> </span>
@ -64,11 +66,11 @@
</tr> </tr>
<tr> <tr>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? if (!empty($LoggedUser['Avatar'])) { ?> <? if (!empty($LoggedUser['Avatar'])) { ?>
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" /> <img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
<? } else { ?> <? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" /> <img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
<? } ?> <? } ?>
</td> </td>
<td class="body" valign="top"> <td class="body" valign="top">
<div id="contentpreview" style="text-align: left;"></div> <div id="contentpreview" style="text-align: left;"></div>
@ -105,7 +107,9 @@
var AnswerCount = 1; var AnswerCount = 1;
function AddAnswerField() { function AddAnswerField() {
if (AnswerCount >= 25) { return; } if (AnswerCount >= 25) {
return;
}
var AnswerField = document.createElement("input"); var AnswerField = document.createElement("input");
AnswerField.type = "text"; AnswerField.type = "text";
AnswerField.id = "answer_"+AnswerCount; AnswerField.id = "answer_"+AnswerCount;
@ -119,9 +123,13 @@ function AddAnswerField() {
} }
function RemoveAnswerField() { function RemoveAnswerField() {
if (AnswerCount == 1) { return; } if (AnswerCount == 1) {
return;
}
var x = $('#answer_block').raw(); var x = $('#answer_block').raw();
for (i=0; i<2; i++) { x.removeChild(x.lastChild); } for (i = 0; i < 2; i++) {
x.removeChild(x.lastChild);
}
AnswerCount--; AnswerCount--;
} }
//]]> //]]>
@ -147,7 +155,7 @@ function RemoveAnswerField() {
<? } ?> <? } ?>
</table> </table>
<div id="subscribediv" class="hidden"> <div id="subscribediv" class="hidden">
<input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> /> <input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : '' ?> />
<label for="subscribebox">Subscribe to topic</label> <label for="subscribebox">Subscribe to topic</label>
</div> </div>
<div id="buttons" class="center"> <div id="buttons" class="center">

View File

@ -8,13 +8,13 @@
list($Page,$Limit) = Format::page_limit(POSTS_PER_PAGE); list($Page,$Limit) = Format::page_limit(POSTS_PER_PAGE);
if($LoggedUser['CustomForums']) { if ($LoggedUser['CustomForums']) {
unset($LoggedUser['CustomForums']['']); unset($LoggedUser['CustomForums']['']);
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
} }
if((isset($_GET['type']) && $_GET['type'] == 'body')) { if ((isset($_GET['type']) && $_GET['type'] == 'body')) {
$Type = 'body'; $Type = 'body';
} else { } else {
$Type='title'; $Type='title';
@ -22,20 +22,19 @@
} }
// What are we looking for? Let's make sure it isn't dangerous. // What are we looking for? Let's make sure it isn't dangerous.
if(isset($_GET['search'])) { if (isset($_GET['search'])) {
$Search = trim($_GET['search']); $Search = trim($_GET['search']);
} else { } else {
$Search = ''; $Search = '';
} }
// Searching for posts by a specific user // Searching for posts by a specific user
if(!empty($_GET['user'])) { if (!empty($_GET['user'])) {
$User = trim($_GET['user']); $User = trim($_GET['user']);
$DB->query("SELECT ID FROM users_main WHERE Username='".db_string($User)."'"); $DB->query("SELECT ID FROM users_main WHERE Username='".db_string($User)."'");
list($AuthorID) = $DB->next_record(); list($AuthorID) = $DB->next_record();
if($AuthorID === null) { if ($AuthorID === null) {
$AuthorID = 0; $AuthorID = 0;
//this will cause the search to return 0 results. //this will cause the search to return 0 results.
//workaround in line 276 to display that the username was wrong. //workaround in line 276 to display that the username was wrong.
@ -45,14 +44,14 @@
} }
// Are we looking in individual forums? // Are we looking in individual forums?
if(isset($_GET['forums']) && is_array($_GET['forums'])) { if (isset($_GET['forums']) && is_array($_GET['forums'])) {
$ForumArray = array(); $ForumArray = array();
foreach($_GET['forums'] as $Forum) { foreach ($_GET['forums'] as $Forum) {
if(is_number($Forum)) { if (is_number($Forum)) {
$ForumArray[]=$Forum; $ForumArray[]=$Forum;
} }
} }
if(count($ForumArray)>0) { if (count($ForumArray) > 0) {
$SearchForums = implode(', ',$ForumArray); $SearchForums = implode(', ',$ForumArray);
} }
} }
@ -61,7 +60,10 @@
if (!empty($_GET['threadid']) && is_number($_GET['threadid'])) { if (!empty($_GET['threadid']) && is_number($_GET['threadid'])) {
$ThreadID = $_GET['threadid']; $ThreadID = $_GET['threadid'];
$Type = 'body'; $Type = 'body';
$SQL = "SELECT Title FROM forums_topics AS t $SQL = "
SELECT
Title
FROM forums_topics AS t
JOIN forums AS f ON f.ID=t.ForumID JOIN forums AS f ON f.ID=t.ForumID
WHERE t.ID=$ThreadID WHERE t.ID=$ThreadID
AND ((f.MinClassRead <= '$LoggedUser[Class]'"; AND ((f.MinClassRead <= '$LoggedUser[Class]'";
@ -102,9 +104,9 @@
<tr> <tr>
<td><strong>Search in:</strong></td> <td><strong>Search in:</strong></td>
<td> <td>
<input type="radio" name="type" id="type_title" value="title" <? if($Type == 'title') { echo 'checked="checked" '; }?>/> <input type="radio" name="type" id="type_title" value="title" <? if ($Type == 'title') { echo 'checked="checked" '; }?>/>
<label for="type_title">Titles</label> <label for="type_title">Titles</label>
<input type="radio" name="type" id="type_body" value="body" <? if($Type == 'body') { echo 'checked="checked" '; }?>/> <input type="radio" name="type" id="type_body" value="body" <? if ($Type == 'body') { echo 'checked="checked" '; }?>/>
<label for="type_body">Post bodies</label> <label for="type_body">Post bodies</label>
</td> </td>
</tr> </tr>
@ -119,7 +121,7 @@
$LastCategoryID = -1; $LastCategoryID = -1;
$Columns = 0; $Columns = 0;
foreach($Forums as $Forum) { foreach ($Forums as $Forum) {
if (!check_forumperm($Forum['ID'])) { if (!check_forumperm($Forum['ID'])) {
continue; continue;
} }
@ -128,9 +130,9 @@
if ($Forum['CategoryID'] != $LastCategoryID) { if ($Forum['CategoryID'] != $LastCategoryID) {
$LastCategoryID = $Forum['CategoryID']; $LastCategoryID = $Forum['CategoryID'];
if($Open) { if ($Open) {
if ($Columns%5) { ?> if ($Columns % 5) { ?>
<td colspan="<?=(5-($Columns%5))?>"></td> <td colspan="<?=(5 - ($Columns % 5))?>"></td>
<? <?
} }
@ -145,17 +147,17 @@
<td colspan="5"><strong><?=$ForumCats[$Forum['CategoryID']]?></strong></td> <td colspan="5"><strong><?=$ForumCats[$Forum['CategoryID']]?></strong></td>
</tr> </tr>
<tr> <tr>
<? } elseif ($Columns%5 == 0) { ?> <? } elseif ($Columns % 5 == 0) { ?>
</tr> </tr>
<tr> <tr>
<? } ?> <? } ?>
<td> <td>
<input type="checkbox" name="forums[]" value="<?=$Forum['ID']?>" id="forum_<?=$Forum['ID']?>"<? if(isset($_GET['forums']) && in_array($Forum['ID'], $_GET['forums'])) { echo ' checked="checked"';} ?> /> <input type="checkbox" name="forums[]" value="<?=$Forum['ID']?>" id="forum_<?=$Forum['ID']?>"<? if (isset($_GET['forums']) && in_array($Forum['ID'], $_GET['forums'])) { echo ' checked="checked"';} ?> />
<label for="forum_<?=$Forum['ID']?>"><?=htmlspecialchars($Forum['Name'])?></label> <label for="forum_<?=$Forum['ID']?>"><?=htmlspecialchars($Forum['Name'])?></label>
</td> </td>
<? } <? }
if ($Columns%5) { ?> if ($Columns % 5) { ?>
<td colspan="<?=(5-($Columns%5))?>"></td> <td colspan="<?=(5 - ($Columns % 5))?>"></td>
<? } ?> <? } ?>
</tr> </tr>
</table> </table>
@ -183,11 +185,13 @@
// Break search string down into individual words // Break search string down into individual words
$Words = explode(' ', db_string($Search)); $Words = explode(' ', db_string($Search));
if($Type == 'body') { if ($Type == 'body') {
$sql = "SELECT SQL_CALC_FOUND_ROWS $sql = "
SELECT
SQL_CALC_FOUND_ROWS
t.ID, t.ID,
".(!empty($ThreadID) ? "SUBSTRING_INDEX(p.Body, ' ', 40)":"t.Title").", ".(!empty($ThreadID) ? "SUBSTRING_INDEX(p.Body, ' ', 40)" : 't.Title').",
t.ForumID, t.ForumID,
f.Name, f.Name,
p.AddedTime, p.AddedTime,
@ -196,13 +200,12 @@
FROM forums_posts AS p FROM forums_posts AS p
JOIN forums_topics AS t ON t.ID=p.TopicID JOIN forums_topics AS t ON t.ID=p.TopicID
JOIN forums AS f ON f.ID=t.ForumID JOIN forums AS f ON f.ID=t.ForumID
WHERE WHERE ((f.MinClassRead<='$LoggedUser[Class]'";
((f.MinClassRead<='$LoggedUser[Class]'"; if (!empty($RestrictedForums)) {
if(!empty($RestrictedForums)) {
$sql.=" AND f.ID NOT IN ('".$RestrictedForums."')"; $sql.=" AND f.ID NOT IN ('".$RestrictedForums."')";
} }
$sql .= ')'; $sql .= ')';
if(!empty($PermittedForums)) { if (!empty($PermittedForums)) {
$sql.=' OR f.ID IN (\''.$PermittedForums.'\')'; $sql.=' OR f.ID IN (\''.$PermittedForums.'\')';
} }
$sql .= ') AND '; $sql .= ') AND ';
@ -216,20 +219,22 @@
//$sql .= implode("', p.Body) AND LOCATE('", $Words); //$sql .= implode("', p.Body) AND LOCATE('", $Words);
//$sql .= "', p.Body) "; //$sql .= "', p.Body) ";
if(isset($SearchForums)) { if (isset($SearchForums)) {
$sql.=" AND f.ID IN ($SearchForums)"; $sql.=" AND f.ID IN ($SearchForums)";
} }
if(isset($AuthorID)) { if (isset($AuthorID)) {
$sql.=" AND p.AuthorID='$AuthorID' "; $sql.=" AND p.AuthorID='$AuthorID' ";
} }
if(!empty($ThreadID)) { if (!empty($ThreadID)) {
$sql.=" AND t.ID='$ThreadID' "; $sql.=" AND t.ID='$ThreadID' ";
} }
$sql .= "ORDER BY p.AddedTime DESC LIMIT $Limit"; $sql .= "ORDER BY p.AddedTime DESC LIMIT $Limit";
} else { } else {
$sql = "SELECT SQL_CALC_FOUND_ROWS $sql = "
SELECT
SQL_CALC_FOUND_ROWS
t.ID, t.ID,
t.Title, t.Title,
t.ForumID, t.ForumID,
@ -239,23 +244,22 @@
'' ''
FROM forums_topics AS t FROM forums_topics AS t
JOIN forums AS f ON f.ID=t.ForumID JOIN forums AS f ON f.ID=t.ForumID
WHERE WHERE ((f.MinClassRead<='$LoggedUser[Class]'";
((f.MinClassRead<='$LoggedUser[Class]'"; if (!empty($RestrictedForums)) {
if(!empty($RestrictedForums)) {
$sql.=" AND f.ID NOT IN ('".$RestrictedForums."')"; $sql.=" AND f.ID NOT IN ('".$RestrictedForums."')";
} }
$sql .= ')'; $sql .= ')';
if(!empty($PermittedForums)) { if (!empty($PermittedForums)) {
$sql.=' OR f.ID IN (\''.$PermittedForums.'\')'; $sql.=' OR f.ID IN (\''.$PermittedForums.'\')';
} }
$sql .= ') AND '; $sql .= ') AND ';
$sql .= "t.Title LIKE '%"; $sql .= "t.Title LIKE '%";
$sql .= implode("%' AND t.Title LIKE '%", $Words); $sql .= implode("%' AND t.Title LIKE '%", $Words);
$sql .= "%' "; $sql .= "%' ";
if(isset($SearchForums)) { if (isset($SearchForums)) {
$sql.=" AND f.ID IN ($SearchForums)"; $sql.=" AND f.ID IN ($SearchForums)";
} }
if(isset($AuthorID)) { if (isset($AuthorID)) {
$sql.=" AND t.AuthorID='$AuthorID' "; $sql.=" AND t.AuthorID='$AuthorID' ";
} }
$sql .= "ORDER BY t.LastPostTime DESC LIMIT $Limit"; $sql .= "ORDER BY t.LastPostTime DESC LIMIT $Limit";
@ -277,12 +281,12 @@
<td><?=(!empty($ThreadID))?'Post Begins':'Topic'?></td> <td><?=(!empty($ThreadID))?'Post Begins':'Topic'?></td>
<td>Time</td> <td>Time</td>
</tr> </tr>
<? if($DB->record_count() == 0) { ?> <? if ($DB->record_count() == 0) { ?>
<tr><td colspan="3">Nothing found<?=(isset($AuthorID) && $AuthorID == 0) ? ' (unknown username)' : ''?>!</td></tr> <tr><td colspan="3">Nothing found<?=(isset($AuthorID) && $AuthorID == 0) ? ' (unknown username)' : '' ?>!</td></tr>
<? } <? }
$Row = 'a'; // For the pretty colours $Row = 'a'; // For the pretty colours
while(list($ID, $Title, $ForumID, $ForumName, $LastTime, $PostID, $Body) = $DB->next_record()) { while (list($ID, $Title, $ForumID, $ForumName, $LastTime, $PostID, $Body) = $DB->next_record()) {
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
// Print results // Print results
?> ?>
@ -291,13 +295,13 @@
<a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$ForumName?></a> <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$ForumName?></a>
</td> </td>
<td> <td>
<? if(empty($ThreadID)) { ?> <? if (empty($ThreadID)) { ?>
<a href="forums.php?action=viewthread&amp;threadid=<?=$ID?>"><?=Format::cut_string($Title, 80); ?></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$ID?>"><?=Format::cut_string($Title, 80); ?></a>
<? } else { ?> <? } else { ?>
<?=Format::cut_string($Title, 80); ?> <?=Format::cut_string($Title, 80); ?>
<? } <? }
if ($Type == 'body') { ?> if ($Type == 'body') { ?>
<a href="#" onclick="$('#post_<?=$PostID?>_text').toggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&amp;threadid=<?=$ID?><? if(!empty($PostID)) { echo '&amp;postid='.$PostID.'#post'.$PostID; } ?>"></a></span> <a href="#" onclick="$('#post_<?=$PostID?>_text').toggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&amp;threadid=<?=$ID?><? if (!empty($PostID)) { echo '&amp;postid='.$PostID.'#post'.$PostID; } ?>"></a></span>
<? } ?> <? } ?>
</td> </td>
<td> <td>
@ -305,7 +309,7 @@
</td> </td>
</tr> </tr>
<? <?
if($Type == 'body') { ?> if ($Type == 'body') { ?>
<tr class="row<?=$Row?> hidden" id="post_<?=$PostID?>_text"> <tr class="row<?=$Row?> hidden" id="post_<?=$PostID?>_text">
<td colspan="3"><?=$Text->full_format($Body)?></td> <td colspan="3"><?=$Text->full_format($Body)?></td>
</tr> </tr>

View File

@ -29,7 +29,7 @@
error(0); error(0);
} }
//If you're not sending anything, go back // If you're not sending anything, go back
if (empty($_POST['body']) || empty($_POST['title'])) { if (empty($_POST['body']) || empty($_POST['title'])) {
header('Location: '.$_SERVER['HTTP_REFERER']); header('Location: '.$_SERVER['HTTP_REFERER']);
die(); die();
@ -38,7 +38,7 @@
$Body = $_POST['body']; $Body = $_POST['body'];
if ($LoggedUser['DisablePosting']) { if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed'); error('Your posting privileges have been removed');
} }
$Title = Format::cut_string(trim($_POST['title']), 150, 1, 0); $Title = Format::cut_string(trim($_POST['title']), 150, 1, 0);
@ -46,27 +46,33 @@
$ForumID = $_POST['forum']; $ForumID = $_POST['forum'];
if (!isset($Forums[$ForumID])) { error(404); } 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); error(403);
} }
$DB->query("INSERT INTO forums_topics $DB->query("
INSERT INTO forums_topics
(Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID) (Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID)
Values Values
('".db_string($Title)."', '".$LoggedUser['ID']."', '$ForumID', '".sqltime()."', '".$LoggedUser['ID']."')"); ('".db_string($Title)."', '".$LoggedUser['ID']."', '$ForumID', '".sqltime()."', '".$LoggedUser['ID']."')");
$TopicID = $DB->inserted_id(); $TopicID = $DB->inserted_id();
$DB->query("INSERT INTO forums_posts $DB->query("
INSERT INTO forums_posts
(TopicID, AuthorID, AddedTime, Body) (TopicID, AuthorID, AddedTime, Body)
VALUES VALUES
('$TopicID', '".$LoggedUser['ID']."', '".sqltime()."', '".db_string($Body)."')"); ('$TopicID', '".$LoggedUser['ID']."', '".sqltime()."', '".db_string($Body)."')");
$PostID = $DB->inserted_id(); $PostID = $DB->inserted_id();
$DB->query("UPDATE forums SET $DB->query("
UPDATE forums
SET
NumPosts = NumPosts+1, NumPosts = NumPosts+1,
NumTopics = NumTopics+1, NumTopics = NumTopics+1,
LastPostID = '$PostID', LastPostID = '$PostID',
@ -75,7 +81,9 @@
LastPostTime = '".sqltime()."' LastPostTime = '".sqltime()."'
WHERE ID = '$ForumID'"); WHERE ID = '$ForumID'");
$DB->query("UPDATE forums_topics SET $DB->query("
UPDATE forums_topics
SET
NumPosts = NumPosts+1, NumPosts = NumPosts+1,
LastPostID = '$PostID', LastPostID = '$PostID',
LastPostAuthorID = '".$LoggedUser['ID']."', LastPostAuthorID = '".$LoggedUser['ID']."',
@ -100,7 +108,7 @@
$Cache->delete_value('subscriptions_user_'.$SubscriberID); $Cache->delete_value('subscriptions_user_'.$SubscriberID);
} }
} }
*/ */
if (empty($_POST['question']) || empty($_POST['answers']) || !check_perms('forums_polls_create')) { if (empty($_POST['question']) || empty($_POST['answers']) || !check_perms('forums_polls_create')) {
$NoPoll = 1; $NoPoll = 1;
@ -127,7 +135,7 @@
$Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,'0000-00-00 00:00:00','0'), 0); $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); send_irc("PRIVMSG ".ADMIN_CHAN." :!mod Poll created by ".$LoggedUser['Username'].': "'.$Question.'" https://'.SSL_SITE_URL.'/forums.php?action=viewthread&threadid='.$TopicID);
} }
} }
@ -141,8 +149,8 @@
} }
if ($Stickies > 0) { if ($Stickies > 0) {
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickies $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page
} else { } else {
$Part1 = array(); $Part1 = array();
$Part3 = $Forum; $Part3 = $Forum;
@ -158,44 +166,44 @@
'LastPostTime' => sqltime(), 'LastPostTime' => sqltime(),
'LastPostAuthorID' => $LoggedUser['ID'], 'LastPostAuthorID' => $LoggedUser['ID'],
'NoPoll' => $NoPoll 'NoPoll' => $NoPoll
)); //Bumped )); // Bumped
$Forum = $Part1 + $Part2 + $Part3; $Forum = $Part1 + $Part2 + $Part3;
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0); $Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0);
//Update the forum root // Update the forum root
$Cache->begin_transaction('forums_list'); $Cache->begin_transaction('forums_list');
$Cache->update_row($ForumID, array( $Cache->update_row($ForumID, array(
'NumPosts'=>'+1', 'NumPosts' => '+1',
'NumTopics'=>'+1', 'NumTopics' => '+1',
'LastPostID'=>$PostID, 'LastPostID' => $PostID,
'LastPostAuthorID'=>$LoggedUser['ID'], 'LastPostAuthorID' => $LoggedUser['ID'],
'LastPostTopicID'=>$TopicID, 'LastPostTopicID' => $TopicID,
'LastPostTime'=>sqltime(), 'LastPostTime' => sqltime(),
'Title'=>$Title, 'Title' => $Title,
'IsLocked'=>0, 'IsLocked' => 0,
'IsSticky'=>0 'IsSticky' => 0
)); ));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
} else { } else {
//If there's no cache, we have no data, and if there's no data // If there's no cache, we have no data, and if there's no data
$Cache->delete_value('forums_list'); $Cache->delete_value('forums_list');
} }
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_0'); $Cache->begin_transaction('thread_'.$TopicID.'_catalogue_0');
$Post = array( $Post = array(
'ID'=>$PostID, 'ID' => $PostID,
'AuthorID'=>$LoggedUser['ID'], 'AuthorID' => $LoggedUser['ID'],
'AddedTime'=>sqltime(), 'AddedTime' => sqltime(),
'Body'=>$Body, 'Body' => $Body,
'EditedUserID'=>0, 'EditedUserID' => 0,
'EditedTime'=>'0000-00-00 00:00:00', 'EditedTime' => '0000-00-00 00:00:00'
); );
$Cache->insert('', $Post); $Cache->insert('', $Post);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
$Cache->begin_transaction('thread_'.$TopicID.'_info'); $Cache->begin_transaction('thread_'.$TopicID.'_info');
$Cache->update_row(false, array('Posts'=>'+1', 'LastPostAuthorID'=>$LoggedUser['ID'])); $Cache->update_row(false, array('Posts' => '+1', 'LastPostAuthorID' => $LoggedUser['ID']));
$Cache->commit_transaction(0); $Cache->commit_transaction(0);
header('Location: forums.php?action=viewthread&threadid='.$TopicID); header('Location: forums.php?action=viewthread&threadid='.$TopicID);

View File

@ -1,6 +1,10 @@
<? <?
authorize(); authorize();
$FriendID = db_string($_GET['friendid']); $FriendID = db_string($_GET['friendid']);
$DB->query("INSERT IGNORE INTO friends (UserID, FriendID) VALUES ('$LoggedUser[ID]', '$FriendID')"); $DB->query("
INSERT IGNORE INTO friends
(UserID, FriendID)
VALUES ('$LoggedUser[ID]', '$FriendID')");
header('Location: friends.php'); header('Location: friends.php');
?> ?>

View File

@ -1,4 +1,9 @@
<? <?
$DB->query("UPDATE friends SET Comment='$P[comment]' WHERE UserID='$LoggedUser[ID]' AND FriendID='$P[friendid]'"); $DB->query("
UPDATE friends
SET Comment='$P[comment]'
WHERE UserID='$LoggedUser[ID]'
AND FriendID='$P[friendid]'");
header('Location: friends.php'); header('Location: friends.php');
?> ?>

View File

@ -1,4 +1,4 @@
<? <?
/************************************************************************ /************************************************************************
//------------// Main friends page //----------------------------------// //------------// Main friends page //----------------------------------//
This page lists a user's friends. This page lists a user's friends.
@ -22,7 +22,8 @@
list($Page,$Limit) = Format::page_limit(FRIENDS_PER_PAGE); list($Page,$Limit) = Format::page_limit(FRIENDS_PER_PAGE);
// Main query // Main query
$DB->query("SELECT $DB->query("
SELECT
SQL_CALC_FOUND_ROWS SQL_CALC_FOUND_ROWS
f.FriendID, f.FriendID,
f.Comment, f.Comment,
@ -72,7 +73,7 @@
<table class="friends_table vertical_margin"> <table class="friends_table vertical_margin">
<tr class="colhead"> <tr class="colhead">
<td colspan="3"> <td colspan="3">
<span style="float:left;"><?=Users::format_username($FriendID, true, true, true, true)?> <span style="float: left;"><?=Users::format_username($FriendID, true, true, true, true)?>
<? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?> <? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong> &nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
<? } <? }
@ -84,7 +85,7 @@
<? } ?> <? } ?>
</span> </span>
<? if (check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) { ?> <? if (check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) { ?>
<span style="float:right;"><?=time_diff($LastAccess)?></span> <span style="float: right;"><?=time_diff($LastAccess)?></span>
<? } ?> <? } ?>
</td> </td>
</tr> </tr>

View File

@ -1,16 +1,16 @@
<? <?
$P = db_array($_POST); $P = db_array($_POST);
enforce_login(); enforce_login();
if(!empty($_REQUEST['friendid']) && !is_number($_REQUEST['friendid'])) { if (!empty($_REQUEST['friendid']) && !is_number($_REQUEST['friendid'])) {
error(404); error(404);
} }
if(!empty($_REQUEST['action'])) { if (!empty($_REQUEST['action'])) {
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'add': case 'add':
include(SERVER_ROOT.'/sections/friends/add.php'); include(SERVER_ROOT.'/sections/friends/add.php');
break; break;
case 'Defriend': case 'Remove friend':
authorize(); authorize();
include(SERVER_ROOT.'/sections/friends/remove.php'); include(SERVER_ROOT.'/sections/friends/remove.php');
break; break;

View File

@ -1,4 +1,8 @@
<? <?
$DB->query("DELETE FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$P[friendid]'"); $DB->query("
DELETE FROM friends
WHERE UserID='$LoggedUser[ID]'
AND FriendID='$P[friendid]'");
header('Location: friends.php'); header('Location: friends.php');
?> ?>

View File

@ -33,8 +33,8 @@
} }
} }
if(isset($_GET['c']) && strlen($Data) < 262144) { if (isset($_GET['c']) && strlen($Data) < 262144) {
$Cache->cache_value('image_cache_'.md5($URL), array($Data,$Type), 3600*24*7); $Cache->cache_value('image_cache_'.md5($URL), array($Data,$Type), 3600 * 24 * 7);
} }
} }
@ -63,13 +63,13 @@
$UserInfo['Avatar'] = ''; $UserInfo['Avatar'] = '';
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000); $Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
$DB->query("UPDATE users_info SET Avatar='', AdminComment=CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data))/1024)."kb, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment) WHERE UserID='$UserID'"); $DB->query("UPDATE users_info SET Avatar='', AdminComment=CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data)) / 1024)." kB, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment) WHERE UserID='$UserID'");
// Send PM // Send PM
send_pm($UserID,0,"Your avatar has been automatically reset","The following avatar rules have been in effect for months now: send_pm($UserID,0,"Your avatar has been automatically reset","The following avatar rules have been in effect for months now:
[b]Avatars must not exceed 256kB or be vertically longer than 400px. [/b] [b]Avatars must not exceed 256 kB or be vertically longer than 400px. [/b]
Your avatar at $DBURL has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your avatar once it has been resized down to an acceptable size."); Your avatar at $DBURL has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your avatar once it has been resized down to an acceptable size.");

View File

@ -39,14 +39,16 @@
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong><a href="staffblog.php">Latest staff blog posts</a></strong></div> <div class="head colhead_dark"><strong><a href="staffblog.php">Latest staff blog posts</a></strong></div>
<? <?
if(($Blog = $Cache->get_value('staff_blog')) === false) { if (($Blog = $Cache->get_value('staff_blog')) === false) {
$DB->query("SELECT $DB->query("
SELECT
b.ID, b.ID,
um.Username, um.Username,
b.Title, b.Title,
b.Body, b.Body,
b.Time b.Time
FROM staff_blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID FROM staff_blog AS b
LEFT JOIN users_main AS um ON b.UserID=um.ID
ORDER BY Time DESC"); ORDER BY Time DESC");
$Blog = $DB->to_array(false, MYSQLI_NUM); $Blog = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('staff_blog', $Blog, 1209600); $Cache->cache_value('staff_blog', $Blog, 1209600);
@ -63,12 +65,12 @@
?> ?>
<ul class="stats nobullet"> <ul class="stats nobullet">
<? <?
if(count($Blog) < 5) { if (count($Blog) < 5) {
$Limit = count($Blog); $Limit = count($Blog);
} else { } else {
$Limit = 5; $Limit = 5;
} }
for($i = 0; $i < $Limit; $i++) { for ($i = 0; $i < $Limit; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
$BlogTime = strtotime($BlogTime); $BlogTime = strtotime($BlogTime);
?> ?>
@ -86,7 +88,7 @@
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div> <div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
<? <?
if(($Blog = $Cache->get_value('blog')) === false) { if (($Blog = $Cache->get_value('blog')) === false) {
$DB->query("SELECT $DB->query("SELECT
b.ID, b.ID,
um.Username, um.Username,
@ -103,12 +105,12 @@
?> ?>
<ul class="stats nobullet"> <ul class="stats nobullet">
<? <?
if(count($Blog) < 5) { if (count($Blog) < 5) {
$Limit = count($Blog); $Limit = count($Blog);
} else { } else {
$Limit = 5; $Limit = 5;
} }
for($i = 0; $i < $Limit; $i++) { for ($i = 0; $i < $Limit; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
?> ?>
<li> <li>
@ -122,13 +124,12 @@
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong>Stats</strong></div> <div class="head colhead_dark"><strong>Stats</strong></div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<? if (USER_LIMIT>0) { ?> <? if (USER_LIMIT > 0) { ?>
<li>Maximum users: <?=number_format(USER_LIMIT) ?></li> <li>Maximum users: <?=number_format(USER_LIMIT) ?></li>
<? <?
} }
if(($UserCount = $Cache->get_value('stats_user_count')) === false){ if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'"); $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
list($UserCount) = $DB->next_record(); list($UserCount) = $DB->next_record();
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache $Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
@ -139,45 +140,53 @@
<? <?
if (($UserStats = $Cache->get_value('stats_users')) === false) { if (($UserStats = $Cache->get_value('stats_users')) === false) {
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600*24)."'"); $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24)."'");
list($UserStats['Day']) = $DB->next_record(); list($UserStats['Day']) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600*24*7)."'"); $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24 * 7)."'");
list($UserStats['Week']) = $DB->next_record(); list($UserStats['Week']) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600*24*30)."'"); $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24 * 30)."'");
list($UserStats['Month']) = $DB->next_record(); list($UserStats['Month']) = $DB->next_record();
$Cache->cache_value('stats_users',$UserStats,0); $Cache->cache_value('stats_users',$UserStats,0);
} }
?> ?>
<li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day']/$UserCount*100,2)?>%)</li> <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100,2)?>%)</li>
<li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week']/$UserCount*100,2)?>%)</li> <li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week'] / $UserCount * 100,2)?>%)</li>
<li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month']/$UserCount*100,2)?>%)</li> <li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month'] / $UserCount * 100,2)?>%)</li>
<? <?
if(($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) { if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
$DB->query("SELECT COUNT(ID) FROM torrents"); $DB->query("SELECT COUNT(ID) FROM torrents");
list($TorrentCount) = $DB->next_record(); list($TorrentCount) = $DB->next_record();
$Cache->cache_value('stats_torrent_count', $TorrentCount, 0); //inf cache $Cache->cache_value('stats_torrent_count', $TorrentCount, 0); //inf cache
} }
if(($AlbumCount = $Cache->get_value('stats_album_count')) === false) { if (($AlbumCount = $Cache->get_value('stats_album_count')) === false) {
$DB->query("SELECT COUNT(ID) FROM torrents_group WHERE CategoryID='1'"); $DB->query("SELECT COUNT(ID) FROM torrents_group WHERE CategoryID='1'");
list($AlbumCount) = $DB->next_record(); list($AlbumCount) = $DB->next_record();
$Cache->cache_value('stats_album_count', $AlbumCount, 0); //inf cache $Cache->cache_value('stats_album_count', $AlbumCount, 0); //inf cache
} }
if(($ArtistCount = $Cache->get_value('stats_artist_count')) === false) { if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
$DB->query("SELECT COUNT(ArtistID) FROM artists_group"); $DB->query("SELECT COUNT(ArtistID) FROM artists_group");
list($ArtistCount) = $DB->next_record(); list($ArtistCount) = $DB->next_record();
$Cache->cache_value('stats_artist_count', $ArtistCount, 0); //inf cache $Cache->cache_value('stats_artist_count', $ArtistCount, 0); //inf cache
} }
if (($PerfectCount = $Cache->get_value('stats_perfect_count')) === false) { if (($PerfectCount = $Cache->get_value('stats_perfect_count')) === false) {
$DB->query("SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC'))"); $DB->query("
SELECT COUNT(ID)
FROM torrents
WHERE ((LogScore = 100 AND Format = 'FLAC')
OR (Media = 'Vinyl' AND Format = 'FLAC')
OR (Media = 'WEB' AND Format = 'FLAC')
OR (Media = 'DVD' AND Format = 'FLAC')
OR (Media = 'Soundboard' AND Format = 'FLAC')
)");
list($PerfectCount) = $DB->next_record(); list($PerfectCount) = $DB->next_record();
$Cache->cache_value('stats_perfect_count', $PerfectCount, 0); $Cache->cache_value('stats_perfect_count', $PerfectCount, 0); //inf cache
} }
?> ?>
<li>Torrents: <?=number_format($TorrentCount)?></li> <li>Torrents: <?=number_format($TorrentCount)?></li>
@ -198,7 +207,7 @@
} }
?> ?>
<li>Requests: <?=number_format($RequestCount)?> (<?=number_format($FilledCount/$RequestCount*100, 2)?>% filled)</li> <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($FilledCount / $RequestCount * 100, 2)?>% filled)</li>
<? <?
if ($SnatchStats = $Cache->get_value('stats_snatches')) { if ($SnatchStats = $Cache->get_value('stats_snatches')) {
@ -207,10 +216,10 @@
<? <?
} }
if(($PeerStats = $Cache->get_value('stats_peers')) === false) { if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
//Cache lock! //Cache lock!
$PeerStatsLocked = $Cache->get_value('stats_peers_lock'); $PeerStatsLocked = $Cache->get_value('stats_peers_lock');
if(!$PeerStatsLocked) { if (!$PeerStatsLocked) {
$Cache->cache_value('stats_peers_lock', 1, 30); $Cache->cache_value('stats_peers_lock', 1, 30);
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid) FROM xbt_files_users WHERE active=1 GROUP BY Type"); $DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid) FROM xbt_files_users WHERE active=1 GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false); $PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
@ -224,7 +233,7 @@
list($LeecherCount,$SeederCount) = $PeerStats; list($LeecherCount,$SeederCount) = $PeerStats;
} }
if(!$PeerStatsLocked) { if (!$PeerStatsLocked) {
$Ratio = Format::get_ratio_html($SeederCount, $LeecherCount); $Ratio = Format::get_ratio_html($SeederCount, $LeecherCount);
$PeerCount = number_format($SeederCount + $LeecherCount); $PeerCount = number_format($SeederCount + $LeecherCount);
$SeederCount = number_format($SeederCount); $SeederCount = number_format($SeederCount);
@ -236,17 +245,17 @@
<li>Peers: <?=$PeerCount?></li> <li>Peers: <?=$PeerCount?></li>
<li>Seeders: <?=$SeederCount?></li> <li>Seeders: <?=$SeederCount?></li>
<li>Leechers: <?=$LeecherCount?></li> <li>Leechers: <?=$LeecherCount?></li>
<li>Seeder/Leecher ratio: <?=$Ratio?></li> <li>Seeder/leecher ratio: <?=$Ratio?></li>
</ul> </ul>
</div> </div>
<? <?
if(($TopicID = $Cache->get_value('polls_featured')) === false) { if (($TopicID = $Cache->get_value('polls_featured')) === false) {
$DB->query("SELECT TopicID FROM forums_polls ORDER BY Featured DESC LIMIT 1"); $DB->query("SELECT TopicID FROM forums_polls ORDER BY Featured DESC LIMIT 1");
list($TopicID) = $DB->next_record(); list($TopicID) = $DB->next_record();
$Cache->cache_value('polls_featured',$TopicID,0); $Cache->cache_value('polls_featured',$TopicID,0);
} }
if($TopicID) { if ($TopicID) {
if(($Poll = $Cache->get_value('polls_'.$TopicID)) === false) { if (($Poll = $Cache->get_value('polls_'.$TopicID)) === false) {
$DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$TopicID."'"); $DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$TopicID."'");
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1)); list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
$Answers = unserialize($Answers); $Answers = unserialize($Answers);
@ -292,16 +301,16 @@
<ul class="poll nobullet"> <ul class="poll nobullet">
<? foreach ($Answers as $i => $Answer) { <? foreach ($Answers as $i => $Answer) {
if ($TotalVotes > 0) { if ($TotalVotes > 0) {
$Ratio = $Votes[$i]/$MaxVotes; $Ratio = $Votes[$i] / $MaxVotes;
$Percent = $Votes[$i]/$TotalVotes; $Percent = $Votes[$i] / $TotalVotes;
} else { } else {
$Ratio=0; $Ratio = 0;
$Percent=0; $Percent = 0;
} }
?> <li><?=display_str($Answers[$i])?> (<?=number_format($Percent*100,2)?>%)</li> ?> <li><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100,2)?>%)</li>
<li class="graph"> <li class="graph">
<span class="left_poll"></span> <span class="left_poll"></span>
<span class="center_poll" style="width:<?=round($Ratio*140)?>px;"></span> <span class="center_poll" style="width: <?=round($Ratio * 140)?>px;"></span>
<span class="right_poll"></span> <span class="right_poll"></span>
<br /> <br />
</li> </li>
@ -319,7 +328,7 @@
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br /> <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
<? } ?> <? } ?>
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br /> <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br />
<input type="button" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" /> <input type="button" onclick="ajax.post('index.php','poll',function(response) {$('#poll_container').raw().innerHTML = response});" value="Vote" />
</form> </form>
</div> </div>
<? } ?> <? } ?>
@ -338,7 +347,8 @@
$Recommend_artists = $Cache->get_value('recommend_artists'); $Recommend_artists = $Cache->get_value('recommend_artists');
if (!is_array($Recommend) || !is_array($Recommend_artists)) { if (!is_array($Recommend) || !is_array($Recommend_artists)) {
$DB->query("SELECT $DB->query("
SELECT
tr.GroupID, tr.GroupID,
tr.UserID, tr.UserID,
u.Username, u.Username,
@ -347,8 +357,8 @@
FROM torrents_recommended AS tr FROM torrents_recommended AS tr
JOIN torrents_group AS tg ON tg.ID=tr.GroupID JOIN torrents_group AS tg ON tg.ID=tr.GroupID
LEFT JOIN users_main AS u ON u.ID=tr.UserID LEFT JOIN users_main AS u ON u.ID=tr.UserID
ORDER BY tr.Time DESC LIMIT 10 ORDER BY tr.Time DESC
"); LIMIT 10");
$Recommend = $DB->to_array(); $Recommend = $DB->to_array();
$Cache->cache_value('recommend',$Recommend,1209600); $Cache->cache_value('recommend',$Recommend,1209600);
@ -367,7 +377,7 @@
<table class="torrent_table hidden" id="vanityhouse"> <table class="torrent_table hidden" id="vanityhouse">
<? <?
foreach($Recommend as $Recommendations) { foreach ($Recommend as $Recommendations) {
list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations; list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
$TagsStr = ''; $TagsStr = '';
if ($TagList) { if ($TagList) {
@ -406,7 +416,7 @@
<div id="news<?=$NewsID?>" class="box"> <div id="news<?=$NewsID?>" class="box">
<div class="head"> <div class="head">
<strong><?=$Text->full_format($Title)?></strong> <?=time_diff($NewsTime);?> <strong><?=$Text->full_format($Title)?></strong> <?=time_diff($NewsTime);?>
<? if(check_perms('admin_manage_news')) {?> <? if (check_perms('admin_manage_news')) { ?>
- <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a> - <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>" class="brackets">Edit</a>
<? } ?> <? } ?>
</div> </div>
@ -432,8 +442,9 @@ function contest() {
global $DB, $Cache, $LoggedUser; global $DB, $Cache, $LoggedUser;
list($Contest, $TotalPoints) = $Cache->get_value('contest'); list($Contest, $TotalPoints) = $Cache->get_value('contest');
if(!$Contest) { if (!$Contest) {
$DB->query("SELECT $DB->query("
SELECT
UserID, UserID,
SUM(Points), SUM(Points),
Username Username
@ -455,7 +466,7 @@ function contest() {
<div class="box box_contest"> <div class="box box_contest">
<div class="head colhead_dark"><strong>Quality time scoreboard</strong></div> <div class="head colhead_dark"><strong>Quality time scoreboard</strong></div>
<div class="pad"> <div class="pad">
<ol style="padding-left:5px;"> <ol style="padding-left: 5px;">
<? <?
foreach ($Contest as $User) { foreach ($Contest as $User) {
list($UserID, $Points, $Username) = $User; list($UserID, $Points, $Username) = $User;

View File

@ -74,7 +74,7 @@
} else { } else {
// Either his key has expired, or he hasn't requested a pass change at all // Either his key has expired, or he hasn't requested a pass change at all
if (strtotime($Expires)<time() && $UserID) { if (strtotime($Expires) < time() && $UserID) {
// If his key has expired, clear all the reset information // If his key has expired, clear all the reset information
$DB->query("UPDATE $DB->query("UPDATE
users_info users_info

View File

@ -15,7 +15,7 @@
$ID = $_GET['id']; $ID = $_GET['id'];
switch ($Short) { switch ($Short) {
case "user" : case 'user' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID); $DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
@ -23,19 +23,19 @@
list($Username) = $DB->next_record(); list($Username) = $DB->next_record();
break; break;
case "request_update" : case 'request_update' :
$NoReason = true; $NoReason = true;
$DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID); $DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
} }
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record(); list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != "Music" || $Year != 0))) { if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != 'Music' || $Year != 0))) {
error(403); error(403);
} }
break; break;
case "request" : case 'request' :
$DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID); $DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
@ -43,7 +43,7 @@
list($Name, $Desc, $Filled) = $DB->next_record(); list($Name, $Desc, $Filled) = $DB->next_record();
break; break;
case "collage" : case 'collage' :
$DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID); $DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
@ -51,7 +51,7 @@
list($Name, $Desc) = $DB->next_record(); list($Name, $Desc) = $DB->next_record();
break; break;
case "thread" : case 'thread' :
$DB->query("SELECT ft.Title, ft.ForumID, um.Username FROM forums_topics AS ft JOIN users_main AS um ON um.ID=ft.AuthorID WHERE ft.ID=".$ID); $DB->query("SELECT ft.Title, ft.ForumID, um.Username FROM forums_topics AS ft JOIN users_main AS um ON um.ID=ft.AuthorID WHERE ft.ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
@ -66,15 +66,15 @@
} }
break; break;
case "post" : case 'post' :
$DB->query("SELECT fp.Body, fp.TopicID, um.Username FROM forums_posts AS fp JOIN users_main AS um ON um.ID=fp.AuthorID WHERE fp.ID=".$ID); $DB->query('SELECT fp.Body, fp.TopicID, um.Username FROM forums_posts AS fp JOIN users_main AS um ON um.ID=fp.AuthorID WHERE fp.ID='.$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
} }
list($Body, $TopicID, $Username) = $DB->next_record(); list($Body, $TopicID, $Username) = $DB->next_record();
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = ".$TopicID); $DB->query('SELECT ForumID FROM forums_topics WHERE ID = '.$TopicID);
list($ForumID) = $DB->next_record(); list($ForumID) = $DB->next_record();
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID); $DB->query('SELECT MinClassRead FROM forums WHERE ID = '.$ForumID);
list($MinClassRead) = $DB->next_record(); list($MinClassRead) = $DB->next_record();
if (!empty($LoggedUser['DisableForums']) || if (!empty($LoggedUser['DisableForums']) ||
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
@ -83,17 +83,17 @@
} }
break; break;
case "requests_comment" : case 'requests_comment' :
case "torrents_comment" : case 'torrents_comment' :
case "artist_comment": case 'artist_comment':
case "collages_comment" : case 'collages_comment' :
$Table = $Short.'s'; $Table = $Short.'s';
if ($Short == "collages_comment") { if ($Short == 'collages_comment') {
$Column = "UserID"; $Column = 'UserID';
} else { } else {
$Column = "AuthorID"; $Column = 'AuthorID';
} }
$DB->query("SELECT ".$Short.".Body, um.Username FROM ".$Table." AS ".$Short." JOIN users_main AS um ON um.ID=".$Short.".".$Column." WHERE ".$Short.".ID=".$ID); $DB->query('SELECT '.$Short.".Body, um.Username FROM ".$Table." AS ".$Short." JOIN users_main AS um ON um.ID=".$Short.".".$Column." WHERE ".$Short.".ID=".$ID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
} }
@ -126,12 +126,12 @@
switch ($Short) { switch ($Short) {
case "user" : case 'user' :
?> ?>
<p>You are reporting the user <strong><?=display_str($Username)?></strong></p> <p>You are reporting the user <strong><?=display_str($Username)?></strong></p>
<? <?
break; break;
case "request_update" : case 'request_update' :
?> ?>
<p>You are reporting the request:</p> <p>You are reporting the request:</p>
<table> <table>
@ -163,13 +163,13 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label">Release Type</td> <td class="label">Release type</td>
<td> <td>
<select id="releasetype" name="releasetype"> <select id="releasetype" name="releasetype">
<option value='0'>---</option> <option value="0">---</option>
<? <?
foreach ($ReleaseTypes as $Key => $Val) { foreach ($ReleaseTypes as $Key => $Val) {
?> <option value='<?=$Key?>' <?=(!empty($ReleaseType) ? ($Key == $ReleaseType ?" selected='selected'" : "") : '') ?>><?=$Val?></option> ?> <option value="<?=$Key?>"<?=(!empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : '') : '') ?>><?=$Val?></option>
<? <?
} }
?> ?>
@ -190,7 +190,7 @@
</div> </div>
<? <?
break; break;
case "request" : case 'request' :
?> ?>
<p>You are reporting the request:</p> <p>You are reporting the request:</p>
<table> <table>
@ -207,7 +207,7 @@
</table> </table>
<? <?
break; break;
case "collage" : case 'collage' :
?> ?>
<p>You are reporting the collage:</p> <p>You are reporting the collage:</p>
<table> <table>
@ -222,7 +222,7 @@
</table> </table>
<? <?
break; break;
case "thread" : case 'thread' :
?> ?>
<p>You are reporting the thread:</p> <p>You are reporting the thread:</p>
<table> <table>
@ -237,7 +237,7 @@
</table> </table>
<? <?
break; break;
case "post" : case 'post' :
?> ?>
<p>You are reporting the post:</p> <p>You are reporting the post:</p>
<table> <table>
@ -252,10 +252,10 @@
</table> </table>
<? <?
break; break;
case "requests_comment" : case 'requests_comment' :
case "torrents_comment" : case 'torrents_comment' :
case "artist_comment": case 'artist_comment':
case "collages_comment" : case 'collages_comment' :
?> ?>
<p>You are reporting the <?=$Types[$Short]['title']?>:</p> <p>You are reporting the <?=$Types[$Short]['title']?>:</p>
<table> <table>

View File

@ -32,7 +32,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h2.2]2.2[/url]. Your torrent was reported because it was a duplicate of another torrent.' 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h2.2]2.2[/url]. Your torrent was reported because it was a duplicate of another torrent.'
) )
), ),
'banned' => array( 'banned' => array(
@ -48,7 +48,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '4', 'warn' => '4',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h1.2]1.2[/url]. You have uploaded material that is currently forbidden. Items on the Do Not Upload list (at the top of the [url=http://'.NONSSL_SITE_URL.'/upload.php]upload page[/url]) and in the [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h1.2]Specifically Banned[/url] portion of the uploading rules cannot be uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comments of the DNU list. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h1.2]1.2[/url]. You have uploaded material that is currently forbidden. Items on the Do Not Upload list (at the top of the [url=https://'.SSL_SITE_URL.'/upload.php]upload page[/url]) and in the [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h1.2]Specifically Banned[/url] portion of the uploading rules cannot be uploaded to the site. Do not upload them unless your torrent meets a condition specified in the comments of the DNU list.
Your torrent was reported because it contained material from the DNU list or from the Specifically Banned section of the rules.' Your torrent was reported because it contained material from the DNU list or from the Specifically Banned section of the rules.'
) )
), ),
@ -106,7 +106,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h2.2]2.2[/url]. Your torrent was reported because it was trumped by another torrent.' 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h2.2]2.2[/url]. Your torrent was reported because it was trumped by another torrent.'
) )
), ),
'private_trump' => array( 'private_trump' => array(
@ -146,7 +146,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.16]2.3.16[/url]. Properly tag your music files. Certain meta tags (e.g., ID3, Vorbis) are required on all music uploads. Make sure to use the appropriate tag format for your files (e.g., no ID3 tags for FLAC - see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.8]2.2.10.8[/url]). ID3v2 tags for files are highly recommended over ID3v1. ID3 are recommended for AC3 torrents but are not mandatory because the format does not natively support file metadata tagging (for AC3, the file names become the vehicle for correctly labeling media files). Torrents uploaded with both good ID3v1 tags and blank ID3v2 tags (a dual set of tags) are trumpable by torrents with either just good ID3v1 tags or good ID3v2 tags (a single set of tags). If you upload an album missing one or more of the required tags, then another user may add the tags, re-upload, and report your torrent for deletion. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.16]2.3.16[/url]. Properly tag your music files. Certain meta tags (e.g., ID3, Vorbis) are required on all music uploads. Make sure to use the appropriate tag format for your files (e.g., no ID3 tags for FLAC - see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.8]2.2.10.8[/url]). ID3v2 tags for files are highly recommended over ID3v1. ID3 are recommended for AC3 torrents but are not mandatory because the format does not natively support file metadata tagging (for AC3, the file names become the vehicle for correctly labeling media files). Torrents uploaded with both good ID3v1 tags and blank ID3v2 tags (a dual set of tags) are trumpable by torrents with either just good ID3v1 tags or good ID3v2 tags (a single set of tags). If you upload an album missing one or more of the required tags, then another user may add the tags, re-upload, and report your torrent for deletion.
Your torrent was reported because it was trumped by another torrent with improved metadata tags.' Your torrent was reported because it was trumped by another torrent with improved metadata tags.'
) )
), ),
@ -166,7 +166,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.5.5]2.5.5[/url]. Vinyl rips may be trumped by better-sounding rips of the same bit depth, regardless of lineage information (see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.9]2.3.9[/url]). 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.5.5]2.5.5[/url]. Vinyl rips may be trumped by better-sounding rips of the same bit depth, regardless of lineage information (see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.9]2.3.9[/url]).
Your torrent was reported as it was trumped by a better-sounding vinyl rip.' Your torrent was reported as it was trumped by a better-sounding vinyl rip.'
) )
), ),
@ -185,8 +185,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.2]2.3.2[/url]. Name your directories with meaningful titles, such as "Artist - Album (Year) - Format." The minimum acceptable is "Album" although it is preferable to include more information. If the directory name does not include this minimum then another user can rename the directory, re-upload, and report your torrent for deletion. In addition, torrent folders that are named using the scene convention will be trumpable if the Scene label is absent from the torrent. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.2]2.3.2[/url]. Name your directories with meaningful titles, such as "Artist - Album (Year) - Format." The minimum acceptable is "Album" although it is preferable to include more information. If the directory name does not include this minimum then another user can rename the directory, re-upload, and report your torrent for deletion. In addition, torrent folders that are named using the scene convention will be trumpable if the Scene label is absent from the torrent.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.3]2.3.3[/url]. Avoid creating unnecessary nested folders (such as an extra folder for the actual album) inside your properly named directory. A torrent with unnecessary nested folders is trumpable by a torrent with such folders removed. For single disc albums, all audio files must be included in the main torrent folder. For multi-disc albums, the main torrent folder may include one sub-folder that holds the audio file contents for each disc in the box set, i.e., the main torrent folder is "Adele - 19 (2008) - FLAC" while appropriate sub-folders may include "19 (Disc 1of2)" or "19" and "Live From The Hotel Cafe (Disc 2of2)" or "Acoustic Set Live From The Hotel Cafe, Los Angeles." Additional folders are unnecessary because they do nothing to improve the organization of the torrent. If you are uncertain about what to do for other cases, PM a staff member for guidance. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.3]2.3.3[/url]. Avoid creating unnecessary nested folders (such as an extra folder for the actual album) inside your properly named directory. A torrent with unnecessary nested folders is trumpable by a torrent with such folders removed. For single disc albums, all audio files must be included in the main torrent folder. For multi-disc albums, the main torrent folder may include one sub-folder that holds the audio file contents for each disc in the box set, i.e., the main torrent folder is "Adele - 19 (2008) - FLAC" while appropriate sub-folders may include "19 (Disc 1of2)" or "19" and "Live From The Hotel Cafe (Disc 2of2)" or "Acoustic Set Live From The Hotel Cafe, Los Angeles." Additional folders are unnecessary because they do nothing to improve the organization of the torrent. If you are uncertain about what to do for other cases, PM a staff member for guidance.
Your torrent was reported because it was trumped by another torrent with an improved folder name and directory structure.' Your torrent was reported because it was trumped by another torrent with an improved folder name and directory structure.'
) )
), ),
@ -205,7 +205,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.11]2.3.11[/url]. File names must accurately reflect the song titles. You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the Scene label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). If all the letters in the track titles are capitalized, the torrent is trumpable. If you upload an album with improper file names, then another user may fix the file names, re-upload, and report yours for deletion. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.11]2.3.11[/url]. File names must accurately reflect the song titles. You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the Scene label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). If all the letters in the track titles are capitalized, the torrent is trumpable. If you upload an album with improper file names, then another user may fix the file names, re-upload, and report yours for deletion.
Your torrent was reported because it was trumped by another torrent with improved file names.' Your torrent was reported because it was trumped by another torrent with improved file names.'
) )
), ),
@ -225,8 +225,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.19]2.1.19[/url]. All music torrents must represent a complete release, and may not be missing tracks (or discs in the case of a multi-disc release). 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.19]2.1.19[/url]. All music torrents must represent a complete release, and may not be missing tracks (or discs in the case of a multi-disc release).
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.19.2]2.1.19.2[/url]. A single track (e.g., one MP3 file) cannot be uploaded on its own unless it is an officially released single. If a specific track can only be found on an album, the entire album must be uploaded in the torrent. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.19.2]2.1.19.2[/url]. A single track (e.g., one MP3 file) cannot be uploaded on its own unless it is an officially released single. If a specific track can only be found on an album, the entire album must be uploaded in the torrent.
Your torrent was reported because it was missing tracks.' Your torrent was reported because it was missing tracks.'
) )
), ),
@ -245,8 +245,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.19]2.1.19[/url]. All music torrents must represent a complete release, and may not be missing tracks (or discs in the case of a multi-disc release). 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.19]2.1.19[/url]. All music torrents must represent a complete release, and may not be missing tracks (or discs in the case of a multi-disc release).
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.19.1]2.1.19.1[/url]. If an album is released as a multi-disc set (or box set) of CDs or vinyl discs, then it must be uploaded as a single torrent. Preferably, each individual CD rip in a multi-disc set should be organized in its own folder (see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.12]2.3.12[/url]). [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.19.1]2.1.19.1[/url]. If an album is released as a multi-disc set (or box set) of CDs or vinyl discs, then it must be uploaded as a single torrent. Preferably, each individual CD rip in a multi-disc set should be organized in its own folder (see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.12]2.3.12[/url]).
Your torrent was reported because it was missing discs.' Your torrent was reported because it was missing discs.'
) )
), ),
@ -266,7 +266,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.19.3]2.1.19.3[/url]. Bonus discs may be uploaded separately in accordance with [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h2.4]2.4[/url]. Please note that individual bonus tracks cannot be uploaded without the rest of the album. Bonus tracks are not bonus discs. Enhanced audio CDs with data or video tracks must be uploaded without the non-audio tracks. If you want to share the videos or data, you may host the files off-site with a file sharing service and include the link to that service in your torrent description. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.19.3]2.1.19.3[/url]. Bonus discs may be uploaded separately in accordance with [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h2.4]2.4[/url]. Please note that individual bonus tracks cannot be uploaded without the rest of the album. Bonus tracks are not bonus discs. Enhanced audio CDs with data or video tracks must be uploaded without the non-audio tracks. If you want to share the videos or data, you may host the files off-site with a file sharing service and include the link to that service in your torrent description.
Your torrent was reported because it contained only bonus tracks without the full album.' Your torrent was reported because it contained only bonus tracks without the full album.'
) )
), ),
@ -286,7 +286,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '2', 'warn' => '2',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.2]2.1.2[/url]. No transcodes or re-encodes of lossy releases are acceptable here. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.2]2.1.2[/url]. No transcodes or re-encodes of lossy releases are acceptable here.
Your torrent was reported because it contained transcoded audio files.' Your torrent was reported because it contained transcoded audio files.'
) )
), ),
@ -304,8 +304,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '2', 'warn' => '2',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.3]2.1.3[/url]. Music releases must have an average bitrate of at least 192 kbps regardless of the format. Exceptions: The following VBR encodes may go under the 192 kbps limit: LAME V2 (VBR), V1 (VBR), V0 (VBR), APS (VBR), APX (VBR), MP3 192 (VBR), and AAC ~192 (VBR) to AAC ~256 (VBR) releases. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.3]2.1.3[/url]. Music releases must have an average bitrate of at least 192 kbps regardless of the format. Exceptions: The following VBR encodes may go under the 192 kbps limit: LAME V2 (VBR), V1 (VBR), V0 (VBR), APS (VBR), APX (VBR), MP3 192 (VBR), and AAC ~192 (VBR) to AAC ~256 (VBR) releases.
Your torrent was reported because it contained one of more audio files that did not meet the minimum bitrate requirement.' Your torrent was reported because it contained one or more audio files that did not meet the minimum bitrate requirement.'
) )
), ),
'mutt' => array( 'mutt' => array(
@ -322,7 +322,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '2', 'warn' => '2',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.6]2.1.6[/url]. All music torrents must be encoded with a single encoder using the same settings. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.6]2.1.6[/url]. All music torrents must be encoded with a single encoder using the same settings.
Your torrent was reported because it contained one or more audio files that were encoded by different audio encoders or with different encoder settings.' Your torrent was reported because it contained one or more audio files that were encoded by different audio encoders or with different encoder settings.'
) )
), ),
@ -342,8 +342,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.5]2.1.5[/url]. Albums must not be ripped or uploaded as a single track. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.5]2.1.5[/url]. Albums must not be ripped or uploaded as a single track.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.5.1]2.1.5.1[/url]. If the tracks on the original CD were separate, you must rip them to separate files. Any unsplit FLAC rips lacking a cue sheet will be deleted outright. Any unsplit FLAC rip that includes a cue sheet will be trumpable by a properly split FLAC torrent. CDs with single tracks can be uploaded without prior splitting. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.5.1]2.1.5.1[/url]. If the tracks on the original CD were separate, you must rip them to separate files. Any unsplit FLAC rips lacking a cue sheet will be deleted outright. Any unsplit FLAC rip that includes a cue sheet will be trumpable by a properly split FLAC torrent. CDs with single tracks can be uploaded without prior splitting.
Your torrent was reported because it contained a single-track rip instead of a rip consisting of separate audio files.' Your torrent was reported because it contained a single-track rip instead of a rip consisting of separate audio files.'
) )
), ),
@ -362,9 +362,9 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.16]2.3.16[/url]. Properly tag your music files. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.16]2.3.16[/url]. Properly tag your music files.
The Uploading Rules require that all uploads be properly tagged. Your torrent has been marked as having poor tags. It is now listed on [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the required tags and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Tag Trump" and indicate in the report comments that you have fixed the tags. Be sure to provide a link (PL) to the new replacement torrent. The Uploading Rules require that all uploads be properly tagged. Your torrent has been marked as having poor tags. It is now listed on [url=https://'.SSL_SITE_URL.'/better.php]Better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the required tags and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Tag Trump" and indicate in the report comments that you have fixed the tags. Be sure to provide a link (PL) to the new replacement torrent.
Your torrent has been labeled as having bad tags and is now eligible for trumping through the [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] listing.' Your torrent has been labeled as having bad tags and is now eligible for trumping through the [url=https://'.SSL_SITE_URL.'/better.php]Better.php[/url] listing.'
) )
), ),
'folders_bad' => array( 'folders_bad' => array(
@ -380,9 +380,9 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.2]2.3.2[/url]. Name your directories with meaningful titles, such as "Artist - Album (Year) - Format." 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.2]2.3.2[/url]. Name your directories with meaningful titles, such as "Artist - Album (Year) - Format."
The Uploading Rules require that all uploads contain torrent directories with meaningful names. Your torrent has been marked as having a poorly named torrent directory. It is now listed on [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the folder/directory name(s) and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Folder Trump" and indicate in the report comments that you have fixed the directory name(s). Be sure to provide a link (PL) to the new replacement torrent. The Uploading Rules require that all uploads contain torrent directories with meaningful names. Your torrent has been marked as having a poorly named torrent directory. It is now listed on [url=https://'.SSL_SITE_URL.'/better.php]Better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the folder/directory name(s) and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Folder Trump" and indicate in the report comments that you have fixed the directory name(s). Be sure to provide a link (PL) to the new replacement torrent.
Your torrent has been labeled as having a bad folder name (or directory structure) and is now eligible for trumping through the [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] listing.' Your torrent has been labeled as having a bad folder name (or directory structure) and is now eligible for trumping through the [url=https://'.SSL_SITE_URL.'/better.php]Better.php[/url] listing.'
) )
), ),
'wrong_format' => array( 'wrong_format' => array(
@ -398,7 +398,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.4]2.1.4[/url]. Bitrates must accurately reflect encoder presets or the average bitrate of the audio files. You are responsible for supplying correct format and bitrate information on the upload page. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.4]2.1.4[/url]. Bitrates must accurately reflect encoder presets or the average bitrate of the audio files. You are responsible for supplying correct format and bitrate information on the upload page.
Your torrent has now been labeled using the appropriate format and bitrate.' Your torrent has now been labeled using the appropriate format and bitrate.'
) )
), ),
@ -432,7 +432,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.1]2.1.1[/url]. The only formats allowed for music are: 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.1]2.1.1[/url]. The only formats allowed for music are:
Lossy: MP3, AAC, AC3, DTS Lossy: MP3, AAC, AC3, DTS
Lossless: FLAC Lossless: FLAC
Your torrent was reported because it contained a disallowed format.' Your torrent was reported because it contained a disallowed format.'
@ -454,7 +454,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.4]2.1.4[/url]. Bitrates must accurately reflect encoder presets or the average bitrate of the audio files. You are responsible for supplying correct format and bitrate information on the upload page. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.4]2.1.4[/url]. Bitrates must accurately reflect encoder presets or the average bitrate of the audio files. You are responsible for supplying correct format and bitrate information on the upload page.
Your torrent was reported because the bitrates of one or more audio files had been misrepresented.' Your torrent was reported because the bitrates of one or more audio files had been misrepresented.'
) )
), ),
@ -472,7 +472,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.11]2.1.11[/url]. Music ripped from the radio (Satellite or FM), television, the web, or podcasts are not allowed. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.11]2.1.11[/url]. Music ripped from the radio (Satellite or FM), television, the web, or podcasts are not allowed.
The only allowable media formats are CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, and Blu-ray.' The only allowable media formats are CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, and Blu-ray.'
) )
), ),
@ -490,7 +490,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.20]2.1.20[/url]. User made discographies may not be uploaded. Multi-album torrents are not allowed on the site under any circumstances. That means no discographies, Pitchfork compilations, etc. If releases (e.g., CD singles) were never released as a bundled set, do not upload them together. Live Soundboard material should be uploaded as one torrent per night, per show, or per venue. Including more than one show in a torrent results in a multi-album torrent. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.20]2.1.20[/url]. User made discographies may not be uploaded. Multi-album torrents are not allowed on the site under any circumstances. That means no discographies, Pitchfork compilations, etc. If releases (e.g., CD singles) were never released as a bundled set, do not upload them together. Live Soundboard material should be uploaded as one torrent per night, per show, or per venue. Including more than one show in a torrent results in a multi-album torrent.
Your torrent was reported because it consisted of a discography.' Your torrent was reported because it consisted of a discography.'
) )
), ),
@ -508,8 +508,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.16]2.1.16[/url]. User-made compilations are not allowed. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.16]2.1.16[/url]. User-made compilations are not allowed.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.16.1]2.1.16.1[/url]. These are defined as compilations made by the uploader or anyone else who does not officially represent the artist or the label. Compilations must be reasonably official. User-made and unofficial multichannel mixes are also not allowed. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.16.1]2.1.16.1[/url]. These are defined as compilations made by the uploader or anyone else who does not officially represent the artist or the label. Compilations must be reasonably official. User-made and unofficial multichannel mixes are also not allowed.
Your torrent was reported because it was a user compilation.' Your torrent was reported because it was a user compilation.'
) )
), ),
@ -526,7 +526,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.9]2.3.9[/url]. All lossless analog rips should include clear information about source lineage. All lossless SACD digital layer analog rips and vinyl rips must include clear information about recording equipment used (see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#h2.8]2.8[/url]). If you used a USB turntable for a vinyl rip, clearly indicate this in your lineage information. Also include all intermediate steps up to lossless encoding, such as the program used for mastering, sound card used, etc. Lossless analog rips missing rip information can be trumped by better documented lossless analog rips of equal or better quality. In order to trump a lossless analog rip without a lineage, this lineage must be included as a .txt or .log file within the new torrent. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.9]2.3.9[/url]. All lossless analog rips should include clear information about source lineage. All lossless SACD digital layer analog rips and vinyl rips must include clear information about recording equipment used (see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#h2.8]2.8[/url]). If you used a USB turntable for a vinyl rip, clearly indicate this in your lineage information. Also include all intermediate steps up to lossless encoding, such as the program used for mastering, sound card used, etc. Lossless analog rips missing rip information can be trumped by better documented lossless analog rips of equal or better quality. In order to trump a lossless analog rip without a lineage, this lineage must be included as a .txt or .log file within the new torrent.
Your torrent is now eligible for trumping by a better-sounding rip with complete lineage information.' Your torrent is now eligible for trumping by a better-sounding rip with complete lineage information.'
) )
), ),
@ -544,8 +544,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '4', 'warn' => '4',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9]2.2.10.9[/url]. No log editing is permitted. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9]2.2.10.9[/url]. No log editing is permitted.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9.1]2.2.10.9.1[/url]. Forging log data is a serious misrepresentation of quality, and will result in a warning and the loss of your uploading privileges when the edited log is found. We recommend that you do not open the rip log file for any reason. However, if you must open the rip log, do not edit anything in the file for any reason. If you discover that one of your software settings is incorrect in the ripping software preferences, you must rip the CD again with the proper settings. Do not consolidate logs under any circumstances. If you must re-rip specific tracks or an entire disc and the rip results happen to have the new log appended to the original, leave them as is. Do not remove any part of either log, and never copy/paste parts of a new log over an old log. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9.1]2.2.10.9.1[/url]. Forging log data is a serious misrepresentation of quality, and will result in a warning and the loss of your uploading privileges when the edited log is found. We recommend that you do not open the rip log file for any reason. However, if you must open the rip log, do not edit anything in the file for any reason. If you discover that one of your software settings is incorrect in the ripping software preferences, you must rip the CD again with the proper settings. Do not consolidate logs under any circumstances. If you must re-rip specific tracks or an entire disc and the rip results happen to have the new log appended to the original, leave them as is. Do not remove any part of either log, and never copy/paste parts of a new log over an old log.
Your torrent was reported because it contained an edited log (either edited by you or someone else). For questions about your uploading privileges, you must PM the staff member who handled this log case.' Your torrent was reported because it contained an edited log (either edited by you or someone else). For questions about your uploading privileges, you must PM the staff member who handled this log case.'
) )
), ),
@ -563,7 +563,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.12]2.1.12[/url]. No unofficial audience recordings may be uploaded. These include but are not limited to AUD (Audience), IEM (In Ear Monitor), ALD (Assistive Listening Device), Mini-Disc, and Matrix-sourced recordings (see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.6.3]2.6.3[/url]). 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.12]2.1.12[/url]. No unofficial audience recordings may be uploaded. These include but are not limited to AUD (Audience), IEM (In Ear Monitor), ALD (Assistive Listening Device), Mini-Disc, and Matrix-sourced recordings (see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.6.3]2.6.3[/url]).
Your torrent was reported because it was sourced from an audience recording.' Your torrent was reported because it was sourced from an audience recording.'
) )
), ),
@ -580,10 +580,10 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.11]2.3.11[/url]. File names must accurately reflect the song titles. You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the Scene label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). If all the letters in the track titles are capitalized, the torrent is trumpable. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.11]2.3.11[/url]. File names must accurately reflect the song titles. You may not have file names like 01track.mp3, 02track.mp3, etc. Torrents containing files that are named with incorrect song titles can be trumped by properly labeled torrents. Also, torrents that are sourced from the scene but do not have the Scene label must comply with site naming rules (no release group names in the file names, no advertisements in the file names, etc.). If all the letters in the track titles are capitalized, the torrent is trumpable.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.13]2.3.13[/url]. Track numbers are required in file names (e.g., "01 - TrackName.mp3"). If a torrent without track numbers in the file names is uploaded, then a torrent with the track numbers in the file names can take its place. When formatted properly, file names will sort in order by track number or playing order. Also see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.3.14]2.3.14[/url]. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.13]2.3.13[/url]. Track numbers are required in file names (e.g., "01 - TrackName.mp3"). If a torrent without track numbers in the file names is uploaded, then a torrent with the track numbers in the file names can take its place. When formatted properly, file names will sort in order by track number or playing order. Also see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.3.14]2.3.14[/url].
The Uploading Rules require that all uploads contain audio tracks with accurate file names. Your torrent has been marked as having incorrect or incomplete file names. It is now listed on [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the file names and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Bad File Names Trump" and indicate in the report comments that you have fixed the file names. Be sure to provide a link (PL) to the new replacement torrent. The Uploading Rules require that all uploads contain audio tracks with accurate file names. Your torrent has been marked as having incorrect or incomplete file names. It is now listed on [url=https://'.SSL_SITE_URL.'/better.php]better.php[/url] and is eligible for trumping. You are of course free to fix this torrent yourself. Add or fix the file names and upload the replacement torrent to the site. Then, report (RP) the older torrent using the category "Bad File Names Trump" and indicate in the report comments that you have fixed the file names. Be sure to provide a link (PL) to the new replacement torrent.
Your torrent has been labeled as having bad file names and is now eligible for trumping through the [url=http://'.NONSSL_SITE_URL.'/better.php]Better.php[/url] listing.' Your torrent has been labeled as having bad file names and is now eligible for trumping through the [url=https://'.SSL_SITE_URL.'/better.php]better.php[/url] listing.'
) )
), ),
'cassette' => array( 'cassette' => array(
@ -591,7 +591,7 @@
'reason' => '17', 'reason' => '17',
'title' => 'Unapproved Cassette', 'title' => 'Unapproved Cassette',
'report_messages' => array( 'report_messages' => array(
"If the album was never released other than on cassette, please include a source." 'If the album was never released other than on cassette, please include a source.'
), ),
'report_fields' => array( 'report_fields' => array(
'link' => '0' 'link' => '0'
@ -600,10 +600,10 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.10.1]2.10.1[/url]. Cassettes are allowed under strict conditions. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.10.1]2.10.1[/url]. Cassettes are allowed under strict conditions.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.10.1.1]2.10.1.1[/url]. Releases available only on cassette may be uploaded under special strict conditions (see [url=http://'.NONSSL_SITE_URL.'/wiki.php?action=article&amp;id=593]this wiki[/url] for information on cassette ripping). Cassette-sourced uploads must be approved by staff first (see [url=http://'.NONSSL_SITE_URL.'/wiki.php?action=article&amp;id=681]this wiki[/url] for details on the approval process). This also applies to soundboard releases where a tape generation can be found in the lineage (either the tape is not in the first generation or there are multiple tape generations). See [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.6.6]2.6.6[/url] for more information. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.10.1.1]2.10.1.1[/url]. Releases available only on cassette may be uploaded under special strict conditions (see [url=https://'.SSL_SITE_URL.'/wiki.php?action=article&amp;id=593]this wiki[/url] for information on cassette ripping).
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.10.1.2]2.10.1.2[/url]. You must contact a moderator privately for approval before uploading. Include proof in the form of discography information from a reputable source as well as the spectrals for 2 songs in your message. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.10.1.2]2.10.1.2[/url]. Rips must be made from official cassette sources. Bootlegs are often from unofficial sources and may be deleted if they do not meet high quality audio standards (see rule [rule]2.10.8[/rule]).
Your torrent was reported because it contains an unapproved cassette rip.' When uploading new cassette-sourced torrents, be sure to include in the release description evidence of its uniqueness in the form of discography information from a reputable source as well as pictures of the cassette you ripped.'
) )
), ),
'skips' => array( 'skips' => array(
@ -611,8 +611,8 @@
'reason' => '13', 'reason' => '13',
'title' => 'Skips / Encode Errors', 'title' => 'Skips / Encode Errors',
'report_messages' => array( 'report_messages' => array(
"Please tell us which track(s) we should check.", 'Please tell us which track(s) we should check.',
"Telling us where precisely in the song the skip/encode error can be heard will help us deal with your torrent." 'Telling us where precisely in the song the skip/encode error can be heard will help us deal with your torrent.'
), ),
'report_fields' => array( 'report_fields' => array(
'track' => '2' 'track' => '2'
@ -621,7 +621,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.8]2.1.8[/url]. Music not sourced from vinyl must not contain pops, clicks, or skips. They will be deleted for rip/encode errors if reported. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.8]2.1.8[/url]. Music not sourced from vinyl must not contain pops, clicks, or skips. They will be deleted for rip/encode errors if reported.
Your torrent was reported because one or more tracks contain encoding errors.' Your torrent was reported because one or more tracks contain encoding errors.'
) )
), ),
@ -639,10 +639,10 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '0', 'delete' => '0',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.3]2.2.10.3[/url]. A FLAC upload with an EAC or XLD rip log that scores 100% on the log checker replaces one with a lower score... . Note: A FLAC upload with a log that scores 95% for not defeating the audio cache may be rescored to 100% following the procedure outlined in [url=http://'.NONSSL_SITE_URL.'/wiki.php?action=article&amp;id=219]this wiki[/url]. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.3]2.2.10.3[/url]. A FLAC upload with an EAC or XLD rip log that scores 100% on the log checker replaces one with a lower score... . Note: A FLAC upload with a log that scores 95% for not defeating the audio cache may be rescored to 100% following the procedure outlined in [url=https://'.SSL_SITE_URL.'/wiki.php?action=article&amp;id=219]this wiki[/url].
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.5]2.2.10.5[/url]. XLD and EAC logs in languages other than English require a manual log checker score adjustment by staff. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.5]2.2.10.5[/url]. XLD and EAC logs in languages other than English require a manual log checker score adjustment by staff.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.6.2]2.2.10.6.2[/url]. If you created a CD range rip that has matching CRCs for test and copy, and where every track has an AccurateRip score of 2 or more, then you may submit your torrent for manual score adjustment. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.6.2]2.2.10.6.2[/url]. If you created a CD range rip that has matching CRCs for test and copy, and where every track has an AccurateRip score of 2 or more, then you may submit your torrent for manual score adjustment.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9.2]2.2.10.9.2[/url]. If you find that an appended log has not been scored properly, please report the torrent and use the log rescore option. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.2.10.9.2]2.2.10.9.2[/url]. If you find that an appended log has not been scored properly, please report the torrent and use the log rescore option.
Your torrent has now been properly scored by the staff.' Your torrent has now been properly scored by the staff.'
) )
) )
@ -662,7 +662,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.2]4.1.2[/url]. All applications must come with a crack, keygen, or other method of ensuring that downloaders can install them easily. App torrents with keygens, cracks, or patches that do not work or torrents missing clear installation instructions will be deleted if reported. No exceptions. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.2]4.1.2[/url]. All applications must come with a crack, keygen, or other method of ensuring that downloaders can install them easily. App torrents with keygens, cracks, or patches that do not work or torrents missing clear installation instructions will be deleted if reported. No exceptions.
Your torrent was reported because it was missing an installation method.' Your torrent was reported because it was missing an installation method.'
) )
), ),
@ -680,8 +680,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '4', 'warn' => '4',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r1.2.5]1.2.5[/url]. Games of any kind. No games of any kind for PC, Mac, Linux, mobile devices, or any other platform are allowed. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r1.2.5]1.2.5[/url]. Games of any kind. No games of any kind for PC, Mac, Linux, mobile devices, or any other platform are allowed.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.7]4.1.7[/url]. Games of any kind are prohibited (see [url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r1.2.5]1.2.5[/url]). [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.7]4.1.7[/url]. Games of any kind are prohibited (see [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r1.2.5]1.2.5[/url]).
Your torrent was reported because it contained a game disc rip.' Your torrent was reported because it contained a game disc rip.'
) )
), ),
@ -699,7 +699,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.3]4.1.3[/url]. App releases must not be freely available tools. Application releases cannot be freely downloaded anywhere from any official source. Nor may you upload open source applications where the source code is available for free. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.3]4.1.3[/url]. App releases must not be freely available tools. Application releases cannot be freely downloaded anywhere from any official source. Nor may you upload open source applications where the source code is available for free.
Your torrent was reported because it contained a freely available application.' Your torrent was reported because it contained a freely available application.'
) )
), ),
@ -717,7 +717,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.4]4.1.4[/url]. Release descriptions for applications must contain good information about the application. You should either have a small description of the program (either taken from its web site or from an NFO file) or a link to the information -- but ideally both. Torrents missing this information will be deleted when reported. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.4]4.1.4[/url]. Release descriptions for applications must contain good information about the application. You should either have a small description of the program (either taken from its web site or from an NFO file) or a link to the information -- but ideally both. Torrents missing this information will be deleted when reported.
Your torrent was reported because it lacked adequate release information.' Your torrent was reported because it lacked adequate release information.'
) )
), ),
@ -735,8 +735,8 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.18]2.1.18[/url]. Sound Sample Packs must be uploaded as applications. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.18]2.1.18[/url]. Sound Sample Packs must be uploaded as applications.
[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.9]4.1.9[/url]. Sound sample packs, template collections, and font collections are allowed if they are official releases, not freely available, and unarchived. Sound sample packs, template collections, and font collections must be official compilations and they must not be uploaded as an archive. The files contained inside the torrent must not be archived so that users can see what the pack contains. That means if sound sample packs are in WAV format, they must be uploaded as WAV. If the font collection, template collection, or sound sample pack was originally released as an archive, you must unpack the files before uploading them in a torrent. None of the contents in these packs and collections may be freely available. [url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.9]4.1.9[/url]. Sound sample packs, template collections, and font collections are allowed if they are official releases, not freely available, and unarchived. Sound sample packs, template collections, and font collections must be official compilations and they must not be uploaded as an archive. The files contained inside the torrent must not be archived so that users can see what the pack contains. That means if sound sample packs are in WAV format, they must be uploaded as WAV. If the font collection, template collection, or sound sample pack was originally released as an archive, you must unpack the files before uploading them in a torrent. None of the contents in these packs and collections may be freely available.
Your torrent was reported because it was an archived collection.' Your torrent was reported because it was an archived collection.'
) )
), ),
@ -754,7 +754,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.11]4.1.11[/url]. Collections of cracks, keygens or serials are not allowed. The crack, keygen, or serial for an application must be in a torrent with its corresponding application. It cannot be uploaded separately from the application. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.11]4.1.11[/url]. Collections of cracks, keygens or serials are not allowed. The crack, keygen, or serial for an application must be in a torrent with its corresponding application. It cannot be uploaded separately from the application.
Your torrent was reported because it contained a collection of serials, keygens, or cracks.' Your torrent was reported because it contained a collection of serials, keygens, or cracks.'
) )
), ),
@ -772,7 +772,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.12]4.1.12[/url]. Torrents containing hacking or cracking tools are prohibited. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.12]4.1.12[/url]. Torrents containing hacking or cracking tools are prohibited.
Your torrent was reported because it contained a hacking tool.' Your torrent was reported because it contained a hacking tool.'
) )
), ),
@ -790,7 +790,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.14]4.1.14[/url]. All applications must be complete. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.14]4.1.14[/url]. All applications must be complete.
The torrent was determined to be infected with a virus or trojan. In the future, please scan all potential uploads with an antivirus program such as AVG, Avast, or MS Security Essentials. The torrent was determined to be infected with a virus or trojan. In the future, please scan all potential uploads with an antivirus program such as AVG, Avast, or MS Security Essentials.
Your torrent was reported because it contained a virus or trojan.' Your torrent was reported because it contained a virus or trojan.'
) )
@ -809,7 +809,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r4.1.14]4.1.14[/url]. All applications must be complete. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r4.1.14]4.1.14[/url]. All applications must be complete.
This program was determined to be not fully functional. This program was determined to be not fully functional.
Your torrent was reported because it contained a program that did not work or no longer works.' Your torrent was reported because it contained a program that did not work or no longer works.'
) )
@ -829,7 +829,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r6.5]6.5[/url]. Collections/packs of ebooks are prohibited, even if each title is somehow related to other ebook titles in some way. All ebooks must be uploaded individually and cannot be archived (users must be able to see the ebook format in the torrent). 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r6.5]6.5[/url]. Collections/packs of ebooks are prohibited, even if each title is somehow related to other ebook titles in some way. All ebooks must be uploaded individually and cannot be archived (users must be able to see the ebook format in the torrent).
Your torrent was reported because it contained a collection or pack of ebooks.' Your torrent was reported because it contained a collection or pack of ebooks.'
) )
) )
@ -850,7 +850,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '0', 'warn' => '0',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r2.1.8]2.1.8[/url]. Music not sourced from vinyl must not contain pops, clicks, or skips. They will be deleted for rip/encode errors if reported. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r2.1.8]2.1.8[/url]. Music not sourced from vinyl must not contain pops, clicks, or skips. They will be deleted for rip/encode errors if reported.
Your torrent was reported because one or more audiobook tracks contain encoding errors.' Your torrent was reported because one or more audiobook tracks contain encoding errors.'
) )
) )
@ -870,7 +870,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r7.3]7.3[/url]. Tutorials on how to use musical instruments, vocal training, producing music, or otherwise learning the theory and practice of music are the only allowed topics. No material outside of these topics is allowed. For example, instruction videos about Kung Fu training, dance lessons, beer brewing, or photography are not permitted here. What is considered allowable under these topics is ultimately at the discretion of the staff. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r7.3]7.3[/url]. Tutorials on how to use musical instruments, vocal training, producing music, or otherwise learning the theory and practice of music are the only allowed topics. No material outside of these topics is allowed. For example, instruction videos about Kung Fu training, dance lessons, beer brewing, or photography are not permitted here. What is considered allowable under these topics is ultimately at the discretion of the staff.
Your torrent was reported because it contained a video that has no relevance to the allowed music-related topics on the site.' Your torrent was reported because it contained a video that has no relevance to the allowed music-related topics on the site.'
) )
) )
@ -890,7 +890,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '1', 'warn' => '1',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r3.3]3.3[/url]. No radio talk shows or podcasts are allowed. What.CD is primarily a music site, and those recordings do not belong in any torrent category. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r3.3]3.3[/url]. No radio talk shows or podcasts are allowed. What.CD is primarily a music site, and those recordings do not belong in any torrent category.
Your torrent was reported because it contained audio files sourced from a talk show or podcast.' Your torrent was reported because it contained audio files sourced from a talk show or podcast.'
) )
) )
@ -910,7 +910,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '', 'warn' => '',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r5.2.3]5.2.3[/url]. Collections may not span more than one comic title. You may not include multiple, different comic titles in a single collection, e.g., "The Amazing Spider-Man #1" and "The Incredible Hulk #1." 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r5.2.3]5.2.3[/url]. Collections may not span more than one comic title. You may not include multiple, different comic titles in a single collection, e.g., "The Amazing Spider-Man #1" and "The Incredible Hulk #1."
Your torrent was reported because it contained comics from multiple unrelated series.' Your torrent was reported because it contained comics from multiple unrelated series.'
) )
), ),
@ -928,7 +928,7 @@
'upload' => '0', 'upload' => '0',
'warn' => '', 'warn' => '',
'delete' => '1', 'delete' => '1',
'pm' => '[url=http://'.NONSSL_SITE_URL.'/rules.php?p=upload#r5.2.6]5.2.6[/url]. Torrents spanning multiple volumes are too large and must be uploaded as separate volumes. 'pm' => '[url=https://'.SSL_SITE_URL.'/rules.php?p=upload#r5.2.6]5.2.6[/url]. Torrents spanning multiple volumes are too large and must be uploaded as separate volumes.
Your torrent was reported because it contained multiple comic volumes.' Your torrent was reported because it contained multiple comic volumes.'
) )
) )

View File

@ -22,11 +22,11 @@
$TorrentCache = get_group_info($GroupID, true, $RevisionID); $TorrentCache = get_group_info($GroupID, true, $RevisionID);
$GroupDetails = $TorrentCache[0]; $GroupDetails = $TorrentCache[0];
$TorrentList = $TorrentCache[1]; $TorrentList = $TorrentCache[1];
//Resolve the torrentlist to the one specific torrent being reported // Resolve the torrentlist to the one specific torrent being reported
foreach ($TorrentList as &$Torrent) { foreach ($TorrentList as &$Torrent) {
//Remove unneeded entries // Remove unneeded entries
if ($Torrent["ID"] != $TorrentID) if ($Torrent['ID'] != $TorrentID)
unset($TorrentList[$Torrent["ID"]]); unset($TorrentList[$Torrent['ID']]);
} }
// Group details // Group details
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear,
@ -47,9 +47,9 @@
$Title = $AltName; $Title = $AltName;
} }
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName.=' [' . $GroupYear . ']'; $DisplayName.= " [$GroupYear]";
$AltName.=' [' . $GroupYear . ']'; $AltName.= " [$GroupYear]";
$Title.= ' [' . $GroupYear . ']'; $Title.= " [$GroupYear]";
} }
if ($GroupVanityHouse) { if ($GroupVanityHouse) {
$DisplayName.=' [Vanity House]'; $DisplayName.=' [Vanity House]';
@ -68,12 +68,11 @@
<div class="header"> <div class="header">
<h2>Report a torrent</h2> <h2>Report a torrent</h2>
</div> </div>
<div class="header"> <div class="header">
<h3><?=$DisplayName?></h3> <h3><?=$DisplayName?></h3>
</div> </div>
<div class="thin"> <div class="thin">
<table class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : ''?>" id="torrent_details"> <table class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : '' ?>" id="torrent_details">
<tr class="colhead_dark"> <tr class="colhead_dark">
<td width="80%"><strong>Reported torrent</strong></td> <td width="80%"><strong>Reported torrent</strong></td>
<td><strong>Size</strong></td> <td><strong>Size</strong></td>
@ -102,7 +101,7 @@
<td class="label">Reason:</td> <td class="label">Reason:</td>
<td> <td>
<select id="type" name="type" onchange="ChangeReportType()"> <select id="type" name="type" onchange="ChangeReportType()">
<? <?
if (!empty($Types[$CategoryID])) { if (!empty($Types[$CategoryID])) {
$TypeList = $Types['master'] + $Types[$CategoryID]; $TypeList = $Types['master'] + $Types[$CategoryID];
$Priorities = array(); $Priorities = array();
@ -116,7 +115,7 @@
foreach ($TypeList as $Type => $Data) { foreach ($TypeList as $Type => $Data) {
?> ?>
<option value="<?= $Type ?>"><?= $Data['title'] ?></option> <option value="<?= $Type ?>"><?= $Data['title'] ?></option>
<? } ?> <? } ?>
</select> </select>
</td> </td>
</tr> </tr>
@ -141,7 +140,6 @@
<script type="text/javascript">ChangeReportType();</script> <script type="text/javascript">ChangeReportType();</script>
</div> </div>
</div> </div>
<input type="submit" value="Submit report" /> <input type="submit" value="Submit report" />
</form> </form>

View File

@ -13,24 +13,24 @@
authorize(); authorize();
if(!is_number($_POST['torrentid'])) { if (!is_number($_POST['torrentid'])) {
error(404); error(404);
} else { } else {
$TorrentID = $_POST['torrentid']; $TorrentID = $_POST['torrentid'];
} }
if(!is_number($_POST['categoryid'])) { if (!is_number($_POST['categoryid'])) {
error(404); error(404);
} else { } else {
$CategoryID = $_POST['categoryid']; $CategoryID = $_POST['categoryid'];
} }
if(!isset($_POST['type'])) { if (!isset($_POST['type'])) {
error(404); error(404);
} else if (array_key_exists($_POST['type'], $Types[$CategoryID])) { } else if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
$Type = $_POST['type']; $Type = $_POST['type'];
$ReportType = $Types[$CategoryID][$Type]; $ReportType = $Types[$CategoryID][$Type];
} else if(array_key_exists($_POST['type'],$Types['master'])) { } else if (array_key_exists($_POST['type'],$Types['master'])) {
$Type = $_POST['type']; $Type = $_POST['type'];
$ReportType = $Types['master'][$Type]; $ReportType = $Types['master'][$Type];
} else { } else {
@ -39,78 +39,78 @@
} }
foreach($ReportType['report_fields'] as $Field => $Value) { foreach ($ReportType['report_fields'] as $Field => $Value) {
if($Value == '1') { if ($Value == '1') {
if(empty($_POST[$Field])) { if (empty($_POST[$Field])) {
$Err = "You are missing a required field (".$Field.") for a ".$ReportType['title']." report."; $Err = "You are missing a required field (".$Field.") for a ".$ReportType['title']." report.";
} }
} }
} }
if(!empty($_POST['sitelink'])) { if (!empty($_POST['sitelink'])) {
if(preg_match_all('/((https?:\/\/)?([a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.)?'.NONSSL_SITE_URL.'\/torrents.php\?(id=[0-9]+\&)?torrentid=([0-9]+))/is', $_POST['sitelink'], $Matches)) { if (preg_match_all('/((https?:\/\/)?([a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.)?'.SSL_SITE_URL.'\/torrents.php\?(id=[0-9]+\&)?torrentid=([0-9]+))/is', $_POST['sitelink'], $Matches)) {
$ExtraIDs = implode(' ', $Matches[6]); $ExtraIDs = implode(' ', $Matches[6]);
if(in_array($TorrentID, $Matches[6])) { if (in_array($TorrentID, $Matches[6])) {
$Err = "The extra permalinks you gave included the link to the torrent you're reporting!"; $Err = "The extra permalinks you gave included the link to the torrent you're reporting!";
} }
} else { } else {
$Err = "Permalink was incorrect, should look like http://".NONSSL_SITE_URL."/torrents.php?torrentid=12345"; $Err = "The permalink was incorrect. It should look like https://".SSL_SITE_URL."/torrents.php?torrentid=12345";
} }
} else { } else {
$ExtraIDs = ""; $ExtraIDs = '';
} }
if(!empty($_POST['link'])) { if (!empty($_POST['link'])) {
//resource_type://domain:port/filepathname?query_string#anchor //resource_type://domain:port/filepathname?query_string#anchor
// http:// www .foo.com /bar // http:// www .foo.com /bar
if(preg_match_all('/(https?:\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(:[0-9]{2,5})?(\/(\S)+)?/is', $_POST['link'], $Matches)) { if (preg_match_all('/(https?:\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*(:[0-9]{2,5})?(\/(\S)+)?/is', $_POST['link'], $Matches)) {
$Links = implode(' ', $Matches[0]); $Links = implode(' ', $Matches[0]);
} else { } else {
$Err = "The extra links you provided weren't links..."; $Err = "The extra links you provided weren't links...";
} }
} else { } else {
$Links = ""; $Links = '';
} }
if(!empty($_POST['image'])) { if (!empty($_POST['image'])) {
if(preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", trim($_POST['image']), $Matches)) { if (preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", trim($_POST['image']), $Matches)) {
$Images = $Matches[0]; $Images = $Matches[0];
} else { } else {
$Err = "The extra image links you provided weren't links to images..."; $Err = "The extra image links you provided weren't links to images...";
} }
} else { } else {
$Images = ""; $Images = '';
} }
if(!empty($_POST['track'])) { if (!empty($_POST['track'])) {
if(preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) { if (preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) {
$Tracks = $Matches[0]; $Tracks = $Matches[0];
} else { } else {
$Err = "Tracks should be given in a space separated list of numbers (no other characters)"; $Err = 'Tracks should be given in a space separated list of numbers (no other characters)';
} }
} else { } else {
$Tracks = ""; $Tracks = '';
} }
if(!empty($_POST['extra'])) { if (!empty($_POST['extra'])) {
$Extra = db_string($_POST['extra']); $Extra = db_string($_POST['extra']);
} else { } else {
$Err = "As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)"; $Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
} }
$DB->query("SELECT ID FROM torrents WHERE ID=".$TorrentID); $DB->query("SELECT ID FROM torrents WHERE ID=".$TorrentID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Err = "A torrent with that ID doesn't exist!"; $Err = "A torrent with that ID doesn't exist!";
} }
if(!empty($Err)) { if (!empty($Err)) {
error($Err); error($Err);
include(SERVER_ROOT.'/sections/reportsv2/report.php'); include(SERVER_ROOT.'/sections/reportsv2/report.php');
die(); die();
} }
$DB->query("SELECT ID FROM reportsv2 WHERE TorrentID=".$TorrentID." AND ReporterID=".db_string($LoggedUser['ID'])." AND ReportedTime > '".time_minus(3)."'"); $DB->query("SELECT ID FROM reportsv2 WHERE TorrentID=".$TorrentID." AND ReporterID=".db_string($LoggedUser['ID'])." AND ReportedTime > '".time_minus(3)."'");
if($DB->record_count() > 0) { if ($DB->record_count() > 0) {
header('Location: torrents.php?torrentid='.$TorrentID); header('Location: torrents.php?torrentid='.$TorrentID);
die(); die();
} }

View File

@ -215,7 +215,7 @@
Tools::warn_user($UploaderID, $WarnLength, $Reason); Tools::warn_user($UploaderID, $WarnLength, $Reason);
} else { } else {
//This is a bitch for people that don't warn but do other things, it makes me sad. //This is a bitch for people that don't warn but do other things, it makes me sad.
$AdminComment = ""; $AdminComment = '';
if($Upload) { if($Upload) {
//They removed upload //They removed upload
$AdminComment .= "Upload privileges removed by ".$LoggedUser['Username']; $AdminComment .= "Upload privileges removed by ".$LoggedUser['Username'];
@ -237,9 +237,9 @@
//PM //PM
if($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) { if($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) {
if(isset($Escaped['delete'])) { if(isset($Escaped['delete'])) {
$PM = "[url=http://".NONSSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported and has been deleted.\n\n"; $PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported and has been deleted.\n\n";
} else { } else {
$PM = "[url=http://".NONSSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported but not deleted.\n\n"; $PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported but not deleted.\n\n";
} }
$Preset = $ResolveType['resolve_options']['pm']; $Preset = $ResolveType['resolve_options']['pm'];
@ -249,7 +249,7 @@
} }
if($Warning > 0) { if($Warning > 0) {
$PM .= "\nThis has resulted in a [url=http://".NONSSL_SITE_URL."/wiki.php?action=article&amp;id=218]".$Warning." week warning.[/url]\n"; $PM .= "\nThis has resulted in a [url=https://".SSL_SITE_URL."/wiki.php?action=article&amp;id=218]".$Warning." week warning.[/url]\n";
} }
if($Upload) { if($Upload) {

View File

@ -7,26 +7,26 @@
*/ */
$NewRequest = ($_GET['action'] == "new" ? true : false); $NewRequest = ($_GET['action'] == 'new' ? true : false);
if(!$NewRequest) { if (!$NewRequest) {
$RequestID = $_GET['id']; $RequestID = $_GET['id'];
if(!is_number($RequestID)) { if (!is_number($RequestID)) {
error(404); error(404);
} }
} }
if($NewRequest && ($LoggedUser['BytesUploaded'] < 250*1024*1024 || !check_perms('site_submit_requests'))) { if ($NewRequest && ($LoggedUser['BytesUploaded'] < 250 * 1024 * 1024 || !check_perms('site_submit_requests'))) {
error('You do not have enough uploaded to make a request.'); error('You do not have enough uploaded to make a request.');
} }
if(!$NewRequest) { if (!$NewRequest) {
if(empty($ReturnEdit)) { if (empty($ReturnEdit)) {
$Request = Requests::get_requests(array($RequestID)); $Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID]; $Request = $Request['matches'][$RequestID];
if(empty($Request)) { if (empty($Request)) {
error(404); error(404);
} }
@ -35,11 +35,11 @@
$VoteArray = get_votes_array($RequestID); $VoteArray = get_votes_array($RequestID);
$VoteCount = count($VoteArray['Voters']); $VoteCount = count($VoteArray['Voters']);
$NeedCue = (strpos($LogCue, "Cue") !== false); $NeedCue = (strpos($LogCue, 'Cue') !== false);
$NeedLog = (strpos($LogCue, "Log") !== false); $NeedLog = (strpos($LogCue, 'Log') !== false);
if($NeedLog) { if ($NeedLog) {
if(strpos($LogCue, "%")) { if (strpos($LogCue, '%')) {
preg_match("/\d+/", $LogCue, $Matches); preg_match('/\d+/', $LogCue, $Matches);
$MinLogScore = (int) $Matches[0]; $MinLogScore = (int) $Matches[0];
} }
} }
@ -47,29 +47,29 @@
$IsFilled = !empty($TorrentID); $IsFilled = !empty($TorrentID);
$CategoryName = $Categories[$CategoryID - 1]; $CategoryName = $Categories[$CategoryID - 1];
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))); $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')); $CanEdit = ((!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
if(!$CanEdit) { if (!$CanEdit) {
error(403); error(403);
} }
if($CategoryName == "Music") { if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID); $ArtistForm = get_request_artists($RequestID);
$BitrateArray = array(); $BitrateArray = array();
if($BitrateList == "Any") { if ($BitrateList == 'Any') {
$BitrateArray = array_keys($Bitrates); $BitrateArray = array_keys($Bitrates);
} else { } else {
$BitrateArray = array_keys(array_intersect($Bitrates,explode('|', $BitrateList))); $BitrateArray = array_keys(array_intersect($Bitrates,explode('|', $BitrateList)));
} }
$FormatArray = array(); $FormatArray = array();
if($FormatList == "Any") { if ($FormatList == 'Any') {
$FormatArray = array_keys($Formats); $FormatArray = array_keys($Formats);
} else { } else {
foreach ($Formats as $Key => $Val) { foreach ($Formats as $Key => $Val) {
if(strpos($FormatList, $Val) !== false) { if (strpos($FormatList, $Val) !== false) {
$FormatArray[] = $Key; $FormatArray[] = $Key;
} }
} }
@ -77,12 +77,12 @@
$MediaArray = array(); $MediaArray = array();
if($MediaList == "Any") { if ($MediaList == 'Any') {
$MediaArray = array_keys($Media); $MediaArray = array_keys($Media);
} else { } else {
$MediaTemp = explode('|', $MediaList); $MediaTemp = explode('|', $MediaList);
foreach ($Media as $Key => $Val) { foreach ($Media as $Key => $Val) {
if(in_array($Val, $MediaTemp)) { if (in_array($Val, $MediaTemp)) {
$MediaArray[] = $Key; $MediaArray[] = $Key;
} }
} }
@ -93,7 +93,7 @@
} }
} }
if($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) { if ($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) {
$DB->query("SELECT Name FROM artists_group WHERE artistid = ".$_GET['artistid']." LIMIT 1"); $DB->query("SELECT Name FROM artists_group WHERE artistid = ".$_GET['artistid']." LIMIT 1");
list($ArtistName) = $DB->next_record(); list($ArtistName) = $DB->next_record();
$ArtistForm = array( $ArtistForm = array(
@ -101,7 +101,7 @@
2 => array(), 2 => array(),
3 => array() 3 => array()
); );
} elseif($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) { } elseif ($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$ArtistForm = Artists::get_artist($_GET['groupid']); $ArtistForm = Artists::get_artist($_GET['groupid']);
$DB->query("SELECT tg.Name, $DB->query("SELECT tg.Name,
tg.Year, tg.Year,
@ -113,7 +113,7 @@
JOIN torrents_tags AS tt ON tt.GroupID=tg.ID JOIN torrents_tags AS tt ON tt.GroupID=tg.ID
JOIN tags AS t ON t.ID=tt.TagID JOIN tags AS t ON t.ID=tt.TagID
WHERE tg.ID = ".$_GET['groupid']); WHERE tg.ID = ".$_GET['groupid']);
if(list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) { if (list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) {
$GroupID = trim($_REQUEST['groupid']); $GroupID = trim($_REQUEST['groupid']);
} }
} }
@ -128,7 +128,7 @@
<div class="box pad"> <div class="box pad">
<form action="" method="post" id="request_form" onsubmit="Calculate();"> <form action="" method="post" id="request_form" onsubmit="Calculate();">
<div> <div>
<? if(!$NewRequest) { ?> <? if (!$NewRequest) { ?>
<input type="hidden" name="requestid" value="<?=$RequestID?>" /> <input type="hidden" name="requestid" value="<?=$RequestID?>" />
<? } ?> <? } ?>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -139,7 +139,7 @@
<tr> <tr>
<td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the request rules!</a></td> <td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the request rules!</a></td>
</tr> </tr>
<? if($NewRequest || $CanEdit) { ?> <? if ($NewRequest || $CanEdit) { ?>
<tr> <tr>
<td class="label"> <td class="label">
Type Type
@ -158,7 +158,7 @@
<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">this</a> for more information.</p> <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">this</a> for more information.</p>
<? <?
if(!empty($ArtistForm)) { if (!empty($ArtistForm)) {
$First = true; $First = true;
foreach($ArtistForm as $Importance => $ArtistNames) { foreach($ArtistForm as $Importance => $ArtistNames) {
foreach($ArtistNames as $Artist) { foreach($ArtistNames as $Artist) {
@ -173,7 +173,7 @@
<option value="3"<?=($Importance == '3' ? ' selected="selected"' : '')?>>Remixer</option> <option value="3"<?=($Importance == '3' ? ' selected="selected"' : '')?>>Remixer</option>
<option value="3"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option> <option value="3"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option>
</select> </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 /> <br />
<? } <? }
} }
@ -193,7 +193,6 @@
?> ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label">Title</td> <td class="label">Title</td>
<td> <td>
@ -225,7 +224,7 @@
<input type="text" name="year" size="5" value="<?=(!empty($Year) ? display_str($Year) : '')?>" /> <input type="text" name="year" size="5" value="<?=(!empty($Year) ? display_str($Year) : '')?>" />
</td> </td>
</tr> </tr>
<? if($NewRequest || $CanEdit) { ?> <? if ($NewRequest || $CanEdit) { ?>
<tr id="image_tr"> <tr id="image_tr">
<td class="label">Image</td> <td class="label">Image</td>
<td> <td>
@ -238,7 +237,7 @@
<td> <td>
<? <?
$GenreTags = $Cache->get_value('genre_tags'); $GenreTags = $Cache->get_value('genre_tags');
if(!$GenreTags) { if (!$GenreTags) {
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); $DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name');
$GenreTags = $DB->collect('Name'); $GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600*6); $Cache->cache_value('genre_tags', $GenreTags, 3600*6);
@ -246,7 +245,7 @@
?> ?>
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" > <select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" >
<option>---</option> <option>---</option>
<? foreach(Misc::display_array($GenreTags) as $Genre){ ?> <? foreach (Misc::display_array($GenreTags) as $Genre){ ?>
<option value="<?=$Genre ?>"><?=$Genre ?></option> <option value="<?=$Genre ?>"><?=$Genre ?></option>
<? } ?> <? } ?>
</select> </select>
@ -257,12 +256,12 @@
There is a list of official tags to the left of the text box. Please use these tags instead of "unofficial" tags (e.g. use the official "<strong class="important_text_alt">drum.and.bass</strong>" tag, instead of an unofficial "<strong class="important_text">dnb</strong>" tag.). There is a list of official tags to the left of the text box. Please use these tags instead of "unofficial" tags (e.g. use the official "<strong class="important_text_alt">drum.and.bass</strong>" tag, instead of an unofficial "<strong class="important_text">dnb</strong>" tag.).
</td> </td>
</tr> </tr>
<? if($NewRequest || $CanEdit) { ?> <? if ($NewRequest || $CanEdit) { ?>
<tr id="releasetypes_tr"> <tr id="releasetypes_tr">
<td class="label">Release type</td> <td class="label">Release type</td>
<td> <td>
<select id="releasetype" name="releasetype"> <select id="releasetype" name="releasetype">
<option value='0'>---</option> <option value="0">---</option>
<? <?
foreach ($ReleaseTypes as $Key => $Val) { foreach ($ReleaseTypes as $Key => $Val) {
//echo '<h1>'.$ReleaseType.'</h1>'; die(); //echo '<h1>'.$ReleaseType.'</h1>'; die();
@ -279,10 +278,12 @@
<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> <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) { <? foreach ($Formats as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?> if ($Key % 8 == 0) {
<input type="checkbox" name="formats[]" value="<?=$Key?>" onchange="ToggleLogCue(); if(!this.checked) { $('#toggle_formats').raw().checked = false; }" id="format_<?=$Key?>" echo '<br />';
} ?>
<input type="checkbox" name="formats[]" value="<?=$Key?>" onchange="ToggleLogCue(); if (!this.checked) { $('#toggle_formats').raw().checked = false; }" id="format_<?=$Key?>"
<?=(!empty($FormatArray) && in_array($Key, $FormatArray) ? ' checked="checked"' : '')?> /><label for="format_<?=$Key?>"> <?=$Val?></label> <?=(!empty($FormatArray) && in_array($Key, $FormatArray) ? ' checked="checked"' : '')?> /><label for="format_<?=$Key?>"> <?=$Val?></label>
<? }?> <? } ?>
</td> </td>
</tr> </tr>
<tr id="bitrates_tr"> <tr id="bitrates_tr">
@ -290,11 +291,13 @@
<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) { <? 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?>" <input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
<?=(!empty($BitrateArray) && in_array($Key, $BitrateArray) ? ' checked="checked" ' : '')?> <?=(!empty($BitrateArray) && in_array($Key, $BitrateArray) ? ' checked="checked" ' : '')?>
onchange="if(!this.checked) { $('#toggle_bitrates').raw().checked = false; }" /><label for="bitrate_<?=$Key?>"> <?=$Val?></label> onchange="if (!this.checked) { $('#toggle_bitrates').raw().checked = false; }" /><label for="bitrate_<?=$Key?>"> <?=$Val?></label>
<? }?> <? } ?>
</td> </td>
</tr> </tr>
<tr id="media_tr"> <tr id="media_tr">
@ -302,11 +305,13 @@
<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) { <? 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?>" <input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
<?=(!empty($MediaArray) && in_array($Key, $MediaArray) ? ' checked="checked" ' : '')?> <?=(!empty($MediaArray) && in_array($Key, $MediaArray) ? ' checked="checked" ' : '')?>
onchange="if(!this.checked) { $('#toggle_media').raw().checked = false; }" /><label for="media_<?=$Key?>"> <?=$Val?></label> onchange="if (!this.checked) { $('#toggle_media').raw().checked = false; }" /><label for="media_<?=$Key?>"> <?=$Val?></label>
<? }?> <? } ?>
</td> </td>
</tr> </tr>
<tr id="logcue_tr" class="hidden"> <tr id="logcue_tr" class="hidden">
@ -326,11 +331,11 @@
<textarea name="description" cols="70" rows="7"><?=(!empty($Description) ? $Description : '')?></textarea> <br /> <textarea name="description" cols="70" rows="7"><?=(!empty($Description) ? $Description : '')?></textarea> <br />
</td> </td>
</tr> </tr>
<? if(check_perms('site_moderate_requests')) { ?> <? if (check_perms('site_moderate_requests')) { ?>
<tr> <tr>
<td class="label">Torrent group</td> <td class="label">Torrent group</td>
<td> <td>
https://what.cd/torrents.php?id=<input type="text" name="groupid" value="<?=$GroupID?>" size="15" /><br /> https://<?=SSL_SITE_URL?>/torrents.php?id=<input type="text" name="groupid" value="<?=$GroupID?>" size="15" /><br />
If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here. If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here.
</td> </td>
</tr> </tr>
@ -339,7 +344,7 @@
<tr> <tr>
<td class="label">Torrent group</td> <td class="label">Torrent group</td>
<td> <td>
<a href="torrents.php?id=<?=$GroupID?>">https://what.cd/torrents.php?id=<?=$GroupID?></a><br /> <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. 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. 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.
@ -348,7 +353,7 @@
</td> </td>
</tr> </tr>
<? } <? }
if($NewRequest) { ?> if ($NewRequest) { ?>
<tr id="voting"> <tr id="voting">
<td class="label">Bounty (MB)</td> <td class="label">Bounty (MB)</td>
<td> <td>

View File

@ -4,7 +4,7 @@
* This is the page that displays the request to the end user after being created. * This is the page that displays the request to the end user after being created.
*/ */
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT; $Text = new TEXT;
@ -237,7 +237,7 @@
<table class="layout"> <table class="layout">
<? $VoteMax = ($VoteCount < 5 ? $VoteCount : 5); <? $VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
$ViewerVote = false; $ViewerVote = false;
for($i = 0; $i < $VoteMax; $i++) { for ($i = 0; $i < $VoteMax; $i++) {
$User = array_shift($RequestVotes['Voters']); $User = array_shift($RequestVotes['Voters']);
$Boldify = false; $Boldify = false;
if ($User['UserID'] == $LoggedUser['ID']) { if ($User['UserID'] == $LoggedUser['ID']) {

View File

@ -5,29 +5,29 @@
authorize(); authorize();
if($_POST['action'] != "takenew" && $_POST['action'] != "takeedit") { if ($_POST['action'] != 'takenew' && $_POST['action'] != 'takeedit') {
error(0); error(0);
} }
$NewRequest = ($_POST['action'] == "takenew"); $NewRequest = ($_POST['action'] == 'takenew');
if(!$NewRequest) { if (!$NewRequest) {
$ReturnEdit = true; $ReturnEdit = true;
} }
if($NewRequest) { if ($NewRequest) {
if(!check_perms('site_submit_requests') || $LoggedUser['BytesUploaded'] < 250*1024*1024){ if (!check_perms('site_submit_requests') || $LoggedUser['BytesUploaded'] < 250 * 1024 * 1024) {
error(403); error(403);
} }
} else { } else {
$RequestID = $_POST['requestid']; $RequestID = $_POST['requestid'];
if(!is_number($RequestID)) { if (!is_number($RequestID)) {
error(0); error(0);
} }
$Request = Requests::get_requests(array($RequestID)); $Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID]; $Request = $Request['matches'][$RequestID];
if(empty($Request)) { if (empty($Request)) {
error(404); error(404);
} }
@ -40,132 +40,132 @@
$CategoryName = $Categories[$CategoryID - 1]; $CategoryName = $Categories[$CategoryID - 1];
$ProjectCanEdit = (check_perms('project_team') && !$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))); $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')); $CanEdit = ((!$IsFilled && $LoggedUser['ID'] == $RequestorID && $VoteCount < 2) || $ProjectCanEdit || check_perms('site_moderate_requests'));
if(!$CanEdit) { if (!$CanEdit) {
error(403); error(403);
} }
} }
// Validate // Validate
if(empty($_POST['type'])) { if (empty($_POST['type'])) {
error(0); error(0);
} }
$CategoryName = $_POST['type']; $CategoryName = $_POST['type'];
$CategoryID = (array_search($CategoryName, $Categories) + 1); $CategoryID = (array_search($CategoryName, $Categories) + 1);
if(empty($CategoryID)) { if (empty($CategoryID)) {
error(0); error(0);
} }
if(empty($_POST['title'])) { if (empty($_POST['title'])) {
$Err = "You forgot to enter the title!"; $Err = 'You forgot to enter the title!';
} else { } else {
$Title = trim($_POST['title']); $Title = trim($_POST['title']);
} }
if(empty($_POST['tags'])) { if (empty($_POST['tags'])) {
$Err = "You forgot to enter any tags!"; $Err = 'You forgot to enter any tags!';
} else { } else {
$Tags = trim($_POST['tags']); $Tags = trim($_POST['tags']);
} }
if($NewRequest) { if ($NewRequest) {
if(empty($_POST['amount'])) { if (empty($_POST['amount'])) {
$Err = "You forgot to enter any bounty!"; $Err = 'You forgot to enter any bounty!';
} else { } else {
$Bounty = trim($_POST['amount']); $Bounty = trim($_POST['amount']);
if(!is_number($Bounty)) { if (!is_number($Bounty)) {
$Err = "Your entered bounty is not a number"; $Err = 'Your entered bounty is not a number';
} elseif($Bounty < 100*1024*1024) { } elseif ($Bounty < 100 * 1024 * 1024) {
$Err = "Minumum bounty is 100MB"; $Err = 'Minumum bounty is 100 MB.';
} }
$Bytes = $Bounty; //From MB to B $Bytes = $Bounty; //From MB to B
} }
} }
if(empty($_POST['image'])) { if (empty($_POST['image'])) {
$Image = ""; $Image = '';
} else { } else {
ImageTools::blacklisted($_POST['image']); ImageTools::blacklisted($_POST['image']);
if(preg_match("/".IMAGE_REGEX."/", trim($_POST['image'])) > 0) { if (preg_match('/'.IMAGE_REGEX.'/', trim($_POST['image'])) > 0) {
$Image = trim($_POST['image']); $Image = trim($_POST['image']);
} else { } else {
$Err = display_str($_POST['image'])." does not appear to be a valid link to an image."; $Err = display_str($_POST['image']).' does not appear to be a valid link to an image.';
} }
} }
if(empty($_POST['description'])) { if (empty($_POST['description'])) {
$Err = "You forgot to enter any description!"; $Err = 'You forgot to enter a description.';
} else { } else {
$Description = trim($_POST['description']); $Description = trim($_POST['description']);
} }
if($CategoryName == "Music") { if ($CategoryName == "Music") {
if(empty($_POST['artists'])) { if (empty($_POST['artists'])) {
$Err = "You didn't enter any artists"; $Err = 'You did not enter any artists.';
} else { } else {
$Artists = $_POST['artists']; $Artists = $_POST['artists'];
$Importance = $_POST['importance']; $Importance = $_POST['importance'];
} }
if(!is_number($_POST['releasetype']) || !array_key_exists($_POST['releasetype'], $ReleaseTypes)) { if (!is_number($_POST['releasetype']) || !array_key_exists($_POST['releasetype'], $ReleaseTypes)) {
$Err = "Please pick a release type"; $Err = 'Please pick a release type';
} }
$ReleaseType = $_POST['releasetype']; $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']; $FormatArray = $_POST['formats'];
if(count($FormatArray) < 1) { if (count($FormatArray) < 1) {
$Err = "You must require at least one format"; $Err = 'You must require at least one format';
} }
} else { } else {
$AllFormats = true; $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']; $BitrateArray = $_POST['bitrates'];
if(count($BitrateArray) < 1) { if (count($BitrateArray) < 1) {
$Err = "You must require at least one bitrate"; $Err = 'You must require at least one bitrate';
} }
} else { } else {
$AllBitrates = true; $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']; $MediaArray = $_POST['media'];
if(count($MediaArray) < 1) { if (count($MediaArray) < 1) {
$Err = "You must require at least one type of media"; $Err = 'You must require at least one medium.';
} }
} else { } else {
$AllMedia = true; $AllMedia = true;
} }
//$Bitrates[1] = FLAC //$Bitrates[1] = FLAC
if(!empty($FormatArray) && in_array(1, $FormatArray)) { if (!empty($FormatArray) && in_array(1, $FormatArray)) {
$NeedLog = empty($_POST['needlog']) ? false : true; $NeedLog = empty($_POST['needlog']) ? false : true;
if($NeedLog) { if ($NeedLog) {
if($_POST['minlogscore']) { if ($_POST['minlogscore']) {
$MinLogScore = trim($_POST['minlogscore']); $MinLogScore = trim($_POST['minlogscore']);
} else { } else {
$MinLogScore = 0; $MinLogScore = 0;
} }
if(!is_number($MinLogScore)) { if (!is_number($MinLogScore)) {
$Err = "You've entered a minimum log score that isn't a number"; $Err = 'You have entered a minimum log score that is not a number.';
} }
} }
$NeedCue = empty($_POST['needcue']) ? false : true; $NeedCue = empty($_POST['needcue']) ? false : true;
//FLAC was picked, require either Lossless or 24 bit Lossless //FLAC was picked, require either Lossless or 24 bit Lossless
if(!$AllBitrates && !in_array(8, $BitrateArray) && !in_array(9, $BitrateArray)) { if (!$AllBitrates && !in_array(8, $BitrateArray) && !in_array(9, $BitrateArray)) {
$Err = "You selected FLAC as a format but no possible bitrate to fill it (Lossless or 24 bit Lossless)"; $Err = 'You selected FLAC as a format but no possible bitrate to fill it (Lossless or 24bit Lossless)';
} }
if (($NeedCue || $NeedLog)) { if (($NeedCue || $NeedLog)) {
if (!(empty($_POST['all_media']) && $MediaArray[0] == 0)) { if (!(empty($_POST['all_media']) && $MediaArray[0] == 0)) {
$Err = "Only CD is allowed as media for FLAC Log/Cue Requests."; $Err = 'Only CD is allowed as media for FLAC + log/cue requests.';
} }
} }
} else { } else {
@ -177,47 +177,47 @@
// GroupID // GroupID
if (!empty($_POST['groupid'])) { if (!empty($_POST['groupid'])) {
$GroupID = trim($_POST['groupid']); $GroupID = trim($_POST['groupid']);
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i'; $URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.SSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
if (preg_match($URLRegex, $GroupID, $Matches)) { if (preg_match($URLRegex, $GroupID, $Matches)) {
$GroupID = $Matches[3]; $GroupID = $Matches[3];
} }
if (is_number($GroupID)) { if (is_number($GroupID)) {
$DB->query("SELECT 1 FROM torrents_group WHERE ID = '$GroupID' AND CategoryID = 1"); $DB->query("SELECT 1 FROM torrents_group WHERE ID = '$GroupID' AND CategoryID = 1");
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
$Err = "Torrent Group, if entered, must correspond to a music group on the site."; $Err = 'The torrent group, if entered, must correspond to a music torrent group on the site.';
} }
} else { } else {
$Err = "Torrent Group, if entered, must correspond to a music group on the site."; $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; $GroupID = 0;
} }
//Not required //Not required
if(!empty($_POST['editioninfo'])) { if (!empty($_POST['editioninfo'])) {
$EditionInfo = trim($_POST['editioninfo']); $EditionInfo = trim($_POST['editioninfo']);
} else { } else {
$EditionInfo = ""; $EditionInfo = '';
} }
if(!empty($_POST['cataloguenumber'])) { if (!empty($_POST['cataloguenumber'])) {
$CatalogueNumber = trim($_POST['cataloguenumber']); $CatalogueNumber = trim($_POST['cataloguenumber']);
} else { } else {
$CatalogueNumber = ""; $CatalogueNumber = '';
} }
if(!empty($_POST['recordlabel'])) { if (!empty($_POST['recordlabel'])) {
$RecordLabel = trim($_POST['recordlabel']); $RecordLabel = trim($_POST['recordlabel']);
} else { } else {
$RecordLabel = ""; $RecordLabel = '';
} }
} }
if($CategoryName == "Music" || $CategoryName == "Audiobooks" || $CategoryName == "Comedy") { if ($CategoryName == 'Music' || $CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
if(empty($_POST['year'])) { if (empty($_POST['year'])) {
$Err = "You forgot to enter the year!"; $Err = 'You forgot to enter the year!';
} else { } else {
$Year = trim($_POST['year']); $Year = trim($_POST['year']);
if(!is_number($Year)) { if (!is_number($Year)) {
$Err = "Your entered year is not a number"; $Err = 'Your entered year is not a number.';
} }
} }
} }
@ -226,12 +226,12 @@
if (!empty($_POST['oclc'])) { if (!empty($_POST['oclc'])) {
$OCLC = trim($_POST['oclc']); $OCLC = trim($_POST['oclc']);
} else { } else {
$OCLC = ""; $OCLC = '';
} }
//For refilling on error //For refilling on error
if($CategoryName == "Music") { if ($CategoryName == 'Music') {
$MainArtistCount = 0; $MainArtistCount = 0;
$ArtistNames = array(); $ArtistNames = array();
$ArtistForm = array( $ArtistForm = array(
@ -239,105 +239,105 @@
2 => array(), 2 => array(),
3 => array() 3 => array()
); );
for($i = 0, $il = count($Artists); $i < $il; $i++) { for ($i = 0, $il = count($Artists); $i < $il; $i++) {
if(trim($Artists[$i]) != "") { if (trim($Artists[$i]) != '') {
if(!in_array($Artists[$i], $ArtistNames)) { if (!in_array($Artists[$i], $ArtistNames)) {
$ArtistForm[$Importance[$i]][] = array('name' => trim($Artists[$i])); $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++; $MainArtistCount++;
} }
$ArtistNames[] = trim($Artists[$i]); $ArtistNames[] = trim($Artists[$i]);
} }
} }
} }
if($MainArtistCount < 1) { if ($MainArtistCount < 1) {
$Err = "Please enter at least one main artist, conductor, composer, or DJ"; $Err = 'Please enter at least one main artist, conductor, composer, or DJ.';
} }
if(!isset($ArtistNames[0])) { if (!isset($ArtistNames[0])) {
unset($ArtistForm); unset($ArtistForm);
} }
} }
if(!empty($Err)) { if (!empty($Err)) {
error($Err); error($Err);
$Div = $_POST['unit'] == 'mb' ? 1024*1024 : 1024*1024*1024; $Div = $_POST['unit'] == 'mb' ? 1024 * 1024 : 1024 * 1024 * 1024;
$Bounty /= $Div; $Bounty /= $Div;
include(SERVER_ROOT.'/sections/requests/new_edit.php'); include(SERVER_ROOT.'/sections/requests/new_edit.php');
die(); die();
} }
//Databasify the input //Databasify the input
if($CategoryName == "Music") { if ($CategoryName == 'Music') {
if(empty($AllBitrates)) { if (empty($AllBitrates)) {
foreach($BitrateArray as $Index => $MasterIndex) { foreach ($BitrateArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Bitrates)) { if (array_key_exists($Index, $Bitrates)) {
$BitrateArray[$Index] = $Bitrates[$MasterIndex]; $BitrateArray[$Index] = $Bitrates[$MasterIndex];
} else { } else {
//Hax //Hax
error(0); error(0);
} }
} }
$BitrateList = implode("|", $BitrateArray); $BitrateList = implode('|', $BitrateArray);
} else { } else {
$BitrateList = "Any"; $BitrateList = 'Any';
} }
if(empty($AllFormats)) { if (empty($AllFormats)) {
foreach($FormatArray as $Index => $MasterIndex) { foreach ($FormatArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Formats)) { if (array_key_exists($Index, $Formats)) {
$FormatArray[$Index] = $Formats[$MasterIndex]; $FormatArray[$Index] = $Formats[$MasterIndex];
} else { } else {
//Hax //Hax
error(0); error(0);
} }
} }
$FormatList = implode("|", $FormatArray); $FormatList = implode('|', $FormatArray);
} else { } else {
$FormatList = "Any"; $FormatList = 'Any';
} }
if(empty($AllMedia)) { if (empty($AllMedia)) {
foreach($MediaArray as $Index => $MasterIndex) { foreach ($MediaArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Media)) { if (array_key_exists($Index, $Media)) {
$MediaArray[$Index] = $Media[$MasterIndex]; $MediaArray[$Index] = $Media[$MasterIndex];
} else { } else {
//Hax //Hax
error(0); error(0);
} }
} }
$MediaList = implode("|", $MediaArray); $MediaList = implode('|', $MediaArray);
} else { } else {
$MediaList = "Any"; $MediaList = 'Any';
} }
$LogCue = ""; $LogCue = '';
if($NeedLog) { if ($NeedLog) {
$LogCue .= "Log"; $LogCue .= 'Log';
if($MinLogScore > 0) { if ($MinLogScore > 0) {
if($MinLogScore >= 100) { if ($MinLogScore >= 100) {
$LogCue .= " (100%)"; $LogCue .= ' (100%)';
} else { } else {
$LogCue .= " (>= ".$MinLogScore."%)"; $LogCue .= ' (>= '.$MinLogScore.'%)';
} }
} }
} }
if($NeedCue) { if ($NeedCue) {
if($LogCue != "") { if ($LogCue != '') {
$LogCue .= " + Cue"; $LogCue .= ' + Cue';
} else { } else {
$LogCue = "Cue"; $LogCue = 'Cue';
} }
} }
} }
//Query time! //Query time!
if($CategoryName == "Music") { if ($CategoryName == 'Music') {
if($NewRequest) { if ($NewRequest) {
$DB->query("INSERT INTO requests ( $DB->query('INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, RecordLabel, UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, RecordLabel,
CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID, OCLC) CatalogueNumber, ReleaseType, BitrateList, FormatList, MediaList, LogCue, Visible, GroupID, OCLC)
VALUES VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."','".db_string($RecordLabel)."', ('.$LoggedUser['ID'].", '".sqltime()."', '".sqltime()."', ".$CategoryID.", '".db_string($Title)."', ".$Year.", '".db_string($Image)."', '".db_string($Description)."','".db_string($RecordLabel)."',
'".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1', '$GroupID', '".db_string($OCLC)."')"); '".db_string($CatalogueNumber)."', ".$ReleaseType.", '".$BitrateList."','".$FormatList."', '".$MediaList."', '".$LogCue."', '1', '$GroupID', '".db_string($OCLC)."')");
$RequestID = $DB->inserted_id(); $RequestID = $DB->inserted_id();
@ -363,7 +363,7 @@
//I almost didn't think of this, we need to be able to delete artists / tags //I almost didn't think of this, we need to be able to delete artists / tags
$DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID); $DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID);
$RequestArtists = $DB->to_array(); $RequestArtists = $DB->to_array();
foreach($RequestArtists as $RequestArtist) { foreach ($RequestArtists as $RequestArtist) {
$Cache->delete_value('artists_requests_'.$RequestArtist); $Cache->delete_value('artists_requests_'.$RequestArtist);
} }
$DB->query("DELETE FROM requests_artists WHERE RequestID = ".$RequestID); $DB->query("DELETE FROM requests_artists WHERE RequestID = ".$RequestID);
@ -383,8 +383,8 @@
*/ */
foreach($ArtistForm as $Importance => $Artists) { foreach ($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) { foreach ($Artists as $Num => $Artist) {
//1. See if each artist given already exists and if it does, grab the ID. //1. See if each artist given already exists and if it does, grab the ID.
$DB->query(" $DB->query("
SELECT SELECT
@ -395,16 +395,16 @@
FROM artists_alias AS aa FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'"); WHERE aa.Name = '".db_string($Artist['name'])."'");
while(list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) { while (list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if(!strcasecmp($Artist['name'], $AliasName)) { if (!strcasecmp($Artist['name'], $AliasName)) {
if($Redirect) { if ($Redirect) {
$AliasID = $Redirect; $AliasID = $Redirect;
} }
$ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName); $ArtistForm[$Importance][$Num] = array('id' => $ArtistID, 'aliasid' => $AliasID, 'name' => $AliasName);
break; break;
} }
} }
if(!$ArtistID) { if (!$ArtistID) {
//2. For each artist that didn't exist, create an artist. //2. For each artist that didn't exist, create an artist.
$DB->query("INSERT INTO artists_group (Name) VALUES ('".db_string($Artist['name'])."')"); $DB->query("INSERT INTO artists_group (Name) VALUES ('".db_string($Artist['name'])."')");
$ArtistID = $DB->inserted_id(); $ArtistID = $DB->inserted_id();
@ -421,8 +421,8 @@
//3. Create a row in the requests_artists table for each artist, based on the ID. //3. Create a row in the requests_artists table for each artist, based on the ID.
foreach($ArtistForm as $Importance => $Artists) { foreach ($ArtistForm as $Importance => $Artists) {
foreach($Artists as $Num => $Artist) { foreach ($Artists as $Num => $Artist) {
$DB->query("INSERT IGNORE INTO requests_artists (RequestID, ArtistID, AliasID, Importance) VALUES (".$RequestID.", ".$Artist['id'].", ".$Artist['aliasid'].", '".$Importance."')"); $DB->query("INSERT IGNORE INTO requests_artists (RequestID, ArtistID, AliasID, Importance) VALUES (".$RequestID.", ".$Artist['id'].", ".$Artist['aliasid'].", '".$Importance."')");
$Cache->increment('stats_album_count'); $Cache->increment('stats_album_count');
$Cache->delete_value('artists_requests_'.$Artist['id']); $Cache->delete_value('artists_requests_'.$Artist['id']);
@ -433,11 +433,11 @@
} else { } else {
//Not a music request anymore, delete music only fields. //Not a music request anymore, delete music only fields.
if(!$NewRequest) { if (!$NewRequest) {
$DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID); $DB->query("SELECT ArtistID FROM requests_artists WHERE RequestID = ".$RequestID);
$OldArtists = $DB->collect('ArtistID'); $OldArtists = $DB->collect('ArtistID');
foreach($OldArtists as $ArtistID) { foreach ($OldArtists as $ArtistID) {
if(empty($ArtistID)) { continue; } if (empty($ArtistID)) { continue; }
//Get a count of how many groups or requests use the artist ID //Get a count of how many groups or requests use the artist ID
$DB->query("SELECT COUNT(ag.ArtistID) $DB->query("SELECT COUNT(ag.ArtistID)
FROM artists_group as ag FROM artists_group as ag
@ -451,7 +451,7 @@
WHERE ta.ArtistID IS NOT NULL WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'"); AND ag.ArtistID = '$ArtistID'");
list($GroupCount) = $DB->next_record(); list($GroupCount) = $DB->next_record();
if(($ReqCount + $GroupCount) == 0) { if (($ReqCount + $GroupCount) == 0) {
//The only group to use this artist //The only group to use this artist
Artists::delete_artist($ArtistID); Artists::delete_artist($ArtistID);
} else { } else {
@ -462,9 +462,9 @@
$DB->query("DELETE FROM requests_artists WHERE RequestID = ".$RequestID); $DB->query("DELETE FROM requests_artists WHERE RequestID = ".$RequestID);
} }
if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") { if ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
//These types require a year field. //These types require a year field.
if($NewRequest) { if ($NewRequest) {
$DB->query("INSERT INTO requests ( $DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, Visible, OCLC) UserID, TimeAdded, LastVote, CategoryID, Title, Year, Image, Description, Visible, OCLC)
VALUES VALUES
@ -483,7 +483,7 @@
WHERE ID = ".$RequestID); WHERE ID = ".$RequestID);
} }
} else { } else {
if($NewRequest) { if ($NewRequest) {
$DB->query("INSERT INTO requests ( $DB->query("INSERT INTO requests (
UserID, TimeAdded, LastVote, CategoryID, Title, Image, Description, Visible, OCLC) UserID, TimeAdded, LastVote, CategoryID, Title, Image, Description, Visible, OCLC)
VALUES VALUES
@ -504,12 +504,12 @@
} }
//Tags //Tags
if(!$NewRequest) { if (!$NewRequest) {
$DB->query("DELETE FROM requests_tags WHERE RequestID = ".$RequestID); $DB->query("DELETE FROM requests_tags WHERE RequestID = ".$RequestID);
} }
$Tags = array_unique(explode(',', $Tags)); $Tags = array_unique(explode(',', $Tags));
foreach($Tags as $Index => $Tag) { foreach ($Tags as $Index => $Tag) {
$Tag = Misc::sanitize_tag($Tag); $Tag = Misc::sanitize_tag($Tag);
$Tag = Misc::get_alias_tag($Tag); $Tag = Misc::get_alias_tag($Tag);
$Tags[$Index] = $Tag; //For announce $Tags[$Index] = $Tag; //For announce
@ -527,7 +527,7 @@
(".$TagID.", ".$RequestID.")"); (".$TagID.", ".$RequestID.")");
} }
if($NewRequest) { if ($NewRequest) {
//Remove the bounty and create the vote //Remove the bounty and create the vote
$DB->query("INSERT INTO requests_votes $DB->query("INSERT INTO requests_votes
(RequestID, UserID, Bounty) (RequestID, UserID, Bounty)
@ -539,7 +539,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); $Announce = "'".$Title."' - ".Artists::display_artists($ArtistForm, false, false)." https://".SSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);
} else { } else {
$Announce = "'".$Title."' - https://".SSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags); $Announce = "'".$Title."' - https://".SSL_SITE_URL."/requests.php?action=view&id=".$RequestID." - ".implode(" ", $Tags);

View File

@ -618,7 +618,7 @@ function next_hour() {
AND ul.UserID IS NULL AND ul.UserID IS NULL
GROUP BY um.ID"); GROUP BY um.ID");
while (list($Username, $Email) = $DB->next_record()) { while (list($Username, $Email) = $DB->next_record()) {
$Body = "Hi $Username, \n\nIt has been almost 4 months since you used your account at http://".NONSSL_SITE_URL.". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in. "; $Body = "Hi $Username, \n\nIt has been almost 4 months since you used your account at https://".SSL_SITE_URL.". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in. ";
Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body); Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body);
} }
$DB->query("SELECT um.ID $DB->query("SELECT um.ID

View File

@ -10,8 +10,8 @@
*****************************************************************/ *****************************************************************/
if (isset($argv[1])) { if (isset($argv[1])) {
if ($argv[1] == "cli_sandbox") { if ($argv[1] == 'cli_sandbox') {
include("misc/cli_sandbox.php"); include('misc/cli_sandbox.php');
die(); die();
} }

View File

@ -5,7 +5,7 @@
View::show_header('Tag Aliases'); View::show_header('Tag Aliases');
$orderby = ($_GET['order']) == "badtags" ? "BadTag" : "AliasTag"; $orderby = ($_GET['order']) == 'badtags' ? 'BadTag' : 'AliasTag';
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
if (isset($_POST['newalias'])) { if (isset($_POST['newalias'])) {
@ -56,7 +56,7 @@
</td> </td>
<? if (check_perms('users_mod')) { ?> <? if (check_perms('users_mod')) { ?>
<td> <td>
<input type="submit" value="Add Alias" /> <input type="submit" value="Add alias" />
</td> </td>
<? } ?> <? } ?>
</form> </form>

View File

@ -0,0 +1,265 @@
<?
View::show_header('Batch Tag Editor','validate');
if (!check_perms('users_mod')) {
error(403);
}
// validation functions
$Val->SetFields('tag',true,'string','Enter a single tag to search for.',array('maxlength'=>'200','minlength'=>'2'));
$Val->SetFields('replace',true,'string','Enter a single replacement tag.',array('maxlength'=>'200','minlength'=>'2'));
echo $Val->GenerateJS('tagform');
// some constants to make programmers' lives easier
define('MODE_RENAME',0);
define('MODE_MERGE',1);
?>
<div class="thin">
<h3>Merge/Rename Tags</h3>
<form action="tools.php" method="get" name="tagform" id="tagform" onsubmit="return formVal();">
<input type="hidden" name="action" value="edit_tags" />
<table>
<tr>
<td class="label">
Tag:
</td>
<td>
<input type="text" name="tag" id="tag" />
</td>
<td class="label">
Rename to/merge with tag:
</td>
<td>
<input type="text" name="replace" id="replace" />
</td>
<td class="label">
<input type="checkbox" name="list" id="list" checked="checked" /> <label for="list">List affected rows</label>
</td>
</tr>
<tr>
<td class="center" colspan="5">
<input type="submit" value="Rename/Merge Tags" />
</td>
</tr>
</table>
</form>
<br />
<?
if (isset($_GET['tag']) || isset($_GET['replace'])) {
// validate input
$Err = $Val->ValidateForm($_GET);
if ($Err) {
echo ' <div class="box pad center">
<strong>Error:</strong> '.$Err.'
</div>';
} else {
$Tag = Misc::sanitize_tag($_GET['tag']);
$Replacement = Misc::sanitize_tag($_GET['replace']);
// trying to merge tag with itself would create big problems
if ($Tag == $Replacement) {
echo " <div class=\"box pad center\">
<strong>Error:</strong> Cannot merge tag $Tag with itself (doh).
</div>
</div>";
View::show_footer();
exit;
}
// 1) make sure tag exists
$DB->query("SELECT ID
FROM tags
WHERE Name = '".$Tag."'
LIMIT 1;");
if ($DB->record_count() == 0) {
echo " <div class=\"box pad center\">
<strong>Error:</strong> No such tag found: $Tag
</div>
</div>";
View::show_footer();
exit;
}
list($TagID) = $DB->next_record();
// 2) check if replacement exists
$DB->query("SELECT ID
FROM tags
WHERE Name = '".$Replacement."'
LIMIT 1;");
if ($DB->record_count() == 0 ) {
$Mode = MODE_RENAME;
} else {
$Mode = MODE_MERGE;
}
list($ReplacementID) = $DB->next_record();
if ($_GET['list']) {
$AffectedTorrents = array();
// 3) get a list of affected torrents
$DB->query("SELECT
tg.ID,
ag.ArtistID,
ag.Name,
tg.Name
FROM torrents_group AS tg
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
JOIN torrents_tags AS t ON t.GroupID=tg.ID
WHERE t.TagID=$TagID;");
while (list($TorrentID,$ArtistID,$ArtistName,$TorrentName) = $DB->next_record()) {
$Row = ($ArtistName ? "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a> - " : '');
$Row.= "<a href='torrents.php?id=$TorrentID'>".display_str($TorrentName)."</a>";
$AffectedTorrents[] = $Row;
}
// 4) get a list of affected requests
$DB->query("SELECT
ra.RequestID,
ag.ArtistID,
ag.Name,
r.Title
FROM requests AS r
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
LEFT JOIN artists_group AS ag ON ag.ArtistID=ra.ArtistID
JOIN requests_tags AS t ON t.RequestID=r.ID
WHERE t.TagID=$TagID;");
while (list($RequestID,$ArtistID,$ArtistName,$RequestName) = $DB->next_record()) {
$Row = ($ArtistName ? "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a> - " : '');
$Row.= "<a href='requests.php?action=viewrequest&id=$RequestID'>".display_str($RequestName)."</a>";
$AffectedRequests[] = $Row;
}
}
$TotalAffected = 0;
if ($Mode == MODE_RENAME) {
// EASY! just rename the tag
// 5) rename the tag
$DB->query("UPDATE tags
SET Name = '".$Replacement."'
WHERE ID = $TagID
LIMIT 1;");
$TotalAffected = $DB->affected_rows();
} else {
// HARD! merge two tags together and update usage
// 5) remove dupe tags from torrents
// (torrents that have both "old tag" and "replacement tag" set)
$DB->query("SELECT GroupID FROM torrents_tags WHERE TagID=$ReplacementID;");
if ($DB->record_count() > 0 ) {
$Query = "DELETE
FROM torrents_tags
WHERE TagID=$TagID
AND GroupID IN (";
while (list($GroupID) = $DB->next_record()) {
$Query.= $GroupID.',';
}
$Query = substr($Query,0,-1).");";
$DB->query($Query);
$TotalAffected = $DB->affected_rows();
}
// 6) replace old tag in torrents
$DB->query("UPDATE torrents_tags
SET TagID=$ReplacementID
WHERE TagID=$TagID;");
$UsageChange = $DB->affected_rows();
// 7) remove dupe tags from artists
$DB->query("SELECT ArtistID FROM artists_tags WHERE TagID=$ReplacementID;");
if ($DB->record_count() > 0 ) {
$Query = "DELETE
FROM artists_tags
WHERE TagID=$TagID
AND ArtistID IN (";
while (list($ArtistID) = $DB->next_record()) {
$Query.= $ArtistID.',';
}
$Query = substr($Query,0,-1).");";
$DB->query($Query);
$TotalAffected += $DB->affected_rows();
}
// 8) replace old tag in artists
$DB->query("UPDATE artists_tags
SET TagID=$ReplacementID
WHERE TagID=$TagID;");
$UsageChange += $DB->affected_rows();
// 9) remove dupe tags from requests
$DB->query("SELECT RequestID FROM requests_tags WHERE TagID=$ReplacementID;");
if ($DB->record_count() > 0) {
$Query = "DELETE
FROM requests_tags
WHERE TagID=$TagID
AND RequestID IN (";
while (list($RequestID) = $DB->next_record()) {
$Query.= $RequestID.',';
}
$Query = substr($Query,0,-1).");";
$DB->query($Query);
$TotalAffected += $DB->affected_rows();
}
// 10) replace old tag in requests
$DB->query("UPDATE requests_tags
SET TagID=$ReplacementID
WHERE TagID=$TagID;");
$UsageChange += $DB->affected_rows();
$TotalAffected += $UsageChange;
// 11) finally, remove old tag completely
$DB->query("DELETE
FROM tags
WHERE ID=$TagID
LIMIT 1");
// 12) update usage count for replacement tag
$DB->query("UPDATE tags
SET Uses=Uses+$UsageChange
WHERE ID=$ReplacementID
LIMIT 1");
} // if ($Mode == MODE_MERGE)
echo '<div class="box pad center"><strong>Success!</strong> Affected entries: '.number_format($TotalAffected).'</div>';
if ($_GET['list']) {
?>
<br>
<table>
<tr class="colhead">
<td>
Affected torrent groups
</td>
</tr>
<?
if (count($AffectedTorrents)) {
foreach ($AffectedTorrents as $Row) {
echo "<tr><td>$Row</td></tr>";
}
}
?>
<tr class="colhead">
<td>
Affected requests
</td>
</tr>
<?
if (count($AffectedRequests)) {
foreach ($AffectedRequests as $Row) {
echo "<tr><td>$Row</td></tr>";
}
}
?>
</table>
<?
}
} // if (!$Err)
} // if ( isset($_GET['tag']) || isset($_GET['replace']) )
echo '</div>';
View::show_footer();
?>

View File

@ -69,8 +69,10 @@
<div class="permission_container"> <div class="permission_container">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Misc</td></tr> <tr class="colhead"><td>Misc</td></tr>
<? if (check_perms('users_mod')) { ?> <? if (check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=edit_tags">Batch tag editor</a></td></tr>
<? }
if (check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=manipulate_tree">Manipulate tree</a></td></tr> <tr><td><a href="tools.php?action=manipulate_tree">Manipulate tree</a></td></tr>
<? } <? }
if (check_perms('admin_update_geoip')) { ?> if (check_perms('admin_update_geoip')) { ?>

View File

@ -1,5 +1,5 @@
<? <?
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
$Where = array(); $Where = array();
@ -445,19 +445,47 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
} }
// append extra info to torrent title // append extra info to torrent title
$ExtraInfo=''; $ExtraInfo = '';
$AddExtra=''; $AddExtra = '';
if ($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; } if ($Format) {
if ($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; } $ExtraInfo.=$Format;
$AddExtra=' / ';
}
if ($Encoding) {
$ExtraInfo.=$AddExtra.$Encoding;
$AddExtra=' / ';
}
// "FLAC / Lossless / Log (100%) / Cue / CD"; // "FLAC / Lossless / Log (100%) / Cue / CD";
if ($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; } if ($HasLog) {
if ($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; } $ExtraInfo.=$AddExtra.'Log ('.$LogScore.'%)';
if ($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; } $AddExtra = ' / ';
if ($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; } }
if ($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; } if ($HasCue) {
if ($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; } $ExtraInfo.=$AddExtra.'Cue';
if ($IsSnatched) { if ($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo.= Format::torrent_label('Snatched!'); } $AddExtra = ' / ';
if ($ExtraInfo!='') { }
if ($Media) {
$ExtraInfo.=$AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.=$AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.=$AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.=$AddExtra.$RemasterTitle;
}
if ($IsSnatched) {
if ($GroupCategoryID == 1) {
$ExtraInfo .= ' / ';
}
$ExtraInfo.= Format::torrent_label('Snatched!');
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]"; $ExtraInfo = "- [$ExtraInfo]";
} }
@ -473,7 +501,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
// print row // print row
?> ?>
<tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>"> <tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td> <td style="padding: 8px; text-align: center;"><strong><?=$Rank?></strong></td>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td> <td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
@ -485,7 +513,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<span><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></span> <span><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></span>
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?><?if($Reported){?> - <strong class="torrent_label tl_reported" title="Reported">Reported</strong><?}?> <strong><?=$DisplayName?></strong> <?=$ExtraInfo?><? if ($Reported) { ?> - <strong class="torrent_label tl_reported" title="Reported">Reported</strong><? } ?>
<span class="bookmark" style="float: right;"> <span class="bookmark" style="float: right;">
<? <?
if ($IsBookmarked) { if ($IsBookmarked) {
@ -496,7 +524,6 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<? } ?> <? } ?>
</span> </span>
<div class="tags"><?=$TorrentTags->format()?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</div> </div>
</td> </td>
<td style="text-align: right;" class="nobr"><?=Format::get_size($Size)?></td> <td style="text-align: right;" class="nobr"><?=Format::get_size($Size)?></td>

View File

@ -186,7 +186,7 @@
$DisplayName = $DisplayName. " [$GroupYear]"; $DisplayName = $DisplayName. " [$GroupYear]";
} }
if ($GroupVanityHouse) { if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; $DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
} }
// Start an output buffer, so we can store this output in $TorrentTable // Start an output buffer, so we can store this output in $TorrentTable
ob_start(); ob_start();

View File

@ -23,7 +23,7 @@
define('EXPLAIN_HACK',false); define('EXPLAIN_HACK',false);
if (EXPLAIN_HACK){ if (EXPLAIN_HACK) {
$SCFR = ''; $SCFR = '';
} else { } else {
$SCFR = 'SQL_CALC_FOUND_ROWS'; $SCFR = 'SQL_CALC_FOUND_ROWS';
@ -31,7 +31,7 @@
// Function to build a SQL WHERE to search for a string // Function to build a SQL WHERE to search for a string
// Offers exact searching, fulltext searching, and negative searching // Offers exact searching, fulltext searching, and negative searching
function build_search($SearchStr,$Field,$Exact=false,$SQLWhere='',$FullText=0,&$FilterString='') { function build_search($SearchStr, $Field, $Exact=false, $SQLWhere='', $FullText=0, &$FilterString='') {
if ($SQLWhere != '') { if ($SQLWhere != '') {
$AddWhere = false; $AddWhere = false;
} else { } else {
@ -645,7 +645,7 @@ function header_link($SortKey,$DefaultWay = 'DESC') {
} }
} }
// List of pages // List of pages
$Pages = Format::get_pages($Page,$TorrentCount,TORRENTS_PER_PAGE); $Pages = Format::get_pages($Page,$TorrentCount,TORRENTS_PER_PAGE);
// Gets tacked onto torrent download URLs // Gets tacked onto torrent download URLs

View File

@ -305,7 +305,48 @@ function header_link($SortKey,$DefaultWay="desc") {
// Tag list // Tag list
if (!empty($SearchWords['taglist'])) { if (!empty($SearchWords['taglist'])) {
global $Cache, $DB;
//Get tag aliases.
$TagAliases = $Cache->get_value('tag_aliases_search');
if (!$TagAliases) {
$DB->query("SELECT ID,BadTag,AliasTag FROM tag_aliases ORDER BY BadTag");
$TagAliases = $DB->to_array();
//Unify tag aliases to be in_this_format as tags not in.this.format
array_walk_recursive($TagAliases, create_function('&$val', '$val = preg_replace("/\./","_", $val);'));
//Clean up the array for smaller cache size
foreach ($TagAliases as &$TagAlias) {
foreach (array_keys($TagAlias) as $Key) {
if (is_numeric($Key)) {
unset($TagAlias[$Key]);
}
}
}
$Cache->cache_value('tag_aliases_search', $TagAliases, 3600 * 24 * 7); // cache for 7 days
}
//Get tags
$Tags = $SearchWords['taglist']; $Tags = $SearchWords['taglist'];
//Replace bad tags with tag aliases
//In other news oh God I'm going to hell for all this preg_replace, but they're kept in two separate formats
for ($i = 0; $i < sizeof($Tags['include']) ; $i++) {
foreach ($TagAliases as $TagAlias) {
if ($Tags['include'][$i] === $TagAlias['BadTag']) {
$Tags['include'][$i] = $TagAlias['AliasTag'];
break;
}
}
}
for ($i = 0; $i < sizeof($Tags['exclude']) ; $i++) {
foreach ($TagAliases as $TagAlias) {
if (preg_replace('/^!/', '', $Tags['exclude'][$i]) === $TagAlias['BadTag']) {
$Tags['exclude'][$i] = '!'.$TagAlias['AliasTag'];
break;
}
}
}
//Only keep unique entries after unifying tag standard
$Tags['include'] = array_unique($Tags['include']);
$Tags['exclude'] = array_unique($Tags['exclude']);
$TagListString = implode(", ", array_merge($Tags['include'], $Tags['exclude']));
if (!$EnableNegation && !empty($Tags['exclude'])) { if (!$EnableNegation && !empty($Tags['exclude'])) {
$Tags['include'] = array_merge($Tags['include'], $Tags['exclude']); $Tags['include'] = array_merge($Tags['include'], $Tags['exclude']);
unset($Tags['exclude']); unset($Tags['exclude']);
@ -389,7 +430,7 @@ function header_link($SortKey,$DefaultWay="desc") {
} }
} }
if (isset($_GET['haslog']) && $_GET['haslog']!=='') { if (isset($_GET['haslog']) && $_GET['haslog'] !== '') {
if ($_GET['haslog'] == 100) { if ($_GET['haslog'] == 100) {
$SphQL->where('logscore', 100); $SphQL->where('logscore', 100);
$SphQLTor->where('logscore', 100); $SphQLTor->where('logscore', 100);
@ -712,7 +753,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<tr id="tagfilter"> <tr id="tagfilter">
<td class="label">Tags (comma-separated):</td> <td class="label">Tags (comma-separated):</td>
<td colspan="3" class="ft_taglist"> <td colspan="3" class="ft_taglist">
<input type="text" size="40" id="tags" name="taglist" class="inputtext smaller" title="Use !tag to exclude tag" value="<?=str_replace('_','.',Format::form('taglist', true))?>" />&nbsp; <input type="text" size="40" id="tags" name="taglist" class="inputtext smaller" title="Use !tag to exclude tag" value="<?=str_replace('_','.',display_str($TagListString)) /* Use aliased tags, not actual query string. */ ?>" />&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_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_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td> </td>
@ -933,14 +974,14 @@ function header_link($SortKey,$DefaultWay="desc") {
} }
$SnatchedGroupClass = $GroupInfo['Flags']['IsSnatched'] ? ' snatched_group' : ''; $SnatchedGroupClass = $GroupInfo['Flags']['IsSnatched'] ? ' snatched_group' : '';
if ($GroupResults && (count($Torrents)>1 || isset($GroupedCategories[$CategoryID-1]))) { if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID - 1]))) {
// These torrents are in a group // These torrents are in a group
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>'; $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName .= " [$GroupYear]"; $DisplayName .= " [$GroupYear]";
} }
if ($GroupVanityHouse) { if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; $DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
} }
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']'; $DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
?> ?>
@ -1040,7 +1081,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<? } ?> <? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ] | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span> </span>
&raquo; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Data)?><?if($Reported){?> / <strong class="torrent_label tl_reported" title="Reported">Reported</strong><?}?></a> &raquo; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Data)?><? if ($Reported) { ?> / <strong class="torrent_label tl_reported" title="Reported">Reported</strong><? } ?></a>
</td> </td>
<td><?=$Data['FileCount']?></td> <td><?=$Data['FileCount']?></td>
<td class="nobr"><?=time_diff($Data['Time'], 1)?></td> <td class="nobr"><?=time_diff($Data['Time'], 1)?></td>

View File

@ -7,7 +7,7 @@ function compare($X, $Y) {
define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default
define('MAX_COLLAGES', 5); // How many normal collages should be shown by default define('MAX_COLLAGES', 5); // How many normal collages should be shown by default
// Bookmarks::has_bookmarked() // Bookmarks::has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT; $Text = NEW TEXT;

View File

@ -201,7 +201,7 @@ function get_reports($TorrentID){
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Text, $Username, $ReportedTimes) { function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Text, $Username, $ReportedTimes) {
function filelist($Str) { function filelist($Str) {
return "</td><td>" . Format::get_size($Str[1]) . "</td></tr>"; return '</td><td>' . Format::get_size($Str[1]) . '</td></tr>';
} }
$LastRemasterYear = '-'; $LastRemasterYear = '-';
@ -265,10 +265,10 @@ function filelist($Str) {
//There was a type but it wasn't an option! //There was a type but it wasn't an option!
$ReportType = $Types['master']['other']; $ReportType = $Types['master']['other'];
} }
$ReportInfo .= "<tr><td>" . (check_perms('admin_reports') ? "<a href='user.php?id=$ReporterID'>$ReporterName</a> <a href='reportsv2.php?view=report&amp;id=$ReportID'>reported it</a> " : "Someone reported it ") . time_diff($ReportedTime, 2, true, true) . " for the reason '" . $ReportType['title'] . "':"; $ReportInfo .= '<tr><td>' . (check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
$ReportInfo .= "<blockquote>" . $Text->full_format($ReportReason) . "</blockquote></td></tr>"; $ReportInfo .= '<blockquote>' . $Text->full_format($ReportReason) . '</blockquote></td></tr>';
} }
$ReportInfo .= "</table>"; $ReportInfo .= '</table>';
} }
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear))); $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
@ -276,12 +276,15 @@ function filelist($Str) {
$RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid=' . $TorrentID . '" class="brackets">Regenerate</a>' : ''; $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid=' . $TorrentID . '" class="brackets">Regenerate</a>' : '';
$FileTable = ' $FileTable = '
<table class="filelist_table"> <table class="filelist_table">
<tr class="colhead_dark"><td> <tr class="colhead_dark">
<div class="filelist_title" style="float: left;">File Name' . $RegenLink . '</div> <td>
<div class="filelist_title" style="float: left;">File name' . $RegenLink . '</div>
<div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div> <div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
</td><td> </td>
<td>
<strong>Size</strong> <strong>Size</strong>
</td></tr>'; </td>
</tr>';
if (substr($FileList, -3) == '}}}') { // Old style if (substr($FileList, -3) == '}}}') { // Old style
$FileListSplit = explode('|||', $FileList); $FileListSplit = explode('|||', $FileList);
foreach ($FileListSplit as $File) { foreach ($FileListSplit as $File) {
@ -393,7 +396,7 @@ function filelist($Str) {
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent"> <tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td> <td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
</tr> </tr>
<? <?
} }
$LastRemasterTitle = $RemasterTitle; $LastRemasterTitle = $RemasterTitle;
$LastRemasterYear = $RemasterYear; $LastRemasterYear = $RemasterYear;
@ -401,21 +404,19 @@ function filelist($Str) {
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber; $LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media; $LastMedia = $Media;
?> ?>
<tr class="torrent_row releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent<?= $IsSnatched ? ' snatched_torrent' : '' ?>" style="font-weight: normal;" id="torrent<?= $TorrentID ?>"> <tr class="torrent_row releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent<?= $IsSnatched ? ' snatched_torrent' : '' ?>" style="font-weight: normal;" id="torrent<?= $TorrentID ?>">
<td> <td>
<span>[ <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="Download"><?= $HasFile ? 'DL' : 'Missing' ?></a> <span>[ <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="Download"><?= $HasFile ? 'DL' : 'Missing' ?></a>
<? if (Torrents::can_use_token($Torrent)) { ?> <? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a> | <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>&amp;usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
<? } ?> <? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?= $TorrentID ?>" title="Report">RP</a> | <a href="reportsv2.php?action=report&amp;id=<?= $TorrentID ?>" title="Report">RP</a>
<? if ($CanEdit) { ?> <? if ($CanEdit) { ?>
| <a href="torrents.php?action=edit&amp;id=<?= $TorrentID ?>" title="Edit">ED</a> | <a href="torrents.php?action=edit&amp;id=<?= $TorrentID ?>" title="Edit">ED</a>
<? } ?> <? }
<? if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?> if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| <a href="torrents.php?action=delete&amp;torrentid=<?= $TorrentID ?>" title="Remove">RM</a> | <a href="torrents.php?action=delete&amp;torrentid=<?= $TorrentID ?>" title="Remove">RM</a>
<? } ?> <? } ?>
| <a href="torrents.php?torrentid=<?= $TorrentID ?>" title="Permalink">PL</a> | <a href="torrents.php?torrentid=<?= $TorrentID ?>" title="Permalink">PL</a>
]</span> ]</span>
&raquo; <a href="#" onclick="$('#torrent_<?= $TorrentID ?>').toggle(); return false;"><?= $ExtraInfo; ?></a> &raquo; <a href="#" onclick="$('#torrent_<?= $TorrentID ?>').toggle(); return false;"><?= $ExtraInfo; ?></a>
@ -425,53 +426,50 @@ function filelist($Str) {
<td><?= number_format($Seeders) ?></td> <td><?= number_format($Seeders) ?></td>
<td><?= number_format($Leechers) ?></td> <td><?= number_format($Leechers) ?></td>
</tr> </tr>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> torrentdetails pad <? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?>hidden<? } ?>" id="torrent_<?= $TorrentID; ?>"> <tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> torrentdetails pad<? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?> hidden<? } ?>" id="torrent_<?= $TorrentID; ?>">
<td colspan="5"> <td colspan="5">
<blockquote> <blockquote>
Uploaded by <?= Users::format_username($UserID, false, false, false) ?> <?= time_diff($TorrentTime); ?> Uploaded by <?= Users::format_username($UserID, false, false, false) ?> <?= time_diff($TorrentTime); ?>
<? if ($Seeders == 0) { ?> <? if ($Seeders == 0) {
<? if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?> if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
<br /><strong>Last active: <?= time_diff($LastActive); ?></strong> <br /><strong>Last active: <?= time_diff($LastActive); ?></strong>
<? } else { ?> <? } else { ?>
<br />Last active: <?= time_diff($LastActive); ?> <br />Last active: <?= time_diff($LastActive); ?>
<? } ?> <? }
<? if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?> if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?= $TorrentID ?>&amp;groupid=<?= $GroupID ?>" class="brackets">Request re-seed</a> <br /><a href="torrents.php?action=reseed&amp;torrentid=<?= $TorrentID ?>&amp;groupid=<?= $GroupID ?>" class="brackets">Request re-seed</a>
<? } ?> <? }
} ?>
<? } ?>
</blockquote> </blockquote>
<? if (check_perms('site_moderate_requests')) { ?> <? if (check_perms('site_moderate_requests')) { ?>
<div class="linkbox"> <div class="linkbox">
<a href="torrents.php?action=masspm&amp;id=<?= $GroupID ?>&amp;torrentid=<?= $TorrentID ?>" class="brackets">Mass PM snatchers</a> <a href="torrents.php?action=masspm&amp;id=<?= $GroupID ?>&amp;torrentid=<?= $TorrentID ?>" class="brackets">Mass PM snatchers</a>
</div> </div>
<? } ?> <? } ?>
<div class="linkbox"> <div class="linkbox">
<a href="#" class="brackets" onclick="show_peers('<?= $TorrentID ?>', 0);return false;">View peer list</a> <a href="#" class="brackets" onclick="show_peers('<?= $TorrentID ?>', 0);return false;">View peer list</a>
<? if (check_perms('site_view_torrent_snatchlist')) { ?> <? if (check_perms('site_view_torrent_snatchlist')) { ?>
<a href="#" class="brackets" onclick="show_downloads('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a> <a href="#" class="brackets" onclick="show_downloads('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets" onclick="show_snatches('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a> <a href="#" class="brackets" onclick="show_snatches('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<? } ?> <? } ?>
<a href="#" class="brackets" onclick="show_files('<?= $TorrentID ?>');return false;">View file list</a> <a href="#" class="brackets" onclick="show_files('<?= $TorrentID ?>');return false;">View file list</a>
<? if ($Reported) { ?> <? if ($Reported) { ?>
<a href="#" class="brackets" onclick="show_reported('<?= $TorrentID ?>');return false;">View report information</a> <a href="#" class="brackets" onclick="show_reported('<?= $TorrentID ?>');return false;">View report information</a>
<? } ?> <? } ?>
</div> </div>
<div id="peers_<?= $TorrentID ?>" class="hidden"></div> <div id="peers_<?= $TorrentID ?>" class="hidden"></div>
<div id="downloads_<?= $TorrentID ?>" class="hidden"></div> <div id="downloads_<?= $TorrentID ?>" class="hidden"></div>
<div id="snatches_<?= $TorrentID ?>" class="hidden"></div> <div id="snatches_<?= $TorrentID ?>" class="hidden"></div>
<div id="files_<?= $TorrentID ?>" class="hidden"><?= $FileTable ?></div> <div id="files_<?= $TorrentID ?>" class="hidden"><?= $FileTable ?></div>
<? if ($Reported) { ?> <? if ($Reported) { ?>
<div id="reported_<?= $TorrentID ?>" class="hidden"><?= $ReportInfo ?></div> <div id="reported_<?= $TorrentID ?>" class="hidden"><?= $ReportInfo ?></div>
<? } ?> <? }
<?
if (!empty($Description)) { if (!empty($Description)) {
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>'; echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';
} }
?> ?>
</td> </td>
</tr> </tr>
<? <?
} }
} }

View File

@ -58,7 +58,7 @@
} }
$DB->query("SELECT ID FROM torrents WHERE GroupID='$GroupID'"); $DB->query("SELECT ID FROM torrents WHERE GroupID='$GroupID'");
while(list($TorrentID) = $DB->next_record()) { while (list($TorrentID) = $DB->next_record()) {
$Cache->delete_value('torrent_download_'.$TorrentID); $Cache->delete_value('torrent_download_'.$TorrentID);
} }
Torrents::update_hash($GroupID); Torrents::update_hash($GroupID);

View File

@ -2,13 +2,19 @@
$GroupID = $_GET['groupid']; $GroupID = $_GET['groupid'];
$TorrentID = $_GET['torrentid']; $TorrentID = $_GET['torrentid'];
if(!is_number($GroupID) || !is_number($TorrentID)) { error(0); } if (!is_number($GroupID) || !is_number($TorrentID)) {
error(0);
}
$DB->query("SELECT last_action, LastReseedRequest, UserID, Time FROM torrents WHERE ID='$TorrentID'"); $DB->query("SELECT last_action, LastReseedRequest, UserID, Time FROM torrents WHERE ID='$TorrentID'");
list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime) = $DB->next_record(); list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime) = $DB->next_record();
if(time()-strtotime($LastReseedRequest)<864000) { error("There was already a re-seed request for this torrent within the past 10 days."); } if (time() - strtotime($LastReseedRequest) < 864000) {
if ($LastActive == '0000-00-00 00:00:00' || time() - strtotime($LastActive) < 345678) { error(403); } error('There was already a re-seed request for this torrent within the past 10 days.');
}
if ($LastActive == '0000-00-00 00:00:00' || time() - strtotime($LastActive) < 345678) {
error(403);
}
$DB->query("UPDATE torrents SET LastReseedRequest=NOW() WHERE ID='$TorrentID'"); $DB->query("UPDATE torrents SET LastReseedRequest=NOW() WHERE ID='$TorrentID'");
@ -27,14 +33,16 @@
$UserID = $User['uid']; $UserID = $User['uid'];
$DB->query("SELECT UserID FROM top_snatchers WHERE UserID='$UserID'"); $DB->query("SELECT UserID FROM top_snatchers WHERE UserID='$UserID'");
if($DB->record_count()>0) { continue; } if ($DB->record_count() > 0) {
continue;
}
$UserInfo = Users::user_info($UserID); $UserInfo = Users::user_info($UserID);
$Username = $UserInfo['Username']; $Username = $UserInfo['Username'];
$TimeStamp = $User['tstamp']; $TimeStamp = $User['tstamp'];
$Request = "Hi $Username, $Request = "Hi $Username,
The user [url=http://".SITE_URL."/user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=http://".SITE_URL."/torrents.php?id=$GroupID&torrentid=$TorrentID]".$Name."[/url], which you snatched on ".date('M d Y', $TimeStamp).". The torrent is now un-seeded, and we need your help to resurrect it! The user [url=https://".SSL_SITE_URL."/user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=https://".SSL_SITE_URL."/torrents.php?id=$GroupID&torrentid=$TorrentID]".$Name."[/url], which you snatched on ".date('M d Y', $TimeStamp).". The torrent is now un-seeded, and we need your help to resurrect it!
The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the .torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the .torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.
@ -49,7 +57,7 @@
$Request = "Hi $Username, $Request = "Hi $Username,
The user [url=http://".SITE_URL."/user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=http://".SITE_URL."/torrents.php?id=$GroupID&torrentid=$TorrentID]".$Name."[/url], which you uploaded on ".date('M d Y', strtotime($UploadedTime)).". The torrent is now un-seeded, and we need your help to resurrect it! The user [url=https://".SSL_SITE_URL."/user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=https://".SSL_SITE_URL."/torrents.php?id=$GroupID&torrentid=$TorrentID]".$Name."[/url], which you uploaded on ".date('M d Y', strtotime($UploadedTime)).". The torrent is now un-seeded, and we need your help to resurrect it!
The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the .torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the .torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.

View File

@ -8,19 +8,25 @@
// The "order by x" links on columns headers // The "order by x" links on columns headers
function header_link($SortKey,$DefaultWay="DESC") { function header_link($SortKey,$DefaultWay="DESC") {
global $Order,$Way; global $Order,$Way;
if($SortKey==$Order) { if ($SortKey == $Order) {
if($Way=="DESC") { $NewWay="ASC"; } if ($Way == 'DESC') {
else { $NewWay="DESC"; } $NewWay = 'ASC';
} else { $NewWay=$DefaultWay; } } else {
$NewWay = 'DESC';
}
} else {
$NewWay = $DefaultWay;
}
return "torrents.php?way=".$NewWay."&amp;order=".$SortKey."&amp;".Format::get_url(array('way','order')); return "torrents.php?way=".$NewWay."&amp;order=".$SortKey."&amp;".Format::get_url(array('way','order'));
} }
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if(!is_number($UserID)) { error(0); } if (!is_number($UserID)) {
error(0);
}
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']; $Page = $_GET['page'];
$Limit = ($Page-1)*TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE; $Limit = ($Page-1)*TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
} else { } else {
@ -28,53 +34,53 @@ function header_link($SortKey,$DefaultWay="DESC") {
$Limit = TORRENTS_PER_PAGE; $Limit = TORRENTS_PER_PAGE;
} }
if(!empty($_GET['order']) && in_array($_GET['order'], $Orders)) { if (!empty($_GET['order']) && in_array($_GET['order'], $Orders)) {
$Order = $_GET['order']; $Order = $_GET['order'];
} else { } else {
$Order = 'Time'; $Order = 'Time';
} }
if(!empty($_GET['way']) && array_key_exists($_GET['way'], $Ways)) { if (!empty($_GET['way']) && array_key_exists($_GET['way'], $Ways)) {
$Way = $_GET['way']; $Way = $_GET['way'];
} else { } else {
$Way = 'DESC'; $Way = 'DESC';
} }
$SearchWhere = array(); $SearchWhere = array();
if(!empty($_GET['format'])) { if (!empty($_GET['format'])) {
if(in_array($_GET['format'], $Formats)) { if (in_array($_GET['format'], $Formats)) {
$SearchWhere[]="t.Format='".db_string($_GET['format'])."'"; $SearchWhere[]="t.Format='".db_string($_GET['format'])."'";
} elseif($_GET['format'] == 'perfectflac') { } elseif ($_GET['format'] == 'perfectflac') {
$_GET['filter'] = 'perfectflac'; $_GET['filter'] = 'perfectflac';
} }
} }
if(!empty($_GET['bitrate']) && in_array($_GET['bitrate'], $Bitrates)) { if (!empty($_GET['bitrate']) && in_array($_GET['bitrate'], $Bitrates)) {
$SearchWhere[]="t.Encoding='".db_string($_GET['bitrate'])."'"; $SearchWhere[]="t.Encoding='".db_string($_GET['bitrate'])."'";
} }
if(!empty($_GET['media']) && in_array($_GET['media'], $Media)) { if (!empty($_GET['media']) && in_array($_GET['media'], $Media)) {
$SearchWhere[]="t.Media='".db_string($_GET['media'])."'"; $SearchWhere[]="t.Media='".db_string($_GET['media'])."'";
} }
if(!empty($_GET['releasetype']) && array_key_exists($_GET['releasetype'], $ReleaseTypes)) { if (!empty($_GET['releasetype']) && array_key_exists($_GET['releasetype'], $ReleaseTypes)) {
$SearchWhere[]="tg.ReleaseType='".db_string($_GET['releasetype'])."'"; $SearchWhere[]="tg.ReleaseType='".db_string($_GET['releasetype'])."'";
} }
if(isset($_GET['scene']) && in_array($_GET['scene'], array('1','0'))) { if (isset($_GET['scene']) && in_array($_GET['scene'], array('1','0'))) {
$SearchWhere[]="t.Scene='".db_string($_GET['scene'])."'"; $SearchWhere[]="t.Scene='".db_string($_GET['scene'])."'";
} }
if(isset($_GET['vanityhouse']) && in_array($_GET['vanityhouse'], array('1','0'))) { if (isset($_GET['vanityhouse']) && in_array($_GET['vanityhouse'], array('1','0'))) {
$SearchWhere[]="tg.VanityHouse='".db_string($_GET['vanityhouse'])."'"; $SearchWhere[]="tg.VanityHouse='".db_string($_GET['vanityhouse'])."'";
} }
if(isset($_GET['cue']) && in_array($_GET['cue'], array('1','0'))) { if (isset($_GET['cue']) && in_array($_GET['cue'], array('1','0'))) {
$SearchWhere[]="t.HasCue='".db_string($_GET['cue'])."'"; $SearchWhere[]="t.HasCue='".db_string($_GET['cue'])."'";
} }
if(isset($_GET['log']) && in_array($_GET['log'], array('1','0', '100', '-1'))) { if (isset($_GET['log']) && in_array($_GET['log'], array('1','0', '100', '-1'))) {
if($_GET['log'] == '100') { if ($_GET['log'] == '100') {
$SearchWhere[]="t.HasLog = '1'"; $SearchWhere[]="t.HasLog = '1'";
$SearchWhere[]="t.LogScore = '100'"; $SearchWhere[]="t.LogScore = '100'";
} elseif ($_GET['log'] == '-1') { } elseif ($_GET['log'] == '-1') {
@ -85,10 +91,10 @@ function header_link($SortKey,$DefaultWay="DESC") {
} }
} }
if(!empty($_GET['categories'])) { if (!empty($_GET['categories'])) {
$Cats = array(); $Cats = array();
foreach(array_keys($_GET['categories']) as $Cat) { foreach (array_keys($_GET['categories']) as $Cat) {
if(!is_number($Cat)) { if (!is_number($Cat)) {
error(0); error(0);
} }
$Cats[]="tg.CategoryID='".db_string($Cat)."'"; $Cats[]="tg.CategoryID='".db_string($Cat)."'";
@ -96,26 +102,30 @@ function header_link($SortKey,$DefaultWay="DESC") {
$SearchWhere[]='('.implode(' OR ', $Cats).')'; $SearchWhere[]='('.implode(' OR ', $Cats).')';
} }
if(!isset($_GET['tags_type'])) { if (!isset($_GET['tags_type'])) {
$_GET['tags_type'] = '1'; $_GET['tags_type'] = '1';
} }
if(!empty($_GET['tags'])) { if (!empty($_GET['tags'])) {
$Tags = explode(',',$_GET['tags']); $Tags = explode(',',$_GET['tags']);
$TagList = array(); $TagList = array();
foreach($Tags as $Tag) { foreach ($Tags as $Tag) {
$Tag = trim(str_replace('.','_',$Tag)); $Tag = trim(str_replace('.','_',$Tag));
if(empty($Tag)) { continue; } if (empty($Tag)) {
if($Tag[0] == '!') { continue;
}
if ($Tag[0] == '!') {
$Tag = ltrim(substr($Tag,1)); $Tag = ltrim(substr($Tag,1));
if(empty($Tag)) { continue; } if (empty($Tag)) {
continue;
}
$TagList[]="CONCAT(' ',tg.TagList,' ') NOT LIKE '% ".db_string($Tag)." %'"; $TagList[]="CONCAT(' ',tg.TagList,' ') NOT LIKE '% ".db_string($Tag)." %'";
} else { } else {
$TagList[]="CONCAT(' ',tg.TagList,' ') LIKE '% ".db_string($Tag)." %'"; $TagList[]="CONCAT(' ',tg.TagList,' ') LIKE '% ".db_string($Tag)." %'";
} }
} }
if(!empty($TagList)) { if (!empty($TagList)) {
if(isset($_GET['tags_type']) && $_GET['tags_type'] != 1) { if (isset($_GET['tags_type']) && $_GET['tags_type'] != 1) {
$_GET['tags_type'] = '0'; $_GET['tags_type'] = '0';
$SearchWhere[]='('.implode(' OR ', $TagList).')'; $SearchWhere[]='('.implode(' OR ', $TagList).')';
} else { } else {
@ -126,7 +136,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
} }
$SearchWhere = implode(' AND ', $SearchWhere); $SearchWhere = implode(' AND ', $SearchWhere);
if(!empty($SearchWhere)) { if (!empty($SearchWhere)) {
$SearchWhere = ' AND '.$SearchWhere; $SearchWhere = ' AND '.$SearchWhere;
} }
@ -134,16 +144,20 @@ function header_link($SortKey,$DefaultWay="DESC") {
$Perms = Permissions::get_permissions($User['PermissionID']); $Perms = Permissions::get_permissions($User['PermissionID']);
$UserClass = $Perms['Class']; $UserClass = $Perms['Class'];
switch($_GET['type']) { switch ($_GET['type']) {
case 'snatched': case 'snatched':
if(!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$Time = 'xs.tstamp'; $Time = 'xs.tstamp';
$UserField = 'xs.uid'; $UserField = 'xs.uid';
$ExtraWhere = ''; $ExtraWhere = '';
$From = "xbt_snatched AS xs JOIN torrents AS t ON t.ID=xs.fid"; $From = "xbt_snatched AS xs JOIN torrents AS t ON t.ID=xs.fid";
break; break;
case 'seeding': case 'seeding':
if(!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$Time = '(xfu.mtime - xfu.timespent)'; $Time = '(xfu.mtime - xfu.timespent)';
$UserField = 'xfu.uid'; $UserField = 'xfu.uid';
$ExtraWhere = 'AND xfu.active=1 AND xfu.Remaining=0'; $ExtraWhere = 'AND xfu.active=1 AND xfu.Remaining=0';
@ -156,21 +170,27 @@ function header_link($SortKey,$DefaultWay="DESC") {
$From = "torrents AS t"; $From = "torrents AS t";
break; break;
case 'leeching': case 'leeching':
if(!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$Time = '(xfu.mtime - xfu.timespent)'; $Time = '(xfu.mtime - xfu.timespent)';
$UserField = 'xfu.uid'; $UserField = 'xfu.uid';
$ExtraWhere = 'AND xfu.active=1 AND xfu.Remaining>0'; $ExtraWhere = 'AND xfu.active=1 AND xfu.Remaining>0';
$From = "xbt_files_users AS xfu JOIN torrents AS t ON t.ID=xfu.fid"; $From = "xbt_files_users AS xfu JOIN torrents AS t ON t.ID=xfu.fid";
break; break;
case 'uploaded': case 'uploaded':
if ((empty($_GET['filter']) || $_GET['filter'] != 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if ((empty($_GET['filter']) || $_GET['filter'] != 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$Time = 'unix_timestamp(t.Time)'; $Time = 'unix_timestamp(t.Time)';
$UserField = 't.UserID'; $UserField = 't.UserID';
$ExtraWhere = ''; $ExtraWhere = '';
$From = "torrents AS t"; $From = "torrents AS t";
break; break;
case 'downloaded': case 'downloaded':
if(!check_perms('site_view_torrent_snatchlist')) { error(403); } if (!check_perms('site_view_torrent_snatchlist')) {
error(403);
}
$Time = 'unix_timestamp(ud.Time)'; $Time = 'unix_timestamp(ud.Time)';
$UserField = 'ud.UserID'; $UserField = 'ud.UserID';
$ExtraWhere = ''; $ExtraWhere = '';
@ -180,37 +200,47 @@ function header_link($SortKey,$DefaultWay="DESC") {
error(404); error(404);
} }
if(!empty($_GET['filter'])) { if (!empty($_GET['filter'])) {
if($_GET['filter'] == "perfectflac") { if ($_GET['filter'] == 'perfectflac') {
if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$ExtraWhere .= " AND t.Format = 'FLAC'"; $ExtraWhere .= " AND t.Format = 'FLAC'";
if(empty($_GET['media'])) { if (empty($_GET['media'])) {
$ExtraWhere .= " AND ( $ExtraWhere .= " AND (
t.LogScore = 100 OR t.LogScore = 100 OR
t.Media IN ('Vinyl','WEB','DVD','Soundboard','Casette','SACD','Blu-ray','DAT') t.Media IN ('Vinyl','WEB','DVD','Soundboard','Casette','SACD','Blu-ray','DAT')
)"; )";
} elseif(strtoupper($_GET['media']) == 'CD' && empty($_GET['log'])) { } elseif (strtoupper($_GET['media']) == 'CD' && empty($_GET['log'])) {
$ExtraWhere .= " AND t.LogScore = 100"; $ExtraWhere .= " AND t.LogScore = 100";
} }
} elseif($_GET['filter'] == "uniquegroup") { } elseif ($_GET['filter'] == 'uniquegroup') {
if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) { error(403); } if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) {
$GroupBy = "tg.ID"; error(403);
}
$GroupBy = 'tg.ID';
} }
} }
if(empty($GroupBy)) { if (empty($GroupBy)) {
$GroupBy = "t.ID"; $GroupBy = 't.ID';
} }
if((empty($_GET['search']) || trim($_GET['search']) == '') && $Order!='Name') { if ((empty($_GET['search']) || trim($_GET['search']) == '') && $Order!='Name') {
$SQL = "SELECT SQL_CALC_FOUND_ROWS t.GroupID, t.ID AS TorrentID, $Time AS Time, tg.CategoryID $SQL = "
SELECT
SQL_CALC_FOUND_ROWS t.GroupID,
t.ID AS TorrentID,
$Time AS Time,
tg.CategoryID
FROM $From FROM $From
JOIN torrents_group AS tg ON tg.ID=t.GroupID JOIN torrents_group AS tg ON tg.ID=t.GroupID
WHERE $UserField='$UserID' $ExtraWhere $SearchWhere WHERE $UserField='$UserID' $ExtraWhere $SearchWhere
GROUP BY ".$GroupBy." GROUP BY ".$GroupBy."
ORDER BY $Order $Way LIMIT $Limit"; ORDER BY $Order $Way LIMIT $Limit";
} else { } else {
$DB->query("CREATE TEMPORARY TABLE temp_sections_torrents_user ( $DB->query("
CREATE TEMPORARY TABLE temp_sections_torrents_user (
GroupID int(10) unsigned not null, GroupID int(10) unsigned not null,
TorrentID int(10) unsigned not null, TorrentID int(10) unsigned not null,
Time int(12) unsigned not null, Time int(12) unsigned not null,
@ -221,7 +251,9 @@ function header_link($SortKey,$DefaultWay="DESC") {
Name mediumtext, Name mediumtext,
Size bigint(12) unsigned, Size bigint(12) unsigned,
PRIMARY KEY (TorrentID)) CHARSET=utf8"); PRIMARY KEY (TorrentID)) CHARSET=utf8");
$DB->query("INSERT IGNORE INTO temp_sections_torrents_user SELECT $DB->query("
INSERT IGNORE INTO temp_sections_torrents_user
SELECT
t.GroupID, t.GroupID,
t.ID AS TorrentID, t.ID AS TorrentID,
$Time AS Time, $Time AS Time,
@ -238,14 +270,14 @@ function header_link($SortKey,$DefaultWay="DESC") {
WHERE $UserField='$UserID' $ExtraWhere $SearchWhere WHERE $UserField='$UserID' $ExtraWhere $SearchWhere
GROUP BY TorrentID, Time"); GROUP BY TorrentID, Time");
if(!empty($_GET['search']) && trim($_GET['search']) != '') { if (!empty($_GET['search']) && trim($_GET['search']) != '') {
$Words = array_unique(explode(' ', db_string($_GET['search']))); $Words = array_unique(explode(' ', db_string($_GET['search'])));
} }
$SQL = "SELECT SQL_CALC_FOUND_ROWS $SQL = "SELECT SQL_CALC_FOUND_ROWS
GroupID, TorrentID, Time, CategoryID GroupID, TorrentID, Time, CategoryID
FROM temp_sections_torrents_user"; FROM temp_sections_torrents_user";
if(!empty($Words)) { if (!empty($Words)) {
$SQL .= " $SQL .= "
WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'"; WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'";
} }
@ -291,27 +323,27 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="nobr" colspan="3"> <td class="nobr" colspan="3">
<select id="bitrate" name="bitrate" class="ft_bitrate"> <select id="bitrate" name="bitrate" class="ft_bitrate">
<option value="">Bitrate</option> <option value="">Bitrate</option>
<? foreach($Bitrates as $BitrateName) { ?> <? foreach ($Bitrates as $BitrateName) { ?>
<option value="<?=display_str($BitrateName); ?>" <?Format::selected('bitrate', $BitrateName)?>><?=display_str($BitrateName); ?></option> <option value="<?=display_str($BitrateName); ?>"<?Format::selected('bitrate', $BitrateName)?>><?=display_str($BitrateName); ?></option>
<? } ?> </select> <? } ?> </select>
<select name="format" class="ft_format"> <select name="format" class="ft_format">
<option value="">Format</option> <option value="">Format</option>
<? foreach($Formats as $FormatName) { ?> <? foreach ($Formats as $FormatName) { ?>
<option value="<?=display_str($FormatName); ?>" <?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option> <option value="<?=display_str($FormatName); ?>"<?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option>
<? } ?> <? } ?>
<option value="perfectflac" <?Format::selected('filter', 'perfectflac')?>>Perfect FLACs</option> <option value="perfectflac"<?Format::selected('filter', 'perfectflac')?>>Perfect FLACs</option>
</select> </select>
<select name="media" class="ft_media"> <select name="media" class="ft_media">
<option value="">Media</option> <option value="">Media</option>
<? foreach($Media as $MediaName) { ?> <? foreach ($Media as $MediaName) { ?>
<option value="<?=display_str($MediaName); ?>" <?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option> <option value="<?=display_str($MediaName); ?>"<?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option>
<? } ?> <? } ?>
</select> </select>
<select name="releasetype" class="ft_releasetype"> <select name="releasetype" class="ft_releasetype">
<option value="">Release type</option> <option value="">Release type</option>
<? foreach($ReleaseTypes as $ID=>$Type) { ?> <? foreach ($ReleaseTypes as $ID=>$Type) { ?>
<option value="<?=display_str($ID); ?>" <?Format::selected('releasetype',$ID)?>><?=display_str($Type); ?></option> <option value="<?=display_str($ID); ?>"<?Format::selected('releasetype',$ID)?>><?=display_str($Type); ?></option>
<? } ?> <? } ?>
</select> </select>
</td> </td>
@ -320,26 +352,26 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="label"><strong>Misc:</strong></td> <td class="label"><strong>Misc:</strong></td>
<td class="nobr" colspan="3"> <td class="nobr" colspan="3">
<select name="log" class="ft_haslog"> <select name="log" class="ft_haslog">
<option value="">Has Log</option> <option value="">Has log</option>
<option value="1" <?Format::selected('log','1')?>>Yes</option> <option value="1"<?Format::selected('log','1')?>>Yes</option>
<option value="0" <?Format::selected('log','0')?>>No</option> <option value="0"<?Format::selected('log','0')?>>No</option>
<option value="100" <?Format::selected('log','100')?>>100% only</option> <option value="100"<?Format::selected('log','100')?>>100% only</option>
<option value="-1" <?Format::selected('log','-1')?>>&lt;100%/Unscored</option> <option value="-1"<?Format::selected('log','-1')?>>&lt;100%/unscored</option>
</select> </select>
<select name="cue" class="ft_hascue"> <select name="cue" class="ft_hascue">
<option value="">Has Cue</option> <option value="">Has cue</option>
<option value="1" <?Format::selected('cue',1)?>>Yes</option> <option value="1"<?Format::selected('cue',1)?>>Yes</option>
<option value="0" <?Format::selected('cue',0)?>>No</option> <option value="0"<?Format::selected('cue',0)?>>No</option>
</select> </select>
<select name="scene" class="ft_scene"> <select name="scene" class="ft_scene">
<option value="">Scene</option> <option value="">Scene</option>
<option value="1" <?Format::selected('scene',1)?>>Yes</option> <option value="1"<?Format::selected('scene',1)?>>Yes</option>
<option value="0" <?Format::selected('scene',0)?>>No</option> <option value="0"<?Format::selected('scene',0)?>>No</option>
</select> </select>
<select name="vanityhouse" class="ft_vanityhouse"> <select name="vanityhouse" class="ft_vanityhouse">
<option value="">Vanity House</option> <option value="">Vanity House</option>
<option value="1" <?Format::selected('vanityhouse',1)?>>Yes</option> <option value="1"<?Format::selected('vanityhouse',1)?>>Yes</option>
<option value="0" <?Format::selected('vanityhouse',0)?>>No</option> <option value="0"<?Format::selected('vanityhouse',0)?>>No</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -347,8 +379,8 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="label"><strong>Tags:</strong></td> <td class="label"><strong>Tags:</strong></td>
<td> <td>
<input type="text" name="tags" size="60" title="Use !tag to exclude tag" value="<?Format::form('tags')?>" />&nbsp; <input type="text" name="tags" size="60" title="Use !tag to exclude tag" value="<?Format::form('tags')?>" />&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_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_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td> </td>
</tr> </tr>
@ -356,14 +388,14 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="label"><strong>Order by</strong></td> <td class="label"><strong>Order by</strong></td>
<td> <td>
<select name="order" class="ft_order_by"> <select name="order" class="ft_order_by">
<? foreach($Orders as $OrderText) { ?> <? foreach ($Orders as $OrderText) { ?>
<option value="<?=$OrderText?>" <?Format::selected('order', $OrderText)?>><?=$OrderText?></option> <option value="<?=$OrderText?>"<?Format::selected('order', $OrderText)?>><?=$OrderText?></option>
<? }?> <? } ?>
</select>&nbsp; </select>&nbsp;
<select name="way" class="ft_order_way"> <select name="way" class="ft_order_way">
<? foreach($Ways as $WayKey=>$WayText) { ?> <? foreach ($Ways as $WayKey=>$WayText) { ?>
<option value="<?=$WayKey?>" <?Format::selected('way', $WayKey)?>><?=$WayText?></option> <option value="<?=$WayKey?>"<?Format::selected('way', $WayKey)?>><?=$WayText?></option>
<? }?> <? } ?>
</select> </select>
</td> </td>
</tr> </tr>
@ -371,11 +403,11 @@ function header_link($SortKey,$DefaultWay="DESC") {
<table class="layout cat_list"> <table class="layout cat_list">
<? <?
$x=0; $x = 0;
reset($Categories); reset($Categories);
foreach($Categories as $CatKey => $CatName) { foreach ($Categories as $CatKey => $CatName) {
if($x%7==0) { if ($x % 7 == 0) {
if($x > 0) { if ($x > 0) {
?> ?>
</tr> </tr>
<? } ?> <? } ?>
@ -385,8 +417,8 @@ function header_link($SortKey,$DefaultWay="DESC") {
$x++; $x++;
?> ?>
<td> <td>
<input type="checkbox" name="categories[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1"<? if(isset($_GET['categories'][$CatKey+1])) { ?> checked="checked"<? } ?> /> <input type="checkbox" name="categories[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1"<? if (isset($_GET['categories'][$CatKey + 1])) { ?> checked="checked"<? } ?> />
<label for="cat_<?=($CatKey+1)?>"><?=$CatName?></label> <label for="cat_<?=($CatKey + 1)?>"><?=$CatName?></label>
</td> </td>
<? <?
} }
@ -398,7 +430,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
</div> </div>
</form> </form>
</div> </div>
<? if(count($GroupIDs) == 0) { ?> <? if (count($GroupIDs) == 0) { ?>
<div class="center"> <div class="center">
Nothing found! Nothing found!
</div> </div>
@ -422,7 +454,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
</tr> </tr>
<? <?
$Results = $Results['matches']; $Results = $Results['matches'];
foreach($TorrentsInfo as $TorrentID => $Info) { foreach ($TorrentsInfo as $TorrentID => $Info) {
list($GroupID, , $Time) = array_values($Info); list($GroupID, , $Time) = array_values($Info);
extract(Torrents::array_group($Results[$GroupID])); extract(Torrents::array_group($Results[$GroupID]));
@ -435,17 +467,21 @@ function header_link($SortKey,$DefaultWay="DESC") {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists); $DisplayName = Artists::display_artists($ExtendedArtists);
} elseif(!empty($Artists)) { } elseif (!empty($Artists)) {
$DisplayName = Artists::display_artists(array(1=>$Artists)); $DisplayName = Artists::display_artists(array(1=>$Artists));
} else { } else {
$DisplayName=''; $DisplayName = '';
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if ($GroupYear > 0) {
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; } $DisplayName.=" [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$ExtraInfo = Torrents::torrent_info($Torrent); $ExtraInfo = Torrents::torrent_info($Torrent);
if($ExtraInfo) { if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;
} }
?> ?>
@ -471,7 +507,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="nobr"><?=time_diff($Time,1)?></td> <td class="nobr"><?=time_diff($Time,1)?></td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td> <td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : ''?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td> <td><?=number_format($Torrent['Leechers'])?></td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -156,7 +156,7 @@ function checked($Checked) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label"><strong>Sort/Hide release types</strong></td> <td class="label"><strong>Sort/hide release types</strong></td>
<td> <td>
<noscript>Please enable JavaScript to use these options.</noscript> <noscript>Please enable JavaScript to use these options.</noscript>
<a href="#" id="toggle_sortable" class="brackets">Expand</a> <a href="#" id="toggle_sortable" class="brackets">Expand</a>

View File

@ -26,7 +26,7 @@
$Email = $_POST['email']; $Email = $_POST['email'];
$Username = $LoggedUser['Username']; $Username = $LoggedUser['Username'];
$SiteName = SITE_NAME; $SiteName = SITE_NAME;
$SiteURL = NONSSL_SITE_URL; $SiteURL = SSL_SITE_URL;
$InviteExpires = time_plus(60*60*24*3); // 3 days $InviteExpires = time_plus(60*60*24*3); // 3 days
//MultiInvite //MultiInvite
@ -61,7 +61,7 @@
To confirm your invite, click on the following link: To confirm your invite, click on the following link:
http://$SiteURL/register.php?invite=$InviteKey https://$SiteURL/register.php?invite=$InviteKey
After you register, you will be able to use your account. Please take note that if you do not use this invite in the next 3 days, it will expire. We urge you to read the RULES and the wiki immediately after you join. After you register, you will be able to use your account. Please take note that if you do not use this invite in the next 3 days, it will expire. We urge you to read the RULES and the wiki immediately after you join.

View File

@ -12,12 +12,14 @@
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT ui.JoinDate, p.Level AS Class FROM users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = $UserID"); $DB->query("SELECT ui.JoinDate, p.Level AS Class FROM users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = $UserID");
list($Joined, $Class) = $DB->next_record(); list($Joined, $Class) = $DB->next_record();
if(!check_perms('users_view_email', $Class)) { if (!check_perms('users_view_email', $Class)) {
error(403); error(403);
} }
@ -84,7 +86,7 @@
?> ?>
</tr> </tr>
<? <?
foreach($History as $Key => $Values){ foreach ($History as $Key => $Values){
if (isset($History[$Key+1])) { if (isset($History[$Key+1])) {
$Values['Time'] = $History[$Key+1]['Time']; $Values['Time'] = $History[$Key+1]['Time'];
} else { } else {
@ -104,7 +106,7 @@
<td /> <td />
<td><?=time_diff($Time)?></td> <td><?=time_diff($Time)?></td>
<td><?=display_str($IP)?></td> <td><?=display_str($IP)?></td>
<? $UserURL = "http://".NONSSL_SITE_URL."/user.php?id=$UserID2"; <? $UserURL = "https://".SSL_SITE_URL."/user.php?id=$UserID2";
$DB->query("SELECT Enabled FROM users_main WHERE ID = ".$UserID2); $DB->query("SELECT Enabled FROM users_main WHERE ID = ".$UserID2);
list($Enabled)=$DB->next_record(); list($Enabled)=$DB->next_record();
$DB->set_query_id($ueQuery); $DB->set_query_id($ueQuery);

View File

@ -3,9 +3,9 @@
var LIMIT = 10; var LIMIT = 10;
var artistId, artistName; var artistId, artistName;
var artistTags; var artistTags;
$(document).ready(function() { $(document).ready(function() {
initArtistCloud(); initArtistCloud();
}); });
function initArtistCloud() { function initArtistCloud() {
$("#currentArtist").text(); $("#currentArtist").text();
@ -22,7 +22,7 @@ function loadArtists() {
var first = true; var first = true;
var ratio; var ratio;
$.each(data, function(key, val) { $.each(data, function(key, val) {
if(first) { if (first) {
ratio = val['score'] / 300; ratio = val['score'] / 300;
first = false; first = false;
} }
@ -39,18 +39,16 @@ function loadArtists() {
function addArtist(id, name, score) { function addArtist(id, name, score) {
var item = $('<li><a style="color:#007DC6;" data-weight="' + score + '">' + name + '</a></li>'); var item = $('<li><a style="color:#007DC6;" data-weight="' + score + '">' + name + '</a></li>');
$(item).click(function(e) { $(item).click(function(e) {
e.preventDefault(); e.preventDefault();
reinit(id, name); reinit(id, name);
}); });
artistTags.append(item); artistTags.append(item);
} }
function addArtistMain(name) { function addArtistMain(name) {
var item = $('<li><a style="color:#007DC6;" data-weight="350">' + name + '</a></li>'); var item = $('<li><a style="color: #007DC6;" data-weight="350">' + name + '</a></li>');
$("#currentArtist").attr('href', 'artist.php?id=' + artistId); $("#currentArtist").attr('href', 'artist.php?id=' + artistId);
$("#currentArtist").text(artistName); $("#currentArtist").text(artistName);
@ -73,38 +71,34 @@ function reinit(id, name) {
} }
function createCloud() { function createCloud() {
if(!$('#similarArtistsCanvas').tagcanvas({ if (!$('#similarArtistsCanvas').tagcanvas({
// textFont: 'Impact,"Arial Black",sans-serif', // textFont: 'Impact,"Arial Black",sans-serif',
wheelZoom: false, wheelZoom: false,
freezeActive: true, freezeActive: true,
weightSize:0.15, weightSize: 0.15,
interval:20, interval: 20,
textFont: null, textFont: null,
textColour: null, textColour: null,
textHeight: 25, textHeight: 25,
outlineColour:'#f96', outlineColour: '#f96',
outlineThickness:4, outlineThickness: 4,
maxSpeed:0.04, maxSpeed: 0.04,
minBrightness:0.1, minBrightness: 0.1,
depth:0.92, depth: 0.92,
pulsateTo:0.2, pulsateTo: 0.2,
pulsateTime:0.75, pulsateTime: 0.75,
initial:[0.1,-0.1], initial: [0.1,-0.1],
decel:0.98, decel: 0.98,
reverse:true, reverse: true,
shadow:'#ccf', shadow: '#ccf',
shadowBlur:3, shadowBlur: 3,
weight : true, weight : true,
weightFrom:'data-weight' weightFrom: 'data-weight'
},'artistTags')) { },'artistTags')) {
// something went wrong, hide the canvas container // something went wrong, hide the canvas container
$('#flip_view_2').hide(); $('#flip_view_2').hide();
} }
} }
} ) ( jQuery ); } ) ( jQuery );

View File

@ -24,56 +24,47 @@ var isMobile = {
} }
}; };
if(isMobile.Android()) { if (isMobile.Android()) {
if(!hasCookie(ANDROID_COOKIE_NAME)) { if (!hasCookie(ANDROID_COOKIE_NAME)) {
setCookie(ANDROID_COOKIE_NAME, true, 365); setCookie(ANDROID_COOKIE_NAME, true, 365);
var result=confirm("An Android App is available for What.CD, would you like to download it?"); var result = confirm("An Android App is available for What.CD, would you like to download it?");
if (result==true) { if (result == true) {
window.location = ANDROID_APP_URL; window.location = ANDROID_APP_URL;
} }
} }
} } else if (isMobile.NotAndroid()) {
if (!hasCookie(OTHER_COOKIE_NAME)) {
else if(isMobile.NotAndroid()) {
if(!hasCookie(OTHER_COOKIE_NAME)) {
setCookie(OTHER_COOKIE_NAME, true, 365); setCookie(OTHER_COOKIE_NAME, true, 365);
var result=confirm("A mobile version of What.CD is available, would you like to use it?"); var result = confirm("A mobile version of What.CD is available, would you like to use it?");
if (result==true) { if (result == true) {
window.location = MOBILE_SITE_URL; window.location = MOBILE_SITE_URL;
} }
} }
} }
function setCookie(c_name,value,exdays) function setCookie(c_name,value,exdays) {
{ var exdate = new Date();
var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays);
exdate.setDate(exdate.getDate() + exdays); var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie = c_name + "=" + c_value;
document.cookie=c_name + "=" + c_value;
} }
function getCookie(c_name) function getCookie(c_name) {
{ var i,x,y,ARRcookies=document.cookie.split(";");
var i,x,y,ARRcookies=document.cookie.split(";"); for (i = 0; i < ARRcookies.length; i++) {
for (i=0;i<ARRcookies.length;i++) x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
{ y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); x = x.replace(/^\s+|\s+$/g,"");
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); if (x == c_name) {
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y); return unescape(y);
} }
} }
} }
function hasCookie(c_name) {
function hasCookie(c_name) var checked=getCookie(c_name);
{ if (checked != null) {
var checked=getCookie(c_name);
if (checked != null)
{
return true; return true;
} }
return false; return false;

View File

@ -1,7 +1,11 @@
function toggleChecks(formElem,masterElem) { function toggleChecks(formElem,masterElem) {
if (masterElem.checked) { checked=true; } else { checked=false; } if (masterElem.checked) {
for(s=0; s<$('#'+formElem).raw().elements.length; s++) { checked = true;
if ($('#'+formElem).raw().elements[s].type=="checkbox") { } else {
checked = false;
}
for (s = 0; s < $('#'+formElem).raw().elements.length; s++) {
if ($('#'+formElem).raw().elements[s].type == "checkbox") {
$('#'+formElem).raw().elements[s].checked=checked; $('#'+formElem).raw().elements[s].checked=checked;
} }
} }
@ -10,15 +14,15 @@ function toggleChecks(formElem,masterElem) {
//Lightbox stuff //Lightbox stuff
/* /*
* If loading from a thumbnail the lightbox is shown first with a "loading" screen * If loading from a thumbnail, the lightbox is shown first with a "loading" screen
* while the full size image loads, then the html of the lightbox is replaced with the image. * while the full size image loads, then the HTML of the lightbox is replaced with the image.
*/ */
var lightbox = { var lightbox = {
init: function (image, size) { init: function (image, size) {
if(typeof(image)=='string') { if (typeof(image) == 'string') {
$('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML = $('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML =
'<p size="7" style="color:gray;font-size:50px">Loading...<p>'; '<p size="7" style="color: gray; font-size: 50px;">Loading...<p>';
$('#curtain').show().listen('click',lightbox.unbox); $('#curtain').show().listen('click',lightbox.unbox);
var src = image; var src = image;
image = new Image(); image = new Image();
@ -40,20 +44,20 @@ var lightbox = {
}, },
box: function (image) { box: function (image) {
var hasA = false; var hasA = false;
if(image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') { if (image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') {
hasA = true; hasA = true;
} }
if(!hasA) { if (!hasA) {
$('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML = '<img src="' + image.src + '" />'; $('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML = '<img src="' + image.src + '" />';
$('#curtain').show().listen('click',lightbox.unbox); $('#curtain').show().listen('click',lightbox.unbox);
} }
}, },
box_async: function (image) { box_async: function (image) {
var hasA = false; var hasA = false;
if(image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') { if (image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') {
hasA = true; hasA = true;
} }
if(!hasA) { if (!hasA) {
$('#lightbox').raw().innerHTML = '<img src="' + image.src + '" />'; $('#lightbox').raw().innerHTML = '<img src="' + image.src + '" />';
} }
}, },
@ -106,9 +110,9 @@ function add_selection() {
var listitem = document.createElement("li"); var listitem = document.createElement("li");
listitem.id = 'list' + selected.value; listitem.id = 'list' + selected.value;
listitem.innerHTML = ' <input type="hidden" name="list[]" value="'+selected.value+'" /> ' + listitem.innerHTML = ' <input type="hidden" name="list[]" value="'+selected.value+'" /> ' +
' <span style="float:left;">'+selected.innerHTML+'</span>' + ' <span style="float: left;">'+selected.innerHTML+'</span>' +
' <a href="#" onclick="remove_selection(\''+selected.value+'\');return false;" style="float:right;" class="brackets">X</a>' + ' <a href="#" onclick="remove_selection(\''+selected.value+'\');return false;" style="float: right;" class="brackets">X</a>' +
' <br style="clear:all;" />'; ' <br style="clear: all;" />';
$('#list').raw().appendChild(listitem); $('#list').raw().appendChild(listitem);
$('#opt' + selected.value).raw().disabled = true; $('#opt' + selected.value).raw().disabled = true;
} }

View File

@ -1,9 +1,9 @@
function ChangeCategory(catid) { function ChangeCategory(catid) {
if(catid == 1) { if (catid == 1) {
$('#split_releasetype').show(); $('#split_releasetype').show();
$('#split_artist').show(); $('#split_artist').show();
$('#split_year').show(); $('#split_year').show();
} else if(catid == 4 || catid == 6) { } else if (catid == 4 || catid == 6) {
$('#split_releasetype').hide(); $('#split_releasetype').hide();
$('#split_year').show(); $('#split_year').show();
$('#split_artist').hide(); $('#split_artist').hide();
@ -16,15 +16,15 @@ function ChangeCategory(catid) {
function ArtistManager() { function ArtistManager() {
var GroupID = window.location.search.match(/[?&]id=(\d+)/); var GroupID = window.location.search.match(/[?&]id=(\d+)/);
if(typeof GroupID == 'undefined') { if (typeof GroupID == 'undefined') {
return; return;
} else { } else {
GroupID = GroupID[1]; GroupID = GroupID[1];
} }
var ArtistList; var ArtistList;
if(!(ArtistList = $('#artist_list').raw())) { if (!(ArtistList = $('#artist_list').raw())) {
return false; return false;
} else if($('#artistmanager').raw()) { } else if ($('#artistmanager').raw()) {
$('#artistmanager').toggle(); $('#artistmanager').toggle();
$('#artist_list').toggle(); $('#artist_list').toggle();
} else { } else {
@ -58,7 +58,7 @@ function ArtistManager() {
importance = 7; importance = 7;
break; break;
} }
if(elArtistList.children[i].children[0].tagName.toUpperCase() == 'A') { if (elArtistList.children[i].children[0].tagName.toUpperCase() == 'A') {
var ArtistID = elArtistList.children[i].children[0].href.match(/[?&]id=(\d+)/)[1]; var ArtistID = elArtistList.children[i].children[0].href.match(/[?&]id=(\d+)/)[1];
var elBox = document.createElement('input'); var elBox = document.createElement('input');
elBox.type = 'checkbox'; elBox.type = 'checkbox';
@ -67,7 +67,7 @@ function ArtistManager() {
elBox.value = importance+';'+ArtistID; elBox.value = importance+';'+ArtistID;
elBox.onclick = function(e) { SelectArtist(e,this); }; elBox.onclick = function(e) { SelectArtist(e,this); };
elArtistList.children[i].insertBefore(elBox, elArtistList.children[i].children[0]); elArtistList.children[i].insertBefore(elBox, elArtistList.children[i].children[0]);
if(importance == 1 || importance == 4 || importance == 6) { if (importance == 1 || importance == 4 || importance == 6) {
MainArtistCount++; MainArtistCount++;
} }
} }
@ -161,11 +161,11 @@ function ArtistManager() {
} }
function SelectArtist(e,obj) { function SelectArtist(e,obj) {
if(window.event) { if (window.event) {
e = window.event; e = window.event;
} }
EndBox = Number(obj.id.substr(17)); EndBox = Number(obj.id.substr(17));
if(!e.shiftKey || typeof StartBox == 'undefined') { if (!e.shiftKey || typeof StartBox == 'undefined') {
StartBox = Number(obj.id.substr(17)); StartBox = Number(obj.id.substr(17));
} }
Dir = (EndBox > StartBox ? 1 : -1); Dir = (EndBox > StartBox ? 1 : -1);
@ -181,19 +181,19 @@ function ArtistManagerSubmit() {
var Selection = new Array(); var Selection = new Array();
var MainSelectionCount = 0; var MainSelectionCount = 0;
for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) { for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) {
if(boxes.raw(i).checked) { if (boxes.raw(i).checked) {
Selection.push(boxes.raw(i).value); Selection.push(boxes.raw(i).value);
if(boxes.raw(i).value.substr(0,1) == '1') { if (boxes.raw(i).value.substr(0,1) == '1') {
MainSelectionCount++; MainSelectionCount++;
} }
} }
} }
if(Selection.length == 0 || ($('#manager_action').raw().value == 'delete' && !confirm('Are you sure you want to delete '+Selection.length+' artists from this group?'))) { if (Selection.length == 0 || ($('#manager_action').raw().value == 'delete' && !confirm('Are you sure you want to delete '+Selection.length+' artists from this group?'))) {
return; return;
} }
$('#artists_selection').raw().value = Selection.join(','); $('#artists_selection').raw().value = Selection.join(',');
if((($('#artists_importance').raw().value != 1 && $('#artists_importance').raw().value != 4 && $('#artists_importance').raw().value != 6) || $('#manager_action').raw().value == 'delete') && MainSelectionCount == MainArtistCount) { if ((($('#artists_importance').raw().value != 1 && $('#artists_importance').raw().value != 4 && $('#artists_importance').raw().value != 6) || $('#manager_action').raw().value == 'delete') && MainSelectionCount == MainArtistCount) {
if(!$('.error_message').raw()) { if (!$('.error_message').raw()) {
error_message('All groups need to have at least one main artist, composer, or DJ.'); error_message('All groups need to have at least one main artist, composer, or DJ.');
} }
$('.error_message').raw().scrollIntoView(); $('.error_message').raw().scrollIntoView();
@ -209,16 +209,16 @@ function ArtistManagerDelete() {
} }
function Vote(amount, requestid) { function Vote(amount, requestid) {
if(typeof amount == 'undefined') { if (typeof amount == 'undefined') {
amount = parseInt($('#amount').raw().value); amount = parseInt($('#amount').raw().value);
} }
if(amount == 0) { if (amount == 0) {
amount = 20 * 1024 * 1024; amount = 20 * 1024 * 1024;
} }
var index; var index;
var votecount; var votecount;
if(!requestid) { if (!requestid) {
requestid = $('#requestid').raw().value; requestid = $('#requestid').raw().value;
votecount = $('#votecount').raw(); votecount = $('#votecount').raw();
index = false; index = false;
@ -229,7 +229,7 @@ function Vote(amount, requestid) {
} }
ajax.get('requests.php?action=takevote&id=' + requestid + '&auth=' + authkey + '&amount=' + amount, function (response) { ajax.get('requests.php?action=takevote&id=' + requestid + '&auth=' + authkey + '&amount=' + amount, function (response) {
if(response == 'bankrupt') { if (response == 'bankrupt') {
error_message("You do not have sufficient upload credit to add " + get_size(amount) + " to this request"); error_message("You do not have sufficient upload credit to add " + get_size(amount) + " to this request");
return; return;
} else if (response == 'dupesuccess') { } else if (response == 'dupesuccess') {
@ -238,7 +238,7 @@ function Vote(amount, requestid) {
votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1; votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
} }
if($('#total_bounty').results() > 0) { if ($('#total_bounty').results() > 0) {
totalBounty = parseInt($('#total_bounty').raw().value); totalBounty = parseInt($('#total_bounty').raw().value);
totalBounty += (amount * (1 - $('#request_tax').raw().value)); totalBounty += (amount * (1 - $('#request_tax').raw().value));
$('#total_bounty').raw().value = totalBounty; $('#total_bounty').raw().value = totalBounty;