Empty commit

This commit is contained in:
Git 2013-06-26 08:01:00 +00:00
parent 68d25e0fbe
commit f8540013d6
12 changed files with 155 additions and 113 deletions

26
api.php
View File

@ -34,13 +34,13 @@ function check_perms() {
} }
function error($Code) { function error($Code) {
echo '<error>',$Code,'</error></payload>'; echo '<error>', $Code, '</error></payload>';
die(); die();
} }
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);
@ -59,20 +59,26 @@ 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","&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;
} }
@ -83,7 +89,7 @@ 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';
@ -91,7 +97,7 @@ 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);
} }
} }
} }
@ -119,7 +125,7 @@ function display_array($Array, $Escape = array()) {
return $Array; return $Array;
} }
header('Expires: '.date('D, d M Y H:i:s', time()+(2*60*60)).' GMT'); header('Expires: '.date('D, d M Y H:i:s', time() + (2 * 60 * 60)).' GMT');
header('Last-Modified: '.date('D, d M Y H:i:s').' GMT'); header('Last-Modified: '.date('D, d M Y H:i:s').' GMT');
header('Content-type: text/xml'); header('Content-type: text/xml');
echo '<?xml version="1.0"?><payload>'; echo '<?xml version="1.0"?><payload>';

View File

@ -27,8 +27,13 @@ function check_name($Name) {
if (preg_match('/INCOMPLETE~\*/i', $Name)) { if (preg_match('/INCOMPLETE~\*/i', $Name)) {
forbidden_error($Name); forbidden_error($Name);
} }
if (preg_match('/[:?]/', $Name, $Matches)) { // Disallow the following characters, which are invalid in NTFS on Windows systems.
character_error($Matches[0]); // : ? / < > \ * | "
$AllBlockedChars = ' : ? / < > \ * | " ';
// Only the following characters need to be escaped:
// \ - ^ ]
if (preg_match('/[\/\\:?<>*|"]*/', $Name, $Matches)) {
character_error($Matches[0], $AllBlockedChars);
} }
} }
@ -38,8 +43,7 @@ function check_extensions($Type, $Name) {
if (!isset($MusicExtensions[get_file_extension($Name)])) { if (!isset($MusicExtensions[get_file_extension($Name)])) {
invalid_error($Name); invalid_error($Name);
} }
} } elseif ($Type == 'Comics') {
elseif ($Type == 'Comics') {
if (!isset($ComicsExtensions[get_file_extension($Name)])) { if (!isset($ComicsExtensions[get_file_extension($Name)])) {
invalid_error($Name); invalid_error($Name);
} }
@ -60,7 +64,7 @@ function forbidden_error($Name) {
$Err = 'The torrent contained one or more forbidden files (' . display_str($Name) . ')'; $Err = 'The torrent contained one or more forbidden files (' . display_str($Name) . ')';
} }
function character_error($Character) { function character_error($Character, $AllBlockedChars) {
global $Err; global $Err;
$Err = "One or more of the files in the torrent has a name that contains the forbidden character '$Character'. Please rename the files as necessary and recreate the torrent."; $Err = "One or more of the files in the torrent has a name that contains the forbidden character '$Character'. Please rename the files as necessary and recreate the torrent.\n\nNote: The complete list of characters that are disallowed are shown below:\n\n\t$AllBlockedChars";
} }

View File

@ -915,9 +915,13 @@ private function smileys ($Str) {
} }
/* /*
//Uncomment this part to test the class via command line: // Uncomment this part to test the class via command line:
function display_str($Str) {return $Str;} function display_str($Str) {
function check_perms($Perm) {return true;} return $Str;
}
function check_perms($Perm) {
return true;
}
$Str = "hello $Str = "hello
[pre]http://anonym.to/?http://whatshirts.portmerch.com/ [pre]http://anonym.to/?http://whatshirts.portmerch.com/
====hi==== ====hi====

View File

@ -82,7 +82,7 @@ function send_irc($Raw) {
* @param boolean $Ajax If true, the header/footer won't be shown, just the description. * @param boolean $Ajax If true, the header/footer won't be shown, just the description.
* @param string $Log If true, the user is given a link to search $Log in the site log. * @param string $Log If true, the user is given a link to search $Log in the site log.
*/ */
function error($Error, $Ajax=false, $Log=false) { function error($Error, $Ajax = false, $Log = false) {
global $Debug; global $Debug;
require(SERVER_ROOT.'/sections/error/index.php'); require(SERVER_ROOT.'/sections/error/index.php');
$Debug->profile(); $Debug->profile();

View File

@ -23,39 +23,56 @@ function check_perms() {
} }
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);
}
} }
} }
@ -75,7 +92,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);
} }
} }
@ -84,7 +101,7 @@ function display_array($Array, $Escape = array()) {
header('Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0');
header('Pragma:'); header('Pragma:');
header('Expires: '.date('D, d M Y H:i:s', time()+(2*60*60)).' GMT'); header('Expires: '.date('D, d M Y H:i:s', time() + (2 * 60 * 60)).' GMT');
header('Last-Modified: '.date('D, d M Y H:i:s').' GMT'); header('Last-Modified: '.date('D, d M Y H:i:s').' GMT');
$Feed->UseSSL = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443); $Feed->UseSSL = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);

