Empty commit

This commit is contained in:
Git 2013-06-18 08:00:48 +00:00
parent b139eca03b
commit b1db2e6185
38 changed files with 214 additions and 181 deletions

View File

@ -14,7 +14,7 @@
$LoginCookie = $Enc->decrypt($_COOKIE['session']); $LoginCookie = $Enc->decrypt($_COOKIE['session']);
} }
if (isset($LoginCookie)) { if (isset($LoginCookie)) {
list($SessionID, $UserID) = explode("|~|",$Enc->decrypt($LoginCookie)); list($SessionID, $UserID) = explode("|~|", $Enc->decrypt($LoginCookie));
if (!$UserID || !$SessionID) { if (!$UserID || !$SessionID) {
die('Not logged in!'); die('Not logged in!');
@ -49,8 +49,8 @@ function is_number($Str) {
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","&",$Str); $Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m", '&', $Str);
$Replace = array( $Replace = array(
"'",'"',"<",">", "'",'"',"<",">",
@ -62,7 +62,7 @@ function display_str($Str) {
'&#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;
} }

View File

@ -49,7 +49,7 @@ public static function get_artists($GroupIDs) {
ORDER BY ta.GroupID ASC, ORDER BY ta.GroupID ASC,
ta.Importance ASC, ta.Importance ASC,
aa.Name ASC;"); aa.Name ASC;");
while (list($GroupID,$ArtistID,$ArtistName,$ArtistImportance,$AliasID) = $DB->next_record(MYSQLI_BOTH, false)) { while (list($GroupID, $ArtistID, $ArtistName, $ArtistImportance, $AliasID) = $DB->next_record(MYSQLI_BOTH, false)) {
$Results[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID); $Results[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
$New[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID); $New[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
} }

View File

@ -72,7 +72,7 @@ function set_up() {
continue; continue;
} }
$this->Artists[$ArtistID] = new ARTIST($ArtistID, $Name); $this->Artists[$ArtistID] = new ARTIST($ArtistID, $Name);
$this->Similar[$ArtistID] = array('ID'=>$ArtistID,'Score'=>$Score); $this->Similar[$ArtistID] = array('ID' => $ArtistID, 'Score' => $Score);
$this->TotalScore += $Score; $this->TotalScore += $Score;
$ArtistIDs[] = $ArtistID; $ArtistIDs[] = $ArtistID;
} }
@ -86,8 +86,8 @@ function set_up() {
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
JOIN artists_group AS a ON a.ArtistID=s2.ArtistID JOIN artists_group AS a ON a.ArtistID=s2.ArtistID
WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).') WHERE s1.ArtistID IN(".implode(',', $ArtistIDs).')
AND s2.ArtistID IN('.implode(',',$ArtistIDs).')'); AND s2.ArtistID IN('.implode(',', $ArtistIDs).')');
// Build into array // Build into array
while (list($Artist1ID, $Artist2ID) = $DB->next_record()) { while (list($Artist1ID, $Artist2ID) = $DB->next_record()) {

View File

@ -30,7 +30,7 @@ public function lines($Thickness, $Solid = 1, $Blank = 0) {
} }
public function title($Title, $Color = '', $Size = '') { public function title($Title, $Color = '', $Size = '') {
$this->URL .= '&amp;chtt='.str_replace(array(' ',"\n"), array('+','|'), $Title); $this->URL .= '&amp;chtt='.str_replace(array(' ', "\n"), array('+', '|'), $Title);
if (!empty($Color)) { if (!empty($Color)) {
$this->URL .= '&amp;chts='.$Color; $this->URL .= '&amp;chts='.$Color;
} }

View File

@ -51,4 +51,32 @@ public static function decrease_subscriptions($CollageID) {
WHERE ID = '$CollageID'"); WHERE ID = '$CollageID'");
} }
public static function create_personal_collage() {
global $DB, $LoggedUser;
$DB->query("
SELECT
COUNT(ID)
FROM collages
WHERE UserID = '$LoggedUser[ID]'
AND CategoryID = '0'
AND Deleted = '0'");
list($CollageCount) = $DB->next_record();
if ($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
list($CollageID) = $DB->next_record();
header('Location: collage.php?id='.$CollageID);
die();
}
$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=https:\/\/".SSL_SITE_URL."\/user.php?id=$LoggedUser[ID]]profile[\/url].', '0', $LoggedUser[ID])");
$CollageID = $DB->inserted_id();
header('Location: collage.php?id='.$CollageID);
die();
}
} }

View File

@ -12,7 +12,7 @@
/* /*
interface COOKIE_INTERFACE { interface COOKIE_INTERFACE {
public function get($Key); public function get($Key);
public function set($Key,$Value,$Seconds,$LimitAccess); public function set($Key, $Value, $Seconds, $LimitAccess);
public function del($Key); public function del($Key);
public function flush(); public function flush();
@ -31,12 +31,12 @@ public function get($Key) {
} }
//Pass the 4th optional param as false to allow JS access to the cookie //Pass the 4th optional param as false to allow JS access to the cookie
public function set($Key,$Value,$Seconds = 86400,$LimitAccess = SELF::LIMIT_ACCESS) { public function set($Key, $Value, $Seconds = 86400, $LimitAccess = SELF::LIMIT_ACCESS) {
setcookie(SELF::PREFIX.$Key,$Value,time()+$Seconds,'/',SITE_URL,$_SERVER['SERVER_PORT'] === '443',$LimitAccess,false); setcookie(SELF::PREFIX.$Key, $Value, time() + $Seconds, '/', SITE_URL, $_SERVER['SERVER_PORT'] === '443', $LimitAccess, false);
} }
public function del($Key) { public function del($Key) {
setcookie(SELF::PREFIX.$Key,'',time()-24*3600); //3600 vs 1 second to account for potential clock desyncs setcookie(SELF::PREFIX.$Key, '', time() - 24 * 3600); //3600 vs 1 second to account for potential clock desyncs
} }
public function flush() { public function flush() {

View File

@ -12,20 +12,20 @@
} }
class CRYPT { class CRYPT {
public function encrypt($Str,$Key=ENCKEY) { public function encrypt($Str, $Key = ENCKEY) {
srand(); srand();
$Str=str_pad($Str, 32-strlen($Str)); $Str = str_pad($Str, 32 - strlen($Str));
$IVSize=mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $IVSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$IV=mcrypt_create_iv($IVSize, MCRYPT_RAND); $IV = mcrypt_create_iv($IVSize, MCRYPT_RAND);
$CryptStr=mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV); $CryptStr = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $Key, $Str, MCRYPT_MODE_CBC, $IV);
return base64_encode($IV.$CryptStr); return base64_encode($IV.$CryptStr);
} }
public function decrypt($CryptStr,$Key=ENCKEY) { public function decrypt($CryptStr, $Key = ENCKEY) {
if ($CryptStr!='') { if ($CryptStr != '') {
$IV=substr(base64_decode($CryptStr),0,16); $IV = substr(base64_decode($CryptStr), 0, 16);
$CryptStr=substr(base64_decode($CryptStr),16); $CryptStr = substr(base64_decode($CryptStr), 16);
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC,$IV)); return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $Key, $CryptStr, MCRYPT_MODE_CBC, $IV));
} else { } else {
return ''; return '';
} }

View File

@ -352,7 +352,7 @@ public static function human_format($Number) {
* @return Number of bytes it represents, e.g. (123.45 * 1024) * @return Number of bytes it represents, e.g. (123.45 * 1024)
*/ */
public static function get_bytes($Size) { public static function get_bytes($Size) {
list($Value,$Unit) = sscanf($Size, "%f%s"); list($Value, $Unit) = sscanf($Size, "%f%s");
$Unit = ltrim($Unit); $Unit = ltrim($Unit);
if (empty($Unit)) { if (empty($Unit)) {
return $Value ? round($Value) : 0; return $Value ? round($Value) : 0;
@ -487,7 +487,7 @@ public static function make_utf8($Str) {
$Encoding = 'UTF-8'; $Encoding = 'UTF-8';
} }
if (empty($Encoding)) { if (empty($Encoding)) {
$Encoding = mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); $Encoding = mb_detect_encoding($Str, 'UTF-8, ISO-8859-1');
} }
if (empty($Encoding)) { if (empty($Encoding)) {
$Encoding = 'ISO-8859-1'; $Encoding = 'ISO-8859-1';
@ -495,7 +495,7 @@ public static function make_utf8($Str) {
if ($Encoding == 'UTF-8') { if ($Encoding == 'UTF-8') {
return $Str; return $Str;
} else { } else {
return @mb_convert_encoding($Str,'UTF-8',$Encoding); return @mb_convert_encoding($Str, 'UTF-8', $Encoding);
} }
} }
} }

View File

@ -46,7 +46,7 @@ function ellipse($x, $y, $Width, $Height, $Color) {
} }
function text($x, $y, $Color, $Text) { function text($x, $y, $Color, $Text) {
return imagettftext ($this->Image, $this->FontSize,$this->TextAngle, $x, $y, $Color, $this->Font, $Text); return imagettftext ($this->Image, $this->FontSize, $this->TextAngle, $x, $y, $Color, $this->Font, $Text);
} }
function make_png($FileName = NULL) { function make_png($FileName = NULL) {

View File

@ -76,7 +76,7 @@ public function disconnect() {
public function get_channel() { public function get_channel() {
preg_match('/.+ PRIVMSG ([^:]+) :.+/', $this->Data, $Channel); preg_match('/.+ PRIVMSG ([^:]+) :.+/', $this->Data, $Channel);
if (preg_match('/#.+/',$Channel[1])) { if (preg_match('/#.+/', $Channel[1])) {
return $Channel[1]; return $Channel[1];
} else { } else {
return false; return false;
@ -100,7 +100,7 @@ protected function get_irc_host() {
protected function get_word($Select=1) { protected function get_word($Select=1) {
preg_match('/:.+ PRIVMSG [^:]+ :(.+)/', $this->Data, $Word); preg_match('/:.+ PRIVMSG [^:]+ :(.+)/', $this->Data, $Word);
$Word = split(' ',$Word[1]); $Word = split(' ', $Word[1]);
return trim($Word[$Select]); return trim($Word[$Select]);
} }
@ -131,7 +131,7 @@ protected function whois($Nick) {
/* /*
This function uses blacklisted_ip, which is no longer in RC2. This function uses blacklisted_ip, which is no longer in RC2.
You can probably find it in old RC1 code kicking aronud if you need it. You can probably find it in old RC1 code kicking aronud if you need it.
protected function ip_check($IP,$Gline=false,$Channel=BOT_REPORT_CHAN) { protected function ip_check($IP, $Gline = false, $Channel = BOT_REPORT_CHAN) {
global $Cache, $DB; global $Cache, $DB;
if (blacklisted_ip($IP)) { if (blacklisted_ip($IP)) {
$this->send_to($Channel, 'TOR IP Detected: '.$IP); $this->send_to($Channel, 'TOR IP Detected: '.$IP);
@ -148,7 +148,7 @@ protected function ip_check($IP,$Gline=false,$Channel=BOT_REPORT_CHAN) {
}*/ }*/
protected function listen() { protected function listen() {
global $Cache,$DB; global $Cache, $DB;
$Cache->InternalCache = false; $Cache->InternalCache = false;
stream_set_timeout($this->Socket, 10000000000); stream_set_timeout($this->Socket, 10000000000);
while ($this->State == 1) { while ($this->State == 1) {
@ -163,7 +163,7 @@ protected function listen() {
} }
if ($this->Whois !== false) { if ($this->Whois !== false) {
$Exp = explode(' ',$this->Data); $Exp = explode(' ', $this->Data);
if ($Exp[1] == '307') { if ($Exp[1] == '307') {
$this->Identified[$this->Whois] = 1; $this->Identified[$this->Whois] = 1;
$this->send_to($this->LastChan, "$this->Whois correctly identified as a real person!"); $this->send_to($this->LastChan, "$this->Whois correctly identified as a real person!");
@ -185,7 +185,7 @@ protected function listen() {
} }
} }
if (preg_match("/:([^!]+)![^\s]* PART #what.cd-disabled/", $this->Data, $Nick)) { if (preg_match("/:([^!]+)![^\s]* PART ".BOT_DISABLED_CHAN.'/', $this->Data, $Nick)) {
if (isset($this->DisabledUsers[$Nick[1]])) { if (isset($this->DisabledUsers[$Nick[1]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'"); $DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'");
$Cache->increment_value('num_disablees', -1); $Cache->increment_value('num_disablees', -1);
@ -193,7 +193,7 @@ protected function listen() {
} }
} }
if (preg_match("/:([^!]+)![^\s]* KICK #what.cd-disabled.* /", $this->Data, $Nick)) { if (preg_match("/:([^!]+)![^\s]* KICK ".BOT_DISABLED_CHAN.'.* /', $this->Data, $Nick)) {
$Nick = explode(" ", $Nick[0]); $Nick = explode(" ", $Nick[0]);
if (isset($this->DisabledUsers[$Nick[3]])) { if (isset($this->DisabledUsers[$Nick[3]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[3] . "'"); $DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[3] . "'");
@ -210,11 +210,11 @@ protected function listen() {
$this->send_raw('PONG :'.$Ping[1]); $this->send_raw('PONG :'.$Ping[1]);
} }
if (preg_match('/.*PRIVMSG #.*/',$this->Data)) { if (preg_match('/.*PRIVMSG #.*/', $this->Data)) {
$this->channel_events(); $this->channel_events();
} }
if (preg_match("/.* PRIVMSG ".BOT_NICK." .*/",$this->Data)) { if (preg_match("/.* PRIVMSG ".BOT_NICK." .*/", $this->Data)) {
$this->query_events(); $this->query_events();
} }
} }

View File

@ -193,7 +193,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
WHERE ID = '$TopicID'"); WHERE ID = '$TopicID'");
// Bump this topic to head of the cache // Bump this topic to head of the cache
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID); list($Forum,,, $Stickies) = $Cache->get_value('forums_'.$ForumID);
if (!empty($Forum)) { if (!empty($Forum)) {
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) { if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
array_pop($Forum); array_pop($Forum);
@ -407,7 +407,7 @@ public static function get_alias_tag($BadTag) {
* @param string $Message the message to write. * @param string $Message the message to write.
*/ */
public static function write_log($Message) { public static function write_log($Message) {
global $DB,$Time; global $DB, $Time;
$DB->query(" $DB->query("
INSERT INTO log (Message, Time) INSERT INTO log (Message, Time)
VALUES ('" . db_string($Message) . "', '" . sqltime() . "')"); VALUES ('" . db_string($Message) . "', '" . sqltime() . "')");
@ -423,7 +423,7 @@ public static function write_log($Message) {
public static function sanitize_tag($Str) { public static function sanitize_tag($Str) {
$Str = strtolower($Str); $Str = strtolower($Str);
$Str = preg_replace('/[^a-z0-9.]/', '', $Str); $Str = preg_replace('/[^a-z0-9.]/', '', $Str);
$Str = preg_replace('/(^[.,]*)|([.,]*$)/','',$Str); $Str = preg_replace('/(^[.,]*)|([.,]*$)/', '', $Str);
$Str = htmlspecialchars($Str); $Str = htmlspecialchars($Str);
$Str = db_string(trim($Str)); $Str = db_string(trim($Str));
return $Str; return $Str;

View File

@ -248,7 +248,7 @@ function query($Query, $AutoHandle = 1) {
function query_unb($Query) { function query_unb($Query) {
$this->connect(); $this->connect();
mysqli_real_query($this->LinkID,$Query); mysqli_real_query($this->LinkID, $Query);
} }
function inserted_id() { function inserted_id() {
@ -257,9 +257,9 @@ function inserted_id() {
} }
} }
function next_record($Type=MYSQLI_BOTH, $Escape = true) { // $Escape can be true, false, or an array of keys to not escape function next_record($Type = MYSQLI_BOTH, $Escape = true) { // $Escape can be true, false, or an array of keys to not escape
if ($this->LinkID) { if ($this->LinkID) {
$this->Record = mysqli_fetch_array($this->QueryID,$Type); $this->Record = mysqli_fetch_array($this->QueryID, $Type);
$this->Row++; $this->Row++;
if (!is_array($this->Record)) { if (!is_array($this->Record)) {
$this->QueryID = false; $this->QueryID = false;
@ -302,7 +302,7 @@ function escape_str($Str) {
trigger_error('Attempted to escape array.'); trigger_error('Attempted to escape array.');
return ''; return '';
} }
return mysqli_real_escape_string($this->LinkID,$Str); return mysqli_real_escape_string($this->LinkID, $Str);
} }
// Creates an array from a result set // Creates an array from a result set
@ -310,7 +310,7 @@ function escape_str($Str) {
// Otherwise, use an integer // Otherwise, use an integer
function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) { function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) {
$Return = array(); $Return = array();
while ($Row = mysqli_fetch_array($this->QueryID,$Type)) { while ($Row = mysqli_fetch_array($this->QueryID, $Type)) {
if ($Escape !== false) { if ($Escape !== false) {
$Row = Misc::display_array($Row, $Escape); $Row = Misc::display_array($Row, $Escape);
} }

View File

@ -6,13 +6,14 @@ class Permissions {
* @param string PermissionName * @param string PermissionName
* @param string $MinClass Return false if the user's class level is below this. * @param string $MinClass Return false if the user's class level is below this.
*/ */
public static function check_perms($PermissionName,$MinClass = 0) { public static function check_perms($PermissionName, $MinClass = 0) {
global $LoggedUser; global $LoggedUser;
return ( return (
isset($LoggedUser['Permissions'][$PermissionName]) isset($LoggedUser['Permissions'][$PermissionName])
&& $LoggedUser['Permissions'][$PermissionName] && $LoggedUser['Permissions'][$PermissionName]
&& ($LoggedUser['Class']>=$MinClass && ($LoggedUser['Class'] >= $MinClass
|| $LoggedUser['EffectiveClass']>=$MinClass)) ? true : false; || $LoggedUser['EffectiveClass'] >= $MinClass)
) ? true : false;
} }
/** /**

View File

@ -1,7 +1,7 @@
<? <?
//Useful: http://www.robtex.com/cnet/ //Useful: http://www.robtex.com/cnet/
$AllowedProxies = array( $AllowedProxies = array(
//Opera Turbo (may include opera owned IPs that aren't used for Turbo, but shouldn't run much risk of exploitation) //Opera Turbo (may include Opera-owned IP addresses that aren't used for Turbo, but shouldn't run much risk of exploitation)
'64.255.180.*', //Norway '64.255.180.*', //Norway
'64.255.164.*', //Norway '64.255.164.*', //Norway
'80.239.242.*', //Poland '80.239.242.*', //Poland
@ -15,16 +15,16 @@
function proxyCheck($IP) { function proxyCheck($IP) {
global $AllowedProxies; global $AllowedProxies;
for ($i=0,$il=count($AllowedProxies);$i<$il;++$i) { for ($i = 0, $il = count($AllowedProxies); $i < $il; ++$i) {
//based on the wildcard principle it should never be shorter //based on the wildcard principle it should never be shorter
if (strlen($IP) < strlen($AllowedProxies[$i])) { if (strlen($IP) < strlen($AllowedProxies[$i])) {
continue; continue;
} }
//since we're matching bit for bit iterating from the start //since we're matching bit for bit iterating from the start
for ($j=0,$jl=strlen($IP);$j<$jl;++$j) { for ($j = 0, $jl = strlen($IP); $j < $jl; ++$j) {
//completed iteration and no inequality //completed iteration and no inequality
if ($j == $jl-1 && $IP[$j] === $AllowedProxies[$i][$j]) { if ($j == $jl - 1 && $IP[$j] === $AllowedProxies[$i][$j]) {
return true; return true;
} }

View File

@ -2,7 +2,7 @@
// Example : // Example :
// $TPL = new TEMPLATE; // $TPL = new TEMPLATE;
// $TPL->open('inv.tpl'); // $TPL->open('inv.tpl');
// $TPL->set('ADDRESS1',$TPL->str_align(57,$UADDRESS1,'l',' ')); // $TPL->set('ADDRESS1', $TPL->str_align(57, $UADDRESS1, 'l', ' '));
// $TPL->get(); // $TPL->get();
class TEMPLATE { class TEMPLATE {

View File

@ -132,7 +132,7 @@ public function full_format ($Str, $OutputTOC = true, $Min = 3) {
$Str = preg_replace('/'.$URLPrefix.'\s+/i', '$1', $Str); $Str = preg_replace('/'.$URLPrefix.'\s+/i', '$1', $Str);
$Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str); $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
// For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link // For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link
$callback = create_function('$matches', 'return str_replace("[inlineurl]","",$matches[0]);'); $callback = create_function('$matches', 'return str_replace("[inlineurl]", "", $matches[0]);');
$Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', $callback, $Str); $Str = preg_replace_callback('/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m', $callback, $Str);
if ($this->TOC) { if ($this->TOC) {
@ -647,11 +647,11 @@ private function to_html ($Array) {
$Group = $Groups['matches'][$Matches[2]]; $Group = $Groups['matches'][$Matches[2]];
$Str .= Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$Matches[2].'">'.$Group['Name'].'</a>'; $Str .= Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$Matches[2].'">'.$Group['Name'].'</a>';
} else { } else {
$Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]'; $Str .= '[torrent]'.str_replace('[inlineurl]', '', $Block['Val']).'[/torrent]';
} }
} }
} else { } else {
$Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]'; $Str .= '[torrent]'.str_replace('[inlineurl]', '', $Block['Val']).'[/torrent]';
} }
break; break;
case 'wiki': case 'wiki':

View File

@ -169,8 +169,8 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
i.BanDate='".sqltime()."', i.BanDate='".sqltime()."',
i.BanReason='$BanReason', i.BanReason='$BanReason',
i.RatioWatchDownload=".($BanReason == 2 ? 'm.Downloaded' : "'0'")." i.RatioWatchDownload=".($BanReason == 2 ? 'm.Downloaded' : "'0'")."
WHERE m.ID IN(".implode(',',$UserIDs).") "); WHERE m.ID IN(".implode(',', $UserIDs).') ');
$Cache->decrement('stats_user_count',$DB->affected_rows()); $Cache->decrement('stats_user_count', $DB->affected_rows());
foreach ($UserIDs as $UserID) { foreach ($UserIDs as $UserID) {
$Cache->delete_value('enabled_'.$UserID); $Cache->delete_value('enabled_'.$UserID);
$Cache->delete_value('user_info_'.$UserID); $Cache->delete_value('user_info_'.$UserID);
@ -197,7 +197,7 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
$DB->query(" $DB->query("
SELECT torrent_pass SELECT torrent_pass
FROM users_main FROM users_main
WHERE ID in (".implode(', ',$UserIDs).')'); WHERE ID in (".implode(', ', $UserIDs).')');
$PassKeys = $DB->collect('torrent_pass'); $PassKeys = $DB->collect('torrent_pass');
$Concat = ''; $Concat = '';
foreach ($PassKeys as $PassKey) { foreach ($PassKeys as $PassKey) {

View File

@ -277,7 +277,7 @@ function file_list() {
$FileSize = $File->Val['length']; $FileSize = $File->Val['length'];
$TotalSize += $FileSize; $TotalSize += $FileSize;
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/'); $FileName = ltrim(implode('/', $File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize; $FileSizes[] = $FileSize;
$FileNames[] = $FileName; $FileNames[] = $FileName;
} }

View File

@ -266,7 +266,7 @@ function file_list() {
$FileSize = substr($File->Val['length'], 7); $FileSize = substr($File->Val['length'], 7);
$TotalSize += $FileSize; $TotalSize += $FileSize;
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/'); $FileName = ltrim(implode('/', $File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize; $FileSizes[] = $FileSize;
$FileNames[] = $FileName; $FileNames[] = $FileName;
} }

View File

@ -213,7 +213,7 @@ public static function torrent_properties(&$Torrent, &$Flags) {
* @param boolean $Hidden Currently does fuck all. TODO: Fix that. * @param boolean $Hidden Currently does fuck all. TODO: Fix that.
*/ */
public static function write_group_log($GroupID, $TorrentID, $UserID, $Message, $Hidden) { public static function write_group_log($GroupID, $TorrentID, $UserID, $Message, $Hidden) {
global $DB,$Time; global $DB, $Time;
$DB->query(" $DB->query("
INSERT INTO group_log INSERT INTO group_log
(GroupID, TorrentID, UserID, Info, Time, Hidden) (GroupID, TorrentID, UserID, Info, Time, Hidden)
@ -371,7 +371,7 @@ public static function delete_group($GroupID) {
$DB->query(" $DB->query("
UPDATE collages UPDATE collages
SET NumTorrents=NumTorrents-1 SET NumTorrents=NumTorrents-1
WHERE ID IN (".implode(', ',$CollageIDs).')'); WHERE ID IN (".implode(', ', $CollageIDs).')');
$DB->query(" $DB->query("
DELETE FROM collages_torrents DELETE FROM collages_torrents
WHERE GroupID='$GroupID'"); WHERE GroupID='$GroupID'");
@ -659,7 +659,7 @@ public static function torrent_info($Data, $ShowMedia = false, $ShowEdition = fa
$EditionInfo = array(); $EditionInfo = array();
if (!empty($Data['RemasterYear'])) { $EditionInfo[] = $Data['RemasterYear']; } if (!empty($Data['RemasterYear'])) { $EditionInfo[] = $Data['RemasterYear']; }
if (!empty($Data['RemasterTitle'])) { $EditionInfo[] = $Data['RemasterTitle']; } if (!empty($Data['RemasterTitle'])) { $EditionInfo[] = $Data['RemasterTitle']; }
if (count($EditionInfo)) { $Info[] = implode(' ',$EditionInfo); } if (count($EditionInfo)) { $Info[] = implode(' ', $EditionInfo); }
} }
if ($Data['IsSnatched']) { $Info[] = Format::torrent_label('Snatched!'); } if ($Data['IsSnatched']) { $Info[] = Format::torrent_label('Snatched!'); }
if ($Data['FreeTorrent'] == '1') { $Info[] = Format::torrent_label('Freeleech!'); } if ($Data['FreeTorrent'] == '1') { $Info[] = Format::torrent_label('Freeleech!'); }

View File

@ -184,13 +184,13 @@ public static function user_heavy_info($UserID) {
foreach ($PermIDs AS $PermID) { foreach ($PermIDs AS $PermID) {
$Perms = Permissions::get_permissions($PermID); $Perms = Permissions::get_permissions($PermID);
if (!empty($Perms['PermittedForums'])) { if (!empty($Perms['PermittedForums'])) {
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums']))); $PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',', $Perms['PermittedForums'])));
} }
} }
$Perms = Permissions::get_permissions($HeavyInfo['PermissionID']); $Perms = Permissions::get_permissions($HeavyInfo['PermissionID']);
unset($HeavyInfo['PermissionID']); unset($HeavyInfo['PermissionID']);
if (!empty($Perms['PermittedForums'])) { if (!empty($Perms['PermittedForums'])) {
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums']))); $PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',', $Perms['PermittedForums'])));
} }
if (!empty($PermittedForums) || !empty($RestrictedForums)) { if (!empty($PermittedForums) || !empty($RestrictedForums)) {

View File

@ -35,8 +35,8 @@ function display_str($Str) {
} }
if ($Str != '' && !is_number($Str)) { if ($Str != '' && !is_number($Str)) {
$Str = Format::make_utf8($Str); $Str = Format::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(
"'",'"',"<",">", "'",'"',"<",">",

View File

@ -6,9 +6,9 @@
//-----------------------------------*/ //-----------------------------------*/
class VALIDATE { class VALIDATE {
var $Fields=array(); var $Fields = array();
function SetFields($FieldName,$Required,$FieldType,$ErrorMessage,$Options=array()) { function SetFields($FieldName, $Required, $FieldType, $ErrorMessage, $Options = array()) {
$this->Fields[$FieldName]['Type'] = strtolower($FieldType); $this->Fields[$FieldName]['Type'] = strtolower($FieldType);
$this->Fields[$FieldName]['Required'] = $Required; $this->Fields[$FieldName]['Required'] = $Required;
$this->Fields[$FieldName]['ErrorMessage'] = $ErrorMessage; $this->Fields[$FieldName]['ErrorMessage'] = $ErrorMessage;
@ -153,7 +153,7 @@ function ValidateForm($ValidateArray) {
} }
} elseif ($Field['Type'] == 'compare') { } elseif ($Field['Type'] == 'compare') {
if ($ValidateArray[$Field['CompareField']]!=$ValidateVar) { if ($ValidateArray[$Field['CompareField']] != $ValidateVar) {
return $Field['ErrorMessage']; return $Field['ErrorMessage'];
} }

View File

@ -2,9 +2,4 @@ User-agent: *
Allow: /index.php Allow: /index.php
Allow: /login.php Allow: /login.php
Allow: /register.php Allow: /register.php
#<skip>
Allow: /what-network/
Allow: /gazelle/
Sitemap: https://what.cd/sitemap.xml
#</skip>
Disallow: / Disallow: /

View File

@ -268,7 +268,10 @@
} elseif (!empty($_GET['artistname'])) { } elseif (!empty($_GET['artistname'])) {
$NameSearch = str_replace('\\', '\\\\', trim($_GET['artistname'])); $NameSearch = str_replace('\\', '\\\\', trim($_GET['artistname']));
$DB->query("SELECT ArtistID, Name FROM artists_alias WHERE Name LIKE '" . db_string($NameSearch) . "'"); $DB->query("
SELECT ArtistID, Name
FROM artists_alias
WHERE Name LIKE '" . db_string($NameSearch) . "'");
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) { if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) {
header('Location: torrents.php?action=advanced&artistname=' . urlencode($_GET['artistname'])); header('Location: torrents.php?action=advanced&artistname=' . urlencode($_GET['artistname']));

View File

@ -1,14 +1,19 @@
<?php <?php
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) { if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$_GET['remove']); $DB->query("
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$_GET['remove']); DELETE FROM torrents_bad_folders
WHERE TorrentID = ".$_GET['remove']);
$DB->query("
SELECT GroupID
FROM torrents
WHERE ID = ".$_GET['remove']);
list($GroupID) = $DB->next_record(); list($GroupID) = $DB->next_record();
$Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value('torrents_details_'.$GroupID);
} }
if (!empty($_GET['filter']) && $_GET['filter'] == "all") { if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
$Join = ''; $Join = '';
$All = true; $All = true;
} else { } else {
@ -61,17 +66,17 @@
} else { } else {
$DisplayName = ''; $DisplayName = '';
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]"; $DisplayName .= " [$GroupYear]";
} }
if ($ReleaseType > 0) { if ($ReleaseType > 0) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']'; $DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
} }
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]); $ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if ($ExtraInfo) { if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName .= ' - '.$ExtraInfo;
} }
?> ?>
<tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">

View File

@ -1,18 +1,19 @@
<? <?
if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) { if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) {
$DB->query("SELECT $DB->query("
t.ID AS TorrentID, SELECT
t.GroupID AS GroupID t.ID AS TorrentID,
FROM xbt_files_users AS x t.GroupID AS GroupID
JOIN torrents AS t ON t.ID=x.fid FROM xbt_files_users AS x
WHERE t.Format='FLAC' JOIN torrents AS t ON t.ID=x.fid
GROUP BY x.fid WHERE t.Format='FLAC'
HAVING COUNT(x.uid) = 1 GROUP BY x.fid
ORDER BY t.LogScore DESC, t.Time ASC HAVING COUNT(x.uid) = 1
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);
} }
$Results = Torrents::get_groups(array_keys($GroupIDs)); $Results = Torrents::get_groups(array_keys($GroupIDs));
@ -42,17 +43,17 @@
} }
$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) { if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]"; $DisplayName .= " [$GroupYear]";
} }
if ($ReleaseType > 0) { if ($ReleaseType > 0) {
$DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; $DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
} }
$ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]); $ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]);
if ($ExtraInfo) { if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName .= ' - '.$ExtraInfo;
} }
?> ?>
<tr class="torrent torrent_row<?=$Torrents[$FlacID]['IsSnatched'] ? ' snatched_torrent' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$FlacID]['IsSnatched'] ? ' snatched_torrent' : ''?>">

View File

@ -19,7 +19,8 @@
} }
// Get list of FLAC snatches // Get list of FLAC snatches
$DB->query("SELECT t.GroupID, x.fid $DB->query("
SELECT t.GroupID, x.fid
FROM ".($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched')." AS x FROM ".($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched')." AS x
JOIN torrents AS t ON t.ID=x.fid JOIN torrents AS t ON t.ID=x.fid
JOIN torrents_group AS tg ON tg.ID = t.GroupID JOIN torrents_group AS tg ON tg.ID = t.GroupID
@ -27,7 +28,8 @@
AND ((t.LogScore = '100' AND t.Media = 'CD') AND ((t.LogScore = '100' AND t.Media = 'CD')
OR t.Media != 'CD') OR t.Media != 'CD')
AND tg.CategoryID = 1 AND tg.CategoryID = 1
AND x.uid='$UserID'" . ($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : '')); AND x.uid='$UserID'" .
($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : ''));
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true); $SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
$SnatchedGroupIDs = array_unique($DB->collect('GroupID')); $SnatchedGroupIDs = array_unique($DB->collect('GroupID'));
@ -41,19 +43,26 @@
} }
// Create hash table // Create hash table
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_snatch $DB->query("
SELECT t.GroupID, CREATE TEMPORARY TABLE temp_sections_better_snatch
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList, SELECT
CRC32(CONCAT_WS(' ', Media, Remasteryear, Remastertitle, t.GroupID,
Remasterrecordlabel, Remastercataloguenumber)) AS RemIdent GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList,
CRC32(CONCAT_WS(
' ', Media, Remasteryear, Remastertitle,
Remasterrecordlabel, Remastercataloguenumber)
) AS RemIdent
FROM torrents AS t FROM torrents AS t
WHERE t.GroupID IN(".implode(',',$SnatchedGroupIDs).") AND t.Format IN ('FLAC', 'MP3') WHERE t.GroupID IN(".implode(',', $SnatchedGroupIDs).")
AND t.Format IN ('FLAC', 'MP3')
GROUP BY t.GroupID, RemIdent"); GROUP BY t.GroupID, RemIdent");
//$DB->query('SELECT * FROM t'); //$DB->query('SELECT * FROM t');
$DB->query("SELECT GroupID FROM temp_sections_better_snatch $DB->query("
WHERE EncodingList NOT LIKE '%V0 (VBR)%' SELECT GroupID
FROM temp_sections_better_snatch
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%' OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'"); OR EncodingList NOT LIKE '%320%'");
@ -218,9 +227,9 @@
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags->format()?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
</tr> </tr>
<? <?
} }

View File

@ -1,8 +1,13 @@
<?php <?php
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) { if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
$DB->query("DELETE FROM torrents_bad_tags WHERE TorrentID = ".$_GET['remove']); $DB->query("
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$_GET['remove']); DELETE FROM torrents_bad_tags
WHERE TorrentID = ".$_GET['remove']);
$DB->query("
SELECT GroupID
FROM torrents
WHERE ID = ".$_GET['remove']);
list($GroupID) = $DB->next_record(); list($GroupID) = $DB->next_record();
$Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value('torrents_details_'.$GroupID);
} }
@ -62,17 +67,17 @@
} else { } else {
$DisplayName = ''; $DisplayName = '';
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'#torrent'.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'#torrent'.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]"; $DisplayName .= " [$GroupYear]";
} }
if ($ReleaseType > 0) { if ($ReleaseType > 0) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']'; $DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
} }
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]); $ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if ($ExtraInfo) { if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName .= ' - '.$ExtraInfo;
} }
?> ?>
<tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>"> <tr class="torrent torrent_row<?=$Torrents[$TorrentID]['IsSnatched'] ? ' snatched_torrent' : ''?>">

View File

@ -178,9 +178,9 @@
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags->format()?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
</tr> </tr>
<? <?
} }

View File

@ -324,9 +324,9 @@ function transcode_parse_groups($Groups) {
<div class="torrent_info"><?=$Edition['EditionName']?></div> <div class="torrent_info"><?=$Edition['EditionName']?></div>
<div class="tags"><?=$TorrentTags->format('better.php?action=transcode&tags=')?></div> <div class="tags"><?=$TorrentTags->format('better.php?action=transcode&tags=')?></div>
</td> </td>
<td><strong <?=(isset($Edition['MP3s']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td> <td><?=(isset($Edition['MP3s']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>')?></td>
<td><strong <?=(isset($Edition['MP3s']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td> <td><?=(isset($Edition['MP3s']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>')?></td>
<td><strong <?=(isset($Edition['MP3s']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td> <td><?=(isset($Edition['MP3s']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>')?></td>
</tr> </tr>
<? <?
} }

View File

@ -13,15 +13,15 @@
$EncodingKeys = array_fill_keys($Encodings, true); $EncodingKeys = array_fill_keys($Encodings, true);
// Get list of FLAC uploads // Get list of FLAC uploads
$DB->query("SELECT t.GroupID, t.ID $DB->query("
SELECT t.GroupID, t.ID
FROM torrents AS t FROM torrents AS t
JOIN torrents_group AS tg ON tg.ID = t.GroupID JOIN torrents_group AS tg ON tg.ID = t.GroupID
WHERE WHERE t.Format='FLAC'
t.Format='FLAC' AND ((t.LogScore = '100' AND t.Media = 'CD')
AND ((t.LogScore = '100' AND t.Media = 'CD') OR t.Media != 'CD')
OR t.Media != 'CD') AND tg.CategoryID = 1
AND tg.CategoryID = 1 AND t.UserID = '$UserID'");
AND t.UserID='$UserID'");
$UploadedTorrentIDs = array_fill_keys($DB->collect('ID'), true); $UploadedTorrentIDs = array_fill_keys($DB->collect('ID'), true);
$UploadedGroupIDs = $DB->collect('GroupID'); $UploadedGroupIDs = $DB->collect('GroupID');
@ -31,17 +31,24 @@
} }
// Create hash table // Create hash table
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_upload $DB->query("
SELECT t.GroupID, CREATE TEMPORARY TABLE temp_sections_better_upload
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList, SELECT
CRC32(CONCAT_WS(' ', Media, Remasteryear, Remastertitle, t.GroupID,
Remasterrecordlabel, Remastercataloguenumber)) AS RemIdent GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList,
CRC32(CONCAT_WS(
' ', Media, Remasteryear, Remastertitle,
Remasterrecordlabel, Remastercataloguenumber)
) AS RemIdent
FROM torrents AS t FROM torrents AS t
WHERE t.GroupID IN(".implode(',',$UploadedGroupIDs).") AND t.Format IN ('FLAC', 'MP3') WHERE t.GroupID IN(".implode(',', $UploadedGroupIDs).")
AND t.Format IN ('FLAC', 'MP3')
GROUP BY t.GroupID, RemIdent"); GROUP BY t.GroupID, RemIdent");
$DB->query("SELECT GroupID FROM temp_sections_better_upload $DB->query("
WHERE EncodingList NOT LIKE '%V0 (VBR)%' SELECT GroupID
FROM temp_sections_better_upload
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%' OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'"); OR EncodingList NOT LIKE '%320%'");
@ -197,9 +204,9 @@
<div class="torrent_info"><?=$ExtraInfo?></div> <div class="torrent_info"><?=$ExtraInfo?></div>
<div class="tags"><?=$TorrentTags->format()?></div> <div class="tags"><?=$TorrentTags->format()?></div>
</td> </td>
<td><strong <?=isset($Edition['Formats']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V2 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['V0 (VBR)']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
<td><strong <?=isset($Edition['Formats']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><?=isset($Edition['Formats']['320']) ? '<strong class="important_text_alt">YES</strong>' : '<strong class="important_text">NO</strong>'?></td>
</tr> </tr>
<? <?
} }

View File

@ -103,31 +103,10 @@
case 'create_personal': case 'create_personal':
if (!check_perms('site_collages_personal')) { if (!check_perms('site_collages_personal')) {
error(403); error(403);
} else {
Collages::create_personal_collage();
} }
break;
$DB->query("
SELECT
COUNT(ID)
FROM collages
WHERE UserID='$LoggedUser[ID]'
AND CategoryID='0'
AND Deleted='0'");
list($CollageCount) = $DB->next_record();
if ($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
list($CollageID) = $DB->next_record();
header('Location: collage.php?id='.$CollageID);
die();
}
$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=https:\/\/".SSL_SITE_URL."\/user.php?id=$LoggedUser[ID]]profile[\/url].', '0', $LoggedUser[ID])");
$CollageID = $DB->inserted_id();
header('Location: collage.php?id='.$CollageID);
die();
default: default:
if (!empty($_GET['id'])) { if (!empty($_GET['id'])) {

View File

@ -580,7 +580,7 @@
$EditSummary[] = "IRC status changed"; $EditSummary[] = "IRC status changed";
$HeavyUpdates['DisableIRC'] = $DisableIRC; $HeavyUpdates['DisableIRC'] = $DisableIRC;
if (!empty($UserReason)) { if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your IRC privileges have been disabled', "Your IRC privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in #what.cd-disabled."); Misc::send_pm($UserID, 0, 'Your IRC privileges have been disabled', "Your IRC privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in ".BOT_DISABLED_CHAN.'.');
} }
} }
@ -589,7 +589,7 @@
$EditSummary[] = "request status changed"; $EditSummary[] = "request status changed";
$HeavyUpdates['DisableRequests'] = $DisableRequests; $HeavyUpdates['DisableRequests'] = $DisableRequests;
if (!empty($UserReason)) { if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your request privileges have been disabled', "Your request privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in #what.cd-disabled."); Misc::send_pm($UserID, 0, 'Your request privileges have been disabled', "Your request privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this please join ".BOT_DISABLED_CHAN." on our IRC network. Instructions can be found [url=https://".SSL_SITE_URL."/wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in ".BOT_DISABLED_CHAN.'.');
} }
} }

View File

@ -26,7 +26,7 @@ function Quote(post, user, link) {
if ($('#quickpost').raw().value !== '') { if ($('#quickpost').raw().value !== '') {
$('#quickpost').raw().value = $('#quickpost').raw().value + "\n\n"; $('#quickpost').raw().value = $('#quickpost').raw().value + "\n\n";
} }
$('#quickpost').raw().value = $('#quickpost').raw().value + "[quote="+username + (link == true ? "|" + post : "") + "]" + $('#quickpost').raw().value = $('#quickpost').raw().value + "[quote=" + username + (link == true ? "|" + post : "") + "]" +
//response.replace(/(img|aud)(\]|=)/ig,'url$2').replace(/\[url\=(https?:\/\/[^\s\[\]<>"\'()]+?)\]\[url\](.+?)\[\/url\]\[\/url\]/gi, "[url]$1[/url]") //response.replace(/(img|aud)(\]|=)/ig,'url$2').replace(/\[url\=(https?:\/\/[^\s\[\]<>"\'()]+?)\]\[url\](.+?)\[\/url\]\[\/url\]/gi, "[url]$1[/url]")
html_entity_decode(response) html_entity_decode(response)
+ "[/quote]"; + "[/quote]";
@ -41,9 +41,9 @@ function Edit_Form(post,key) {
$('#reply_box').ghide(); $('#reply_box').ghide();
if (location.href.match(/torrents\.php/) || if (location.href.match(/torrents\.php/) ||
location.href.match(/artist\.php/)) { location.href.match(/artist\.php/)) {
boxWidth="50"; boxWidth = "50";
} else { } else {
boxWidth="80"; boxWidth = "80";
} }
postuserid = $('#post' + postid + ' strong a').raw().getAttribute('href').split('=')[1] postuserid = $('#post' + postid + ' strong a').raw().getAttribute('href').split('=')[1]
/* jQuery isnt enabled on comments, artist comments, or basically anywhere but thread.php /* jQuery isnt enabled on comments, artist comments, or basically anywhere but thread.php
@ -52,13 +52,13 @@ function Edit_Form(post,key) {
postuserid = jQuery('#post' + postid + ' strong a').attr('href').split('=')[1]; postuserid = jQuery('#post' + postid + ' strong a').attr('href').split('=')[1];
*/ */
if (postuserid != userid) { if (postuserid != userid) {
pmbox = '<span id="pmbox'+postid+'">PM user on edit? <input type="checkbox" name="pm" value="1" /></span>'; pmbox = '<span id="pmbox' + postid + '"><label>PM user on edit? <input type="checkbox" name="pm" value="1" /></label></span>';
} else { } else {
pmbox = ''; pmbox = '';
}; };
$('#bar' + postid).raw().cancel = $('#content' + postid).raw().innerHTML; $('#bar' + postid).raw().cancel = $('#content' + postid).raw().innerHTML;
$('#bar' + postid).raw().oldbar = $('#bar' + postid).raw().innerHTML; $('#bar' + postid).raw().oldbar = $('#bar' + postid).raw().innerHTML;
$('#content' + postid).raw().innerHTML = "<div id=\"preview" + postid + "\"></div><form id=\"form" + postid + "\" method=\"post\" action=\"\">"+pmbox+"<input type=\"hidden\" name=\"auth\" value=\"" + authkey + "\" /><input type=\"hidden\" name=\"key\" value=\"" + key + "\" /><input type=\"hidden\" name=\"post\" value=\"" + postid + "\" /><textarea id=\"editbox" + postid + "\" onkeyup=\"resize('editbox" + postid + "');\" name=\"body\" cols=\""+boxWidth+"\" rows=\"10\"></textarea></form>"; $('#content' + postid).raw().innerHTML = "<div id=\"preview" + postid + "\"></div><form id=\"form" + postid + "\" method=\"post\" action=\"\">" + pmbox + "<input type=\"hidden\" name=\"auth\" value=\"" + authkey + "\" /><input type=\"hidden\" name=\"key\" value=\"" + key + "\" /><input type=\"hidden\" name=\"post\" value=\"" + postid + "\" /><textarea id=\"editbox" + postid + "\" onkeyup=\"resize('editbox" + postid + "');\" name=\"body\" cols=\"" + boxWidth + "\" rows=\"10\"></textarea></form>";
$('#bar' + postid).raw().innerHTML = '<input type="button" value="Preview" onclick="Preview_Edit(' + postid + ');" /><input type="button" value="Post" onclick="Save_Edit(' + postid + ')" /><input type="button" value="Cancel" onclick="Cancel_Edit(' + postid + ');" />'; $('#bar' + postid).raw().innerHTML = '<input type="button" value="Preview" onclick="Preview_Edit(' + postid + ');" /><input type="button" value="Post" onclick="Save_Edit(' + postid + ')" /><input type="button" value="Cancel" onclick="Cancel_Edit(' + postid + ');" />';
} }
/* If it's the initial edit, fetch the post content to be edited. /* If it's the initial edit, fetch the post content to be edited.
@ -161,7 +161,7 @@ function Quick_Preview() {
var quickreplybuttons; var quickreplybuttons;
$('#post_preview').raw().value = "Make changes"; $('#post_preview').raw().value = "Make changes";
$('#post_preview').raw().preview = true; $('#post_preview').raw().preview = true;
ajax.post("ajax.php?action=preview","quickpostform", function(response) { ajax.post("ajax.php?action=preview", "quickpostform", function(response) {
$('#quickreplypreview').gshow(); $('#quickreplypreview').gshow();
$('#contentpreview').raw().innerHTML = response; $('#contentpreview').raw().innerHTML = response;
$('#quickreplytext').ghide(); $('#quickreplytext').ghide();
@ -180,7 +180,7 @@ function Newthread_Preview(mode) {
$('#newthreadpreviewbutton').gtoggle(); $('#newthreadpreviewbutton').gtoggle();
$('#newthreadeditbutton').gtoggle(); $('#newthreadeditbutton').gtoggle();
if (mode) { // Preview if (mode) { // Preview
ajax.post("ajax.php?action=preview","newthreadform", function(response) { ajax.post("ajax.php?action=preview", "newthreadform", function(response) {
$('#contentpreview').raw().innerHTML = response; $('#contentpreview').raw().innerHTML = response;
}); });
$('#newthreadtitle').raw().innerHTML = $('#title').raw().value; $('#newthreadtitle').raw().innerHTML = $('#title').raw().value;

View File

@ -27,7 +27,7 @@ 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;
} }
@ -35,7 +35,7 @@ if (isMobile.Android()) {
} else if (isMobile.NotAndroid()) { } else if (isMobile.NotAndroid()) {
if (!hasCookie(OTHER_COOKIE_NAME)) { 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;
} }

View File

@ -1,5 +1,5 @@
/* /*
Mono What.cd Stylesheet Mono What.CD Stylesheet
Author: Callum Jefferies (callumj) Author: Callum Jefferies (callumj)
Contact: callum.jefferies@gmail.com Contact: callum.jefferies@gmail.com
@ -16,7 +16,7 @@ All icons Copyright (c) Callum Jefferies 2011
body { body {
padding: 120px 20px 60px 20px; padding: 120px 20px 60px 20px;
background: #eee !important; background: #eee !important;
font: 9pt/14pt 'Lucida Grande',Helvetica,Arial,sans-serif; font: 9pt/14pt 'Lucida Grande', Helvetica, Arial, sans-serif;
} }
table { table {
@ -38,7 +38,7 @@ a:hover {
} }
h1,h2,h3 { h1,h2,h3 {
font-family: Helvetica,Arial,sans-serif; font-family: Helvetica, Arial, sans-serif;
font-weight: bold; font-weight: bold;
color: #444 !important; color: #444 !important;
} }

View File

@ -2043,7 +2043,7 @@ tr.torrent .bookmark > a:after {
} }
.group_image img { .group_image img {
background: url(https://what.cd/static/common/noartwork/music.png) no-repeat top left; background: url(static/common/noartwork/music.png) no-repeat top left;
background-size: 90px; background-size: 90px;
color: transparent; color: transparent;
} }