Empty commit

This commit is contained in:
Git 2013-02-22 08:00:24 +00:00
parent 57b88f03c1
commit c2746069c1
286 changed files with 1982 additions and 1979 deletions

View File

@ -38,17 +38,17 @@ terms of Sections 1 and 2 above provided that you also do one of the
following:
3.1: Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above on
code, which must be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
3.2: Accompany it with a written offer, valid for at least one year, to
give any third party, for a charge no more than your cost of physically
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1 and
2 above on a medium customarily used for software interchange; or,
3.3: Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only for
distribute corresponding source code. (This alternative is allowed only for
noncommercial distribution and only if you received the Software in object
code or executable form with such an offer, in accord with Subsection 3.2
above.)

View File

@ -5,16 +5,16 @@ INSTALLATION NOTES
2. Run gazelle.sql (preferably as root) to create the database, the table, and the default data.
3. Install sphinx - we recommend you use the included sphinx.conf
For documentation, read http://www.sphinxsearch.com/docs/current.html
After you've installed sphinx, create the indices:
/usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --all
4. Move classes/config.template to classes/config.php. Edit the config.php as needed.
4. Move classes/config.template to classes/config.php. Edit the config.php as needed.
We use http://grc.com/passwords.html for our passwords - you'll be generating a lot of these.
5. Sign up. The first user is made a SysOp!
6. Set up cron jobs. You need a cron job for the schedule, a cron job for
the peerupdate (all groups are cached, but the peer counts change often,
so peerupdate is a script to update them), and the two sphinx indices.
6. Set up cron jobs. You need a cron job for the schedule, a cron job for
the peerupdate (all groups are cached, but the peer counts change often,
so peerupdate is a script to update them), and the two sphinx indices.
These are our cron jobs:
0,15,30,45 * * * * /usr/local/bin/php /var/www/vhosts/what/schedule.php SCHEDULE_KEY >> /root/schedule.log

View File

@ -1,2 +1,2 @@
<?
<?
require('classes/script_start.php');

View File