View File

@ -1,8 +1,8 @@
<? <?
/*-- Image Start Class ---------------------------------*/ /*-- Image Start Class ---------------------------------*/
/*------------------------------------------------------*/ /*------------------------------------------------------*/
/* Simplified version of script_start, used for the */ /* Simplified version of script_start, used for the */
/* sitewide image proxy. */ /* sitewide image proxy. */
/*------------------------------------------------------*/ /*------------------------------------------------------*/
/********************************************************/ /********************************************************/
error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR); error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);
@ -12,29 +12,29 @@
die(); die();
} }
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time() + 3600 * 24 * 120)); //120 days header('Expires: '.date('D, d-M-Y H:i:s \U\T\C', time() + 3600 * 24 * 120)); // 120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time())); header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C', time()));
require('classes/config.php'); //The config contains all site wide configuration information as well as memcached rules require('classes/config.php'); // The config contains all site wide configuration information as well as memcached rules
if (!extension_loaded('gd')) { if (!extension_loaded('gd')) {
error('nogd'); error('nogd');
} }
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class require(SERVER_ROOT.'/classes/cache.class.php'); // Require the caching class
require(SERVER_ROOT.'/classes/encrypt.class.php'); //Require the encryption class require(SERVER_ROOT.'/classes/encrypt.class.php'); // Require the encryption class
require(SERVER_ROOT.'/classes/regex.php'); require(SERVER_ROOT.'/classes/regex.php');
$Cache = NEW CACHE($MemcachedServers); //Load the caching class $Cache = NEW CACHE($MemcachedServers); // Load the caching class
$Enc = NEW CRYPT; //Load the encryption class $Enc = NEW CRYPT; // Load the encryption class
if (isset($_COOKIE['session'])) { if (isset($_COOKIE['session'])) {
$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));
$UserID = (int)$UserID; $UserID = (int)$UserID;
$UserInfo = $Cache->get_value('user_info_'.$UserID); $UserInfo = $Cache->get_value("user_info_$UserID");
$Permissions = $Cache->get_value('perm_'.$UserInfo['PermissionID']); $Permissions = $Cache->get_value('perm_'.$UserInfo['PermissionID']);
} }
@ -55,7 +55,7 @@ function invisible($Image) {
} }
$TotalAlpha = 0; $TotalAlpha = 0;
for ($i = 0; $i < $Count; ++$i) { for ($i = 0; $i < $Count; ++$i) {
$Color = imagecolorsforindex($Image,$i); $Color = imagecolorsforindex($Image, $i);
$TotalAlpha += $Color['alpha']; $TotalAlpha += $Color['alpha'];
} }
return (($TotalAlpha/$Count) == 127) ? true : false; return (($TotalAlpha/$Count) == 127) ? true : false;
@ -77,19 +77,19 @@ function verysmall($Image) {
} }
function image_type($Data) { function image_type($Data) {
if (!strncmp($Data,'GIF',3)) { if (!strncmp($Data, 'GIF', 3)) {
return 'gif'; return 'gif';
} }
if (!strncmp($Data,pack('H*','89504E47'),4)) { if (!strncmp($Data, pack('H*', '89504E47'), 4)) {
return 'png'; return 'png';
} }
if (!strncmp($Data,pack('H*','FFD8'),2)) { if (!strncmp($Data, pack('H*', 'FFD8'), 2)) {
return 'jpeg'; return 'jpeg';
} }
if (!strncmp($Data,'BM',2)) { if (!strncmp($Data, 'BM', 2)) {
return 'bmp'; return 'bmp';
} }
if (!strncmp($Data,'II',2) || !strncmp($Data,'MM',2)) { if (!strncmp($Data, 'II', 2) || !strncmp($Data, 'MM', 2)) {
return 'tiff'; return 'tiff';
} }
} }
@ -108,10 +108,12 @@ function image_height($Type, $Data) {
$Str []= "Started 4, + ".$Block['Length']; $Str []= "Started 4, + ".$Block['Length'];
while ($Data != '') { // iterate through the blocks until we find the start of frame marker (FFC0) while ($Data != '') { // iterate through the blocks until we find the start of frame marker (FFC0)
$Block = unpack('CBlock/CType/nLength', $Data); // Get info about the block $Block = unpack('CBlock/CType/nLength', $Data); // Get info about the block
if ($Block['Block'] != '255') { break; } // We should be at the start of a new block if ($Block['Block'] != '255') { // We should be at the start of a new block
break;
}
if ($Block['Type'] != '192') { // C0 if ($Block['Type'] != '192') { // C0
$Data = substr($Data, $Block['Length'] + 2); // Next block $Data = substr($Data, $Block['Length'] + 2); // Next block
$Str []= "Started ".$i.", + ".($Block['Length'] + 2); $Str []= "Started $i, + ".($Block['Length'] + 2);
$i += ($Block['Length'] + 2); $i += ($Block['Length'] + 2);
} else { // We're at the FFC0 block } else { // We're at the FFC0 block
$Data = substr($Data, 5); // Skip FF C0 Length(2) precision(1) $Data = substr($Data, 5); // Skip FF C0 Length(2) precision(1)
@ -150,31 +152,31 @@ function send_pm($ToID, $FromID, $Subject, $Body, $ConvID = '') {
INSERT INTO pm_conversations_users INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) (UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
VALUES VALUES
('$ToID', '$ConvID', '1','0','".sqltime()."', '".sqltime()."', '1')"); ('$ToID', '$ConvID', '1', '0', '".sqltime()."', '".sqltime()."', '1')");
if ($FromID != 0) { if ($FromID != 0) {
$DB->query(" $DB->query("
INSERT INTO pm_conversations_users INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) (UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
VALUES VALUES
('$FromID', '$ConvID', '0','1','".sqltime()."', '".sqltime()."', '0')"); ('$FromID', '$ConvID', '0', '1', '".sqltime()."', '".sqltime()."', '0')");
} }
} else { } else {
$DB->query(" $DB->query("
UPDATE pm_conversations_users UPDATE pm_conversations_users
SET SET
InInbox='1', InInbox = '1',
UnRead='1', UnRead = '1',
ReceivedDate='".sqltime()."' ReceivedDate = '".sqltime()."'
WHERE UserID='$ToID' WHERE UserID = '$ToID'
AND ConvID='$ConvID'"); AND ConvID = '$ConvID'");
$DB->query(" $DB->query("
UPDATE pm_conversations_users UPDATE pm_conversations_users
SET SET
InSentbox='1', InSentbox = '1',
SentDate='".sqltime()."' SentDate = '".sqltime()."'
WHERE UserID='$FromID' WHERE UserID = '$FromID'
AND ConvID='$ConvID'"); AND ConvID = '$ConvID'");
} }
$DB->query(" $DB->query("
INSERT INTO pm_messages INSERT INTO pm_messages
@ -186,20 +188,20 @@ function send_pm($ToID, $FromID, $Subject, $Body, $ConvID = '') {
/*$DB->query(" /*$DB->query("
SELECT UnRead SELECT UnRead
FROM pm_conversations_users FROM pm_conversations_users
WHERE ConvID='$ConvID' WHERE ConvID = '$ConvID'
AND UserID='$ToID'"); AND UserID = '$ToID'");
*/ */
$DB->query(" $DB->query("
SELECT COUNT(ConvID) SELECT COUNT(ConvID)
FROM pm_conversations_users FROM pm_conversations_users
WHERE UnRead = '1' WHERE UnRead = '1'
AND UserID='$ToID' AND UserID = '$ToID'
AND InInbox = '1'"); AND InInbox = '1'");
list($UnRead) = $DB->next_record(MYSQLI_BOTH, FALSE); list($UnRead) = $DB->next_record(MYSQLI_BOTH, FALSE);
$Cache->cache_value('inbox_new_'.$ToID, $UnRead); $Cache->cache_value("inbox_new_$ToID", $UnRead);
//if ($UnRead == 0) { //if ($UnRead == 0) {
// $Cache->increment('inbox_new_'.$ToID); // $Cache->increment("inbox_new_$ToID");
//} //}
return $ConvID; return $ConvID;
} }
@ -216,20 +218,26 @@ function display_str($Str) {
} }
if ($Str != '' && !is_number($Str)) { if ($Str != '' && !is_number($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;
} }

View File

@ -142,7 +142,7 @@
<div class="head"><strong>Stats</strong></div> <div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<li>Artists: <?=number_format($NumArtists)?></li> <li>Artists: <?=number_format($NumArtists)?></li>
<li>Subscribers: <?=number_format(count($Subscribers))?></li> <li>Subscribers: <?=number_format((int)$Subscribers)?></li>
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li> <li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
<li>Last updated: <?=time_diff($Updated)?></li> <li>Last updated: <?=time_diff($Updated)?></li>
</ul> </ul>
@ -288,5 +288,5 @@
<? <?
View::show_footer(); View::show_footer();
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600); $Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)), 3600);
?> ?>

