mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-05 22:10:11 +00:00
Empty commit
This commit is contained in:
parent
57b88f03c1
commit
c2746069c1
@ -38,17 +38,17 @@ terms of Sections 1 and 2 above provided that you also do one of the
|
|||||||
following:
|
following:
|
||||||
|
|
||||||
3.1: Accompany it with the complete corresponding machine-readable source
|
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,
|
a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
3.2: Accompany it with a written offer, valid for at least one year, to
|
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
|
performing source distribution, a complete machine-readable copy of the
|
||||||
corresponding source code, to be distributed under the terms of Sections 1 and
|
corresponding source code, to be distributed under the terms of Sections 1 and
|
||||||
2 above on a medium customarily used for software interchange; or,
|
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
|
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
|
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
|
code or executable form with such an offer, in accord with Subsection 3.2
|
||||||
above.)
|
above.)
|
||||||
|
12
INSTALL.txt
12
INSTALL.txt
@ -5,16 +5,16 @@ INSTALLATION NOTES
|
|||||||
2. Run gazelle.sql (preferably as root) to create the database, the table, and the default data.
|
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
|
3. Install sphinx - we recommend you use the included sphinx.conf
|
||||||
For documentation, read http://www.sphinxsearch.com/docs/current.html
|
For documentation, read http://www.sphinxsearch.com/docs/current.html
|
||||||
|
|
||||||
After you've installed sphinx, create the indices:
|
After you've installed sphinx, create the indices:
|
||||||
/usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --all
|
/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.
|
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!
|
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
|
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,
|
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.
|
so peerupdate is a script to update them), and the two sphinx indices.
|
||||||
These are our cron jobs:
|
These are our cron jobs:
|
||||||
|
|
||||||
0,15,30,45 * * * * /usr/local/bin/php /var/www/vhosts/what/schedule.php SCHEDULE_KEY >> /root/schedule.log
|
0,15,30,45 * * * * /usr/local/bin/php /var/www/vhosts/what/schedule.php SCHEDULE_KEY >> /root/schedule.log
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<?
|
<?
|
||||||
require('classes/script_start.php');
|
require('classes/script_start.php');
|
||||||
|
@ -11,7 +11,7 @@ function flush() {
|
|||||||
$Aliases = $DB->to_array('Alias');
|
$Aliases = $DB->to_array('Alias');
|
||||||
$Cache->cache_value('wiki_aliases', $Aliases, 3600*24*14);
|
$Cache->cache_value('wiki_aliases', $Aliases, 3600*24*14);
|
||||||
}
|
}
|
||||||
|
|
||||||
function to_id($Alias) {
|
function to_id($Alias) {
|
||||||
global $Cache, $DB;
|
global $Cache, $DB;
|
||||||
$Aliases = $Cache->get_value('wiki_aliases');
|
$Aliases = $Cache->get_value('wiki_aliases');
|
||||||
@ -26,7 +26,7 @@ function to_id($Alias) {
|
|||||||
function flush() {
|
function flush() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function to_id($Alias) {
|
function to_id($Alias) {
|
||||||
global $DB;
|
global $DB;
|
||||||
$Alias = $this->convert($Alias);
|
$Alias = $this->convert($Alias);
|
||||||
|
@ -155,7 +155,7 @@ public function delete_value($Key) {
|
|||||||
}
|
}
|
||||||
$this->Time+=(microtime(true)-$StartTime)*1000;
|
$this->Time+=(microtime(true)-$StartTime)*1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function increment_value($Key,$Value=1) {
|
public function increment_value($Key,$Value=1) {
|
||||||
$StartTime=microtime(true);
|
$StartTime=microtime(true);
|
||||||
$this->increment($Key,$Value);
|
$this->increment($Key,$Value);
|
||||||
|
@ -4,7 +4,7 @@ class GOOGLE_CHARTS {
|
|||||||
protected $Labels = array();
|
protected $Labels = array();
|
||||||
protected $Data = array();
|
protected $Data = array();
|
||||||
protected $Options = array();
|
protected $Options = array();
|
||||||
|
|
||||||
public function __construct($Type, $Width, $Height, $Options) {
|
public function __construct($Type, $Width, $Height, $Options) {
|
||||||
if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
|
if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
|
||||||
trigger_error('Tried to make chart too large.');
|
trigger_error('Tried to make chart too large.');
|
||||||
@ -12,7 +12,7 @@ public function __construct($Type, $Width, $Height, $Options) {
|
|||||||
$this->URL .= '?cht='.$Type.'&chs='.$Width.'x'.$Height;
|
$this->URL .= '?cht='.$Type.'&chs='.$Width.'x'.$Height;
|
||||||
$this->Options = $Options;
|
$this->Options = $Options;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function encode($Number) {
|
protected function encode($Number) {
|
||||||
if ($Number == -1) {
|
if ($Number == -1) {
|
||||||
return '__';
|
return '__';
|
||||||
@ -20,15 +20,15 @@ protected function encode($Number) {
|
|||||||
$CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
|
$CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
|
||||||
return $CharKey[floor($Number/64)].$CharKey[floor($Number%64)];
|
return $CharKey[floor($Number/64)].$CharKey[floor($Number%64)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function color($Colors) {
|
public function color($Colors) {
|
||||||
$this->URL .= '&chco='.$Colors;
|
$this->URL .= '&chco='.$Colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lines($Thickness, $Solid=1, $Blank=0) {
|
public function lines($Thickness, $Solid=1, $Blank=0) {
|
||||||
$this->URL .= '&chls='.$Thickness.','.$Solid.','.$Blank;
|
$this->URL .= '&chls='.$Thickness.','.$Solid.','.$Blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title($Title, $Color='', $Size='') {
|
public function title($Title, $Color='', $Size='') {
|
||||||
$this->URL .= '&chtt='.str_replace(array(' ',"\n"), array('+','|'), $Title);
|
$this->URL .= '&chtt='.str_replace(array(' ',"\n"), array('+','|'), $Title);
|
||||||
if (!empty($Color)) {
|
if (!empty($Color)) {
|
||||||
@ -38,7 +38,7 @@ public function title($Title, $Color='', $Size='') {
|
|||||||
$this->URL .= ','.$Size;
|
$this->URL .= ','.$Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function legend($Items, $Placement='') {
|
public function legend($Items, $Placement='') {
|
||||||
$this->URL .= '&chdl='.str_replace(' ', '+', implode('|', $Items));
|
$this->URL .= '&chdl='.str_replace(' ', '+', implode('|', $Items));
|
||||||
if (!empty($Placement)) {
|
if (!empty($Placement)) {
|
||||||
@ -48,24 +48,24 @@ public function legend($Items, $Placement='') {
|
|||||||
$this->URL .= '&chdlp='.$Placement;
|
$this->URL .= '&chdlp='.$Placement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add($Label, $Data) {
|
public function add($Label, $Data) {
|
||||||
if ($Label !== false) {
|
if ($Label !== false) {
|
||||||
$this->Labels[] = $Label;
|
$this->Labels[] = $Label;
|
||||||
}
|
}
|
||||||
$this->Data[] = $Data;
|
$this->Data[] = $Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function grid_lines($SpacingX=0, $SpacingY=-1, $Solid=1, $Blank=1) {
|
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
|
//Can take 2 more parameters for offset, but we're not bothering with that right now
|
||||||
$this->URL .= '&chg='.$SpacingX.','.$SpacingY.','.$Solid.','.$Blank.'';
|
$this->URL .= '&chg='.$SpacingX.','.$SpacingY.','.$Solid.','.$Blank.'';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transparent() {
|
public function transparent() {
|
||||||
$this->URL .= '&chf=bg,s,FFFFFF00';
|
$this->URL .= '&chf=bg,s,FFFFFF00';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function url() {
|
public function url() {
|
||||||
return $this->URL;
|
return $this->URL;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ public function __construct ($Width, $Height, $Options=array()) {
|
|||||||
public function color ($Color) {
|
public function color ($Color) {
|
||||||
$this->URL .= '&chco='.$Color.'&chm=B,'.$Color.'50,0,0,0';
|
$this->URL .= '&chco='.$Color.'&chm=B,'.$Color.'50,0,0,0';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$Max = max($this->Data);
|
$Max = max($this->Data);
|
||||||
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
|
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
|
||||||
@ -109,12 +109,12 @@ public function generate() {
|
|||||||
sort($this->Data);
|
sort($this->Data);
|
||||||
$this->Data = array_reverse($this->Data);
|
$this->Data = array_reverse($this->Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Data = array();
|
$Data = array();
|
||||||
$Labels = $this->Labels;
|
$Labels = $this->Labels;
|
||||||
$OtherPercentage = 0.00;
|
$OtherPercentage = 0.00;
|
||||||
$OtherData = 0;
|
$OtherData = 0;
|
||||||
|
|
||||||
foreach ($this->Data as $Key => $Value) {
|
foreach ($this->Data as $Key => $Value) {
|
||||||
$ThisPercentage = number_format(($Value/$Sum)*100, 2);
|
$ThisPercentage = number_format(($Value/$Sum)*100, 2);
|
||||||
$ThisData = ($Value/$Sum)*4095;
|
$ThisData = ($Value/$Sum)*4095;
|
||||||
@ -152,7 +152,7 @@ public function __construct ($Base, $Width, $Height, $Options=array()) {
|
|||||||
public function color ($Color) {
|
public function color ($Color) {
|
||||||
$this->URL .= '&chco='.$Color.'&chm=B,'.$Color.'50,0,0,0';
|
$this->URL .= '&chco='.$Color.'&chm=B,'.$Color.'50,0,0,0';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$Max = max($this->Data);
|
$Max = max($this->Data);
|
||||||
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
|
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
|
||||||
@ -175,7 +175,7 @@ public function add($Label, $Data) {
|
|||||||
}
|
}
|
||||||
$this->Data[] = $Data;
|
$this->Data[] = $Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$Count = count($this->Data);
|
$Count = count($this->Data);
|
||||||
$Height = (30*$Count)+20;
|
$Height = (30*$Count)+20;
|
||||||
|
@ -14,7 +14,7 @@ interface COOKIE_INTERFACE {
|
|||||||
public function get($Key);
|
public function get($Key);
|
||||||
public function set($Key,$Value,$Seconds,$LimitAccess);
|
public function set($Key,$Value,$Seconds,$LimitAccess);
|
||||||
public function del($Key);
|
public function del($Key);
|
||||||
|
|
||||||
public function flush();
|
public function flush();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -22,23 +22,23 @@ public function flush();
|
|||||||
class COOKIE /*implements COOKIE_INTERFACE*/ {
|
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 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
|
const PREFIX = ''; //In some cases you may desire to prefix your cookies
|
||||||
|
|
||||||
public function get($Key) {
|
public function get($Key) {
|
||||||
if (!isset($_COOKIE[SELF::PREFIX.$Key])) {
|
if (!isset($_COOKIE[SELF::PREFIX.$Key])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $_COOKIE[SELF::PREFIX.$Key];
|
return $_COOKIE[SELF::PREFIX.$Key];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Pass the 4th optional param as false to allow JS access to the cookie
|
//Pass the 4th optional param as false to allow JS access to the cookie
|
||||||
public function set($Key,$Value,$Seconds = 86400,$LimitAccess = SELF::LIMIT_ACCESS) {
|
public function set($Key,$Value,$Seconds = 86400,$LimitAccess = SELF::LIMIT_ACCESS) {
|
||||||
setcookie(SELF::PREFIX.$Key,$Value,time()+$Seconds,'/',SITE_URL,$_SERVER['SERVER_PORT'] === '443',$LimitAccess,false);
|
setcookie(SELF::PREFIX.$Key,$Value,time()+$Seconds,'/',SITE_URL,$_SERVER['SERVER_PORT'] === '443',$LimitAccess,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function del($Key) {
|
public function del($Key) {
|
||||||
setcookie(SELF::PREFIX.$Key,'',time()-24*3600); //3600 vs 1 second to account for potential clock desyncs
|
setcookie(SELF::PREFIX.$Key,'',time()-24*3600); //3600 vs 1 second to account for potential clock desyncs
|
||||||
}
|
}
|
||||||
|
|
||||||
public function flush() {
|
public function flush() {
|
||||||
$Cookies = array_keys($_COOKIE);
|
$Cookies = array_keys($_COOKIE);
|
||||||
foreach ($Cookies as $Cookie) {
|
foreach ($Cookies as $Cookie) {
|
||||||
|
@ -17,7 +17,7 @@ function check_file($Type, $Name) {
|
|||||||
|
|
||||||
function check_name($Name) {
|
function check_name($Name) {
|
||||||
global $keywords;
|
global $keywords;
|
||||||
foreach ($keywords as &$value) {
|
foreach ($keywords as &$value) {
|
||||||
if(preg_match('/'.$value.'/i', $Name)) {
|
if(preg_match('/'.$value.'/i', $Name)) {
|
||||||
forbidden_error($Name);
|
forbidden_error($Name);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class Format
|
|||||||
'lossy master approved' => 'tl_approved tl_lossy_master',
|
'lossy master approved' => 'tl_approved tl_lossy_master',
|
||||||
'lossy web approved' => 'tl_approved tl_lossy_web'
|
'lossy web approved' => 'tl_approved tl_lossy_web'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shorten a string
|
* Shorten a string
|
||||||
*
|
*
|
||||||
@ -499,9 +499,9 @@ public static function is_utf8($Str) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Modified accessor for the $TorrentLabels array
|
* Modified accessor for the $TorrentLabels array
|
||||||
*
|
*
|
||||||
* Converts $text to lowercase and strips non-word characters
|
* Converts $text to lowercase and strips non-word characters
|
||||||
*
|
*
|
||||||
* @param string $text Search string
|
* @param string $text Search string
|
||||||
* @return string CSS class(es)
|
* @return string CSS class(es)
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@ class IMAGE {
|
|||||||
var $FontSize = 10;
|
var $FontSize = 10;
|
||||||
var $Font = '';
|
var $Font = '';
|
||||||
var $TextAngle = 0;
|
var $TextAngle = 0;
|
||||||
|
|
||||||
function create($Width, $Height) {
|
function create($Width, $Height) {
|
||||||
$this->Image = imagecreate($Width, $Height);
|
$this->Image = imagecreate($Width, $Height);
|
||||||
$this->Font = SERVER_ROOT.'/classes/fonts/VERDANA.TTF';
|
$this->Font = SERVER_ROOT.'/classes/fonts/VERDANA.TTF';
|
||||||
@ -16,11 +16,11 @@ function create($Width, $Height) {
|
|||||||
imageantialias($this->Image, true);
|
imageantialias($this->Image, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function color($Red, $Green, $Blue, $Alpha=0){
|
function color($Red, $Green, $Blue, $Alpha=0){
|
||||||
return imagecolorallocatealpha($this->Image, $Red, $Green, $Blue, $Alpha);
|
return imagecolorallocatealpha($this->Image, $Red, $Green, $Blue, $Alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
function line($x1, $y1, $x2, $y2, $Color, $Thickness = 1){
|
function line($x1, $y1, $x2, $y2, $Color, $Thickness = 1){
|
||||||
if($Thickness == 1){
|
if($Thickness == 1){
|
||||||
return imageline($this->Image, $x1, $y1, $x2, $y2, $Color);
|
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);
|
imagefilledpolygon($this->Image, $Points, 4, $Color);
|
||||||
return imagepolygon($this->Image, $Points, 4, $Color);
|
return imagepolygon($this->Image, $Points, 4, $Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ellipse($x, $y, $Width, $Height, $Color){
|
function ellipse($x, $y, $Width, $Height, $Color){
|
||||||
return imageEllipse($this->Image, $x, $y, $Width, $Height, $Color);
|
return imageEllipse($this->Image, $x, $y, $Width, $Height, $Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
function text($x, $y, $Color, $Text){
|
function text($x, $y, $Color, $Text){
|
||||||
return imagettftext ($this->Image, $this->FontSize,$this->TextAngle, $x, $y, $Color, $this->Font, $Text);
|
return imagettftext ($this->Image, $this->FontSize,$this->TextAngle, $x, $y, $Color, $this->Font, $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_png($FileName = NULL){
|
function make_png($FileName = NULL){
|
||||||
return imagepng($this->Image, $FileName);
|
return imagepng($this->Image, $FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
$blacklist = array("tinypic", "dsimg");
|
$blacklist = array("tinypic", "dsimg");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if image host is good, otherwise displays an error.
|
* Checks if image host is good, otherwise displays an error.
|
||||||
*/
|
*/
|
||||||
function check_imagehost($url) {
|
function check_imagehost($url) {
|
||||||
global $blacklist;
|
global $blacklist;
|
||||||
|
|
||||||
foreach ($blacklist as &$value) {
|
foreach ($blacklist as &$value) {
|
||||||
if(strpos(strtolower($url), $value)) {
|
if(strpos(strtolower($url), $value)) {
|
||||||
$parsed_url = parse_url($url);
|
$parsed_url = parse_url($url);
|
||||||
error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
|
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.
|
* The main function, called to get the thumbnail url.
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
class INVITE_TREE {
|
class INVITE_TREE {
|
||||||
var $UserID = 0;
|
var $UserID = 0;
|
||||||
var $Visible = true;
|
var $Visible = true;
|
||||||
|
|
||||||
// Set things up
|
// Set things up
|
||||||
function INVITE_TREE($UserID, $Options = array()){
|
function INVITE_TREE($UserID, $Options = array()){
|
||||||
$this->UserID = $UserID;
|
$this->UserID = $UserID;
|
||||||
@ -17,7 +17,7 @@ function INVITE_TREE($UserID, $Options = array()){
|
|||||||
$this->Visible = false;
|
$this->Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_tree() {
|
function make_tree() {
|
||||||
$UserID = $this->UserID;
|
$UserID = $this->UserID;
|
||||||
global $DB;
|
global $DB;
|
||||||
@ -39,7 +39,7 @@ function make_tree() {
|
|||||||
} else {
|
} else {
|
||||||
$MaxPosition = false;
|
$MaxPosition = false;
|
||||||
}
|
}
|
||||||
$TreeQuery = $DB->query("SELECT
|
$TreeQuery = $DB->query("SELECT
|
||||||
it.UserID,
|
it.UserID,
|
||||||
Enabled,
|
Enabled,
|
||||||
PermissionID,
|
PermissionID,
|
||||||
@ -57,9 +57,9 @@ function make_tree() {
|
|||||||
($MaxPosition ? " AND TreePosition<$MaxPosition" : "")."
|
($MaxPosition ? " AND TreePosition<$MaxPosition" : "")."
|
||||||
AND TreeLevel>$TreeLevel
|
AND TreeLevel>$TreeLevel
|
||||||
ORDER BY TreePosition");
|
ORDER BY TreePosition");
|
||||||
|
|
||||||
$PreviousTreeLevel = $TreeLevel;
|
$PreviousTreeLevel = $TreeLevel;
|
||||||
|
|
||||||
// Stats for the summary
|
// Stats for the summary
|
||||||
$MaxTreeLevel = $TreeLevel; // The deepest level (this changes)
|
$MaxTreeLevel = $TreeLevel; // The deepest level (this changes)
|
||||||
$OriginalTreeLevel = $TreeLevel; // The level of the user we're viewing
|
$OriginalTreeLevel = $TreeLevel; // The level of the user we're viewing
|
||||||
@ -73,30 +73,30 @@ function make_tree() {
|
|||||||
$TotalDownload = 0;
|
$TotalDownload = 0;
|
||||||
$TopLevelUpload = 0;
|
$TopLevelUpload = 0;
|
||||||
$TopLevelDownload = 0;
|
$TopLevelDownload = 0;
|
||||||
|
|
||||||
$ClassSummary = array();
|
$ClassSummary = array();
|
||||||
global $Classes;
|
global $Classes;
|
||||||
foreach ($Classes as $ClassID => $Val) {
|
foreach ($Classes as $ClassID => $Val) {
|
||||||
$ClassSummary[$ClassID] = 0;
|
$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
|
// We store this in an output buffer, so we can show the summary at the top without having to loop through twice
|
||||||
ob_start();
|
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
|
// Do stats
|
||||||
$Count++;
|
$Count++;
|
||||||
|
|
||||||
if($TreeLevel > $MaxTreeLevel){
|
if($TreeLevel > $MaxTreeLevel){
|
||||||
$MaxTreeLevel = $TreeLevel;
|
$MaxTreeLevel = $TreeLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($TreeLevel == $BaseTreeLevel){
|
if($TreeLevel == $BaseTreeLevel){
|
||||||
$Branches++;
|
$Branches++;
|
||||||
$TopLevelUpload += $Uploaded;
|
$TopLevelUpload += $Uploaded;
|
||||||
$TopLevelDownload += $Downloaded;
|
$TopLevelDownload += $Downloaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ClassSummary[$Class]++;
|
$ClassSummary[$Class]++;
|
||||||
if($Enabled == 2){
|
if($Enabled == 2){
|
||||||
$DisabledCount++;
|
$DisabledCount++;
|
||||||
@ -104,7 +104,7 @@ function make_tree() {
|
|||||||
if($Donor){
|
if($Donor){
|
||||||
$DonorCount++;
|
$DonorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manage tree depth
|
// Manage tree depth
|
||||||
if($TreeLevel > $PreviousTreeLevel){
|
if($TreeLevel > $PreviousTreeLevel){
|
||||||
for($i = 0; $i<$TreeLevel-$PreviousTreeLevel; $i++){ echo "<ul class=\"invitetree\"><li>"; }
|
for($i = 0; $i<$TreeLevel-$PreviousTreeLevel; $i++){ echo "<ul class=\"invitetree\"><li>"; }
|
||||||
@ -133,7 +133,7 @@ function make_tree() {
|
|||||||
Paranoia: <strong><?=number_format($Paranoia) ?></strong>
|
Paranoia: <strong><?=number_format($Paranoia) ?></strong>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<? $PreviousTreeLevel = $TreeLevel;
|
<? $PreviousTreeLevel = $TreeLevel;
|
||||||
$DB->set_query_id($TreeQuery);
|
$DB->set_query_id($TreeQuery);
|
||||||
@ -143,7 +143,7 @@ function make_tree() {
|
|||||||
for($i = 0; $i<$PreviousTreeLevel-$OriginalTreeLevel; $i++){ $Tree .= "</li></ul>\n"; }
|
for($i = 0; $i<$PreviousTreeLevel-$OriginalTreeLevel; $i++){ $Tree .= "</li></ul>\n"; }
|
||||||
|
|
||||||
if($Count){
|
if($Count){
|
||||||
|
|
||||||
?> <p style="font-weight: bold;">
|
?> <p style="font-weight: bold;">
|
||||||
This tree has <?=$Count?> entries, <?=$Branches?> branches, and a depth of <?=$MaxTreeLevel - $OriginalTreeLevel?>.
|
This tree has <?=$Count?> entries, <?=$Branches?> branches, and a depth of <?=$MaxTreeLevel - $OriginalTreeLevel?>.
|
||||||
It has
|
It has
|
||||||
@ -152,15 +152,15 @@ function make_tree() {
|
|||||||
foreach ($ClassSummary as $ClassID => $ClassCount) {
|
foreach ($ClassSummary as $ClassID => $ClassCount) {
|
||||||
if($ClassCount == 0) { continue; }
|
if($ClassCount == 0) { continue; }
|
||||||
$LastClass = Users::make_class_string($ClassID);
|
$LastClass = Users::make_class_string($ClassID);
|
||||||
if($ClassCount>1) {
|
if($ClassCount>1) {
|
||||||
if($LastClass == "Torrent Celebrity") {
|
if($LastClass == "Torrent Celebrity") {
|
||||||
$LastClass = 'Torrent Celebrities';
|
$LastClass = 'Torrent Celebrities';
|
||||||
} else {
|
} else {
|
||||||
$LastClass.='s';
|
$LastClass.='s';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$LastClass= $ClassCount.' '.$LastClass.' (' . number_format(($ClassCount/$Count)*100) . '%)';
|
$LastClass= $ClassCount.' '.$LastClass.' (' . number_format(($ClassCount/$Count)*100) . '%)';
|
||||||
|
|
||||||
$ClassStrings []= $LastClass;
|
$ClassStrings []= $LastClass;
|
||||||
}
|
}
|
||||||
if(count($ClassStrings)>1){
|
if(count($ClassStrings)>1){
|
||||||
@ -183,13 +183,13 @@ function make_tree() {
|
|||||||
if($DonorCount == 0) { echo '0%)'; }
|
if($DonorCount == 0) { echo '0%)'; }
|
||||||
else { echo number_format(($DonorCount/$Count)*100) . '%)';}
|
else { echo number_format(($DonorCount/$Count)*100) . '%)';}
|
||||||
echo '. </p>';
|
echo '. </p>';
|
||||||
|
|
||||||
echo '<p style="font-weight: bold;">';
|
echo '<p style="font-weight: bold;">';
|
||||||
echo 'The total amount uploaded by the entire tree was '.Format::get_size($TotalUpload);
|
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 '; the total amount downloaded was '.Format::get_size($TotalDownload);
|
||||||
echo '; and the total ratio is '.Format::get_ratio_html($TotalUpload, $TotalDownload).'. ';
|
echo '; and the total ratio is '.Format::get_ratio_html($TotalUpload, $TotalDownload).'. ';
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
|
|
||||||
echo '<p style="font-weight: bold;">';
|
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 uploaded by direct invitees (the top level) was '.Format::get_size($TopLevelUpload);
|
||||||
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
|
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
|
||||||
@ -211,7 +211,7 @@ function make_tree() {
|
|||||||
echo '</p>';
|
echo '</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<?=$Tree?>
|
<?=$Tree?>
|
||||||
|
@ -168,7 +168,7 @@ public function header ()
|
|||||||
*/
|
*/
|
||||||
public function footer ()
|
public function footer ()
|
||||||
{
|
{
|
||||||
if ($this->HasTorrents) :
|
if ($this->HasTorrents) :
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -88,7 +88,7 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
|
|||||||
list($UnRead) = $DB->next_record();
|
list($UnRead) = $DB->next_record();
|
||||||
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
|
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
|
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
|
||||||
list($SenderName) = $DB->next_record();
|
list($SenderName) = $DB->next_record();
|
||||||
foreach($ToID as $ID) {
|
foreach($ToID as $ID) {
|
||||||
|
@ -145,17 +145,17 @@ class DB_MYSQL {
|
|||||||
protected $Row;
|
protected $Row;
|
||||||
protected $Errno = 0;
|
protected $Errno = 0;
|
||||||
protected $Error = '';
|
protected $Error = '';
|
||||||
|
|
||||||
public $Queries = array();
|
public $Queries = array();
|
||||||
public $Time = 0.0;
|
public $Time = 0.0;
|
||||||
|
|
||||||
protected $Database = '';
|
protected $Database = '';
|
||||||
protected $Server = '';
|
protected $Server = '';
|
||||||
protected $User = '';
|
protected $User = '';
|
||||||
protected $Pass = '';
|
protected $Pass = '';
|
||||||
protected $Port = 0;
|
protected $Port = 0;
|
||||||
protected $Socket = '';
|
protected $Socket = '';
|
||||||
|
|
||||||
function __construct($Database = SQLDB, $User = SQLLOGIN, $Pass = SQLPASS, $Server = SQLHOST, $Port = SQLPORT, $Socket = SQLSOCK) {
|
function __construct($Database = SQLDB, $User = SQLLOGIN, $Pass = SQLPASS, $Server = SQLHOST, $Port = SQLPORT, $Socket = SQLSOCK) {
|
||||||
$this->Database = $Database;
|
$this->Database = $Database;
|
||||||
$this->Server = $Server;
|
$this->Server = $Server;
|
||||||
@ -169,7 +169,7 @@ function halt($Msg) {
|
|||||||
global $LoggedUser, $Cache, $Debug, $argv;
|
global $LoggedUser, $Cache, $Debug, $argv;
|
||||||
$DBError='MySQL: '.strval($Msg).' SQL error: '.strval($this->Errno).' ('.strval($this->Error).')';
|
$DBError='MySQL: '.strval($Msg).' SQL error: '.strval($this->Errno).' ('.strval($this->Error).')';
|
||||||
if ($this->Errno == 1194) { send_irc('PRIVMSG '.ADMIN_CHAN.' :'.$this->Error); }
|
if ($this->Errno == 1194) { send_irc('PRIVMSG '.ADMIN_CHAN.' :'.$this->Error); }
|
||||||
/*if ($this->Errno == 1194) {
|
/*if ($this->Errno == 1194) {
|
||||||
preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches);
|
preg_match("Table '(\S+)' is marked as crashed and should be repaired", $this->Error, $Matches);
|
||||||
} */
|
} */
|
||||||
$Debug->analysis('!dev DB Error',$DBError,3600*24);
|
$Debug->analysis('!dev DB Error',$DBError,3600*24);
|
||||||
@ -207,7 +207,7 @@ function query($Query,$AutoHandle=1) {
|
|||||||
}
|
}
|
||||||
$Debug->analysis('Non-Fatal Deadlock:',$Query,3600*24);
|
$Debug->analysis('Non-Fatal Deadlock:',$Query,3600*24);
|
||||||
trigger_error("Database deadlock, attempt $i");
|
trigger_error("Database deadlock, attempt $i");
|
||||||
|
|
||||||
sleep($i*rand(2, 5)); // Wait longer as attempts increase
|
sleep($i*rand(2, 5)); // Wait longer as attempts increase
|
||||||
}
|
}
|
||||||
$QueryEndTime=microtime(true);
|
$QueryEndTime=microtime(true);
|
||||||
@ -319,10 +319,14 @@ function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) {
|
|||||||
function to_pair($KeyField, $ValField, $Escape = true) {
|
function to_pair($KeyField, $ValField, $Escape = true) {
|
||||||
$Return = array();
|
$Return = array();
|
||||||
while ($Row = mysqli_fetch_array($this->QueryID)) {
|
while ($Row = mysqli_fetch_array($this->QueryID)) {
|
||||||
if ($Escape !== false) {
|
if ($Escape) {
|
||||||
$Row = Misc::display_array($Row[$ValField], $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);
|
mysqli_data_seek($this->QueryID, 0);
|
||||||
return $Return;
|
return $Return;
|
||||||
@ -342,7 +346,7 @@ function set_query_id(&$ResultSet){
|
|||||||
$this->QueryID = $ResultSet;
|
$this->QueryID = $ResultSet;
|
||||||
$this->Row = 0;
|
$this->Row = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_query_id() {
|
function get_query_id() {
|
||||||
return $this->QueryID;
|
return $this->QueryID;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
define("PARANOIA_ALLOWED", 1);
|
define("PARANOIA_ALLOWED", 1);
|
||||||
define("PARANOIA_OVERRIDDEN", 2);
|
define("PARANOIA_OVERRIDDEN", 2);
|
||||||
|
|
||||||
function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
|
function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
|
||||||
global $LoggedUser, $Classes;
|
global $LoggedUser, $Classes;
|
||||||
if ($Property == false) {
|
if ($Property == false) {
|
||||||
@ -68,8 +68,8 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
|
|||||||
$May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia);
|
$May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia);
|
||||||
if($May)
|
if($May)
|
||||||
return PARANOIA_ALLOWED;
|
return PARANOIA_ALLOWED;
|
||||||
|
|
||||||
if(check_perms('users_override_paranoia', $UserClass))
|
if(check_perms('users_override_paranoia', $UserClass))
|
||||||
return PARANOIA_OVERRIDDEN;
|
return PARANOIA_OVERRIDDEN;
|
||||||
$Override=false;
|
$Override=false;
|
||||||
switch ($Property) {
|
switch ($Property) {
|
||||||
@ -78,20 +78,20 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
|
|||||||
case 'uploaded':
|
case 'uploaded':
|
||||||
case 'lastseen':
|
case 'lastseen':
|
||||||
if(check_perms('users_mod', $UserClass))
|
if(check_perms('users_mod', $UserClass))
|
||||||
return PARANOIA_OVERRIDDEN;
|
return PARANOIA_OVERRIDDEN;
|
||||||
break;
|
break;
|
||||||
case 'snatched': case 'snatched+':
|
case 'snatched': case 'snatched+':
|
||||||
if(check_perms('users_view_torrents_snatchlist', $UserClass))
|
if(check_perms('users_view_torrents_snatchlist', $UserClass))
|
||||||
return PARANOIA_OVERRIDDEN;
|
return PARANOIA_OVERRIDDEN;
|
||||||
break;
|
break;
|
||||||
case 'uploads': case 'uploads+':
|
case 'uploads': case 'uploads+':
|
||||||
case 'seeding': case 'seeding+':
|
case 'seeding': case 'seeding+':
|
||||||
case 'leeching': case 'leeching+':
|
case 'leeching': case 'leeching+':
|
||||||
if(check_perms('users_view_seedleech', $UserClass))
|
if(check_perms('users_view_seedleech', $UserClass))
|
||||||
return PARANOIA_OVERRIDDEN;
|
return PARANOIA_OVERRIDDEN;
|
||||||
break;
|
break;
|
||||||
case 'invitedcount':
|
case 'invitedcount':
|
||||||
if(check_perms('users_view_invites', $UserClass))
|
if(check_perms('users_view_invites', $UserClass))
|
||||||
return PARANOIA_OVERRIDDEN;
|
return PARANOIA_OVERRIDDEN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -20,19 +20,19 @@ function proxyCheck($IP) {
|
|||||||
if (strlen($IP) < strlen($AllowedProxies[$i])) {
|
if (strlen($IP) < strlen($AllowedProxies[$i])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//since we're matching bit for bit iterating from the start
|
//since we're matching bit for bit iterating from the start
|
||||||
for ($j=0,$jl=strlen($IP);$j<$jl;++$j) {
|
for ($j=0,$jl=strlen($IP);$j<$jl;++$j) {
|
||||||
//completed iteration and no inequality
|
//completed iteration and no inequality
|
||||||
if ($j == $jl-1 && $IP[$j] === $AllowedProxies[$i][$j]) {
|
if ($j == $jl-1 && $IP[$j] === $AllowedProxies[$i][$j]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//wildcard
|
//wildcard
|
||||||
if ($AllowedProxies[$i][$j] === '*') {
|
if ($AllowedProxies[$i][$j] === '*') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//inequality found
|
//inequality found
|
||||||
if ($IP[$j] !== $AllowedProxies[$i][$j]) {
|
if ($IP[$j] !== $AllowedProxies[$i][$j]) {
|
||||||
break;
|
break;
|
||||||
|
@ -10,30 +10,30 @@ class SPHINX_SEARCH extends SphinxClient {
|
|||||||
public $Queries = array();
|
public $Queries = array();
|
||||||
public $Time = 0.0;
|
public $Time = 0.0;
|
||||||
public $Filters = array();
|
public $Filters = array();
|
||||||
|
|
||||||
function SPHINX_SEARCH() {
|
function SPHINX_SEARCH() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->SetServer(SPHINX_HOST, SPHINX_PORT);
|
$this->SetServer(SPHINX_HOST, SPHINX_PORT);
|
||||||
$this->SetMatchMode(SPH_MATCH_EXTENDED2);
|
$this->SetMatchMode(SPH_MATCH_EXTENDED2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
/--- Search function --------------------------------------------
|
/--- 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
|
extended2 mode. It then fetches the records for each primary key
|
||||||
from memcached (by joining $CachePrefix and the primary key), and
|
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.
|
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
|
$SQL. They are then cached, and merged with the memcached matches
|
||||||
and returned.
|
and returned.
|
||||||
|
|
||||||
$Query - sphinx query
|
$Query - sphinx query
|
||||||
$CachePrefix - Prefix for memcache key (no underscore)
|
$CachePrefix - Prefix for memcache key (no underscore)
|
||||||
$CacheLength - How long to store data in the cache, if it's found by MySQL
|
$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.
|
If empty, return all.
|
||||||
$SQL - SQL query to fetch results not found in memcached
|
$SQL - SQL query to fetch results not found in memcached
|
||||||
- Should take the format of:
|
- 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
|
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
|
$IDColumn - The primary key of the SQL table - must be the
|
||||||
same primary key returned by sphinx!
|
same primary key returned by sphinx!
|
||||||
|
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(), $SQL = '', $IDColumn='ID') {
|
function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(), $SQL = '', $IDColumn='ID') {
|
||||||
global $Cache, $DB;
|
global $Cache, $DB;
|
||||||
$QueryStartTime=microtime(true);
|
$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->Queries[]=array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime)*1000);
|
||||||
$this->Time+=($QueryEndTime-$QueryStartTime)*1000;
|
$this->Time+=($QueryEndTime-$QueryStartTime)*1000;
|
||||||
|
|
||||||
if($Result === false) {
|
if($Result === false) {
|
||||||
if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
|
if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
|
||||||
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
|
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());
|
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->TotalResults = $Result['total_found'];
|
||||||
$this->SearchTime = $Result['time'];
|
$this->SearchTime = $Result['time'];
|
||||||
|
|
||||||
if(empty($Result['matches'])) {
|
if(empty($Result['matches'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$Matches = $Result['matches'];
|
$Matches = $Result['matches'];
|
||||||
|
|
||||||
$MatchIDs = array_keys($Matches);
|
$MatchIDs = array_keys($Matches);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$NotFound = array();
|
$NotFound = array();
|
||||||
$Skip = array();
|
$Skip = array();
|
||||||
if(!empty($ReturnData)) {
|
if(!empty($ReturnData)) {
|
||||||
@ -87,7 +87,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
|
|||||||
} else {
|
} else {
|
||||||
$AllFields = true;
|
$AllFields = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($MatchIDs as $Match) {
|
foreach($MatchIDs as $Match) {
|
||||||
$Matches[$Match] = $Matches[$Match]['attrs'];
|
$Matches[$Match] = $Matches[$Match]['attrs'];
|
||||||
if(!empty($CachePrefix)) {
|
if(!empty($CachePrefix)) {
|
||||||
@ -120,7 +120,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
|
|||||||
$Matches[$Match] = array_merge($Matches[$Match], $Data);
|
$Matches[$Match] = array_merge($Matches[$Match], $Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($SQL!='') {
|
if($SQL!='') {
|
||||||
if(!empty($NotFound)) {
|
if(!empty($NotFound)) {
|
||||||
$DB->query(str_replace('%ids', implode(',',$NotFound), $SQL));
|
$DB->query(str_replace('%ids', implode(',',$NotFound), $SQL));
|
||||||
@ -132,21 +132,21 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
|
|||||||
} else {
|
} else {
|
||||||
$Matches = array('matches'=>$Matches,'notfound'=>$NotFound);
|
$Matches = array('matches'=>$Matches,'notfound'=>$NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $Matches;
|
return $Matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
function limit($Start, $Length) {
|
function limit($Start, $Length) {
|
||||||
$Start = (int)$Start;
|
$Start = (int)$Start;
|
||||||
$Length = (int)$Length;
|
$Length = (int)$Length;
|
||||||
$this->SetLimits($Start, $Length, $Start+$Length);
|
$this->SetLimits($Start, $Length, $Start+$Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function set_index($Index) {
|
function set_index($Index) {
|
||||||
$this->Index = $Index;
|
$this->Index = $Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_filter($Name, $Vals, $Exclude=false) {
|
function set_filter($Name, $Vals, $Exclude=false) {
|
||||||
foreach($Vals as $Val) {
|
foreach($Vals as $Val) {
|
||||||
if($Exclude) {
|
if($Exclude) {
|
||||||
@ -157,12 +157,12 @@ function set_filter($Name, $Vals, $Exclude=false) {
|
|||||||
}
|
}
|
||||||
$this->SetFilter($Name, $Vals, $Exclude);
|
$this->SetFilter($Name, $Vals, $Exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_filter_range($Name, $Min, $Max, $Exclude) {
|
function set_filter_range($Name, $Min, $Max, $Exclude) {
|
||||||
$this->Filters[$Name] = array($Min.'-'.$Max);
|
$this->Filters[$Name] = array($Min.'-'.$Max);
|
||||||
$this->SetFilterRange($Name, $Min, $Max, $Exclude);
|
$this->SetFilterRange($Name, $Min, $Max, $Exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
function escape_string($String) {
|
function escape_string($String) {
|
||||||
return strtr($String, array(
|
return strtr($String, array(
|
||||||
'('=>'\(',
|
'('=>'\(',
|
||||||
@ -182,7 +182,7 @@ function escape_string($String) {
|
|||||||
'$'=>'\$',
|
'$'=>'\$',
|
||||||
'='=>'\='));
|
'='=>'\='));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -23,7 +23,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
|
|||||||
}
|
}
|
||||||
if($TimeStamp == 0) { return 'Never'; }
|
if($TimeStamp == 0) { return 'Never'; }
|
||||||
$Time = time()-$TimeStamp;
|
$Time = time()-$TimeStamp;
|
||||||
|
|
||||||
// If the time is negative, then it expires in the future.
|
// If the time is negative, then it expires in the future.
|
||||||
if($Time < 0) {
|
if($Time < 0) {
|
||||||
$Time = -$Time;
|
$Time = -$Time;
|
||||||
@ -77,7 +77,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
|
|||||||
if ($Return!="") {
|
if ($Return!="") {
|
||||||
$Return.=', ';
|
$Return.=', ';
|
||||||
}
|
}
|
||||||
if ($Weeks>1) {
|
if ($Weeks>1) {
|
||||||
$Return.=$Weeks.' weeks';
|
$Return.=$Weeks.' weeks';
|
||||||
} else {
|
} else {
|
||||||
$Return.=$Weeks.' week';
|
$Return.=$Weeks.' week';
|
||||||
@ -120,7 +120,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
|
|||||||
}
|
}
|
||||||
$Levels--;
|
$Levels--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Return == '') {
|
if($Return == '') {
|
||||||
$Return = 'Just now';
|
$Return = 'Just now';
|
||||||
} elseif (!isset($HideAgo)) {
|
} elseif (!isset($HideAgo)) {
|
||||||
@ -130,7 +130,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
|
|||||||
if ($Lowercase) {
|
if ($Lowercase) {
|
||||||
$Return = strtolower($Return);
|
$Return = strtolower($Return);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Span) {
|
if ($Span) {
|
||||||
return '<span class="time" title="'.date('M d Y, H:i', $TimeStamp).'">'.$Return.'</span>';
|
return '<span class="time" title="'.date('M d Y, H:i', $TimeStamp).'">'.$Return.'</span>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
There are 4 data types in bencode:
|
There are 4 data types in bencode:
|
||||||
* String
|
* String
|
||||||
* Int
|
* Int
|
||||||
* List - array without keys
|
* List - array without keys
|
||||||
- like array('value', 'value 2', 'value 3', 'etc')
|
- like array('value', 'value 2', 'value 3', 'etc')
|
||||||
* Dictionary - array with string keys
|
* Dictionary - array with string keys
|
||||||
- like array['key 1'] = 'value 1'; array['key 2'] = 'value 2';
|
- like array['key 1'] = 'value 1'; array['key 2'] = 'value 2';
|
||||||
@ -25,22 +25,22 @@
|
|||||||
- Stored as php strings. Not difficult to remember.
|
- Stored as php strings. Not difficult to remember.
|
||||||
|
|
||||||
* Integers
|
* Integers
|
||||||
- Stored as php ints
|
- Stored as php ints
|
||||||
- must be casted with (int)
|
- must be casted with (int)
|
||||||
|
|
||||||
* Lists
|
* 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 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
|
- The list in BENCODE_LIST::$Val is populated by the BENCODE_LIST::dec() function
|
||||||
|
|
||||||
* Dictionaries
|
* 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 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
|
- The list in BENCODE_DICT::$Val is populated by the BENCODE_DICT::dec() function
|
||||||
|
|
||||||
//----- BENCODE_* Objects -----//
|
//----- 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:
|
functions:
|
||||||
|
|
||||||
* decode(Type, $Key)
|
* decode(Type, $Key)
|
||||||
@ -59,15 +59,15 @@ functions:
|
|||||||
- Relies mostly on the encode() function
|
- Relies mostly on the encode() function
|
||||||
|
|
||||||
Finally, as all torrents are just large dictionaries, the TORRENT class extends
|
Finally, as all torrents are just large dictionaries, the TORRENT class extends
|
||||||
the BENCODE_DICT class.
|
the BENCODE_DICT class.
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
class BENCODE {
|
class BENCODE {
|
||||||
var $Val; // Decoded array
|
var $Val; // Decoded array
|
||||||
var $Pos = 1; // Pointer that indicates our position in the string
|
var $Pos = 1; // Pointer that indicates our position in the string
|
||||||
var $Str = ''; // Torrent string
|
var $Str = ''; // Torrent string
|
||||||
|
|
||||||
function __construct($Val, $IsParsed = false){
|
function __construct($Val, $IsParsed = false){
|
||||||
if(!$IsParsed) {
|
if(!$IsParsed) {
|
||||||
$this->Str = $Val;
|
$this->Str = $Val;
|
||||||
@ -76,8 +76,8 @@ function __construct($Val, $IsParsed = false){
|
|||||||
$this->Val = $Val;
|
$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){
|
function decode($Type, $Key){
|
||||||
if(is_number($Type)) { // Element is a string
|
if(is_number($Type)) { // Element is a string
|
||||||
// Get length of string
|
// Get length of string
|
||||||
@ -87,24 +87,24 @@ function decode($Type, $Key){
|
|||||||
$StrLen.=$this->Str[$this->Pos];
|
$StrLen.=$this->Str[$this->Pos];
|
||||||
}
|
}
|
||||||
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
|
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
|
||||||
|
|
||||||
$this->Pos+=$StrLen;
|
$this->Pos+=$StrLen;
|
||||||
$this->Pos+=2;
|
$this->Pos+=2;
|
||||||
|
|
||||||
} elseif($Type == 'i') { // Element is an int
|
} elseif($Type == 'i') { // Element is an int
|
||||||
$this->Pos++;
|
$this->Pos++;
|
||||||
|
|
||||||
// Find end of integer (first occurance of 'e' after position)
|
// 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
|
// 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;
|
$this->Pos = $End+1;
|
||||||
|
|
||||||
} elseif($Type == 'l') { // Element is a list
|
} elseif($Type == 'l') { // Element is a list
|
||||||
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
|
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
|
||||||
$this->Pos += $this->Val[$Key]->Pos;
|
$this->Pos += $this->Val[$Key]->Pos;
|
||||||
|
|
||||||
} elseif($Type == 'd') { // Element is a dictionary
|
} elseif($Type == 'd') { // Element is a dictionary
|
||||||
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
|
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
|
||||||
$this->Pos += $this->Val[$Key]->Pos;
|
$this->Pos += $this->Val[$Key]->Pos;
|
||||||
@ -112,12 +112,12 @@ function decode($Type, $Key){
|
|||||||
if (!empty($this->Val[$Key]->Val)) {
|
if (!empty($this->Val[$Key]->Val)) {
|
||||||
ksort($this->Val[$Key]->Val);
|
ksort($this->Val[$Key]->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
die('Invalid torrent file');
|
die('Invalid torrent file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function encode($Val){
|
function encode($Val){
|
||||||
if(is_int($Val)) { // Integer
|
if(is_int($Val)) { // Integer
|
||||||
return 'i'.$Val.'e';
|
return 'i'.$Val.'e';
|
||||||
@ -143,7 +143,7 @@ function enc(){
|
|||||||
}
|
}
|
||||||
return $Str.'e';
|
return $Str.'e';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode a list
|
// Decode a list
|
||||||
function dec(){
|
function dec(){
|
||||||
$Key = 0; // Array index
|
$Key = 0; // Array index
|
||||||
@ -152,13 +152,13 @@ function dec(){
|
|||||||
$Type = $this->Str[$this->Pos];
|
$Type = $this->Str[$this->Pos];
|
||||||
// $Type now indicates what type of element we're dealing with
|
// $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)
|
// 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
|
if($Type == 'e') { // End of list
|
||||||
$this->Pos += 1;
|
$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.
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the bencoded element.
|
// Decode the bencoded element.
|
||||||
// This function changes $this->Pos and $this->Val, so you don't have to.
|
// This function changes $this->Pos and $this->Val, so you don't have to.
|
||||||
$this->decode($Type, $Key);
|
$this->decode($Type, $Key);
|
||||||
@ -180,22 +180,22 @@ function enc(){
|
|||||||
}
|
}
|
||||||
return $Str.'e';
|
return $Str.'e';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode a dictionary
|
// Decode a dictionary
|
||||||
function dec(){
|
function dec(){
|
||||||
$Length = strlen($this->Str);
|
$Length = strlen($this->Str);
|
||||||
while($this->Pos<$Length) {
|
while($this->Pos<$Length) {
|
||||||
|
|
||||||
if($this->Str[$this->Pos] == 'e') { // End of dictionary
|
if($this->Str[$this->Pos] == 'e') { // End of dictionary
|
||||||
$this->Pos += 1;
|
$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.
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the dictionary key
|
// Get the dictionary key
|
||||||
// Length of the key, in bytes
|
// Length of the key, in bytes
|
||||||
$KeyLen = $this->Str[$this->Pos];
|
$KeyLen = $this->Str[$this->Pos];
|
||||||
|
|
||||||
// Allow for multi-digit lengths
|
// Allow for multi-digit lengths
|
||||||
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
|
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
|
||||||
$this->Pos++;
|
$this->Pos++;
|
||||||
@ -204,21 +204,21 @@ function dec(){
|
|||||||
// $this->Pos is now on the last letter of the key length
|
// $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
|
// Adding 2 brings it past that character and the ':' to the beginning of the string
|
||||||
$this->Pos+=2;
|
$this->Pos+=2;
|
||||||
|
|
||||||
// Get the name of the key
|
// 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
|
// Move the position past the key to the beginning of the element
|
||||||
$this->Pos+=$KeyLen;
|
$this->Pos+=$KeyLen;
|
||||||
$Type = $this->Str[$this->Pos];
|
$Type = $this->Str[$this->Pos];
|
||||||
// $Type now indicates what type of element we're dealing with
|
// $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)
|
// 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.
|
// Decode the bencoded element.
|
||||||
// This function changes $this->Pos and $this->Val, so you don't have to.
|
// This function changes $this->Pos and $this->Val, so you don't have to.
|
||||||
$this->decode($Type, $Key);
|
$this->decode($Type, $Key);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -230,12 +230,12 @@ function dump() {
|
|||||||
// Convenience function used for testing and figuring out how we store the data
|
// Convenience function used for testing and figuring out how we store the data
|
||||||
print_r($this->Val);
|
print_r($this->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dump_data() {
|
function dump_data() {
|
||||||
// Function which serializes $this->Val for storage
|
// Function which serializes $this->Val for storage
|
||||||
return base64_encode(serialize($this->Val));
|
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
|
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() {
|
function set_multi_announce() {
|
||||||
@ -249,14 +249,14 @@ function set_multi_announce() {
|
|||||||
$this->Val['announce-list'] = $AnnounceList;
|
$this->Val['announce-list'] = $AnnounceList;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function set_announce_url($Announce) {
|
function set_announce_url($Announce) {
|
||||||
$this->Val['announce'] = $Announce;
|
$this->Val['announce'] = $Announce;
|
||||||
ksort($this->Val);
|
ksort($this->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array of:
|
// Returns an array of:
|
||||||
// * the files in the torrent
|
// * the files in the torrent
|
||||||
// * the total size of files described therein
|
// * the total size of files described therein
|
||||||
function file_list() {
|
function file_list() {
|
||||||
$FileList = array();
|
$FileList = array();
|
||||||
@ -276,7 +276,7 @@ function file_list() {
|
|||||||
foreach ($Files as $File) {
|
foreach ($Files as $File) {
|
||||||
$FileSize = $File->Val['length'];
|
$FileSize = $File->Val['length'];
|
||||||
$TotalSize += $FileSize;
|
$TotalSize += $FileSize;
|
||||||
|
|
||||||
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
|
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
|
||||||
$FileSizes[] = $FileSize;
|
$FileSizes[] = $FileSize;
|
||||||
$FileNames[] = $FileName;
|
$FileNames[] = $FileName;
|
||||||
@ -296,26 +296,26 @@ function get_name() {
|
|||||||
return $this->Val['info']->Val['name'];
|
return $this->Val['info']->Val['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_private() {
|
function make_private() {
|
||||||
//----- The following properties do not affect the infohash:
|
//----- The following properties do not affect the infohash:
|
||||||
|
|
||||||
// anounce-list is an unofficial extension to the protocol
|
// anounce-list is an unofficial extension to the protocol
|
||||||
// that allows for multiple trackers per torrent
|
// that allows for multiple trackers per torrent
|
||||||
unset($this->Val['announce-list']);
|
unset($this->Val['announce-list']);
|
||||||
|
|
||||||
// Bitcomet & Azureus cache peers in here
|
// Bitcomet & Azureus cache peers in here
|
||||||
unset($this->Val['nodes']);
|
unset($this->Val['nodes']);
|
||||||
|
|
||||||
// Azureus stores the dht_backup_enable flag here
|
// Azureus stores the dht_backup_enable flag here
|
||||||
unset($this->Val['azureus_properties']);
|
unset($this->Val['azureus_properties']);
|
||||||
|
|
||||||
// Remove web-seeds
|
// Remove web-seeds
|
||||||
unset($this->Val['url-list']);
|
unset($this->Val['url-list']);
|
||||||
|
|
||||||
// Remove libtorrent resume info
|
// Remove libtorrent resume info
|
||||||
unset($this->Val['libtorrent_resume']);
|
unset($this->Val['libtorrent_resume']);
|
||||||
|
|
||||||
//----- End properties that do not affect the infohash
|
//----- End properties that do not affect the infohash
|
||||||
if ($this->Val['info']->Val['private']) {
|
if ($this->Val['info']->Val['private']) {
|
||||||
return true; // Torrent is private
|
return true; // Torrent is private
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
There are 4 data types in bencode:
|
There are 4 data types in bencode:
|
||||||
* String
|
* String
|
||||||
* Int
|
* Int
|
||||||
* List - array without keys
|
* List - array without keys
|
||||||
- like array('value', 'value 2', 'value 3', 'etc')
|
- like array('value', 'value 2', 'value 3', 'etc')
|
||||||
* Dictionary - array with string keys
|
* Dictionary - array with string keys
|
||||||
- like array['key 1'] = 'value 1'; array['key 2'] = 'value 2';
|
- 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
|
- If stored as an int on 32 bit boxes, it won't allow for any size over 2 gigs
|
||||||
|
|
||||||
* Lists
|
* 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 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
|
- The list in BENCODE_LIST::$Val is populated by the BENCODE_LIST::dec() function
|
||||||
|
|
||||||
* Dictionaries
|
* 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 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
|
- The list in BENCODE_DICT::$Val is populated by the BENCODE_DICT::dec() function
|
||||||
|
|
||||||
//----- BENCODE_* Objects -----//
|
//----- 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:
|
functions:
|
||||||
|
|
||||||
* decode(Type, $Key)
|
* decode(Type, $Key)
|
||||||
@ -60,15 +60,15 @@ functions:
|
|||||||
- Relies mostly on the encode() function
|
- Relies mostly on the encode() function
|
||||||
|
|
||||||
Finally, as all torrents are just large dictionaries, the TORRENT class extends
|
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*]
|
**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
|
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
|
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
|
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
|
coded up in around 4 minutes for STC when we discovered this problem, then
|
||||||
discovered that floats aren't accurate enough to use. :(
|
discovered that floats aren't accurate enough to use. :(
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -76,7 +76,7 @@ class BENCODE {
|
|||||||
var $Val; // Decoded array
|
var $Val; // Decoded array
|
||||||
var $Pos = 1; // Pointer that indicates our position in the string
|
var $Pos = 1; // Pointer that indicates our position in the string
|
||||||
var $Str = ''; // Torrent string
|
var $Str = ''; // Torrent string
|
||||||
|
|
||||||
function __construct($Val, $IsParsed = false){
|
function __construct($Val, $IsParsed = false){
|
||||||
if(!$IsParsed) {
|
if(!$IsParsed) {
|
||||||
$this->Str = $Val;
|
$this->Str = $Val;
|
||||||
@ -96,35 +96,35 @@ function decode($Type, $Key){
|
|||||||
$StrLen.=$this->Str[$this->Pos];
|
$StrLen.=$this->Str[$this->Pos];
|
||||||
}
|
}
|
||||||
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
|
$this->Val[$Key] = substr($this->Str, $this->Pos+2, $StrLen);
|
||||||
|
|
||||||
$this->Pos+=$StrLen;
|
$this->Pos+=$StrLen;
|
||||||
$this->Pos+=2;
|
$this->Pos+=2;
|
||||||
|
|
||||||
} elseif($Type == 'i') { // Element is an int
|
} elseif($Type == 'i') { // Element is an int
|
||||||
$this->Pos++;
|
$this->Pos++;
|
||||||
|
|
||||||
// Find end of integer (first occurance of 'e' after position)
|
// 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)
|
// 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;
|
$this->Pos = $End+1;
|
||||||
|
|
||||||
} elseif($Type == 'l') { // Element is a list
|
} elseif($Type == 'l') { // Element is a list
|
||||||
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
|
$this->Val[$Key] = new BENCODE_LIST(substr($this->Str, $this->Pos));
|
||||||
$this->Pos += $this->Val[$Key]->Pos;
|
$this->Pos += $this->Val[$Key]->Pos;
|
||||||
|
|
||||||
} elseif($Type == 'd') { // Element is a dictionary
|
} elseif($Type == 'd') { // Element is a dictionary
|
||||||
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
|
$this->Val[$Key] = new BENCODE_DICT(substr($this->Str, $this->Pos));
|
||||||
$this->Pos += $this->Val[$Key]->Pos;
|
$this->Pos += $this->Val[$Key]->Pos;
|
||||||
// Sort by key to respect spec
|
// Sort by key to respect spec
|
||||||
ksort($this->Val[$Key]->Val);
|
ksort($this->Val[$Key]->Val);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
die('Invalid torrent file');
|
die('Invalid torrent file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function encode($Val){
|
function encode($Val){
|
||||||
if(is_string($Val)) {
|
if(is_string($Val)) {
|
||||||
if(substr($Val, 0, 7) == '[*INT*]') {
|
if(substr($Val, 0, 7) == '[*INT*]') {
|
||||||
@ -149,7 +149,7 @@ function enc(){
|
|||||||
}
|
}
|
||||||
return $Str.'e';
|
return $Str.'e';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode a list
|
// Decode a list
|
||||||
function dec(){
|
function dec(){
|
||||||
$Key = 0; // Array index
|
$Key = 0; // Array index
|
||||||
@ -158,13 +158,13 @@ function dec(){
|
|||||||
$Type = $this->Str[$this->Pos];
|
$Type = $this->Str[$this->Pos];
|
||||||
// $Type now indicates what type of element we're dealing with
|
// $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)
|
// 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
|
if($Type == 'e') { // End of list
|
||||||
$this->Pos += 1;
|
$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.
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the bencoded element.
|
// Decode the bencoded element.
|
||||||
// This function changes $this->Pos and $this->Val, so you don't have to.
|
// This function changes $this->Pos and $this->Val, so you don't have to.
|
||||||
$this->decode($Type, $Key);
|
$this->decode($Type, $Key);
|
||||||
@ -183,22 +183,22 @@ function enc(){
|
|||||||
}
|
}
|
||||||
return $Str.'e';
|
return $Str.'e';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode a dictionary
|
// Decode a dictionary
|
||||||
function dec(){
|
function dec(){
|
||||||
$Length = strlen($this->Str);
|
$Length = strlen($this->Str);
|
||||||
while($this->Pos<$Length) {
|
while($this->Pos<$Length) {
|
||||||
|
|
||||||
if($this->Str[$this->Pos] == 'e') { // End of dictionary
|
if($this->Str[$this->Pos] == 'e') { // End of dictionary
|
||||||
$this->Pos += 1;
|
$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.
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the dictionary key
|
// Get the dictionary key
|
||||||
// Length of the key, in bytes
|
// Length of the key, in bytes
|
||||||
$KeyLen = $this->Str[$this->Pos];
|
$KeyLen = $this->Str[$this->Pos];
|
||||||
|
|
||||||
// Allow for multi-digit lengths
|
// Allow for multi-digit lengths
|
||||||
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
|
while($this->Str[$this->Pos+1]!=':' && $this->Pos+1<$Length) {
|
||||||
$this->Pos++;
|
$this->Pos++;
|
||||||
@ -207,21 +207,21 @@ function dec(){
|
|||||||
// $this->Pos is now on the last letter of the key length
|
// $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
|
// Adding 2 brings it past that character and the ':' to the beginning of the string
|
||||||
$this->Pos+=2;
|
$this->Pos+=2;
|
||||||
|
|
||||||
// Get the name of the key
|
// 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
|
// Move the position past the key to the beginning of the element
|
||||||
$this->Pos+=$KeyLen;
|
$this->Pos+=$KeyLen;
|
||||||
$Type = $this->Str[$this->Pos];
|
$Type = $this->Str[$this->Pos];
|
||||||
// $Type now indicates what type of element we're dealing with
|
// $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)
|
// 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.
|
// Decode the bencoded element.
|
||||||
// This function changes $this->Pos and $this->Val, so you don't have to.
|
// This function changes $this->Pos and $this->Val, so you don't have to.
|
||||||
$this->decode($Type, $Key);
|
$this->decode($Type, $Key);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -233,19 +233,19 @@ function dump() {
|
|||||||
// Convenience function used for testing and figuring out how we store the data
|
// Convenience function used for testing and figuring out how we store the data
|
||||||
print_r($this->Val);
|
print_r($this->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dump_data() {
|
function dump_data() {
|
||||||
// Function which serializes $this->Val for storage
|
// Function which serializes $this->Val for storage
|
||||||
return base64_encode(serialize($this->Val));
|
return base64_encode(serialize($this->Val));
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_announce_url($Announce) {
|
function set_announce_url($Announce) {
|
||||||
$this->Val['announce'] = $Announce;
|
$this->Val['announce'] = $Announce;
|
||||||
ksort($this->Val);
|
ksort($this->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array of:
|
// Returns an array of:
|
||||||
// * the files in the torrent
|
// * the files in the torrent
|
||||||
// * the total size of files described therein
|
// * the total size of files described therein
|
||||||
function file_list() {
|
function file_list() {
|
||||||
$FileList = array();
|
$FileList = array();
|
||||||
@ -265,7 +265,7 @@ function file_list() {
|
|||||||
foreach ($Files as $File) {
|
foreach ($Files as $File) {
|
||||||
$FileSize = substr($File->Val['length'], 7);
|
$FileSize = substr($File->Val['length'], 7);
|
||||||
$TotalSize += $FileSize;
|
$TotalSize += $FileSize;
|
||||||
|
|
||||||
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
|
$FileName = ltrim(implode('/',$File->Val[$PathKey]->Val), '/');
|
||||||
$FileSizes[] = $FileSize;
|
$FileSizes[] = $FileSize;
|
||||||
$FileNames[] = $FileName;
|
$FileNames[] = $FileName;
|
||||||
@ -285,7 +285,7 @@ function get_name() {
|
|||||||
return $this->Val['info']->Val['name'];
|
return $this->Val['info']->Val['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_private() {
|
function make_private() {
|
||||||
//----- The following properties do not affect the infohash:
|
//----- The following properties do not affect the infohash:
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
|||||||
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||||
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache it all
|
// Cache it all
|
||||||
foreach ($Found as $GroupID=>$GroupInfo) {
|
foreach ($Found as $GroupID=>$GroupInfo) {
|
||||||
$Cache->cache_value('torrent_group_'.$GroupID,
|
$Cache->cache_value('torrent_group_'.$GroupID,
|
||||||
@ -639,7 +639,7 @@ public static function can_use_token($Torrent) {
|
|||||||
&& $LoggedUser['CanLeech'] == '1');
|
&& $LoggedUser['CanLeech'] == '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function has_snatched($TorrentID) {
|
public static function has_snatched($TorrentID) {
|
||||||
global $DB, $Cache, $LoggedUser;
|
global $DB, $Cache, $LoggedUser;
|
||||||
if (empty($LoggedUser) || !$LoggedUser['ShowSnatched']) {
|
if (empty($LoggedUser) || !$LoggedUser['ShowSnatched']) {
|
||||||
|
@ -21,6 +21,8 @@ class TorrentsDL {
|
|||||||
* @param string $Title name of the collection that will be created
|
* @param string $Title name of the collection that will be created
|
||||||
*/
|
*/
|
||||||
public function __construct(&$QueryResult, $Title) {
|
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
|
Zip::unlimit(); // Need more memory and longer timeout
|
||||||
$this->QueryResult = $QueryResult;
|
$this->QueryResult = $QueryResult;
|
||||||
$this->Title = $Title;
|
$this->Title = $Title;
|
||||||
@ -168,6 +170,7 @@ public function errors() {
|
|||||||
* @return file name with at most 180 characters that is valid on most systems
|
* @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) {
|
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);
|
$TorrentName = Misc::file_string($Album);
|
||||||
if ($Year > 0) {
|
if ($Year > 0) {
|
||||||
$TorrentName .= " - $Year";
|
$TorrentName .= " - $Year";
|
||||||
@ -190,8 +193,8 @@ public static function construct_file_name($Artist, $Album, $Year, $Media, $Form
|
|||||||
|
|
||||||
if (!$TorrentName) {
|
if (!$TorrentName) {
|
||||||
$TorrentName = "No Name";
|
$TorrentName = "No Name";
|
||||||
} else if (strlen($TorrentName . $TorrentInfo) <= 197) {
|
} else if (strlen($Artist . $TorrentName . $TorrentInfo) <= 196) {
|
||||||
$TorrentName = Misc::file_string($Artist) . $TorrentName;
|
$TorrentName = $Artist . $TorrentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave some room to the user in case the file system limits the path length
|
// Leave some room to the user in case the file system limits the path length
|
||||||
|
@ -3,33 +3,33 @@
|
|||||||
define('PREFIX', 'percentiles_'); // Prefix for memcache keys, to make life easier
|
define('PREFIX', 'percentiles_'); // Prefix for memcache keys, to make life easier
|
||||||
|
|
||||||
class USER_RANK {
|
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
|
// Returns a 101 row array (101 percentiles - 0 - 100), with the minimum value for that percentile as the value for each row
|
||||||
// BTW - ingenious
|
// BTW - ingenious
|
||||||
function build_table($MemKey, $Query) {
|
function build_table($MemKey, $Query) {
|
||||||
global $Cache,$DB;
|
global $Cache,$DB;
|
||||||
|
|
||||||
$DB->query("DROP TEMPORARY TABLE IF EXISTS temp_stats");
|
$DB->query("DROP TEMPORARY TABLE IF EXISTS temp_stats");
|
||||||
|
|
||||||
$DB->query("CREATE TEMPORARY TABLE temp_stats
|
$DB->query("CREATE TEMPORARY TABLE temp_stats
|
||||||
(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
Val bigint(20) NOT NULL);");
|
Val bigint(20) NOT NULL);");
|
||||||
|
|
||||||
$DB->query("INSERT INTO temp_stats (Val) ".$Query);
|
$DB->query("INSERT INTO temp_stats (Val) ".$Query);
|
||||||
|
|
||||||
$DB->query("SELECT COUNT(ID) FROM temp_stats");
|
$DB->query("SELECT COUNT(ID) FROM temp_stats");
|
||||||
list($UserCount) = $DB->next_record();
|
list($UserCount) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("SELECT MIN(Val) FROM temp_stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
|
$DB->query("SELECT MIN(Val) FROM temp_stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
|
||||||
|
|
||||||
$Table = $DB->to_array();
|
$Table = $DB->to_array();
|
||||||
|
|
||||||
// Give a little variation to the cache length, so all the tables don't expire at the same time
|
// 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;
|
return $Table;
|
||||||
}
|
}
|
||||||
|
|
||||||
function table_query($TableName) {
|
function table_query($TableName) {
|
||||||
switch($TableName) {
|
switch($TableName) {
|
||||||
case 'uploaded':
|
case 'uploaded':
|
||||||
@ -57,11 +57,11 @@ function table_query($TableName) {
|
|||||||
}
|
}
|
||||||
return $Query;
|
return $Query;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_rank($TableName, $Value) {
|
function get_rank($TableName, $Value) {
|
||||||
if($Value == 0) { return 0; }
|
if($Value == 0) { return 0; }
|
||||||
global $Cache, $DB;
|
global $Cache, $DB;
|
||||||
|
|
||||||
$Table = $Cache->get_value(PREFIX.$TableName);
|
$Table = $Cache->get_value(PREFIX.$TableName);
|
||||||
if(!$Table) {
|
if(!$Table) {
|
||||||
//Cache lock!
|
//Cache lock!
|
||||||
@ -84,7 +84,7 @@ function get_rank($TableName, $Value) {
|
|||||||
}
|
}
|
||||||
return 100; // 100th percentile
|
return 100; // 100th percentile
|
||||||
}
|
}
|
||||||
|
|
||||||
function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bounty, $Artists, $Ratio){
|
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
|
// We can do this all in 1 line, but it's easier to read this way
|
||||||
if($Ratio>1) { $Ratio = 1; }
|
if($Ratio>1) { $Ratio = 1; }
|
||||||
@ -103,7 +103,7 @@ function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bou
|
|||||||
$TotalScore *= $Ratio;
|
$TotalScore *= $Ratio;
|
||||||
return $TotalScore;
|
return $TotalScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class USER_AGENT {
|
|||||||
'RSS' => 'RSS Downloader'
|
'RSS' => 'RSS Downloader'
|
||||||
*/
|
*/
|
||||||
);
|
);
|
||||||
|
|
||||||
var $OperatingSystems = array(
|
var $OperatingSystems = array(
|
||||||
//Mobile
|
//Mobile
|
||||||
'SymbianOS' => 'Symbian',
|
'SymbianOS' => 'Symbian',
|
||||||
@ -105,7 +105,7 @@ class USER_AGENT {
|
|||||||
'win' => 'Windows',
|
'win' => 'Windows',
|
||||||
'mac' => 'Mac OS X'
|
'mac' => 'Mac OS X'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function operating_system(&$UserAgentString) {
|
public function operating_system(&$UserAgentString) {
|
||||||
if (empty($UserAgentString)) {
|
if (empty($UserAgentString)) {
|
||||||
return 'Hidden';
|
return 'Hidden';
|
||||||
@ -119,19 +119,19 @@ public function operating_system(&$UserAgentString) {
|
|||||||
}
|
}
|
||||||
return $Return;
|
return $Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mobile(&$UserAgentString) {
|
public function mobile(&$UserAgentString) {
|
||||||
if (strpos($UserAgentString, 'iPad')) {
|
if (strpos($UserAgentString, 'iPad')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mobi catches Mobile
|
//Mobi catches Mobile
|
||||||
if (/*strpos($UserAgentString, 'Mobile') || */strpos($UserAgentString, 'Device') || strpos($UserAgentString, 'Mobi') || strpos($UserAgentString, 'Mini') || strpos($UserAgentString, 'webOS')) {
|
if (/*strpos($UserAgentString, 'Mobile') || */strpos($UserAgentString, 'Device') || strpos($UserAgentString, 'Mobi') || strpos($UserAgentString, 'Mini') || strpos($UserAgentString, 'webOS')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function browser(&$UserAgentString) {
|
public function browser(&$UserAgentString) {
|
||||||
if (empty($UserAgentString)) {
|
if (empty($UserAgentString)) {
|
||||||
return 'Hidden';
|
return 'Hidden';
|
||||||
|
@ -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 .= ($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&id=218"'
|
$Str .= ($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&id=218"'
|
||||||
. '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
|
. '><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'])) : '')
|
. ($LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d h:i', strtotime($UserInfo['Warned'])) : '')
|
||||||
. '" /></a>' : '';
|
. '" /></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>' : '';
|
$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>' : '';
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public static function render_template ($TemplateName, $Args)
|
|||||||
* @example <pre><?php
|
* @example <pre><?php
|
||||||
* // box.phtml
|
* // box.phtml
|
||||||
* <p id="<?=$id?>">Data</p>
|
* <p id="<?=$id?>">Data</p>
|
||||||
*
|
*
|
||||||
* // The variable $id within box.phtml will be filled by $some_id
|
* // The variable $id within box.phtml will be filled by $some_id
|
||||||
* View::parse('section/box.phtml', array('id' => $some_id));
|
* View::parse('section/box.phtml', array('id' => $some_id));
|
||||||
*
|
*
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
## Wiki class ##
|
## 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.
|
reasons - JOINs instead of multiple queries), this class is rather bare.
|
||||||
|
|
||||||
The only useful function in here is revision_history(). It creates a
|
The only useful function in here is revision_history(). It creates a
|
||||||
table with the revision history for that particular wiki page.
|
table with the revision history for that particular wiki page.
|
||||||
|
|
||||||
|
|
||||||
class_wiki depends on your wiki table being structured like this:
|
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 | |
|
| 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
|
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->PageID = $PageID;
|
||||||
$this->BaseURL = $BaseURL;
|
$this->BaseURL = $BaseURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function revision_history(){
|
function revision_history(){
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
$BaseURL = $this->BaseURL;
|
$BaseURL = $this->BaseURL;
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
RevisionID,
|
RevisionID,
|
||||||
Summary,
|
Summary,
|
||||||
Time,
|
Time,
|
||||||
UserID
|
UserID
|
||||||
@ -62,7 +62,7 @@ function revision_history(){
|
|||||||
</tr>
|
</tr>
|
||||||
<? //-----------------------------------------
|
<? //-----------------------------------------
|
||||||
$Row = 'a';
|
$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';
|
$Row = ($Row == 'a') ? 'b' : 'a';
|
||||||
//------------------------------------------------------ ?>
|
//------------------------------------------------------ ?>
|
||||||
<tr class="row<?=$Row?>">
|
<tr class="row<?=$Row?>">
|
||||||
@ -84,7 +84,7 @@ function revision_history(){
|
|||||||
//-------------------------------------------- ?>
|
//-------------------------------------------- ?>
|
||||||
</table>
|
</table>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
}
|
}
|
||||||
} // class
|
} // class
|
||||||
?>
|
?>
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|*************************************************************************|
|
|*************************************************************************|
|
||||||
|
|
||||||
This class provides a convenient way for us to generate and serve zip
|
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
|
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.
|
downloaded twice.
|
||||||
|
|
||||||
Utilizes gzcompress, based upon RFC 1950
|
Utilizes gzcompress, based upon RFC 1950
|
||||||
@ -39,7 +39,7 @@
|
|||||||
$Zip->add_file($TorrentData, "Bookmarks/Artist - Album [2008].torrent");
|
$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).
|
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:
|
* Then, close the archive to the user:
|
||||||
@ -96,12 +96,12 @@ class Zip {
|
|||||||
private $Structure = ''; // Structure saved to memory
|
private $Structure = ''; // Structure saved to memory
|
||||||
private $FileOffset = 0; // Offset to write data
|
private $FileOffset = 0; // Offset to write data
|
||||||
private $Data = ''; //An idea
|
private $Data = ''; //An idea
|
||||||
|
|
||||||
public function __construct ($ArchiveName='Archive') {
|
public function __construct ($ArchiveName='Archive') {
|
||||||
header("Content-type: application/octet-stream"); //Stream download
|
header("Content-type: application/octet-stream"); //Stream download
|
||||||
header("Content-disposition: attachment; filename=\"$ArchiveName.zip\""); //Name the archive - Should not be urlencoded
|
header("Content-disposition: attachment; filename=\"$ArchiveName.zip\""); //Name the archive - Should not be urlencoded
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function unlimit () {
|
public static function unlimit () {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
set_time_limit(3600); //Limit 1 hour
|
set_time_limit(3600); //Limit 1 hour
|
||||||
@ -121,7 +121,7 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
|
|||||||
$ZipData = gzcompress($FileData); // Ditto.
|
$ZipData = gzcompress($FileData); // Ditto.
|
||||||
$ZipData = substr ($ZipData, 2,(strlen($ZipData) - 6)); // Checksum resolution
|
$ZipData = substr ($ZipData, 2,(strlen($ZipData) - 6)); // Checksum resolution
|
||||||
$ZipLength = strlen($ZipData); //Ditto.
|
$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",$ZipLength); // Compressed filesize
|
||||||
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
|
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
|
||||||
$this->Data .= pack("v",strlen($ArchivePath)); // Pathname length
|
$this->Data .= pack("v",strlen($ArchivePath)); // Pathname length
|
||||||
@ -136,10 +136,10 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
|
|||||||
/* Data descriptor
|
/* Data descriptor
|
||||||
Not needed (only needed when 3rd bitflag is set), causes problems with OS X archive utility
|
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",$CRC32); // CRC-32
|
||||||
$this->Data .= pack("V",$ZipLength); // Compressed filesize
|
$this->Data .= pack("V",$ZipLength); // Compressed filesize
|
||||||
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
|
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
|
||||||
END data descriptor */
|
END data descriptor */
|
||||||
|
|
||||||
$FileDataLength = strlen($this->Data);
|
$FileDataLength = strlen($this->Data);
|
||||||
$this->ArchiveSize = $this->ArchiveSize + $FileDataLength; // All we really need is the size
|
$this->ArchiveSize = $this->ArchiveSize + $FileDataLength; // All we really need is the size
|
||||||
$CurrentOffset = $this->ArchiveSize; // Update offsets
|
$CurrentOffset = $this->ArchiveSize; // Update offsets
|
||||||
@ -148,14 +148,14 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
|
|||||||
/* Central Directory Structure */
|
/* Central Directory Structure */
|
||||||
$CDS = "\x50\x4b\x01\x02"; // CDS signature
|
$CDS = "\x50\x4b\x01\x02"; // CDS signature
|
||||||
$CDS .="\x14\x00"; // Constructor version
|
$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 .="\x00\x08"; // Bit flag - 0x8 = UTF-8 file names
|
||||||
$CDS .="\x08\x00"; // Compression
|
$CDS .="\x08\x00"; // Compression
|
||||||
$CDS .="\x00\x00\x00\x00"; // Last modified
|
$CDS .="\x00\x00\x00\x00"; // Last modified
|
||||||
$CDS .= pack("V",$CRC32); // CRC-32
|
$CDS .= pack("V",$CRC32); // CRC-32
|
||||||
$CDS .= pack("V",$ZipLength); // Compressed filesize
|
$CDS .= pack("V",$ZipLength); // Compressed filesize
|
||||||
$CDS .= pack("V",$DataLength); // Uncompressed filesize
|
$CDS .= pack("V",$DataLength); // Uncompressed filesize
|
||||||
$CDS .= pack("v",strlen($ArchivePath)); // Pathname length
|
$CDS .= pack("v",strlen($ArchivePath)); // Pathname length
|
||||||
$CDS .="\x00\x00"; // Extra field length (0'd so we can ignore this)
|
$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"; // File comment length (no comment, 0'd)
|
||||||
$CDS .="\x00\x00"; // Disk number start (0 seems valid)
|
$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() {
|
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 "\x50\x4b\x05\x06"; // End of central directory signature
|
||||||
echo "\x00\x00"; // This disk
|
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); // Handle the numebr of entries
|
||||||
echo pack("v", $this->ArchiveFiles); // Ditto
|
echo pack("v", $this->ArchiveFiles); // Ditto
|
||||||
echo pack("V", strlen($this->Structure)); //Size
|
echo pack("V", strlen($this->Structure)); //Size
|
||||||
echo pack("V", $this->ArchiveSize); // Offset
|
echo pack("V", $this->ArchiveSize); // Offset
|
||||||
echo "\x00\x00"; // No comment, close it off
|
echo "\x00\x00"; // No comment, close it off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
** This function is used to create both the class permissions form, and the **
|
** This function is used to create both the class permissions form, and the **
|
||||||
** user custom permissions form. **
|
** user custom permissions form. **
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
$PermissionsArray = array(
|
$PermissionsArray = array(
|
||||||
'site_leech' => 'Can leech (Does this work?).',
|
'site_leech' => 'Can leech (Does this work?).',
|
||||||
'site_upload' => 'Upload torrent access.',
|
'site_upload' => 'Upload torrent access.',
|
||||||
@ -31,7 +31,7 @@
|
|||||||
'site_moderate_requests' => 'Request moderation access.',
|
'site_moderate_requests' => 'Request moderation access.',
|
||||||
'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).',
|
'site_delete_artist' => 'Can delete artists (must be able to delete torrents+requests).',
|
||||||
'site_moderate_forums' => 'Forum moderation access.',
|
'site_moderate_forums' => 'Forum moderation access.',
|
||||||
|
|
||||||
'site_admin_forums' => 'Forum administrator access.',
|
'site_admin_forums' => 'Forum administrator access.',
|
||||||
'site_forums_double_post' => 'Can double post in the forums.',
|
'site_forums_double_post' => 'Can double post in the forums.',
|
||||||
'site_view_flow' => 'Can view stats and data pools.',
|
'site_view_flow' => 'Can view stats and data pools.',
|
||||||
@ -113,7 +113,7 @@
|
|||||||
'artist_edit_vanityhouse' => 'Can mark artists as part of Vanity House.'
|
'artist_edit_vanityhouse' => 'Can mark artists as part of Vanity House.'
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
function permissions_form(){ ?>
|
function permissions_form(){ ?>
|
||||||
<div class="permissions">
|
<div class="permissions">
|
||||||
<div class="permission_container">
|
<div class="permission_container">
|
||||||
@ -216,9 +216,9 @@ function permissions_form(){ ?>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<? display_perm('torrents_edit', 'Can edit any torrent'); ?>
|
<? display_perm('torrents_edit', 'Can edit any torrent'); ?>
|
||||||
|
|
||||||
<? display_perm('torrents_delete', 'Can delete torrents'); ?>
|
<? display_perm('torrents_delete', 'Can delete torrents'); ?>
|
||||||
<? display_perm('torrents_delete_fast', 'Can delete more than 3 torrents at a time.'); ?>
|
<? display_perm('torrents_delete_fast', 'Can delete more than 3 torrents at a time.'); ?>
|
||||||
<? display_perm('torrents_freeleech', 'Can make torrents freeleech'); ?>
|
<? display_perm('torrents_freeleech', 'Can make torrents freeleech'); ?>
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
function sphPackI64 ( $v )
|
function sphPackI64 ( $v )
|
||||||
{
|
{
|
||||||
assert ( is_numeric($v) );
|
assert ( is_numeric($v) );
|
||||||
|
|
||||||
// x64
|
// x64
|
||||||
if ( PHP_INT_SIZE>=8 )
|
if ( PHP_INT_SIZE>=8 )
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ function sphPackI64 ( $v )
|
|||||||
if ( is_int($v) )
|
if ( is_int($v) )
|
||||||
return pack ( "NN", $v < 0 ? -1 : 0, $v );
|
return pack ( "NN", $v < 0 ? -1 : 0, $v );
|
||||||
|
|
||||||
// x32, bcmath
|
// x32, bcmath
|
||||||
if ( function_exists("bcmul") )
|
if ( function_exists("bcmul") )
|
||||||
{
|
{
|
||||||
if ( bccomp ( $v, 0 ) == -1 )
|
if ( bccomp ( $v, 0 ) == -1 )
|
||||||
@ -174,16 +174,16 @@ function sphPackI64 ( $v )
|
|||||||
function sphPackU64 ( $v )
|
function sphPackU64 ( $v )
|
||||||
{
|
{
|
||||||
assert ( is_numeric($v) );
|
assert ( is_numeric($v) );
|
||||||
|
|
||||||
// x64
|
// x64
|
||||||
if ( PHP_INT_SIZE>=8 )
|
if ( PHP_INT_SIZE>=8 )
|
||||||
{
|
{
|
||||||
assert ( $v>=0 );
|
assert ( $v>=0 );
|
||||||
|
|
||||||
// x64, int
|
// x64, int
|
||||||
if ( is_int($v) )
|
if ( is_int($v) )
|
||||||
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
|
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
|
||||||
|
|
||||||
// x64, bcmath
|
// x64, bcmath
|
||||||
if ( function_exists("bcmul") )
|
if ( function_exists("bcmul") )
|
||||||
{
|
{
|
||||||
@ -191,12 +191,12 @@ function sphPackU64 ( $v )
|
|||||||
$l = bcmod ( $v, 4294967296 );
|
$l = bcmod ( $v, 4294967296 );
|
||||||
return pack ( "NN", $h, $l );
|
return pack ( "NN", $h, $l );
|
||||||
}
|
}
|
||||||
|
|
||||||
// x64, no-bcmath
|
// x64, no-bcmath
|
||||||
$p = max ( 0, strlen($v) - 13 );
|
$p = max ( 0, strlen($v) - 13 );
|
||||||
$lo = (int)substr ( $v, $p );
|
$lo = (int)substr ( $v, $p );
|
||||||
$hi = (int)substr ( $v, 0, $p );
|
$hi = (int)substr ( $v, 0, $p );
|
||||||
|
|
||||||
$m = $lo + $hi*1316134912;
|
$m = $lo + $hi*1316134912;
|
||||||
$l = $m % 4294967296;
|
$l = $m % 4294967296;
|
||||||
$h = $hi*2328 + (int)($m/4294967296);
|
$h = $hi*2328 + (int)($m/4294967296);
|
||||||
@ -207,7 +207,7 @@ function sphPackU64 ( $v )
|
|||||||
// x32, int
|
// x32, int
|
||||||
if ( is_int($v) )
|
if ( is_int($v) )
|
||||||
return pack ( "NN", 0, $v );
|
return pack ( "NN", 0, $v );
|
||||||
|
|
||||||
// x32, bcmath
|
// x32, bcmath
|
||||||
if ( function_exists("bcmul") )
|
if ( function_exists("bcmul") )
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ function sphPackU64 ( $v )
|
|||||||
$p = max(0, strlen($v) - 13);
|
$p = max(0, strlen($v) - 13);
|
||||||
$lo = (float)substr($v, $p);
|
$lo = (float)substr($v, $p);
|
||||||
$hi = (float)substr($v, 0, $p);
|
$hi = (float)substr($v, 0, $p);
|
||||||
|
|
||||||
$m = $lo + $hi*1316134912.0;
|
$m = $lo + $hi*1316134912.0;
|
||||||
$q = floor($m / 4294967296.0);
|
$q = floor($m / 4294967296.0);
|
||||||
$l = $m - ($q * 4294967296.0);
|
$l = $m - ($q * 4294967296.0);
|
||||||
@ -276,11 +276,11 @@ function sphUnpackU64 ( $v )
|
|||||||
// x32, bcmath
|
// x32, bcmath
|
||||||
if ( function_exists("bcmul") )
|
if ( function_exists("bcmul") )
|
||||||
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
|
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
|
||||||
|
|
||||||
// x32, no-bcmath
|
// x32, no-bcmath
|
||||||
$hi = (float)$hi;
|
$hi = (float)$hi;
|
||||||
$lo = (float)$lo;
|
$lo = (float)$lo;
|
||||||
|
|
||||||
$q = floor($hi/10000000.0);
|
$q = floor($hi/10000000.0);
|
||||||
$r = $hi - $q*10000000.0;
|
$r = $hi - $q*10000000.0;
|
||||||
$m = $lo + $r*4967296.0;
|
$m = $lo + $r*4967296.0;
|
||||||
@ -323,7 +323,7 @@ function sphUnpackI64 ( $v )
|
|||||||
return $lo;
|
return $lo;
|
||||||
return sprintf ( "%.0f", $lo - 4294967296.0 );
|
return sprintf ( "%.0f", $lo - 4294967296.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
$neg = "";
|
$neg = "";
|
||||||
$c = 0;
|
$c = 0;
|
||||||
if ( $hi<0 )
|
if ( $hi<0 )
|
||||||
@ -332,7 +332,7 @@ function sphUnpackI64 ( $v )
|
|||||||
$lo = ~$lo;
|
$lo = ~$lo;
|
||||||
$c = 1;
|
$c = 1;
|
||||||
$neg = "-";
|
$neg = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
$hi = sprintf ( "%u", $hi );
|
$hi = sprintf ( "%u", $hi );
|
||||||
$lo = sprintf ( "%u", $lo );
|
$lo = sprintf ( "%u", $lo );
|
||||||
@ -344,7 +344,7 @@ function sphUnpackI64 ( $v )
|
|||||||
// x32, no-bcmath
|
// x32, no-bcmath
|
||||||
$hi = (float)$hi;
|
$hi = (float)$hi;
|
||||||
$lo = (float)$lo;
|
$lo = (float)$lo;
|
||||||
|
|
||||||
$q = floor($hi/10000000.0);
|
$q = floor($hi/10000000.0);
|
||||||
$r = $hi - $q*10000000.0;
|
$r = $hi - $q*10000000.0;
|
||||||
$m = $lo + $r*4967296.0;
|
$m = $lo + $r*4967296.0;
|
||||||
@ -507,7 +507,7 @@ function SetServer ( $host, $port = 0 )
|
|||||||
$this->_path = $host;
|
$this->_path = $host;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert ( is_int($port) );
|
assert ( is_int($port) );
|
||||||
$this->_host = $host;
|
$this->_host = $host;
|
||||||
$this->_port = $port;
|
$this->_port = $port;
|
||||||
@ -587,14 +587,14 @@ function _Connect ()
|
|||||||
$fp = @fsockopen ( $host, $port, $errno, $errstr );
|
$fp = @fsockopen ( $host, $port, $errno, $errstr );
|
||||||
else
|
else
|
||||||
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
|
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
|
||||||
|
|
||||||
if ( !$fp )
|
if ( !$fp )
|
||||||
{
|
{
|
||||||
if ( $this->_path )
|
if ( $this->_path )
|
||||||
$location = $this->_path;
|
$location = $this->_path;
|
||||||
else
|
else
|
||||||
$location = "{$this->_host}:{$this->_port}";
|
$location = "{$this->_host}:{$this->_port}";
|
||||||
|
|
||||||
$errstr = trim ( $errstr );
|
$errstr = trim ( $errstr );
|
||||||
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
|
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
|
||||||
$this->_connerror = true;
|
$this->_connerror = true;
|
||||||
@ -1228,7 +1228,7 @@ function _ParseSearchResponse ( $response, $nreqs )
|
|||||||
if ( $type==SPH_ATTR_FLOAT )
|
if ( $type==SPH_ATTR_FLOAT )
|
||||||
{
|
{
|
||||||
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
|
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;
|
$attrvals[$attr] = $fval;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1257,7 +1257,7 @@ function _ParseSearchResponse ( $response, $nreqs )
|
|||||||
} else if ( $type==SPH_ATTR_STRING )
|
} else if ( $type==SPH_ATTR_STRING )
|
||||||
{
|
{
|
||||||
$attrvals[$attr] = substr ( $response, $p, $val );
|
$attrvals[$attr] = substr ( $response, $p, $val );
|
||||||
$p += $val;
|
$p += $val;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$attrvals[$attr] = sphFixUint($val);
|
$attrvals[$attr] = sphFixUint($val);
|
||||||
@ -1624,7 +1624,7 @@ function Close()
|
|||||||
|
|
||||||
fclose ( $this->_socket );
|
fclose ( $this->_socket );
|
||||||
$this->_socket = false;
|
$this->_socket = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?
|
<?
|
||||||
define('ERROR_EXCEPTION', true);
|
define('ERROR_EXCEPTION', true);
|
||||||
require('classes/script_start.php');
|
require('classes/script_start.php');
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Load = sys_getloadavg();
|
$Load = sys_getloadavg();
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
|
@ -264,8 +264,6 @@
|
|||||||
$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
|
$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
|
||||||
}
|
}
|
||||||
if ($SBlogReadTime < $LatestSBlogTime) {
|
if ($SBlogReadTime < $LatestSBlogTime) {
|
||||||
global $Debug;
|
|
||||||
$Debug->log_var(array('b' => $SBlogReadTime, 'l' => $LatestSBlogTime), 'Times');
|
|
||||||
$Alerts[] = '<a href="staffblog.php">'.'New Staff Blog Post!'.'</a>';
|
$Alerts[] = '<a href="staffblog.php">'.'New Staff Blog Post!'.'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +357,7 @@
|
|||||||
list($NumTorrentReports) = $DB->next_record();
|
list($NumTorrentReports) = $DB->next_record();
|
||||||
$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
|
$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
|
$ModBar[] = '<a href="reportsv2.php">'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +411,7 @@
|
|||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
//Done handling alertbars
|
//Done handling alertbars
|
||||||
|
|
||||||
if(!$Mobile && $LoggedUser['Rippy'] != 'Off') {
|
if(!$Mobile && $LoggedUser['Rippy'] != 'Off') {
|
||||||
switch($LoggedUser['Rippy']) {
|
switch($LoggedUser['Rippy']) {
|
||||||
case 'PM' :
|
case 'PM' :
|
||||||
@ -446,7 +444,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="rippy" onclick="rippyclick();"></div>
|
<div class="rippy" onclick="rippyclick();"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
|
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
|
||||||
<? if ($Mobile) { ?>
|
<? if ($Mobile) { ?>
|
||||||
<script src="<?=STATIC_SERVER?>styles/mobile/style.js?v=<?=filemtime(SERVER_ROOT.'/static/mobile/style.js')?>" type="text/javascript"></script>
|
<script src="<?=STATIC_SERVER?>styles/mobile/style.js?v=<?=filemtime(SERVER_ROOT.'/static/mobile/style.js')?>" type="text/javascript"></script>
|
||||||
<? }
|
<? }
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</head>
|
</head>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">Home</a></li>
|
<li><a href="index.php">Home</a></li>
|
||||||
<li><a href="login.php">Login</a></li>
|
<li><a href="login.php">Login</a></li>
|
||||||
<? if (OPEN_REGISTRATION) { ?>
|
<? if (OPEN_REGISTRATION) { ?>
|
||||||
<li><a href="register.php">Register</a></li>
|
<li><a href="register.php">Register</a></li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?
|
<?
|
||||||
define('ERROR_EXCEPTION', true);
|
define('ERROR_EXCEPTION', true);
|
||||||
require('classes/script_start.php');
|
require('classes/script_start.php');
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
if (preg_match('/PING :(.+)$/', $Line, $Ping)) {
|
if (preg_match('/PING :(.+)$/', $Line, $Ping)) {
|
||||||
fwrite($Socket, "PONG :$Ping[1]\n");
|
fwrite($Socket, "PONG :$Ping[1]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example command
|
// Example command
|
||||||
if(stripos('!mode', $Line)) {
|
if(stripos('!mode', $Line)) {
|
||||||
fwrite($Socket, "PRIVMSG ".RELAY." :Mode command used\n");
|
fwrite($Socket, "PRIVMSG ".RELAY." :Mode command used\n");
|
||||||
@ -34,6 +34,6 @@
|
|||||||
fwrite($Socket, "WHOIS WhatMan\n");
|
fwrite($Socket, "WHOIS WhatMan\n");
|
||||||
fwrite($Socket, "MODE Orbulon\n");
|
fwrite($Socket, "MODE Orbulon\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($Socket, "PRIVMSG ".RELAY." : -----".$Line."\n");
|
fwrite($Socket, "PRIVMSG ".RELAY." : -----".$Line."\n");
|
||||||
}
|
}
|
||||||
|
@ -26,43 +26,43 @@
|
|||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?artistname={searchTerms}"></Url>
|
<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&name={searchTerms}"/>
|
<Url type="application/x-suggestions+json" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?action=autocomplete&name={searchTerms}"/>
|
||||||
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'torrents':
|
case 'torrents':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=basic&searchstr={searchTerms}"></Url>
|
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=basic&searchstr={searchTerms}"></Url>
|
||||||
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php</moz:SearchForm>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'requests':
|
case 'requests':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php?search={searchTerms}"></Url>
|
<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>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/requests.php</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'forums':
|
case 'forums':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search&search={searchTerms}"></Url>
|
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search&search={searchTerms}"></Url>
|
||||||
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search</moz:SearchForm>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/forums.php?action=search</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'users':
|
case 'users':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search&search={searchTerms}"></Url>
|
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search&search={searchTerms}"></Url>
|
||||||
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search</moz:SearchForm>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/user.php?action=search</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'wiki':
|
case 'wiki':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search&search={searchTerms}"></Url>
|
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search&search={searchTerms}"></Url>
|
||||||
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search</moz:SearchForm>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/wiki.php?action=search</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
case 'log':
|
case 'log':
|
||||||
?>
|
?>
|
||||||
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php?search={searchTerms}"></Url>
|
<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>
|
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/log.php</moz:SearchForm>
|
||||||
<?
|
<?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -60,14 +60,14 @@
|
|||||||
if (strtotime($NewsTime) > time()) {
|
if (strtotime($NewsTime) > time()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonAnnouncements[] = array(
|
$JsonAnnouncements[] = array(
|
||||||
'newsId' => (int) $NewsID,
|
'newsId' => (int) $NewsID,
|
||||||
'title' => $Title,
|
'title' => $Title,
|
||||||
'body' => $Text->full_format($Body),
|
'body' => $Text->full_format($Body),
|
||||||
'newsTime' => $NewsTime
|
'newsTime' => $NewsTime
|
||||||
);
|
);
|
||||||
|
|
||||||
if (++$Count > 4) {
|
if (++$Count > 4) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
break;
|
break;
|
||||||
case 'artistless':
|
case 'artistless':
|
||||||
include(SERVER_ROOT.'/sections/ajax/better/artistless.php');
|
include(SERVER_ROOT.'/sections/ajax/better/artistless.php');
|
||||||
break;
|
break;
|
||||||
case 'tags':
|
case 'tags':
|
||||||
include(SERVER_ROOT.'/sections/ajax/better/tags.php');
|
include(SERVER_ROOT.'/sections/ajax/better/tags.php');
|
||||||
break;
|
break;
|
||||||
case 'folders':
|
case 'folders':
|
||||||
include(SERVER_ROOT.'/sections/ajax/better/folders.php');
|
include(SERVER_ROOT.'/sections/ajax/better/folders.php');
|
||||||
break;
|
break;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
foreach ($Results as $GroupID=>$Group) {
|
foreach ($Results as $GroupID=>$Group) {
|
||||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
|
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
|
||||||
$FlacID = $GroupIDs[$GroupID]['TorrentID'];
|
$FlacID = $GroupIDs[$GroupID]['TorrentID'];
|
||||||
|
|
||||||
$JsonArtists = array();
|
$JsonArtists = array();
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
foreach ($Artists as $Artist) {
|
foreach ($Artists as $Artist) {
|
||||||
@ -32,7 +32,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonResults[] = array(
|
$JsonResults[] = array(
|
||||||
'torrentId' => (int) $FlacID,
|
'torrentId' => (int) $FlacID,
|
||||||
'groupId' => (int) $GroupID,
|
'groupId' => (int) $GroupID,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
if(!empty($_GET['userid'])) {
|
if(!empty($_GET['userid'])) {
|
||||||
if(!check_perms('users_override_paranoia')) {
|
if(!check_perms('users_override_paranoia')) {
|
||||||
print
|
print
|
||||||
json_encode(
|
json_encode(
|
||||||
array(
|
array(
|
||||||
'status' => 'failure'
|
'status' => 'failure'
|
||||||
@ -13,7 +13,7 @@
|
|||||||
$UserID = $_GET['userid'];
|
$UserID = $_GET['userid'];
|
||||||
$Sneaky = ($UserID != $LoggedUser['ID']);
|
$Sneaky = ($UserID != $LoggedUser['ID']);
|
||||||
if(!is_number($UserID)) {
|
if(!is_number($UserID)) {
|
||||||
print
|
print
|
||||||
json_encode(
|
json_encode(
|
||||||
array(
|
array(
|
||||||
'status' => 'failure'
|
'status' => 'failure'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?
|
<?
|
||||||
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
|
include(SERVER_ROOT.'/sections/bookmarks/functions.php');
|
||||||
|
|
||||||
// Number of users per page
|
// Number of users per page
|
||||||
define('BOOKMARKS_PER_PAGE', '20');
|
define('BOOKMARKS_PER_PAGE', '20');
|
||||||
|
|
||||||
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; }
|
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; }
|
||||||
@ -22,7 +22,7 @@
|
|||||||
require(SERVER_ROOT.'/sections/ajax/requests/requests.php');
|
require(SERVER_ROOT.'/sections/ajax/requests/requests.php');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print
|
print
|
||||||
json_encode(
|
json_encode(
|
||||||
array(
|
array(
|
||||||
'status' => 'failure'
|
'status' => 'failure'
|
||||||
|
@ -28,8 +28,8 @@ function compare($X, $Y){
|
|||||||
list($K, list($TorrentList, $CollageDataList)) = each($Data);
|
list($K, list($TorrentList, $CollageDataList)) = each($Data);
|
||||||
} else {
|
} else {
|
||||||
// Build the data for the collage and the torrent list
|
// Build the data for the collage and the torrent list
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
bt.GroupID,
|
bt.GroupID,
|
||||||
tg.WikiImage,
|
tg.WikiImage,
|
||||||
tg.CategoryID,
|
tg.CategoryID,
|
||||||
bt.Time
|
bt.Time
|
||||||
@ -37,7 +37,7 @@ function compare($X, $Y){
|
|||||||
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
|
JOIN torrents_group AS tg ON tg.ID=bt.GroupID
|
||||||
WHERE bt.UserID='$UserID'
|
WHERE bt.UserID='$UserID'
|
||||||
ORDER BY bt.Time");
|
ORDER BY bt.Time");
|
||||||
|
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
|
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||||
if(count($GroupIDs)>0) {
|
if(count($GroupIDs)>0) {
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
// This is done here so we get the benefit of the caching, and we
|
// 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
|
// don't have to make a database query for each topic on the page
|
||||||
$LastRead = $DB->to_array('TopicID');
|
$LastRead = $DB->to_array('TopicID');
|
||||||
|
|
||||||
$JsonTopics = array();
|
$JsonTopics = array();
|
||||||
foreach ($Forum as $Topic) {
|
foreach ($Forum as $Topic) {
|
||||||
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
|
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
|
||||||
@ -122,7 +122,7 @@
|
|||||||
$AuthorName = $UserInfo['Username'];
|
$AuthorName = $UserInfo['Username'];
|
||||||
$UserInfo = Users::user_info($LastAuthorID);
|
$UserInfo = Users::user_info($LastAuthorID);
|
||||||
$LastAuthorName = $UserInfo['Username'];
|
$LastAuthorName = $UserInfo['Username'];
|
||||||
|
|
||||||
$JsonTopics[] = array(
|
$JsonTopics[] = array(
|
||||||
'topicId' => (int) $TopicID,
|
'topicId' => (int) $TopicID,
|
||||||
'title' => display_str($Title),
|
'title' => display_str($Title),
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
unset($ForumID, $Forum);
|
unset($ForumID, $Forum);
|
||||||
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
|
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_GET['type']) || $_GET['type'] == 'main') {
|
if(empty($_GET['type']) || $_GET['type'] == 'main') {
|
||||||
include(SERVER_ROOT.'/sections/ajax/forum/main.php');
|
include(SERVER_ROOT.'/sections/ajax/forum/main.php');
|
||||||
} else {
|
} else {
|
||||||
@ -96,7 +96,7 @@ function get_forum_info($ForumID) {
|
|||||||
}
|
}
|
||||||
// Makes an array, with $Forum['Name'], etc.
|
// Makes an array, with $Forum['Name'], etc.
|
||||||
$Forum = $DB->next_record(MYSQLI_ASSOC);
|
$Forum = $DB->next_record(MYSQLI_ASSOC);
|
||||||
|
|
||||||
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
|
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
|
||||||
}
|
}
|
||||||
return $Forum;
|
return $Forum;
|
||||||
|
@ -56,14 +56,14 @@
|
|||||||
);
|
);
|
||||||
$JsonForums = array();
|
$JsonForums = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
|
if((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
|
||||||
$Read = 'unread';
|
$Read = 'unread';
|
||||||
} else {
|
} else {
|
||||||
$Read = 'read';
|
$Read = 'read';
|
||||||
}
|
}
|
||||||
$UserInfo = Users::user_info($LastAuthorID);
|
$UserInfo = Users::user_info($LastAuthorID);
|
||||||
|
|
||||||
$JsonForums[] = array(
|
$JsonForums[] = array(
|
||||||
'forumId' => (int) $ForumID,
|
'forumId' => (int) $ForumID,
|
||||||
'forumName' => $ForumName,
|
'forumName' => $ForumName,
|
||||||
|
@ -141,13 +141,13 @@
|
|||||||
$Answers = unserialize($Answers);
|
$Answers = unserialize($Answers);
|
||||||
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$ThreadID' GROUP BY Vote");
|
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$ThreadID' GROUP BY Vote");
|
||||||
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
||||||
|
|
||||||
$Votes = array();
|
$Votes = array();
|
||||||
foreach ($VoteArray as $VoteSet) {
|
foreach ($VoteArray as $VoteSet) {
|
||||||
list($Key,$Value) = $VoteSet;
|
list($Key,$Value) = $VoteSet;
|
||||||
$Votes[$Key] = $Value;
|
$Votes[$Key] = $Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(array_keys($Answers) as $i) {
|
foreach(array_keys($Answers) as $i) {
|
||||||
if (!isset($Votes[$i])) {
|
if (!isset($Votes[$i])) {
|
||||||
$Votes[$i] = 0;
|
$Votes[$i] = 0;
|
||||||
@ -155,7 +155,7 @@
|
|||||||
}
|
}
|
||||||
$Cache->cache_value('polls_'.$ThreadID, array($Question,$Answers,$Votes,$Featured,$Closed), 0);
|
$Cache->cache_value('polls_'.$ThreadID, array($Question,$Answers,$Votes,$Featured,$Closed), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($Votes)) {
|
if (!empty($Votes)) {
|
||||||
$TotalVotes = array_sum($Votes);
|
$TotalVotes = array_sum($Votes);
|
||||||
$MaxVotes = max($Votes);
|
$MaxVotes = max($Votes);
|
||||||
@ -163,7 +163,7 @@
|
|||||||
$TotalVotes = 0;
|
$TotalVotes = 0;
|
||||||
$MaxVotes = 0;
|
$MaxVotes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
|
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
|
||||||
//Polls lose the you voted arrow thingy
|
//Polls lose the you voted arrow thingy
|
||||||
$DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'");
|
$DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'");
|
||||||
@ -175,14 +175,14 @@
|
|||||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonPoll['closed'] = $Closed == 1;
|
$JsonPoll['closed'] = $Closed == 1;
|
||||||
$JsonPoll['featured'] = $Featured;
|
$JsonPoll['featured'] = $Featured;
|
||||||
$JsonPoll['question'] = $Question;
|
$JsonPoll['question'] = $Question;
|
||||||
$JsonPoll['maxVotes'] = (int) $MaxVotes;
|
$JsonPoll['maxVotes'] = (int) $MaxVotes;
|
||||||
$JsonPoll['totalVotes'] = $TotalVotes;
|
$JsonPoll['totalVotes'] = $TotalVotes;
|
||||||
$JsonPollAnswers = array();
|
$JsonPollAnswers = array();
|
||||||
|
|
||||||
foreach($Answers as $i => $Answer) {
|
foreach($Answers as $i => $Answer) {
|
||||||
if (!empty($Votes[$i]) && $TotalVotes > 0) {
|
if (!empty($Votes[$i]) && $TotalVotes > 0) {
|
||||||
$Ratio = $Votes[$i]/$MaxVotes;
|
$Ratio = $Votes[$i]/$MaxVotes;
|
||||||
@ -197,13 +197,13 @@
|
|||||||
'percent' => $Percent
|
'percent' => $Percent
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) {
|
if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) {
|
||||||
$JsonPoll['voted'] = True;
|
$JsonPoll['voted'] = True;
|
||||||
} else {
|
} else {
|
||||||
$JsonPoll['voted'] = False;
|
$JsonPoll['voted'] = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonPoll['answers'] = $JsonPollAnswers;
|
$JsonPoll['answers'] = $JsonPollAnswers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +241,7 @@
|
|||||||
'enabled' => $Enabled == 2 ? false : true,
|
'enabled' => $Enabled == 2 ? false : true,
|
||||||
'userTitle' => $UserTitle
|
'userTitle' => $UserTitle
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
/*
|
/*
|
||||||
AJAX Switch Center
|
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'].
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
|
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
|
||||||
|
|
||||||
if ($Result['UnRead'] == 1) $NumNew++;
|
if ($Result['UnRead'] == 1) $NumNew++;
|
||||||
|
|
||||||
$JsonNotifications[] = array(
|
$JsonNotifications[] = array(
|
||||||
'torrentId' => (int) $TorrentID,
|
'torrentId' => (int) $TorrentID,
|
||||||
'groupId' => (int) $GroupID,
|
'groupId' => (int) $GroupID,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
include(SERVER_ROOT.'/classes/class_text.php');
|
include(SERVER_ROOT.'/classes/class_text.php');
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
|
|
||||||
if(empty($_GET['id']) || !is_number($_GET['id'])) {
|
if(empty($_GET['id']) || !is_number($_GET['id'])) {
|
||||||
print
|
print
|
||||||
json_encode(
|
json_encode(
|
||||||
array(
|
array(
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
//First things first, lets get the data for the request.
|
//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];
|
$Request = $Request['matches'][$RequestID];
|
||||||
if(empty($Request)) {
|
if(empty($Request)) {
|
||||||
print
|
print
|
||||||
@ -61,14 +61,14 @@
|
|||||||
$ArtistForm = get_request_artists($RequestID);
|
$ArtistForm = get_request_artists($RequestID);
|
||||||
$ArtistName = Artists::display_artists($ArtistForm, false, true);
|
$ArtistName = Artists::display_artists($ArtistForm, false, true);
|
||||||
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
||||||
|
|
||||||
if($IsFilled) {
|
if($IsFilled) {
|
||||||
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>".$Title."</a> [".$Year."]";
|
$DisplayLink = $ArtistLink."<a href='torrents.php?torrentid=".$TorrentID."'>".$Title."</a> [".$Year."]";
|
||||||
} else {
|
} else {
|
||||||
$DisplayLink = $ArtistLink.$Title." [".$Year."]";
|
$DisplayLink = $ArtistLink.$Title." [".$Year."]";
|
||||||
}
|
}
|
||||||
$FullName = $ArtistName.$Title." [".$Year."]";
|
$FullName = $ArtistName.$Title." [".$Year."]";
|
||||||
|
|
||||||
if($BitrateList != "") {
|
if($BitrateList != "") {
|
||||||
$BitrateString = implode(", ", explode("|", $BitrateList));
|
$BitrateString = implode(", ", explode("|", $BitrateList));
|
||||||
$FormatString = implode(", ", explode("|", $FormatList));
|
$FormatString = implode(", ", explode("|", $FormatList));
|
||||||
@ -78,13 +78,13 @@
|
|||||||
$FormatString = "Unknown, please read the description.";
|
$FormatString = "Unknown, please read the description.";
|
||||||
$MediaString = "Unknown, please read the description.";
|
$MediaString = "Unknown, please read the description.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($ReleaseType)) {
|
if(empty($ReleaseType)) {
|
||||||
$ReleaseName = "Unknown";
|
$ReleaseName = "Unknown";
|
||||||
} else {
|
} else {
|
||||||
$ReleaseName = $ReleaseTypes[$ReleaseType];
|
$ReleaseName = $ReleaseTypes[$ReleaseType];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||||
$FullName = $Title." [".$Year."]";
|
$FullName = $Title." [".$Year."]";
|
||||||
$DisplayLink = $Title." [".$Year."]";
|
$DisplayLink = $Title." [".$Year."]";
|
||||||
@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
$JsonTopContributors = array();
|
$JsonTopContributors = array();
|
||||||
$VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
|
$VoteMax = ($VoteCount < 5 ? $VoteCount : 5);
|
||||||
for($i = 0; $i < $VoteMax; $i++) {
|
for($i = 0; $i < $VoteMax; $i++) {
|
||||||
$User = array_shift($RequestVotes['Voters']);
|
$User = array_shift($RequestVotes['Voters']);
|
||||||
$JsonTopContributors[] = array(
|
$JsonTopContributors[] = array(
|
||||||
'userId' => (int) $User['UserID'],
|
'userId' => (int) $User['UserID'],
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
|
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
|
||||||
list($Page,$Limit) = Format::page_limit(REQUESTS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(REQUESTS_PER_PAGE);
|
||||||
$Submitted = !empty($_GET['submit']);
|
$Submitted = !empty($_GET['submit']);
|
||||||
|
|
||||||
//Paranoia
|
//Paranoia
|
||||||
$UserInfo = Users::user_info((int)$_GET['userid']);
|
$UserInfo = Users::user_info((int)$_GET['userid']);
|
||||||
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||||
$UserClass = $Perms['Class'];
|
$UserClass = $Perms['Class'];
|
||||||
|
|
||||||
$BookmarkView = false;
|
$BookmarkView = false;
|
||||||
|
|
||||||
if(empty($_GET['type'])) {
|
if(empty($_GET['type'])) {
|
||||||
$Title = 'Requests';
|
$Title = 'Requests';
|
||||||
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
|
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
|
||||||
$SS->set_filter('visible', array(1));
|
$SS->set_filter('visible', array(1));
|
||||||
@ -137,7 +137,7 @@
|
|||||||
unset($ReleaseArray[$Index]);
|
unset($ReleaseArray[$Index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($ReleaseArray) >= 1) {
|
if(count($ReleaseArray) >= 1) {
|
||||||
$SS->set_filter('releasetype', $ReleaseArray);
|
$SS->set_filter('releasetype', $ReleaseArray);
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@
|
|||||||
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
|
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($FormatNameArray) >= 1) {
|
if(count($FormatNameArray) >= 1) {
|
||||||
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
|
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
|
||||||
}
|
}
|
||||||
@ -287,11 +287,11 @@
|
|||||||
unset($SphinxResults['matches'][$ID]);
|
unset($SphinxResults['matches'][$ID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge SQL results with memcached results
|
// Merge SQL results with memcached results
|
||||||
foreach($SQLResults['matches'] as $ID => $SQLResult) {
|
foreach($SQLResults['matches'] as $ID => $SQLResult) {
|
||||||
$SphinxResults['matches'][$ID] = $SQLResult;
|
$SphinxResults['matches'][$ID] = $SQLResult;
|
||||||
|
|
||||||
//$Requests['matches'][$ID] = array_merge($Requests['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
|
//We ksort because depending on the filter modes, we're given our data in an unpredictable order
|
||||||
//ksort($Requests['matches'][$ID]);
|
//ksort($Requests['matches'][$ID]);
|
||||||
@ -316,24 +316,24 @@
|
|||||||
$JsonResults = array();
|
$JsonResults = array();
|
||||||
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
|
$TimeCompare = 1267643718; // Requests v2 was implemented 2010-03-03 20:15:18
|
||||||
foreach ($Requests as $RequestID => $Request) {
|
foreach ($Requests as $RequestID => $Request) {
|
||||||
|
|
||||||
//list($BitrateList, $CatalogueNumber, $CategoryID, $Description, $FillerID, $FormatList, $RequestID, $Image, $LogCue, $MediaList, $ReleaseType,
|
//list($BitrateList, $CatalogueNumber, $CategoryID, $Description, $FillerID, $FormatList, $RequestID, $Image, $LogCue, $MediaList, $ReleaseType,
|
||||||
// $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote,
|
// $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote,
|
||||||
// $ReleaseType, $TagIDs, $TimeAdded, $TimeFilled, $TorrentID, $RequestorID, $Voters) = array_values($Request);
|
// $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;
|
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
|
||||||
|
|
||||||
$RequestVotes = get_votes_array($RequestID);
|
$RequestVotes = get_votes_array($RequestID);
|
||||||
|
|
||||||
$VoteCount = count($RequestVotes['Voters']);
|
$VoteCount = count($RequestVotes['Voters']);
|
||||||
|
|
||||||
if($CategoryID == 0) {
|
if($CategoryID == 0) {
|
||||||
$CategoryName = "Unknown";
|
$CategoryName = "Unknown";
|
||||||
} else {
|
} else {
|
||||||
$CategoryName = $Categories[$CategoryID - 1];
|
$CategoryName = $Categories[$CategoryID - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$JsonArtists = array();
|
$JsonArtists = array();
|
||||||
if($CategoryName == "Music") {
|
if($CategoryName == "Music") {
|
||||||
$ArtistForm = get_request_artists($RequestID);
|
$ArtistForm = get_request_artists($RequestID);
|
||||||
@ -341,7 +341,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Tags = $Request['Tags'];
|
$Tags = $Request['Tags'];
|
||||||
|
|
||||||
$JsonResults[] = array(
|
$JsonResults[] = array(
|
||||||
'requestId' => (int) $RequestID,
|
'requestId' => (int) $RequestID,
|
||||||
'requestorId' => (int) $RequestorID,
|
'requestorId' => (int) $RequestorID,
|
||||||
|
@ -24,37 +24,37 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
$Type = ($_REQUEST['vote'] == 'up')?"Up":"Down";
|
$Type = ($_REQUEST['vote'] == 'up')?"Up":"Down";
|
||||||
|
|
||||||
// Update the two votes tables if needed
|
// Update the two votes tables if needed
|
||||||
$DB->query("INSERT IGNORE INTO users_votes (UserID, GroupID, Type) VALUES ($UserID, $GroupID, '$Type')");
|
$DB->query("INSERT IGNORE INTO users_votes (UserID, GroupID, Type) VALUES ($UserID, $GroupID, '$Type')");
|
||||||
if ($DB->affected_rows() == 0) {
|
if ($DB->affected_rows() == 0) {
|
||||||
echo 'noaction';
|
echo 'noaction';
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the group's cache key
|
// Update the group's cache key
|
||||||
$GroupVotes['Total'] += 1;
|
$GroupVotes['Total'] += 1;
|
||||||
if ($Type == "Up") {
|
if ($Type == "Up") {
|
||||||
$GroupVotes['Ups'] += 1;
|
$GroupVotes['Ups'] += 1;
|
||||||
}
|
}
|
||||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
$Cache->cache_value('votes_'.$GroupID, $GroupVotes);
|
||||||
|
|
||||||
// If the group has no votes yet, we need an insert, otherwise an update
|
// 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...
|
// so we can cut corners and use the magic of INSERT...ON DUPLICATE KEY UPDATE...
|
||||||
// to accomplish both in one query
|
// to accomplish both in one query
|
||||||
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
|
$DB->query("INSERT INTO torrents_votes (GroupID, Total, Ups, Score)
|
||||||
VALUES ($GroupID, 1, ".($Type=='Up'?1:0).", 0)
|
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)".
|
Score = IFNULL(binomial_ci(Ups".($Type=='Up'?'+1':'').",Total),0)".
|
||||||
($Type=='Up'?', Ups = Ups+1':''));
|
($Type=='Up'?', Ups = Ups+1':''));
|
||||||
|
|
||||||
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
|
$UserVotes[$GroupID] = array('GroupID' => $GroupID, 'Type' => $Type);
|
||||||
|
|
||||||
// Update this guy's cache key
|
// Update this guy's cache key
|
||||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||||
|
|
||||||
// Update the paired cache keys for "people who liked"
|
// 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.
|
// our life just got a bit easier. We're only tracking paired votes on upvotes.
|
||||||
if ($Type == 'Up') {
|
if ($Type == 'Up') {
|
||||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
|
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
|
||||||
@ -108,7 +108,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo 'success';
|
echo 'success';
|
||||||
} elseif ($_REQUEST['do'] == 'unvote') {
|
} elseif ($_REQUEST['do'] == 'unvote') {
|
||||||
if (!isset($UserVotes[$GroupID])) {
|
if (!isset($UserVotes[$GroupID])) {
|
||||||
@ -116,13 +116,13 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
$Type = $UserVotes[$GroupID]['Type'];
|
$Type = $UserVotes[$GroupID]['Type'];
|
||||||
|
|
||||||
$DB->query("DELETE FROM users_votes WHERE UserID=$UserID AND GroupID=$GroupID");
|
$DB->query("DELETE FROM users_votes WHERE UserID=$UserID AND GroupID=$GroupID");
|
||||||
|
|
||||||
// Update personal cache key
|
// Update personal cache key
|
||||||
unset($UserVotes[$GroupID]);
|
unset($UserVotes[$GroupID]);
|
||||||
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
|
||||||
|
|
||||||
// Update the group's cache key
|
// Update the group's cache key
|
||||||
$GroupVotes['Total'] -= 1;
|
$GroupVotes['Total'] -= 1;
|
||||||
if ($Type == "Up") {
|
if ($Type == "Up") {
|
||||||
@ -135,7 +135,7 @@
|
|||||||
($Type=='Up'?', Ups = GREATEST(0, Ups - 1)':'')."
|
($Type=='Up'?', Ups = GREATEST(0, Ups - 1)':'')."
|
||||||
WHERE GroupID=$GroupID");
|
WHERE GroupID=$GroupID");
|
||||||
// Update paired cache keys
|
// 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.
|
// our life just got a bit easier. We're only tracking paired votes on upvotes.
|
||||||
if ($Type == 'Up') {
|
if ($Type == 'Up') {
|
||||||
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
|
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
|
||||||
@ -160,7 +160,7 @@
|
|||||||
}
|
}
|
||||||
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
$Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now do the paired votes keys for all of this guy's other votes
|
// Now do the paired votes keys for all of this guy's other votes
|
||||||
foreach ($UserVotes as $VGID => $Vote) {
|
foreach ($UserVotes as $VGID => $Vote) {
|
||||||
if ($Vote['Type'] != 'Up') {
|
if ($Vote['Type'] != 'Up') {
|
||||||
@ -190,7 +190,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let the script know what happened
|
// Let the script know what happened
|
||||||
if ($Type == 'Up') {
|
if ($Type == 'Up') {
|
||||||
echo 'success-up';
|
echo 'success-up';
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
require(SERVER_ROOT.'/sections/torrents/functions.php');
|
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
|
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
case 'Music':
|
case 'Music':
|
||||||
$TorrentForm->music_form($GenreTags);
|
$TorrentForm->music_form($GenreTags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Audiobooks':
|
case 'Audiobooks':
|
||||||
case 'Comedy':
|
case 'Comedy':
|
||||||
$TorrentForm->audiobook_form();
|
$TorrentForm->audiobook_form();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Applications':
|
case 'Applications':
|
||||||
case 'Comics':
|
case 'Comics':
|
||||||
case 'E-Books':
|
case 'E-Books':
|
||||||
|
@ -45,7 +45,7 @@ function error_out($reason = "") {
|
|||||||
FROM users_main AS m
|
FROM users_main AS m
|
||||||
JOIN users_info AS i ON i.UserID = m.ID
|
JOIN users_info AS i ON i.UserID = m.ID
|
||||||
WHERE m.ID = $UserID");
|
WHERE m.ID = $UserID");
|
||||||
|
|
||||||
if($DB->record_count() == 0){ // If user doesn't exist
|
if($DB->record_count() == 0){ // If user doesn't exist
|
||||||
error_out("User does not exist!");
|
error_out("User does not exist!");
|
||||||
}
|
}
|
||||||
@ -170,22 +170,22 @@ function error_out($reason = "") {
|
|||||||
$sql.='
|
$sql.='
|
||||||
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
|
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= '
|
$sql .= '
|
||||||
ORDER BY p.ID DESC';
|
ORDER BY p.ID DESC';
|
||||||
|
|
||||||
if($ShowGrouped) {
|
if($ShowGrouped) {
|
||||||
$sql.='
|
$sql.='
|
||||||
) AS sub
|
) AS sub
|
||||||
GROUP BY TopicID ORDER BY ID DESC';
|
GROUP BY TopicID ORDER BY ID DESC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.=' LIMIT '.$Limit;
|
$sql.=' LIMIT '.$Limit;
|
||||||
$Posts = $DB->query($sql);
|
$Posts = $DB->query($sql);
|
||||||
|
|
||||||
$DB->query("SELECT FOUND_ROWS()");
|
$DB->query("SELECT FOUND_ROWS()");
|
||||||
list($Results) = $DB->next_record();
|
list($Results) = $DB->next_record();
|
||||||
|
|
||||||
$DB->set_query_id($Posts);
|
$DB->set_query_id($Posts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
if (!empty($_GET['search'])) {
|
if (!empty($_GET['search'])) {
|
||||||
|
|
||||||
$_GET['username'] = $_GET['search'];
|
$_GET['username'] = $_GET['search'];
|
||||||
}
|
}
|
||||||
|
|
||||||
define('USERS_PER_PAGE', 30);
|
define('USERS_PER_PAGE', 30);
|
||||||
|
|
||||||
if(isset($_GET['username'])){
|
if(isset($_GET['username'])){
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<state><?
|
<state><?
|
||||||
switch ($User['State']) {
|
switch ($User['State']) {
|
||||||
case 0:
|
case 0:
|
||||||
echo 'pending';
|
echo 'pending';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
$Available = array(
|
$Available = array(
|
||||||
'access_request',
|
'access_request',
|
||||||
'access_state',
|
'access_state',
|
||||||
|
|
||||||
'user_stats_ratio',
|
'user_stats_ratio',
|
||||||
'user_stats_torrent',
|
'user_stats_torrent',
|
||||||
'user_stats_comumnity',
|
'user_stats_comumnity',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
empty($_GET['req']) ||
|
empty($_GET['req']) ||
|
||||||
empty($_GET['uid']) ||
|
empty($_GET['uid']) ||
|
||||||
empty($_GET['aid']) ||
|
empty($_GET['aid']) ||
|
||||||
empty($_GET['key']) ||
|
empty($_GET['key']) ||
|
||||||
!is_number($_GET['uid']) ||
|
!is_number($_GET['uid']) ||
|
||||||
!is_number($_GET['aid']) ||
|
!is_number($_GET['aid']) ||
|
||||||
!in_array($_GET['req'],$Available,true)
|
!in_array($_GET['req'],$Available,true)
|
||||||
) {
|
) {
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
list($Artist2ID) = $DB->next_record();
|
list($Artist2ID) = $DB->next_record();
|
||||||
|
|
||||||
if(!empty($Artist2ID)) { // artist was found in the database
|
if(!empty($Artist2ID)) { // artist was found in the database
|
||||||
|
|
||||||
// Let's see if there's already a similar artists field for these two
|
// Let's see if there's already a similar artists field for these two
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
s1.SimilarID
|
s1.SimilarID
|
||||||
FROM artists_similar AS s1
|
FROM artists_similar AS s1
|
||||||
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID
|
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID
|
||||||
WHERE s1.ArtistID='$Artist1ID' AND s2.ArtistID='$Artist2ID'");
|
WHERE s1.ArtistID='$Artist1ID' AND s2.ArtistID='$Artist2ID'");
|
||||||
list($SimilarID) = $DB->next_record();
|
list($SimilarID) = $DB->next_record();
|
||||||
|
|
||||||
if($SimilarID){ // The similar artists field already exists, just update the score
|
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'");
|
$DB->query("UPDATE artists_similar_scores SET Score=Score+200 WHERE SimilarID='$SimilarID'");
|
||||||
} else { // No, it doesn't exist - create it
|
} 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 ('$Artist1ID', '$SimilarID')");
|
||||||
$DB->query("INSERT INTO artists_similar (ArtistID, SimilarID) VALUES ('$Artist2ID', '$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'");
|
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='up'");
|
||||||
if($DB->record_count() == 0) {
|
if($DB->record_count() == 0) {
|
||||||
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
|
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
|
||||||
}
|
}
|
||||||
|
|
||||||
$Cache->delete('artist_'.$Artist1ID); // Delete artist cache
|
$Cache->delete('artist_'.$Artist1ID); // Delete artist cache
|
||||||
$Cache->delete('artist_'.$Artist2ID); // Delete artist cache
|
$Cache->delete('artist_'.$Artist2ID); // Delete artist cache
|
||||||
$Cache->delete('similar_positions_'.$Artist1ID); // Delete artist's similar map cache
|
$Cache->delete('similar_positions_'.$Artist1ID); // Delete artist's similar map cache
|
||||||
|
@ -20,16 +20,16 @@
|
|||||||
$DB=NEW DB_MYSQL; //Load the database wrapper
|
$DB=NEW DB_MYSQL; //Load the database wrapper
|
||||||
}
|
}
|
||||||
$Limit = (($KeySize === $MaxKeySize)?250:10);
|
$Limit = (($KeySize === $MaxKeySize)?250:10);
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
a.ArtistID,
|
a.ArtistID,
|
||||||
a.Name,
|
a.Name,
|
||||||
SUM(t.Snatched) AS Snatches
|
SUM(t.Snatched) AS Snatches
|
||||||
FROM artists_group AS a
|
FROM artists_group AS a
|
||||||
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
|
INNER JOIN torrents_artists AS ta ON ta.ArtistID=a.ArtistID
|
||||||
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
|
INNER JOIN torrents AS t ON t.GroupID=ta.GroupID
|
||||||
WHERE a.Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
|
WHERE a.Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
|
||||||
GROUP BY ta.ArtistID
|
GROUP BY ta.ArtistID
|
||||||
ORDER BY Snatches DESC
|
ORDER BY Snatches DESC
|
||||||
LIMIT $Limit");
|
LIMIT $Limit");
|
||||||
$AutoSuggest = $DB->to_array(false,MYSQLI_NUM,false);
|
$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
|
$Cache->cache_value('autocomplete_artist_'.$KeySize.'_'.$Letters,$AutoSuggest,1800+7200*($MaxKeySize-$KeySize)); // Can't cache things for too long in case names are edited
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
if ($NewArtistID > 0) {
|
if ($NewArtistID > 0) {
|
||||||
// Make sure that's a real artist ID number, and grab the name
|
// 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())) {
|
if(!(list($NewArtistName) = $DB->next_record())) {
|
||||||
error('Please enter a valid artist ID number.');
|
error('Please enter a valid artist ID number.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Didn't give an ID, so try to grab based on the name
|
// 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())) {
|
if(!(list($NewArtistID) = $DB->next_record())) {
|
||||||
error('No artist by that name was found.');
|
error('No artist by that name was found.');
|
||||||
}
|
}
|
||||||
@ -58,23 +58,23 @@
|
|||||||
$NewArtistGroups = $DB->collect('GroupID');
|
$NewArtistGroups = $DB->collect('GroupID');
|
||||||
$NewArtistGroups[] = '0';
|
$NewArtistGroups[] = '0';
|
||||||
$NewArtistGroups = implode(',',$NewArtistGroups);
|
$NewArtistGroups = implode(',',$NewArtistGroups);
|
||||||
|
|
||||||
$DB->query("SELECT DISTINCT RequestID FROM requests_artists WHERE ArtistID = $NewArtistID");
|
$DB->query("SELECT DISTINCT RequestID FROM requests_artists WHERE ArtistID = $NewArtistID");
|
||||||
$NewArtistRequests = $DB->collect('RequestID');
|
$NewArtistRequests = $DB->collect('RequestID');
|
||||||
$NewArtistRequests[] = '0';
|
$NewArtistRequests[] = '0';
|
||||||
$NewArtistRequests = implode(',',$NewArtistRequests);
|
$NewArtistRequests = implode(',',$NewArtistRequests);
|
||||||
|
|
||||||
$DB->query("SELECT DISTINCT UserID from bookmarks_artists WHERE ArtistID = $NewArtistID");
|
$DB->query("SELECT DISTINCT UserID from bookmarks_artists WHERE ArtistID = $NewArtistID");
|
||||||
$NewArtistBookmarks = $DB->collect('UserID');
|
$NewArtistBookmarks = $DB->collect('UserID');
|
||||||
$NewArtistBookmarks[] = '0';
|
$NewArtistBookmarks[] = '0';
|
||||||
$NewArtistBookmarks = implode(',',$NewArtistBookmarks);
|
$NewArtistBookmarks = implode(',',$NewArtistBookmarks);
|
||||||
|
|
||||||
// Merge all of this artist's aliases onto the new artist
|
// Merge all of this artist's aliases onto the new artist
|
||||||
$DB->query("UPDATE artists_alias SET ArtistID = $NewArtistID WHERE ArtistID = $ArtistID");
|
$DB->query("UPDATE artists_alias SET ArtistID = $NewArtistID WHERE ArtistID = $ArtistID");
|
||||||
|
|
||||||
// Update the torrent groups, requests, and bookmarks
|
// Update the torrent groups, requests, and bookmarks
|
||||||
$DB->query("UPDATE IGNORE torrents_artists SET ArtistID = $NewArtistID
|
$DB->query("UPDATE IGNORE torrents_artists SET ArtistID = $NewArtistID
|
||||||
WHERE ArtistID = $ArtistID
|
WHERE ArtistID = $ArtistID
|
||||||
AND GroupID NOT IN ($NewArtistGroups)");
|
AND GroupID NOT IN ($NewArtistGroups)");
|
||||||
$DB->query("DELETE FROM torrents_artists WHERE ArtistID = $ArtistID");
|
$DB->query("DELETE FROM torrents_artists WHERE ArtistID = $ArtistID");
|
||||||
$DB->query("UPDATE IGNORE requests_artists SET ArtistID = $NewArtistID
|
$DB->query("UPDATE IGNORE requests_artists SET ArtistID = $NewArtistID
|
||||||
@ -85,7 +85,7 @@
|
|||||||
WHERE ArtistID = $ArtistID
|
WHERE ArtistID = $ArtistID
|
||||||
AND UserID NOT IN ($NewArtistBookmarks)");
|
AND UserID NOT IN ($NewArtistBookmarks)");
|
||||||
$DB->query("DELETE FROM bookmarks_artists WHERE ArtistID = $ArtistID");
|
$DB->query("DELETE FROM bookmarks_artists WHERE ArtistID = $ArtistID");
|
||||||
|
|
||||||
// Cache clearing
|
// Cache clearing
|
||||||
if(!empty($Groups)) {
|
if(!empty($Groups)) {
|
||||||
foreach($Groups as $GroupID) {
|
foreach($Groups as $GroupID) {
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
|
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query('SELECT tg.Name,
|
$DB->query('SELECT tg.Name,
|
||||||
tg.ID
|
tg.ID
|
||||||
FROM torrents_group AS tg
|
FROM torrents_group AS tg
|
||||||
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
|
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
|
||||||
WHERE ta.ArtistID='.$ArtistID);
|
WHERE ta.ArtistID='.$ArtistID);
|
||||||
$Count = $DB->record_count();
|
$Count = $DB->record_count();
|
||||||
if($DB->record_count() > 0) {
|
if($DB->record_count() > 0) {
|
||||||
@ -47,10 +47,10 @@
|
|||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query('SELECT r.Title,
|
$DB->query('SELECT r.Title,
|
||||||
r.ID
|
r.ID
|
||||||
FROM requests AS r
|
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);
|
WHERE ra.ArtistID='.$ArtistID);
|
||||||
$Count += $DB->record_count();
|
$Count += $DB->record_count();
|
||||||
if($DB->record_count() > 0) {
|
if($DB->record_count() > 0) {
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT aa.AliasID
|
$DB->query("SELECT aa.AliasID
|
||||||
FROM artists_alias AS aa
|
FROM artists_alias AS aa
|
||||||
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
|
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
|
||||||
WHERE aa.AliasID=".$AliasID);
|
WHERE aa.AliasID=".$AliasID);
|
||||||
|
|
||||||
if($DB->record_count() == 1) {
|
if($DB->record_count() == 1) {
|
||||||
|
@ -135,8 +135,6 @@
|
|||||||
$Collector = new TorrentsDL($DownloadsQ, $ArtistName);
|
$Collector = new TorrentsDL($DownloadsQ, $ArtistName);
|
||||||
|
|
||||||
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
|
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
|
||||||
$Debug->log_var($Downloads, '$Downloads');
|
|
||||||
$Debug->log_var($GroupIDs, '$GroupIDs');
|
|
||||||
$Artists = Artists::get_artists($GroupIDs);
|
$Artists = Artists::get_artists($GroupIDs);
|
||||||
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
|
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
|
||||||
if (is_int($TorrentFilesQ)) {
|
if (is_int($TorrentFilesQ)) {
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
||------------|| Edit artist wiki page ||------------------------------||
|
||------------|| 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.
|
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.
|
ID of the artist, and must be set.
|
||||||
|
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@ -55,7 +55,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? if(check_perms('torrents_edit')) { ?>
|
<? if(check_perms('torrents_edit')) { ?>
|
||||||
<h2>Rename</h2>
|
<h2>Rename</h2>
|
||||||
<div class="box pad">
|
<div class="box pad">
|
||||||
<form class="rename_form" name="artist" action="artist.php" method="post">
|
<form class="rename_form" name="artist" action="artist.php" method="post">
|
||||||
@ -67,11 +67,11 @@
|
|||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<input type="submit" value="Rename" />
|
<input type="submit" value="Rename" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Make into non-redirecting alias</h2>
|
<h2>Make into non-redirecting alias</h2>
|
||||||
<div class="box pad">
|
<div class="box pad">
|
||||||
<form class="merge_form" name="artist" action="artist.php" method="post">
|
<form class="merge_form" name="artist" action="artist.php" method="post">
|
||||||
@ -90,14 +90,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Aliases</h2>
|
<h2>Aliases</h2>
|
||||||
<div class="box pad">
|
<div class="box pad">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
$DB->query("SELECT AliasID, Name, UserID, Redirect FROM artists_alias WHERE ArtistID='$ArtistID'");
|
$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; }
|
if($AliasName == $Name) { $DefaultRedirectID = $AliasID; }
|
||||||
?>
|
?>
|
||||||
<li><?=$AliasID?>. <?=$AliasName?>
|
<li><?=$AliasID?>. <?=$AliasName?>
|
||||||
@ -120,6 +120,6 @@
|
|||||||
<input type="submit" value="Add alias" />
|
<input type="submit" value="Add alias" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</div>
|
</div>
|
||||||
<? View::show_footer() ?>
|
<? View::show_footer() ?>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
||------------|| Artist wiki history page ||---------------------------||
|
||------------|| Artist wiki history page ||---------------------------||
|
||||||
|
|
||||||
This page lists previous revisions of the artists page. It gets called
|
This page lists previous revisions of the artists page. It gets called
|
||||||
if $_GET['action'] == 'history'.
|
if $_GET['action'] == 'history'.
|
||||||
|
|
||||||
It also requires $_GET['artistid'].
|
It also requires $_GET['artistid'].
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Artists Switch Center
|
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).
|
the root less cluttered).
|
||||||
|
|
||||||
enforce_login() is run here - the entire artist pages are off limits for
|
enforce_login() is run here - the entire artist pages are off limits for
|
||||||
non members.
|
non members.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
// Width and height of similar artist map
|
// Width and height of similar artist map
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$DB->query("UPDATE artists_group SET Name='".db_string($NewName)."' WHERE ArtistID='$ArtistID'");
|
$DB->query("UPDATE artists_group SET Name='".db_string($NewName)."' WHERE ArtistID='$ArtistID'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$OldAliasID'");
|
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$OldAliasID'");
|
||||||
$Groups = $DB->collect('GroupID');
|
$Groups = $DB->collect('GroupID');
|
||||||
$DB->query("UPDATE IGNORE torrents_artists SET AliasID='$TargetAliasID',ArtistID='$TargetArtistID' WHERE AliasID='$OldAliasID'");
|
$DB->query("UPDATE IGNORE torrents_artists SET AliasID='$TargetAliasID',ArtistID='$TargetArtistID' WHERE AliasID='$OldAliasID'");
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
$Subject = "You have received a warning";
|
$Subject = "You have received a warning";
|
||||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
|
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
|
||||||
$WarnTime = time_plus($Time);
|
$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 {
|
} else {
|
||||||
$Subject = "You have received a verbal warning";
|
$Subject = "You have received a verbal warning";
|
||||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||||
|
@ -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');
|
include(SERVER_ROOT.'/classes/class_image_tools.php');
|
||||||
@ -40,18 +40,18 @@
|
|||||||
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
|
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
|
||||||
VALUES ('$ArtistID', '$Body', '$Image', '$UserID', '$Summary', '".sqltime()."')");
|
VALUES ('$ArtistID', '$Body', '$Image', '$UserID', '$Summary', '".sqltime()."')");
|
||||||
} else { // revert
|
} else { // revert
|
||||||
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
|
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
|
||||||
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
|
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
|
||||||
FROM wiki_artists WHERE RevisionID='$RevisionID'");
|
FROM wiki_artists WHERE RevisionID='$RevisionID'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$RevisionID=$DB->inserted_id();
|
$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)
|
// 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
|
$DB->query("UPDATE artists_group
|
||||||
SET
|
SET
|
||||||
". ( isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '' ) ."
|
". ( isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '' ) ."
|
||||||
RevisionID='$RevisionID'
|
RevisionID='$RevisionID'
|
||||||
WHERE ArtistID='$ArtistID'");
|
WHERE ArtistID='$ArtistID'");
|
||||||
|
|
||||||
// There we go, all done!
|
// There we go, all done!
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||||
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID = ".$_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>';
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
||||||
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
||||||
|
|
||||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList=array();
|
$TagList=array();
|
||||||
if($TorrentTags!='') {
|
if($TorrentTags!='') {
|
||||||
$TorrentTags=explode(' ',$TorrentTags);
|
$TorrentTags=explode(' ',$TorrentTags);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||||
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$_GET['remove']);
|
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$_GET['remove']);
|
||||||
@ -61,7 +61,7 @@
|
|||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList=array();
|
$TagList=array();
|
||||||
if($TorrentTags!='') {
|
if($TorrentTags!='') {
|
||||||
$TorrentTags=explode(' ',$TorrentTags);
|
$TorrentTags=explode(' ',$TorrentTags);
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
break;
|
break;
|
||||||
case 'artistless':
|
case 'artistless':
|
||||||
include(SERVER_ROOT.'/sections/better/artistless.php');
|
include(SERVER_ROOT.'/sections/better/artistless.php');
|
||||||
break;
|
break;
|
||||||
case 'tags':
|
case 'tags':
|
||||||
include(SERVER_ROOT.'/sections/better/tags.php');
|
include(SERVER_ROOT.'/sections/better/tags.php');
|
||||||
break;
|
break;
|
||||||
case 'folders':
|
case 'folders':
|
||||||
include(SERVER_ROOT.'/sections/better/folders.php');
|
include(SERVER_ROOT.'/sections/better/folders.php');
|
||||||
break;
|
break;
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList=array();
|
$TagList=array();
|
||||||
if($TorrentTags!='') {
|
if($TorrentTags!='') {
|
||||||
$TorrentTags=explode(' ',$TorrentTags);
|
$TorrentTags=explode(' ',$TorrentTags);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
header('Location: blog.php');
|
header('Location: blog.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'takenewblog':
|
case 'takenewblog':
|
||||||
authorize();
|
authorize();
|
||||||
$Title = db_string($_POST['title']);
|
$Title = db_string($_POST['title']);
|
||||||
@ -53,20 +53,20 @@
|
|||||||
if($DB->record_count() < 1) {
|
if($DB->record_count() < 1) {
|
||||||
error("No such thread exists!");
|
error("No such thread exists!");
|
||||||
header('Location: blog.php');
|
header('Location: blog.php');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body);
|
$ThreadID = Misc::create_thread(ANNOUNCEMENT_FORUM_ID, $LoggedUser[ID], $Title, $Body);
|
||||||
if($ThreadID < 1) {
|
if($ThreadID < 1) {
|
||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
|
$DB->query("INSERT INTO blog (UserID, Title, Body, Time, ThreadID, Important)
|
||||||
VALUES ('".$LoggedUser['ID']."',
|
VALUES ('".$LoggedUser['ID']."',
|
||||||
'".db_string($_POST['title'])."',
|
'".db_string($_POST['title'])."',
|
||||||
'".db_string($_POST['body'])."',
|
'".db_string($_POST['body'])."',
|
||||||
'".sqltime()."',
|
'".sqltime()."',
|
||||||
".$ThreadID.",
|
".$ThreadID.",
|
||||||
'".(($_POST['important']=='1')?'1':'0')."')");
|
'".(($_POST['important']=='1')?'1':'0')."')");
|
||||||
$Cache->delete_value('blog');
|
$Cache->delete_value('blog');
|
||||||
if ($_POST['important']=='1') {
|
if ($_POST['important']=='1') {
|
||||||
@ -81,7 +81,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="box thin">
|
<div class="box thin">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
@ -91,9 +91,9 @@
|
|||||||
<div class="pad">
|
<div class="pad">
|
||||||
<input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
|
<input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
|
||||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||||
<? if(!empty($_GET['action']) && $_GET['action'] == 'editblog'){?>
|
<? if(!empty($_GET['action']) && $_GET['action'] == 'editblog'){?>
|
||||||
<input type="hidden" name="blogid" value="<?=$BlogID; ?>" />
|
<input type="hidden" name="blogid" value="<?=$BlogID; ?>" />
|
||||||
<? }?>
|
<? }?>
|
||||||
<h3>Title</h3>
|
<h3>Title</h3>
|
||||||
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br />
|
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br />
|
||||||
<h3>Body</h3>
|
<h3>Body</h3>
|
||||||
@ -113,7 +113,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
@ -147,7 +147,7 @@
|
|||||||
<div id="blog<?=$BlogID?>" class="box">
|
<div id="blog<?=$BlogID?>" class="box">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?>
|
<strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?>
|
||||||
<? if(check_perms('admin_manage_blog')) { ?>
|
<? if(check_perms('admin_manage_blog')) { ?>
|
||||||
- <a href="blog.php?action=editblog&id=<?=$BlogID?>" class="brackets">Edit</a>
|
- <a href="blog.php?action=editblog&id=<?=$BlogID?>" class="brackets">Edit</a>
|
||||||
<a href="blog.php?action=deleteblog&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
|
<a href="blog.php?action=deleteblog&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
@ -157,14 +157,14 @@
|
|||||||
<? if($ThreadID) { ?>
|
<? if($ThreadID) { ?>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<em><a href="forums.php?action=viewthread&threadid=<?=$ThreadID?>">Discuss this post here</a></em>
|
<em><a href="forums.php?action=viewthread&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&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a>
|
<a href="blog.php?action=deadthread&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a>
|
||||||
<? }
|
<? }
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@ function bookmark_schema($Type) {
|
|||||||
break;
|
break;
|
||||||
case 'request':
|
case 'request':
|
||||||
return array('bookmarks_requests', 'RequestID');
|
return array('bookmarks_requests', 'RequestID');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
die('HAX');
|
die('HAX');
|
||||||
}
|
}
|
||||||
|
@ -8,29 +8,29 @@ function get_font() {
|
|||||||
|
|
||||||
function make_captcha_img() {
|
function make_captcha_img() {
|
||||||
global $CaptchaBGs;
|
global $CaptchaBGs;
|
||||||
|
|
||||||
$Length=6;
|
$Length=6;
|
||||||
$ImageHeight=75;
|
$ImageHeight=75;
|
||||||
$ImageWidth=300;
|
$ImageWidth=300;
|
||||||
|
|
||||||
$Chars='abcdefghjkmprstuvwxyzABCDEFGHJKLMPQRSTUVWXY23456789';
|
$Chars='abcdefghjkmprstuvwxyzABCDEFGHJKLMPQRSTUVWXY23456789';
|
||||||
$CaptchaString='';
|
$CaptchaString='';
|
||||||
|
|
||||||
for($i=0;$i<$Length;$i++) { $CaptchaString.=$Chars[mt_rand(0,strlen($Chars)-1)]; }
|
for($i=0;$i<$Length;$i++) { $CaptchaString.=$Chars[mt_rand(0,strlen($Chars)-1)]; }
|
||||||
|
|
||||||
for($x=0;$x<$Length;$x++) {
|
for($x=0;$x<$Length;$x++) {
|
||||||
$FontDisplay[$x]['size']=mt_rand(24,32);
|
$FontDisplay[$x]['size']=mt_rand(24,32);
|
||||||
$FontDisplay[$x]['top']=mt_rand($FontDisplay[$x]['size']+5,$ImageHeight-($FontDisplay[$x]['size']/2));
|
$FontDisplay[$x]['top']=mt_rand($FontDisplay[$x]['size']+5,$ImageHeight-($FontDisplay[$x]['size']/2));
|
||||||
$FontDisplay[$x]['angle']=mt_rand(-30,30);
|
$FontDisplay[$x]['angle']=mt_rand(-30,30);
|
||||||
$FontDisplay[$x]['font']=get_font();
|
$FontDisplay[$x]['font']=get_font();
|
||||||
}
|
}
|
||||||
|
|
||||||
$Img=imagecreatetruecolor($ImageWidth,$ImageHeight);
|
$Img=imagecreatetruecolor($ImageWidth,$ImageHeight);
|
||||||
$BGImg=imagecreatefrompng(SERVER_ROOT.'/captcha/'.$CaptchaBGs[mt_rand(0,count($CaptchaBGs)-1)]);
|
$BGImg=imagecreatefrompng(SERVER_ROOT.'/captcha/'.$CaptchaBGs[mt_rand(0,count($CaptchaBGs)-1)]);
|
||||||
imagecopymerge($Img,$BGImg,0,0,0,0,300,75,50);
|
imagecopymerge($Img,$BGImg,0,0,0,0,300,75,50);
|
||||||
|
|
||||||
$ForeColor=imagecolorallocatealpha($Img,255,255,255,65);
|
$ForeColor=imagecolorallocatealpha($Img,255,255,255,65);
|
||||||
|
|
||||||
for($i=0;$i<strlen($CaptchaString);$i++) {
|
for($i=0;$i<strlen($CaptchaString);$i++) {
|
||||||
$CharX=(($ImageWidth/$Length)*($i+1))-(($ImageWidth/$Length)*.75);
|
$CharX=(($ImageWidth/$Length)*($i+1))-(($ImageWidth/$Length)*.75);
|
||||||
imagettftext($Img,$FontDisplay[$i]['size'],$FontDisplay[$i]['angle'],$CharX,
|
imagettftext($Img,$FontDisplay[$i]['size'],$FontDisplay[$i]['angle'],$CharX,
|
||||||
@ -42,7 +42,7 @@ function make_captcha_img() {
|
|||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
imagepng($Img);
|
imagepng($Img);
|
||||||
imagedestroy($Img);
|
imagedestroy($Img);
|
||||||
|
|
||||||
return $CaptchaString;
|
return $CaptchaString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
if($LoggedUser['DisablePosting']) {
|
if($LoggedUser['DisablePosting']) {
|
||||||
error('Your posting rights have been removed'); // Should this be logged?
|
error('Your posting rights have been removed'); // Should this be logged?
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("INSERT INTO collages_comments
|
$DB->query("INSERT INTO collages_comments
|
||||||
(CollageID, Body, UserID, Time)
|
(CollageID, Body, UserID, Time)
|
||||||
VALUES
|
VALUES
|
||||||
('$CollageID', '".db_string($_POST['body'])."', '$LoggedUser[ID]', '".sqltime()."')");
|
('$CollageID', '".db_string($_POST['body'])."', '$LoggedUser[ID]', '".sqltime()."')");
|
||||||
|
|
||||||
|
@ -15,17 +15,17 @@ function AddTorrent($CollageID, $GroupID) {
|
|||||||
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||||
if ($DB->record_count() == 0) {
|
if ($DB->record_count() == 0) {
|
||||||
$DB->query("INSERT IGNORE INTO collages_torrents
|
$DB->query("INSERT IGNORE INTO collages_torrents
|
||||||
(CollageID, GroupID, UserID, Sort, AddedOn)
|
(CollageID, GroupID, UserID, Sort, AddedOn)
|
||||||
VALUES
|
VALUES
|
||||||
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
|
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
|
||||||
|
|
||||||
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
|
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
|
||||||
|
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||||
$Cache->delete_value('torrent_collages_'.$GroupID);
|
$Cache->delete_value('torrent_collages_'.$GroupID);
|
||||||
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
|
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
|
||||||
|
|
||||||
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
|
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID");
|
||||||
while (list($CacheUserID) = $DB->next_record()) {
|
while (list($CacheUserID) = $DB->next_record()) {
|
||||||
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
|
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID);
|
||||||
@ -88,11 +88,11 @@ function AddTorrent($CollageID, $GroupID) {
|
|||||||
if (!$GroupID) {
|
if (!$GroupID) {
|
||||||
error('The torrent was not found in the database.');
|
error('The torrent was not found in the database.');
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTorrent($CollageID, $GroupID);
|
AddTorrent($CollageID, $GroupID);
|
||||||
} else {
|
} else {
|
||||||
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
|
$URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i';
|
||||||
|
|
||||||
$URLs = explode("\n",$_REQUEST['urls']);
|
$URLs = explode("\n",$_REQUEST['urls']);
|
||||||
$GroupIDs = array();
|
$GroupIDs = array();
|
||||||
$Err = '';
|
$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.";
|
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT ID FROM torrents_group WHERE ID='$GroupID'");
|
$DB->query("SELECT ID FROM torrents_group WHERE ID='$GroupID'");
|
||||||
if (!$DB->record_count()) {
|
if (!$DB->record_count()) {
|
||||||
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
|
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Err) {
|
if ($Err) {
|
||||||
error($Err);
|
error($Err);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($GroupIDs as $GroupID) {
|
foreach ($GroupIDs as $GroupID) {
|
||||||
AddTorrent($CollageID, $GroupID);
|
AddTorrent($CollageID, $GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Location: collages.php?id='.$CollageID);
|
header('Location: collages.php?id='.$CollageID);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Things to expect in $_GET:
|
Things to expect in $_GET:
|
||||||
ThreadID: ID of the forum curently being browsed
|
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
|
page = 1 is the same as no page
|
||||||
|
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
// Check for lame SQL injection attempts
|
// Check for lame SQL injection attempts
|
||||||
$CollageID = $_GET['collageid'];
|
$CollageID = $_GET['collageid'];
|
||||||
if(!is_number($CollageID)) {
|
if(!is_number($CollageID)) {
|
||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<? }
|
<? }
|
||||||
if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
||||||
if($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
if($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
||||||
|
|
||||||
|
@ -68,14 +68,14 @@
|
|||||||
$BookmarkJoin = '';
|
$BookmarkJoin = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$BaseSQL = $SQL = "SELECT SQL_CALC_FOUND_ROWS
|
$BaseSQL = $SQL = "SELECT SQL_CALC_FOUND_ROWS
|
||||||
c.ID,
|
c.ID,
|
||||||
c.Name,
|
c.Name,
|
||||||
c.NumTorrents,
|
c.NumTorrents,
|
||||||
c.TagList,
|
c.TagList,
|
||||||
c.CategoryID,
|
c.CategoryID,
|
||||||
c.UserID
|
c.UserID
|
||||||
FROM collages AS c
|
FROM collages AS c
|
||||||
$BookmarkJoin
|
$BookmarkJoin
|
||||||
WHERE Deleted = '0'";
|
WHERE Deleted = '0'";
|
||||||
|
|
||||||
@ -214,7 +214,7 @@
|
|||||||
<input type="submit" value="Search" />
|
<input type="submit" value="Search" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? } // if (!$BookmarkView) ?>
|
<? } // if (!$BookmarkView) ?>
|
||||||
@ -222,12 +222,12 @@
|
|||||||
<? if (!$BookmarkView) {
|
<? if (!$BookmarkView) {
|
||||||
if (check_perms('site_collages_create')) { ?>
|
if (check_perms('site_collages_create')) { ?>
|
||||||
<a href="collages.php?action=new" class="brackets">New collage</a>
|
<a href="collages.php?action=new" class="brackets">New collage</a>
|
||||||
<? }
|
<? }
|
||||||
if (check_perms('site_collages_personal')) {
|
if (check_perms('site_collages_personal')) {
|
||||||
|
|
||||||
$DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
$DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
||||||
$CollageCount = $DB->record_count();
|
$CollageCount = $DB->record_count();
|
||||||
|
|
||||||
if ($CollageCount == 1) {
|
if ($CollageCount == 1) {
|
||||||
list($CollageID) = $DB->next_record();
|
list($CollageID) = $DB->next_record();
|
||||||
?>
|
?>
|
||||||
@ -235,7 +235,7 @@
|
|||||||
<? } elseif ($CollageCount > 1) { ?>
|
<? } elseif ($CollageCount > 1) { ?>
|
||||||
<a href="collages.php?action=mine" class="brackets">Personal collages</a>
|
<a href="collages.php?action=mine" class="brackets">Personal collages</a>
|
||||||
<? }
|
<? }
|
||||||
}
|
}
|
||||||
if (check_perms('site_collages_subscribe')) { ?>
|
if (check_perms('site_collages_subscribe')) { ?>
|
||||||
<a href="userhistory.php?action=subscribed_collages" class="brackets">Subscribed collages</a>
|
<a href="userhistory.php?action=subscribed_collages" class="brackets">Subscribed collages</a>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
@ -296,7 +296,7 @@
|
|||||||
$Tags[]='<a href="collages.php?action=search&tags='.$Tag.'">'.$Tag.'</a>';
|
$Tags[]='<a href="collages.php?action=search&tags='.$Tag.'">'.$Tag.'</a>';
|
||||||
}
|
}
|
||||||
$Tags = implode(', ', $Tags);
|
$Tags = implode(', ', $Tags);
|
||||||
|
|
||||||
//Print results
|
//Print results
|
||||||
?>
|
?>
|
||||||
<tr class="row<?=$Row?> <?=($BookmarkView)?'bookmark_'.$ID:''?>">
|
<tr class="row<?=$Row?> <?=($BookmarkView)?'bookmark_'.$ID:''?>">
|
||||||
@ -309,7 +309,7 @@
|
|||||||
<span style="float:right">
|
<span style="float:right">
|
||||||
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
|
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
|
||||||
</span>
|
</span>
|
||||||
<? }
|
<? }
|
||||||
if(!empty($Tags)) {
|
if(!empty($Tags)) {
|
||||||
?>
|
?>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
$CollageID = $_GET['collageid'];
|
$CollageID = $_GET['collageid'];
|
||||||
if(!is_number($CollageID) || !$CollageID) {
|
if(!is_number($CollageID) || !$CollageID) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT Name, UserID FROM collages WHERE ID='$CollageID'");
|
$DB->query("SELECT Name, UserID FROM collages WHERE ID='$CollageID'");
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
/*********************************************************************\
|
/*********************************************************************\
|
||||||
//--------------Get Post--------------------------------------------//
|
//--------------Get Post--------------------------------------------//
|
||||||
|
|
||||||
This gets the raw BBCode of a post. It's used for editing and
|
This gets the raw BBCode of a post. It's used for editing and
|
||||||
quoting posts.
|
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.
|
$_GET['post'], which is the ID of the post.
|
||||||
|
|
||||||
\*********************************************************************/
|
\*********************************************************************/
|
||||||
@ -18,10 +18,10 @@
|
|||||||
// Variables for database input
|
// Variables for database input
|
||||||
$PostID = $_GET['post'];
|
$PostID = $_GET['post'];
|
||||||
|
|
||||||
// Mainly
|
// Mainly
|
||||||
$DB->query("SELECT Body FROM collages_comments WHERE ID='$PostID'");
|
$DB->query("SELECT Body FROM collages_comments WHERE ID='$PostID'");
|
||||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
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);
|
echo trim($Body);
|
||||||
|
@ -66,11 +66,11 @@
|
|||||||
if(!check_perms('site_collages_personal')) {
|
if(!check_perms('site_collages_personal')) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
||||||
list($CollageCount) = $DB->next_record();
|
list($CollageCount) = $DB->next_record();
|
||||||
|
|
||||||
if($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
|
if($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
|
||||||
list($CollageID) = $DB->next_record();
|
list($CollageID) = $DB->next_record();
|
||||||
header('Location: collage.php?id='.$CollageID);
|
header('Location: collage.php?id='.$CollageID);
|
||||||
die();
|
die();
|
||||||
|
@ -44,6 +44,6 @@
|
|||||||
if(!is_number($Sort)) { error(404); }
|
if(!is_number($Sort)) { error(404); }
|
||||||
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
header('Location: collages.php?action=manage&collageid='.$CollageID);
|
header('Location: collages.php?action=manage&collageid='.$CollageID);
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
<select name="category" <?=$ChangeJS?>>
|
<select name="category" <?=$ChangeJS?>>
|
||||||
<?
|
<?
|
||||||
array_shift($CollageCats);
|
array_shift($CollageCats);
|
||||||
|
|
||||||
foreach($CollageCats as $CatID=>$CatName) { ?>
|
foreach($CollageCats as $CatID=>$CatName) { ?>
|
||||||
<option value="<?=$CatID+1?>"<?=(($CatID+1 == $Category)?' selected':'')?>><?=$CatName?></option>
|
<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'");
|
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
||||||
list($CollageCount) = $DB->next_record();
|
list($CollageCount) = $DB->next_record();
|
||||||
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Theme</strong> - A collage containing releases that all relate to a certain theme (e.g. "Searching for the Perfect Beat", "Concept Albums", "Funky Groove", etc.).</li>
|
<li><strong>Theme</strong> - A collage containing releases that all relate to a certain theme (e.g. "Searching for the Perfect Beat", "Concept Albums", "Funky Groove", etc.).</li>
|
||||||
<li><strong>Genre introduction</strong> - A subjective introduction to a genre composed by our own users.</li>
|
<li><strong>Genre introduction</strong> - A subjective introduction to a genre composed by our own users.</li>
|
||||||
<li><strong>Discography</strong> - A collage containing all the releases of an artist. Useful for keeping track of side-projects.</li>
|
<li><strong>Discography</strong> - A collage containing all the releases of an artist. Useful for keeping track of side-projects.</li>
|
||||||
<li><strong>Label</strong> - A collage containing all the releases of a particular record label.</li>
|
<li><strong>Label</strong> - A collage containing all the releases of a particular record label.</li>
|
||||||
@ -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>
|
<li><strong>Charts</strong> - Contains all the releases that comprise a certain type of chart (e.g. Billboard Top 100, Pitchfork Top 100, What.cd Top 10, etc.).</li>
|
||||||
<?
|
<?
|
||||||
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
if(($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
||||||
<li><strong>Personal</strong> - You can put whatever you want here. It's your own personal collage.</li>
|
<li><strong>Personal</strong> - You can put whatever you want here. It's your own personal collage.</li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
}
|
}
|
||||||
$TagList = implode(' ',$TagList);
|
$TagList = implode(' ',$TagList);
|
||||||
|
|
||||||
$DB->query("INSERT INTO collages
|
$DB->query("INSERT INTO collages
|
||||||
(Name, Description, UserID, TagList, CategoryID)
|
(Name, Description, UserID, TagList, CategoryID)
|
||||||
VALUES
|
VALUES
|
||||||
('$P[name]', '$P[description]', $LoggedUser[ID], '$TagList', '$P[category]')");
|
('$P[name]', '$P[description]', $LoggedUser[ID], '$TagList', '$P[category]')");
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
|
|
||||||
$CollageID = $_POST['collageid'];
|
$CollageID = $_POST['collageid'];
|
||||||
if(!is_number($CollageID) || !$CollageID) {
|
if(!is_number($CollageID) || !$CollageID) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT Name, CategoryID, UserID FROM collages WHERE ID='$CollageID'");
|
$DB->query("SELECT Name, CategoryID, UserID FROM collages WHERE ID='$CollageID'");
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
$Body = db_string(urldecode($_POST['body']));
|
$Body = db_string(urldecode($_POST['body']));
|
||||||
$PostID = $_POST['post'];
|
$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'");
|
$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();
|
list($OldBody, $AuthorID, $CollageID, $PostNum) = $DB->next_record();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<?=$OtherLink?>
|
<?=$OtherLink?>
|
||||||
</div>
|
</div>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="linkbox">
|
<div class="linkbox">
|
||||||
<?=$Pages?>
|
<?=$Pages?>
|
||||||
</div>
|
</div>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
} /* end while loop*/ ?>
|
} /* end while loop*/ ?>
|
||||||
<div class="linkbox"><?= $Pages; ?></div>
|
<div class="linkbox"><?= $Pages; ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
View::show_footer();
|
View::show_footer();
|
||||||
|
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
if(isset($_GET['id'])) {
|
if(isset($_GET['id'])) {
|
||||||
$UserID = $_GET['id'];
|
$UserID = $_GET['id'];
|
||||||
if(!is_number($UserID))
|
if(!is_number($UserID))
|
||||||
error(404);
|
error(404);
|
||||||
|
|
||||||
$UserInfo = Users::user_info($UserID);
|
$UserInfo = Users::user_info($UserID);
|
||||||
|
|
||||||
$Username = $UserInfo['Username'];
|
$Username = $UserInfo['Username'];
|
||||||
if($LoggedUser['ID'] == $UserID) {
|
if($LoggedUser['ID'] == $UserID) {
|
||||||
$Self = true;
|
$Self = true;
|
||||||
@ -29,8 +29,8 @@
|
|||||||
}
|
}
|
||||||
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||||
$UserClass = $Perms['Class'];
|
$UserClass = $Perms['Class'];
|
||||||
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
|
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
|
||||||
error(403);
|
error(403);
|
||||||
} else {
|
} else {
|
||||||
$UserID = $LoggedUser['ID'];
|
$UserID = $LoggedUser['ID'];
|
||||||
$Username = $LoggedUser['Username'];
|
$Username = $LoggedUser['Username'];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* @param $UserID UserID of the guy/gal who posted the comment
|
* @param $UserID UserID of the guy/gal who posted the comment
|
||||||
* @param $PostID The post number
|
* @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 $permalink the link to the post elsewhere on the site (torrents.php)
|
||||||
* @param $Body the post body
|
* @param $Body the post body
|
||||||
* @param $EditorID the guy who last edited the post
|
* @param $EditorID the guy who last edited the post
|
||||||
@ -15,7 +15,7 @@
|
|||||||
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
|
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
|
||||||
global $Text,$HeavyInfo;
|
global $Text,$HeavyInfo;
|
||||||
$UserInfo = Users::user_info($UserID);
|
$UserInfo = Users::user_info($UserID);
|
||||||
$postheader = "by <strong>" . Users::format_username($UserID, true, true, true, true, false) . "</strong> "
|
$postheader = "by <strong>" . Users::format_username($UserID, true, true, true, true, false) . "</strong> "
|
||||||
. time_diff($AddedTime) . $postheader;
|
. time_diff($AddedTime) . $postheader;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -44,7 +44,7 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
|
|||||||
</td>
|
</td>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<td class='body' valign="top">
|
<td class='body' valign="top">
|
||||||
<?=$Text->full_format($Body) ?>
|
<?=$Text->full_format($Body) ?>
|
||||||
<? if($EditorID){ ?>
|
<? if($EditorID){ ?>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
Last edited by
|
Last edited by
|
||||||
@ -53,4 +53,4 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<? }
|
<? }
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
//Repeat donor
|
//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.'),'');
|
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->update_row(false, array('Invites' => $Invites));
|
||||||
$Cache->commit_transaction(0);
|
$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.'),'');
|
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);
|
send_irc("PRIVMSG ".BOT_REPORT_CHAN." :".$Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_info
|
$DB->query("UPDATE users_info
|
||||||
SET
|
SET
|
||||||
AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment)
|
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']."'");
|
WHERE UserID='".$_POST['custom']."'");
|
||||||
$DB->query("INSERT INTO donations
|
$DB->query("INSERT INTO donations
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<?
|
<?
|
||||||
// Main feeds page
|
// Main feeds page
|
||||||
// The feeds don't use script_start.php, their code resides entirely in feeds.php in the document root
|
// 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 (
|
if (
|
||||||
empty($_GET['feed']) ||
|
empty($_GET['feed']) ||
|
||||||
empty($_GET['authkey']) ||
|
empty($_GET['authkey']) ||
|
||||||
empty($_GET['auth']) ||
|
empty($_GET['auth']) ||
|
||||||
empty($_GET['passkey']) ||
|
empty($_GET['passkey']) ||
|
||||||
empty($_GET['user']) ||
|
empty($_GET['user']) ||
|
||||||
!is_number($_GET['user']) ||
|
!is_number($_GET['user']) ||
|
||||||
strlen($_GET['authkey']) != 32 ||
|
strlen($_GET['authkey']) != 32 ||
|
||||||
strlen($_GET['passkey']) != 32 ||
|
strlen($_GET['passkey']) != 32 ||
|
||||||
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
$Feed->open_feed();
|
$Feed->open_feed();
|
||||||
switch($_GET['feed']) {
|
switch($_GET['feed']) {
|
||||||
case 'feed_news':
|
case 'feed_news':
|
||||||
include(SERVER_ROOT.'/classes/class_text.php');
|
include(SERVER_ROOT.'/classes/class_text.php');
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
$Feed->channel('News', 'RSS feed for site news.');
|
$Feed->channel('News', 'RSS feed for site news.');
|
||||||
@ -71,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'feed_blog':
|
case 'feed_blog':
|
||||||
include(SERVER_ROOT.'/classes/class_text.php');
|
include(SERVER_ROOT.'/classes/class_text.php');
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
$Feed->channel('Blog', 'RSS feed for site blog.');
|
$Feed->channel('Blog', 'RSS feed for site blog.');
|
||||||
@ -100,75 +100,75 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'torrents_all':
|
case 'torrents_all':
|
||||||
$Feed->channel('All Torrents', 'RSS feed for all new torrent uploads.');
|
$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']);
|
||||||
break;
|
break;
|
||||||
case 'torrents_music':
|
case 'torrents_music':
|
||||||
$Feed->channel('Music Torrents', 'RSS feed for all new music torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_apps':
|
case 'torrents_apps':
|
||||||
$Feed->channel('Application Torrents', 'RSS feed for all new application torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_ebooks':
|
case 'torrents_ebooks':
|
||||||
$Feed->channel('E-Book Torrents', 'RSS feed for all new e-book torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_abooks':
|
case 'torrents_abooks':
|
||||||
$Feed->channel('Audiobook Torrents', 'RSS feed for all new audiobook torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_evids':
|
case 'torrents_evids':
|
||||||
$Feed->channel('E-Learning Video Torrents', 'RSS feed for all new e-learning video torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_comedy':
|
case 'torrents_comedy':
|
||||||
$Feed->channel('Comedy Torrents', 'RSS feed for all new comedy torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_comics':
|
case 'torrents_comics':
|
||||||
$Feed->channel('Comic Torrents', 'RSS feed for all new comic torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_mp3':
|
case 'torrents_mp3':
|
||||||
$Feed->channel('MP3 Torrents', 'RSS feed for all new mp3 torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_flac':
|
case 'torrents_flac':
|
||||||
$Feed->channel('FLAC Torrents', 'RSS feed for all new FLAC torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_vinyl':
|
case 'torrents_vinyl':
|
||||||
$Feed->channel('Vinyl Sourced Torrents', 'RSS feed for all new vinyl sourced torrents.');
|
$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;
|
break;
|
||||||
case 'torrents_lossless':
|
case 'torrents_lossless':
|
||||||
$Feed->channel('Lossless Torrents', 'RSS feed for all new lossless uploads.');
|
$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;
|
break;
|
||||||
case 'torrents_lossless24':
|
case 'torrents_lossless24':
|
||||||
$Feed->channel('24bit Lossless Torrents', 'RSS feed for all new 24bit uploads.');
|
$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;
|
break;
|
||||||
default:
|
default:
|
||||||
// Personalized torrents
|
// Personalized torrents
|
||||||
if(empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
|
if(empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
|
||||||
// All personalized torrent notifications
|
// All personalized torrent notifications
|
||||||
$Feed->channel('Personalized torrent notifications', 'RSS feed for 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_'){
|
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
|
||||||
// Specific personalized torrent notification channel
|
// Specific personalized torrent notification channel
|
||||||
$Feed->channel(display_str($_GET['name']), 'Personal RSS feed: '.display_str($_GET['name']));
|
$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_') {
|
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 21) == 'torrents_bookmarks_t_') {
|
||||||
// Bookmarks
|
// Bookmarks
|
||||||
$Feed->channel('Bookmarked torrent notifications', 'RSS feed for bookmarked torrents.');
|
$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 {
|
} else {
|
||||||
$Feed->channel('All Torrents', 'RSS feed for all new torrent uploads.');
|
$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();
|
$Feed->close_feed();
|
||||||
|
@ -26,13 +26,13 @@
|
|||||||
$Edits = $Cache->get_value($Type.'_edits_'.$PostID);
|
$Edits = $Cache->get_value($Type.'_edits_'.$PostID);
|
||||||
if(!is_array($Edits)) {
|
if(!is_array($Edits)) {
|
||||||
$DB->query("SELECT ce.EditUser, ce.EditTime, ce.Body
|
$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."
|
WHERE Page = '".$Type."' AND PostID = ".$PostID."
|
||||||
ORDER BY ce.EditTime DESC");
|
ORDER BY ce.EditTime DESC");
|
||||||
$Edits = $DB->to_array();
|
$Edits = $DB->to_array();
|
||||||
$Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0);
|
$Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($UserID, $Time) = $Edits[$Depth];
|
list($UserID, $Time) = $Edits[$Depth];
|
||||||
if($Depth != 0) {
|
if($Depth != 0) {
|
||||||
list(,,$Body) = $Edits[$Depth - 1];
|
list(,,$Body) = $Edits[$Depth - 1];
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
$DB->query("UPDATE forums_polls_votes SET Vote = ".$NewVote." WHERE TopicID = ".$ThreadID." AND UserID = ".$LoggedUser['ID']);
|
$DB->query("UPDATE forums_polls_votes SET Vote = ".$NewVote." WHERE TopicID = ".$ThreadID." AND UserID = ".$LoggedUser['ID']);
|
||||||
$Cache->delete_value('polls_'.$ThreadID);
|
$Cache->delete_value('polls_'.$ThreadID);
|
||||||
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
|
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get topicid, forumid, number of pages
|
// Get topicid, forumid, number of pages
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
TopicID,
|
TopicID,
|
||||||
ForumID,
|
ForumID,
|
||||||
CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages,
|
CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages,
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
$Cache->delete_value('polls_'.$ThreadID);
|
$Cache->delete_value('polls_'.$ThreadID);
|
||||||
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
|
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
list($Stickies) = $DB->next_record();
|
list($Stickies) = $DB->next_record();
|
||||||
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!isset($Forums[$ForumID])) { error(404); }
|
if(!isset($Forums[$ForumID])) { error(404); }
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<h3>Search this forum:</h3>
|
<h3>Search this forum:</h3>
|
||||||
<form class="search_form" name="forum" action="forums.php" method="get">
|
<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>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="action" value="search" />
|
<input type="hidden" name="action" value="search" />
|
||||||
@ -93,9 +93,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><strong>Search in:</strong></td>
|
<td><strong>Search in:</strong></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" name="type" id="type_title" value="title" checked="checked" />
|
<input type="radio" name="type" id="type_title" value="title" checked="checked" />
|
||||||
<label for="type_title">Titles</label>
|
<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>
|
<label for="type_body">Post bodies</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -111,17 +111,17 @@
|
|||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?
|
|
||||||
|
<?
|
||||||
/*
|
/*
|
||||||
if(check_perms('users_mod')) {
|
if(check_perms('users_mod')) {
|
||||||
$DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'");
|
$DB->query("SELECT ForumID from subscribed_forums WHERE ForumID='$ForumID' AND SubscriberID='$LoggedUser[ID]'");
|
||||||
if($DB->record_count() == 0) { ?>
|
if($DB->record_count() == 0) { ?>
|
||||||
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<a href="forums.php?action=forum_subscribe&perform=remove&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Unsubscribe from forum</a>
|
<a href="forums.php?action=forum_subscribe&perform=remove&forumid=<?=$ForumID?>&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
Loading…
Reference in New Issue
Block a user