@ -11,7 +11,7 @@ function flush() {
$Aliases = $DB->to_array('Alias');
$Cache->cache_value('wiki_aliases', $Aliases, 3600*24*14);
}
function to_id($Alias) {
global $Cache, $DB;
$Aliases = $Cache->get_value('wiki_aliases');
@ -26,7 +26,7 @@ function to_id($Alias) {
function flush() {
}
function to_id($Alias) {
global $DB;
$Alias = $this->convert($Alias);

View File

@ -155,7 +155,7 @@ public function delete_value($Key) {
}
$this->Time+=(microtime(true)-$StartTime)*1000;
}
public function increment_value($Key,$Value=1) {
$StartTime=microtime(true);
$this->increment($Key,$Value);

View File

@ -4,7 +4,7 @@ class GOOGLE_CHARTS {
protected $Labels = array();
protected $Data = array();
protected $Options = array();
public function __construct($Type, $Width, $Height, $Options) {
if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
trigger_error('Tried to make chart too large.');
@ -12,7 +12,7 @@ public function __construct($Type, $Width, $Height, $Options) {
$this->URL .= '?cht='.$Type.'&amp;chs='.$Width.'x'.$Height;
$this->Options = $Options;
}
protected function encode($Number) {
if ($Number == -1) {
return '__';
@ -20,15 +20,15 @@ protected function encode($Number) {
$CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
return $CharKey[floor($Number/64)].$CharKey[floor($Number%64)];
}
public function color($Colors) {
$this->URL .= '&amp;chco='.$Colors;
}
public function lines($Thickness, $Solid=1, $Blank=0) {
$this->URL .= '&amp;chls='.$Thickness.','.$Solid.','.$Blank;
}
public function title($Title, $Color='', $Size='') {
$this->URL .= '&amp;chtt='.str_replace(array(' ',"\n"), array('+','|'), $Title);
if (!empty($Color)) {
@ -38,7 +38,7 @@ public function title($Title, $Color='', $Size='') {
$this->URL .= ','.$Size;
}
}
public function legend($Items, $Placement='') {
$this->URL .= '&amp;chdl='.str_replace(' ', '+', implode('|', $Items));
if (!empty($Placement)) {
@ -48,24 +48,24 @@ public function legend($Items, $Placement='') {
$this->URL .= '&amp;chdlp='.$Placement;
}
}
public function add($Label, $Data) {
if ($Label !== false) {
$this->Labels[] = $Label;
}
$this->Data[] = $Data;
}
public function grid_lines($SpacingX=0, $SpacingY=-1, $Solid=1, $Blank=1) {
//Can take 2 more parameters for offset, but we're not bothering with that right now
$this->URL .= '&amp;chg='.$SpacingX.','.$SpacingY.','.$Solid.','.$Blank.'';
}
public function transparent() {
$this->URL .= '&amp;chf=bg,s,FFFFFF00';
}
public function url() {
return $this->URL;
}
@ -79,7 +79,7 @@ public function __construct ($Width, $Height, $Options=array()) {
public function color ($Color) {
$this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
}
public function generate() {
$Max = max($this->Data);
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
@ -109,12 +109,12 @@ public function generate() {
sort($this->Data);
$this->Data = array_reverse($this->Data);
}
$Data = array();
$Labels = $this->Labels;
$OtherPercentage = 0.00;
$OtherData = 0;
foreach ($this->Data as $Key => $Value) {
$ThisPercentage = number_format(($Value/$Sum)*100, 2);
$ThisData = ($Value/$Sum)*4095;
@ -152,7 +152,7 @@ public function __construct ($Base, $Width, $Height, $Options=array()) {
public function color ($Color) {
$this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
}
public function generate() {
$Max = max($this->Data);
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
@ -175,7 +175,7 @@ public function add($Label, $Data) {
}
$this->Data[] = $Data;
}
public function generate() {
$Count = count($this->Data);
$Height = (30*$Count)+20;

View File

@ -14,7 +14,7 @@ interface COOKIE_INTERFACE {
public function get($Key);
public function set($Key,$Value,$Seconds,$LimitAccess);
public function del($Key);
public function flush();
}
*/
@ -22,23 +22,23 @@ public function flush();
class COOKIE /*implements COOKIE_INTERFACE*/ {
const LIMIT_ACCESS = true; //If true, blocks JS cookie API access by default (can be overridden case by case)
const PREFIX = ''; //In some cases you may desire to prefix your cookies
public function get($Key) {
if (!isset($_COOKIE[SELF::PREFIX.$Key])) {
return false;
}
return $_COOKIE[SELF::PREFIX.$Key];
}
//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) {
setcookie(SELF::PREFIX.$Key,$Value,time()+$Seconds,'/',SITE_URL,$_SERVER['SERVER_PORT'] === '443',$LimitAccess,false);
}
public function del($Key) {
setcookie(SELF::PREFIX.$Key,'',time()-24*3600); //3600 vs 1 second to account for potential clock desyncs
}
public function flush() {
$Cookies = array_keys($_COOKIE);
foreach ($Cookies as $Cookie) {

View File

@ -17,7 +17,7 @@ function check_file($Type, $Name) {
function check_name($Name) {
global $keywords;
foreach ($keywords as &$value) {
foreach ($keywords as &$value) {
if(preg_match('/'.$value.'/i', $Name)) {
forbidden_error($Name);
}

View File

@ -33,7 +33,7 @@ class Format
'lossy master approved' => 'tl_approved tl_lossy_master',
'lossy web approved' => 'tl_approved tl_lossy_web'
);
/**
* Shorten a string
*
@ -499,9 +499,9 @@ public static function is_utf8($Str) {
/**
* Modified accessor for the $TorrentLabels array
*
*
* Converts $text to lowercase and strips non-word characters
*
*
* @param string $text Search string
* @return string CSS class(es)
*/

View File

@ -8,7 +8,7 @@ class IMAGE {
var $FontSize = 10;
var $Font = '';
var $TextAngle = 0;
function create($Width, $Height) {
$this->Image = imagecreate($Width, $Height);
$this->Font = SERVER_ROOT.'/classes/fonts/VERDANA.TTF';
@ -16,11 +16,11 @@ function create($Width, $Height) {
imageantialias($this->Image, true);
}
}
function color($Red, $Green, $Blue, $Alpha=0){
return imagecolorallocatealpha($this->Image, $Red, $Green, $Blue, $Alpha);
}
function line($x1, $y1, $x2, $y2, $Color, $Thickness = 1){
if($Thickness == 1){
return imageline($this->Image, $x1, $y1, $x2, $y2, $Color);
@ -40,19 +40,19 @@ function line($x1, $y1, $x2, $y2, $Color, $Thickness = 1){
imagefilledpolygon($this->Image, $Points, 4, $Color);
return imagepolygon($this->Image, $Points, 4, $Color);
}
function ellipse($x, $y, $Width, $Height, $Color){
return imageEllipse($this->Image, $x, $y, $Width, $Height, $Color);
}
function text($x, $y, $Color, $Text){
return imagettftext ($this->Image, $this->FontSize,$this->TextAngle, $x, $y, $Color, $this->Font, $Text);
}
function make_png($FileName = NULL){
return imagepng($this->Image, $FileName);
}
}
?>

View File

@ -5,14 +5,14 @@
**/
$blacklist = array("tinypic", "dsimg");
/**
* Checks if image host is good, otherwise displays an error.
*/
function check_imagehost($url) {
global $blacklist;
foreach ($blacklist as &$value) {
foreach ($blacklist as &$value) {
if(strpos(strtolower($url), $value)) {
$parsed_url = parse_url($url);
error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
@ -20,7 +20,7 @@ function check_imagehost($url) {
}
}
}
/**
* The main function, called to get the thumbnail url.
*/

View File

@ -9,7 +9,7 @@
class INVITE_TREE {
var $UserID = 0;
var $Visible = true;
// Set things up
function INVITE_TREE($UserID, $Options = array()){
$this->UserID = $UserID;
@ -17,7 +17,7 @@ function INVITE_TREE($UserID, $Options = array()){
$this->Visible = false;
}
}
function make_tree() {
$UserID = $this->UserID;
global $DB;
@ -39,7 +39,7 @@ function make_tree() {
} else {
$MaxPosition = false;
}
$TreeQuery = $DB->query("SELECT
$TreeQuery = $DB->query("SELECT
it.UserID,
Enabled,
PermissionID,
@ -57,9 +57,9 @@ function make_tree() {
($MaxPosition ? " AND TreePosition<$MaxPosition" : "")."
AND TreeLevel>$TreeLevel
ORDER BY TreePosition");
$PreviousTreeLevel = $TreeLevel;
// Stats for the summary
$MaxTreeLevel = $TreeLevel; // The deepest level (this changes)
$OriginalTreeLevel = $TreeLevel; // The level of the user we're viewing
@ -73,30 +73,30 @@ function make_tree() {
$TotalDownload = 0;
$TopLevelUpload = 0;
$TopLevelDownload = 0;
$ClassSummary = array();
global $Classes;
foreach ($Classes as $ClassID => $Val) {
$ClassSummary[$ClassID] = 0;
}
// We store this in an output buffer, so we can show the summary at the top without having to loop through twice
ob_start();
while(list($ID, $Enabled, $Class, $Donor, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = $DB->next_record()){
while(list($ID, $Enabled, $Class, $Donor, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = $DB->next_record()){
// Do stats
$Count++;
if($TreeLevel > $MaxTreeLevel){
$MaxTreeLevel = $TreeLevel;
}
if($TreeLevel == $BaseTreeLevel){
$Branches++;
$TopLevelUpload += $Uploaded;
$TopLevelDownload += $Downloaded;
}
$ClassSummary[$Class]++;
if($Enabled == 2){
$DisabledCount++;
@ -104,7 +104,7 @@ function make_tree() {
if($Donor){
$DonorCount++;
}
// Manage tree depth
if($TreeLevel > $PreviousTreeLevel){
for($i = 0; $i<$TreeLevel-$PreviousTreeLevel; $i++){ echo "<ul class=\"invitetree\"><li>"; }
@ -133,7 +133,7 @@ function make_tree() {
&nbsp;Paranoia: <strong><?=number_format($Paranoia) ?></strong>
<?
}
?>
?>
<? $PreviousTreeLevel = $TreeLevel;
$DB->set_query_id($TreeQuery);
@ -143,7 +143,7 @@ function make_tree() {
for($i = 0; $i<$PreviousTreeLevel-$OriginalTreeLevel; $i++){ $Tree .= "</li></ul>\n"; }
if($Count){
?> <p style="font-weight: bold;">
This tree has <?=$Count?> entries, <?=$Branches?> branches, and a depth of <?=$MaxTreeLevel - $OriginalTreeLevel?>.
It has
@ -152,15 +152,15 @@ function make_tree() {
foreach ($ClassSummary as $ClassID => $ClassCount) {
if($ClassCount == 0) { continue; }
$LastClass = Users::make_class_string($ClassID);
if($ClassCount>1) {
if($ClassCount>1) {
if($LastClass == "Torrent Celebrity") {
$LastClass = 'Torrent Celebrities';
} else {
$LastClass.='s';
$LastClass.='s';
}
}
$LastClass= $ClassCount.' '.$LastClass.' (' . number_format(($ClassCount/$Count)*100) . '%)';
$ClassStrings []= $LastClass;
}
if(count($ClassStrings)>1){
@ -183,13 +183,13 @@ function make_tree() {
if($DonorCount == 0) { echo '0%)'; }
else { echo number_format(($DonorCount/$Count)*100) . '%)';}
echo '. </p>';
echo '<p style="font-weight: bold;">';
echo 'The total amount uploaded by the entire tree was '.Format::get_size($TotalUpload);
echo '; the total amount downloaded was '.Format::get_size($TotalDownload);
echo '; and the total ratio is '.Format::get_ratio_html($TotalUpload, $TotalDownload).'. ';
echo '</p>';
echo '<p style="font-weight: bold;">';
echo 'The total amount uploaded by direct invitees (the top level) was '.Format::get_size($TopLevelUpload);
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
@ -211,7 +211,7 @@ function make_tree() {
echo '</p>';
}
}
?>
<br />
<?=$Tree?>

View File

@ -168,7 +168,7 @@ public function header ()
*/
public function footer ()
{
if ($this->HasTorrents) :
if ($this->HasTorrents) :
?>
</tbody>

View File

@ -88,7 +88,7 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
}
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
list($SenderName) = $DB->next_record();
foreach($ToID as $ID) {

View File

@ -145,17 +145,17 @@ class DB_MYSQL {
protected $Row;
protected $Errno = 0;
protected $Error = '';
public $Queries = array();
public $Time = 0.0;
protected $Database = '';
protected $Server = '';
protected $User = '';
protected $Pass = '';
protected $Port = 0;
protected $Socket = '';
function __construct($Database = SQLDB, $User = SQLLOGIN, $Pass = SQLPASS, $Server = SQLHOST, $Port = SQLPORT, $Socket = SQLSOCK) {
$this->Database = $Database;
$this->Server = $Server;
@ -169,7 +169,7 @@ function halt($Msg) {
global $LoggedUser, $Cache, $Debug, $argv;
$DBError='MySQL: '.strval($Msg).' SQL error: '.strval($this->Errno).' ('.strval($this->Error).')';
if ($this->Errno == 1194) { send_irc('PRIVMSG '.ADMIN_CHAN.' :'.$this->Error); }
/*if ($this->Errno == 1194) {
/*if ($this->Errno == 1194) {
preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches);
} */
$Debug->analysis('!dev DB Error',$DBError,3600*24);
@ -207,7 +207,7 @@ function query($Query,$AutoHandle=1) {
}
$Debug->analysis('Non-Fatal Deadlock:',$Query,3600*24);
trigger_error("Database deadlock, attempt $i");
sleep($i*rand(2, 5)); // Wait longer as attempts increase
}
$QueryEndTime=microtime(true);
@ -319,10 +319,14 @@ function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) {
function to_pair($KeyField, $ValField, $Escape = true) {
$Return = array();
while ($Row = mysqli_fetch_array($this->QueryID)) {
if ($Escape !== false) {
$Row = Misc::display_array($Row[$ValField], $Escape);
if ($Escape) {
$Key = display_str($Row[$KeyField]);
$Val = display_str($Row[$ValField]);
} else {
$Key = $Row[$KeyField];
$Val = $Row[$ValField];
}
$Return[$Row[$KeyField]] = $Row[$ValField];
$Return[$Key] = $Val;
}
mysqli_data_seek($this->QueryID, 0);
return $Return;
@ -342,7 +346,7 @@ function set_query_id(&$ResultSet){
$this->QueryID = $ResultSet;
$this->Row = 0;
}
function get_query_id() {
return $this->QueryID;
}

View File

@ -44,7 +44,7 @@
define("PARANOIA_ALLOWED", 1);
define("PARANOIA_OVERRIDDEN", 2);
function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
global $LoggedUser, $Classes;
if ($Property == false) {
@ -68,8 +68,8 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
$May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia);
if($May)
return PARANOIA_ALLOWED;
if(check_perms('users_override_paranoia', $UserClass))
if(check_perms('users_override_paranoia', $UserClass))
return PARANOIA_OVERRIDDEN;
$Override=false;
switch ($Property) {
@ -78,20 +78,20 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
case 'uploaded':
case 'lastseen':
if(check_perms('users_mod', $UserClass))
return PARANOIA_OVERRIDDEN;
return PARANOIA_OVERRIDDEN;
break;
case 'snatched': case 'snatched+':
if(check_perms('users_view_torrents_snatchlist', $UserClass))
if(check_perms('users_view_torrents_snatchlist', $UserClass))
return PARANOIA_OVERRIDDEN;
break;
case 'uploads': case 'uploads+':
case 'seeding': case 'seeding+':
case 'leeching': case 'leeching+':
if(check_perms('users_view_seedleech', $UserClass))
if(check_perms('users_view_seedleech', $UserClass))
return PARANOIA_OVERRIDDEN;
break;
case 'invitedcount':
if(check_perms('users_view_invites', $UserClass))
if(check_perms('users_view_invites', $UserClass))
return PARANOIA_OVERRIDDEN;
break;
}

View File

@ -20,19 +20,19 @@ function proxyCheck($IP) {
if (strlen($IP) < strlen($AllowedProxies[$i])) {
continue;
}
//since we're matching bit for bit iterating from the start
for ($j=0,$jl=strlen($IP);$j<$jl;++$j) {
//completed iteration and no inequality
if ($j == $jl-1 && $IP[$j] === $AllowedProxies[$i][$j]) {
return true;
}
//wildcard
if ($AllowedProxies[$i][$j] === '*') {
return true;
}
//inequality found
if ($IP[$j] !== $AllowedProxies[$i][$j]) {
break;

View File

@ -10,30 +10,30 @@ class SPHINX_SEARCH extends SphinxClient {
public $Queries = array();
public $Time = 0.0;
public $Filters = array();
function SPHINX_SEARCH() {
parent::__construct();
$this->SetServer(SPHINX_HOST, SPHINX_PORT);
$this->SetMatchMode(SPH_MATCH_EXTENDED2);
}
/****************************************************************
/--- Search function --------------------------------------------
This function queries sphinx for whatever is in $Query, in
This function queries sphinx for whatever is in $Query, in
extended2 mode. It then fetches the records for each primary key
from memcached (by joining $CachePrefix and the primary key), and
fetches the fields needed ($ReturnData) from the memcached
fetches the fields needed ($ReturnData) from the memcached
result.
Any keys not found in memcached are then queried in MySQL, using
Any keys not found in memcached are then queried in MySQL, using
$SQL. They are then cached, and merged with the memcached matches
and returned.
$Query - sphinx query
$CachePrefix - Prefix for memcache key (no underscore)
$CacheLength - How long to store data in the cache, if it's found by MySQL
$ReturnData - Array of keys to the array in memcached to return.
$ReturnData - Array of keys to the array in memcached to return.
If empty, return all.
$SQL - SQL query to fetch results not found in memcached
- Should take the format of:
@ -41,9 +41,9 @@ function SPHINX_SEARCH() {
where %ids will be replaced by a list of IDs not found in memcached
$IDColumn - The primary key of the SQL table - must be the
same primary key returned by sphinx!
****************************************************************/
function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(), $SQL = '', $IDColumn='ID') {
global $Cache, $DB;
$QueryStartTime=microtime(true);
@ -59,7 +59,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$this->Queries[]=array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime)*1000);
$this->Time+=($QueryEndTime-$QueryStartTime)*1000;
if($Result === false) {
if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
@ -67,19 +67,19 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
}
send_irc('PRIVMSG '.LAB_CHAN.' :Search for "'.$Query.'" ('.str_replace("\n",'',print_r($this->Filters, true)).') failed: '.$this->GetLastError());
}
$this->TotalResults = $Result['total_found'];
$this->SearchTime = $Result['time'];
if(empty($Result['matches'])) {
return false;
}
$Matches = $Result['matches'];
$MatchIDs = array_keys($Matches);
$NotFound = array();
$Skip = array();
if(!empty($ReturnData)) {
@ -87,7 +87,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
} else {
$AllFields = true;
}
foreach($MatchIDs as $Match) {
$Matches[$Match] = $Matches[$Match]['attrs'];
if(!empty($CachePrefix)) {
@ -120,7 +120,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$Matches[$Match] = array_merge($Matches[$Match], $Data);
}
}
if($SQL!='') {
if(!empty($NotFound)) {
$DB->query(str_replace('%ids', implode(',',$NotFound), $SQL));
@ -132,21 +132,21 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
} else {
$Matches = array('matches'=>$Matches,'notfound'=>$NotFound);
}
return $Matches;
}
function limit($Start, $Length) {
$Start = (int)$Start;
$Length = (int)$Length;
$this->SetLimits($Start, $Length, $Start+$Length);
}
function set_index($Index) {
$this->Index = $Index;
}
function set_filter($Name, $Vals, $Exclude=false) {
foreach($Vals as $Val) {
if($Exclude) {
@ -157,12 +157,12 @@ function set_filter($Name, $Vals, $Exclude=false) {
}
$this->SetFilter($Name, $Vals, $Exclude);
}
function set_filter_range($Name, $Min, $Max, $Exclude) {
$this->Filters[$Name] = array($Min.'-'.$Max);
$this->SetFilterRange($Name, $Min, $Max, $Exclude);
}
function escape_string($String) {
return strtr($String, array(
'('=>'\(',
@ -182,7 +182,7 @@ function escape_string($String) {
'$'=>'\$',
'='=>'\='));
}
}
?>

View File

@ -23,7 +23,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
}
if($TimeStamp == 0) { return 'Never'; }
$Time = time()-$TimeStamp;
// If the time is negative, then it expires in the future.
if($Time < 0) {
$Time = -$Time;
@ -77,7 +77,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
if ($Return!="") {
$Return.=', ';
}
if ($Weeks>1) {
if ($Weeks>1) {
$Return.=$Weeks.' weeks';
} else {
$Return.=$Weeks.' week';
@ -120,7 +120,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
}
$Levels--;
}
if($Return == '') {
$Return = 'Just now';
} elseif (!isset($HideAgo)) {
@ -130,7 +130,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
if ($Lowercase) {
$Return = strtolower($Return);
}
if ($Span) {
return '<span class="time" title="'.date('M d Y, H:i', $TimeStamp).'">'.$Return.'</span>';
} else {

View File

@ -11,7 +11,7 @@
There are 4 data types in bencode:
* String
* Int
* List - array without keys
* List - array without keys
- like array('value', 'value 2', 'value 3', 'etc')
* Dictionary - array with string keys
- like array['key 1'] = 'value 1'; array['key 2'] = 'value 2';
@ -25,22 +25,22 @@
- Stored as php strings. Not difficult to remember.
* Integers
- Stored as php ints
- Stored as php ints
- must be casted with (int)
* Lists
- Stored as a BENCODE_LIST object.
- Stored as a BENCODE_LIST object.
- The actual list is in BENCODE_LIST::$Val, as an array with incrementing integer indices
- The list in BENCODE_LIST::$Val is populated by the BENCODE_LIST::dec() function
* Dictionaries
- Stored as a BENCODE_DICT object.
- Stored as a BENCODE_DICT object.
- The actual list is in BENCODE_DICT::$Val, as an array with string indices
- The list in BENCODE_DICT::$Val is populated by the BENCODE_DICT::dec() function
//----- BENCODE_* Objects -----//
Lists and dictionaries are stored as objects. They each have the following
Lists and dictionaries are stored as objects. They each have the following
functions:
* decode(Type, $Key)
@ -59,15 +59,15 @@ functions:
- Relies mostly on the encode() function
Finally, as all torrents are just large dictionaries, the TORRENT class extends
the BENCODE_DICT class.
the BENCODE_DICT class.
*******************************************************************************/
class BENCODE {
var $Val; // Decoded array
var $Pos = 1; // Pointer that indicates our position in the string
var $Str = ''; // Torrent string
function __construct($Val, $IsParsed = false){
if(!$IsParsed) {
$this->Str = $Val;
@ -76,8 +76,8 @@ function __construct($Val, $IsParsed = false){
$this->Val = $Val;
}
}
// Decode an element based on the type. The type is really just an indicator.
// Decode an element based on the type. The type is really just an indicator.
function decode($Type, $Key){
if(is_number($Type)) { // Element is a string
// Get length of string
@ -87,24 +87,24 @@ function decode($Type, $Key){
$StrLen.=$this->Str[$this->Pos];
}
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
$this->Pos+=$StrLen;
$this->Pos+=2;
} elseif($Type == 'i') { // Element is an int
$this->Pos++;
// Find end of integer (first occurance of 'e' after position)
$End = strpos($this->Str, 'e', $this->Pos);
$End = strpos($this->Str, 'e', $this->Pos);
// Get the integer, and - IMPORTANT - cast it as an int, so we know later that it's an int and not a string
$this->Val[$Key] = (int)substr($this->Str, $this->Pos, $End-$this->Pos);
$this->Val[$Key] = (int)substr($this->Str, $this->Pos, $End-$this->Pos);
$this->Pos = $End+1;
} elseif($Type == 'l') { // Element is a list
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
$this->Pos += $this->Val[$Key]->Pos;
} elseif($Type == 'd') { // Element is a dictionary
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
$this->Pos += $this->Val[$Key]->Pos;
@ -112,12 +112,12 @@ function decode($Type, $Key){
if (!empty($this->Val[$Key]->Val)) {
ksort($this->Val[$Key]->Val);
}
} else {
die('Invalid torrent file');
}
}
function encode($Val){
if(is_int($Val)) { // Integer
return 'i'.$Val.'e';
@ -143,7 +143,7 @@ function enc(){
}
return $Str.'e';
}
// Decode a list
function dec(){
$Key = 0; // Array index
@ -152,13 +152,13 @@ function dec(){
$Type = $this->Str[$this->Pos];
// $Type now indicates what type of element we're dealing with
// It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
if($Type == 'e') { // End of list
$this->Pos += 1;
unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
return;
}
// Decode the bencoded element.
// This function changes $this->Pos and $this->Val, so you don't have to.
$this->decode($Type, $Key);
@ -180,22 +180,22 @@ function enc(){
}
return $Str.'e';
}
// Decode a dictionary
function dec(){
$Length = strlen($this->Str);
while($this->Pos<$Length) {
if($this->Str[$this->Pos] == 'e') { // End of dictionary
$this->Pos += 1;
unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
return;
}
// Get the dictionary key
// Length of the key, in bytes
$KeyLen = $this->Str[$this->Pos];
// Allow for multi-digit lengths
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
$this->Pos++;
@ -204,21 +204,21 @@ function dec(){
// $this->Pos is now on the last letter of the key length
// Adding 2 brings it past that character and the ':' to the beginning of the string
$this->Pos+=2;
// Get the name of the key
$Key = substr($this->Str, $this->Pos, $KeyLen);
$Key = substr($this->Str, $this->Pos, $KeyLen);
// Move the position past the key to the beginning of the element
$this->Pos+=$KeyLen;
$Type = $this->Str[$this->Pos];
// $Type now indicates what type of element we're dealing with
// It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
// Decode the bencoded element.
// This function changes $this->Pos and $this->Val, so you don't have to.
$this->decode($Type, $Key);
}
return true;
}
@ -230,12 +230,12 @@ function dump() {
// Convenience function used for testing and figuring out how we store the data
print_r($this->Val);
}
function dump_data() {
// Function which serializes $this->Val for storage
return base64_encode(serialize($this->Val));
}
/*
To use this, please remove the announce-list unset in make_private and be sure to still set_announce_url for backwards compatibility
function set_multi_announce() {
@ -249,14 +249,14 @@ function set_multi_announce() {
$this->Val['announce-list'] = $AnnounceList;
}
*/
function set_announce_url($Announce) {
$this->Val['announce'] = $Announce;
ksort($this->Val);
}
// Returns an array of:
// * the files in the torrent
// * the files in the torrent
// * the total size of files described therein
function file_list() {
$FileList = array();
@ -276,7 +276,7 @@ function file_list() {
foreach ($Files as $File) {
$FileSize = $File->Val['length'];
$TotalSize += $FileSize;
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize;
$FileNames[] = $FileName;
@ -296,26 +296,26 @@ function get_name() {
return $this->Val['info']->Val['name'];
}
}
function make_private() {
//----- The following properties do not affect the infohash:
// anounce-list is an unofficial extension to the protocol
// that allows for multiple trackers per torrent
unset($this->Val['announce-list']);
// Bitcomet & Azureus cache peers in here
unset($this->Val['nodes']);
// Azureus stores the dht_backup_enable flag here
unset($this->Val['azureus_properties']);
// Remove web-seeds
unset($this->Val['url-list']);
// Remove libtorrent resume info
unset($this->Val['libtorrent_resume']);
//----- End properties that do not affect the infohash
if ($this->Val['info']->Val['private']) {
return true; // Torrent is private

View File

@ -11,7 +11,7 @@
There are 4 data types in bencode:
* String
* Int
* List - array without keys
* List - array without keys
- like array('value', 'value 2', 'value 3', 'etc')
* Dictionary - array with string keys
- like array['key 1'] = 'value 1'; array['key 2'] = 'value 2';
@ -30,18 +30,18 @@
- If stored as an int on 32 bit boxes, it won't allow for any size over 2 gigs
* Lists
- Stored as a BENCODE_LIST object.
- Stored as a BENCODE_LIST object.
- The actual list is in BENCODE_LIST::$Val, as an array with incrementing integer indices
- The list in BENCODE_LIST::$Val is populated by the BENCODE_LIST::dec() function
* Dictionaries
- Stored as a BENCODE_DICT object.
- Stored as a BENCODE_DICT object.
- The actual list is in BENCODE_DICT::$Val, as an array with incrementing integer indices
- The list in BENCODE_DICT::$Val is populated by the BENCODE_DICT::dec() function
//----- BENCODE_* Objects -----//
Lists and dictionaries are stored as objects. They each have the following
Lists and dictionaries are stored as objects. They each have the following
functions:
* decode(Type, $Key)
@ -60,15 +60,15 @@ functions:
- Relies mostly on the encode() function
Finally, as all torrents are just large dictionaries, the TORRENT class extends
the BENCODE_DICT class.
the BENCODE_DICT class.
**Note** The version we run doesn't store ints as strings marked with [*INT*]
We store them as php integers. You can do this too for added speed and reduced
hackery, if you're running a 64 bit box, or if you're running a 32 bit box and
don't care about files larger than 2 gigs. The system with the [*INT*]s was
coded up in around 4 minutes for STC when we discovered this problem, then
don't care about files larger than 2 gigs. The system with the [*INT*]s was
coded up in around 4 minutes for STC when we discovered this problem, then
discovered that floats aren't accurate enough to use. :(
*******************************************************************************/
@ -76,7 +76,7 @@ class BENCODE {
var $Val; // Decoded array
var $Pos = 1; // Pointer that indicates our position in the string
var $Str = ''; // Torrent string
function __construct($Val, $IsParsed = false){
if(!$IsParsed) {
$this->Str = $Val;
@ -96,35 +96,35 @@ function decode($Type, $Key){
$StrLen.=$this->Str[$this->Pos];
}
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
$this->Pos+=$StrLen;
$this->Pos+=2;
} elseif($Type == 'i') { // Element is an int
$this->Pos++;
// Find end of integer (first occurance of 'e' after position)
$End = strpos($this->Str, 'e', $this->Pos);
$End = strpos($this->Str, 'e', $this->Pos);
// Get the integer, and mark it as an int (on our version 64 bit box, we cast it to an int)
$this->Val[$Key] = '[*INT*]'.substr($this->Str, $this->Pos, $End-$this->Pos);
$this->Val[$Key] = '[*INT*]'.substr($this->Str, $this->Pos, $End-$this->Pos);
$this->Pos = $End+1;
} elseif($Type == 'l') { // Element is a list
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
$this->Pos += $this->Val[$Key]->Pos;
} elseif($Type == 'd') { // Element is a dictionary
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
$this->Pos += $this->Val[$Key]->Pos;
// Sort by key to respect spec
ksort($this->Val[$Key]->Val);
} else {
die('Invalid torrent file');
}
}
function encode($Val){
if(is_string($Val)) {
if(substr($Val, 0, 7) == '[*INT*]') {
@ -149,7 +149,7 @@ function enc(){
}
return $Str.'e';
}
// Decode a list
function dec(){
$Key = 0; // Array index
@ -158,13 +158,13 @@ function dec(){
$Type = $this->Str[$this->Pos];
// $Type now indicates what type of element we're dealing with
// It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
if($Type == 'e') { // End of list
$this->Pos += 1;
unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
return;
}
// Decode the bencoded element.
// This function changes $this->Pos and $this->Val, so you don't have to.
$this->decode($Type, $Key);
@ -183,22 +183,22 @@ function enc(){
}
return $Str.'e';
}
// Decode a dictionary
function dec(){
$Length = strlen($this->Str);
while($this->Pos<$Length) {
if($this->Str[$this->Pos] == 'e') { // End of dictionary
$this->Pos += 1;
unset($this->Str); // Since we're finished parsing the string, we don't need to store it anymore. Benchmarked - this makes the parser run way faster.
return;
}
// Get the dictionary key
// Length of the key, in bytes
$KeyLen = $this->Str[$this->Pos];
// Allow for multi-digit lengths
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
$this->Pos++;
@ -207,21 +207,21 @@ function dec(){
// $this->Pos is now on the last letter of the key length
// Adding 2 brings it past that character and the ':' to the beginning of the string
$this->Pos+=2;
// Get the name of the key
$Key = substr($this->Str, $this->Pos, $KeyLen);
$Key = substr($this->Str, $this->Pos, $KeyLen);
// Move the position past the key to the beginning of the element
$this->Pos+=$KeyLen;
$Type = $this->Str[$this->Pos];
// $Type now indicates what type of element we're dealing with
// It's either an integer (string), 'i' (an integer), 'l' (a list), 'd' (a dictionary), or 'e' (end of dictionary/list)
// Decode the bencoded element.
// This function changes $this->Pos and $this->Val, so you don't have to.
$this->decode($Type, $Key);
}
return true;
}
@ -233,19 +233,19 @@ function dump() {
// Convenience function used for testing and figuring out how we store the data
print_r($this->Val);
}
function dump_data() {
// Function which serializes $this->Val for storage
return base64_encode(serialize($this->Val));
}
function set_announce_url($Announce) {
$this->Val['announce'] = $Announce;
ksort($this->Val);
}
// Returns an array of:
// * the files in the torrent
// * the files in the torrent
// * the total size of files described therein
function file_list() {
$FileList = array();
@ -265,7 +265,7 @@ function file_list() {
foreach ($Files as $File) {
$FileSize = substr($File->Val['length'], 7);
$TotalSize += $FileSize;
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
$FileSizes[] = $FileSize;
$FileNames[] = $FileName;
@ -285,7 +285,7 @@ function get_name() {
return $this->Val['info']->Val['name'];
}
}
function make_private() {
//----- The following properties do not affect the infohash:

View File

@ -103,7 +103,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
}
// Cache it all
foreach ($Found as $GroupID=>$GroupInfo) {
$Cache->cache_value('torrent_group_'.$GroupID,
@ -639,7 +639,7 @@ public static function can_use_token($Torrent) {
&& $LoggedUser['CanLeech'] == '1');
}
public static function has_snatched($TorrentID) {
global $DB, $Cache, $LoggedUser;
if (empty($LoggedUser) || !$LoggedUser['ShowSnatched']) {

View File

@ -21,6 +21,8 @@ class TorrentsDL {
* @param string $Title name of the collection that will be created
*/
public function __construct(&$QueryResult, $Title) {
global $Cache;
$Cache->InternalCache = false; // The internal cache is almost completely useless for this
Zip::unlimit(); // Need more memory and longer timeout
$this->QueryResult = $QueryResult;
$this->Title = $Title;
@ -168,6 +170,7 @@ public function errors() {
* @return file name with at most 180 characters that is valid on most systems
*/
public static function construct_file_name($Artist, $Album, $Year, $Media, $Format, $Encoding, $TorrentID = false, $TxtExtension = false) {
$TorrentArtist = Misc::file_string($Artist);
$TorrentName = Misc::file_string($Album);
if ($Year > 0) {
$TorrentName .= " - $Year";
@ -190,8 +193,8 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
if (!$TorrentName) {
$TorrentName = "No Name";
} else if (strlen($TorrentName . $TorrentInfo) <= 197) {
$TorrentName = Misc::file_string($Artist) . $TorrentName;
} else if (strlen($Artist . $TorrentName . $TorrentInfo) <= 196) {
$TorrentName = $Artist . $TorrentName;
}
// Leave some room to the user in case the file system limits the path length

View File

@ -3,33 +3,33 @@
define('PREFIX', 'percentiles_'); // Prefix for memcache keys, to make life easier
class USER_RANK {
// Returns a 101 row array (101 percentiles - 0 - 100), with the minimum value for that percentile as the value for each row
// BTW - ingenious
function build_table($MemKey, $Query) {
global $Cache,$DB;
$DB->query("DROP TEMPORARY TABLE IF EXISTS temp_stats");
$DB->query("CREATE TEMPORARY TABLE temp_stats
(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Val bigint(20) NOT NULL);");
$DB->query("INSERT INTO temp_stats (Val) ".$Query);
$DB->query("SELECT COUNT(ID) FROM temp_stats");
list($UserCount) = $DB->next_record();
$DB->query("SELECT MIN(Val) FROM temp_stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
$Table = $DB->to_array();
// Give a little variation to the cache length, so all the tables don't expire at the same time
$Cache->cache_value($MemKey, $Table, 3600*24*rand(800,1000)*0.001);
$Cache->cache_value($MemKey, $Table, 3600*24*rand(800,1000)*0.001);
return $Table;
}
function table_query($TableName) {
switch($TableName) {
case 'uploaded':
@ -57,11 +57,11 @@ function table_query($TableName) {
}
return $Query;
}
function get_rank($TableName, $Value) {
if($Value == 0) { return 0; }
global $Cache, $DB;
$Table = $Cache->get_value(PREFIX.$TableName);
if(!$Table) {
//Cache lock!
@ -84,7 +84,7 @@ function get_rank($TableName, $Value) {
}
return 100; // 100th percentile
}
function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bounty, $Artists, $Ratio){
// We can do this all in 1 line, but it's easier to read this way
if($Ratio>1) { $Ratio = 1; }
@ -103,7 +103,7 @@ function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bou
$TotalScore *= $Ratio;
return $TotalScore;
}
}

View File

@ -42,7 +42,7 @@ class USER_AGENT {
'RSS' => 'RSS Downloader'
*/
);
var $OperatingSystems = array(
//Mobile
'SymbianOS' => 'Symbian',
@ -105,7 +105,7 @@ class USER_AGENT {
'win' => 'Windows',
'mac' => 'Mac OS X'
);
public function operating_system(&$UserAgentString) {
if (empty($UserAgentString)) {
return 'Hidden';
@ -119,19 +119,19 @@ public function operating_system(&$UserAgentString) {
}
return $Return;
}
public function mobile(&$UserAgentString) {
if (strpos($UserAgentString, 'iPad')) {
return false;
}
//Mobi catches Mobile
if (/*strpos($UserAgentString, 'Mobile') || */strpos($UserAgentString, 'Device') || strpos($UserAgentString, 'Mobi') || strpos($UserAgentString, 'Mini') || strpos($UserAgentString, 'webOS')) {
return true;
}
return false;
}
public function browser(&$UserAgentString) {
if (empty($UserAgentString)) {
return 'Hidden';

View File

@ -450,9 +450,9 @@ public static function format_username($UserID, $Badges = false, $IsWarned = tru
$Str .= ($UserInfo['Donor'] == 1) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" title="Donor" /></a>' : '';
}
$Str .= ($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"'
. '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
. ($LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d h:i', strtotime($UserInfo['Warned'])) : '')
$Str .= ($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"'
. '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
. ($LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d h:i', strtotime($UserInfo['Warned'])) : '')
. '" /></a>' : '';
$Str .= ($IsEnabled && $UserInfo['Enabled'] == 2) ? '<a href="rules.php"><img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" /></a>' : '';

View File

@ -104,7 +104,7 @@ public static function render_template ($TemplateName, $Args)
* @example <pre><?php
* // box.phtml
* <p id="<?=$id?>">Data</p>
*
*
* // The variable $id within box.phtml will be filled by $some_id
* View::parse('section/box.phtml', array('id' => $some_id));
*

View File

@ -3,11 +3,11 @@
## Wiki class ##
##########################################################################
Seeing as each page has to manage its wiki separately (for performance
Seeing as each page has to manage its wiki separately (for performance
reasons - JOINs instead of multiple queries), this class is rather bare.
The only useful function in here is revision_history(). It creates a
table with the revision history for that particular wiki page.
The only useful function in here is revision_history(). It creates a
table with the revision history for that particular wiki page.
class_wiki depends on your wiki table being structured like this:
@ -23,9 +23,9 @@ class_wiki depends on your wiki table being structured like this:
| Time | datetime | NO | MUL | 0000-00-00 00:00:00 | |
+------------+--------------+------+-----+----------------------+-------+
It is also recommended that you have a field in the main table for
It is also recommended that you have a field in the main table for
whatever the page is (e.g. details.php main table = torrents), so you can
do a JOIN.
do a JOIN.
########################################################################*/
@ -39,13 +39,13 @@ function WIKI($Table, $PageID, $BaseURL = ''){
$this->PageID = $PageID;
$this->BaseURL = $BaseURL;
}
function revision_history(){
global $DB;
$BaseURL = $this->BaseURL;
$DB->query("SELECT
RevisionID,
$DB->query("SELECT
RevisionID,
Summary,
Time,
UserID
@ -62,7 +62,7 @@ function revision_history(){
</tr>
<? //-----------------------------------------
$Row = 'a';
while(list($RevisionID, $Summary, $Time, $UserID, $Username) = $DB->next_record()){
while(list($RevisionID, $Summary, $Time, $UserID, $Username) = $DB->next_record()){
$Row = ($Row == 'a') ? 'b' : 'a';
//------------------------------------------------------ ?>
<tr class="row<?=$Row?>">
@ -84,7 +84,7 @@ function revision_history(){
//-------------------------------------------- ?>
</table>
<?
}
} // class
?>

View File

@ -4,9 +4,9 @@
|*************************************************************************|
This class provides a convenient way for us to generate and serve zip
archives to our end users, both from physical files, cached
archives to our end users, both from physical files, cached
or already parsed data (torrent files). It's all done on the fly, due to
the high probability that a filesystem stored archive will never be
the high probability that a filesystem stored archive will never be
downloaded twice.
Utilizes gzcompress, based upon RFC 1950
@ -39,7 +39,7 @@
$Zip->add_file($TorrentData, "Bookmarks/Artist - Album [2008].torrent");
Adds the parsed torrent to the archive in the Bookmarks folder (created simply by placing it in the path).
-----
* Then, close the archive to the user:
@ -96,12 +96,12 @@ class Zip {
private $Structure = ''; // Structure saved to memory
private $FileOffset = 0; // Offset to write data
private $Data = ''; //An idea
public function __construct ($ArchiveName='Archive') {
header("Content-type: application/octet-stream"); //Stream download
header("Content-disposition: attachment; filename=\"$ArchiveName.zip\""); //Name the archive - Should not be urlencoded
}
public static function unlimit () {
ob_end_clean();
set_time_limit(3600); //Limit 1 hour
@ -121,7 +121,7 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
$ZipData = gzcompress($FileData); // Ditto.
$ZipData = substr ($ZipData, 2,(strlen($ZipData) - 6)); // Checksum resolution
$ZipLength = strlen($ZipData); //Ditto.
$this->Data .= pack("V",$CRC32); // CRC-32
$this->Data .= pack("V",$CRC32); // CRC-32
$this->Data .= pack("V",$ZipLength); // Compressed filesize
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
$this->Data .= pack("v",strlen($ArchivePath)); // Pathname length
@ -136,10 +136,10 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
/* Data descriptor
Not needed (only needed when 3rd bitflag is set), causes problems with OS X archive utility
$this->Data .= pack("V",$CRC32); // CRC-32
$this->Data .= pack("V",$ZipLength); // Compressed filesize
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
$this->Data .= pack("V",$ZipLength); // Compressed filesize
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
END data descriptor */
$FileDataLength = strlen($this->Data);
$this->ArchiveSize = $this->ArchiveSize + $FileDataLength; // All we really need is the size
$CurrentOffset = $this->ArchiveSize; // Update offsets
@ -148,14 +148,14 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
/* Central Directory Structure */
$CDS = "\x50\x4b\x01\x02"; // CDS signature
$CDS .="\x14\x00"; // Constructor version
$CDS .="\x14\x00"; // Version requirements
$CDS .="\x14\x00"; // Version requirements
$CDS .="\x00\x08"; // Bit flag - 0x8 = UTF-8 file names
$CDS .="\x08\x00"; // Compression
$CDS .="\x00\x00\x00\x00"; // Last modified
$CDS .= pack("V",$CRC32); // CRC-32
$CDS .= pack("V",$ZipLength); // Compressed filesize
$CDS .= pack("V",$DataLength); // Uncompressed filesize
$CDS .= pack("v",strlen($ArchivePath)); // Pathname length
$CDS .="\x00\x00\x00\x00"; // Last modified
$CDS .= pack("V",$CRC32); // CRC-32
$CDS .= pack("V",$ZipLength); // Compressed filesize
$CDS .= pack("V",$DataLength); // Uncompressed filesize
$CDS .= pack("v",strlen($ArchivePath)); // Pathname length
$CDS .="\x00\x00"; // Extra field length (0'd so we can ignore this)
$CDS .="\x00\x00"; // File comment length (no comment, 0'd)
$CDS .="\x00\x00"; // Disk number start (0 seems valid)
@ -171,14 +171,14 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
}
public function close_stream() {
echo $this->Structure; // Structure Root
echo $this->Structure; // Structure Root
echo "\x50\x4b\x05\x06"; // End of central directory signature
echo "\x00\x00"; // This disk
echo "\x00\x00"; // CDS start
echo "\x00\x00"; // CDS start
echo pack("v", $this->ArchiveFiles); // Handle the numebr of entries
echo pack("v", $this->ArchiveFiles); // Ditto
echo pack("V", strlen($this->Structure)); //Size
echo pack("V", $this->ArchiveSize); // Offset
echo pack("V", strlen($this->Structure)); //Size
echo pack("V", $this->ArchiveSize); // Offset
echo "\x00\x00"; // No comment, close it off
}
}

View File

@ -6,7 +6,7 @@
** This function is used to create both the class permissions form, and the **
** user custom permissions form. **
********************************************************************************/
$PermissionsArray = array(
'site_leech' => 'Can leech (Does this work?).',
'site_upload' => 'Upload torrent access.',
@ -31,7 +31,7 @@
'site_moderate_requests' => 'Request moderation access.',
'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).',
'site_moderate_forums' => 'Forum moderation access.',
'site_admin_forums' => 'Forum administrator access.',
'site_forums_double_post' => 'Can double post in the forums.',
'site_view_flow' => 'Can view stats and data pools.',
@ -113,7 +113,7 @@
'artist_edit_vanityhouse' => 'Can mark artists as part of Vanity House.'
);
function permissions_form(){ ?>
<div class="permissions">
<div class="permission_container">
@ -216,9 +216,9 @@ function permissions_form(){ ?>
</tr>
<tr>
<td>
<? display_perm('torrents_edit', 'Can edit any torrent'); ?>
<? display_perm('torrents_delete', 'Can delete torrents'); ?>
<? display_perm('torrents_delete_fast', 'Can delete more than 3 torrents at a time.'); ?>
<? display_perm('torrents_freeleech', 'Can make torrents freeleech'); ?>

View File

@ -125,7 +125,7 @@
function sphPackI64 ( $v )
{
assert ( is_numeric($v) );
// x64
if ( PHP_INT_SIZE>=8 )
{
@ -137,7 +137,7 @@ function sphPackI64 ( $v )
if ( is_int($v) )
return pack ( "NN", $v < 0 ? -1 : 0, $v );
// x32, bcmath
// x32, bcmath
if ( function_exists("bcmul") )
{
if ( bccomp ( $v, 0 ) == -1 )
@ -174,16 +174,16 @@ function sphPackI64 ( $v )
function sphPackU64 ( $v )
{
assert ( is_numeric($v) );
// x64
if ( PHP_INT_SIZE>=8 )
{
assert ( $v>=0 );
// x64, int
if ( is_int($v) )
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
// x64, bcmath
if ( function_exists("bcmul") )
{
@ -191,12 +191,12 @@ function sphPackU64 ( $v )
$l = bcmod ( $v, 4294967296 );
return pack ( "NN", $h, $l );
}
// x64, no-bcmath
$p = max ( 0, strlen($v) - 13 );
$lo = (int)substr ( $v, $p );
$hi = (int)substr ( $v, 0, $p );
$m = $lo + $hi*1316134912;
$l = $m % 4294967296;
$h = $hi*2328 + (int)($m/4294967296);
@ -207,7 +207,7 @@ function sphPackU64 ( $v )
// x32, int
if ( is_int($v) )
return pack ( "NN", 0, $v );
// x32, bcmath
if ( function_exists("bcmul") )
{
@ -220,7 +220,7 @@ function sphPackU64 ( $v )
$p = max(0, strlen($v) - 13);
$lo = (float)substr($v, $p);
$hi = (float)substr($v, 0, $p);
$m = $lo + $hi*1316134912.0;
$q = floor($m / 4294967296.0);
$l = $m - ($q * 4294967296.0);
@ -276,11 +276,11 @@ function sphUnpackU64 ( $v )
// x32, bcmath
if ( function_exists("bcmul") )
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@ -323,7 +323,7 @@ function sphUnpackI64 ( $v )
return $lo;
return sprintf ( "%.0f", $lo - 4294967296.0 );
}
$neg = "";
$c = 0;
if ( $hi<0 )
@ -332,7 +332,7 @@ function sphUnpackI64 ( $v )
$lo = ~$lo;
$c = 1;
$neg = "-";
}
}
$hi = sprintf ( "%u", $hi );
$lo = sprintf ( "%u", $lo );
@ -344,7 +344,7 @@ function sphUnpackI64 ( $v )
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@ -507,7 +507,7 @@ function SetServer ( $host, $port = 0 )
$this->_path = $host;
return;
}
assert ( is_int($port) );
$this->_host = $host;
$this->_port = $port;
@ -587,14 +587,14 @@ function _Connect ()
$fp = @fsockopen ( $host, $port, $errno, $errstr );
else
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
if ( !$fp )
{
if ( $this->_path )
$location = $this->_path;
else
$location = "{$this->_host}:{$this->_port}";
$errstr = trim ( $errstr );
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
$this->_connerror = true;
@ -1228,7 +1228,7 @@ function _ParseSearchResponse ( $response, $nreqs )
if ( $type==SPH_ATTR_FLOAT )
{
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
$attrvals[$attr] = $fval;
continue;
}
@ -1257,7 +1257,7 @@ function _ParseSearchResponse ( $response, $nreqs )
} else if ( $type==SPH_ATTR_STRING )
{
$attrvals[$attr] = substr ( $response, $p, $val );
$p += $val;
$p += $val;
} else
{
$attrvals[$attr] = sphFixUint($val);
@ -1624,7 +1624,7 @@ function Close()
fclose ( $this->_socket );
$this->_socket = false;
return true;
}

View File

@ -1,3 +1,3 @@
<?
<?
define('ERROR_EXCEPTION', true);
require('classes/script_start.php');

View File

@ -16,7 +16,7 @@
}
}
}
$Load = sys_getloadavg();
?>
<p>

View File

@ -264,8 +264,6 @@
$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
}
if ($SBlogReadTime < $LatestSBlogTime) {
global $Debug;
$Debug->log_var(array('b' => $SBlogReadTime, 'l' => $LatestSBlogTime), 'Times');
$Alerts[] = '<a href="staffblog.php">'.'New Staff Blog Post!'.'</a>';
}
}
@ -359,7 +357,7 @@
list($NumTorrentReports) = $DB->next_record();
$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
}
$ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
}
@ -413,7 +411,7 @@
<?
}
//Done handling alertbars
if(!$Mobile && $LoggedUser['Rippy'] != 'Off') {
switch($LoggedUser['Rippy']) {
case 'PM' :
@ -446,7 +444,7 @@
</div>
<div class="rippy" onclick="rippyclick();"></div>
</div>
<?
}
}

View File

@ -25,7 +25,7 @@
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
<? if ($Mobile) { ?>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js?v=<?=filemtime(SERVER_ROOT.'/static/mobile/style.js')?>" type="text/javascript"></script>
<? }
<? }
?>
</head>
@ -39,7 +39,7 @@
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="login.php">Login</a></li>
<? if (OPEN_REGISTRATION) { ?>
<? if (OPEN_REGISTRATION) { ?>
<li><a href="register.php">Register</a></li>
<? } ?>
</ul>

View File

@ -1,3 +1,3 @@
<?
<?
define('ERROR_EXCEPTION', true);
require('classes/script_start.php');

View File

@ -26,7 +26,7 @@
if (preg_match('/PING :(.+)$/', $Line, $Ping)) {
fwrite($Socket, "PONG :$Ping[1]\n");
}
// Example command
if(stripos('!mode', $Line)) {
fwrite($Socket, "PRIVMSG ".RELAY." :Mode command used\n");
@ -34,6 +34,6 @@
fwrite($Socket, "WHOIS WhatMan\n");
fwrite($Socket, "MODE Orbulon\n");
}
fwrite($Socket, "PRIVMSG ".RELAY." : -----".$Line."\n");
}

View File

@ -26,43 +26,43 @@
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?artistname={searchTerms}"></Url>
<Url type="application/x-suggestions+json" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?action=autocomplete&amp;name={searchTerms}"/>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm>
<?
<?
break;
case 'torrents':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=basic&amp;searchstr={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php</moz:SearchForm>
<?
<?
break;
case 'requests':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php?search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php</moz:SearchForm>
<?
<?
break;
case 'forums':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search&amp;search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search</moz:SearchForm>
<?
<?
break;
case 'users':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search&amp;search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search</moz:SearchForm>
<?
<?
break;
case 'wiki':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search&amp;search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search</moz:SearchForm>
<?
<?
break;
case 'log':
?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php?search={searchTerms}"></Url>
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php</moz:SearchForm>
<?
<?
break;
}
?>

View File

@ -60,14 +60,14 @@
if (strtotime($NewsTime) > time()) {
continue;
}
$JsonAnnouncements[] = array(
'newsId' => (int) $NewsID,
'title' => $Title,
'body' => $Text->full_format($Body),
'newsTime' => $NewsTime
);
if (++$Count > 4) {
break;
}

View File

@ -15,10 +15,10 @@
break;
case 'artistless':
include(SERVER_ROOT.'/sections/ajax/better/artistless.php');
break;
break;
case 'tags':
include(SERVER_ROOT.'/sections/ajax/better/tags.php');
break;
break;
case 'folders':
include(SERVER_ROOT.'/sections/ajax/better/folders.php');
break;

View File

@ -21,7 +21,7 @@
foreach ($Results as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
$FlacID = $GroupIDs[$GroupID]['TorrentID'];
$JsonArtists = array();
if(count($Artists)>0) {
foreach ($Artists as $Artist) {
@ -32,7 +32,7 @@
);
}
}
$JsonResults[] = array(
'torrentId' => (int) $FlacID,
'groupId' => (int) $GroupID,

View File

@ -2,7 +2,7 @@
if(!empty($_GET['userid'])) {
if(!check_perms('users_override_paranoia')) {
print
print
json_encode(
array(
'status' => 'failure'
@ -13,7 +13,7 @@
$UserID = $_GET['userid'];
$Sneaky = ($UserID != $LoggedUser['ID']);
if(!is_number($UserID)) {
print
print
json_encode(
array(
'status' => 'failure'

View File

@ -1,7 +1,7 @@
<?
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
// Number of users per page
// Number of users per page
define('BOOKMARKS_PER_PAGE', '20');
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; }
@ -22,7 +22,7 @@
require(SERVER_ROOT.'/sections/ajax/requests/requests.php');
break;
default:
print
print
json_encode(
array(
'status' => 'failure'

View File

@ -28,8 +28,8 @@ function compare($X, $Y){
list($K, list($TorrentList, $CollageDataList)) = each($Data);
} else {
// Build the data for the collage and the torrent list
$DB->query("SELECT
bt.GroupID,
$DB->query("SELECT
bt.GroupID,
tg.WikiImage,
tg.CategoryID,
bt.Time
@ -37,7 +37,7 @@ function compare($X, $Y){
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
WHERE bt.UserID='$UserID'
ORDER BY bt.Time");
$GroupIDs = $DB->collect('GroupID');
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
if(count($GroupIDs)>0) {

View File

@ -107,7 +107,7 @@
// This is done here so we get the benefit of the caching, and we
// don't have to make a database query for each topic on the page
$LastRead = $DB->to_array('TopicID');
$JsonTopics = array();
foreach ($Forum as $Topic) {
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
@ -122,7 +122,7 @@
$AuthorName = $UserInfo['Username'];
$UserInfo = Users::user_info($LastAuthorID);
$LastAuthorName = $UserInfo['Username'];
$JsonTopics[] = array(
'topicId' => (int) $TopicID,
'title' => display_str($Title),

View File

@ -57,7 +57,7 @@
unset($ForumID, $Forum);
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
}
if(empty($_GET['type']) || $_GET['type'] == 'main') {
include(SERVER_ROOT.'/sections/ajax/forum/main.php');
} else {
@ -96,7 +96,7 @@ function get_forum_info($ForumID) {
}
// Makes an array, with $Forum['Name'], etc.
$Forum = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
}
return $Forum;

View File

@ -56,14 +56,14 @@
);
$JsonForums = array();
}
if((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
$Read = 'unread';
} else {
$Read = 'read';
}
$UserInfo = Users::user_info($LastAuthorID);
$JsonForums[] = array(
'forumId' => (int) $ForumID,
'forumName' => $ForumName,

View File

@ -141,13 +141,13 @@
$Answers = unserialize($Answers);
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$ThreadID' GROUP BY Vote");
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
$Votes = array();
foreach ($VoteArray as $VoteSet) {
list($Key,$Value) = $VoteSet;
list($Key,$Value) = $VoteSet;
$Votes[$Key] = $Value;
}
foreach(array_keys($Answers) as $i) {
if (!isset($Votes[$i])) {
$Votes[$i] = 0;
@ -155,7 +155,7 @@
}
$Cache->cache_value('polls_'.$ThreadID, array($Question,$Answers,$Votes,$Featured,$Closed), 0);
}
if (!empty($Votes)) {
$TotalVotes = array_sum($Votes);
$MaxVotes = max($Votes);
@ -163,7 +163,7 @@
$TotalVotes = 0;
$MaxVotes = 0;
}
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
//Polls lose the you voted arrow thingy
$DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'");
@ -175,14 +175,14 @@
$Answers[$UserResponse] = '&raquo; '.$Answers[$UserResponse];
}
}
$JsonPoll['closed'] = $Closed == 1;
$JsonPoll['featured'] = $Featured;
$JsonPoll['question'] = $Question;
$JsonPoll['maxVotes'] = (int) $MaxVotes;
$JsonPoll['totalVotes'] = $TotalVotes;
$JsonPollAnswers = array();
foreach($Answers as $i => $Answer) {
if (!empty($Votes[$i]) && $TotalVotes > 0) {
$Ratio = $Votes[$i]/$MaxVotes;
@ -197,13 +197,13 @@
'percent' => $Percent
);
}
if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) {
$JsonPoll['voted'] = True;
$JsonPoll['voted'] = True;
} else {
$JsonPoll['voted'] = False;
}
$JsonPoll['answers'] = $JsonPollAnswers;
}
@ -241,7 +241,7 @@
'enabled' => $Enabled == 2 ? false : true,
'userTitle' => $UserTitle
),
);
}

View File

@ -2,9 +2,9 @@
/*
AJAX Switch Center
This page acts as an AJAX "switch" - it's called by scripts, and it includes the required pages.
This page acts as an AJAX "switch" - it's called by scripts, and it includes the required pages.
The required page is determined by $_GET['action'].
The required page is determined by $_GET['action'].
*/

View File

@ -69,7 +69,7 @@
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
if ($Result['UnRead'] == 1) $NumNew++;
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,

View File

@ -17,7 +17,7 @@
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
if(empty($_GET['id']) || !is_number($_GET['id'])) {
if(empty($_GET['id']) || !is_number($_GET['id'])) {
print
json_encode(
array(
@ -31,7 +31,7 @@
//First things first, lets get the data for the request.
$Request = Requests::get_requests(array($RequestID));
$Request = Requests::get_requests(array($RequestID));
$Request = $Request['matches'][$RequestID];
if(empty($Request)) {
print
@ -61,14 +61,14 @@
$ArtistForm = get_request_artists($RequestID);
$ArtistName = Artists::display_artists($ArtistForm, false, true);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
if($IsFilled) {
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>".$Title."</a> [".$Year."]";
} else {
$DisplayLink = $ArtistLink.$Title." [".$Year."]";
}
$FullName = $ArtistName.$Title." [".$Year."]";
if($BitrateList != "") {
$BitrateString = implode(", ", explode("|", $BitrateList));
$FormatString = implode(", ", explode("|", $FormatList));
@ -78,13 +78,13 @@
$FormatString = "Unknown, please read the description.";
$MediaString = "Unknown, please read the description.";
}
if(empty($ReleaseType)) {
$ReleaseName = "Unknown";
} else {
$ReleaseName = $ReleaseTypes[$ReleaseType];
}
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = $Title." [".$Year."]";
$DisplayLink = $Title." [".$Year."]";
@ -121,7 +121,7 @@
$JsonTopContributors = array();
$VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
for($i = 0; $i < $VoteMax; $i++) {
for($i = 0; $i < $VoteMax; $i++) {
$User = array_shift($RequestVotes['Voters']);
$JsonTopContributors[] = array(
'userId' => (int) $User['UserID'],

View File

@ -7,15 +7,15 @@
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
list($Page,$Limit) = Format::page_limit(REQUESTS_PER_PAGE);
$Submitted = !empty($_GET['submit']);
//Paranoia
//Paranoia
$UserInfo = Users::user_info((int)$_GET['userid']);
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
$UserClass = $Perms['Class'];
$BookmarkView = false;
if(empty($_GET['type'])) {
if(empty($_GET['type'])) {
$Title = 'Requests';
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
$SS->set_filter('visible', array(1));
@ -137,7 +137,7 @@
unset($ReleaseArray[$Index]);
}
}
if(count($ReleaseArray) >= 1) {
$SS->set_filter('releasetype', $ReleaseArray);
}
@ -153,7 +153,7 @@
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
}
}
if(count($FormatNameArray) >= 1) {
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
}
@ -287,11 +287,11 @@
unset($SphinxResults['matches'][$ID]);
}
}
// Merge SQL results with memcached results
foreach($SQLResults['matches'] as $ID => $SQLResult) {
$SphinxResults['matches'][$ID] = $SQLResult;
//$Requests['matches'][$ID] = array_merge($Requests['matches'][$ID], $SQLResult);
//We ksort because depending on the filter modes, we're given our data in an unpredictable order
//ksort($Requests['matches'][$ID]);
@ -316,24 +316,24 @@
$JsonResults = array();
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
foreach ($Requests as $RequestID => $Request) {
//list($BitrateList, $CatalogueNumber, $CategoryID, $Description, $FillerID, $FormatList, $RequestID, $Image, $LogCue, $MediaList, $ReleaseType,
// $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote,
//list($BitrateList, $CatalogueNumber, $CategoryID, $Description, $FillerID, $FormatList, $RequestID, $Image, $LogCue, $MediaList, $ReleaseType,
// $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote,
// $ReleaseType, $TagIDs, $TimeAdded, $TimeFilled, $TorrentID, $RequestorID, $Voters) = array_values($Request);
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber,
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
$RequestVotes = get_votes_array($RequestID);
$VoteCount = count($RequestVotes['Voters']);
if($CategoryID == 0) {
$CategoryName = "Unknown";
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
$JsonArtists = array();
if($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
@ -341,7 +341,7 @@
}
$Tags = $Request['Tags'];
$JsonResults[] = array(
'requestId' => (int) $RequestID,
'requestorId' => (int) $RequestorID,

View File

@ -24,37 +24,37 @@
die();
}
$Type = ($_REQUEST['vote'] == 'up')?"Up":"Down";
// Update the two votes tables if needed
$DB->query("INSERT IGNORE INTO users_votes (UserID, GroupID, Type) VALUES ($UserID, $GroupID, '$Type')");
if ($DB->affected_rows() == 0) {
echo 'noaction';
die();
}
// Update the group's cache key
$GroupVotes['Total'] += 1;
if ($Type == "Up") {
$GroupVotes['Ups'] += 1;
}
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
// If the group has no votes yet, we need an insert, otherwise an update
// so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE...
// to accomplish both in one query
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
VALUES ($GroupID, 1, ".($Type=='Up'?1:0).", 0)
ON DUPLICATE KEY UPDATE Total = Total + 1,
ON DUPLICATE KEY UPDATE Total = Total + 1,
Score = IFNULL(binomial_ci(Ups".($Type=='Up'?'+1':'').",Total),0)".
($Type=='Up'?', Ups = Ups+1':''));
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
// Update this guy's cache key
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
// Update the paired cache keys for "people who liked"
// First update this album's paired votes. If this keys is magically not set,
// First update this album's paired votes. If this keys is magically not set,
// our life just got a bit easier. We're only tracking paired votes on upvotes.
if ($Type == 'Up') {
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
@ -108,7 +108,7 @@
}
}
echo 'success';
} elseif ($_REQUEST['do'] == 'unvote') {
if (!isset($UserVotes[$GroupID])) {
@ -116,13 +116,13 @@
die();
}
$Type = $UserVotes[$GroupID]['Type'];
$DB->query("DELETE FROM users_votes WHERE UserID=$UserID AND GroupID=$GroupID");
// Update personal cache key
unset($UserVotes[$GroupID]);
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
// Update the group's cache key
$GroupVotes['Total'] -= 1;
if ($Type == "Up") {
@ -135,7 +135,7 @@
($Type=='Up'?', Ups = GREATEST(0, Ups - 1)':'')."
WHERE GroupID=$GroupID");
// Update paired cache keys
// First update this album's paired votes. If this keys is magically not set,
// First update this album's paired votes. If this keys is magically not set,
// our life just got a bit easier. We're only tracking paired votes on upvotes.
if ($Type == 'Up') {
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
@ -160,7 +160,7 @@
}
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
}
// Now do the paired votes keys for all of this guy's other votes
foreach ($UserVotes as $VGID => $Vote) {
if ($Vote['Type'] != 'Up') {
@ -190,7 +190,7 @@
}
}
}
// Let the script know what happened
if ($Type == 'Up') {
echo 'success-up';

View File

@ -2,7 +2,7 @@
require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;

View File

@ -19,12 +19,12 @@
case 'Music':
$TorrentForm->music_form($GenreTags);
break;
case 'Audiobooks':
case 'Comedy':
$TorrentForm->audiobook_form();
break;
case 'Applications':
case 'Comics':
case 'E-Books':

View File

@ -45,7 +45,7 @@ function error_out($reason = "") {
FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID
WHERE m.ID = $UserID");
if($DB->record_count() == 0){ // If user doesn't exist
error_out("User does not exist!");
}
@ -170,22 +170,22 @@ function error_out($reason = "") {
$sql.='
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
}
$sql .= '
ORDER BY p.ID DESC';
if($ShowGrouped) {
$sql.='
) AS sub
GROUP BY TopicID ORDER BY ID DESC';
}
$sql.=' LIMIT '.$Limit;
$Posts = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($Posts);
}

View File

@ -4,10 +4,10 @@
**********************************************************************/
if (!empty($_GET['search'])) {
$_GET['username'] = $_GET['search'];
}
define('USERS_PER_PAGE', 30);
if(isset($_GET['username'])){

View File

@ -1,6 +1,6 @@
<state><?
switch ($User['State']) {
case 0:
case 0:
echo 'pending';
break;
case 1:

View File

@ -2,18 +2,18 @@
$Available = array(
'access_request',
'access_state',
'user_stats_ratio',
'user_stats_torrent',
'user_stats_comumnity',
);
if (
empty($_GET['req']) ||
empty($_GET['uid']) ||
empty($_GET['aid']) ||
empty($_GET['key']) ||
!is_number($_GET['uid']) ||
empty($_GET['req']) ||
empty($_GET['uid']) ||
empty($_GET['aid']) ||
empty($_GET['key']) ||
!is_number($_GET['uid']) ||
!is_number($_GET['aid']) ||
!in_array($_GET['req'],$Available,true)
) {

View File

@ -17,15 +17,15 @@
list($Artist2ID) = $DB->next_record();
if(!empty($Artist2ID)) { // artist was found in the database
// Let's see if there's already a similar artists field for these two
$DB->query("SELECT
s1.SimilarID
$DB->query("SELECT
s1.SimilarID
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID
WHERE s1.ArtistID='$Artist1ID' AND s2.ArtistID='$Artist2ID'");
list($SimilarID) = $DB->next_record();
if($SimilarID){ // The similar artists field already exists, just update the score
$DB->query("UPDATE artists_similar_scores SET Score=Score+200 WHERE SimilarID='$SimilarID'");
} else { // No, it doesn't exist - create it
@ -34,12 +34,12 @@
$DB->query("INSERT INTO artists_similar (ArtistID, SimilarID) VALUES ('$Artist1ID', '$SimilarID')");
$DB->query("INSERT INTO artists_similar (ArtistID, SimilarID) VALUES ('$Artist2ID', '$SimilarID')");
}
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='up'");
if($DB->record_count() == 0) {
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
}
$Cache->delete('artist_'.$Artist1ID); // Delete artist cache
$Cache->delete('artist_'.$Artist2ID); // Delete artist cache
$Cache->delete('similar_positions_'.$Artist1ID); // Delete artist's similar map cache

View File

@ -20,16 +20,16 @@
$DB=NEW DB_MYSQL; //Load the database wrapper
}
$Limit = (($KeySize === $MaxKeySize)?250:10);
$DB->query("SELECT
$DB->query("SELECT
a.ArtistID,
a.Name,
SUM(t.Snatched) AS Snatches
FROM artists_group AS a
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
a.Name,
SUM(t.Snatched) AS Snatches
FROM artists_group AS a
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
WHERE a.Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
GROUP BY ta.ArtistID
ORDER BY Snatches DESC
GROUP BY ta.ArtistID
ORDER BY Snatches DESC
LIMIT $Limit");
$AutoSuggest = $DB->to_array(false,MYSQLI_NUM,false);
$Cache->cache_value('autocomplete_artist_'.$KeySize.'_'.$Letters,$AutoSuggest,1800+7200*($MaxKeySize-$KeySize)); // Can't cache things for too long in case names are edited

View File

@ -24,13 +24,13 @@
if ($NewArtistID > 0) {
// Make sure that's a real artist ID number, and grab the name
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = $NewArtistID LIMIT 1");
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = $NewArtistID LIMIT 1");
if(!(list($NewArtistName) = $DB->next_record())) {
error('Please enter a valid artist ID number.');
}
} else {
// Didn't give an ID, so try to grab based on the name
$DB->query("SELECT ArtistID FROM artists_alias WHERE Name = '".db_string($NewArtistName)."' LIMIT 1");
$DB->query("SELECT ArtistID FROM artists_alias WHERE Name = '".db_string($NewArtistName)."' LIMIT 1");
if(!(list($NewArtistID) = $DB->next_record())) {
error('No artist by that name was found.');
}
@ -58,23 +58,23 @@
$NewArtistGroups = $DB->collect('GroupID');
$NewArtistGroups[] = '0';
$NewArtistGroups = implode(',',$NewArtistGroups);
$DB->query("SELECT DISTINCT RequestID FROM requests_artists WHERE ArtistID = $NewArtistID");
$NewArtistRequests = $DB->collect('RequestID');
$NewArtistRequests[] = '0';
$NewArtistRequests = implode(',',$NewArtistRequests);
$DB->query("SELECT DISTINCT UserID from bookmarks_artists WHERE ArtistID = $NewArtistID");
$NewArtistBookmarks = $DB->collect('UserID');
$NewArtistBookmarks[] = '0';
$NewArtistBookmarks = implode(',',$NewArtistBookmarks);
$NewArtistBookmarks = implode(',',$NewArtistBookmarks);
// Merge all of this artist's aliases onto the new artist
$DB->query("UPDATE artists_alias SET ArtistID = $NewArtistID WHERE ArtistID = $ArtistID");
// Update the torrent groups, requests, and bookmarks
$DB->query("UPDATE IGNORE torrents_artists SET ArtistID = $NewArtistID
WHERE ArtistID = $ArtistID
WHERE ArtistID = $ArtistID
AND GroupID NOT IN ($NewArtistGroups)");
$DB->query("DELETE FROM torrents_artists WHERE ArtistID = $ArtistID");
$DB->query("UPDATE IGNORE requests_artists SET ArtistID = $NewArtistID
@ -85,7 +85,7 @@
WHERE ArtistID = $ArtistID
AND UserID NOT IN ($NewArtistBookmarks)");
$DB->query("DELETE FROM bookmarks_artists WHERE ArtistID = $ArtistID");
// Cache clearing
if(!empty($Groups)) {
foreach($Groups as $GroupID) {

View File

@ -19,10 +19,10 @@
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
list($Name) = $DB->next_record();
$DB->query('SELECT tg.Name,
tg.ID
FROM torrents_group AS tg
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
$DB->query('SELECT tg.Name,
tg.ID
FROM torrents_group AS tg
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
WHERE ta.ArtistID='.$ArtistID);
$Count = $DB->record_count();
if($DB->record_count() > 0) {
@ -47,10 +47,10 @@
<?
}
$DB->query('SELECT r.Title,
r.ID
$DB->query('SELECT r.Title,
r.ID
FROM requests AS r
LEFT JOIN requests_artists AS ra ON ra.RequestID=r.ID
LEFT JOIN requests_artists AS ra ON ra.RequestID=r.ID
WHERE ra.ArtistID='.$ArtistID);
$Count += $DB->record_count();
if($DB->record_count() > 0) {

View File

@ -9,8 +9,8 @@
}
$DB->query("SELECT aa.AliasID
FROM artists_alias AS aa
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
FROM artists_alias AS aa
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
WHERE aa.AliasID=".$AliasID);
if($DB->record_count() == 1) {

View File

@ -135,8 +135,6 @@
$Collector = new TorrentsDL($DownloadsQ, $ArtistName);
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
$Debug->log_var($Downloads, '$Downloads');
$Debug->log_var($GroupIDs, '$GroupIDs');
$Artists = Artists::get_artists($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
if (is_int($TorrentFilesQ)) {

View File

@ -2,10 +2,10 @@
/************************************************************************
||------------|| Edit artist wiki page ||------------------------------||
This page is the page that is displayed when someone feels like editing
This page is the page that is displayed when someone feels like editing
an artist's wiki page.
It is called when $_GET['action'] == 'edit'. $_GET['artistid'] is the
It is called when $_GET['action'] == 'edit'. $_GET['artistid'] is the
ID of the artist, and must be set.
************************************************************************/
@ -55,7 +55,7 @@
</div>
</form>
</div>
<? if(check_perms('torrents_edit')) { ?>
<? if(check_perms('torrents_edit')) { ?>
<h2>Rename</h2>
<div class="box pad">
<form class="rename_form" name="artist" action="artist.php" method="post">
@ -67,11 +67,11 @@
<div style="text-align: center;">
<input type="submit" value="Rename" />
</div>
</div>
</form>
</div>
<h2>Make into non-redirecting alias</h2>
<div class="box pad">
<form class="merge_form" name="artist" action="artist.php" method="post">
@ -90,14 +90,14 @@
</div>
</form>
</div>
<h2>Aliases</h2>
<div class="box pad">
<ul>
<?
$DB->query("SELECT AliasID, Name, UserID, Redirect FROM artists_alias WHERE ArtistID='$ArtistID'");
while(list($AliasID, $AliasName, $User, $Redirect) = $DB->next_record(MYSQLI_NUM, true)) {
while(list($AliasID, $AliasName, $User, $Redirect) = $DB->next_record(MYSQLI_NUM, true)) {
if($AliasName == $Name) { $DefaultRedirectID = $AliasID; }
?>
<li><?=$AliasID?>. <?=$AliasName?>
@ -120,6 +120,6 @@
<input type="submit" value="Add alias" />
</form>
</div>
<? } ?>
<? } ?>
</div>
<? View::show_footer() ?>

View File

@ -2,8 +2,8 @@
/************************************************************************
||------------|| Artist wiki history page ||---------------------------||
This page lists previous revisions of the artists page. It gets called
if $_GET['action'] == 'history'.
This page lists previous revisions of the artists page. It gets called
if $_GET['action'] == 'history'.
It also requires $_GET['artistid'].

View File

@ -2,11 +2,11 @@
/**************************************************************************
Artists Switch Center
This page acts as a switch that includes the real artist pages (to keep
This page acts as a switch that includes the real artist pages (to keep
the root less cluttered).
enforce_login() is run here - the entire artist pages are off limits for
non members.
enforce_login() is run here - the entire artist pages are off limits for
non members.
****************************************************************************/
// Width and height of similar artist map

View File

@ -81,7 +81,7 @@
} else {
$DB->query("UPDATE artists_group SET Name='".db_string($NewName)."' WHERE ArtistID='$ArtistID'");
}
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$OldAliasID'");
$Groups = $DB->collect('GroupID');
$DB->query("UPDATE IGNORE torrents_artists SET AliasID='$TargetAliasID',ArtistID='$TargetArtistID' WHERE AliasID='$OldAliasID'");

View File

@ -23,7 +23,7 @@
$Subject = "You have received a warning";
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
$WarnTime = time_plus($Time);
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
} else {
$Subject = "You have received a verbal warning";
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;

View File

@ -1,6 +1,6 @@
<?
/*********************************************************************\
The page that handles the backend of the 'edit artist' function.
The page that handles the backend of the 'edit artist' function.
\*********************************************************************/
include(SERVER_ROOT.'/classes/class_image_tools.php');
@ -40,18 +40,18 @@
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
VALUES ('$ArtistID', '$Body', '$Image', '$UserID', '$Summary', '".sqltime()."')");
} else { // revert
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
FROM wiki_artists WHERE RevisionID='$RevisionID'");
}
$RevisionID=$DB->inserted_id();
// Update artists table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE artists_group
SET
$DB->query("UPDATE artists_group
SET
". ( isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '' ) ."
RevisionID='$RevisionID'
RevisionID='$RevisionID'
WHERE ArtistID='$ArtistID'");
// There we go, all done!

View File

@ -1,4 +1,4 @@
<?php
<?php
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID = ".$_GET['remove']);
@ -56,12 +56,12 @@
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);

View File

@ -1,4 +1,4 @@
<?php
<?php
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$_GET['remove']);
@ -61,7 +61,7 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);

View File

@ -15,10 +15,10 @@
break;
case 'artistless':
include(SERVER_ROOT.'/sections/better/artistless.php');
break;
break;
case 'tags':
include(SERVER_ROOT.'/sections/better/tags.php');
break;
break;
case 'folders':
include(SERVER_ROOT.'/sections/better/folders.php');
break;

View File

@ -62,7 +62,7 @@
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);

View File

@ -42,7 +42,7 @@
}
header('Location: blog.php');
break;
case 'takenewblog':
authorize();
$Title = db_string($_POST['title']);
@ -53,20 +53,20 @@
if($DB->record_count() < 1) {
error("No such thread exists!");
header('Location: blog.php');
}
}
} else {
$ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body);
if($ThreadID < 1) {
error(0);
}
}
$DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
VALUES ('".$LoggedUser['ID']."',
'".db_string($_POST['title'])."',
'".db_string($_POST['body'])."',
'".sqltime()."',
".$ThreadID.",
$DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
VALUES ('".$LoggedUser['ID']."',
'".db_string($_POST['title'])."',
'".db_string($_POST['body'])."',
'".sqltime()."',
".$ThreadID.",
'".(($_POST['important']=='1')?'1':'0')."')");
$Cache->delete_value('blog');
if ($_POST['important']=='1') {
@ -81,7 +81,7 @@
break;
}
}
?>
<div class="box thin">
<div class="head">
@ -91,9 +91,9 @@
<div class="pad">
<input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
<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; ?>" />
<? }?>
<? }?>
<h3>Title</h3>
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br />
<h3>Body</h3>
@ -113,7 +113,7 @@
</form>
</div>
<br />
<?
<?
}
?>
<div class="thin">
@ -147,7 +147,7 @@
<div id="blog<?=$BlogID?>" class="box">
<div class="head">
<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=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
<? } ?>
@ -157,14 +157,14 @@
<? if($ThreadID) { ?>
<br /><br />
<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>
<? }
} ?>
</div>
</div>
<br />
<?
<?
}
?>
</div>

View File

@ -19,7 +19,7 @@ function bookmark_schema($Type) {
break;
case 'request':
return array('bookmarks_requests', 'RequestID');
break;
break;
default:
die('HAX');
}

View File

@ -8,29 +8,29 @@ function get_font() {
function make_captcha_img() {
global $CaptchaBGs;
$Length=6;
$ImageHeight=75;
$ImageWidth=300;
$Chars='abcdefghjkmprstuvwxyzABCDEFGHJKLMPQRSTUVWXY23456789';
$CaptchaString='';
for($i=0;$i<$Length;$i++) { $CaptchaString.=$Chars[mt_rand(0,strlen($Chars)-1)]; }
for($x=0;$x<$Length;$x++) {
$FontDisplay[$x]['size']=mt_rand(24,32);
$FontDisplay[$x]['top']=mt_rand($FontDisplay[$x]['size']+5,$ImageHeight-($FontDisplay[$x]['size']/2));
$FontDisplay[$x]['angle']=mt_rand(-30,30);
$FontDisplay[$x]['font']=get_font();
}
$Img=imagecreatetruecolor($ImageWidth,$ImageHeight);
$BGImg=imagecreatefrompng(SERVER_ROOT.'/captcha/'.$CaptchaBGs[mt_rand(0,count($CaptchaBGs)-1)]);
imagecopymerge($Img,$BGImg,0,0,0,0,300,75,50);
$ForeColor=imagecolorallocatealpha($Img,255,255,255,65);
for($i=0;$i<strlen($CaptchaString);$i++) {
$CharX=(($ImageWidth/$Length)*($i+1))-(($ImageWidth/$Length)*.75);
imagettftext($Img,$FontDisplay[$i]['size'],$FontDisplay[$i]['angle'],$CharX,
@ -42,7 +42,7 @@ function make_captcha_img() {
header('Content-type: image/png');
imagepng($Img);
imagedestroy($Img);
return $CaptchaString;
}

View File

@ -7,9 +7,9 @@
if($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed'); // Should this be logged?
}
$DB->query("INSERT INTO collages_comments
(CollageID, Body, UserID, Time)
(CollageID, Body, UserID, Time)
VALUES
('$CollageID', '".db_string($_POST['body'])."', '$LoggedUser[ID]', '".sqltime()."')");

View File

@ -15,17 +15,17 @@ function AddTorrent($CollageID, $GroupID) {
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
if ($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_torrents
(CollageID, GroupID, UserID, Sort, AddedOn)
(CollageID, GroupID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
@ -88,11 +88,11 @@ function AddTorrent($CollageID, $GroupID) {
if (!$GroupID) {
error('The torrent was not found in the database.');
}
AddTorrent($CollageID, $GroupID);
} else {
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
$URLs = explode("\n",$_REQUEST['urls']);
$GroupIDs = array();
$Err = '';
@ -122,20 +122,20 @@ function AddTorrent($CollageID, $GroupID) {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
break;
}
$DB->query("SELECT ID FROM torrents_group WHERE ID='$GroupID'");
if (!$DB->record_count()) {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
break;
}
}
if ($Err) {
error($Err);
}
foreach ($GroupIDs as $GroupID) {
AddTorrent($CollageID, $GroupID);
}
}
}
header('Location: collages.php?id='.$CollageID);

View File

@ -3,7 +3,7 @@
Things to expect in $_GET:
ThreadID: ID of the forum curently being browsed
page: The page the user's on.
page: The page the user's on.
page = 1 is the same as no page
********************************************************************************/
@ -15,7 +15,7 @@
// Check for lame SQL injection attempts
$CollageID = $_GET['collageid'];
if(!is_number($CollageID)) {
if(!is_number($CollageID)) {
error(0);
}
@ -105,7 +105,7 @@
</td>
</tr>
</table>
<? }
<? }
if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
if($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {

View File

@ -68,14 +68,14 @@
$BookmarkJoin = '';
}
$BaseSQL = $SQL = "SELECT SQL_CALC_FOUND_ROWS
c.ID,
c.Name,
$BaseSQL = $SQL = "SELECT SQL_CALC_FOUND_ROWS
c.ID,
c.Name,
c.NumTorrents,
c.TagList,
c.CategoryID,
c.UserID
FROM collages AS c
FROM collages AS c
$BookmarkJoin
WHERE Deleted = '0'";
@ -214,7 +214,7 @@
<input type="submit" value="Search" />
</td>
</tr>
</table>
</table>
</form>
</div>
<? } // if (!$BookmarkView) ?>
@ -222,12 +222,12 @@
<? if (!$BookmarkView) {
if (check_perms('site_collages_create')) { ?>
<a href="collages.php?action=new" class="brackets">New collage</a>
<? }
<? }
if (check_perms('site_collages_personal')) {
$DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
$CollageCount = $DB->record_count();
if ($CollageCount == 1) {
list($CollageID) = $DB->next_record();
?>
@ -235,7 +235,7 @@
<? } elseif ($CollageCount > 1) { ?>
<a href="collages.php?action=mine" class="brackets">Personal collages</a>
<? }
}
}
if (check_perms('site_collages_subscribe')) { ?>
<a href="userhistory.php?action=subscribed_collages" class="brackets">Subscribed collages</a>
<? } ?>
@ -296,7 +296,7 @@
$Tags[]='<a href="collages.php?action=search&amp;tags='.$Tag.'">'.$Tag.'</a>';
}
$Tags = implode(', ', $Tags);
//Print results
?>
<tr class="row<?=$Row?> <?=($BookmarkView)?'bookmark_'.$ID:''?>">
@ -309,7 +309,7 @@
<span style="float:right">
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
</span>
<? }
<? }
if(!empty($Tags)) {
?>
<div class="tags">

View File

@ -1,8 +1,8 @@
<?
$CollageID = $_GET['collageid'];
if(!is_number($CollageID) || !$CollageID) {
error(404);
if(!is_number($CollageID) || !$CollageID) {
error(404);
}
$DB->query("SELECT Name, UserID FROM collages WHERE ID='$CollageID'");

View File

@ -2,10 +2,10 @@
/*********************************************************************\
//--------------Get Post--------------------------------------------//
This gets the raw BBCode of a post. It's used for editing and
quoting posts.
This gets the raw BBCode of a post. It's used for editing and
quoting posts.
It gets called if $_GET['action'] == 'get_post'. It requires
It gets called if $_GET['action'] == 'get_post'. It requires
$_GET['post'], which is the ID of the post.
\*********************************************************************/
@ -18,10 +18,10 @@
// Variables for database input
$PostID = $_GET['post'];
// Mainly
// Mainly
$DB->query("SELECT Body FROM collages_comments WHERE ID='$PostID'");
list($Body) = $DB->next_record(MYSQLI_NUM);
// This gets sent to the browser, which echoes it wherever
// This gets sent to the browser, which echoes it wherever
echo trim($Body);

View File

@ -66,11 +66,11 @@
if(!check_perms('site_collages_personal')) {
error(403);
}
$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']) {
if($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
list($CollageID) = $DB->next_record();
header('Location: collage.php?id='.$CollageID);
die();

View File

@ -44,6 +44,6 @@
if(!is_number($Sort)) { error(404); }
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
}
$Cache->delete_value('collage_'.$CollageID);
header('Location: collages.php?action=manage&collageid='.$CollageID);

View File

@ -38,10 +38,10 @@
<select name="category" <?=$ChangeJS?>>
<?
array_shift($CollageCats);
foreach($CollageCats as $CatID=>$CatName) { ?>
<option value="<?=$CatID+1?>"<?=(($CatID+1 == $Category)?' selected':'')?>><?=$CatName?></option>
<? }
<? }
$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']) && check_perms('site_collages_personal')) { ?>
@ -50,7 +50,7 @@
</select>
<br />
<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>Discography</strong> - A collage containing all the releases of an artist. Useful for keeping track of side-projects.</li>
<li><strong>Label</strong> - A collage containing all the releases of a particular record label.</li>
@ -58,8 +58,8 @@
<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')) { ?>
<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's your own personal collage.</li>
<? } ?>
</ul>
</td>
</tr>

View File

@ -70,8 +70,8 @@
}
$TagList = implode(' ',$TagList);
$DB->query("INSERT INTO collages
(Name, Description, UserID, TagList, CategoryID)
$DB->query("INSERT INTO collages
(Name, Description, UserID, TagList, CategoryID)
VALUES
('$P[name]', '$P[description]', $LoggedUser[ID], '$TagList', '$P[category]')");

View File

@ -3,8 +3,8 @@
$CollageID = $_POST['collageid'];
if(!is_number($CollageID) || !$CollageID) {
error(404);
if(!is_number($CollageID) || !$CollageID) {
error(404);
}
$DB->query("SELECT Name, CategoryID, UserID FROM collages WHERE ID='$CollageID'");

View File

@ -15,7 +15,7 @@
$Body = db_string(urldecode($_POST['body']));
$PostID = $_POST['post'];
// Mainly
// Mainly
$DB->query("SELECT cc.Body, cc.UserID, cc.CollageID, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$PostID." AND collages_comments.CollageID = cc.CollageID) FROM collages_comments AS cc WHERE cc.ID='$PostID'");
list($OldBody, $AuthorID, $CollageID, $PostNum) = $DB->next_record();

View File

@ -47,7 +47,7 @@
<?=$OtherLink?>
</div>
<? } ?>
</div>
</div>
<div class="linkbox">
<?=$Pages?>
</div>
@ -62,7 +62,7 @@
} /* end while loop*/ ?>
<div class="linkbox"><?= $Pages; ?></div>
</div>
<?
<?
View::show_footer();

View File

@ -16,11 +16,11 @@
*/
if(isset($_GET['id'])) {
$UserID = $_GET['id'];
if(!is_number($UserID))
if(!is_number($UserID))
error(404);
$UserInfo = Users::user_info($UserID);
$Username = $UserInfo['Username'];
if($LoggedUser['ID'] == $UserID) {
$Self = true;
@ -29,8 +29,8 @@
}
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
$UserClass = $Perms['Class'];
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
error(403);
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
error(403);
} else {
$UserID = $LoggedUser['ID'];
$Username = $LoggedUser['Username'];

View File

@ -5,7 +5,7 @@
*
* @param $UserID UserID of the guy/gal who posted the comment
* @param $PostID The post number
* @param $postheader the header used in the post.
* @param $postheader the header used in the post.
* @param $permalink the link to the post elsewhere on the site (torrents.php)
* @param $Body the post body
* @param $EditorID the guy who last edited the post
@ -15,7 +15,7 @@
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
global $Text,$HeavyInfo;
$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;
?>
@ -44,7 +44,7 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
</td>
<? } ?>
<td class='body' valign="top">
<?=$Text->full_format($Body) ?>
<?=$Text->full_format($Body) ?>
<? if($EditorID){ ?>
<br /><br />
Last edited by
@ -53,4 +53,4 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
</td>
</tr>
</table>
<? }
<? }

View File

@ -52,7 +52,7 @@
//Repeat donor
Misc::send_pm($_POST['custom'],0,db_string('Thank you for your donation'),db_string('Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Your continued support is highly appreciated and helps to make this place possible.'),'');
}
}
}
@ -84,14 +84,14 @@
$Cache->update_row(false, array('Invites' => $Invites));
$Cache->commit_transaction(0);
Misc::send_pm($_POST['custom'],0,db_string('Notice of donation failure'),db_string('PapPal has just notified us that the donation you sent from '.$_POST['payer_email'].' of '.$TotalDonated.' '.PAYPAL_CURRENCY.' at '.$DonationTime.' UTC has been revoked. Because of this your special privileges have been revoked, and your invites removed.'),'');
send_irc("PRIVMSG ".BOT_REPORT_CHAN." :".$Message);
}
}
}
$DB->query("UPDATE users_info
SET
$DB->query("UPDATE users_info
SET
AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment)
WHERE UserID='".$_POST['custom']."'");
$DB->query("INSERT INTO donations

View File

@ -1,14 +1,14 @@
<?
// Main feeds page
// The feeds don't use script_start.php, their code resides entirely in feeds.php in the document root
// Bear this in mind when you try to use script_start functions.
// Bear this in mind when you try to use script_start functions.
if (
empty($_GET['feed']) ||
empty($_GET['authkey']) ||
empty($_GET['auth']) ||
empty($_GET['passkey']) ||
empty($_GET['user']) ||
empty($_GET['feed']) ||
empty($_GET['authkey']) ||
empty($_GET['auth']) ||
empty($_GET['passkey']) ||
empty($_GET['user']) ||
!is_number($_GET['user']) ||
strlen($_GET['authkey']) != 32 ||
strlen($_GET['passkey']) != 32 ||
@ -41,7 +41,7 @@
$Feed->open_feed();
switch($_GET['feed']) {
case 'feed_news':
case 'feed_news':
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
$Feed->channel('News', 'RSS feed for site news.');
@ -71,7 +71,7 @@
}
}
break;
case 'feed_blog':
case 'feed_blog':
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
$Feed->channel('Blog', 'RSS feed for site blog.');
@ -100,75 +100,75 @@
}
}
break;
case 'torrents_all':
case 'torrents_all':
$Feed->channel('All Torrents', 'RSS feed for all new torrent uploads.');
$Feed->retrieve('torrents_all',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_music':
case 'torrents_music':
$Feed->channel('Music Torrents', 'RSS feed for all new music torrents.');
$Feed->retrieve('torrents_music',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_music',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_apps':
case 'torrents_apps':
$Feed->channel('Application Torrents', 'RSS feed for all new application torrents.');
$Feed->retrieve('torrents_apps',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_apps',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_ebooks':
case 'torrents_ebooks':
$Feed->channel('E-Book Torrents', 'RSS feed for all new e-book torrents.');
$Feed->retrieve('torrents_ebooks',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_ebooks',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_abooks':
case 'torrents_abooks':
$Feed->channel('Audiobook Torrents', 'RSS feed for all new audiobook torrents.');
$Feed->retrieve('torrents_abooks',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_abooks',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_evids':
case 'torrents_evids':
$Feed->channel('E-Learning Video Torrents', 'RSS feed for all new e-learning video torrents.');
$Feed->retrieve('torrents_evids',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_evids',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_comedy':
case 'torrents_comedy':
$Feed->channel('Comedy Torrents', 'RSS feed for all new comedy torrents.');
$Feed->retrieve('torrents_comedy',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_comedy',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_comics':
case 'torrents_comics':
$Feed->channel('Comic Torrents', 'RSS feed for all new comic torrents.');
$Feed->retrieve('torrents_comics',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_comics',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_mp3':
case 'torrents_mp3':
$Feed->channel('MP3 Torrents', 'RSS feed for all new mp3 torrents.');
$Feed->retrieve('torrents_mp3',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_mp3',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_flac':
case 'torrents_flac':
$Feed->channel('FLAC Torrents', 'RSS feed for all new FLAC torrents.');
$Feed->retrieve('torrents_flac',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_flac',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_vinyl':
case 'torrents_vinyl':
$Feed->channel('Vinyl Sourced Torrents', 'RSS feed for all new vinyl sourced torrents.');
$Feed->retrieve('torrents_vinyl',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_vinyl',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_lossless':
case 'torrents_lossless':
$Feed->channel('Lossless Torrents', 'RSS feed for all new lossless uploads.');
$Feed->retrieve('torrents_lossless',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_lossless',$_GET['authkey'],$_GET['passkey']);
break;
case 'torrents_lossless24':
case 'torrents_lossless24':
$Feed->channel('24bit Lossless Torrents', 'RSS feed for all new 24bit uploads.');
$Feed->retrieve('torrents_lossless24',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_lossless24',$_GET['authkey'],$_GET['passkey']);
break;
default:
// Personalized torrents
if(empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
// All personalized torrent notifications
$Feed->channel('Personalized torrent notifications', 'RSS feed for personalized torrent notifications.');
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
// Specific personalized torrent notification channel
$Feed->channel(display_str($_GET['name']), 'Personal RSS feed: '.display_str($_GET['name']));
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 21) == 'torrents_bookmarks_t_') {
// Bookmarks
$Feed->channel('Bookmarked torrent notifications', 'RSS feed for bookmarked torrents.');
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
} else {
$Feed->channel('All Torrents', 'RSS feed for all new torrent uploads.');
$Feed->retrieve('torrents_all',$_GET['authkey'],$_GET['passkey']);
$Feed->retrieve('torrents_all',$_GET['authkey'],$_GET['passkey']);
}
}
$Feed->close_feed();

View File

@ -26,13 +26,13 @@
$Edits = $Cache->get_value($Type.'_edits_'.$PostID);
if(!is_array($Edits)) {
$DB->query("SELECT ce.EditUser, ce.EditTime, ce.Body
FROM comments_edits AS ce
FROM comments_edits AS ce
WHERE Page = '".$Type."' AND PostID = ".$PostID."
ORDER BY ce.EditTime DESC");
$Edits = $DB->to_array();
$Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0);
}
list($UserID, $Time) = $Edits[$Depth];
if($Depth != 0) {
list(,,$Body) = $Edits[$Depth - 1];

View File

@ -16,7 +16,7 @@
$DB->query("UPDATE forums_polls_votes SET Vote = ".$NewVote." WHERE TopicID = ".$ThreadID." AND UserID = ".$LoggedUser['ID']);
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
} else {
error(404);
}

View File

@ -10,7 +10,7 @@
}
// Get topicid, forumid, number of pages
$DB->query("SELECT
$DB->query("SELECT
TopicID,
ForumID,
CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages,

View File

@ -29,7 +29,7 @@
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
} else {
error(404);
}

View File

@ -53,7 +53,7 @@
list($Stickies) = $DB->next_record();
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
}
}
}
if(!isset($Forums[$ForumID])) { error(404); }
@ -79,7 +79,7 @@
<div style="display: inline-block;">
<h3>Search this forum:</h3>
<form class="search_form" name="forum" action="forums.php" method="get">
<table cellpadding="6" cellspacing="1" border="0" class="layout border">
<table cellpadding="6" cellspacing="1" border="0" class="layout border">
<tr>
<td>
<input type="hidden" name="action" value="search" />
@ -93,9 +93,9 @@
<tr>
<td><strong>Search in:</strong></td>
<td>
<input type="radio" name="type" id="type_title" value="title" checked="checked" />
<input type="radio" name="type" id="type_title" value="title" checked="checked" />
<label for="type_title">Titles</label>
<input type="radio" name="type" id="type_body" value="body" />
<input type="radio" name="type" id="type_body" value="body" />
<label for="type_body">Post bodies</label>
</td>
</tr>
@ -111,17 +111,17 @@
<br />
</div>
</div>
<?
<?
/*
if(check_perms('users_mod')) {
$DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'");
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>
<? } 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>
<? }
<? }
}
*/
?>

Some files were not shown because too many files have changed in this diff Show More