View File

@ -385,7 +385,7 @@
<? if (!empty($TopArtists)) { ?> <? if (!empty($TopArtists)) { ?>
<li>Artists: <?=number_format(count($TopArtists))?></li> <li>Artists: <?=number_format(count($TopArtists))?></li>
<? } ?> <? } ?>
<li>Subscribers: <?=number_format(count($Subscribers))?></li> <li>Subscribers: <?=number_format((int)$Subscribers)?></li>
<li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li> <li>Built by <?=number_format(count($Users))?> user<?=(count($Users) > 1 ? 's' : '')?></li>
<li>Last updated: <?=time_diff($Updated)?></li> <li>Last updated: <?=time_diff($Updated)?></li>
</ul> </ul>
@ -569,5 +569,5 @@
<? <?
View::show_footer(); View::show_footer();
$Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600); $Cache->cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)), 3600);
?> ?>

View File

@ -7,7 +7,7 @@
<h3 id="forums">Donation Complete</h3> <h3 id="forums">Donation Complete</h3>
</div> </div>
<div class="box pad" style="padding: 10px 10px 10px 20px;"> <div class="box pad" style="padding: 10px 10px 10px 20px;">
<p>Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a <img src="<?=(STATIC_SERVER)?>common/symbols/donor.png" alt="Donor" />.</p> <p>Thank you for your donation! If this is your first time donating, you will have received two (2) invitations and a <img src="<?=(STATIC_SERVER)?>common/symbols/donor.png" alt="Donor" />.</p>
</div> </div>
</div> </div>
<? View::show_footer();?> <? View::show_footer();?>

View File

@ -689,7 +689,7 @@ 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">
<div id="release_<?=$TorrentID?>" class="no_overflow"> <div id="release_<?=$TorrentID?>" class="no_overflow">
<blockquote> <blockquote>
@ -702,7 +702,7 @@ function filelist($Str) {
<? } <? }
} }
if (($Seeders === 0 &&$LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?> if (($Seeders === 0 && $LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
<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>
<? } <? }
@ -715,14 +715,14 @@ function filelist($Str) {
</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>
@ -783,15 +783,15 @@ function filelist($Str) {
</div> </div>
<? <?
} }
$Collages = $Cache->get_value('torrent_collages_'.$GroupID); $Collages = $Cache->get_value("torrent_collages_$GroupID");
if (!is_array($Collages)) { if (!is_array($Collages)) {
$DB->query(" $DB->query("
SELECT c.Name, c.NumTorrents, c.ID SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c FROM collages AS c
JOIN collages_torrents AS ct ON ct.CollageID=c.ID JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE ct.GroupID='$GroupID' WHERE ct.GroupID = '$GroupID'
AND Deleted='0' AND Deleted = '0'
AND CategoryID!='0'"); AND CategoryID != '0'");
$Collages = $DB->to_array(); $Collages = $DB->to_array();
$Cache->cache_value('torrent_collages_'.$GroupID, $Collages, 3600 * 6); $Cache->cache_value('torrent_collages_'.$GroupID, $Collages, 3600 * 6);
} }
@ -833,17 +833,17 @@ function filelist($Str) {
<? <?
} }
$PersonalCollages = $Cache->get_value('torrent_collages_personal_'.$GroupID); $PersonalCollages = $Cache->get_value("torrent_collages_personal_$GroupID");
if (!is_array($PersonalCollages)) { if (!is_array($PersonalCollages)) {
$DB->query(" $DB->query("
SELECT c.Name, c.NumTorrents, c.ID SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c FROM collages AS c
JOIN collages_torrents AS ct ON ct.CollageID=c.ID JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE ct.GroupID='$GroupID' WHERE ct.GroupID = '$GroupID'
AND Deleted='0' AND Deleted = '0'
AND CategoryID='0'"); AND CategoryID = '0'");
$PersonalCollages = $DB->to_array(false, MYSQLI_NUM); $PersonalCollages = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('torrent_collages_personal_'.$GroupID, $PersonalCollages, 3600 * 6); $Cache->cache_value("torrent_collages_personal_$GroupID", $PersonalCollages, 3600 * 6);
} }
if (count($PersonalCollages) > 0) { if (count($PersonalCollages) > 0) {
@ -894,14 +894,14 @@ function filelist($Str) {
// --- Comments --- // --- Comments ---
// gets the amount of comments for this group // gets the amount of comments for this group
$Results = $Cache->get_value('torrent_comments_'.$GroupID); $Results = $Cache->get_value("torrent_comments_$GroupID");
if ($Results === false) { if ($Results === false) {
$DB->query(" $DB->query("
SELECT COUNT(c.ID) SELECT COUNT(c.ID)
FROM torrents_comments as c FROM torrents_comments as c
WHERE c.GroupID = '$GroupID'"); WHERE c.GroupID = '$GroupID'");
list($Results) = $DB->next_record(); list($Results) = $DB->next_record();
$Cache->cache_value('torrent_comments_'.$GroupID, $Results, 0); $Cache->cache_value("torrent_comments_$GroupID", $Results, 0);
} }
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) { if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
@ -911,9 +911,9 @@ function filelist($Str) {
WHERE GroupID = $GroupID WHERE GroupID = $GroupID
AND ID <= $_GET[postid]"); AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record(); list($PostNum) = $DB->next_record();
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum); list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
} else { } else {
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results); list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $Results);
} }
//Get the cache catalogue //Get the cache catalogue
@ -923,7 +923,7 @@ function filelist($Str) {
//---------- Get some data to start processing //---------- Get some data to start processing
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page // Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('torrent_comments_'.$GroupID.'_catalogue_'.$CatalogueID); $Catalogue = $Cache->get_value("torrent_comments_{$GroupID}_catalogue_$CatalogueID");
if ($Catalogue === false) { if ($Catalogue === false) {
$DB->query(" $DB->query("
SELECT SELECT
@ -935,12 +935,12 @@ function filelist($Str) {
c.EditedTime, c.EditedTime,
u.Username u.Username
FROM torrents_comments as c FROM torrents_comments as c
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID LEFT JOIN users_main AS u ON u.ID = c.EditedUserID
WHERE c.GroupID = '$GroupID' WHERE c.GroupID = '$GroupID'
ORDER BY c.ID ORDER BY c.ID
LIMIT $CatalogueLimit"); LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC); $Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
$Cache->cache_value('torrent_comments_'.$GroupID.'_catalogue_'.$CatalogueID, $Catalogue, 0); $Cache->cache_value("torrent_comments_{$GroupID}_catalogue_$CatalogueID", $Catalogue, 0);
} }
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue //This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
@ -969,9 +969,9 @@ function filelist($Str) {
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>"> <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
<div style="float: left;"><a class="post_id" href="torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a> <div style="float: left;"><a class="post_id" href="torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
<strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a> - <a href="#quickpost" onclick="Quote('<?=$PostID?>', '<?=$Username?>');" class="brackets">Quote</a>
<? if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> <? if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?>
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>', '<?=$Key?>');" class="brackets">Edit</a>
<? } <? }
if (check_perms('site_moderate_forums')) { ?> if (check_perms('site_moderate_forums')) { ?>
- <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a>
@ -1015,7 +1015,7 @@ function filelist($Str) {
<a href="#content<?=$PostID?>" onclick="LoadEdit('torrents', <?=$PostID?>, 1); return false;">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit('torrents', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?> <?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime, 2, true, true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>

View File

@ -111,6 +111,8 @@
$DB->query("DELETE FROM collages_torrents WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'"); $DB->query("DELETE FROM collages_torrents WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID); $Cache->delete_value('collage_'.$CollageID);
} }
$Cache->delete_value('torrent_collages_'.$NewGroupID);
$Cache->delete_value('torrent_collages_personal_'.$NewGroupID);
//Requests //Requests
$DB->query("SELECT ID FROM requests WHERE GroupID='$OldGroupID'"); $DB->query("SELECT ID FROM requests WHERE GroupID='$OldGroupID'");

View File

@ -35,9 +35,10 @@
$Name .= $GroupName; $Name .= $GroupName;
$DB->query(" $DB->query("
SELECT uid, tstamp SELECT uid, MAX(tstamp) AS tstamp
FROM xbt_snatched FROM xbt_snatched
WHERE fid='$TorrentID' WHERE fid='$TorrentID'
GROUP BY uid
ORDER BY tstamp DESC ORDER BY tstamp DESC
LIMIT 10"); LIMIT 10");
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {