mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
c5f1e0d054
commit
e830d8d517
@ -13,11 +13,11 @@
|
|||||||
if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); }
|
if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); }
|
||||||
if(isset($LoginCookie)) {
|
if(isset($LoginCookie)) {
|
||||||
list($SessionID, $UserID)=explode("|~|",$Enc->decrypt($LoginCookie));
|
list($SessionID, $UserID)=explode("|~|",$Enc->decrypt($LoginCookie));
|
||||||
|
|
||||||
if(!$UserID || !$SessionID) {
|
if(!$UserID || !$SessionID) {
|
||||||
die('Not logged in!');
|
die('Not logged in!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$Enabled = $Cache->get_value('enabled_'.$UserID)){
|
if(!$Enabled = $Cache->get_value('enabled_'.$UserID)){
|
||||||
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
|
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
|
||||||
$DB=NEW DB_MYSQL; //Load the database wrapper
|
$DB=NEW DB_MYSQL; //Load the database wrapper
|
||||||
|
@ -1,19 +1,3 @@
|
|||||||
<?
|
<?
|
||||||
class ARTIST {
|
// Placeholder for if we ever decide to actaully have a model for an artist.
|
||||||
var $ID = 0;
|
|
||||||
var $Name = 0;
|
|
||||||
var $NameLength = 0;
|
|
||||||
var $SimilarID = 0;
|
|
||||||
var $Displayed = false;
|
|
||||||
var $x = 0;
|
|
||||||
var $y = 0;
|
|
||||||
var $Similar = array();
|
|
||||||
|
|
||||||
function ARTIST($ID='', $Name=''){
|
|
||||||
$this->ID = $ID;
|
|
||||||
$this->NameLength = mb_strlen($Name, 'utf8');
|
|
||||||
$this->Name = display_str($Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
274
classes/class_artists.php
Normal file
274
classes/class_artists.php
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
<?
|
||||||
|
class Artists {
|
||||||
|
/**
|
||||||
|
* Given an array of GroupIDs, return their associated artists.
|
||||||
|
*
|
||||||
|
* @param array $GroupIDs
|
||||||
|
* @return an array of the following form:
|
||||||
|
* GroupID => {
|
||||||
|
* [ArtistType] => {
|
||||||
|
* id, name, aliasid
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ArtistType is an int. It can be:
|
||||||
|
* 1 => Main artist
|
||||||
|
* 2 => Guest artist
|
||||||
|
* 4 => Composer
|
||||||
|
* 5 => Conductor
|
||||||
|
* 6 => DJ
|
||||||
|
*/
|
||||||
|
public static function get_artists($GroupIDs) {
|
||||||
|
global $Cache, $DB;
|
||||||
|
$Results = array();
|
||||||
|
$DBs = array();
|
||||||
|
foreach($GroupIDs as $GroupID) {
|
||||||
|
if(!is_number($GroupID)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$Artists = $Cache->get_value('groups_artists_'.$GroupID);
|
||||||
|
if(is_array($Artists)) {
|
||||||
|
$Results[$GroupID] = $Artists;
|
||||||
|
} else {
|
||||||
|
$DBs[] = $GroupID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($DBs) > 0) {
|
||||||
|
$IDs = implode(',', $DBs);
|
||||||
|
if(empty($IDs)) {
|
||||||
|
$IDs = "null";
|
||||||
|
}
|
||||||
|
$DB->query("SELECT ta.GroupID,
|
||||||
|
ta.ArtistID,
|
||||||
|
aa.Name,
|
||||||
|
ta.Importance,
|
||||||
|
ta.AliasID
|
||||||
|
FROM torrents_artists AS ta
|
||||||
|
JOIN artists_alias AS aa ON ta.AliasID = aa.AliasID
|
||||||
|
WHERE ta.GroupID IN ($IDs)
|
||||||
|
ORDER BY ta.GroupID ASC,
|
||||||
|
ta.Importance ASC,
|
||||||
|
aa.Name ASC;");
|
||||||
|
while(list($GroupID,$ArtistID,$ArtistName,$ArtistImportance,$AliasID) = $DB->next_record(MYSQLI_BOTH, false)) {
|
||||||
|
$Results[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
|
||||||
|
$New[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
|
||||||
|
}
|
||||||
|
foreach($DBs as $GroupID) {
|
||||||
|
if(isset($New[$GroupID])) {
|
||||||
|
$Cache->cache_value('groups_artists_'.$GroupID, $New[$GroupID]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Cache->cache_value('groups_artists_'.$GroupID, array());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Missing = array_diff($GroupIDs, array_keys($Results));
|
||||||
|
if(!empty($Missing)) {
|
||||||
|
$Results += array_fill_keys($Missing, array());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function for get_artists, when you just need one group.
|
||||||
|
*
|
||||||
|
* @param int $GroupID
|
||||||
|
* @return array - see get_artists
|
||||||
|
*/
|
||||||
|
public static function get_artist($GroupID) {
|
||||||
|
$Results = Artists::get_artists(array($GroupID));
|
||||||
|
return $Results[$GroupID];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format an array of artists for display.
|
||||||
|
* TODO: Revisit the logic of this, see if we can helper-function the copypasta.
|
||||||
|
*
|
||||||
|
* @param array Artists an array of the form output by get_artists
|
||||||
|
* @param boolean $MakeLink if true, the artists will be links, if false, they will be text.
|
||||||
|
* @param boolean $IncludeHyphen if true, appends " - " to the end.
|
||||||
|
* @param $Escape if true, output will be escaped. Think carefully before setting it false.
|
||||||
|
*/
|
||||||
|
public static function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Escape = true) {
|
||||||
|
if(!empty($Artists)) {
|
||||||
|
$ampersand = ($Escape) ? ' & ' : ' & ';
|
||||||
|
$link = '';
|
||||||
|
|
||||||
|
$MainArtists = $Artists[1];
|
||||||
|
$Guests = $Artists[2];
|
||||||
|
$Composers = $Artists[4];
|
||||||
|
$Conductors = $Artists[5];
|
||||||
|
$DJs = $Artists[6];
|
||||||
|
|
||||||
|
if ((count($MainArtists) + count($Conductors) + count($DJs) == 0) && (count($Composers) == 0)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Various Composers is not needed and is ugly and should die
|
||||||
|
switch(count($Composers)) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$link .= Artists::display_artist($Composers[0], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$link .= Artists::display_artist($Composers[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($Composers[1], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((count($Composers) > 0) && (count($Composers) < 3) && (count($MainArtists) > 0)) {
|
||||||
|
$link .= ' performed by ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ComposerStr .= $link;
|
||||||
|
|
||||||
|
switch(count($MainArtists)) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$link .= Artists::display_artist($MainArtists[0], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$link .= Artists::display_artist($MainArtists[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($MainArtists[1], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$link .= 'Various Artists';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(!empty($Guests) && (count($MainArtists) + count($Composers) > 0) && (count($MainArtists) + count($Composers) + count($Conductors) < 3)) {
|
||||||
|
switch(count($Guests)) {
|
||||||
|
case 1:
|
||||||
|
$link .= ' with '.Artists::display_artist($Guests[0], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$link .= ' with '.Artists::display_artist($Guests[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($Guests[1], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if ((count($Conductors) > 0) && (count($MainArtists) + count($Composers) > 0) && (count($Composers) < 3 || count($MainArtists) > 0)) {
|
||||||
|
$link .= ' under ';
|
||||||
|
}
|
||||||
|
switch(count($Conductors)) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$link .= Artists::display_artist($Conductors[0], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$link .= Artists::display_artist($Conductors[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($Conductors[1], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$link .= ' Various Conductors';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((count($Composers) > 0) && (count($MainArtists) + count($Conductors) > 3) && (count($MainArtists) > 1) && (count($Conductors) > 1)) {
|
||||||
|
$link = $ComposerStr . 'Various Artists';
|
||||||
|
} elseif ((count($Composers) > 2) && (count($MainArtists) + count($Conductors) == 0)) {
|
||||||
|
$link = 'Various Composers';
|
||||||
|
}
|
||||||
|
|
||||||
|
// DJs override everything else
|
||||||
|
switch(count($DJs)) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$link = Artists::display_artist($DJs[0], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$link = Artists::display_artist($DJs[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($DJs[1], $MakeLink, $Escape);
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
$link = 'Various DJs';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link.($IncludeHyphen?' - ':'');
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a single artist name.
|
||||||
|
*
|
||||||
|
* @param array $Artist an array of the form ('id'=>ID, 'name'=>Name)
|
||||||
|
* @param boolean $MakeLink If true, links to the artist page.
|
||||||
|
* @param boolean $Escape If false and $MakeLink is false, returns the unescaped, unadorned artist name.
|
||||||
|
* @return string Formatted artist name.
|
||||||
|
*/
|
||||||
|
public static function display_artist($Artist, $MakeLink = true, $Escape = true) {
|
||||||
|
if ($MakeLink && !$Escape) {
|
||||||
|
error('Invalid parameters to Artists::display_artist()');
|
||||||
|
} elseif ($MakeLink) {
|
||||||
|
return '<a href="artist.php?id='.$Artist['id'].'">'.display_str($Artist['name']).'</a>';
|
||||||
|
} elseif ($Escape) {
|
||||||
|
return display_str($Artist['name']);
|
||||||
|
} else {
|
||||||
|
return $Artist['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an artist and their requests, wiki, and tags.
|
||||||
|
* Does NOT delete their torrents.
|
||||||
|
*
|
||||||
|
* @param int $ArtistID
|
||||||
|
*/
|
||||||
|
public static function delete_artist($ArtistID) {
|
||||||
|
global $DB, $LoggedUser, $Cache;
|
||||||
|
|
||||||
|
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = ".$ArtistID);
|
||||||
|
list($Name) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
|
||||||
|
// Delete requests
|
||||||
|
$DB->query("SELECT RequestID FROM requests_artists WHERE ArtistID=".$ArtistID." AND ArtistID != 0");
|
||||||
|
$Requests = $DB->to_array();
|
||||||
|
foreach($Requests AS $Request) {
|
||||||
|
list($RequestID) = $Request;
|
||||||
|
$DB->query('DELETE FROM requests WHERE ID='.$RequestID);
|
||||||
|
$DB->query('DELETE FROM requests_votes WHERE RequestID='.$RequestID);
|
||||||
|
$DB->query('DELETE FROM requests_tags WHERE RequestID='.$RequestID);
|
||||||
|
$DB->query('DELETE FROM requests_artists WHERE RequestID='.$RequestID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete artist
|
||||||
|
$DB->query('DELETE FROM artists_group WHERE ArtistID='.$ArtistID);
|
||||||
|
$DB->query('DELETE FROM artists_alias WHERE ArtistID='.$ArtistID);
|
||||||
|
$Cache->decrement('stats_artist_count');
|
||||||
|
|
||||||
|
// Delete wiki revisions
|
||||||
|
$DB->query('DELETE FROM wiki_artists WHERE PageID='.$ArtistID);
|
||||||
|
|
||||||
|
// Delete tags
|
||||||
|
$DB->query('DELETE FROM artists_tags WHERE ArtistID='.$ArtistID);
|
||||||
|
|
||||||
|
$Cache->delete_value('artist_'.$ArtistID);
|
||||||
|
// Record in log
|
||||||
|
|
||||||
|
if(!empty($LoggedUser['Username'])) {
|
||||||
|
$Username = $LoggedUser['Username'];
|
||||||
|
} else {
|
||||||
|
$Username = 'System';
|
||||||
|
}
|
||||||
|
Misc::write_log('Artist '.$ArtistID.' ('.$Name.') was deleted by '.$Username);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove LRM (left-right-marker) and trims, because people copypaste carelessly.
|
||||||
|
* If we don't do this, we get seemingly duplicate artist names.
|
||||||
|
* TODO: make stricter, e.g. on all whitespace characters or Unicode normalisation
|
||||||
|
*
|
||||||
|
* @param string $ArtistName
|
||||||
|
*/
|
||||||
|
public static function normalise_artist_name($ArtistName) {
|
||||||
|
// \u200e is ‎
|
||||||
|
$ArtistName = trim($ArtistName);
|
||||||
|
$ArtistName = preg_replace('/^(\xE2\x80\x8E)+/', '', $ArtistName);
|
||||||
|
$ArtistName = preg_replace('/(\xE2\x80\x8E)+$/', '', $ArtistName);
|
||||||
|
return trim(preg_replace('/ +/', ' ', $ArtistName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -1,35 +1,52 @@
|
|||||||
<?
|
<?
|
||||||
|
class ARTIST {
|
||||||
|
var $ID = 0;
|
||||||
|
var $Name = 0;
|
||||||
|
var $NameLength = 0;
|
||||||
|
var $SimilarID = 0;
|
||||||
|
var $Displayed = false;
|
||||||
|
var $x = 0;
|
||||||
|
var $y = 0;
|
||||||
|
var $Similar = array();
|
||||||
|
|
||||||
|
function ARTIST($ID='', $Name=''){
|
||||||
|
$this->ID = $ID;
|
||||||
|
$this->NameLength = mb_strlen($Name, 'utf8');
|
||||||
|
$this->Name = display_str($Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ARTISTS_SIMILAR extends ARTIST{
|
class ARTISTS_SIMILAR extends ARTIST{
|
||||||
var $Artists = array();
|
var $Artists = array();
|
||||||
var $TotalScore = 0;
|
var $TotalScore = 0;
|
||||||
|
|
||||||
var $xValues = array(WIDTH=>1);
|
var $xValues = array(WIDTH=>1);
|
||||||
var $yValues = array(HEIGHT=>1);
|
var $yValues = array(HEIGHT=>1);
|
||||||
|
|
||||||
var $LargestDecimal = 0;
|
var $LargestDecimal = 0;
|
||||||
var $LowestDecimal = 1;
|
var $LowestDecimal = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function dump_data(){
|
function dump_data(){
|
||||||
return serialize(array(time(), $this->Name, $this->x, $this->y, serialize($this->Artists), serialize($this->Similar)));
|
return serialize(array(time(), $this->Name, $this->x, $this->y, serialize($this->Artists), serialize($this->Similar)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_data($Data){
|
function load_data($Data){
|
||||||
list($LastUpdated, $this->Name, $this->x, $this->y, $this->Artists, $this->Similar) = unserialize($Data);
|
list($LastUpdated, $this->Name, $this->x, $this->y, $this->Artists, $this->Similar) = unserialize($Data);
|
||||||
$this->Artists = unserialize($this->Artists);
|
$this->Artists = unserialize($this->Artists);
|
||||||
$this->Similar = unserialize($this->Similar);
|
$this->Similar = unserialize($this->Similar);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_up(){
|
function set_up(){
|
||||||
$this->x = ceil(WIDTH/2);
|
$this->x = ceil(WIDTH/2);
|
||||||
$this->y = ceil(HEIGHT/2);
|
$this->y = ceil(HEIGHT/2);
|
||||||
|
|
||||||
$this->xValues[$this->x] = $this->ID;
|
$this->xValues[$this->x] = $this->ID;
|
||||||
$this->yValues[$this->y] = $this->ID;
|
$this->yValues[$this->y] = $this->ID;
|
||||||
|
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// Get artists that are directly similar to the artist
|
// Get artists that are directly similar to the artist
|
||||||
$ArtistIDs = array();
|
$ArtistIDs = array();
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -44,11 +61,11 @@ function set_up(){
|
|||||||
WHERE s1.ArtistID=".$this->ID."
|
WHERE s1.ArtistID=".$this->ID."
|
||||||
ORDER BY ass.Score DESC
|
ORDER BY ass.Score DESC
|
||||||
LIMIT 14");
|
LIMIT 14");
|
||||||
|
|
||||||
if($DB->record_count() == 0){
|
if($DB->record_count() == 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build into array. Each artist is its own object in $this->Artists
|
// Build into array. Each artist is its own object in $this->Artists
|
||||||
while(list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)){
|
while(list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)){
|
||||||
if($Score<0){
|
if($Score<0){
|
||||||
@ -59,7 +76,7 @@ function set_up(){
|
|||||||
$this->TotalScore+=$Score;
|
$this->TotalScore+=$Score;
|
||||||
$ArtistIDs[]=$ArtistID;
|
$ArtistIDs[]=$ArtistID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get similarities between artists on the map
|
// Get similarities between artists on the map
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
s1.ArtistID,
|
s1.ArtistID,
|
||||||
@ -71,17 +88,17 @@ function set_up(){
|
|||||||
WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).")
|
WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).")
|
||||||
AND s2.ArtistID IN(".implode(',',$ArtistIDs).")
|
AND s2.ArtistID IN(".implode(',',$ArtistIDs).")
|
||||||
");
|
");
|
||||||
|
|
||||||
// Build into array
|
// Build into array
|
||||||
while(list($Artist1ID, $Artist2ID) = $DB->next_record()){
|
while(list($Artist1ID, $Artist2ID) = $DB->next_record()){
|
||||||
$this->Artists[$Artist1ID]->Similar[$Artist2ID] = array('ID'=>$Artist2ID);
|
$this->Artists[$Artist1ID]->Similar[$Artist2ID] = array('ID'=>$Artist2ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate decimal point scores between artists
|
// Calculate decimal point scores between artists
|
||||||
foreach($this->Similar as $SimilarArtist) {
|
foreach($this->Similar as $SimilarArtist) {
|
||||||
list($ArtistID, $Similar) = array_values($SimilarArtist);
|
list($ArtistID, $Similar) = array_values($SimilarArtist);
|
||||||
$this->Similar[$ArtistID]['Decimal'] = $this->similarity($Similar['Score'], $this->TotalScore);
|
$this->Similar[$ArtistID]['Decimal'] = $this->similarity($Similar['Score'], $this->TotalScore);
|
||||||
|
|
||||||
if($this->Similar[$ArtistID]['Decimal'] < $this->LowestDecimal){
|
if($this->Similar[$ArtistID]['Decimal'] < $this->LowestDecimal){
|
||||||
$this->LowestDecimal = $this->Similar[$ArtistID]['Decimal'];
|
$this->LowestDecimal = $this->Similar[$ArtistID]['Decimal'];
|
||||||
}
|
}
|
||||||
@ -91,28 +108,28 @@ function set_up(){
|
|||||||
}
|
}
|
||||||
reset($this->Artists);
|
reset($this->Artists);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_positions(){
|
function set_positions(){
|
||||||
$xValues = array(); // Possible x values
|
$xValues = array(); // Possible x values
|
||||||
$Root = ceil(WIDTH/4); // Half-way into half of the image
|
$Root = ceil(WIDTH/4); // Half-way into half of the image
|
||||||
$Offset = 4; // Distance from the root (a quarter of the way into the image) to the x value
|
$Offset = 4; // Distance from the root (a quarter of the way into the image) to the x value
|
||||||
|
|
||||||
// The number of artists placed in the top or the bottom
|
// The number of artists placed in the top or the bottom
|
||||||
$NumTop = 0;
|
$NumTop = 0;
|
||||||
$NumBottom = 0;
|
$NumBottom = 0;
|
||||||
|
|
||||||
// The number of artists placed in the left or the right
|
// The number of artists placed in the left or the right
|
||||||
$NumLeft = 0;
|
$NumLeft = 0;
|
||||||
$NumRight = 0;
|
$NumRight = 0;
|
||||||
|
|
||||||
$Multiplier = 0;
|
$Multiplier = 0;
|
||||||
|
|
||||||
// Build up an impressive list of possible x values
|
// Build up an impressive list of possible x values
|
||||||
// We later iterate through these, and pick out the ones we want
|
// We later iterate through these, and pick out the ones we want
|
||||||
|
|
||||||
// These x values are all below WIDTH/2 (all on the left)
|
// These x values are all below WIDTH/2 (all on the left)
|
||||||
// The script later chooses which side to put them on
|
// The script later chooses which side to put them on
|
||||||
|
|
||||||
// We create more very low x values because they're more likely to be skipped
|
// We create more very low x values because they're more likely to be skipped
|
||||||
for($i = 0; $i<=count($this->Artists)*4; $i++){
|
for($i = 0; $i<=count($this->Artists)*4; $i++){
|
||||||
if($Offset>=((WIDTH/4))){
|
if($Offset>=((WIDTH/4))){
|
||||||
@ -120,20 +137,20 @@ function set_positions(){
|
|||||||
}
|
}
|
||||||
$Plus = $Root+$Offset; // Point on the right of the root
|
$Plus = $Root+$Offset; // Point on the right of the root
|
||||||
$Minus = abs($Root-$Offset); // Point on the left of the root
|
$Minus = abs($Root-$Offset); // Point on the left of the root
|
||||||
|
|
||||||
$xValues[$Plus]=$Plus;
|
$xValues[$Plus]=$Plus;
|
||||||
|
|
||||||
$xValues[$Minus]=$Minus;
|
$xValues[$Minus]=$Minus;
|
||||||
|
|
||||||
// Throw in an extra x value closer to the edge, because they're more likely to be skipped
|
// Throw in an extra x value closer to the edge, because they're more likely to be skipped
|
||||||
|
|
||||||
if($Minus>30){
|
if($Minus>30){
|
||||||
// $xValues[$Minus-30]=$Minus-30;
|
// $xValues[$Minus-30]=$Minus-30;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Offset = $Offset+rand(5,20); // Increase offset, and go again
|
$Offset = $Offset+rand(5,20); // Increase offset, and go again
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->Artists as $Artist){
|
foreach($this->Artists as $Artist){
|
||||||
$ArtistID = $Artist->ID;
|
$ArtistID = $Artist->ID;
|
||||||
if($Artist->Displayed == true){
|
if($Artist->Displayed == true){
|
||||||
@ -142,14 +159,14 @@ function set_positions(){
|
|||||||
$this->Similar[$ArtistID]['Decimal'] = $this->Similar[$ArtistID]['Decimal'] * (1/($this->LargestDecimal))-0.1;
|
$this->Similar[$ArtistID]['Decimal'] = $this->Similar[$ArtistID]['Decimal'] * (1/($this->LargestDecimal))-0.1;
|
||||||
// Calculate the distance away from the center, based on similarity
|
// Calculate the distance away from the center, based on similarity
|
||||||
$IdealDistance = $this->calculate_distance($this->Similar[$ArtistID]['Decimal'], $this->x, $this->y);
|
$IdealDistance = $this->calculate_distance($this->Similar[$ArtistID]['Decimal'], $this->x, $this->y);
|
||||||
|
|
||||||
$this->Similar[$ArtistID]['Distance'] = $IdealDistance;
|
$this->Similar[$ArtistID]['Distance'] = $IdealDistance;
|
||||||
|
|
||||||
// 1 = left, 2 = right
|
// 1 = left, 2 = right
|
||||||
$Horizontal = 0;
|
$Horizontal = 0;
|
||||||
$Vertical = 0;
|
$Vertical = 0;
|
||||||
|
|
||||||
// See if any similar artists have been placed yet. If so, place artist in that half
|
// See if any similar artists have been placed yet. If so, place artist in that half
|
||||||
// (provided that there are enough in the other half to visually balance out)
|
// (provided that there are enough in the other half to visually balance out)
|
||||||
reset($Artist->Similar);
|
reset($Artist->Similar);
|
||||||
foreach($Artist->Similar as $SimilarArtist) {
|
foreach($Artist->Similar as $SimilarArtist) {
|
||||||
@ -163,17 +180,17 @@ function set_positions(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shuffle($xValues);
|
shuffle($xValues);
|
||||||
|
|
||||||
while($xValue = array_shift($xValues)){
|
while($xValue = array_shift($xValues)){
|
||||||
if(abs($this->x - $xValue) <= $IdealDistance) {
|
if(abs($this->x - $xValue) <= $IdealDistance) {
|
||||||
if(hypot(abs($this->x - $xValue), ($this->y - 50)) > $IdealDistance
|
if(hypot(abs($this->x - $xValue), ($this->y - 50)) > $IdealDistance
|
||||||
|| ceil(sqrt(pow($IdealDistance, 2) - pow($this->x - $xValue, 2))) > (HEIGHT/2)){
|
|| ceil(sqrt(pow($IdealDistance, 2) - pow($this->x - $xValue, 2))) > (HEIGHT/2)){
|
||||||
$xValue = $this->x - ceil(sqrt(pow($IdealDistance, 2) - pow($IdealDistance*0.1*rand(5,9), 2)));
|
$xValue = $this->x - ceil(sqrt(pow($IdealDistance, 2) - pow($IdealDistance*0.1*rand(5,9), 2)));
|
||||||
//echo "Had to change x value for ".$Artist->Name." to ".$xValue."\n";
|
//echo "Had to change x value for ".$Artist->Name." to ".$xValue."\n";
|
||||||
}
|
}
|
||||||
// Found a match (Is close enough to the center to satisfy $IdealDistance),
|
// Found a match (Is close enough to the center to satisfy $IdealDistance),
|
||||||
// Now it's time to choose which half to put it on
|
// Now it's time to choose which half to put it on
|
||||||
if(!$Horizontal) {
|
if(!$Horizontal) {
|
||||||
// No similar artists displayed
|
// No similar artists displayed
|
||||||
@ -185,11 +202,11 @@ function set_positions(){
|
|||||||
} else {
|
} else {
|
||||||
$NumLeft++;
|
$NumLeft++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Artist->x = $xValue;
|
$Artist->x = $xValue;
|
||||||
$this->xValues[$xValue] = $ArtistID;
|
$this->xValues[$xValue] = $ArtistID;
|
||||||
unset($xValues[$xValue]);
|
unset($xValues[$xValue]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,14 +217,14 @@ function set_positions(){
|
|||||||
$this->xValues[$xValue] = $ArtistID;
|
$this->xValues[$xValue] = $ArtistID;
|
||||||
unset($xValues[$xValue]);
|
unset($xValues[$xValue]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pythagoras. $yValue is the vertical distance from the center to the y value
|
// Pythagoras. $yValue is the vertical distance from the center to the y value
|
||||||
$yValue = sqrt(pow($IdealDistance, 2) - pow(abs($this->x - $Artist->x), 2));
|
$yValue = sqrt(pow($IdealDistance, 2) - pow(abs($this->x - $Artist->x), 2));
|
||||||
|
|
||||||
|
|
||||||
// Now we pick if it should go on the top or bottom
|
// Now we pick if it should go on the top or bottom
|
||||||
|
|
||||||
if($NumTop>$NumBottom){ // Send it to the bottom half
|
if($NumTop>$NumBottom){ // Send it to the bottom half
|
||||||
$yValue=(HEIGHT/2)+$yValue;
|
$yValue=(HEIGHT/2)+$yValue;
|
||||||
$NumBottom++;
|
$NumBottom++;
|
||||||
@ -215,20 +232,20 @@ function set_positions(){
|
|||||||
$yValue=(HEIGHT/2)-$yValue;
|
$yValue=(HEIGHT/2)-$yValue;
|
||||||
$NumTop++;
|
$NumTop++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$yValue = ceil($yValue);
|
$yValue = ceil($yValue);
|
||||||
|
|
||||||
// $yValue is now a proper y coordinate
|
// $yValue is now a proper y coordinate
|
||||||
// Now time to do some spacing out
|
// Now time to do some spacing out
|
||||||
|
|
||||||
if($yValue < 10){
|
if($yValue < 10){
|
||||||
$yValue+=(10+abs($yValue))+rand(10,20);
|
$yValue+=(10+abs($yValue))+rand(10,20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($yValue > (HEIGHT - 10)){
|
if($yValue > (HEIGHT - 10)){
|
||||||
$yValue-=((HEIGHT/2)-rand(10,20));
|
$yValue-=((HEIGHT/2)-rand(10,20));
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
while($Conflict = $this->scan_array_range($this->yValues, abs($yValue-13), $yValue+13)) {
|
while($Conflict = $this->scan_array_range($this->yValues, abs($yValue-13), $yValue+13)) {
|
||||||
if($i > 10){
|
if($i > 10){
|
||||||
@ -237,7 +254,7 @@ function set_positions(){
|
|||||||
if(!$this->scan_array_range($this->yValues, abs($yValue-5), $yValue-20)){
|
if(!$this->scan_array_range($this->yValues, abs($yValue-5), $yValue-20)){
|
||||||
$yValue -= 20;
|
$yValue -= 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
$yValue=$Conflict + rand(10, 20);
|
$yValue=$Conflict + rand(10, 20);
|
||||||
if($yValue>HEIGHT-10){
|
if($yValue>HEIGHT-10){
|
||||||
$yValue-=ceil(HEIGHT/2.5);
|
$yValue-=ceil(HEIGHT/2.5);
|
||||||
@ -246,16 +263,16 @@ function set_positions(){
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Artist->y = $yValue;
|
$Artist->y = $yValue;
|
||||||
$this->yValues[$yValue] = $ArtistID;
|
$this->yValues[$yValue] = $ArtistID;
|
||||||
}
|
}
|
||||||
reset($this->Artists);
|
reset($this->Artists);
|
||||||
reset($this->xValues);
|
reset($this->xValues);
|
||||||
reset($this->yValues);
|
reset($this->yValues);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the ideal distance from the center point ($Rootx, $Rooty) to the artist's point on the board
|
// Calculate the ideal distance from the center point ($Rootx, $Rooty) to the artist's point on the board
|
||||||
// Pythagoras as fun!
|
// Pythagoras as fun!
|
||||||
function calculate_distance($SimilarityCoefficient, $Rootx, $Rooty){
|
function calculate_distance($SimilarityCoefficient, $Rootx, $Rooty){
|
||||||
@ -265,13 +282,13 @@ function calculate_distance($SimilarityCoefficient, $Rootx, $Rooty){
|
|||||||
$y = $MaxHeight - ($SimilarityCoefficient*$MaxHeight); // Possible y value
|
$y = $MaxHeight - ($SimilarityCoefficient*$MaxHeight); // Possible y value
|
||||||
$Hypot = hypot($Rootx - $x, $Rooty - $y);
|
$Hypot = hypot($Rootx - $x, $Rooty - $y);
|
||||||
return $MaxWidth - $Hypot;
|
return $MaxWidth - $Hypot;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function similarity($Score, $TotalArtistScore){
|
function similarity($Score, $TotalArtistScore){
|
||||||
return (pow(($Score/($TotalArtistScore+1)), (1/1)));
|
return (pow(($Score/($TotalArtistScore+1)), (1/1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function scan_array_range($Array, $Start, $Finish){
|
function scan_array_range($Array, $Start, $Finish){
|
||||||
if($Start<0){
|
if($Start<0){
|
||||||
die($Start);
|
die($Start);
|
||||||
@ -283,15 +300,15 @@ function scan_array_range($Array, $Start, $Finish){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function write_artists(){
|
function write_artists(){
|
||||||
?>
|
?>
|
||||||
<div style="position:absolute;bottom:<?=$this->y-10?>px;left:<?=$this->x - $this->NameLength*4?>px;font-size:13pt;white-space:nowrap;" class="similar_artist_header">
|
<div style="position:absolute;bottom:<?=$this->y-10?>px;left:<?=$this->x - $this->NameLength*4?>px;font-size:13pt;white-space:nowrap;" class="similar_artist_header">
|
||||||
<?=$this->Name?>
|
<?=$this->Name?>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
|
|
||||||
foreach($this->Artists as $Artist){
|
foreach($this->Artists as $Artist){
|
||||||
if($Artist->ID == $this->ID){
|
if($Artist->ID == $this->ID){
|
||||||
continue;
|
continue;
|
||||||
@ -303,7 +320,7 @@ function write_artists(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
$Decimal = $this->Similar[$Artist->ID]['Decimal'];
|
$Decimal = $this->Similar[$Artist->ID]['Decimal'];
|
||||||
|
|
||||||
if($Decimal<0.2){
|
if($Decimal<0.2){
|
||||||
$FontSize = 8;
|
$FontSize = 8;
|
||||||
} elseif($Decimal<0.3){
|
} elseif($Decimal<0.3){
|
||||||
@ -321,7 +338,7 @@ function write_artists(){
|
|||||||
}
|
}
|
||||||
reset($this->Artists);
|
reset($this->Artists);
|
||||||
}
|
}
|
||||||
|
|
||||||
function background_image(){
|
function background_image(){
|
||||||
global $Img;
|
global $Img;
|
||||||
reset($this->Similar);
|
reset($this->Similar);
|
||||||
@ -330,9 +347,9 @@ function background_image(){
|
|||||||
$Artist = $this->Artists[$ArtistID];
|
$Artist = $this->Artists[$ArtistID];
|
||||||
$Decimal = $this->Similar[$ArtistID]['Decimal'];
|
$Decimal = $this->Similar[$ArtistID]['Decimal'];
|
||||||
$Width = ceil($Decimal*4)+1;
|
$Width = ceil($Decimal*4)+1;
|
||||||
|
|
||||||
$Img->line($this->x, $this->y, $Artist->x, $Artist->y,$Img->color(199,218,255), $Width);
|
$Img->line($this->x, $this->y, $Artist->x, $Artist->y,$Img->color(199,218,255), $Width);
|
||||||
|
|
||||||
unset($Artist->Similar[$this->ID]);
|
unset($Artist->Similar[$this->ID]);
|
||||||
reset($Artist->Similar);
|
reset($Artist->Similar);
|
||||||
foreach($Artist->Similar as $SimilarArtist2) {
|
foreach($Artist->Similar as $SimilarArtist2) {
|
||||||
@ -345,10 +362,10 @@ function background_image(){
|
|||||||
}
|
}
|
||||||
reset($this->xValues);
|
reset($this->xValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Img->make_png(SERVER_ROOT.'/static/similar/'.$this->ID.'.png');
|
$Img->make_png(SERVER_ROOT.'/static/similar/'.$this->ID.'.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
function dump(){
|
function dump(){
|
||||||
echo "Similarities:\n";
|
echo "Similarities:\n";
|
||||||
foreach($this->Artists as $Artist){
|
foreach($this->Artists as $Artist){
|
||||||
@ -362,10 +379,10 @@ function dump(){
|
|||||||
//print_r($Artist->Similar);
|
//print_r($Artist->Similar);
|
||||||
echo "\n\n---\n\n";
|
echo "\n\n---\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class CACHE extends Memcache {
|
|||||||
'top10tor_*',
|
'top10tor_*',
|
||||||
'query_lock_*'
|
'query_lock_*'
|
||||||
);
|
);
|
||||||
|
|
||||||
public $CanClear = false;
|
public $CanClear = false;
|
||||||
public $InternalCache = true;
|
public $InternalCache = true;
|
||||||
|
|
||||||
@ -72,6 +72,14 @@ public function cache_value($Key, $Value, $Duration=2592000) {
|
|||||||
$this->Time+=(microtime(true)-$StartTime)*1000;
|
$this->Time+=(microtime(true)-$StartTime)*1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper for Memcache::add, with the zlib option removed and default duration of 30 days
|
||||||
|
public function add_value($Key, $Value, $Duration=2592000) {
|
||||||
|
$StartTime=microtime(true);
|
||||||
|
$Added=$this->add($Key, $Value, 0, $Duration);
|
||||||
|
$this->Time+=(microtime(true)-$StartTime)*1000;
|
||||||
|
return $Added;
|
||||||
|
}
|
||||||
|
|
||||||
public function replace_value($Key, $Value, $Duration=2592000) {
|
public function replace_value($Key, $Value, $Duration=2592000) {
|
||||||
$StartTime=microtime(true);
|
$StartTime=microtime(true);
|
||||||
$this->replace($Key, $Value, false, $Duration);
|
$this->replace($Key, $Value, false, $Duration);
|
||||||
@ -87,13 +95,13 @@ public function get_value($Key, $NoCache=false) {
|
|||||||
trigger_error("Cache retrieval failed for empty key");
|
trigger_error("Cache retrieval failed for empty key");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['clearcache']) && $this->CanClear && !in_array_partial($Key, $this->PersistentKeys)) {
|
if (isset($_GET['clearcache']) && $this->CanClear && !Misc::in_array_partial($Key, $this->PersistentKeys)) {
|
||||||
if ($_GET['clearcache'] == 1) {
|
if ($_GET['clearcache'] == 1) {
|
||||||
//Because check_perms isn't true until loggeduser is pulled from the cache, we have to remove the entries loaded before the loggeduser data
|
//Because check_perms isn't true until loggeduser is pulled from the cache, we have to remove the entries loaded before the loggeduser data
|
||||||
//Because of this, not user cache data will require a secondary pageload following the clearcache to update
|
//Because of this, not user cache data will require a secondary pageload following the clearcache to update
|
||||||
if (count($this->CacheHits) > 0) {
|
if (count($this->CacheHits) > 0) {
|
||||||
foreach (array_keys($this->CacheHits) as $HitKey) {
|
foreach (array_keys($this->CacheHits) as $HitKey) {
|
||||||
if (!in_array_partial($HitKey, $this->PersistentKeys)) {
|
if (!Misc::in_array_partial($HitKey, $this->PersistentKeys)) {
|
||||||
$this->delete($HitKey);
|
$this->delete($HitKey);
|
||||||
unset($this->CacheHits[$HitKey]);
|
unset($this->CacheHits[$HitKey]);
|
||||||
}
|
}
|
||||||
@ -308,23 +316,22 @@ public function update($Key, $Rows, $Values, $Time=2592000) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Built-in increment/decrement functions are said not to be thread safe
|
/**
|
||||||
/* Supposedly fixed in v1.4.6
|
* Tries to set a lock. Expiry time is one hour to avoid indefinite locks
|
||||||
public function increment($Key, $Value=1) {
|
*
|
||||||
if(($OldValue = $this->get($Key)) === false || !is_number($Value)) {
|
* @param string $LockName name on the lock
|
||||||
return false;
|
* @return true if lock was acquired
|
||||||
}
|
*/
|
||||||
$this->replace_value($Key, $OldValue+$Value);
|
public function get_query_lock($LockName) {
|
||||||
|
return $this->add_value('query_lock_'.$LockName, 1, 3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decrement($Key, $Value=1) {
|
/**
|
||||||
if(($OldValue = $this->get($Key)) === false || !is_number($Value) || !is_number($OldValue)) {
|
* Remove lock
|
||||||
return false;
|
*
|
||||||
}
|
* @param string $LockName name on the lock
|
||||||
if($Value > $OldValue) {
|
*/
|
||||||
$OldValue = $Value = 0;
|
public function clear_query_lock($LockName) {
|
||||||
}
|
$this->delete_value('query_lock_'.$LockName);
|
||||||
$this->replace_value($Key, $OldValue-$Value);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ public function __construct () {
|
|||||||
|
|
||||||
public function add($Label, $Data) {
|
public function add($Label, $Data) {
|
||||||
if ($Label !== false) {
|
if ($Label !== false) {
|
||||||
$this->Labels[] = cut_string($Label,35);
|
$this->Labels[] = Format::cut_string($Label,35);
|
||||||
}
|
}
|
||||||
$this->Data[] = $Data;
|
$this->Data[] = $Data;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public function profile($Automatic='') {
|
|||||||
*/
|
*/
|
||||||
$Ram = memory_get_usage(true);
|
$Ram = memory_get_usage(true);
|
||||||
if ($Ram > MAX_MEMORY && !defined('MEMORY_EXCEPTION')) {
|
if ($Ram > MAX_MEMORY && !defined('MEMORY_EXCEPTION')) {
|
||||||
$Reason[] = get_size($Ram).' Ram Used';
|
$Reason[] = Format::get_size($Ram).' Ram Used';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['profile'])) {
|
if (isset($_REQUEST['profile'])) {
|
||||||
@ -57,7 +57,7 @@ public function analysis($Message, $Report='', $Time=43200) {
|
|||||||
if (empty($Report)) {
|
if (empty($Report)) {
|
||||||
$Report = $Message;
|
$Report = $Message;
|
||||||
}
|
}
|
||||||
$Identifier = make_secret(5);
|
$Identifier = Users::make_secret(5);
|
||||||
$Cache->cache_value(
|
$Cache->cache_value(
|
||||||
'analysis_'.$Identifier,
|
'analysis_'.$Identifier,
|
||||||
array(
|
array(
|
||||||
@ -245,14 +245,14 @@ public function get_sphinx_time() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function get_sphinxql_queries() {
|
public function get_sphinxql_queries() {
|
||||||
if(class_exists(SPHINXQL)) {
|
if(class_exists(SphinxQL)) {
|
||||||
return SPHINXQL::$Queries;
|
return SphinxQL::$Queries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_sphinxql_time() {
|
public function get_sphinxql_time() {
|
||||||
if(class_exists(SPHINXQL)) {
|
if(class_exists(SphinxQL)) {
|
||||||
return SPHINXQL::$Time;
|
return SphinxQL::$Time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ public function flag_table($Flags=false) {
|
|||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<td align="left"><?=$Event?></td>
|
<td align="left"><?=$Event?></td>
|
||||||
<td align="left"><?=$MicroTime?> ms</td>
|
<td align="left"><?=$MicroTime?> ms</td>
|
||||||
<td align="left"><?=get_size($Memory)?></td>
|
<td align="left"><?=Format::get_size($Memory)?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
396
classes/class_format.php
Normal file
396
classes/class_format.php
Normal file
@ -0,0 +1,396 @@
|
|||||||
|
<?
|
||||||
|
class Format {
|
||||||
|
/**
|
||||||
|
* Shorten a string
|
||||||
|
*
|
||||||
|
* @param $Str string to cut
|
||||||
|
* @param $Length cut at length
|
||||||
|
* @param $Hard force cut at length instead of at closest word
|
||||||
|
* @param $ShowDots Show dots at the end
|
||||||
|
* @return string formatted string
|
||||||
|
*/
|
||||||
|
public static function cut_string($Str, $Length, $Hard = false, $ShowDots = true) {
|
||||||
|
if (mb_strlen($Str, 'UTF-8') > $Length) {
|
||||||
|
if ($Hard == 0) {
|
||||||
|
// Not hard, cut at closest word
|
||||||
|
$CutDesc = mb_substr($Str, 0, $Length, 'UTF-8');
|
||||||
|
$DescArr = explode(' ', $CutDesc);
|
||||||
|
if (count($DescArr) > 1) {
|
||||||
|
array_pop($DescArr);
|
||||||
|
$CutDesc = implode(' ', $DescArr);
|
||||||
|
}
|
||||||
|
if ($ShowDots) { $CutDesc .= '...'; }
|
||||||
|
} else {
|
||||||
|
$CutDesc = mb_substr($Str, 0, $Length, 'UTF-8');
|
||||||
|
if ($ShowDots) { $CutDesc .= '...'; }
|
||||||
|
}
|
||||||
|
return $CutDesc;
|
||||||
|
} else {
|
||||||
|
return $Str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the CSS class corresponding to a ratio
|
||||||
|
*
|
||||||
|
* @param $Ratio ratio to get the css class for
|
||||||
|
* @return string the CSS class corresponding to the ratio range
|
||||||
|
*/
|
||||||
|
public static function get_ratio_color($Ratio) {
|
||||||
|
if ($Ratio < 0.1) { return 'r00'; }
|
||||||
|
if ($Ratio < 0.2) { return 'r01'; }
|
||||||
|
if ($Ratio < 0.3) { return 'r02'; }
|
||||||
|
if ($Ratio < 0.4) { return 'r03'; }
|
||||||
|
if ($Ratio < 0.5) { return 'r04'; }
|
||||||
|
if ($Ratio < 0.6) { return 'r05'; }
|
||||||
|
if ($Ratio < 0.7) { return 'r06'; }
|
||||||
|
if ($Ratio < 0.8) { return 'r07'; }
|
||||||
|
if ($Ratio < 0.9) { return 'r08'; }
|
||||||
|
if ($Ratio < 1) { return 'r09'; }
|
||||||
|
if ($Ratio < 2) { return 'r10'; }
|
||||||
|
if ($Ratio < 5) { return 'r20'; }
|
||||||
|
return 'r50';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates and formats a ratio.
|
||||||
|
*
|
||||||
|
* @param int $Dividend AKA numerator
|
||||||
|
* @param int $Divisor
|
||||||
|
* @param boolean $Color if true, ratio will be coloured.
|
||||||
|
* @return formatted ratio HTML
|
||||||
|
*/
|
||||||
|
public static function get_ratio_html($Dividend, $Divisor, $Color = true) {
|
||||||
|
if ($Divisor == 0 && $Dividend == 0) {
|
||||||
|
return '--';
|
||||||
|
} elseif ($Divisor == 0) {
|
||||||
|
return '<span class="r99">∞</span>';
|
||||||
|
}
|
||||||
|
$Ratio = number_format(max($Dividend/$Divisor-0.005,0), 2); //Subtract .005 to floor to 2 decimals
|
||||||
|
if ($Color) {
|
||||||
|
$Class = Format::get_ratio_color($Ratio);
|
||||||
|
if ($Class) {
|
||||||
|
$Ratio = '<span class="'.$Class.'">'.$Ratio.'</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the query string of the current page, minus the parameters in $Exclude
|
||||||
|
*
|
||||||
|
* @param array $Exclude Query string parameters to leave out, or blank to include all parameters.
|
||||||
|
* @return An HTML sanatized query string
|
||||||
|
*/
|
||||||
|
public static function get_url($Exclude = false) {
|
||||||
|
if ($Exclude !== false) {
|
||||||
|
$QueryItems = array();
|
||||||
|
parse_str($_SERVER['QUERY_STRING'], $QueryItems);
|
||||||
|
|
||||||
|
foreach ($QueryItems AS $Key => $Val) {
|
||||||
|
if (!in_array(strtolower($Key),$Exclude)) {
|
||||||
|
$Query[$Key] = $Val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($Query)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return display_str(http_build_query($Query));
|
||||||
|
} else {
|
||||||
|
return display_str($_SERVER['QUERY_STRING']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds what page we're on and gives it to us, as well as the LIMIT clause for SQL
|
||||||
|
* Takes in $_GET['page'] as an additional input
|
||||||
|
*
|
||||||
|
* @param $PerPage Results to show per page
|
||||||
|
* @param $DefaultResult Optional, which result's page we want if no page is specified
|
||||||
|
* If this parameter is not specified, we will default to page 1
|
||||||
|
*
|
||||||
|
* @return array(int,string) What page we are on, and what to use in the LIMIT section of a query
|
||||||
|
* i.e. "SELECT [...] LIMIT $Limit;"
|
||||||
|
*/
|
||||||
|
public static function page_limit($PerPage, $DefaultResult = 1) {
|
||||||
|
if (!isset($_GET['page'])) {
|
||||||
|
$Page = ceil($DefaultResult/$PerPage);
|
||||||
|
if ($Page == 0) $Page = 1;
|
||||||
|
$Limit=$PerPage;
|
||||||
|
} else {
|
||||||
|
if (!is_number($_GET['page'])) {
|
||||||
|
error(0);
|
||||||
|
}
|
||||||
|
$Page = $_GET['page'];
|
||||||
|
if ($Page <= 0) { $Page = 1; }
|
||||||
|
$Limit=$PerPage*$Page-$PerPage . ', ' . $PerPage;
|
||||||
|
}
|
||||||
|
return array($Page,$Limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A9 magic. Some other poor soul can write the phpdoc.
|
||||||
|
// For data stored in memcached catalogues (giant arrays), eg. forum threads
|
||||||
|
public static function catalogue_limit($Page, $PerPage, $CatalogueSize=500) {
|
||||||
|
$CatalogueID = floor(($PerPage*$Page-$PerPage)/$CatalogueSize);;
|
||||||
|
$CatalogueLimit = ($CatalogueID*$CatalogueSize).', '.$CatalogueSize;
|
||||||
|
return array($CatalogueID, $CatalogueLimit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function catalogue_select($Catalogue, $Page, $PerPage, $CatalogueSize=500) {
|
||||||
|
return array_slice($Catalogue,(($PerPage*$Page-$PerPage)%$CatalogueSize),$PerPage,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Get pages
|
||||||
|
* Returns a page list, given certain information about the pages.
|
||||||
|
*
|
||||||
|
* @param int $StartPage: The current record the page you're on starts with.
|
||||||
|
* eg. if you're on page 2 of a forum thread with 25 posts per page, $StartPage is 25.
|
||||||
|
* If you're on page 1, $StartPage is 0.
|
||||||
|
* @param int $TotalRecords: The total number of records in the result set.
|
||||||
|
* eg. if you're on a forum thread with 152 posts, $TotalRecords is 152.
|
||||||
|
* @param int $ItemsPerPage: Self-explanatory. The number of records shown on each page
|
||||||
|
* eg. if there are 25 posts per forum page, $ItemsPerPage is 25.
|
||||||
|
* @param int $ShowPages: The number of page links that are shown.
|
||||||
|
* eg. If there are 20 pages that exist, but $ShowPages is only 11, only 11 links will be shown.
|
||||||
|
* @param string $Anchor A URL fragment to attach to the links.
|
||||||
|
* eg. '#comment12'
|
||||||
|
* @return A sanitized HTML page listing.
|
||||||
|
*/
|
||||||
|
public static function get_pages($StartPage,$TotalRecords,$ItemsPerPage,$ShowPages=11,$Anchor='') {
|
||||||
|
global $Document, $Method, $Mobile;
|
||||||
|
$Location = $Document.'.php';
|
||||||
|
$StartPage = ceil($StartPage);
|
||||||
|
$TotalPages = 0;
|
||||||
|
if ($TotalRecords > 0) {
|
||||||
|
$StartPage = min($StartPage, ceil($TotalRecords/$ItemsPerPage));
|
||||||
|
|
||||||
|
$ShowPages--;
|
||||||
|
$TotalPages = ceil($TotalRecords/$ItemsPerPage);
|
||||||
|
|
||||||
|
if ($TotalPages > $ShowPages) {
|
||||||
|
$StartPosition = $StartPage-round($ShowPages/2);
|
||||||
|
|
||||||
|
if ($StartPosition <= 0) {
|
||||||
|
$StartPosition = 1;
|
||||||
|
} else {
|
||||||
|
if ($StartPosition >= ($TotalPages-$ShowPages)) {
|
||||||
|
$StartPosition = $TotalPages-$ShowPages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$StopPage = $ShowPages+$StartPosition;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$StopPage = $TotalPages;
|
||||||
|
$StartPosition = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$StartPosition = max($StartPosition, 1);
|
||||||
|
|
||||||
|
$QueryString = Format::get_url(array('page','post'));
|
||||||
|
if ($QueryString != '') {
|
||||||
|
$QueryString = '&'.$QueryString;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Pages = '';
|
||||||
|
|
||||||
|
if ($StartPage > 1) {
|
||||||
|
$Pages .= '<a href="'.$Location.'?page=1'.$QueryString.$Anchor.'"><strong><< First</strong></a> ';
|
||||||
|
$Pages .= '<a href="'.$Location.'?page='.($StartPage-1).$QueryString.$Anchor.'" class="pager_prev"><strong>< Prev</strong></a> | ';
|
||||||
|
}
|
||||||
|
//End change
|
||||||
|
|
||||||
|
if (!$Mobile) {
|
||||||
|
for ($i = $StartPosition; $i <= $StopPage; $i++) {
|
||||||
|
if ($i != $StartPage) {
|
||||||
|
$Pages .= '<a href="'.$Location.'?page='.$i.$QueryString.$Anchor.'">';
|
||||||
|
}
|
||||||
|
$Pages .= "<strong>";
|
||||||
|
if ($i*$ItemsPerPage > $TotalRecords) {
|
||||||
|
$Pages .= ((($i-1)*$ItemsPerPage)+1).'-'.($TotalRecords);
|
||||||
|
} else {
|
||||||
|
$Pages .= ((($i-1)*$ItemsPerPage)+1).'-'.($i*$ItemsPerPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Pages .= "</strong>";
|
||||||
|
if ($i != $StartPage) {
|
||||||
|
$Pages.='</a>';
|
||||||
|
}
|
||||||
|
if ($i < $StopPage) {
|
||||||
|
$Pages.=" | ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$Pages .= $StartPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($StartPage && $StartPage < $TotalPages) {
|
||||||
|
$Pages .= ' | <a href="'.$Location.'?page='.($StartPage+1).$QueryString.$Anchor.'" class="pager_next"><strong>Next ></strong></a> ';
|
||||||
|
$Pages .= '<a href="'.$Location.'?page='.$TotalPages.$QueryString.$Anchor.'"><strong> Last >></strong></a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($TotalPages > 1) {
|
||||||
|
return $Pages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a size in bytes as a human readable string in KiB/MiB/...
|
||||||
|
*
|
||||||
|
* @param int $Size
|
||||||
|
* @param int $Levels Number of decimal places. Defaults to 2, unless the size >= 1TB, in which case it defaults to 4.
|
||||||
|
* @return string formatted number.
|
||||||
|
*/
|
||||||
|
public static function get_size($Size, $Levels = 2) {
|
||||||
|
$Units = array(' B',' KB',' MB',' GB',' TB',' PB',' EB',' ZB',' YB');
|
||||||
|
$Size = (double) $Size;
|
||||||
|
for($Steps = 0; abs($Size) >= 1024; $Size /= 1024, $Steps++) {}
|
||||||
|
if (func_num_args() == 1 && $Steps >= 4) {
|
||||||
|
$Levels++;
|
||||||
|
}
|
||||||
|
return number_format($Size,$Levels) . $Units[$Steps];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a number as a multiple of its highest power of 1000 (eg. 10035 -> '10.04k')
|
||||||
|
*
|
||||||
|
* @param int $Number
|
||||||
|
* @return string formatted number.
|
||||||
|
*/
|
||||||
|
public static function human_format($Number) {
|
||||||
|
$Steps = 0;
|
||||||
|
while($Number>=1000) {
|
||||||
|
$Steps++;
|
||||||
|
$Number=$Number/1000;
|
||||||
|
}
|
||||||
|
switch ($Steps) {
|
||||||
|
case 0: return round($Number); break;
|
||||||
|
case 1: return round($Number,2).'k'; break;
|
||||||
|
case 2: return round($Number,2).'M'; break;
|
||||||
|
case 3: return round($Number,2).'G'; break;
|
||||||
|
case 4: return round($Number,2).'T'; break;
|
||||||
|
case 5: return round($Number,2).'P'; break;
|
||||||
|
default:
|
||||||
|
return round($Number,2).'E + '.$Steps*3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a formatted string of a size, get the number of bytes it represents.
|
||||||
|
*
|
||||||
|
* @param string $Size formatted size string, eg. 123.45k
|
||||||
|
* @return Number of bytes it represents, eg. (123.45 * 1024)
|
||||||
|
*/
|
||||||
|
public static function get_bytes($Size) {
|
||||||
|
list($Value,$Unit) = sscanf($Size, "%f%s");
|
||||||
|
$Unit = ltrim($Unit);
|
||||||
|
if (empty($Unit)) {
|
||||||
|
return $Value ? round($Value) : 0;
|
||||||
|
}
|
||||||
|
switch(strtolower($Unit[0])) {
|
||||||
|
case 'k': return round($Value * 1024);
|
||||||
|
case 'm': return round($Value * 1048576);
|
||||||
|
case 'g': return round($Value * 1073741824);
|
||||||
|
case 't': return round($Value * 1099511627776);
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the effects of display_str - un-sanitize HTML.
|
||||||
|
* Use sparingly.
|
||||||
|
*
|
||||||
|
* @param string $Str the string to unsanitize
|
||||||
|
* @return unsanitized string
|
||||||
|
*/
|
||||||
|
// Use sparingly
|
||||||
|
public static function undisplay_str($Str) {
|
||||||
|
return mb_convert_encoding($Str, 'UTF-8', 'HTML-ENTITIES');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Echo data sent in a GET form field, useful for text areas.
|
||||||
|
*
|
||||||
|
* @param string $Index the name of the form field
|
||||||
|
* @param boolean $Return if set to true, value is returned instead of echoed.
|
||||||
|
* @return Sanitized value of field index if $Return == true
|
||||||
|
*/
|
||||||
|
public static function form($Index, $Return = false) {
|
||||||
|
if (!empty($_GET[$Index])) {
|
||||||
|
if ($Return) {
|
||||||
|
return display_str($_GET[$Index]);
|
||||||
|
} else {
|
||||||
|
echo display_str($_GET[$Index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to echo out selected='selected' and checked='checked' so you don't have to.
|
||||||
|
*
|
||||||
|
* @param $Name the name of the option in the select (or field in $Array)
|
||||||
|
* @param $Value the value that the option must be for the option to be marked as selected or checked
|
||||||
|
* @param $Attribute The value returned/echoed is $Attribute="$Attribute"
|
||||||
|
* @param $Array The array the option is in, defaults to GET.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static function selected($Name, $Value, $Attribute='selected', $Array = array()) {
|
||||||
|
if (empty($Array)) {
|
||||||
|
$Array == $_GET;
|
||||||
|
}
|
||||||
|
if (isset($Array[$Name]) && $Array[$Name]!=='') {
|
||||||
|
if ($Array[$Name] == $Value) {
|
||||||
|
echo ' '.$Attribute.'="'.$Attribute.'"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect the encoding of a string and transform it to UTF-8.
|
||||||
|
*
|
||||||
|
* @param string $Str
|
||||||
|
* @return UTF-8 encoded version of $Str
|
||||||
|
*/
|
||||||
|
public static function make_utf8($Str) {
|
||||||
|
if ($Str!="") {
|
||||||
|
if (Format::is_utf8($Str)) { $Encoding="UTF-8"; }
|
||||||
|
if (empty($Encoding)) { $Encoding=mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); }
|
||||||
|
if (empty($Encoding)) { $Encoding="ISO-8859-1"; }
|
||||||
|
if ($Encoding=="UTF-8") { return $Str; }
|
||||||
|
else { return @mb_convert_encoding($Str,"UTF-8",$Encoding); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magical function.
|
||||||
|
*
|
||||||
|
* @param string $Str function to detect encoding on.
|
||||||
|
* @return true if the string is in UTF-8.
|
||||||
|
*/
|
||||||
|
public static function is_utf8($Str) {
|
||||||
|
return preg_match('%^(?:
|
||||||
|
[\x09\x0A\x0D\x20-\x7E] // ASCII
|
||||||
|
| [\xC2-\xDF][\x80-\xBF] // non-overlong 2-byte
|
||||||
|
| \xE0[\xA0-\xBF][\x80-\xBF] // excluding overlongs
|
||||||
|
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} // straight 3-byte
|
||||||
|
| \xED[\x80-\x9F][\x80-\xBF] // excluding surrogates
|
||||||
|
| \xF0[\x90-\xBF][\x80-\xBF]{2} // planes 1-3
|
||||||
|
| [\xF1-\xF3][\x80-\xBF]{3} // planes 4-15
|
||||||
|
| \xF4[\x80-\x8F][\x80-\xBF]{2} // plane 16
|
||||||
|
)*$%xs', $Str
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
@ -118,15 +118,15 @@ function make_tree(){
|
|||||||
echo "<li>";
|
echo "<li>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<strong><?=format_username($ID, true, true, $Enabled != 2 ? false : true, true)?></strong>
|
<strong><?=Users::format_username($ID, true, true, $Enabled != 2 ? false : true, true)?></strong>
|
||||||
<?
|
<?
|
||||||
if(check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
|
if(check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
|
||||||
$TotalUpload += $Uploaded;
|
$TotalUpload += $Uploaded;
|
||||||
$TotalDownload += $Downloaded;
|
$TotalDownload += $Downloaded;
|
||||||
?>
|
?>
|
||||||
Uploaded: <strong><?=get_size($Uploaded)?></strong>
|
Uploaded: <strong><?=Format::get_size($Uploaded)?></strong>
|
||||||
Downloaded: <strong><?=get_size($Downloaded)?></strong>
|
Downloaded: <strong><?=Format::get_size($Downloaded)?></strong>
|
||||||
Ratio: <strong><?=ratio($Uploaded, $Downloaded)?></strong>
|
Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
|
||||||
<?
|
<?
|
||||||
} else {
|
} else {
|
||||||
$ParanoidCount++;
|
$ParanoidCount++;
|
||||||
@ -152,7 +152,7 @@ function make_tree(){
|
|||||||
$ClassStrings = array();
|
$ClassStrings = array();
|
||||||
foreach ($ClassSummary as $ClassID => $ClassCount) {
|
foreach ($ClassSummary as $ClassID => $ClassCount) {
|
||||||
if($ClassCount == 0) { continue; }
|
if($ClassCount == 0) { continue; }
|
||||||
$LastClass = 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';
|
||||||
@ -186,15 +186,15 @@ function make_tree(){
|
|||||||
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 '.get_size($TotalUpload);
|
echo 'The total amount uploaded by the entire tree was '.Format::get_size($TotalUpload);
|
||||||
echo '; the total amount downloaded was '.get_size($TotalDownload);
|
echo '; the total amount downloaded was '.Format::get_size($TotalDownload);
|
||||||
echo '; and the total ratio is '.ratio($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 '.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 '.get_size($TopLevelDownload);
|
echo '; the total amount downloaded was '.Format::get_size($TopLevelDownload);
|
||||||
echo '; and the total ratio is '.ratio($TopLevelUpload, $TopLevelDownload).'. ';
|
echo '; and the total ratio is '.Format::get_ratio_html($TopLevelUpload, $TopLevelDownload).'. ';
|
||||||
|
|
||||||
|
|
||||||
echo 'These numbers include the stats of paranoid users, and will be factored in to the invitation giving script.</p>';
|
echo 'These numbers include the stats of paranoid users, and will be factored in to the invitation giving script.</p>';
|
||||||
|
@ -9,7 +9,7 @@ function halt($Msg) {
|
|||||||
abstract class IRC_BOT {
|
abstract class IRC_BOT {
|
||||||
abstract protected function connect_events();
|
abstract protected function connect_events();
|
||||||
abstract protected function channel_events();
|
abstract protected function channel_events();
|
||||||
abstract protected function query_events();
|
abstract protected function query_events();
|
||||||
abstract protected function listener_events();
|
abstract protected function listener_events();
|
||||||
|
|
||||||
protected $Debug = false;
|
protected $Debug = false;
|
||||||
@ -92,7 +92,7 @@ protected function get_message() {
|
|||||||
return trim($Msg[1]);
|
return trim($Msg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_host() {
|
protected function get_irc_host() {
|
||||||
preg_match('/:[^!:]+!.+@([^\s]+) PRIVMSG [^:]+ :.+/', $this->Data, $Host);
|
preg_match('/:[^!:]+!.+@([^\s]+) PRIVMSG [^:]+ :.+/', $this->Data, $Host);
|
||||||
return trim($Host[1]);
|
return trim($Host[1]);
|
||||||
}
|
}
|
||||||
@ -126,10 +126,10 @@ protected function whois($Nick) {
|
|||||||
$this->Whois = $Nick;
|
$this->Whois = $Nick;
|
||||||
$this->send_raw("WHOIS $Nick");
|
$this->send_raw("WHOIS $Nick");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function uses blacklisted_ip, which is no longer in RC2.
|
This function uses blacklisted_ip, which is no longer in RC2.
|
||||||
You can probably find it in old RC1 code kicking aronud if you need it.
|
You can probably find it in old RC1 code kicking aronud if you need it.
|
||||||
protected function ip_check($IP,$Gline=false,$Channel=BOT_REPORT_CHAN) {
|
protected function ip_check($IP,$Gline=false,$Channel=BOT_REPORT_CHAN) {
|
||||||
global $Cache, $DB;
|
global $Cache, $DB;
|
||||||
if(blacklisted_ip($IP)) {
|
if(blacklisted_ip($IP)) {
|
||||||
@ -209,7 +209,7 @@ protected function listen() {
|
|||||||
if($this->Listened = @socket_accept($this->ListenSocket)) {
|
if($this->Listened = @socket_accept($this->ListenSocket)) {
|
||||||
$this->listener_events();
|
$this->listener_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->LinkID = false;
|
$DB->LinkID = false;
|
||||||
$DB->Queries = array();
|
$DB->Queries = array();
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
|
395
classes/class_misc.php
Normal file
395
classes/class_misc.php
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
<?
|
||||||
|
class Misc {
|
||||||
|
/**
|
||||||
|
* Send an email.
|
||||||
|
*
|
||||||
|
* @param string $To the email address to send it to.
|
||||||
|
* @param string $Subject
|
||||||
|
* @param string $Body
|
||||||
|
* @param string $From The user part of the user@NONSSL_SITE_URL email address.
|
||||||
|
* @param string $ContentType text/plain or text/html
|
||||||
|
*/
|
||||||
|
public static function send_email($To,$Subject,$Body,$From='noreply',$ContentType='text/plain') {
|
||||||
|
$Headers='MIME-Version: 1.0'."\r\n";
|
||||||
|
$Headers.='Content-type: '.$ContentType.'; charset=iso-8859-1'."\r\n";
|
||||||
|
$Headers.='From: '.SITE_NAME.' <'.$From.'@'.NONSSL_SITE_URL.'>'."\r\n";
|
||||||
|
$Headers.='Reply-To: '.$From.'@'.NONSSL_SITE_URL."\r\n";
|
||||||
|
$Headers.='X-Mailer: Project Gazelle'."\r\n";
|
||||||
|
$Headers.='Message-Id: <'.Users::make_secret().'@'.NONSSL_SITE_URL.">\r\n";
|
||||||
|
$Headers.='X-Priority: 3'."\r\n";
|
||||||
|
mail($To,$Subject,$Body,$Headers,"-f ".$From."@".NONSSL_SITE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize a string to be allowed as a filename.
|
||||||
|
*
|
||||||
|
* @param string $EscapeStr the string to escape
|
||||||
|
* @return the string with all banned characters removed.
|
||||||
|
*/
|
||||||
|
public static function file_string($EscapeStr) {
|
||||||
|
return str_replace(array('"','*','/',':','<','>','?','\\','|'), '', $EscapeStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a PM from $FromId to $ToId.
|
||||||
|
*
|
||||||
|
* @param string $ToID ID of user to send PM to. If $ToID is an array and $ConvID is empty, a message will be sent to multiple users.
|
||||||
|
* @param string $FromID ID of user to send PM from, 0 to send from system
|
||||||
|
* @param string $Subject
|
||||||
|
* @param string $Body
|
||||||
|
* @param int $ConvID The conversation the message goes in. Leave blank to start a new conversation.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
|
||||||
|
global $DB, $Cache, $Time;
|
||||||
|
if ($ToID == 0 || $ToID == $FromID) {
|
||||||
|
// Don't allow users to send messages to the system or themselves
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($ConvID=='') {
|
||||||
|
// Create a new conversation.
|
||||||
|
$DB->query("INSERT INTO pm_conversations(Subject) VALUES ('".$Subject."')");
|
||||||
|
$ConvID = $DB->inserted_id();
|
||||||
|
$DB->query("INSERT INTO pm_conversations_users
|
||||||
|
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) VALUES
|
||||||
|
('$ToID', '$ConvID', '1','0','".sqltime()."', '".sqltime()."', '1')");
|
||||||
|
if ($FromID != 0) {
|
||||||
|
$DB->query("INSERT INTO pm_conversations_users
|
||||||
|
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) VALUES
|
||||||
|
('$FromID', '$ConvID', '0','1','".sqltime()."', '".sqltime()."', '0')");
|
||||||
|
}
|
||||||
|
$ToID = array($ToID);
|
||||||
|
} else {
|
||||||
|
// Update the pre-existing conversations.
|
||||||
|
$DB->query("UPDATE pm_conversations_users SET
|
||||||
|
InInbox='1',
|
||||||
|
UnRead='1',
|
||||||
|
ReceivedDate='".sqltime()."'
|
||||||
|
WHERE UserID IN (".implode(',', $ToID).")
|
||||||
|
AND ConvID='$ConvID'");
|
||||||
|
|
||||||
|
$DB->query("UPDATE pm_conversations_users SET
|
||||||
|
InSentbox='1',
|
||||||
|
SentDate='".sqltime()."'
|
||||||
|
WHERE UserID='$FromID'
|
||||||
|
AND ConvID='$ConvID'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now that we have a $ConvID for sure, send the message.
|
||||||
|
$DB->query("INSERT INTO pm_messages
|
||||||
|
(SenderID, ConvID, SentDate, Body) VALUES
|
||||||
|
('$FromID', '$ConvID', '".sqltime()."', '".$Body."')");
|
||||||
|
|
||||||
|
// Update the cached new message count.
|
||||||
|
foreach ($ToID as $ID) {
|
||||||
|
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'");
|
||||||
|
list($UnRead) = $DB->next_record();
|
||||||
|
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ConvID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create thread function, things should already be escaped when sent here.
|
||||||
|
*
|
||||||
|
* @param int $ForumID
|
||||||
|
* @param int $AuthorID ID of the user creating the post.
|
||||||
|
* @param string $Title
|
||||||
|
* @param string $PostBody
|
||||||
|
* @return -1 on error, -2 on user not existing, thread id on success.
|
||||||
|
*/
|
||||||
|
public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
||||||
|
global $DB, $Cache, $Time;
|
||||||
|
if (!$ForumID || !$AuthorID || !is_number($AuthorID) || !$Title || !$PostBody) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("SELECT Username FROM users_main WHERE ID=".$AuthorID);
|
||||||
|
if ($DB->record_count() < 1) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
list($AuthorName) = $DB->next_record();
|
||||||
|
|
||||||
|
$ThreadInfo = array();
|
||||||
|
$ThreadInfo['IsLocked'] = 0;
|
||||||
|
$ThreadInfo['IsSticky'] = 0;
|
||||||
|
|
||||||
|
$DB->query("INSERT INTO forums_topics
|
||||||
|
(Title, AuthorID, ForumID, LastPostTime, LastPostAuthorID)
|
||||||
|
Values
|
||||||
|
('".$Title."', '".$AuthorID."', '$ForumID', '".sqltime()."', '".$AuthorID."')");
|
||||||
|
$TopicID = $DB->inserted_id();
|
||||||
|
$Posts = 1;
|
||||||
|
|
||||||
|
$DB->query("INSERT INTO forums_posts
|
||||||
|
(TopicID, AuthorID, AddedTime, Body)
|
||||||
|
VALUES
|
||||||
|
('$TopicID', '".$AuthorID."', '".sqltime()."', '".$PostBody."')");
|
||||||
|
$PostID = $DB->inserted_id();
|
||||||
|
|
||||||
|
$DB->query("UPDATE forums SET
|
||||||
|
NumPosts = NumPosts+1,
|
||||||
|
NumTopics = NumTopics+1,
|
||||||
|
LastPostID = '$PostID',
|
||||||
|
LastPostAuthorID = '".$AuthorID."',
|
||||||
|
LastPostTopicID = '$TopicID',
|
||||||
|
LastPostTime = '".sqltime()."'
|
||||||
|
WHERE ID = '$ForumID'");
|
||||||
|
|
||||||
|
$DB->query("UPDATE forums_topics SET
|
||||||
|
NumPosts = NumPosts+1,
|
||||||
|
LastPostID = '$PostID',
|
||||||
|
LastPostAuthorID = '".$AuthorID."',
|
||||||
|
LastPostTime = '".sqltime()."'
|
||||||
|
WHERE ID = '$TopicID'");
|
||||||
|
|
||||||
|
// Bump this topic to head of the cache
|
||||||
|
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
|
||||||
|
if (!empty($Forum)) {
|
||||||
|
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
|
||||||
|
array_pop($Forum);
|
||||||
|
}
|
||||||
|
$DB->query("SELECT f.IsLocked, f.IsSticky, f.NumPosts FROM forums_topics AS f
|
||||||
|
WHERE f.ID ='$TopicID'");
|
||||||
|
list($IsLocked,$IsSticky,$NumPosts) = $DB->next_record();
|
||||||
|
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickys
|
||||||
|
$Part2 = array(
|
||||||
|
$TopicID=>array(
|
||||||
|
'ID' => $TopicID,
|
||||||
|
'Title' => $Title,
|
||||||
|
'AuthorID' => $AuthorID,
|
||||||
|
'IsLocked' => $IsLocked,
|
||||||
|
'IsSticky' => $IsSticky,
|
||||||
|
'NumPosts' => $NumPosts,
|
||||||
|
'LastPostID' => $PostID,
|
||||||
|
'LastPostTime' => sqltime(),
|
||||||
|
'LastPostAuthorID' => $AuthorID,
|
||||||
|
)
|
||||||
|
); //Bumped thread
|
||||||
|
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE,true); //Rest of page
|
||||||
|
if ($Stickies > 0) {
|
||||||
|
$Part1 = array_slice($Forum,0,$Stickies,true); //Stickies
|
||||||
|
$Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE-$Stickies-1,true); //Rest of page
|
||||||
|
} else {
|
||||||
|
$Part1 = array();
|
||||||
|
$Part3 = $Forum;
|
||||||
|
}
|
||||||
|
if (is_null($Part1)) { $Part1 = array(); }
|
||||||
|
if (is_null($Part3)) { $Part3 = array(); }
|
||||||
|
$Forum = $Part1 + $Part2 + $Part3;
|
||||||
|
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update the forum root
|
||||||
|
$Cache->begin_transaction('forums_list');
|
||||||
|
$UpdateArray = array(
|
||||||
|
'NumPosts'=>'+1',
|
||||||
|
'NumTopics'=>'+1',
|
||||||
|
'LastPostID'=>$PostID,
|
||||||
|
'LastPostAuthorID'=>$AuthorID,
|
||||||
|
'LastPostTopicID'=>$TopicID,
|
||||||
|
'LastPostTime'=>sqltime(),
|
||||||
|
'Title'=>$Title,
|
||||||
|
'IsLocked'=>$ThreadInfo['IsLocked'],
|
||||||
|
'IsSticky'=>$ThreadInfo['IsSticky']
|
||||||
|
);
|
||||||
|
|
||||||
|
$UpdateArray['NumTopics']='+1';
|
||||||
|
|
||||||
|
$Cache->update_row($ForumID, $UpdateArray);
|
||||||
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
|
$CatalogueID = floor((POSTS_PER_PAGE*ceil($Posts/POSTS_PER_PAGE)-POSTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||||
|
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID);
|
||||||
|
$Post = array(
|
||||||
|
'ID'=>$PostID,
|
||||||
|
'AuthorID'=>$LoggedUser['ID'],
|
||||||
|
'AddedTime'=>sqltime(),
|
||||||
|
'Body'=>$PostBody,
|
||||||
|
'EditedUserID'=>0,
|
||||||
|
'EditedTime'=>'0000-00-00 00:00:00',
|
||||||
|
'Username'=>''
|
||||||
|
);
|
||||||
|
$Cache->insert('', $Post);
|
||||||
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
|
$Cache->begin_transaction('thread_'.$TopicID.'_info');
|
||||||
|
$Cache->update_row(false, array('Posts'=>'+1', 'LastPostAuthorID'=>$AuthorID));
|
||||||
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
|
return $TopicID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the suffix of $Haystack is $Needle
|
||||||
|
*
|
||||||
|
* @param string $Haystack String to search in
|
||||||
|
* @param string $Needle String to search for
|
||||||
|
* @return boolean True if $Needle is a suffix of $Haystack
|
||||||
|
*/
|
||||||
|
public static function ends_with($Haystack, $Needle) {
|
||||||
|
return substr($Haystack, strlen($Needle) * -1) == $Needle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the preix of $Haystack is $Needle
|
||||||
|
*
|
||||||
|
* @param string $Haystack String to search in
|
||||||
|
* @param string $Needle String to search for
|
||||||
|
* @return boolean True if $Needle is a preix of $Haystack
|
||||||
|
*/
|
||||||
|
public static function starts_with($Haystack, $Needle) {
|
||||||
|
return strpos($Haystack, $Needle) === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variant of in_array() with trailing wildcard support
|
||||||
|
*
|
||||||
|
* @param string $Needle, array $Haystack
|
||||||
|
* @return boolean true if (substring of) $Needle exists in $Haystack
|
||||||
|
*/
|
||||||
|
public static function in_array_partial($Needle, $Haystack) {
|
||||||
|
static $Searches = array();
|
||||||
|
if (array_key_exists($Needle, $Searches)) {
|
||||||
|
return $Searches[$Needle];
|
||||||
|
}
|
||||||
|
foreach ($Haystack as $String) {
|
||||||
|
if (substr($String, -1) == '*') {
|
||||||
|
if (!strncmp($Needle, $String, strlen($String)-1)) {
|
||||||
|
$Searches[$Needle] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} elseif (!strcmp($Needle, $String)) {
|
||||||
|
$Searches[$Needle] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Searches[$Needle] = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to check if keys in $_POST and $_GET are all set, and throws an error if not.
|
||||||
|
* This reduces 'if' statement redundancy for a lot of variables
|
||||||
|
*
|
||||||
|
* @param array $Request Either $_POST or $_GET, or whatever other array you want to check.
|
||||||
|
* @param array $Keys The keys to ensure are set.
|
||||||
|
* @param boolean $AllowEmpty If set to true, a key that is in the request but blank will not throw an error.
|
||||||
|
* @param int $Error The error code to throw if one of the keys isn't in the array.
|
||||||
|
*/
|
||||||
|
public static function assert_isset_request($Request, $Keys=NULL, $AllowEmpty = False, $Error=0) {
|
||||||
|
if (isset($Keys)) {
|
||||||
|
foreach ($Keys as $K) {
|
||||||
|
if (!isset($Request[$K]) || ($AllowEmpty == False && $Request[$K] == '')) {
|
||||||
|
error($Error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($Request as $R) {
|
||||||
|
if (!isset($R) || ($AllowEmpty == False && $R == '')) {
|
||||||
|
error($Error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given an array of tags, return an array of their IDs.
|
||||||
|
*
|
||||||
|
* @param arary $TagNames
|
||||||
|
* @return array IDs
|
||||||
|
*/
|
||||||
|
public static function get_tags($TagNames) {
|
||||||
|
global $Cache, $DB;
|
||||||
|
$TagIDs = array();
|
||||||
|
foreach ($TagNames as $Index => $TagName) {
|
||||||
|
$Tag = $Cache->get_value('tag_id_'.$TagName);
|
||||||
|
if (is_array($Tag)) {
|
||||||
|
unset($TagNames[$Index]);
|
||||||
|
$TagIDs[$Tag['ID']] = $Tag['Name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($TagNames) > 0) {
|
||||||
|
$DB->query("SELECT ID, Name FROM tags WHERE Name IN ('".implode("', '", $TagNames)."')");
|
||||||
|
$SQLTagIDs = $DB->to_array();
|
||||||
|
foreach ($SQLTagIDs as $Tag) {
|
||||||
|
$TagIDs[$Tag['ID']] = $Tag['Name'];
|
||||||
|
$Cache->cache_value('tag_id_'.$Tag['Name'], $Tag, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return($TagIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the alias of the tag, if there is no alias silently returns the original tag.
|
||||||
|
*
|
||||||
|
* @param string $BadTag the tag we want to alias
|
||||||
|
* @return string The aliased tag.
|
||||||
|
*/
|
||||||
|
public static function get_alias_tag($BadTag) {
|
||||||
|
global $DB;
|
||||||
|
$DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1");
|
||||||
|
if ($DB->record_count() > 0) {
|
||||||
|
list($AliasTag) = $DB->next_record();
|
||||||
|
return $AliasTag;
|
||||||
|
}
|
||||||
|
return $BadTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a message to the system log.
|
||||||
|
*
|
||||||
|
* @param string $Message the message to write.
|
||||||
|
*/
|
||||||
|
public static function write_log($Message) {
|
||||||
|
global $DB,$Time;
|
||||||
|
$DB->query('INSERT INTO log (Message, Time) VALUES (\''
|
||||||
|
.db_string($Message).'\', \''.sqltime().'\')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a tag ready for database input and display.
|
||||||
|
*
|
||||||
|
* @param string $Str
|
||||||
|
* @return sanitized version of $Str
|
||||||
|
*/
|
||||||
|
public static function sanitize_tag($Str) {
|
||||||
|
$Str = strtolower($Str);
|
||||||
|
$Str = preg_replace('/[^a-z0-9.]/', '', $Str);
|
||||||
|
$Str = preg_replace('/(^[.,]*)|([.,]*$)/','',$Str);
|
||||||
|
$Str = htmlspecialchars($Str);
|
||||||
|
$Str = db_string(trim($Str));
|
||||||
|
return $Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTML escape an entire array for output.
|
||||||
|
* @param array $Array, what we want to escape
|
||||||
|
* @param boolean/array $Escape
|
||||||
|
* if true, all keys escaped
|
||||||
|
* if false, no escaping.
|
||||||
|
* If array, it's a list of array keys not to escape.
|
||||||
|
* @return mutated version of $Array with values escaped.
|
||||||
|
*/
|
||||||
|
public static function display_array($Array, $Escape = array()) {
|
||||||
|
foreach ($Array as $Key => $Val) {
|
||||||
|
if((!is_array($Escape) && $Escape == true) || !in_array($Key, $Escape)) {
|
||||||
|
$Array[$Key] = display_str($Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -255,7 +255,7 @@ function next_record($Type=MYSQLI_BOTH, $Escape = true) { // $Escape can be true
|
|||||||
if (!is_array($this->Record)) {
|
if (!is_array($this->Record)) {
|
||||||
$this->QueryID = FALSE;
|
$this->QueryID = FALSE;
|
||||||
} elseif($Escape !== FALSE){
|
} elseif($Escape !== FALSE){
|
||||||
$this->Record = display_array($this->Record, $Escape);
|
$this->Record = Misc::display_array($this->Record, $Escape);
|
||||||
}
|
}
|
||||||
return $this->Record;
|
return $this->Record;
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) {
|
|||||||
$Return = array();
|
$Return = array();
|
||||||
while($Row = mysqli_fetch_array($this->QueryID,$Type)){
|
while($Row = mysqli_fetch_array($this->QueryID,$Type)){
|
||||||
if($Escape!==FALSE) {
|
if($Escape!==FALSE) {
|
||||||
$Row = display_array($Row, $Escape);
|
$Row = Misc::display_array($Row, $Escape);
|
||||||
}
|
}
|
||||||
if($Key !== false) {
|
if($Key !== false) {
|
||||||
$Return[$Row[$Key]] = $Row;
|
$Return[$Row[$Key]] = $Row;
|
||||||
|
100
classes/class_permissions.php
Normal file
100
classes/class_permissions.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?
|
||||||
|
class Permissions {
|
||||||
|
/* Check to see if a user has the permission to perform an action
|
||||||
|
* This is called by check_perms in util.php, for convenience.
|
||||||
|
*
|
||||||
|
* @param string PermissionName
|
||||||
|
* @param string $MinClass Return false if the user's class level is below this.
|
||||||
|
*/
|
||||||
|
public static function check_perms($PermissionName,$MinClass = 0) {
|
||||||
|
global $LoggedUser;
|
||||||
|
return (
|
||||||
|
isset($LoggedUser['Permissions'][$PermissionName])
|
||||||
|
&& $LoggedUser['Permissions'][$PermissionName]
|
||||||
|
&& ($LoggedUser['Class']>=$MinClass
|
||||||
|
|| $LoggedUser['EffectiveClass']>=$MinClass)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the permissions associated with a certain permissionid
|
||||||
|
*
|
||||||
|
* @param int $PermissionID the kind of permissions to fetch
|
||||||
|
* @return array permissions
|
||||||
|
*/
|
||||||
|
public static function get_permissions($PermissionID) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
$Permission = $Cache->get_value('perm_'.$PermissionID);
|
||||||
|
if (empty($Permission)) {
|
||||||
|
$DB->query("SELECT p.Level AS Class, p.Values as Permissions, p.Secondary, p.PermittedForums FROM permissions AS p WHERE ID='$PermissionID'");
|
||||||
|
$Permission = $DB->next_record(MYSQLI_ASSOC, array('Permissions'));
|
||||||
|
$Permission['Permissions'] = unserialize($Permission['Permissions']);
|
||||||
|
$Cache->cache_value('perm_'.$PermissionID, $Permission, 2592000);
|
||||||
|
}
|
||||||
|
return $Permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user's permissions.
|
||||||
|
*
|
||||||
|
* @param $UserID
|
||||||
|
* @param array|false $CustomPermissions
|
||||||
|
* Pass in the user's custom permissions if you already have them.
|
||||||
|
* Leave false if you don't have their permissions, the function will fetch them.
|
||||||
|
* @return array Mapping of PermissionName=>bool/int
|
||||||
|
*/
|
||||||
|
public static function get_permissions_for_user($UserID, $CustomPermissions = false) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$UserInfo = Users::user_info($UserID);
|
||||||
|
|
||||||
|
// Fetch custom permissions if they weren't passed in.
|
||||||
|
if ($CustomPermissions === false) {
|
||||||
|
$DB->query('SELECT um.CustomPermissions FROM users_main AS um
|
||||||
|
WHERE um.ID = '.((int)$UserID));
|
||||||
|
list($CustomPermissions) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($CustomPermissions) && !is_array($CustomPermissions)) {
|
||||||
|
$CustomPermissions = unserialize($CustomPermissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Permissions = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||||
|
|
||||||
|
// Manage 'special' inherited permissions
|
||||||
|
$BonusPerms = array();
|
||||||
|
$BonusCollages = 0;
|
||||||
|
foreach ($UserInfo['ExtraClasses'] as $PermID => $Value) {
|
||||||
|
$ClassPerms = Permissions::get_permissions($PermID);
|
||||||
|
$BonusCollages += $ClassPerms['Permissions']['MaxCollages'];
|
||||||
|
unset($ClassPerms['Permissions']['MaxCollages']);
|
||||||
|
$BonusPerms = array_merge($BonusPerms, $ClassPerms['Permissions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($CustomPermissions)) {
|
||||||
|
$CustomPerms = $CustomPermissions;
|
||||||
|
} else {
|
||||||
|
$CustomPerms = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is legacy donor cruft
|
||||||
|
if ($UserInfo['Donor']) {
|
||||||
|
$DonorPerms = Permissions::get_permissions(DONOR);
|
||||||
|
} else {
|
||||||
|
$DonorPerms = array('Permissions' => array());
|
||||||
|
}
|
||||||
|
|
||||||
|
$MaxCollages = $Permissions['Permissions']['MaxCollages']
|
||||||
|
+ $BonusCollages
|
||||||
|
+ $CustomPerms['MaxCollages']
|
||||||
|
+ $DonorPerms['Permissions']['MaxCollages'];
|
||||||
|
|
||||||
|
//Combine the permissions
|
||||||
|
return array_merge(
|
||||||
|
$Permissions['Permissions'],
|
||||||
|
$BonusPerms,
|
||||||
|
$CustomPerms,
|
||||||
|
$DonorPerms['Permissions'],
|
||||||
|
array('MaxCollages' => $MaxCollages));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
120
classes/class_requests.php
Normal file
120
classes/class_requests.php
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?
|
||||||
|
class Requests {
|
||||||
|
/**
|
||||||
|
* Update the sphinx requests delta table for a request.
|
||||||
|
*
|
||||||
|
* @param $RequestID
|
||||||
|
*/
|
||||||
|
public static function update_sphinx_requests($RequestID) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
|
||||||
|
$DB->query("REPLACE INTO sphinx_requests_delta (
|
||||||
|
ID, UserID, TimeAdded, LastVote, CategoryID, Title,
|
||||||
|
Year, ReleaseType, CatalogueNumber, BitrateList,
|
||||||
|
FormatList, MediaList, LogCue, FillerID, TorrentID,
|
||||||
|
TimeFilled, Visible, Votes, Bounty)
|
||||||
|
SELECT
|
||||||
|
ID, r.UserID, UNIX_TIMESTAMP(TimeAdded) AS TimeAdded,
|
||||||
|
UNIX_TIMESTAMP(LastVote) AS LastVote, CategoryID,
|
||||||
|
Title, Year, ReleaseType, CatalogueNumber, BitrateList,
|
||||||
|
FormatList, MediaList, LogCue, FillerID, TorrentID,
|
||||||
|
UNIX_TIMESTAMP(TimeFilled) AS TimeFilled, Visible,
|
||||||
|
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 10 AS Bounty
|
||||||
|
FROM requests AS r LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||||
|
wHERE ID = ".$RequestID."
|
||||||
|
GROUP BY r.ID");
|
||||||
|
|
||||||
|
$DB->query("UPDATE sphinx_requests_delta
|
||||||
|
SET ArtistList = (SELECT
|
||||||
|
GROUP_CONCAT(aa.Name SEPARATOR ' ')
|
||||||
|
FROM requests_artists AS ra
|
||||||
|
JOIN artists_alias AS aa ON aa.AliasID=ra.AliasID
|
||||||
|
WHERE ra.RequestID = ".$RequestID."
|
||||||
|
GROUP BY NULL)
|
||||||
|
WHERE ID = ".$RequestID);
|
||||||
|
|
||||||
|
$Cache->delete_value('requests_'.$RequestID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get data from an array of $RequestIDs.
|
||||||
|
* In places where the output from this is merged with sphinx filters, it will be in a different order.
|
||||||
|
*
|
||||||
|
* @param array $RequestIDs
|
||||||
|
* @param boolean $Return if set to false, data won't be returned (ie. if we just want to prime the cache.)
|
||||||
|
* @return The array of requests.
|
||||||
|
* Format: array(RequestID => Associative array)
|
||||||
|
* To see what's exactly inside each associate array, peek inside the function. It won't bite.
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
//In places where the output from this is merged with sphinx filters, it will be in a different order.
|
||||||
|
public static function get_requests($RequestIDs, $Return = true) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
|
||||||
|
// Try to fetch the requests from the cache first.
|
||||||
|
$Found = array_flip($RequestIDs);
|
||||||
|
$NotFound = array_flip($RequestIDs);
|
||||||
|
|
||||||
|
foreach ($RequestIDs as $RequestID) {
|
||||||
|
$Data = $Cache->get_value('request_'.$RequestID);
|
||||||
|
if (!empty($Data)) {
|
||||||
|
unset($NotFound[$RequestID]);
|
||||||
|
$Found[$RequestID] = $Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$IDs = implode(',',array_flip($NotFound));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Don't change without ensuring you change everything else that uses get_requests()
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (count($NotFound) > 0) {
|
||||||
|
$DB->query("SELECT
|
||||||
|
r.ID AS ID,
|
||||||
|
r.UserID,
|
||||||
|
u.Username,
|
||||||
|
r.TimeAdded,
|
||||||
|
r.LastVote,
|
||||||
|
r.CategoryID,
|
||||||
|
r.Title,
|
||||||
|
r.Year,
|
||||||
|
r.Image,
|
||||||
|
r.Description,
|
||||||
|
r.CatalogueNumber,
|
||||||
|
r.RecordLabel,
|
||||||
|
r.ReleaseType,
|
||||||
|
r.BitrateList,
|
||||||
|
r.FormatList,
|
||||||
|
r.MediaList,
|
||||||
|
r.LogCue,
|
||||||
|
r.FillerID,
|
||||||
|
filler.Username,
|
||||||
|
r.TorrentID,
|
||||||
|
r.TimeFilled,
|
||||||
|
r.GroupID,
|
||||||
|
r.OCLC
|
||||||
|
FROM requests AS r
|
||||||
|
LEFT JOIN users_main AS u ON u.ID=r.UserID
|
||||||
|
LEFT JOIN users_main AS filler ON filler.ID=FillerID AND FillerID!=0
|
||||||
|
WHERE r.ID IN (".$IDs.")
|
||||||
|
ORDER BY ID");
|
||||||
|
|
||||||
|
$Requests = $DB->to_array();
|
||||||
|
foreach ($Requests as $Request) {
|
||||||
|
unset($NotFound[$Request['ID']]);
|
||||||
|
$Request['Tags'] = get_request_tags($Request['ID']);
|
||||||
|
$Found[$Request['ID']] = $Request;
|
||||||
|
$Cache->cache_value('request_'.$Request['ID'], $Request, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Return) { // If we're interested in the data, and not just caching it
|
||||||
|
$Matches = array('matches'=>$Found, 'notfound'=>array_flip($NotFound));
|
||||||
|
return $Matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -3,7 +3,7 @@
|
|||||||
error('Mysqli Extension not loaded.');
|
error('Mysqli Extension not loaded.');
|
||||||
}
|
}
|
||||||
|
|
||||||
class SPHINXQL extends mysqli {
|
class SphinxQL extends mysqli {
|
||||||
private static $Connections = array();
|
private static $Connections = array();
|
||||||
private $Server;
|
private $Server;
|
||||||
private $Port;
|
private $Port;
|
||||||
@ -56,7 +56,7 @@ private function get_ident($Server, $Port, $Socket) {
|
|||||||
public static function init_connection($Server, $Port, $Socket) {
|
public static function init_connection($Server, $Port, $Socket) {
|
||||||
$Ident = self::get_ident($Server, $Port, $Socket);
|
$Ident = self::get_ident($Server, $Port, $Socket);
|
||||||
if(!isset(self::$Connections[$Ident])) {
|
if(!isset(self::$Connections[$Ident])) {
|
||||||
self::$Connections[$Ident] = new SPHINXQL($Server, $Port, $Socket);
|
self::$Connections[$Ident] = new SphinxQL($Server, $Port, $Socket);
|
||||||
}
|
}
|
||||||
return self::$Connections[$Ident];
|
return self::$Connections[$Ident];
|
||||||
}
|
}
|
||||||
@ -130,12 +130,12 @@ public function escape_string($String) {
|
|||||||
* @param param $QueryProcessTime time building and processing the query
|
* @param param $QueryProcessTime time building and processing the query
|
||||||
*/
|
*/
|
||||||
public function register_query($QueryString, $QueryProcessTime) {
|
public function register_query($QueryString, $QueryProcessTime) {
|
||||||
SPHINXQL::$Queries[] = array($QueryString, $QueryProcessTime);
|
SphinxQL::$Queries[] = array($QueryString, $QueryProcessTime);
|
||||||
SPHINXQL::$Time += $QueryProcessTime;
|
SphinxQL::$Time += $QueryProcessTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SPHINXQL_QUERY {
|
class SphinxQL_Query {
|
||||||
private $SphinxQL;
|
private $SphinxQL;
|
||||||
|
|
||||||
private $Expressions;
|
private $Expressions;
|
||||||
@ -157,7 +157,7 @@ class SPHINXQL_QUERY {
|
|||||||
* @param string $Socket Unix socket address, overrides $Server:$Port
|
* @param string $Socket Unix socket address, overrides $Server:$Port
|
||||||
*/
|
*/
|
||||||
public function __construct($Server = SPHINXQL_HOST, $Port = SPHINXQL_PORT, $Socket = SPHINXQL_SOCK) {
|
public function __construct($Server = SPHINXQL_HOST, $Port = SPHINXQL_PORT, $Socket = SPHINXQL_SOCK) {
|
||||||
$this->SphinxQL = SPHINXQL::init_connection($Server, $Port, $Socket);
|
$this->SphinxQL = SphinxQL::init_connection($Server, $Port, $Socket);
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ public function where_match($Expr, $Field = '*') {
|
|||||||
if(empty($Expr)) {
|
if(empty($Expr)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$this->Expressions[] = "@$Field ".SPHINXQL::escape_string($Expr);
|
$this->Expressions[] = "@$Field ".SphinxQL::escape_string($Expr);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ public function query($GetMeta = true) {
|
|||||||
$QueryString = $this->QueryString;
|
$QueryString = $this->QueryString;
|
||||||
$Result = $this->send_query($GetMeta);
|
$Result = $this->send_query($GetMeta);
|
||||||
$QueryProcessTime = (microtime(true) - $QueryStartTime)*1000;
|
$QueryProcessTime = (microtime(true) - $QueryStartTime)*1000;
|
||||||
SPHINXQL::register_query($QueryString, $QueryProcessTime);
|
SphinxQL::register_query($QueryString, $QueryProcessTime);
|
||||||
return $Result;
|
return $Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ private function send_query($GetMeta) {
|
|||||||
} else {
|
} else {
|
||||||
$Meta = $GetMeta ? $this->get_meta() : null;
|
$Meta = $GetMeta ? $this->get_meta() : null;
|
||||||
}
|
}
|
||||||
return new SPHINXQL_RESULT($Result, $Meta, $Errno, $Error);
|
return new SphinxQL_Result($Result, $Meta, $Errno, $Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,7 +441,7 @@ private function error($Msg, $Halt = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SPHINXQL_RESULT {
|
class SphinxQL_Result {
|
||||||
private $Result;
|
private $Result;
|
||||||
private $Meta;
|
private $Meta;
|
||||||
public $Errno;
|
public $Errno;
|
||||||
|
@ -458,24 +458,24 @@ function to_html($Array) {
|
|||||||
$Str.='<a href="user.php?action=search&search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
$Str.='<a href="user.php?action=search&search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
||||||
break;
|
break;
|
||||||
case 'artist':
|
case 'artist':
|
||||||
$Str.='<a href="artist.php?artistname='.urlencode(undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
|
$Str.='<a href="artist.php?artistname='.urlencode(Format::undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
|
||||||
break;
|
break;
|
||||||
case 'rule':
|
case 'rule':
|
||||||
$Rule = trim(strtolower($Block['Val']));
|
$Rule = trim(strtolower($Block['Val']));
|
||||||
if($Rule[0] != 'r' && $Rule[0] != 'h') {
|
if($Rule[0] != 'r' && $Rule[0] != 'h') {
|
||||||
$Rule = 'r'.$Rule;
|
$Rule = 'r'.$Rule;
|
||||||
}
|
}
|
||||||
$Str.='<a href="rules.php?p=upload#'.urlencode(undisplay_str($Rule)).'">'.preg_replace('/[aA-zZ]/', '', $Block['Val']).'</a>';
|
$Str.='<a href="rules.php?p=upload#'.urlencode(Format::undisplay_str($Rule)).'">'.preg_replace('/[aA-zZ]/', '', $Block['Val']).'</a>';
|
||||||
break;
|
break;
|
||||||
case 'torrent':
|
case 'torrent':
|
||||||
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
|
$Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
|
||||||
$Matches = array();
|
$Matches = array();
|
||||||
if (preg_match($Pattern, $Block['Val'], $Matches)) {
|
if (preg_match($Pattern, $Block['Val'], $Matches)) {
|
||||||
if (isset($Matches[2])) {
|
if (isset($Matches[2])) {
|
||||||
$Groups = get_groups(array($Matches[2]), true, true, false);
|
$Groups = Torrents::get_groups(array($Matches[2]), true, true, false);
|
||||||
if (!empty($Groups['matches'][$Matches[2]])) {
|
if (!empty($Groups['matches'][$Matches[2]])) {
|
||||||
$Group = $Groups['matches'][$Matches[2]];
|
$Group = $Groups['matches'][$Matches[2]];
|
||||||
$Str .= display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$Matches[2].'">'.$Group['Name'].'</a>';
|
$Str .= Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$Matches[2].'">'.$Group['Name'].'</a>';
|
||||||
} else {
|
} else {
|
||||||
$Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]';
|
$Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]';
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ function to_html($Array) {
|
|||||||
$Str.='<a href="user.php?action=search&search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
$Str.='<a href="user.php?action=search&search='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
||||||
break;
|
break;
|
||||||
case 'artist':
|
case 'artist':
|
||||||
$Str.='<a href="artist.php?artistname='.urlencode(undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
|
$Str.='<a href="artist.php?artistname='.urlencode(Format::undisplay_str($Block['Val'])).'">'.$Block['Val'].'</a>';
|
||||||
break;
|
break;
|
||||||
case 'wiki':
|
case 'wiki':
|
||||||
$Str.='<a href="wiki.php?action=article&name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
$Str.='<a href="wiki.php?action=article&name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
||||||
|
239
classes/class_tools.php
Normal file
239
classes/class_tools.php
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
<?
|
||||||
|
class Tools {
|
||||||
|
/**
|
||||||
|
* Returns true if given IP is banned.
|
||||||
|
*
|
||||||
|
* @param string $IP
|
||||||
|
*/
|
||||||
|
public static function site_ban_ip($IP) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
$IPNum = Tools::ip_to_unsigned($IP);
|
||||||
|
$IPBans = $Cache->get_value('ip_bans');
|
||||||
|
if (!is_array($IPBans)) {
|
||||||
|
$DB->query("SELECT ID, FromIP, ToIP FROM ip_bans");
|
||||||
|
$IPBans = $DB->to_array(0, MYSQLI_NUM);
|
||||||
|
$Cache->cache_value('ip_bans', $IPBans, 0);
|
||||||
|
}
|
||||||
|
foreach ($IPBans as $Index => $IPBan) {
|
||||||
|
list ($ID, $FromIP, $ToIP) = $IPBan;
|
||||||
|
if ($IPNum >= $FromIP && $IPNum <= $ToIP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unsigned form of an IP address.
|
||||||
|
*
|
||||||
|
* @param string $IP The IP address x.x.x.x
|
||||||
|
* @return string the long it represents.
|
||||||
|
*/
|
||||||
|
public static function ip_to_unsigned($IP) {
|
||||||
|
return sprintf("%u", ip2long($IP));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Geolocate an IP address using the database
|
||||||
|
*
|
||||||
|
* @param $IP the ip to fetch the country for
|
||||||
|
* @return the country of origin
|
||||||
|
*/
|
||||||
|
public static function geoip($IP) {
|
||||||
|
static $IPs = array();
|
||||||
|
if (isset($IPs[$IP])) {
|
||||||
|
return $IPs[$IP];
|
||||||
|
}
|
||||||
|
$Long = Tools::ip_to_unsigned($IP);
|
||||||
|
if(!$Long || $Long == 2130706433) { // No need to check cc for 127.0.0.1
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
global $DB;
|
||||||
|
$DB->query("SELECT EndIP,Code FROM geoip_country WHERE $Long >= StartIP ORDER BY StartIP DESC LIMIT 1");
|
||||||
|
if((!list($EndIP,$Country) = $DB->next_record()) || $EndIP < $Long) {
|
||||||
|
$Country = '?';
|
||||||
|
}
|
||||||
|
$IPs[$IP] = $Country;
|
||||||
|
return $Country;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hostname for an IP address
|
||||||
|
*
|
||||||
|
* @param $IP the IP to get the hostname for
|
||||||
|
* @return hostname fetched
|
||||||
|
*/
|
||||||
|
public static function get_host_by_ip($IP)
|
||||||
|
{
|
||||||
|
$testar = explode('.',$IP);
|
||||||
|
if (count($testar)!=4) {
|
||||||
|
return $IP;
|
||||||
|
}
|
||||||
|
for ($i=0;$i<4;++$i) {
|
||||||
|
if (!is_numeric($testar[$i])) {
|
||||||
|
return $IP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$host = `host -W 1 $IP`;
|
||||||
|
return (($host ? end ( explode (' ', $host)) : $IP));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an hostname using AJAX
|
||||||
|
*
|
||||||
|
* @param $IP the IP to fetch
|
||||||
|
* @return a span with javascript code
|
||||||
|
*/
|
||||||
|
public static function get_host_by_ajax($IP) {
|
||||||
|
static $ID = 0;
|
||||||
|
++$ID;
|
||||||
|
return '<span id="host_'.$ID.'">Resolving host...<script type="text/javascript">ajax.get(\'tools.php?action=get_host&ip='.$IP.'\',function(host){$(\'#host_'.$ID.'\').raw().innerHTML=host;});</script></span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks up the full host of an IP address, by system call.
|
||||||
|
* Used as the server-side counterpart to get_host_by_ajax.
|
||||||
|
*
|
||||||
|
* @param string $IP The IP address to look up.
|
||||||
|
* @return string the host.
|
||||||
|
*/
|
||||||
|
public static function lookup_ip($IP) {
|
||||||
|
//TODO: use the $Cache
|
||||||
|
$Output = explode(' ',shell_exec('host -W 1 '.escapeshellarg($IP)));
|
||||||
|
if(count($Output) == 1 && empty($Output[0])) {
|
||||||
|
//No output at all implies the command failed
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($Output) != 5) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return $Output[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format an IP address with links to IP history.
|
||||||
|
*
|
||||||
|
* @param string IP
|
||||||
|
* @return string The HTML
|
||||||
|
*/
|
||||||
|
public static function display_ip($IP) {
|
||||||
|
$Line = display_str($IP).' ('.Tools::get_country_code_by_ajax($IP).') ';
|
||||||
|
$Line .= '[<a href="user.php?action=search&ip_history=on&ip='.display_str($IP).'&matchtype=strict" title="Search">S</a>]';
|
||||||
|
|
||||||
|
return $Line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_country_code_by_ajax($IP) {
|
||||||
|
static $ID = 0;
|
||||||
|
++$ID;
|
||||||
|
return '<span id="cc_'.$ID.'">Resolving CC...<script type="text/javascript">ajax.get(\'tools.php?action=get_cc&ip='.$IP.'\',function(cc){$(\'#cc_'.$ID.'\').raw().innerHTML=cc;});</script></span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable an array of users.
|
||||||
|
*
|
||||||
|
* @param array $UserIDs (You can also send it one ID as an int, because fuck types)
|
||||||
|
* @param BanReason 0 - Unknown, 1 - Manual, 2 - Ratio, 3 - Inactive, 4 - Unused.
|
||||||
|
*/
|
||||||
|
public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
|
||||||
|
global $Cache, $DB;
|
||||||
|
if(!is_array($UserIDs)) {
|
||||||
|
$UserIDs = array($UserIDs);
|
||||||
|
}
|
||||||
|
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
|
||||||
|
SET m.Enabled='2',
|
||||||
|
m.can_leech='0',
|
||||||
|
i.AdminComment = CONCAT('".sqltime()." - ".($AdminComment ? $AdminComment : 'Disabled by system')."\n\n', i.AdminComment),
|
||||||
|
i.BanDate='".sqltime()."',
|
||||||
|
i.BanReason='".$BanReason."',
|
||||||
|
i.RatioWatchDownload=".($BanReason == 2?'m.Downloaded':"'0'")."
|
||||||
|
WHERE m.ID IN(".implode(',',$UserIDs).") ");
|
||||||
|
$Cache->decrement('stats_user_count',$DB->affected_rows());
|
||||||
|
foreach($UserIDs as $UserID) {
|
||||||
|
$Cache->delete_value('enabled_'.$UserID);
|
||||||
|
$Cache->delete_value('user_info_'.$UserID);
|
||||||
|
$Cache->delete_value('user_info_heavy_'.$UserID);
|
||||||
|
$Cache->delete_value('user_stats_'.$UserID);
|
||||||
|
|
||||||
|
$DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID' AND Active = 1");
|
||||||
|
while(list($SessionID) = $DB->next_record()) {
|
||||||
|
$Cache->delete_value('session_'.$UserID.'_'.$SessionID);
|
||||||
|
}
|
||||||
|
$Cache->delete_value('users_sessions_'.$UserID);
|
||||||
|
|
||||||
|
|
||||||
|
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID'");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the users from the tracker.
|
||||||
|
$DB->query("SELECT torrent_pass FROM users_main WHERE ID in (".implode(", ",$UserIDs).")");
|
||||||
|
$PassKeys = $DB->collect('torrent_pass');
|
||||||
|
$Concat = "";
|
||||||
|
foreach($PassKeys as $PassKey) {
|
||||||
|
if(strlen($Concat) > 4000) {
|
||||||
|
Tracker::update_tracker('remove_users', array('passkeys' => $Concat));
|
||||||
|
$Concat = $PassKey;
|
||||||
|
} else {
|
||||||
|
$Concat .= $PassKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Tracker::update_tracker('remove_users', array('passkeys' => $Concat));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warn a user.
|
||||||
|
*
|
||||||
|
* @param int $UserID
|
||||||
|
* @param int $Duration length of warning in seconds
|
||||||
|
* @param string $reason
|
||||||
|
*/
|
||||||
|
public static function warn_user($UserID, $Duration, $Reason) {
|
||||||
|
global $LoggedUser, $DB, $Cache, $Time;
|
||||||
|
|
||||||
|
$DB->query("SELECT Warned FROM users_info
|
||||||
|
WHERE UserID=".$UserID."
|
||||||
|
AND Warned <> '0000-00-00 00:00:00'");
|
||||||
|
if($DB->record_count() > 0) {
|
||||||
|
//User was already warned, appending new warning to old.
|
||||||
|
list($OldDate) = $DB->next_record();
|
||||||
|
$NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration);
|
||||||
|
|
||||||
|
Misc::send_pm($UserID, 0,
|
||||||
|
db_string("You have received multiple warnings."),
|
||||||
|
db_string("When you received your latest warning (Set to expire on ".date("Y-m-d", (time() + $Duration))."), you already had a different warning (Set to expire on ".date("Y-m-d", strtotime($OldDate)).").\n\n Due to this collision, your warning status will now expire at ".$NewExpDate."."));
|
||||||
|
|
||||||
|
$AdminComment = date("Y-m-d").' - Warning (Clash) extended to expire at '.$NewExpDate.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
|
||||||
|
|
||||||
|
$DB->query('UPDATE users_info SET
|
||||||
|
Warned=\''.db_string($NewExpDate).'\',
|
||||||
|
WarnedTimes=WarnedTimes+1,
|
||||||
|
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
|
||||||
|
WHERE UserID=\''.db_string($UserID).'\'');
|
||||||
|
} else {
|
||||||
|
//Not changing, user was not already warned
|
||||||
|
$WarnTime = time_plus($Duration);
|
||||||
|
|
||||||
|
$Cache->begin_transaction('user_info_'.$UserID);
|
||||||
|
$Cache->update_row(false, array('Warned' => $WarnTime));
|
||||||
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
|
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $Reason\n\n";
|
||||||
|
|
||||||
|
$DB->query('UPDATE users_info SET
|
||||||
|
Warned=\''.db_string($WarnTime).'\',
|
||||||
|
WarnedTimes=WarnedTimes+1,
|
||||||
|
AdminComment=CONCAT(\''.db_string($AdminComment).'\',AdminComment)
|
||||||
|
WHERE UserID=\''.db_string($UserID).'\'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -93,9 +93,9 @@ function head() {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="categories" name="type" onchange="Categories()"<?=$this->Disabled?>>
|
<select id="categories" name="type" onchange="Categories()"<?=$this->Disabled?>>
|
||||||
<? foreach(display_array($this->Categories) as $Index => $Cat) {
|
<? foreach(Misc::display_array($this->Categories) as $Index => $Cat) {
|
||||||
echo "<option value=\"$Index\"";
|
echo "<option value=\"$Index\"";
|
||||||
if($Cat == $this->Torrent['CategoryName']) { echo ' selected="selected"'; }
|
if($Cat == $this->Torrent['CategoryName']) { echo " selected='selected'"; }
|
||||||
echo ">";
|
echo ">";
|
||||||
echo $Cat;
|
echo $Cat;
|
||||||
echo "</option>\n";
|
echo "</option>\n";
|
||||||
@ -398,7 +398,7 @@ function show() {
|
|||||||
<td>
|
<td>
|
||||||
<select id="format" name="format" onchange="Format()">
|
<select id="format" name="format" onchange="Format()">
|
||||||
<option>---</option>
|
<option>---</option>
|
||||||
<? foreach(display_array($this->Formats) as $Format) {
|
<? foreach(Misc::display_array($this->Formats) as $Format) {
|
||||||
echo "<option value='$Format'";
|
echo "<option value='$Format'";
|
||||||
if($Format == $Torrent['Format']) { echo " selected='selected'"; }
|
if($Format == $Torrent['Format']) { echo " selected='selected'"; }
|
||||||
echo ">";
|
echo ">";
|
||||||
@ -432,7 +432,7 @@ function show() {
|
|||||||
$SimpleBitrate = $SimpleBitrate[0];
|
$SimpleBitrate = $SimpleBitrate[0];
|
||||||
|
|
||||||
|
|
||||||
foreach(display_array($this->Bitrates) as $Bitrate) {
|
foreach(Misc::display_array($this->Bitrates) as $Bitrate) {
|
||||||
echo "<option value='$Bitrate'";
|
echo "<option value='$Bitrate'";
|
||||||
if(($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == "Other")) {
|
if(($SimpleBitrate && preg_match('/^'.$SimpleBitrate.'.*/', $Bitrate)) || ($OtherBitrate && $Bitrate == "Other")) {
|
||||||
echo ' selected="selected"';
|
echo ' selected="selected"';
|
||||||
@ -580,7 +580,7 @@ function show() {
|
|||||||
<? if($GenreTags) { ?>
|
<? if($GenreTags) { ?>
|
||||||
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" <?=$this->Disabled?>>
|
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" <?=$this->Disabled?>>
|
||||||
<option>---</option>
|
<option>---</option>
|
||||||
<? foreach(display_array($GenreTags) as $Genre) { ?>
|
<? foreach(Misc::display_array($GenreTags) as $Genre) { ?>
|
||||||
<option value="<?=$Genre ?>"><?=$Genre ?></option>
|
<option value="<?=$Genre ?>"><?=$Genre ?></option>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</select>
|
</select>
|
||||||
@ -655,7 +655,7 @@ function audiobook_form() {
|
|||||||
<select name="format" onchange="Format()">
|
<select name="format" onchange="Format()">
|
||||||
<option value="">---</option>
|
<option value="">---</option>
|
||||||
<?
|
<?
|
||||||
foreach(display_array($this->Formats) as $Format) {
|
foreach(Misc::display_array($this->Formats) as $Format) {
|
||||||
echo "<option value='$Format'";
|
echo "<option value='$Format'";
|
||||||
if($Format == $Torrent['Format']) { echo " selected='selected'"; }
|
if($Format == $Torrent['Format']) { echo " selected='selected'"; }
|
||||||
echo ">";
|
echo ">";
|
||||||
@ -681,7 +681,7 @@ function audiobook_form() {
|
|||||||
} else {
|
} else {
|
||||||
$OtherBitrate = false;
|
$OtherBitrate = false;
|
||||||
}
|
}
|
||||||
foreach(display_array($this->Bitrates) as $Bitrate) {
|
foreach(Misc::display_array($this->Bitrates) as $Bitrate) {
|
||||||
echo "<option value='$Bitrate'";
|
echo "<option value='$Bitrate'";
|
||||||
if($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
|
if($Bitrate == $Torrent['Bitrate'] || ($OtherBitrate && $Bitrate == "Other")) {
|
||||||
echo " selected='selected'";
|
echo " selected='selected'";
|
||||||
|
481
classes/class_torrents.php
Normal file
481
classes/class_torrents.php
Normal file
@ -0,0 +1,481 @@
|
|||||||
|
<?
|
||||||
|
class Torrents {
|
||||||
|
/*
|
||||||
|
* Function to get data and torrents for an array of GroupIDs.
|
||||||
|
* In places where the output from this is merged with sphinx filters, it will be in a different order.
|
||||||
|
*
|
||||||
|
* @param array $GroupIDs
|
||||||
|
* @param boolean $Return if false, nothing is returned. For priming cache.
|
||||||
|
* @param boolean $GetArtists if true, each group will contain the result of
|
||||||
|
* Artists::get_artists($GroupID), in result[$GroupID]['ExtendedArtists']
|
||||||
|
* @param boolean $Torrents if true, each group contains a list of torrents, in result[$GroupID]['Torrents']
|
||||||
|
*
|
||||||
|
* @return array each row of the following format:
|
||||||
|
* GroupID => (
|
||||||
|
* Name
|
||||||
|
* Year
|
||||||
|
* RecordLabel
|
||||||
|
* CatalogueNumber
|
||||||
|
* TagList
|
||||||
|
* ReleaseType
|
||||||
|
* VanityHouse
|
||||||
|
* Torrents => {
|
||||||
|
* ID => {
|
||||||
|
* GroupID, Media, Format, Encoding, RemasterYear, Remastered,
|
||||||
|
* RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene,
|
||||||
|
* HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers,
|
||||||
|
* Seeders, Snatched, Time, HasFile
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ExtendedArtists => {
|
||||||
|
* [1-6] => { // See documentation on Artists::get_artists
|
||||||
|
* id, name, aliasid
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public static function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
|
||||||
|
$Found = array_flip($GroupIDs);
|
||||||
|
$NotFound = array_flip($GroupIDs);
|
||||||
|
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
|
||||||
|
|
||||||
|
foreach ($GroupIDs as $GroupID) {
|
||||||
|
$Data = $Cache->get_value($Key.$GroupID);
|
||||||
|
if (!empty($Data) && (@$Data['ver'] >= 4)) {
|
||||||
|
unset($NotFound[$GroupID]);
|
||||||
|
$Found[$GroupID] = $Data['d'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$IDs = implode(',',array_flip($NotFound));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Changing any of these attributes returned will cause very large, very dramatic site-wide chaos.
|
||||||
|
Do not change what is returned or the order thereof without updating:
|
||||||
|
torrents, artists, collages, bookmarks, better, the front page,
|
||||||
|
and anywhere else the get_groups function is used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (count($NotFound)>0) {
|
||||||
|
$DB->query("SELECT
|
||||||
|
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse
|
||||||
|
FROM torrents_group AS g WHERE g.ID IN ($IDs)");
|
||||||
|
|
||||||
|
while($Group = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||||
|
unset($NotFound[$Group['ID']]);
|
||||||
|
$Found[$Group['ID']] = $Group;
|
||||||
|
$Found[$Group['ID']]['Torrents'] = array();
|
||||||
|
$Found[$Group['ID']]['Artists'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Torrents) {
|
||||||
|
$DB->query("SELECT
|
||||||
|
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle,
|
||||||
|
RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore,
|
||||||
|
FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
|
||||||
|
FROM torrents AS t
|
||||||
|
WHERE GroupID IN($IDs)
|
||||||
|
ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle,
|
||||||
|
RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
|
||||||
|
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||||
|
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
||||||
|
|
||||||
|
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'],
|
||||||
|
array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||||
|
$Cache->cache_value('torrent_group_light_'.$Torrent['GroupID'],
|
||||||
|
array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($Found as $Group) {
|
||||||
|
$Cache->cache_value('torrent_group_light_'.$Group['ID'], array('ver'=>4, 'd'=>$Found[$Group['ID']]), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($GetArtists) {
|
||||||
|
$Artists = Artists::get_artists($GroupIDs);
|
||||||
|
} else {
|
||||||
|
$Artists = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Return) { // If we're interested in the data, and not just caching it
|
||||||
|
foreach ($Artists as $GroupID=>$Data) {
|
||||||
|
if (array_key_exists(1, $Data) || array_key_exists(4, $Data) || array_key_exists(6, $Data)) {
|
||||||
|
$Found[$GroupID]['Artists']=$Data[1]; // Only use main artists (legacy)
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][1]=$Data[1];
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][2]=$Data[2];
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][3]=$Data[3];
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][4]=$Data[4];
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][5]=$Data[5];
|
||||||
|
$Found[$GroupID]['ExtendedArtists'][6]=$Data[6];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$Found[$GroupID]['ExtendedArtists'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Matches = array('matches'=>$Found, 'notfound'=>array_flip($NotFound));
|
||||||
|
|
||||||
|
return $Matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write to the group log.
|
||||||
|
*
|
||||||
|
* @param int $GroupID
|
||||||
|
* @param int $TorrentID
|
||||||
|
* @param int $UserID
|
||||||
|
* @param string $Message
|
||||||
|
* @param boolean $Hidden Currently does fuck all. TODO: Fix that.
|
||||||
|
*/
|
||||||
|
public static function write_group_log($GroupID, $TorrentID, $UserID, $Message, $Hidden) {
|
||||||
|
global $DB,$Time;
|
||||||
|
$DB->query("INSERT INTO group_log (GroupID, TorrentID, UserID, Info, Time, Hidden) VALUES ("
|
||||||
|
.$GroupID.", ".$TorrentID.", ".$UserID.", '".db_string($Message)."', '".sqltime()."', ".$Hidden.")");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a torrent.
|
||||||
|
*
|
||||||
|
* @param int $ID The ID of the torrent to delete.
|
||||||
|
* @param int $GroupID Set it if you have it handy, to save a query. Otherwise, it will be found.
|
||||||
|
* @param string $OcelotReason The deletion reason for ocelot to report to users.
|
||||||
|
*/
|
||||||
|
public static function delete_torrent($ID, $GroupID=0, $OcelotReason=-1) {
|
||||||
|
global $DB, $Cache, $LoggedUser;
|
||||||
|
if (!$GroupID) {
|
||||||
|
$DB->query("SELECT GroupID, UserID FROM torrents WHERE ID='$ID'");
|
||||||
|
list($GroupID, $UploaderID) = $DB->next_record();
|
||||||
|
}
|
||||||
|
if (empty($UserID)) {
|
||||||
|
$DB->query("SELECT UserID FROM torrents WHERE ID='$ID'");
|
||||||
|
list($UserID) = $DB->next_record();
|
||||||
|
}
|
||||||
|
|
||||||
|
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
|
||||||
|
if (is_array($RecentUploads)) {
|
||||||
|
foreach ($RecentUploads as $Key => $Recent) {
|
||||||
|
if ($Recent['ID'] == $GroupID) {
|
||||||
|
$Cache->delete_value('recent_uploads_'.$UserID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$DB->query("SELECT info_hash FROM torrents WHERE ID = ".$ID);
|
||||||
|
list($InfoHash) = $DB->next_record(MYSQLI_BOTH, false);
|
||||||
|
$DB->query("DELETE FROM torrents WHERE ID = ".$ID);
|
||||||
|
Tracker::update_tracker('delete_torrent', array('info_hash' => rawurlencode($InfoHash), 'id' => $ID, 'reason' => $OcelotReason));
|
||||||
|
|
||||||
|
$Cache->decrement('stats_torrent_count');
|
||||||
|
|
||||||
|
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$GroupID'");
|
||||||
|
list($Count) = $DB->next_record();
|
||||||
|
|
||||||
|
if ($Count == 0) {
|
||||||
|
Torrents::delete_group($GroupID);
|
||||||
|
} else {
|
||||||
|
Torrents::update_hash($GroupID);
|
||||||
|
//Artists
|
||||||
|
$DB->query("SELECT ArtistID
|
||||||
|
FROM torrents_artists
|
||||||
|
WHERE GroupID = ".$GroupID);
|
||||||
|
$ArtistIDs = $DB->collect('ArtistID');
|
||||||
|
foreach ($ArtistIDs as $ArtistID) {
|
||||||
|
$Cache->delete_value('artist_'.$ArtistID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Torrent notifications
|
||||||
|
$DB->query("SELECT UserID FROM users_notify_torrents WHERE TorrentID='$ID'");
|
||||||
|
while(list($UserID) = $DB->next_record()) {
|
||||||
|
$Cache->delete_value('notifications_new_'.$UserID);
|
||||||
|
}
|
||||||
|
$DB->query("DELETE FROM users_notify_torrents WHERE TorrentID='$ID'");
|
||||||
|
|
||||||
|
|
||||||
|
$DB->query("UPDATE reportsv2 SET
|
||||||
|
Status='Resolved',
|
||||||
|
LastChangeTime='".sqltime()."',
|
||||||
|
ModComment='Report already dealt with (Torrent deleted)'
|
||||||
|
WHERE TorrentID=".$ID."
|
||||||
|
AND Status != 'Resolved'");
|
||||||
|
$Reports = $DB->affected_rows();
|
||||||
|
if ($Reports) {
|
||||||
|
$Cache->decrement('num_torrent_reportsv2', $Reports);
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("DELETE FROM torrents_files WHERE TorrentID='$ID'");
|
||||||
|
$DB->query("DELETE FROM torrents_bad_tags WHERE TorrentID = ".$ID);
|
||||||
|
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$ID);
|
||||||
|
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID = ".$ID);
|
||||||
|
$DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID = ".$ID);
|
||||||
|
$DB->query("DELETE FROM torrents_lossymaster_approved WHERE TorrentID = ".$ID);
|
||||||
|
$DB->query("DELETE FROM torrents_lossyweb_approved WHERE TorrentID = ".$ID);
|
||||||
|
$Cache->delete_value('torrent_download_'.$ID);
|
||||||
|
$Cache->delete_value('torrent_group_'.$GroupID);
|
||||||
|
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a group, called after all of its torrents have been deleted.
|
||||||
|
* IMPORTANT: Never call this unless you're certain the group is no longer used by any torrents
|
||||||
|
*
|
||||||
|
* @param int $GroupID
|
||||||
|
*/
|
||||||
|
public static function delete_group($GroupID) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
|
||||||
|
Misc::write_log("Group ".$GroupID." automatically deleted (No torrents have this group).");
|
||||||
|
|
||||||
|
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
|
||||||
|
list($Category) = $DB->next_record();
|
||||||
|
if ($Category == 1) {
|
||||||
|
$Cache->decrement('stats_album_count');
|
||||||
|
}
|
||||||
|
$Cache->decrement('stats_group_count');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Collages
|
||||||
|
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'");
|
||||||
|
if ($DB->record_count()>0) {
|
||||||
|
$CollageIDs = $DB->collect('CollageID');
|
||||||
|
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-1 WHERE ID IN (".implode(', ',$CollageIDs).")");
|
||||||
|
$DB->query("DELETE FROM collages_torrents WHERE GroupID='$GroupID'");
|
||||||
|
|
||||||
|
foreach ($CollageIDs as $CollageID) {
|
||||||
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
|
}
|
||||||
|
$Cache->delete_value('torrent_collages_'.$GroupID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
// Collect the artist IDs and then wipe the torrents_artist entry
|
||||||
|
$DB->query("SELECT ArtistID FROM torrents_artists WHERE GroupID = ".$GroupID);
|
||||||
|
$Artists = $DB->collect('ArtistID');
|
||||||
|
|
||||||
|
$DB->query("DELETE FROM torrents_artists WHERE GroupID='$GroupID'");
|
||||||
|
|
||||||
|
foreach ($Artists as $ArtistID) {
|
||||||
|
if (empty($ArtistID)) { continue; }
|
||||||
|
// Get a count of how many groups or requests use the artist ID
|
||||||
|
$DB->query("SELECT COUNT(ag.ArtistID)
|
||||||
|
FROM artists_group as ag
|
||||||
|
LEFT JOIN requests_artists AS ra ON ag.ArtistID=ra.ArtistID
|
||||||
|
WHERE ra.ArtistID IS NOT NULL
|
||||||
|
AND ag.ArtistID = '$ArtistID'");
|
||||||
|
list($ReqCount) = $DB->next_record();
|
||||||
|
$DB->query("SELECT COUNT(ag.ArtistID)
|
||||||
|
FROM artists_group as ag
|
||||||
|
LEFT JOIN torrents_artists AS ta ON ag.ArtistID=ta.ArtistID
|
||||||
|
WHERE ta.ArtistID IS NOT NULL
|
||||||
|
AND ag.ArtistID = '$ArtistID'");
|
||||||
|
list($GroupCount) = $DB->next_record();
|
||||||
|
if (($ReqCount + $GroupCount) == 0) {
|
||||||
|
//The only group to use this artist
|
||||||
|
Artists::delete_artist($ArtistID);
|
||||||
|
} else {
|
||||||
|
//Not the only group, still need to clear cache
|
||||||
|
$Cache->delete_value('artist_'.$ArtistID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Requests
|
||||||
|
$DB->query("SELECT ID FROM requests WHERE GroupID='$GroupID'");
|
||||||
|
$Requests = $DB->collect('ID');
|
||||||
|
$DB->query("UPDATE requests SET GroupID = NULL WHERE GroupID = '$GroupID'");
|
||||||
|
foreach ($Requests as $RequestID) {
|
||||||
|
$Cache->delete_value('request_'.$RequestID);
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("DELETE FROM torrents_group WHERE ID='$GroupID'");
|
||||||
|
$DB->query("DELETE FROM torrents_tags WHERE GroupID='$GroupID'");
|
||||||
|
$DB->query("DELETE FROM torrents_tags_votes WHERE GroupID='$GroupID'");
|
||||||
|
$DB->query("DELETE FROM torrents_comments WHERE GroupID='$GroupID'");
|
||||||
|
$DB->query("DELETE FROM bookmarks_torrents WHERE GroupID='$GroupID'");
|
||||||
|
$DB->query("DELETE FROM wiki_torrents WHERE PageID='$GroupID'");
|
||||||
|
|
||||||
|
// Tells Sphinx that the group is removed
|
||||||
|
$DB->query("REPLACE INTO sphinx_delta (ID,Time) VALUES ('$GroupID',UNIX_TIMESTAMP())");
|
||||||
|
|
||||||
|
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||||
|
$Cache->delete_value('torrent_group_'.$GroupID);
|
||||||
|
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the cache and sphinx delta index to keep everything up to date.
|
||||||
|
*
|
||||||
|
* @param int $GroupID
|
||||||
|
*/
|
||||||
|
public static function update_hash($GroupID) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
$DB->query("UPDATE torrents_group SET TagList=(SELECT REPLACE(GROUP_CONCAT(tags.Name SEPARATOR ' '),'.','_')
|
||||||
|
FROM torrents_tags AS t
|
||||||
|
INNER JOIN tags ON tags.ID=t.TagID
|
||||||
|
WHERE t.GroupID='$GroupID'
|
||||||
|
GROUP BY t.GroupID)
|
||||||
|
WHERE ID='$GroupID'");
|
||||||
|
|
||||||
|
$DB->query("REPLACE INTO sphinx_delta
|
||||||
|
(ID, GroupName, TagList, Year, CategoryID, Time, ReleaseType, RecordLabel,
|
||||||
|
CatalogueNumber, VanityHouse, Size, Snatched, Seeders, Leechers, LogScore,
|
||||||
|
Scene, HasLog, HasCue, FreeTorrent, Media, Format, Encoding, RemasterYear,
|
||||||
|
RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, FileList)
|
||||||
|
SELECT
|
||||||
|
g.ID AS ID,
|
||||||
|
g.Name AS GroupName,
|
||||||
|
g.TagList,
|
||||||
|
g.Year,
|
||||||
|
g.CategoryID,
|
||||||
|
UNIX_TIMESTAMP(g.Time) AS Time,
|
||||||
|
g.ReleaseType,
|
||||||
|
g.RecordLabel,
|
||||||
|
g.CatalogueNumber,
|
||||||
|
g.VanityHouse,
|
||||||
|
MAX(CEIL(t.Size/1024)) AS Size,
|
||||||
|
SUM(t.Snatched) AS Snatched,
|
||||||
|
SUM(t.Seeders) AS Seeders,
|
||||||
|
SUM(t.Leechers) AS Leechers,
|
||||||
|
MAX(t.LogScore) AS LogScore,
|
||||||
|
MAX(t.Scene) AS Scene,
|
||||||
|
MAX(t.HasLog) AS HasLog,
|
||||||
|
MAX(t.HasCue) AS HasCue,
|
||||||
|
BIT_OR(t.FreeTorrent-1) AS FreeTorrent,
|
||||||
|
GROUP_CONCAT(DISTINCT t.Media SEPARATOR ' ') AS Media,
|
||||||
|
GROUP_CONCAT(DISTINCT t.Format SEPARATOR ' ') AS Format,
|
||||||
|
GROUP_CONCAT(DISTINCT t.Encoding SEPARATOR ' ') AS Encoding,
|
||||||
|
GROUP_CONCAT(DISTINCT t.RemasterYear SEPARATOR ' ') AS RemasterYear,
|
||||||
|
GROUP_CONCAT(DISTINCT t.RemasterTitle SEPARATOR ' ') AS RemasterTitle,
|
||||||
|
GROUP_CONCAT(DISTINCT t.RemasterRecordLabel SEPARATOR ' ') AS RemasterRecordLabel,
|
||||||
|
GROUP_CONCAT(DISTINCT t.RemasterCatalogueNumber SEPARATOR ' ') AS RemasterCatalogueNumber,
|
||||||
|
GROUP_CONCAT(REPLACE(REPLACE(FileList, '|||', '\n '), '_', ' ') SEPARATOR '\n ') AS FileList
|
||||||
|
FROM torrents AS t
|
||||||
|
JOIN torrents_group AS g ON g.ID=t.GroupID
|
||||||
|
WHERE g.ID=$GroupID
|
||||||
|
GROUP BY g.ID");
|
||||||
|
|
||||||
|
$DB->query("INSERT INTO sphinx_delta
|
||||||
|
(ID, ArtistName)
|
||||||
|
SELECT
|
||||||
|
GroupID,
|
||||||
|
GROUP_CONCAT(aa.Name separator ' ')
|
||||||
|
FROM torrents_artists AS ta
|
||||||
|
JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
|
||||||
|
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||||
|
WHERE ta.GroupID=$GroupID AND ta.Importance IN ('1', '4', '5', '6')
|
||||||
|
GROUP BY tg.ID
|
||||||
|
ON DUPLICATE KEY UPDATE ArtistName=values(ArtistName)");
|
||||||
|
|
||||||
|
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||||
|
$Cache->delete_value('torrent_group_'.$GroupID);
|
||||||
|
|
||||||
|
$ArtistInfo = Artists::get_artist($GroupID);
|
||||||
|
foreach ($ArtistInfo as $Importances => $Importance) {
|
||||||
|
foreach ($Importance as $Artist) {
|
||||||
|
$Cache->delete_value('artist_'.$Artist['id']); //Needed for at least freeleech change, if not others.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the information about a torrent.
|
||||||
|
* @param $Data an array a subset of the following keys:
|
||||||
|
* Format, Encoding, HasLog, LogScore HasCue, Media, Scene, RemasterYear
|
||||||
|
* RemasterTitle, FreeTorrent, PersonalFL
|
||||||
|
* @param boolean $ShowMedia if false, Media key will be omitted
|
||||||
|
* @param boolean $ShowEdition if false, RemasterYear/RemasterTitle will be omitted
|
||||||
|
*/
|
||||||
|
public static function torrent_info($Data, $ShowMedia = false, $ShowEdition = false) {
|
||||||
|
$Info = array();
|
||||||
|
if (!empty($Data['Format'])) { $Info[]=$Data['Format']; }
|
||||||
|
if (!empty($Data['Encoding'])) { $Info[]=$Data['Encoding']; }
|
||||||
|
if (!empty($Data['HasLog'])) {
|
||||||
|
$Str = 'Log';
|
||||||
|
if (!empty($Data['LogScore'])) {
|
||||||
|
$Str.=' ('.$Data['LogScore'].'%)';
|
||||||
|
}
|
||||||
|
$Info[]=$Str;
|
||||||
|
}
|
||||||
|
if (!empty($Data['HasCue'])) { $Info[]='Cue'; }
|
||||||
|
if ($ShowMedia && !empty($Data['Media'])) { $Info[]=$Data['Media']; }
|
||||||
|
if (!empty($Data['Scene'])) { $Info[]='Scene'; }
|
||||||
|
if ($ShowEdition) {
|
||||||
|
$EditionInfo = array();
|
||||||
|
if (!empty($Data['RemasterYear'])) { $EditionInfo[]=$Data['RemasterYear']; }
|
||||||
|
if (!empty($Data['RemasterTitle'])) { $EditionInfo[]=$Data['RemasterTitle']; }
|
||||||
|
if (count($EditionInfo)) { $Info[]=implode(' ',$EditionInfo); }
|
||||||
|
}
|
||||||
|
if ($Data['FreeTorrent'] == '1') { $Info[]='<strong>Freeleech!</strong>'; }
|
||||||
|
if ($Data['FreeTorrent'] == '2') { $Info[]='<strong>Neutral Leech!</strong>'; }
|
||||||
|
if ($Data['PersonalFL'] == 1) { $Info[]='<strong>Personal Freeleech!</strong>'; }
|
||||||
|
return implode(' / ', $Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will freeleech / neutralleech / normalise a set of torrents
|
||||||
|
*
|
||||||
|
* @param array $TorrentIDs An array of torrents IDs to iterate over
|
||||||
|
* @param int $FreeNeutral 0 = normal, 1 = fl, 2 = nl
|
||||||
|
* @param int $FreeLeechType 0 = Unknown, 1 = Staff picks, 2 = Perma-FL (Toolbox, etc.), 3 = Vanity House
|
||||||
|
*/
|
||||||
|
public static function freeleech_torrents($TorrentIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
|
||||||
|
global $DB, $Cache, $LoggedUser;
|
||||||
|
|
||||||
|
if (!is_array($TorrentIDs)) {
|
||||||
|
$TorrentIDs = array($TorrentIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("UPDATE torrents SET FreeTorrent = '".$FreeNeutral."', FreeLeechType = '".$FreeLeechType
|
||||||
|
."' WHERE ID IN (".implode(", ", $TorrentIDs).")");
|
||||||
|
|
||||||
|
$DB->query("SELECT ID, GroupID, info_hash FROM torrents WHERE ID IN (".implode(", ", $TorrentIDs).") ORDER BY GroupID ASC");
|
||||||
|
$Torrents = $DB->to_array(false, MYSQLI_NUM, false);
|
||||||
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
|
|
||||||
|
foreach ($Torrents as $Torrent) {
|
||||||
|
list($TorrentID, $GroupID, $InfoHash) = $Torrent;
|
||||||
|
Tracker::update_tracker('update_torrent', array('info_hash' => rawurlencode($InfoHash), 'freetorrent' => $FreeNeutral));
|
||||||
|
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||||
|
Misc::write_log($LoggedUser['Username']." marked torrent ".$TorrentID." freeleech type ".$FreeLeechType."!");
|
||||||
|
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "marked as freeleech type ".$FreeLeechType."!", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($GroupIDs as $GroupID) {
|
||||||
|
Torrents::update_hash($GroupID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to allow for passing groups to Torrents::freeleech_torrents()
|
||||||
|
*
|
||||||
|
* @param array $GroupIDs the groups in question
|
||||||
|
* @param int $FreeNeutral see Torrents::freeleech_torrents()
|
||||||
|
* @param int $FreeLeechType see Torrents::freeleech_torrents()
|
||||||
|
*/
|
||||||
|
public static function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechType = 0) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if (!is_array($GroupIDs)) {
|
||||||
|
$GroupIDs = array($GroupIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("SELECT ID from torrents WHERE GroupID IN (".implode(", ", $GroupIDs).")");
|
||||||
|
if ($DB->record_count()) {
|
||||||
|
$TorrentIDs = $DB->collect('ID');
|
||||||
|
Torrents::freeleech_torrents($TorrentIDs, $FreeNeutral, $FreeLeechType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
73
classes/class_tracker.php
Normal file
73
classes/class_tracker.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?
|
||||||
|
// TODO: Turn this into a class with nice functions like update_user, delete_torrent, etc.
|
||||||
|
class Tracker {
|
||||||
|
/**
|
||||||
|
* Send a GET request over a socket directly to the tracker
|
||||||
|
* For example, Tracker::update_tracker('change_passkey', array('oldpasskey' => OLD_PASSKEY, 'newpasskey' => NEW_PASSKEY)) will send the request:
|
||||||
|
* GET /tracker_32_char_secret_code/update?action=change_passkey&oldpasskey=OLD_PASSKEY&newpasskey=NEW_PASSKEY HTTP/1.1
|
||||||
|
*
|
||||||
|
* @param string $Action The action to send
|
||||||
|
* @param array $Updates An associative array of key->value pairs to send to the tracker
|
||||||
|
* @param boolean $ToIRC Sends a message to the channel #tracker with the GET URL.
|
||||||
|
*/
|
||||||
|
function update_tracker($Action, $Updates, $ToIRC = false) {
|
||||||
|
global $Cache;
|
||||||
|
//Build request
|
||||||
|
$Get = '/update?action='.$Action;
|
||||||
|
foreach ($Updates as $Key => $Value) {
|
||||||
|
$Get .= '&'.$Key.'='.$Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ToIRC != false) {
|
||||||
|
send_irc('PRIVMSG #tracker :'.$Get);
|
||||||
|
}
|
||||||
|
$Path = TRACKER_SECRET.$Get;
|
||||||
|
|
||||||
|
$Return = "";
|
||||||
|
$Attempts = 0;
|
||||||
|
while ($Return != "success" && $Attempts < 3) {
|
||||||
|
|
||||||
|
// Send update
|
||||||
|
$File = fsockopen(TRACKER_HOST, TRACKER_PORT, $ErrorNum, $ErrorString);
|
||||||
|
if ($File) {
|
||||||
|
$Header = 'GET /'.$Path.' HTTP/1.1\r\n';
|
||||||
|
if (fwrite($File, $Header) === false) {
|
||||||
|
$Attempts++;
|
||||||
|
$Err = "Failed to fwrite()";
|
||||||
|
sleep(3);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$Attempts++;
|
||||||
|
$Err = "Failed to fsockopen() - ".$ErrorNum." - ".$ErrorString;
|
||||||
|
sleep(6);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for response.
|
||||||
|
|
||||||
|
$ResHeader = '';
|
||||||
|
do {
|
||||||
|
$ResHeader .= fread($File, 1);
|
||||||
|
} while (!feof($File) && !Misc::ends_with($ResHeader, "\r\n\r\n"));
|
||||||
|
|
||||||
|
$Response = '';
|
||||||
|
while($Line = fgets($File)) {
|
||||||
|
$Response .= $Line;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Return = chop($Response);
|
||||||
|
$Attempts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Return != "success") {
|
||||||
|
send_irc("PRIVMSG #tracker :{$Attempts} {$Err} {$Get}");
|
||||||
|
if ($Cache->get_value('ocelot_error_reported') === false) {
|
||||||
|
send_irc("PRIVMSG ".ADMIN_CHAN." :Failed to update ocelot: ".$Err." : ".$Get);
|
||||||
|
$Cache->cache_value('ocelot_error_reported', true, 900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($Return == "success");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
452
classes/class_users.php
Normal file
452
classes/class_users.php
Normal file
@ -0,0 +1,452 @@
|
|||||||
|
<?
|
||||||
|
class Users {
|
||||||
|
/**
|
||||||
|
* Get $Classes (list of classes keyed by ID) and $ClassLevels
|
||||||
|
* (list of classes keyed by level)
|
||||||
|
* @return array ($Classes, $ClassLevels)
|
||||||
|
*/
|
||||||
|
public static function get_classes() {
|
||||||
|
global $Cache, $DB, $Debug;
|
||||||
|
// Get permissions
|
||||||
|
list($Classes, $ClassLevels) = $Cache->get_value('classes');
|
||||||
|
if (!$Classes || !$ClassLevels) {
|
||||||
|
$DB->query('SELECT ID, Name, Level, Secondary FROM permissions ORDER BY Level');
|
||||||
|
$Classes = $DB->to_array('ID');
|
||||||
|
$ClassLevels = $DB->to_array('Level');
|
||||||
|
$Cache->cache_value('classes', array($Classes, $ClassLevels), 0);
|
||||||
|
}
|
||||||
|
$Debug->set_flag('Loaded permissions');
|
||||||
|
|
||||||
|
return array($Classes, $ClassLevels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user info, is used for the current user and usernames all over the site.
|
||||||
|
*
|
||||||
|
* @param $UserID int The UserID to get info for
|
||||||
|
* @return array with the following keys:
|
||||||
|
* int ID
|
||||||
|
* string Username
|
||||||
|
* int PermissionID
|
||||||
|
* array Paranoia - $Paranoia array sent to class_paranoia
|
||||||
|
* boolean Artist
|
||||||
|
* boolean Donor
|
||||||
|
* string Warned - When their warning expires in international time format
|
||||||
|
* string Avatar - URL
|
||||||
|
* boolean Enabled
|
||||||
|
* string Title
|
||||||
|
* string CatchupTime - When they last caught up on forums
|
||||||
|
* boolean Visible - If false, they don't show up on peer lists
|
||||||
|
* array ExtraClasses - Secondary classes.
|
||||||
|
* int EffectiveClass - the highest level of their main and secondary classes
|
||||||
|
*/
|
||||||
|
public static function user_info($UserID) {
|
||||||
|
global $DB, $Cache, $Classes, $SSL;
|
||||||
|
$UserInfo = $Cache->get_value('user_info_'.$UserID);
|
||||||
|
// the !isset($UserInfo['Paranoia']) can be removed after a transition period
|
||||||
|
if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) {
|
||||||
|
$OldQueryID = $DB->get_query_id();
|
||||||
|
|
||||||
|
|
||||||
|
$DB->query("SELECT
|
||||||
|
m.ID,
|
||||||
|
m.Username,
|
||||||
|
m.PermissionID,
|
||||||
|
m.Paranoia,
|
||||||
|
i.Artist,
|
||||||
|
i.Donor,
|
||||||
|
i.Warned,
|
||||||
|
i.Avatar,
|
||||||
|
m.Enabled,
|
||||||
|
m.Title,
|
||||||
|
i.CatchupTime,
|
||||||
|
m.Visible,
|
||||||
|
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels
|
||||||
|
FROM users_main AS m
|
||||||
|
INNER JOIN users_info AS i ON i.UserID=m.ID
|
||||||
|
LEFT JOIN users_levels AS ul ON ul.UserID = m.ID
|
||||||
|
WHERE m.ID='$UserID'
|
||||||
|
GROUP BY m.ID");
|
||||||
|
if ($DB->record_count() == 0) { // Deleted user, maybe?
|
||||||
|
$UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$UserInfo = $DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title'));
|
||||||
|
$UserInfo['CatchupTime'] = strtotime($UserInfo['CatchupTime']);
|
||||||
|
$UserInfo['Paranoia'] = unserialize($UserInfo['Paranoia']);
|
||||||
|
if ($UserInfo['Paranoia'] === false) {
|
||||||
|
$UserInfo['Paranoia'] = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$UserInfo['Class'] = $Classes[$UserInfo['PermissionID']]['Level'];
|
||||||
|
|
||||||
|
if (!empty($UserInfo['Levels'])) {
|
||||||
|
$UserInfo['ExtraClasses'] = array_fill_keys(explode(',', $UserInfo['Levels']), 1);
|
||||||
|
} else {
|
||||||
|
$UserInfo['ExtraClasses'] = array();
|
||||||
|
}
|
||||||
|
unset($UserInfo['Levels']);
|
||||||
|
$EffectiveClass = $Classes[$UserInfo['PermissionID']]['Level'];
|
||||||
|
foreach ($UserInfo['ExtraClasses'] as $Class => $Val) {
|
||||||
|
$EffectiveClass = max($EffectiveClass, $Classes[$Class]['Level']);
|
||||||
|
}
|
||||||
|
$UserInfo['EffectiveClass'] = $EffectiveClass;
|
||||||
|
|
||||||
|
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
|
||||||
|
$DB->set_query_id($OldQueryID);
|
||||||
|
}
|
||||||
|
if (strtotime($UserInfo['Warned']) < time()) {
|
||||||
|
$UserInfo['Warned'] = '0000-00-00 00:00:00';
|
||||||
|
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Image proxy
|
||||||
|
if (check_perms('site_proxy_images') && !empty($UserInfo['Avatar'])) {
|
||||||
|
$UserInfo['Avatar'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&avatar='.$UserID.'&i='.urlencode($UserInfo['Avatar']);
|
||||||
|
}
|
||||||
|
return $UserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the heavy user info
|
||||||
|
* Only used for current user
|
||||||
|
*
|
||||||
|
* @param $UserID The userid to get the information for
|
||||||
|
* @return fetched heavy info.
|
||||||
|
* Just read the goddamn code, I don't have time to comment this shit.
|
||||||
|
*/
|
||||||
|
public static function user_heavy_info($UserID) {
|
||||||
|
global $DB, $Cache;
|
||||||
|
//global $Debug;
|
||||||
|
|
||||||
|
$HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID);
|
||||||
|
|
||||||
|
if (empty($HeavyInfo)) {
|
||||||
|
|
||||||
|
$DB->query("SELECT
|
||||||
|
m.Invites,
|
||||||
|
m.torrent_pass,
|
||||||
|
m.IP,
|
||||||
|
m.CustomPermissions,
|
||||||
|
m.can_leech AS CanLeech,
|
||||||
|
i.AuthKey,
|
||||||
|
i.RatioWatchEnds,
|
||||||
|
i.RatioWatchDownload,
|
||||||
|
i.StyleID,
|
||||||
|
i.StyleURL,
|
||||||
|
i.DisableInvites,
|
||||||
|
i.DisablePosting,
|
||||||
|
i.DisableUpload,
|
||||||
|
i.DisableWiki,
|
||||||
|
i.DisableAvatar,
|
||||||
|
i.DisablePM,
|
||||||
|
i.DisableRequests,
|
||||||
|
i.DisableForums,
|
||||||
|
i.SiteOptions,
|
||||||
|
i.DownloadAlt,
|
||||||
|
i.LastReadNews,
|
||||||
|
i.LastReadBlog,
|
||||||
|
i.RestrictedForums,
|
||||||
|
i.PermittedForums,
|
||||||
|
m.FLTokens,
|
||||||
|
m.PermissionID
|
||||||
|
FROM users_main AS m
|
||||||
|
INNER JOIN users_info AS i ON i.UserID=m.ID
|
||||||
|
WHERE m.ID='$UserID'");
|
||||||
|
$HeavyInfo = $DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions'));
|
||||||
|
|
||||||
|
if (!empty($HeavyInfo['CustomPermissions'])) {
|
||||||
|
$HeavyInfo['CustomPermissions'] = unserialize($HeavyInfo['CustomPermissions']);
|
||||||
|
} else {
|
||||||
|
$HeavyInfo['CustomPermissions'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($HeavyInfo['RestrictedForums'])) {
|
||||||
|
$RestrictedForums = array_map('trim', explode(',', $HeavyInfo['RestrictedForums']));
|
||||||
|
} else {
|
||||||
|
$RestrictedForums = array();
|
||||||
|
}
|
||||||
|
unset($HeavyInfo['RestrictedForums']);
|
||||||
|
if (!empty($HeavyInfo['PermittedForums'])) {
|
||||||
|
$PermittedForums = array_map('trim', explode(',', $HeavyInfo['PermittedForums']));
|
||||||
|
} else {
|
||||||
|
$PermittedForums = array();
|
||||||
|
}
|
||||||
|
unset($HeavyInfo['PermittedForums']);
|
||||||
|
//$Debug->log_var($PermittedForums, 'PermittedForums - User');
|
||||||
|
|
||||||
|
$DB->query("SELECT PermissionID FROM users_levels WHERE UserID = $UserID");
|
||||||
|
$PermIDs = $DB->collect('PermissionID');
|
||||||
|
foreach ($PermIDs AS $PermID) {
|
||||||
|
$Perms = Permissions::get_permissions($PermID);
|
||||||
|
if (!empty($Perms['PermittedForums'])) {
|
||||||
|
//$Debug->log_var("'".$Perms['PermittedForums']."'", "PermittedForums - Perm $PermID");
|
||||||
|
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums'])));
|
||||||
|
//$Debug->log_var($PermittedForums, "PermittedForums - After Perm $PermID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$Perms = Permissions::get_permissions($HeavyInfo['PermissionID']);
|
||||||
|
unset($HeavyInfo['PermissionID']);
|
||||||
|
if (!empty($Perms['PermittedForums'])) {
|
||||||
|
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums'])));
|
||||||
|
}
|
||||||
|
//$Debug->log_var($PermittedForums, 'PermittedForums - Done');
|
||||||
|
|
||||||
|
if (!empty($PermittedForums) || !empty($RestrictedForums)) {
|
||||||
|
$HeavyInfo['CustomForums'] = array();
|
||||||
|
foreach ($RestrictedForums as $ForumID) {
|
||||||
|
$HeavyInfo['CustomForums'][$ForumID] = 0;
|
||||||
|
}
|
||||||
|
foreach ($PermittedForums as $ForumID) {
|
||||||
|
$HeavyInfo['CustomForums'][$ForumID] = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$HeavyInfo['CustomForums'] = null;
|
||||||
|
}
|
||||||
|
//$Debug->log_var($HeavyInfo['CustomForums'], 'CustomForums');
|
||||||
|
|
||||||
|
$HeavyInfo['SiteOptions'] = unserialize($HeavyInfo['SiteOptions']);
|
||||||
|
if (!empty($HeavyInfo['SiteOptions'])) {
|
||||||
|
$HeavyInfo = array_merge($HeavyInfo, $HeavyInfo['SiteOptions']);
|
||||||
|
}
|
||||||
|
unset($HeavyInfo['SiteOptions']);
|
||||||
|
|
||||||
|
$Cache->cache_value('user_info_heavy_'.$UserID, $HeavyInfo, 0);
|
||||||
|
}
|
||||||
|
return $HeavyInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the site options in the database
|
||||||
|
*
|
||||||
|
* @param int $UserID the UserID to set the options for
|
||||||
|
* @param array $NewOptions the new options to set
|
||||||
|
* @return false if $NewOptions is empty, true otherwise
|
||||||
|
*/
|
||||||
|
public static function update_site_options($UserID, $NewOptions) {
|
||||||
|
if (!is_number($UserID)) {
|
||||||
|
error(0);
|
||||||
|
}
|
||||||
|
if (empty($NewOptions)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
global $DB, $Cache, $LoggedUser;
|
||||||
|
|
||||||
|
// Get SiteOptions
|
||||||
|
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID = $UserID");
|
||||||
|
list($SiteOptions) = $DB->next_record(MYSQLI_NUM,false);
|
||||||
|
$SiteOptions = unserialize($SiteOptions);
|
||||||
|
|
||||||
|
// Get HeavyInfo
|
||||||
|
$HeavyInfo = Users::user_heavy_info($UserID);
|
||||||
|
|
||||||
|
// Insert new/replace old options
|
||||||
|
$SiteOptions = array_merge($SiteOptions, $NewOptions);
|
||||||
|
$HeavyInfo = array_merge($HeavyInfo, $NewOptions);
|
||||||
|
|
||||||
|
// Update DB
|
||||||
|
$DB->query("UPDATE users_info SET SiteOptions = '".db_string(serialize($SiteOptions))."' WHERE UserID = $UserID");
|
||||||
|
|
||||||
|
// Update cache
|
||||||
|
$Cache->cache_value('user_info_heavy_'.$UserID, $HeavyInfo, 0);
|
||||||
|
|
||||||
|
// Update $LoggedUser if the options are changed for the current
|
||||||
|
if ($LoggedUser['ID'] == $UserID) {
|
||||||
|
$LoggedUser = array_merge($LoggedUser, $NewOptions);
|
||||||
|
$LoggedUser['ID'] = $UserID; // We don't want to allow userid switching
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a random string
|
||||||
|
*
|
||||||
|
* @param Length
|
||||||
|
* @return random alphanumeric string
|
||||||
|
*/
|
||||||
|
public static function make_secret($Length = 32) {
|
||||||
|
$Secret = '';
|
||||||
|
$Chars='abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
$CharLen = strlen($Chars)-1;
|
||||||
|
for ($i = 0; $i < $Length; ++$i) {
|
||||||
|
$Secret .= $Chars[mt_rand(0, $CharLen)];
|
||||||
|
}
|
||||||
|
return $Secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a password hash. This method is deprecated and
|
||||||
|
* should not be used to create new passwords
|
||||||
|
*
|
||||||
|
* @param $Str password
|
||||||
|
* @param $Secret salt
|
||||||
|
* @return password hash
|
||||||
|
*/
|
||||||
|
public static function make_hash($Str,$Secret) {
|
||||||
|
return sha1(md5($Secret).$Str.sha1($Secret).SITE_SALT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify a password against a password hash
|
||||||
|
*
|
||||||
|
* @param $Password password
|
||||||
|
* @param $Hash password hash
|
||||||
|
* @param $Secret salt - Only used if the hash was created
|
||||||
|
* with the deprecated Users::make_hash() method
|
||||||
|
* @return true on correct password
|
||||||
|
*/
|
||||||
|
public static function check_password($Password, $Hash, $Secret='') {
|
||||||
|
if (!$Password || !$Hash) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Users::is_crypt_hash($Hash)) {
|
||||||
|
return crypt($Password, $Hash) == $Hash;
|
||||||
|
} elseif ($Secret) {
|
||||||
|
return Users::make_hash($Password, $Secret) == $Hash;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if a given hash is a crypt hash
|
||||||
|
*
|
||||||
|
* @param $Hash password hash
|
||||||
|
* @return true if hash is a crypt hash
|
||||||
|
*/
|
||||||
|
public static function is_crypt_hash($Hash) {
|
||||||
|
return preg_match('/\$\d[axy]?\$/', substr($Hash, 0, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create salted crypt hash for a given string with
|
||||||
|
* settings specified in CRYPT_HASH_PREFIX
|
||||||
|
*
|
||||||
|
* @param $Str string to hash
|
||||||
|
* @return salted crypt hash
|
||||||
|
*/
|
||||||
|
public static function make_crypt_hash($Str) {
|
||||||
|
$Salt = CRYPT_HASH_PREFIX.Users::gen_crypt_salt().'$';
|
||||||
|
return crypt($Str, $Salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create salt string for eksblowfish hashing. If /dev/urandom cannot be read,
|
||||||
|
* fall back to an unsecure method based on mt_rand(). The last character needs
|
||||||
|
* a special case as it must be either '.', 'O', 'e', or 'u'.
|
||||||
|
*
|
||||||
|
* @return salt suitable for eksblowfish hashing
|
||||||
|
*/
|
||||||
|
public static function gen_crypt_salt() {
|
||||||
|
$Salt = '';
|
||||||
|
$Chars = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
$Numchars = strlen($Chars) - 1;
|
||||||
|
if ($Handle = @fopen('/dev/urandom', 'r')) {
|
||||||
|
$Bytes = fread($Handle, 22);
|
||||||
|
for($i = 0; $i < 21; $i++) {
|
||||||
|
$Salt .= $Chars[ord($Bytes[$i]) & $Numchars];
|
||||||
|
}
|
||||||
|
$Salt[$i] = $Chars[(ord($Bytes[$i]) & 3) << 4];
|
||||||
|
} else {
|
||||||
|
for($i = 0; $i < 21; $i++) {
|
||||||
|
$Salt .= $Chars[mt_rand(0, $Numchars)];
|
||||||
|
}
|
||||||
|
$Salt[$i] = $Chars[mt_rand(0, 3) << 4];
|
||||||
|
}
|
||||||
|
return $Salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a username string for display
|
||||||
|
*
|
||||||
|
* @param int $UserID
|
||||||
|
* @param boolean $Badges whether or not badges (donor, warned, enabled) should be shown
|
||||||
|
* @param boolean $IsWarned -- TODO: Why the fuck do we need this?
|
||||||
|
* @param boolean $IsEnabled -- TODO: Why the fuck do we need this?
|
||||||
|
* @param boolean $Class whether or not to show the class
|
||||||
|
* @param boolean $Title whether or not to show the title
|
||||||
|
* @return HTML formatted username
|
||||||
|
*/
|
||||||
|
public static function format_username($UserID, $Badges = false, $IsWarned = true, $IsEnabled = true, $Class = false, $Title = false) {
|
||||||
|
global $Classes;
|
||||||
|
|
||||||
|
// This array is a hack that should be made less retarded, but whatevs
|
||||||
|
// PermID => ShortForm
|
||||||
|
$SecondaryClasses = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($UserID == 0) {
|
||||||
|
return 'System';
|
||||||
|
}
|
||||||
|
|
||||||
|
$UserInfo = Users::user_info($UserID);
|
||||||
|
if ($UserInfo['Username'] == '') {
|
||||||
|
return "Unknown [$UserID]";
|
||||||
|
}
|
||||||
|
|
||||||
|
$Str = '';
|
||||||
|
|
||||||
|
if ($Title) {
|
||||||
|
$Str .= '<strong><a href="user.php?id='.$UserID.'">'.$UserInfo['Username'].'</a></strong>';
|
||||||
|
} else {
|
||||||
|
$Str .= '<a href="user.php?id='.$UserID.'">'.$UserInfo['Username'].'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Badges) {
|
||||||
|
$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"><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned" /></a>' : '';
|
||||||
|
$Str .= ($IsEnabled && $UserInfo['Enabled'] == 2) ? '<a href="rules.php"><img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" /></a>' : '';
|
||||||
|
|
||||||
|
if ($Badges) {
|
||||||
|
$ClassesDisplay = array();
|
||||||
|
foreach($SecondaryClasses as $PermID => $PermHTML) {
|
||||||
|
if ($UserInfo['ExtraClasses'][$PermID]) {
|
||||||
|
$ClassesDisplay[] = '<span class="secondary_class" title="'.$Classes[$PermID]['Name'].'">'.$PermHTML.'</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($ClassesDisplay)) {
|
||||||
|
$Str .= ' '.implode(' ', $ClassesDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Class) {
|
||||||
|
if ($Title) {
|
||||||
|
$Str .= ' <strong>('.Users::make_class_string($UserInfo['PermissionID']).')</strong>';
|
||||||
|
} else {
|
||||||
|
$Str .= ' ('.Users::make_class_string($UserInfo['PermissionID']).')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Title) {
|
||||||
|
// Image proxy CTs
|
||||||
|
if (check_perms('site_proxy_images') && !empty($UserInfo['Title'])) {
|
||||||
|
$UserInfo['Title'] = preg_replace_callback('~src=("?)(http.+?)(["\s>])~',
|
||||||
|
function($Matches) {
|
||||||
|
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Matches[2]).$Matches[3];
|
||||||
|
},
|
||||||
|
$UserInfo['Title']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($UserInfo['Title']) {
|
||||||
|
$Str .= ' <span class="user_title">('.$UserInfo['Title'].')</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a class ID, return its name.
|
||||||
|
*
|
||||||
|
* @param int $ClassID
|
||||||
|
* @return string name
|
||||||
|
*/
|
||||||
|
public static function make_class_string($ClassID) {
|
||||||
|
global $Classes;
|
||||||
|
return $Classes[$ClassID]['Name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
73
classes/class_view.php
Normal file
73
classes/class_view.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?
|
||||||
|
class View {
|
||||||
|
/**
|
||||||
|
* This function is to include the header file on a page.
|
||||||
|
*
|
||||||
|
* @param $PageTitle the title of the page
|
||||||
|
* @param $JSIncludes is a comma separated list of js files to be inclides on
|
||||||
|
* the page, ONLY PUT THE RELATIVE LOCATION WITHOUT .js
|
||||||
|
* ex: 'somefile,somdire/somefile'
|
||||||
|
*/
|
||||||
|
public static function show_header($PageTitle='',$JSIncludes='') {
|
||||||
|
global $Document, $Cache, $DB, $LoggedUser, $Mobile, $Classes;
|
||||||
|
|
||||||
|
if($PageTitle!='') { $PageTitle.=' :: '; }
|
||||||
|
$PageTitle .= SITE_NAME;
|
||||||
|
|
||||||
|
if(!is_array($LoggedUser) || empty($LoggedUser['ID'])) {
|
||||||
|
require(SERVER_ROOT.'/design/publicheader.php');
|
||||||
|
} else {
|
||||||
|
require(SERVER_ROOT.'/design/privateheader.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is to include the footer file on a page.
|
||||||
|
*
|
||||||
|
* @param $Options an optional array that you can pass information to the
|
||||||
|
* header through as well as setup certain limitations
|
||||||
|
* Here is a list of parameters that work in the $Options array:
|
||||||
|
* ['disclaimer'] = [boolean] (False) Displays the disclaimer in the footer
|
||||||
|
*/
|
||||||
|
public static function show_footer($Options=array()) {
|
||||||
|
global $ScriptStartTime, $LoggedUser, $Cache, $DB, $SessionID, $UserSessions, $Debug, $Time;
|
||||||
|
if (!is_array($LoggedUser)) { require(SERVER_ROOT.'/design/publicfooter.php'); }
|
||||||
|
else { require(SERVER_ROOT.'/design/privatefooter.php'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a generic function to load a template fromm /design and render it.
|
||||||
|
* The template should be in /design/my_template_name.php, and have a class
|
||||||
|
* in it called MyTemplateNameTemplate (my_template_name transformed to
|
||||||
|
* MixedCase, with the word 'Template' appended).
|
||||||
|
* This class should have a public static function render($Args), where
|
||||||
|
* $Args is an associative array of the template variables.
|
||||||
|
* You should note that by "Template", we mean "php file that outputs stuff".
|
||||||
|
*
|
||||||
|
* This function loads /design/$TemplateName.php, and then calls
|
||||||
|
* render($Args) on the class.
|
||||||
|
*
|
||||||
|
* @param string $TemplateName The name of the template, in underscore_format
|
||||||
|
* @param array $Args the arguments passed to the template.
|
||||||
|
*/
|
||||||
|
public static function render_template($TemplateName, $Args) {
|
||||||
|
static $LoadedTemplates; // Keep track of templates we've already loaded.
|
||||||
|
$ClassName = '';
|
||||||
|
if (isset($LoadedTemplates[$TemplateName])) {
|
||||||
|
$ClassName = $LoadedTemplates[$TemplateName];
|
||||||
|
} else {
|
||||||
|
include(SERVER_ROOT.'/design/' . $TemplateName . '.php');
|
||||||
|
|
||||||
|
// Turn template_name into TemplateName
|
||||||
|
$ClassNameParts = explode('_', $TemplateName);
|
||||||
|
foreach ($ClassNameParts as $Index => $Part) {
|
||||||
|
$ClassNameParts[$Index] = ucfirst($Part);
|
||||||
|
}
|
||||||
|
$ClassName = implode($ClassNameParts). 'Template';
|
||||||
|
$LoadedTemplates[$TemplateName] = $ClassName;
|
||||||
|
}
|
||||||
|
$ClassName::render($Args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -61,7 +61,7 @@
|
|||||||
require('classes/class_zip.php');
|
require('classes/class_zip.php');
|
||||||
$Zip = new ZIP('FileName');
|
$Zip = new ZIP('FileName');
|
||||||
$Name = 'Ubuntu-8.10';
|
$Name = 'Ubuntu-8.10';
|
||||||
$Zip->add_file($TorrentData, 'Torrents/'.file_string($Name).'.torrent');
|
$Zip->add_file($TorrentData, 'Torrents/'.Misc::file_string($Name).'.torrent');
|
||||||
$Zip->add_file(file_get_contents('zip.php'), 'zip.php');
|
$Zip->add_file(file_get_contents('zip.php'), 'zip.php');
|
||||||
$Zip->close_stream();
|
$Zip->close_stream();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
95
classes/util.php
Normal file
95
classes/util.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?
|
||||||
|
// This is a file of miscellaneous functions that are called so damn often
|
||||||
|
// that it'd just be annoying to stick them in namespaces.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the given string is numeric.
|
||||||
|
*
|
||||||
|
* @param string $Str
|
||||||
|
* @return true if $Str numeric
|
||||||
|
*/
|
||||||
|
function is_number($Str) {
|
||||||
|
$Return = true;
|
||||||
|
if ($Str < 0) { $Return = false; }
|
||||||
|
// We're converting input to a int, then string and comparing to original
|
||||||
|
$Return = ($Str == strval(intval($Str)) ? true : false);
|
||||||
|
return $Return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTML-escape a string for output.
|
||||||
|
* This is preferable to htmlspecialchars because it doesn't screw up upon a double escape.
|
||||||
|
*
|
||||||
|
* @param string $Str
|
||||||
|
* @return string escaped string.
|
||||||
|
*/
|
||||||
|
function display_str($Str) {
|
||||||
|
if ($Str === NULL || $Str === FALSE || is_array($Str)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ($Str!='' && !is_number($Str)) {
|
||||||
|
$Str = Format::make_utf8($Str);
|
||||||
|
$Str = mb_convert_encoding($Str,"HTML-ENTITIES","UTF-8");
|
||||||
|
$Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m","&",$Str);
|
||||||
|
|
||||||
|
$Replace = array(
|
||||||
|
"'",'"',"<",">",
|
||||||
|
'€','‚','ƒ','„','…','†','‡','ˆ',
|
||||||
|
'‰','Š','‹','Œ','Ž','‘','’','“',
|
||||||
|
'”','•','–','—','˜','™','š','›',
|
||||||
|
'œ','ž','Ÿ'
|
||||||
|
);
|
||||||
|
|
||||||
|
$With = array(
|
||||||
|
''','"','<','>',
|
||||||
|
'€','‚','ƒ','„','…','†','‡','ˆ',
|
||||||
|
'‰','Š','‹','Œ','Ž','‘','’','“',
|
||||||
|
'”','•','–','—','˜','™','š','›',
|
||||||
|
'œ','ž','Ÿ'
|
||||||
|
);
|
||||||
|
|
||||||
|
$Str = str_replace($Replace, $With, $Str);
|
||||||
|
}
|
||||||
|
return $Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message to an IRC bot listening on SOCKET_LISTEN_PORT
|
||||||
|
*
|
||||||
|
* @param string $Raw An IRC protocol snippet to send.
|
||||||
|
*/
|
||||||
|
function send_irc($Raw) {
|
||||||
|
$IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
|
||||||
|
$Raw = str_replace(array("\n", "\r"), '', $Raw);
|
||||||
|
fwrite($IRCSocket, $Raw);
|
||||||
|
fclose($IRCSocket);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a critical error and kills the page.
|
||||||
|
*
|
||||||
|
* @param string $Error Error type. Automatically supported:
|
||||||
|
* 403, 404, 0 (invalid input), -1 (invalid request)
|
||||||
|
* If you use your own string for Error, it becomes the error description.
|
||||||
|
* @param boolean $Ajax If true, the header/footer won't be shown, just the description.
|
||||||
|
* @param string $Log If true, the user is given a link to search $Log in the site log.
|
||||||
|
*/
|
||||||
|
function error($Error, $Ajax=false, $Log=false) {
|
||||||
|
global $Debug;
|
||||||
|
require(SERVER_ROOT.'/sections/error/index.php');
|
||||||
|
$Debug->profile();
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function. See doc in class_permissions.php
|
||||||
|
*/
|
||||||
|
function check_perms($PermissionName, $MinClass = 0) {
|
||||||
|
return Permissions::check_perms($PermissionName, $MinClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -24,7 +24,7 @@
|
|||||||
<? if(!empty($LastActive)){ ?><p><a href="user.php?action=sessions" title="Manage Sessions">Last activity <?=time_diff($LastActive['LastUpdate'])?> from <?=$LastActive['IP']?>.</a></p><? } ?>
|
<? if(!empty($LastActive)){ ?><p><a href="user.php?action=sessions" title="Manage Sessions">Last activity <?=time_diff($LastActive['LastUpdate'])?> from <?=$LastActive['IP']?>.</a></p><? } ?>
|
||||||
<p>
|
<p>
|
||||||
<strong>Time:</strong> <?=number_format(((microtime(true)-$ScriptStartTime)*1000),5)?> ms
|
<strong>Time:</strong> <?=number_format(((microtime(true)-$ScriptStartTime)*1000),5)?> ms
|
||||||
<strong>Used:</strong> <?=get_size(memory_get_usage(true))?>
|
<strong>Used:</strong> <?=Format::get_size(memory_get_usage(true))?>
|
||||||
<strong>Load:</strong> <?=number_format($Load[0],2).' '.number_format($Load[1],2).' '.number_format($Load[2],2)?>
|
<strong>Load:</strong> <?=number_format($Load[0],2).' '.number_format($Load[1],2).' '.number_format($Load[2],2)?>
|
||||||
<strong>Date:</strong> <?=date('M d Y, H:i')?>
|
<strong>Date:</strong> <?=date('M d Y, H:i')?>
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul id="userinfo_stats">
|
<ul id="userinfo_stats">
|
||||||
<li id="stats_seeding"><a href="torrents.php?type=seeding&userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat"><?=get_size($LoggedUser['BytesUploaded'])?></span></li>
|
<li id="stats_seeding"><a href="torrents.php?type=seeding&userid=<?=$LoggedUser['ID']?>">Up</a>: <span class="stat"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span></li>
|
||||||
<li id="stats_leeching"><a href="torrents.php?type=leeching&userid=<?=$LoggedUser['ID']?>">Down</a>: <span class="stat"><?=get_size($LoggedUser['BytesDownloaded'])?></span></li>
|
<li id="stats_leeching"><a href="torrents.php?type=leeching&userid=<?=$LoggedUser['ID']?>">Down</a>: <span class="stat"><?=Format::get_size($LoggedUser['BytesDownloaded'])?></span></li>
|
||||||
<li id="stats_ratio">Ratio: <span class="stat"><?=ratio($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span></li>
|
<li id="stats_ratio">Ratio: <span class="stat"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span></li>
|
||||||
<? if(!empty($LoggedUser['RequiredRatio'])) {?>
|
<? if(!empty($LoggedUser['RequiredRatio'])) {?>
|
||||||
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
|
<li id="stats_required"><a href="rules.php?p=ratio">Required</a>: <span class="stat"><?=number_format($LoggedUser['RequiredRatio'], 2)?></span></li>
|
||||||
<? }
|
<? }
|
||||||
|
@ -53,7 +53,7 @@ function invisible($Image) {
|
|||||||
$TotalAlpha += $Color['alpha'];
|
$TotalAlpha += $Color['alpha'];
|
||||||
}
|
}
|
||||||
return (($TotalAlpha/$Count) == 127) ? true : false;
|
return (($TotalAlpha/$Count) == 127) ? true : false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_number($Str) {
|
function is_number($Str) {
|
||||||
|
@ -11,10 +11,6 @@ function compare($X, $Y){
|
|||||||
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;
|
||||||
|
|
||||||
// Similar artist map
|
|
||||||
include(SERVER_ROOT.'/classes/class_artist.php');
|
|
||||||
include(SERVER_ROOT.'/classes/class_artists_similar.php');
|
|
||||||
|
|
||||||
$ArtistID = $_GET['id'];
|
$ArtistID = $_GET['id'];
|
||||||
if(!is_number($ArtistID)) {
|
if(!is_number($ArtistID)) {
|
||||||
print json_encode(array('status' => 'failure'));
|
print json_encode(array('status' => 'failure'));
|
||||||
@ -53,7 +49,7 @@ function compare($X, $Y){
|
|||||||
wiki.Image,
|
wiki.Image,
|
||||||
wiki.body,
|
wiki.body,
|
||||||
a.VanityHouse
|
a.VanityHouse
|
||||||
FROM wiki_artists AS wiki
|
FROM wiki_artists AS wiki
|
||||||
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
||||||
WHERE wiki.RevisionID='$RevisionID' ";
|
WHERE wiki.RevisionID='$RevisionID' ";
|
||||||
} else {
|
} else {
|
||||||
@ -91,7 +87,7 @@ function compare($X, $Y){
|
|||||||
SUM(rv.Bounty) AS Bounty
|
SUM(rv.Bounty) AS Bounty
|
||||||
FROM requests AS r
|
FROM requests AS r
|
||||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
||||||
WHERE ra.ArtistID = ".$ArtistID."
|
WHERE ra.ArtistID = ".$ArtistID."
|
||||||
AND r.TorrentID = 0
|
AND r.TorrentID = 0
|
||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
@ -108,18 +104,18 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$LastReleaseType = 0;
|
$LastReleaseType = 0;
|
||||||
if(empty($Importances) || empty($TorrentList)) {
|
if(empty($Importances) || empty($TorrentList)) {
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
|
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
|
||||||
FROM torrents_artists AS ta
|
FROM torrents_artists AS ta
|
||||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||||
WHERE ta.ArtistID='$ArtistID'
|
WHERE ta.ArtistID='$ArtistID'
|
||||||
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),ta.Importance, 1),
|
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),ta.Importance, 1),
|
||||||
tg.ReleaseType ASC, tg.Year DESC, tg.Name DESC");
|
tg.ReleaseType ASC, tg.Year DESC, tg.Name DESC");
|
||||||
|
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$Importances = $DB->to_array('GroupID', MYSQLI_BOTH, false);
|
$Importances = $DB->to_array('GroupID', MYSQLI_BOTH, false);
|
||||||
if(count($GroupIDs)>0) {
|
if(count($GroupIDs)>0) {
|
||||||
$TorrentList = get_groups($GroupIDs, true,true);
|
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -181,8 +177,8 @@ function compare($X, $Y){
|
|||||||
$Tags[$Tag]['count']++;
|
$Tags[$Tag]['count']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$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(check_perms('users_mod')) {
|
if(check_perms('users_mod')) {
|
||||||
@ -197,9 +193,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName = display_artists($ExtendedArtists).$DisplayName;
|
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array(1 => $Artists), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1022: // Show performers on composer pages
|
case 1022: // Show performers on composer pages
|
||||||
@ -207,14 +203,14 @@ function compare($X, $Y){
|
|||||||
unset($ExtendedArtists[4]);
|
unset($ExtendedArtists[4]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
unset($ExtendedArtists[6]);
|
unset($ExtendedArtists[6]);
|
||||||
$DisplayName = display_artists($ExtendedArtists).$DisplayName;
|
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array(1 => $Artists), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: // Show composers otherwise
|
default: // Show composers otherwise
|
||||||
if (!empty($ExtendedArtists[4])) {
|
if (!empty($ExtendedArtists[4])) {
|
||||||
$DisplayName = display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
|
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Results = get_groups(array_keys($GroupIDs));
|
$Results = Torrents::get_groups(array_keys($GroupIDs));
|
||||||
|
|
||||||
$Results = $Results['matches'];
|
$Results = $Results['matches'];
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
// If some were fetched from memcached, get their artists
|
// If some were fetched from memcached, get their artists
|
||||||
if(!empty($Results['matches'])) { // Fetch the artists for groups
|
if(!empty($Results['matches'])) { // Fetch the artists for groups
|
||||||
$GroupIDs = array_keys($Results['matches']);
|
$GroupIDs = array_keys($Results['matches']);
|
||||||
$Artists = get_artists($GroupIDs);
|
$Artists = Artists::get_artists($GroupIDs);
|
||||||
foreach($Artists as $GroupID=>$Data) {
|
foreach($Artists as $GroupID=>$Data) {
|
||||||
if(!empty($Data[1])) {
|
if(!empty($Data[1])) {
|
||||||
$Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists
|
$Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists
|
||||||
@ -44,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
// These ones were not found in the cache, run SQL
|
// These ones were not found in the cache, run SQL
|
||||||
if(!empty($Results['notfound'])) {
|
if(!empty($Results['notfound'])) {
|
||||||
$SQLResults = get_groups($Results['notfound']);
|
$SQLResults = Torrents::get_groups($Results['notfound']);
|
||||||
|
|
||||||
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
||||||
reset($SQLResults['notfound']);
|
reset($SQLResults['notfound']);
|
||||||
@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$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."]"; }
|
||||||
|
@ -41,7 +41,7 @@ function compare($X, $Y){
|
|||||||
$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) {
|
||||||
$TorrentList = get_groups($GroupIDs);
|
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -94,7 +94,7 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($GroupArtists)>0) {
|
if(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$GroupArtists));
|
$DisplayName = Artists::display_artists(array('1'=>$GroupArtists));
|
||||||
}
|
}
|
||||||
$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 = $DisplayName. ' ['. $GroupYear .']';}
|
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||||
@ -170,7 +170,7 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(!empty($GroupArtists)) {
|
if(!empty($GroupArtists)) {
|
||||||
$DisplayName.= display_artists(array('1'=>$GroupArtists), false);
|
$DisplayName.= Artists::display_artists(array('1'=>$GroupArtists), false);
|
||||||
}
|
}
|
||||||
$DisplayName .= $GroupName;
|
$DisplayName .= $GroupName;
|
||||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||||
|
@ -12,7 +12,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
else { $NewWay="desc"; }
|
else { $NewWay="desc"; }
|
||||||
} else { $NewWay=$DefaultWay; }
|
} else { $NewWay=$DefaultWay; }
|
||||||
|
|
||||||
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".get_url(array('order_way','order_by'));
|
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||||
@ -284,7 +284,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
|
|
||||||
// These ones were not found in the cache, run SQL
|
// These ones were not found in the cache, run SQL
|
||||||
if(!empty($Results['notfound'])) {
|
if(!empty($Results['notfound'])) {
|
||||||
$SQLResults = get_groups($Results['notfound']);
|
$SQLResults = Torrents::get_groups($Results['notfound']);
|
||||||
|
|
||||||
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
||||||
reset($SQLResults['notfound']);
|
reset($SQLResults['notfound']);
|
||||||
@ -362,7 +362,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName = display_artists($ExtendedArtists, false, false, true);
|
$DisplayName = Artists::display_artists($ExtendedArtists, false, false, true);
|
||||||
foreach ($ExtendedArtists[1] as $Artist) {
|
foreach ($ExtendedArtists[1] as $Artist) {
|
||||||
$JsonArtists[] = array(
|
$JsonArtists[] = array(
|
||||||
'id' => (int) $Artist['id'],
|
'id' => (int) $Artist['id'],
|
||||||
@ -371,7 +371,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} elseif(!empty($Artists)) {
|
} elseif(!empty($Artists)) {
|
||||||
$DisplayName = display_artists(array(1=>$Artists), false, false, true);
|
$DisplayName = Artists::display_artists(array(1=>$Artists), false, false, true);
|
||||||
foreach ($Artists as $Artist) {
|
foreach ($Artists as $Artist) {
|
||||||
$JsonArtists[] = array(
|
$JsonArtists[] = array(
|
||||||
'id' => (int) $Artist['id'],
|
'id' => (int) $Artist['id'],
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
$PerPage = POSTS_PER_PAGE;
|
$PerPage = POSTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(TOPICS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(TOPICS_PER_PAGE);
|
||||||
|
|
||||||
//---------- Get some data to start processing
|
//---------- Get some data to start processing
|
||||||
|
|
||||||
@ -80,7 +80,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Pages=get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9);
|
||||||
|
|
||||||
if (count($Forum) == 0) {
|
if (count($Forum) == 0) {
|
||||||
print
|
print
|
||||||
@ -118,9 +118,9 @@
|
|||||||
} else {
|
} else {
|
||||||
$Read = 'read';
|
$Read = 'read';
|
||||||
}
|
}
|
||||||
$UserInfo = user_info($AuthorID);
|
$UserInfo = Users::user_info($AuthorID);
|
||||||
$AuthorName = $UserInfo['Username'];
|
$AuthorName = $UserInfo['Username'];
|
||||||
$UserInfo = user_info($LastAuthorID);
|
$UserInfo = Users::user_info($LastAuthorID);
|
||||||
$LastAuthorName = $UserInfo['Username'];
|
$LastAuthorName = $UserInfo['Username'];
|
||||||
|
|
||||||
$JsonTopics[] = array(
|
$JsonTopics[] = array(
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$Read = 'read';
|
$Read = 'read';
|
||||||
}
|
}
|
||||||
$UserInfo = user_info($LastAuthorID);
|
$UserInfo = Users::user_info($LastAuthorID);
|
||||||
|
|
||||||
$JsonForums[] = array(
|
$JsonForums[] = array(
|
||||||
'forumId' => (int) $ForumID,
|
'forumId' => (int) $ForumID,
|
||||||
|
@ -73,11 +73,11 @@
|
|||||||
} else {
|
} else {
|
||||||
$PostNum = 1;
|
$PostNum = 1;
|
||||||
}
|
}
|
||||||
list($Page,$Limit) = page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
||||||
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
||||||
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
||||||
}
|
}
|
||||||
list($CatalogueID,$CatalogueLimit) = catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
||||||
|
|
||||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||||
if(!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
if(!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
$Thread = Format::catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
||||||
|
|
||||||
if ($_GET['updatelastread'] != '0') {
|
if ($_GET['updatelastread'] != '0') {
|
||||||
$LastPost = end($Thread);
|
$LastPost = end($Thread);
|
||||||
@ -220,8 +220,8 @@
|
|||||||
$JsonPosts = array();
|
$JsonPosts = array();
|
||||||
foreach ($Thread as $Key => $Post) {
|
foreach ($Thread as $Key => $Post) {
|
||||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime) = array_values($Post);
|
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime) = array_values($Post);
|
||||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||||
$UserInfo = user_info($EditedUserID);
|
$UserInfo = Users::user_info($EditedUserID);
|
||||||
$JsonPosts[] = array(
|
$JsonPosts[] = array(
|
||||||
'postId' => (int) $PostID,
|
'postId' => (int) $PostID,
|
||||||
'addedTime' => $AddedTime,
|
'addedTime' => $AddedTime,
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(MESSAGES_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE);
|
||||||
|
|
||||||
$Sort = empty($_GET['sort']) || $_GET['sort'] != "unread" ? "Date DESC" : "cu.Unread = '1' DESC, DATE DESC";
|
$Sort = empty($_GET['sort']) || $_GET['sort'] != "unread" ? "Date DESC" : "cu.Unread = '1' DESC, DATE DESC";
|
||||||
|
|
||||||
@ -70,14 +70,14 @@
|
|||||||
list($NumResults) = $DB->next_record();
|
list($NumResults) = $DB->next_record();
|
||||||
$DB->set_query_id($Results);
|
$DB->set_query_id($Results);
|
||||||
|
|
||||||
$CurURL = get_url(array('sort'));
|
$CurURL = Format::get_url(array('sort'));
|
||||||
if(empty($CurURL)) {
|
if(empty($CurURL)) {
|
||||||
$CurURL = "inbox.php?";
|
$CurURL = "inbox.php?";
|
||||||
} else {
|
} else {
|
||||||
$CurURL = "inbox.php?".$CurURL."&";
|
$CurURL = "inbox.php?".$CurURL."&";
|
||||||
}
|
}
|
||||||
|
|
||||||
$Pages=get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9);
|
||||||
|
|
||||||
$JsonMessages = array();
|
$JsonMessages = array();
|
||||||
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) {
|
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
while(list($PMUserID, $Username) = $DB->next_record()) {
|
while(list($PMUserID, $Username) = $DB->next_record()) {
|
||||||
$PMUserID = (int)$PMUserID;
|
$PMUserID = (int)$PMUserID;
|
||||||
$Users[$PMUserID]['UserStr'] = format_username($PMUserID, true, true, true, true);
|
$Users[$PMUserID]['UserStr'] = Users::format_username($PMUserID, true, true, true, true);
|
||||||
$Users[$PMUserID]['Username'] = $Username;
|
$Users[$PMUserID]['Username'] = $Username;
|
||||||
}
|
}
|
||||||
$Users[0]['UserStr'] = 'System'; // in case it's a message from the system
|
$Users[0]['UserStr'] = 'System'; // in case it's a message from the system
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
define('NOTIFICATIONS_PER_PAGE', 50);
|
define('NOTIFICATIONS_PER_PAGE', 50);
|
||||||
list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
|
||||||
|
|
||||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$LoggedUser['ID']);
|
$TokenTorrents = $Cache->get_value('users_tokens_'.$LoggedUser['ID']);
|
||||||
if (empty($TokenTorrents)) {
|
if (empty($TokenTorrents)) {
|
||||||
@ -36,10 +36,10 @@
|
|||||||
list($TorrentCount) = $DB->next_record();
|
list($TorrentCount) = $DB->next_record();
|
||||||
|
|
||||||
if(count($GroupIDs)) {
|
if(count($GroupIDs)) {
|
||||||
$TorrentGroups = get_groups($GroupIDs);
|
$TorrentGroups = Torrents::get_groups($GroupIDs);
|
||||||
$TorrentGroups = $TorrentGroups['matches'];
|
$TorrentGroups = $TorrentGroups['matches'];
|
||||||
|
|
||||||
// Need some extra info that get_groups() doesn't return
|
// Need some extra info that Torrents::get_groups() doesn't return
|
||||||
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
|
$DB->query("SELECT ID, CategoryID FROM torrents_group WHERE ID IN (".implode(',', $GroupIDs).")");
|
||||||
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
$GroupCategoryIDs = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||||
|
|
||||||
|
@ -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 = 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
|
||||||
@ -59,8 +59,8 @@
|
|||||||
//Do we need to get artists?
|
//Do we need to get artists?
|
||||||
if($CategoryName == "Music") {
|
if($CategoryName == "Music") {
|
||||||
$ArtistForm = get_request_artists($RequestID);
|
$ArtistForm = get_request_artists($RequestID);
|
||||||
$ArtistName = display_artists($ArtistForm, false, true);
|
$ArtistName = Artists::display_artists($ArtistForm, false, true);
|
||||||
$ArtistLink = 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."]";
|
||||||
@ -141,7 +141,7 @@
|
|||||||
$Cache->cache_value('request_comments_'.$RequestID, $Results, 0);
|
$Cache->cache_value('request_comments_'.$RequestID, $Results, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
|
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
|
||||||
|
|
||||||
//Get the cache catalogue
|
//Get the cache catalogue
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||||
@ -175,7 +175,7 @@
|
|||||||
$JsonRequestComments = array();
|
$JsonRequestComments = array();
|
||||||
foreach($Thread as $Key => $Post){
|
foreach($Thread as $Key => $Post){
|
||||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
||||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||||
$JsonRequestComments[] = array(
|
$JsonRequestComments[] = array(
|
||||||
'postId' => (int) $PostID,
|
'postId' => (int) $PostID,
|
||||||
'authorId' => (int) $AuthorID,
|
'authorId' => (int) $AuthorID,
|
||||||
@ -183,7 +183,7 @@
|
|||||||
'donor' => $Donor == 1,
|
'donor' => $Donor == 1,
|
||||||
'warned' => ($Warned!='0000-00-00 00:00:00'),
|
'warned' => ($Warned!='0000-00-00 00:00:00'),
|
||||||
'enabled' => ($Enabled == 2 ? false : true),
|
'enabled' => ($Enabled == 2 ? false : true),
|
||||||
'class' => make_class_string($PermissionID),
|
'class' => Users::make_class_string($PermissionID),
|
||||||
'addedTime' => $AddedTime,
|
'addedTime' => $AddedTime,
|
||||||
'avatar' => $Avatar,
|
'avatar' => $Avatar,
|
||||||
'comment' => $Text->full_format($Body),
|
'comment' => $Text->full_format($Body),
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
$Queries = array();
|
$Queries = array();
|
||||||
|
|
||||||
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
|
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
|
||||||
list($Page,$Limit) = 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 = user_info((int)$_GET['userid']);
|
$UserInfo = Users::user_info((int)$_GET['userid']);
|
||||||
$Perms = get_permissions($UserInfo['PermissionID']);
|
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||||
$UserClass = $Perms['Class'];
|
$UserClass = $Perms['Class'];
|
||||||
|
|
||||||
$BookmarkView = false;
|
$BookmarkView = false;
|
||||||
@ -96,12 +96,12 @@
|
|||||||
$Tags = explode(',', $_GET['tags']);
|
$Tags = explode(',', $_GET['tags']);
|
||||||
$TagNames = array();
|
$TagNames = array();
|
||||||
foreach ($Tags as $Tag) {
|
foreach ($Tags as $Tag) {
|
||||||
$Tag = sanitize_tag($Tag);
|
$Tag = Misc::sanitize_tag($Tag);
|
||||||
if(!empty($Tag)) {
|
if(!empty($Tag)) {
|
||||||
$TagNames[] = $Tag;
|
$TagNames[] = $Tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$Tags = get_tags($TagNames);
|
$Tags = Misc::get_tags($TagNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($_GET['tags_type']) && !empty($Tags)) {
|
if(empty($_GET['tags_type']) && !empty($Tags)) {
|
||||||
@ -278,7 +278,7 @@
|
|||||||
//We don't use sphinxapi's default cache searcher, we use our own functions
|
//We don't use sphinxapi's default cache searcher, we use our own functions
|
||||||
|
|
||||||
if(!empty($SphinxResults['notfound'])) {
|
if(!empty($SphinxResults['notfound'])) {
|
||||||
$SQLResults = get_requests($SphinxResults['notfound']);
|
$SQLResults = Requests::get_requests($SphinxResults['notfound']);
|
||||||
if(is_array($SQLResults['notfound'])) {
|
if(is_array($SQLResults['notfound'])) {
|
||||||
//Something wasn't found in the db, remove it from results
|
//Something wasn't found in the db, remove it from results
|
||||||
reset($SQLResults['notfound']);
|
reset($SQLResults['notfound']);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$PerPage = POSTS_PER_PAGE;
|
$PerPage = POSTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
list($Page,$Limit) = page_limit($PerPage);
|
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||||
|
|
||||||
if($LoggedUser['CustomForums']) {
|
if($LoggedUser['CustomForums']) {
|
||||||
unset($LoggedUser['CustomForums']['']);
|
unset($LoggedUser['CustomForums']['']);
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
if(isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
|
if(isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
|
||||||
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_GET[postid]");
|
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_GET[postid]");
|
||||||
list($PostNum) = $DB->next_record();
|
list($PostNum) = $DB->next_record();
|
||||||
list($Page,$Limit) = page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
|
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
|
||||||
} else {
|
} else {
|
||||||
list($Page,$Limit) = page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
|
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the cache catalogue
|
//Get the cache catalogue
|
||||||
@ -57,7 +57,7 @@
|
|||||||
$JsonComments = array();
|
$JsonComments = array();
|
||||||
foreach ($Thread as $Key => $Post) {
|
foreach ($Thread as $Key => $Post) {
|
||||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
||||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||||
$JsonComments[] = array(
|
$JsonComments[] = array(
|
||||||
'postId' => (int) $PostID,
|
'postId' => (int) $PostID,
|
||||||
'addedTime' => $AddedTime,
|
'addedTime' => $AddedTime,
|
||||||
|
@ -146,7 +146,7 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
|
|||||||
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
|
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
|
||||||
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;
|
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;
|
||||||
|
|
||||||
$Artist = display_artists(get_artist($GroupID), false, true);
|
$Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
|
||||||
$TruncArtist = substr($Artist, 0, strlen($Artist)-3);
|
$TruncArtist = substr($Artist, 0, strlen($Artist)-3);
|
||||||
|
|
||||||
$TagList=array();
|
$TagList=array();
|
||||||
|
@ -20,7 +20,7 @@ function filter_by_key($input, $keys) { return array_intersect_key($input, array
|
|||||||
|
|
||||||
$TorrentDetails = filter_by_key($TorrentCache[0][0], $GroupAllowed);
|
$TorrentDetails = filter_by_key($TorrentCache[0][0], $GroupAllowed);
|
||||||
|
|
||||||
$ArtistForm = get_artist($GroupID);
|
$ArtistForm = Artists::get_artist($GroupID);
|
||||||
if($TorrentDetails['CategoryID'] == 0) {
|
if($TorrentDetails['CategoryID'] == 0) {
|
||||||
$CategoryName = "Unknown";
|
$CategoryName = "Unknown";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
//TODO: replace 24-43 with user_info()
|
//TODO: replace 24-43 with Users::user_info()
|
||||||
/*
|
/*
|
||||||
User post history page
|
User post history page
|
||||||
*/
|
*/
|
||||||
@ -32,7 +32,7 @@ function error_out($reason = "") {
|
|||||||
$PerPage = POSTS_PER_PAGE;
|
$PerPage = POSTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit($PerPage);
|
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||||
|
|
||||||
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === FALSE) {
|
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === FALSE) {
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
if(isset($_GET['username'])){
|
if(isset($_GET['username'])){
|
||||||
$_GET['username'] = trim($_GET['username']);
|
$_GET['username'] = trim($_GET['username']);
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(USERS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
|
||||||
$DB->query("SELECT SQL_CALC_FOUND_ROWS
|
$DB->query("SELECT SQL_CALC_FOUND_ROWS
|
||||||
ID,
|
ID,
|
||||||
Username,
|
Username,
|
||||||
@ -42,7 +42,7 @@
|
|||||||
'donor' => $Donor == 1,
|
'donor' => $Donor == 1,
|
||||||
'warned' => ($Warned!='0000-00-00 00:00:00'),
|
'warned' => ($Warned!='0000-00-00 00:00:00'),
|
||||||
'enabled' => ($Enabled == 2 ? false : true),
|
'enabled' => ($Enabled == 2 ? false : true),
|
||||||
'class' => make_class_string($PermissionID)
|
'class' => Users::make_class_string($PermissionID)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
if(!check_perms('torrents_edit')) { error(403); }
|
if(!check_perms('torrents_edit')) { error(403); }
|
||||||
$ArtistID = $_POST['artistid'];
|
$ArtistID = $_POST['artistid'];
|
||||||
$Redirect = $_POST['redirect'];
|
$Redirect = $_POST['redirect'];
|
||||||
$AliasName = normalise_artist_name($_POST['name']);
|
$AliasName = Artists::normalise_artist_name($_POST['name']);
|
||||||
$DBAliasName = db_string($AliasName);
|
$DBAliasName = db_string($AliasName);
|
||||||
if(!$Redirect) { $Redirect = 0; }
|
if(!$Redirect) { $Redirect = 0; }
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
if($ArtistID == $CloneArtistID && $Redirect == 0) {
|
if($ArtistID == $CloneArtistID && $Redirect == 0) {
|
||||||
if($CloneRedirect != 0) {
|
if($CloneRedirect != 0) {
|
||||||
$DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'");
|
$DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'");
|
||||||
write_log("Redirection for the alias $CloneAliasID ($DBAliasName) for the artist $ArtistID was removed by user $LoggedUser[ID] ($LoggedUser[Username])");
|
Misc::write_log("Redirection for the alias $CloneAliasID ($DBAliasName) for the artist $ArtistID was removed by user $LoggedUser[ID] ($LoggedUser[Username])");
|
||||||
} else {
|
} else {
|
||||||
error('No changes were made as the target alias did not redirect anywhere.');
|
error('No changes were made as the target alias did not redirect anywhere.');
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@
|
|||||||
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = ".$ArtistID);
|
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = ".$ArtistID);
|
||||||
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
|
||||||
write_log("The alias ".$AliasID." (".$DBAliasName.") was added to the artist ".$ArtistID." (".db_string($ArtistName).") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
Misc::write_log("The alias ".$AliasID." (".$DBAliasName.") was added to the artist ".$ArtistID." (".db_string($ArtistName).") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||||
}
|
}
|
||||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||||
?>
|
?>
|
||||||
|
@ -13,7 +13,6 @@ function compare($X, $Y){
|
|||||||
include(SERVER_ROOT.'/sections/requests/functions.php');
|
include(SERVER_ROOT.'/sections/requests/functions.php');
|
||||||
|
|
||||||
// Similar artist map
|
// Similar artist map
|
||||||
include(SERVER_ROOT.'/classes/class_artist.php');
|
|
||||||
include(SERVER_ROOT.'/classes/class_artists_similar.php');
|
include(SERVER_ROOT.'/classes/class_artists_similar.php');
|
||||||
|
|
||||||
include(SERVER_ROOT.'/classes/class_image_tools.php');
|
include(SERVER_ROOT.'/classes/class_image_tools.php');
|
||||||
@ -33,7 +32,7 @@ function compare($X, $Y){
|
|||||||
if($Data) {
|
if($Data) {
|
||||||
$Data = unserialize($Data);
|
$Data = unserialize($Data);
|
||||||
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, $TorrentList, $Importances, $VanityHouseArtist)) = each($Data);
|
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, $TorrentList, $Importances, $VanityHouseArtist)) = each($Data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($RevisionID) {
|
if ($RevisionID) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@ -41,7 +40,7 @@ function compare($X, $Y){
|
|||||||
wiki.Image,
|
wiki.Image,
|
||||||
wiki.body,
|
wiki.body,
|
||||||
a.VanityHouse
|
a.VanityHouse
|
||||||
FROM wiki_artists AS wiki
|
FROM wiki_artists AS wiki
|
||||||
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
||||||
WHERE wiki.RevisionID='$RevisionID' ";
|
WHERE wiki.RevisionID='$RevisionID' ";
|
||||||
} else {
|
} else {
|
||||||
@ -56,9 +55,9 @@ function compare($X, $Y){
|
|||||||
}
|
}
|
||||||
$sql .= " GROUP BY a.ArtistID";
|
$sql .= " GROUP BY a.ArtistID";
|
||||||
$DB->query($sql);
|
$DB->query($sql);
|
||||||
|
|
||||||
if($DB->record_count()==0) { error(404); }
|
if($DB->record_count()==0) { error(404); }
|
||||||
|
|
||||||
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
|
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,12 +85,12 @@ function compare($X, $Y){
|
|||||||
SUM(rv.Bounty) AS Bounty
|
SUM(rv.Bounty) AS Bounty
|
||||||
FROM requests AS r
|
FROM requests AS r
|
||||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
||||||
WHERE ra.ArtistID = ".$ArtistID."
|
WHERE ra.ArtistID = ".$ArtistID."
|
||||||
AND r.TorrentID = 0
|
AND r.TorrentID = 0
|
||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
ORDER BY Votes DESC");
|
ORDER BY Votes DESC");
|
||||||
|
|
||||||
if($DB->record_count() > 0) {
|
if($DB->record_count() > 0) {
|
||||||
$Requests = $DB->to_array();
|
$Requests = $DB->to_array();
|
||||||
} else {
|
} else {
|
||||||
@ -103,19 +102,19 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$LastReleaseType = 0;
|
$LastReleaseType = 0;
|
||||||
if(empty($Importances) || empty($TorrentList)) {
|
if(empty($Importances) || empty($TorrentList)) {
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse
|
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse
|
||||||
FROM torrents_artists AS ta
|
FROM torrents_artists AS ta
|
||||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||||
WHERE ta.ArtistID='$ArtistID'
|
WHERE ta.ArtistID='$ArtistID'
|
||||||
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),1000 + ta.Importance, tg.ReleaseType) ASC,
|
ORDER BY IF(ta.Importance IN ('2', '3', '4', '7'),1000 + ta.Importance, tg.ReleaseType) ASC,
|
||||||
tg.Year DESC, tg.Name DESC");
|
tg.Year DESC, tg.Name DESC");
|
||||||
|
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
||||||
|
|
||||||
if(count($GroupIDs)>0) {
|
if(count($GroupIDs)>0) {
|
||||||
$TorrentList = get_groups($GroupIDs, true,true);
|
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -138,32 +137,32 @@ function compare($X, $Y){
|
|||||||
//$TorrentList[$GroupID]['ReleaseType'] = 1024;
|
//$TorrentList[$GroupID]['ReleaseType'] = 1024;
|
||||||
$GuestAlbums = true;
|
$GuestAlbums = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '3':
|
case '3':
|
||||||
$Importances[$ID]['ReleaseType'] = 1023;
|
$Importances[$ID]['ReleaseType'] = 1023;
|
||||||
//$TorrentList[$GroupID]['ReleaseType'] = 1023;
|
//$TorrentList[$GroupID]['ReleaseType'] = 1023;
|
||||||
$RemixerAlbums = true;
|
$RemixerAlbums = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '4':
|
case '4':
|
||||||
$Importances[$ID]['ReleaseType'] = 1022;
|
$Importances[$ID]['ReleaseType'] = 1022;
|
||||||
//$TorrentList[$GroupID]['ReleaseType'] = 1022;
|
//$TorrentList[$GroupID]['ReleaseType'] = 1022;
|
||||||
$ComposerAlbums = true;
|
$ComposerAlbums = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '7':
|
case '7':
|
||||||
$Importances[$ID]['ReleaseType'] = 1021;
|
$Importances[$ID]['ReleaseType'] = 1021;
|
||||||
//$TorrentList[$GroupID]['ReleaseType'] = 1021;
|
//$TorrentList[$GroupID]['ReleaseType'] = 1021;
|
||||||
$ProducerAlbums = true;
|
$ProducerAlbums = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
|
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($Importances[$ID]['ReleaseType'], $UsedReleases)) {
|
if(!in_array($Importances[$ID]['ReleaseType'], $UsedReleases)) {
|
||||||
$UsedReleases[] = $Importances[$ID]['ReleaseType'];
|
$UsedReleases[] = $Importances[$ID]['ReleaseType'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($GuestAlbums)) {
|
if(!empty($GuestAlbums)) {
|
||||||
@ -199,7 +198,7 @@ function compare($X, $Y){
|
|||||||
$DisplayName = $ReleaseTypes[$ReleaseID]."s";
|
$DisplayName = $ReleaseTypes[$ReleaseID]."s";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseID, $LoggedUser['HideTypes']))) {
|
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseID, $LoggedUser['HideTypes']))) {
|
||||||
$ToggleStr = " onclick=\"$('.releases_$ReleaseID').show(); return true;\"";
|
$ToggleStr = " onclick=\"$('.releases_$ReleaseID').show(); return true;\"";
|
||||||
} else {
|
} else {
|
||||||
@ -225,7 +224,7 @@ function compare($X, $Y){
|
|||||||
$TagList = explode(' ',str_replace('_','.',$Group['TagList']));
|
$TagList = explode(' ',str_replace('_','.',$Group['TagList']));
|
||||||
|
|
||||||
$TorrentTags = array();
|
$TorrentTags = array();
|
||||||
|
|
||||||
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
|
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
|
||||||
if ($Group['ReleaseType'] != 7 && $Group['ReleaseType'] != 3) {
|
if ($Group['ReleaseType'] != 7 && $Group['ReleaseType'] != 3) {
|
||||||
foreach($TagList as $Tag) {
|
foreach($TagList as $Tag) {
|
||||||
@ -238,14 +237,14 @@ function compare($X, $Y){
|
|||||||
}
|
}
|
||||||
$TorrentTags = implode(', ', $TorrentTags);
|
$TorrentTags = implode(', ', $TorrentTags);
|
||||||
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
||||||
|
|
||||||
foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
|
foreach ($Group['Torrents'] as $TorrentID => $Torrent) {
|
||||||
$NumTorrents++;
|
$NumTorrents++;
|
||||||
|
|
||||||
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
|
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
|
||||||
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
|
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
|
||||||
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
|
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
|
||||||
|
|
||||||
$NumSeeders+=$Torrent['Seeders'];
|
$NumSeeders+=$Torrent['Seeders'];
|
||||||
$NumLeechers+=$Torrent['Leechers'];
|
$NumLeechers+=$Torrent['Leechers'];
|
||||||
$NumSnatches+=$Torrent['Snatched'];
|
$NumSnatches+=$Torrent['Snatched'];
|
||||||
@ -264,31 +263,31 @@ function compare($X, $Y){
|
|||||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($TorrentList[$Group['GroupID']]);
|
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists) = array_values($TorrentList[$Group['GroupID']]);
|
||||||
$ReleaseType = $Group['ReleaseType'];
|
$ReleaseType = $Group['ReleaseType'];
|
||||||
$GroupVanityHouse = $Group['VanityHouse'];
|
$GroupVanityHouse = $Group['VanityHouse'];
|
||||||
|
|
||||||
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
|
if ($GroupID == $OldGroupID && $ReleaseType == $OldReleaseType) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
$OldGroupID = $GroupID;
|
$OldGroupID = $GroupID;
|
||||||
$OldReleaseType = $ReleaseType;
|
$OldReleaseType = $ReleaseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) {
|
if (!empty($LoggedUser['DiscogView']) || (isset($LoggedUser['HideTypes']) && in_array($ReleaseType, $LoggedUser['HideTypes']))) {
|
||||||
$HideDiscog = ' hidden';
|
$HideDiscog = ' hidden';
|
||||||
} else {
|
} else {
|
||||||
$HideDiscog = '';
|
$HideDiscog = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList = explode(' ',str_replace('_','.',$TagList));
|
$TagList = explode(' ',str_replace('_','.',$TagList));
|
||||||
|
|
||||||
$TorrentTags = array();
|
$TorrentTags = array();
|
||||||
|
|
||||||
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
|
// $Tags array is for the sidebar on the right. Skip compilations and soundtracks.
|
||||||
foreach($TagList as $Tag) {
|
foreach($TagList as $Tag) {
|
||||||
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
|
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
|
||||||
}
|
}
|
||||||
$TorrentTags = implode(', ', $TorrentTags);
|
$TorrentTags = implode(', ', $TorrentTags);
|
||||||
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
||||||
|
|
||||||
if($ReleaseType!=$LastReleaseType) {
|
if($ReleaseType!=$LastReleaseType) {
|
||||||
switch($ReleaseTypes[$ReleaseType]) {
|
switch($ReleaseTypes[$ReleaseType]) {
|
||||||
case "Remix" :
|
case "Remix" :
|
||||||
@ -322,13 +321,13 @@ function compare($X, $Y){
|
|||||||
$LastReleaseType = $ReleaseType;
|
$LastReleaseType = $ReleaseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$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(check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
|
if(check_perms('users_mod') || check_perms('torrents_fix_ghosts')) {
|
||||||
$DisplayName .= ' [<a href="torrents.php?action=fix_group&groupid='.$GroupID.'&artistid='.$ArtistID.'&auth='.$LoggedUser['AuthKey'].'" title="Fix ghost DB entry">Fix</a>]';
|
$DisplayName .= ' [<a href="torrents.php?action=fix_group&groupid='.$GroupID.'&artistid='.$ArtistID.'&auth='.$LoggedUser['AuthKey'].'" title="Fix ghost DB entry">Fix</a>]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch($ReleaseType){
|
switch($ReleaseType){
|
||||||
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
|
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
|
||||||
case 1024:
|
case 1024:
|
||||||
@ -337,9 +336,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName = display_artists($ExtendedArtists).$DisplayName;
|
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array(1 => $Artists), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1022: // Show performers on composer pages
|
case 1022: // Show performers on composer pages
|
||||||
@ -347,14 +346,14 @@ function compare($X, $Y){
|
|||||||
unset($ExtendedArtists[4]);
|
unset($ExtendedArtists[4]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
unset($ExtendedArtists[6]);
|
unset($ExtendedArtists[6]);
|
||||||
$DisplayName = display_artists($ExtendedArtists).$DisplayName;
|
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array(1 => $Artists), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: // Show composers otherwise
|
default: // Show composers otherwise
|
||||||
if (!empty($ExtendedArtists[4])) {
|
if (!empty($ExtendedArtists[4])) {
|
||||||
$DisplayName = display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
|
$DisplayName = Artists::display_artists(array(4 => $ExtendedArtists[4]), true, true).$DisplayName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,19 +382,19 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$EditionID = 0;
|
$EditionID = 0;
|
||||||
unset($FirstUnknown);
|
unset($FirstUnknown);
|
||||||
|
|
||||||
foreach ($Torrents as $TorrentID => $Torrent) {
|
foreach ($Torrents as $TorrentID => $Torrent) {
|
||||||
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
|
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
|
||||||
$FirstUnknown = !isset($FirstUnknown);
|
$FirstUnknown = !isset($FirstUnknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||||
$Torrent['PersonalFL'] = 1;
|
$Torrent['PersonalFL'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||||
|
|
||||||
$EditionID++;
|
$EditionID++;
|
||||||
|
|
||||||
if($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
|
if($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
|
||||||
@ -405,7 +404,7 @@ function compare($X, $Y){
|
|||||||
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
||||||
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
|
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
|
||||||
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
|
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog<?=$HideDiscog.$HideTorrents?>">
|
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog<?=$HideDiscog.$HideTorrents?>">
|
||||||
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$RemasterName?></strong></a></td>
|
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$RemasterName?></strong></a></td>
|
||||||
@ -438,14 +437,14 @@ function compare($X, $Y){
|
|||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span>
|
<span>
|
||||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Torrent['HasFile'] ? 'DL' : 'Missing'?></a>
|
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Torrent['HasFile'] ? 'DL' : 'Missing'?></a>
|
||||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||||
<? } ?> ]
|
<? } ?> ]
|
||||||
</span>
|
</span>
|
||||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=torrent_info($Torrent)?></a>
|
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||||
</td>
|
</td>
|
||||||
<td class="nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -457,12 +456,12 @@ function compare($X, $Y){
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?}
|
<?}
|
||||||
|
|
||||||
$TorrentDisplayList = ob_get_clean();
|
$TorrentDisplayList = ob_get_clean();
|
||||||
|
|
||||||
//----------------- End building list and getting stats
|
//----------------- End building list and getting stats
|
||||||
|
|
||||||
show_header($Name, 'browse,requests,bbcode');
|
View::show_header($Name, 'browse,requests,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -494,7 +493,7 @@ function compare($X, $Y){
|
|||||||
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
|
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
|
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
|
||||||
<?
|
<?
|
||||||
@ -557,11 +556,11 @@ function compare($X, $Y){
|
|||||||
<form class="download_form" name="zip" action="artist.php" method="post">
|
<form class="download_form" name="zip" action="artist.php" method="post">
|
||||||
<input type="hidden" name="action" value="download" />
|
<input type="hidden" name="action" value="download" />
|
||||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||||
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
|
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
|
||||||
<ul id="list" class="nobullet">
|
<ul id="list" class="nobullet">
|
||||||
<? foreach ($ZIPList as $ListItem) { ?>
|
<? foreach ($ZIPList as $ListItem) { ?>
|
||||||
<li id="list<?=$ListItem?>">
|
<li id="list<?=$ListItem?>">
|
||||||
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
|
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
|
||||||
<span style="float:left;"><?=$ZIPOptions[$ListItem]['2']?></span>
|
<span style="float:left;"><?=$ZIPOptions[$ListItem]['2']?></span>
|
||||||
<a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float:right;" title="Remove format from the Collector">[X]</a>
|
<a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float:right;" title="Remove format from the Collector">[X]</a>
|
||||||
<br style="clear:all;" />
|
<br style="clear:all;" />
|
||||||
@ -597,7 +596,7 @@ function compare($X, $Y){
|
|||||||
<option value="1"<? if($ZIPPrefs==1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
<option value="1"<? if($ZIPPrefs==1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||||
<option value="2"<? if($ZIPPrefs==2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
<option value="2"<? if($ZIPPrefs==2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" style="width:210px" value="Download" />
|
<input type="submit" style="width:210px" value="Download" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -656,10 +655,10 @@ function compare($X, $Y){
|
|||||||
<ul class="stats nobullet">
|
<ul class="stats nobullet">
|
||||||
<?
|
<?
|
||||||
if($NumSimilar == 0) { ?>
|
if($NumSimilar == 0) { ?>
|
||||||
<li><span style="font-style: italic;">None found</span></li>
|
<li><span style="font-style: italic;">None found</span></li>
|
||||||
<? }
|
<? }
|
||||||
$First = true;
|
$First = true;
|
||||||
foreach ($SimilarArray as $SimilarArtist) {
|
foreach ($SimilarArray as $SimilarArtist) {
|
||||||
list($Artist2ID, $Artist2Name, $Score, $SimilarID) = $SimilarArtist;
|
list($Artist2ID, $Artist2Name, $Score, $SimilarID) = $SimilarArtist;
|
||||||
$Score = $Score/100;
|
$Score = $Score/100;
|
||||||
if($First) {
|
if($First) {
|
||||||
@ -730,7 +729,7 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
if($CategoryName == "Music") {
|
if($CategoryName == "Music") {
|
||||||
$ArtistForm = get_request_artists($RequestID);
|
$ArtistForm = get_request_artists($RequestID);
|
||||||
$ArtistLink = display_artists($ArtistForm, true, true);
|
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
||||||
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||||
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||||
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||||
@ -764,7 +763,7 @@ function compare($X, $Y){
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span id="bounty_<?=$RequestID?>"><?=get_size($Bounty)?></span>
|
<span id="bounty_<?=$RequestID?>"><?=Format::get_size($Bounty)?></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?=time_diff($TimeAdded)?>
|
<?=time_diff($TimeAdded)?>
|
||||||
@ -815,7 +814,7 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<? } // if $NumSimilar>0
|
<? } // if $NumSimilar>0
|
||||||
|
|
||||||
if($NumSimilar>0) { ?>
|
if($NumSimilar>0) { ?>
|
||||||
|
|
||||||
@ -894,14 +893,14 @@ function require(file, callback) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
|
|
||||||
|
|
||||||
// Cache page for later use
|
// Cache page for later use
|
||||||
|
|
||||||
if($RevisionID) {
|
if($RevisionID) {
|
||||||
$Key = "artist_$ArtistID"."_revision_$RevisionID";
|
$Key = "artist_$ArtistID"."_revision_$RevisionID";
|
||||||
} else {
|
} else {
|
||||||
$Key = 'artist_'.$ArtistID;
|
$Key = 'artist_'.$ArtistID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
|
|
||||||
// Similar artist map
|
// Similar artist map
|
||||||
include(SERVER_ROOT.'/classes/class_artist.php');
|
|
||||||
include(SERVER_ROOT.'/classes/class_artists_similar.php');
|
include(SERVER_ROOT.'/classes/class_artists_similar.php');
|
||||||
|
|
||||||
$ArtistID = $_GET['id'];
|
$ArtistID = $_GET['id'];
|
||||||
@ -31,7 +30,7 @@ function compare($X, $Y){
|
|||||||
if($Data) {
|
if($Data) {
|
||||||
$Data = unserialize($Data);
|
$Data = unserialize($Data);
|
||||||
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, $TorrentList, $GroupMeta)) = each($Data);
|
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, $TorrentList, $GroupMeta)) = each($Data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
a.Name,
|
a.Name,
|
||||||
@ -48,9 +47,9 @@ function compare($X, $Y){
|
|||||||
}
|
}
|
||||||
$sql .= " GROUP BY a.ArtistID";
|
$sql .= " GROUP BY a.ArtistID";
|
||||||
$DB->query($sql, MYSQLI_NUM, true);
|
$DB->query($sql, MYSQLI_NUM, true);
|
||||||
|
|
||||||
if($DB->record_count()==0) { error(404); }
|
if($DB->record_count()==0) { error(404); }
|
||||||
|
|
||||||
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record();
|
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +71,12 @@ function compare($X, $Y){
|
|||||||
SUM(rv.Bounty) AS Bounty
|
SUM(rv.Bounty) AS Bounty
|
||||||
FROM requests AS r
|
FROM requests AS r
|
||||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
||||||
WHERE ra.ArtistID = ".$ArtistID."
|
WHERE ra.ArtistID = ".$ArtistID."
|
||||||
AND r.TorrentID = 0
|
AND r.TorrentID = 0
|
||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
ORDER BY Votes DESC");
|
ORDER BY Votes DESC");
|
||||||
|
|
||||||
if($DB->record_count() > 0) {
|
if($DB->record_count() > 0) {
|
||||||
$Requests = $DB->to_array();
|
$Requests = $DB->to_array();
|
||||||
} else {
|
} else {
|
||||||
@ -89,17 +88,17 @@ function compare($X, $Y){
|
|||||||
|
|
||||||
$LastReleaseType = 0;
|
$LastReleaseType = 0;
|
||||||
if(empty($GroupMeta) || empty($TorrentList)) {
|
if(empty($GroupMeta) || empty($TorrentList)) {
|
||||||
$DB->query("SELECT
|
$DB->query("SELECT
|
||||||
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
|
DISTINCT ta.GroupID, ta.Importance, tg.VanityHouse
|
||||||
FROM torrents_artists AS ta
|
FROM torrents_artists AS ta
|
||||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||||
WHERE ta.ArtistID='$ArtistID'
|
WHERE ta.ArtistID='$ArtistID'
|
||||||
ORDER BY ta.Importance, tg.ReleaseType ASC, tg.Year DESC");
|
ORDER BY ta.Importance, tg.ReleaseType ASC, tg.Year DESC");
|
||||||
|
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$GroupMeta = $DB->to_array('GroupID', MYSQLI_BOTH, false);
|
$GroupMeta = $DB->to_array('GroupID', MYSQLI_BOTH, false);
|
||||||
if(count($GroupIDs)>0) {
|
if(count($GroupIDs)>0) {
|
||||||
$TorrentList = get_groups($GroupIDs, true, true);
|
$TorrentList = Torrents::get_groups($GroupIDs, true, true);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -204,7 +203,7 @@ function display_name($ReleaseType) {
|
|||||||
$OpenTable = false;
|
$OpenTable = false;
|
||||||
foreach ($TorrentListByReleaseType as $ReleaseType => $TorrentListForReleaseType) {
|
foreach ($TorrentListByReleaseType as $ReleaseType => $TorrentListForReleaseType) {
|
||||||
$NumTorrentsReleaseType = count($TorrentListForReleaseType);
|
$NumTorrentsReleaseType = count($TorrentListForReleaseType);
|
||||||
if($OpenTable) {
|
if($OpenTable) {
|
||||||
?></table><?
|
?></table><?
|
||||||
$OpenTable = false;
|
$OpenTable = false;
|
||||||
}
|
}
|
||||||
@ -223,12 +222,12 @@ function display_name($ReleaseType) {
|
|||||||
|
|
||||||
if ((isset($LoggedUser['ArtistOptions']) && array_key_exists($ReleaseType, $LoggedUser['ArtistOptions'])) && $LoggedUser['ArtistOptions'][$ReleaseType] == 0) {
|
if ((isset($LoggedUser['ArtistOptions']) && array_key_exists($ReleaseType, $LoggedUser['ArtistOptions'])) && $LoggedUser['ArtistOptions'][$ReleaseType] == 0) {
|
||||||
$HideDiscog = " hidden";
|
$HideDiscog = " hidden";
|
||||||
$HideDiscogDefault = true;
|
$HideDiscogDefault = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$HideDiscog = "";
|
$HideDiscog = "";
|
||||||
$HideDiscogDefault = false;
|
$HideDiscogDefault = false;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<table class="torrent_table grouped release_table releases_<?=$ReleaseType?>_table<?=$NumTorrentsReleaseType==0?" empty hidden":""?>" id="torrents_<?=$ReleaseTypeLabel?>">
|
<table class="torrent_table grouped release_table releases_<?=$ReleaseType?>_table<?=$NumTorrentsReleaseType==0?" empty hidden":""?>" id="torrents_<?=$ReleaseTypeLabel?>">
|
||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
@ -267,7 +266,7 @@ function display_name($ReleaseType) {
|
|||||||
$TagList = explode(' ',str_replace('_','.',$TagList));
|
$TagList = explode(' ',str_replace('_','.',$TagList));
|
||||||
|
|
||||||
$TorrentTags = array();
|
$TorrentTags = array();
|
||||||
|
|
||||||
// $Tags array is for the sidebar on the right
|
// $Tags array is for the sidebar on the right
|
||||||
foreach($TagList as $Tag) {
|
foreach($TagList as $Tag) {
|
||||||
if(!isset($Tags[$Tag])) {
|
if(!isset($Tags[$Tag])) {
|
||||||
@ -281,11 +280,11 @@ function display_name($ReleaseType) {
|
|||||||
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
$TorrentTags = '<br /><div class="tags">'.$TorrentTags.'</div>';
|
||||||
|
|
||||||
if (($ReleaseType == 1023) || ($ReleaseType == 1024)) {
|
if (($ReleaseType == 1023) || ($ReleaseType == 1024)) {
|
||||||
$ArtistPrefix = display_artists(array(1 => $GroupArtists));
|
$ArtistPrefix = Artists::display_artists(array(1 => $GroupArtists));
|
||||||
} else {
|
} else {
|
||||||
$ArtistPrefix = '';
|
$ArtistPrefix = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$DisplayName = $ArtistPrefix . '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName = $ArtistPrefix . '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) { $DisplayName = $GroupYear. ' - '.$DisplayName; }
|
if($GroupYear>0) { $DisplayName = $GroupYear. ' - '.$DisplayName; }
|
||||||
|
|
||||||
@ -307,33 +306,33 @@ function display_name($ReleaseType) {
|
|||||||
$LastRemasterRecordLabel = '';
|
$LastRemasterRecordLabel = '';
|
||||||
$LastRemasterCatalogueNumber = '';
|
$LastRemasterCatalogueNumber = '';
|
||||||
$LastMedia = '';
|
$LastMedia = '';
|
||||||
|
|
||||||
$EditionID = 0;
|
$EditionID = 0;
|
||||||
|
|
||||||
foreach ($Torrents as $TorrentID => $Torrent) {
|
foreach ($Torrents as $TorrentID => $Torrent) {
|
||||||
$NumTorrents++;
|
$NumTorrents++;
|
||||||
|
|
||||||
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
|
$Torrent['Seeders'] = (int)$Torrent['Seeders'];
|
||||||
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
|
$Torrent['Leechers'] = (int)$Torrent['Leechers'];
|
||||||
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
|
$Torrent['Snatched'] = (int)$Torrent['Snatched'];
|
||||||
|
|
||||||
$NumSeeders+=$Torrent['Seeders'];
|
$NumSeeders+=$Torrent['Seeders'];
|
||||||
$NumLeechers+=$Torrent['Leechers'];
|
$NumLeechers+=$Torrent['Leechers'];
|
||||||
$NumSnatches+=$Torrent['Snatched'];
|
$NumSnatches+=$Torrent['Snatched'];
|
||||||
|
|
||||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $Torrent['Media'] != $LastMedia) {
|
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $Torrent['Media'] != $LastMedia) {
|
||||||
|
|
||||||
$EditionID++;
|
$EditionID++;
|
||||||
|
|
||||||
if($Torrent['RemasterTitle'] || $Torrent['RemasterYear'] || $Torrent['RemasterRecordLabel'] || $Torrent['RemasterCatalogueNumber']) {
|
if($Torrent['RemasterTitle'] || $Torrent['RemasterYear'] || $Torrent['RemasterRecordLabel'] || $Torrent['RemasterCatalogueNumber']) {
|
||||||
$RemasterName = $Torrent['RemasterYear'];
|
$RemasterName = $Torrent['RemasterYear'];
|
||||||
$AddExtra = " - ";
|
$AddExtra = " - ";
|
||||||
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
|
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
|
||||||
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
||||||
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
|
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
|
||||||
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
|
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog <?=$HideDiscog?>">
|
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog <?=$HideDiscog?>">
|
||||||
<td colspan="7" class="artist_normalcol edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$RemasterName?></strong></a></td>
|
<td colspan="7" class="artist_normalcol edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?=$RemasterName?></strong></a></td>
|
||||||
@ -363,9 +362,9 @@ function display_name($ReleaseType) {
|
|||||||
<span>
|
<span>
|
||||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]
|
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]
|
||||||
</span>
|
</span>
|
||||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=torrent_info($Torrent)?></a>
|
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||||
</td>
|
</td>
|
||||||
<td class="artist_normalcol nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="artist_normalcol nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td class="artist_normalcol"><?=number_format($Torrent['Snatched'])?></td>
|
<td class="artist_normalcol"><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td class="artist_normalcol<?=($Torrent['Seeders']==0)?' r00':''?>"><?=number_format($Torrent['Seeders'])?></td>
|
<td class="artist_normalcol<?=($Torrent['Seeders']==0)?' r00':''?>"><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td class="artist_normalcol"><?=number_format($Torrent['Leechers'])?></td>
|
<td class="artist_normalcol"><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -387,7 +386,7 @@ function display_name($ReleaseType) {
|
|||||||
|
|
||||||
//----------------- End building list and getting stats
|
//----------------- End building list and getting stats
|
||||||
|
|
||||||
show_header($Name, 'browse,requests,artists,bbcode');
|
View::show_header($Name, 'browse,requests,artists,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -426,7 +425,7 @@ function display_name($ReleaseType) {
|
|||||||
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
|
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'[Bookmark]');return false;">[Remove bookmark]</a>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
|
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'[Remove bookmark]');return false;">[Bookmark]</a>
|
||||||
<?
|
<?
|
||||||
@ -588,7 +587,7 @@ function display_name($ReleaseType) {
|
|||||||
|
|
||||||
if($CategoryName == "Music") {
|
if($CategoryName == "Music") {
|
||||||
$ArtistForm = get_request_artists($RequestID);
|
$ArtistForm = get_request_artists($RequestID);
|
||||||
$ArtistLink = display_artists($ArtistForm, true, true);
|
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
||||||
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||||
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||||
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||||
@ -619,10 +618,10 @@ function display_name($ReleaseType) {
|
|||||||
<? if(check_perms('site_vote')){ ?>
|
<? if(check_perms('site_vote')){ ?>
|
||||||
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||||
<a href="javascript:Vote(0)"><strong>(+)</strong></a>
|
<a href="javascript:Vote(0)"><strong>(+)</strong></a>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?=get_size($Bounty)?>
|
<?=Format::get_size($Bounty)?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?=time_diff($TimeAdded)?>
|
<?=time_diff($TimeAdded)?>
|
||||||
@ -675,7 +674,7 @@ function display_name($ReleaseType) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
|
|
||||||
|
|
||||||
// Cache page for later use
|
// Cache page for later use
|
||||||
|
@ -90,13 +90,13 @@
|
|||||||
if(!empty($Groups)) {
|
if(!empty($Groups)) {
|
||||||
foreach($Groups as $GroupID) {
|
foreach($Groups as $GroupID) {
|
||||||
$Cache->delete_value('groups_artists_'.$GroupID);
|
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||||
update_hash($GroupID);
|
Torrents::update_hash($GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($Requests)) {
|
if(!empty($Requests)) {
|
||||||
foreach($Requests as $RequestID) {
|
foreach($Requests as $RequestID) {
|
||||||
$Cache->delete_value('request_artist_'.$RequestID);
|
$Cache->delete_value('request_artist_'.$RequestID);
|
||||||
update_sphinx_requests($RequestID);
|
Requests::update_sphinx_requests($RequestID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($BookmarkUsers)) {
|
if(!empty($BookmarkUsers)) {
|
||||||
@ -116,11 +116,11 @@
|
|||||||
// Delete the old artist
|
// Delete the old artist
|
||||||
$DB->query("DELETE FROM artists_group WHERE ArtistID = $ArtistID");
|
$DB->query("DELETE FROM artists_group WHERE ArtistID = $ArtistID");
|
||||||
|
|
||||||
write_log("The artist ".$ArtistID." (".$ArtistName.") was made into a non-redirecting alias of artist ".$NewArtistID." (".$NewArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
Misc::write_log("The artist ".$ArtistID." (".$ArtistName.") was made into a non-redirecting alias of artist ".$NewArtistID." (".$NewArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||||
|
|
||||||
header("Location: artist.php?action=edit&artistid=$NewArtistID");
|
header("Location: artist.php?action=edit&artistid=$NewArtistID");
|
||||||
} else {
|
} else {
|
||||||
show_header('Merging Artists');
|
View::show_header('Merging Artists');
|
||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h2>Confirm merge</h2>
|
<h2>Confirm merge</h2>
|
||||||
@ -138,6 +138,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
if(!check_perms('site_delete_artist') || !check_perms('torrents_delete')) { error(403); }
|
if(!check_perms('site_delete_artist') || !check_perms('torrents_delete')) { error(403); }
|
||||||
|
|
||||||
show_header('Artist deleted');
|
View::show_header('Artist deleted');
|
||||||
|
|
||||||
$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();
|
||||||
@ -76,9 +76,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($Count == 0) {
|
if($Count == 0) {
|
||||||
delete_artist($ArtistID);
|
Artists::delete_artist($ArtistID);
|
||||||
?>
|
?>
|
||||||
<div class="thin">Artist deleted!</div>
|
<div class="thin">Artist deleted!</div>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
show_footer();?>
|
View::show_footer();?>
|
||||||
|
@ -32,6 +32,6 @@
|
|||||||
$DB->query("DELETE FROM artists_alias WHERE AliasID='$AliasID'");
|
$DB->query("DELETE FROM artists_alias WHERE AliasID='$AliasID'");
|
||||||
$DB->query("UPDATE artists_alias SET Redirect='0' WHERE Redirect='$AliasID'");
|
$DB->query("UPDATE artists_alias SET Redirect='0' WHERE Redirect='$AliasID'");
|
||||||
|
|
||||||
write_log("The alias ".$AliasID." (".$AliasName.") was removed from the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
Misc::write_log("The alias ".$AliasID." (".$AliasName.") was removed from the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||||
|
|
||||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
|
|
||||||
$DB->query($SQL);
|
$DB->query($SQL);
|
||||||
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
|
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
|
||||||
$Artists = get_artists($GroupIDs, false);
|
$Artists = Artists::get_artists($GroupIDs, false);
|
||||||
$Skips = array();
|
$Skips = array();
|
||||||
$TotalSize = 0;
|
$TotalSize = 0;
|
||||||
if(count($Downloads)) {
|
if(count($Downloads)) {
|
||||||
@ -139,10 +139,10 @@
|
|||||||
|
|
||||||
require(SERVER_ROOT.'/classes/class_torrent.php');
|
require(SERVER_ROOT.'/classes/class_torrent.php');
|
||||||
require(SERVER_ROOT.'/classes/class_zip.php');
|
require(SERVER_ROOT.'/classes/class_zip.php');
|
||||||
$Zip = new ZIP(file_string($ArtistName));
|
$Zip = new ZIP(Misc::file_string($ArtistName));
|
||||||
foreach($Downloads as $Download) {
|
foreach($Downloads as $Download) {
|
||||||
list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $ReleaseType, $Year, $Album, $Size) = $Download;
|
list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $ReleaseType, $Year, $Album, $Size) = $Download;
|
||||||
$Artist = display_artists($Artists[$GroupID],false,true,false);
|
$Artist = Artists::display_artists($Artists[$GroupID],false,true,false);
|
||||||
if ($Rank == 100) {
|
if ($Rank == 100) {
|
||||||
$Skips[] = $Artist.$Album.' '.$Year;
|
$Skips[] = $Artist.$Album.' '.$Year;
|
||||||
continue;
|
continue;
|
||||||
@ -163,22 +163,22 @@
|
|||||||
// We need this section for long file names :/
|
// We need this section for long file names :/
|
||||||
$TorrentName='';
|
$TorrentName='';
|
||||||
$TorrentInfo='';
|
$TorrentInfo='';
|
||||||
$TorrentName = file_string($Artist.$Album);
|
$TorrentName = Misc::file_string($Artist.$Album);
|
||||||
if ($Year > 0) { $TorrentName.=' - '.file_string($Year); }
|
if ($Year > 0) { $TorrentName.=' - '.Misc::file_string($Year); }
|
||||||
if ($Media != '') { $TorrentInfo .= file_string($Media); }
|
if ($Media != '') { $TorrentInfo .= Misc::file_string($Media); }
|
||||||
if ($Format != '') {
|
if ($Format != '') {
|
||||||
if ($TorrentInfo!='') { $TorrentInfo .= ' - '; }
|
if ($TorrentInfo!='') { $TorrentInfo .= ' - '; }
|
||||||
$TorrentInfo .= file_string($Format);
|
$TorrentInfo .= Misc::file_string($Format);
|
||||||
}
|
}
|
||||||
if ($Encoding!='') {
|
if ($Encoding!='') {
|
||||||
if ($TorrentInfo != '') { $TorrentInfo.=' - '; }
|
if ($TorrentInfo != '') { $TorrentInfo.=' - '; }
|
||||||
$TorrentInfo .= file_string($Encoding);
|
$TorrentInfo .= Misc::file_string($Encoding);
|
||||||
}
|
}
|
||||||
if ($TorrentInfo != '') { $TorrentInfo = " ($TorrentInfo)"; }
|
if ($TorrentInfo != '') { $TorrentInfo = " ($TorrentInfo)"; }
|
||||||
if (strlen($TorrentName) + strlen($TorrentInfo) + 3 > 200) {
|
if (strlen($TorrentName) + strlen($TorrentInfo) + 3 > 200) {
|
||||||
$TorrentName = file_string($Album).(($Year>0)?(' - '.file_string($Year)):'');
|
$TorrentName = Misc::file_string($Album).(($Year>0)?(' - '.Misc::file_string($Year)):'');
|
||||||
}
|
}
|
||||||
$FileName = cut_string($TorrentName.$TorrentInfo, 180, true, false);
|
$FileName = Format::cut_string($TorrentName.$TorrentInfo, 180, true, false);
|
||||||
|
|
||||||
$Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.$FileName.'.torrent');
|
$Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.$FileName.'.torrent');
|
||||||
}
|
}
|
||||||
@ -186,9 +186,9 @@
|
|||||||
$Skipped = count($Skips);
|
$Skipped = count($Skips);
|
||||||
$Downloaded = $Analyzed - $Skipped;
|
$Downloaded = $Analyzed - $Skipped;
|
||||||
$Time = number_format(((microtime(true)-$ScriptStartTime)*1000),5).' ms';
|
$Time = number_format(((microtime(true)-$ScriptStartTime)*1000),5).' ms';
|
||||||
$Used = get_size(memory_get_usage(true));
|
$Used = Format::get_size(memory_get_usage(true));
|
||||||
$Date = date('M d Y, H:i');
|
$Date = date('M d Y, H:i');
|
||||||
$Zip->add_file('Collector Download Summary - '.SITE_NAME."\r\n\r\nUser:\t\t$LoggedUser[Username]\r\nPasskey:\t$LoggedUser[torrent_pass]\r\n\r\nTime:\t\t$Time\r\nUsed:\t\t$Used\r\nDate:\t\t$Date\r\n\r\nTorrents Analyzed:\t\t$Analyzed\r\nTorrents Filtered:\t\t$Skipped\r\nTorrents Downloaded:\t$Downloaded\r\n\r\nTotal Size of Torrents (Ratio Hit): ".get_size($TotalSize)."\r\n\r\nAlbums Unavailable within your criteria (consider making a request for your desired format):\r\n".implode("\r\n",$Skips), 'Summary.txt');
|
$Zip->add_file('Collector Download Summary - '.SITE_NAME."\r\n\r\nUser:\t\t$LoggedUser[Username]\r\nPasskey:\t$LoggedUser[torrent_pass]\r\n\r\nTime:\t\t$Time\r\nUsed:\t\t$Used\r\nDate:\t\t$Date\r\n\r\nTorrents Analyzed:\t\t$Analyzed\r\nTorrents Filtered:\t\t$Skipped\r\nTorrents Downloaded:\t$Downloaded\r\n\r\nTotal Size of Torrents (Ratio Hit): ".Format::get_size($TotalSize)."\r\n\r\nAlbums Unavailable within your criteria (consider making a request for your desired format):\r\n".implode("\r\n",$Skips), 'Summary.txt');
|
||||||
$Settings = array(implode(':',$_REQUEST['list']),$_REQUEST['preference']);
|
$Settings = array(implode(':',$_REQUEST['list']),$_REQUEST['preference']);
|
||||||
$Zip->close_stream();
|
$Zip->close_stream();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
list($Name, $Image, $Body, $VanityHouse) = $DB->next_record(MYSQLI_NUM, true);
|
list($Name, $Image, $Body, $VanityHouse) = $DB->next_record(MYSQLI_NUM, true);
|
||||||
|
|
||||||
// Start printing form
|
// Start printing form
|
||||||
show_header('Edit artist');
|
View::show_header('Edit artist');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -122,4 +122,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer() ?>
|
<? View::show_footer() ?>
|
@ -21,7 +21,7 @@
|
|||||||
$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(MYSQLI_NUM, true);
|
list($Name) = $DB->next_record(MYSQLI_NUM, true);
|
||||||
|
|
||||||
show_header("Revision history for ".$Name); // Set title
|
View::show_header("Revision history for ".$Name); // Set title
|
||||||
|
|
||||||
// Start printing form
|
// Start printing form
|
||||||
?>
|
?>
|
||||||
@ -34,5 +34,5 @@
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
authorize();
|
authorize();
|
||||||
|
|
||||||
$ArtistID = $_POST['artistid'];
|
$ArtistID = $_POST['artistid'];
|
||||||
$NewName = normalise_artist_name($_POST['name']);
|
$NewName = Artists::normalise_artist_name($_POST['name']);
|
||||||
|
|
||||||
if(!$ArtistID || !is_number($ArtistID)) { error(404); }
|
if(!$ArtistID || !is_number($ArtistID)) { error(404); }
|
||||||
|
|
||||||
@ -56,7 +56,7 @@
|
|||||||
if(!empty($Groups)) {
|
if(!empty($Groups)) {
|
||||||
foreach($Groups as $GroupID) {
|
foreach($Groups as $GroupID) {
|
||||||
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
|
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
|
||||||
update_hash($GroupID);
|
Torrents::update_hash($GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@
|
|||||||
if(!empty($Requests)) {
|
if(!empty($Requests)) {
|
||||||
foreach($Requests as $RequestID) {
|
foreach($Requests as $RequestID) {
|
||||||
$Cache->delete_value('request_artists_'.$RequestID); // Delete group artist cache
|
$Cache->delete_value('request_artists_'.$RequestID); // Delete group artist cache
|
||||||
update_sphinx_requests($RequestID);
|
Requests::update_sphinx_requests($RequestID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$TargetArtistID = $ArtistID;
|
$TargetArtistID = $ArtistID;
|
||||||
@ -89,7 +89,7 @@
|
|||||||
if(!empty($Groups)) {
|
if(!empty($Groups)) {
|
||||||
foreach($Groups as $GroupID) {
|
foreach($Groups as $GroupID) {
|
||||||
$Cache->delete_value('groups_artists_'.$GroupID);
|
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||||
update_hash($GroupID);
|
Torrents::update_hash($GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@
|
|||||||
if(!empty($Requests)) {
|
if(!empty($Requests)) {
|
||||||
foreach($Requests as $RequestID) {
|
foreach($Requests as $RequestID) {
|
||||||
$Cache->delete_value('request_artists_'.$RequestID);
|
$Cache->delete_value('request_artists_'.$RequestID);
|
||||||
update_sphinx_requests($RequestID);
|
Requests::update_sphinx_requests($RequestID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@
|
|||||||
if(!empty($Groups)) {
|
if(!empty($Groups)) {
|
||||||
foreach($Groups as $GroupID) {
|
foreach($Groups as $GroupID) {
|
||||||
$Cache->delete_value('groups_artists_'.$GroupID);
|
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||||
update_hash($GroupID);
|
Torrents::update_hash($GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@
|
|||||||
if(!empty($Requests)) {
|
if(!empty($Requests)) {
|
||||||
foreach($Requests as $RequestID) {
|
foreach($Requests as $RequestID) {
|
||||||
$Cache->delete_value('request_artists_'.$RequestID);
|
$Cache->delete_value('request_artists_'.$RequestID);
|
||||||
update_sphinx_requests($RequestID);
|
Requests::update_sphinx_requests($RequestID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
//Include the header
|
//Include the header
|
||||||
show_header('Better');
|
View::show_header('Better');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h3 id="general">Pursuit of Perfection</h3>
|
<h3 id="general">Pursuit of Perfection</h3>
|
||||||
@ -98,4 +98,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
$All = false;
|
$All = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Torrents with bad file names');
|
View::show_header('Torrents with bad file names');
|
||||||
$DB->query("SELECT tfi.TorrentID, t.GroupID FROM torrents_bad_files AS tfi JOIN torrents AS t ON t.ID = tfi.TorrentID ".$Join." ORDER BY tfi.TimeAdded ASC");
|
$DB->query("SELECT tfi.TorrentID, t.GroupID FROM torrents_bad_files AS tfi JOIN torrents AS t ON t.ID = tfi.TorrentID ".$Join." ORDER BY tfi.TimeAdded ASC");
|
||||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||||
foreach($TorrentsInfo as $Torrent) {
|
foreach($TorrentsInfo as $Torrent) {
|
||||||
$GroupIDs[] = $Torrent['GroupID'];
|
$GroupIDs[] = $Torrent['GroupID'];
|
||||||
}
|
}
|
||||||
$Results = get_groups($GroupIDs);
|
$Results = Torrents::get_groups($GroupIDs);
|
||||||
$Results = $Results['matches'];
|
$Results = $Results['matches'];
|
||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -49,13 +49,13 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$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 = torrent_info($Torrents[$TorrentID]);
|
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
@ -85,5 +85,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
$All = false;
|
$All = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Torrents with bad folder names');
|
View::show_header('Torrents with bad folder names');
|
||||||
$DB->query("SELECT tbf.TorrentID, t.GroupID FROM torrents_bad_folders AS tbf JOIN torrents AS t ON t.ID = tbf.TorrentID ".$Join." ORDER BY tbf.TimeAdded ASC");
|
$DB->query("SELECT tbf.TorrentID, t.GroupID FROM torrents_bad_folders AS tbf JOIN torrents AS t ON t.ID = tbf.TorrentID ".$Join." ORDER BY tbf.TimeAdded ASC");
|
||||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||||
foreach($TorrentsInfo as $Torrent) {
|
foreach($TorrentsInfo as $Torrent) {
|
||||||
$GroupIDs[] = $Torrent['GroupID'];
|
$GroupIDs[] = $Torrent['GroupID'];
|
||||||
}
|
}
|
||||||
$Results = get_groups($GroupIDs);
|
$Results = Torrents::get_groups($GroupIDs);
|
||||||
$Results = $Results['matches'];
|
$Results = $Results['matches'];
|
||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -50,14 +50,14 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) {
|
if($GroupYear>0) {
|
||||||
$DisplayName.=" [".$GroupYear."]";
|
$DisplayName.=" [".$GroupYear."]";
|
||||||
}
|
}
|
||||||
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
||||||
$ExtraInfo = torrent_info($Torrents[$TorrentID]);
|
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
@ -87,5 +87,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
|
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Results = get_groups(array_keys($GroupIDs));
|
$Results = Torrents::get_groups(array_keys($GroupIDs));
|
||||||
|
|
||||||
show_header('Single seeder FLACs');
|
View::show_header('Single seeder FLACs');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<table width="100%" class="torrent_table">
|
<table width="100%" class="torrent_table">
|
||||||
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
||||||
@ -59,5 +59,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -49,9 +49,9 @@
|
|||||||
|
|
||||||
if(count($GroupIDs) == 0) { error('No results found'); }
|
if(count($GroupIDs) == 0) { error('No results found'); }
|
||||||
|
|
||||||
$Results = get_groups($GroupIDs);
|
$Results = Torrents::get_groups($GroupIDs);
|
||||||
|
|
||||||
show_header('Transcode Snatches');
|
View::show_header('Transcode Snatches');
|
||||||
?>
|
?>
|
||||||
<div class="linkbox">
|
<div class="linkbox">
|
||||||
<? if($SeedingOnly) { ?>
|
<? if($SeedingOnly) { ?>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
||||||
@ -116,5 +116,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
$All = false;
|
$All = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Torrents with bad tags');
|
View::show_header('Torrents with bad tags');
|
||||||
$DB->query("SELECT tbt.TorrentID, t.GroupID FROM torrents_bad_tags AS tbt JOIN torrents AS t ON t.ID = tbt.TorrentID ".$Join." ORDER BY tbt.TimeAdded ASC");
|
$DB->query("SELECT tbt.TorrentID, t.GroupID FROM torrents_bad_tags AS tbt JOIN torrents AS t ON t.ID = tbt.TorrentID ".$Join." ORDER BY tbt.TimeAdded ASC");
|
||||||
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
|
||||||
foreach($TorrentsInfo as $Torrent) {
|
foreach($TorrentsInfo as $Torrent) {
|
||||||
$GroupIDs[] = $Torrent['GroupID'];
|
$GroupIDs[] = $Torrent['GroupID'];
|
||||||
}
|
}
|
||||||
$Results = get_groups($GroupIDs);
|
$Results = Torrents::get_groups($GroupIDs);
|
||||||
$Results = $Results['matches'];
|
$Results = $Results['matches'];
|
||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -49,14 +49,14 @@
|
|||||||
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Results[$Info['GroupID']]);
|
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Results[$Info['GroupID']]);
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
if($GroupYear>0) {
|
if($GroupYear>0) {
|
||||||
$DisplayName.=" [".$GroupYear."]";
|
$DisplayName.=" [".$GroupYear."]";
|
||||||
}
|
}
|
||||||
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
|
||||||
$ExtraInfo = torrent_info($Torrents[$TorrentID]);
|
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||||
if($ExtraInfo) {
|
if($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName.=' - '.$ExtraInfo;
|
||||||
}
|
}
|
||||||
@ -86,5 +86,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
// If some were fetched from memcached, get their artists
|
// If some were fetched from memcached, get their artists
|
||||||
if(!empty($Results['matches'])) { // Fetch the artists for groups
|
if(!empty($Results['matches'])) { // Fetch the artists for groups
|
||||||
$GroupIDs = array_keys($Results['matches']);
|
$GroupIDs = array_keys($Results['matches']);
|
||||||
$Artists = get_artists($GroupIDs);
|
$Artists = Artists::get_artists($GroupIDs);
|
||||||
foreach($Artists as $GroupID=>$Data) {
|
foreach($Artists as $GroupID=>$Data) {
|
||||||
if(!empty($Data[1])) {
|
if(!empty($Data[1])) {
|
||||||
$Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists
|
$Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists
|
||||||
@ -44,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
// These ones were not found in the cache, run SQL
|
// These ones were not found in the cache, run SQL
|
||||||
if(!empty($Results['notfound'])) {
|
if(!empty($Results['notfound'])) {
|
||||||
$SQLResults = get_groups($Results['notfound']);
|
$SQLResults = Torrents::get_groups($Results['notfound']);
|
||||||
|
|
||||||
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
if(is_array($SQLResults['notfound'])) { // Something wasn't found in the db, remove it from results
|
||||||
reset($SQLResults['notfound']);
|
reset($SQLResults['notfound']);
|
||||||
@ -64,7 +64,7 @@
|
|||||||
$Results = $Results['matches'];
|
$Results = $Results['matches'];
|
||||||
|
|
||||||
|
|
||||||
show_header('Transcode Search');
|
View::show_header('Transcode Search');
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$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."]"; }
|
||||||
@ -142,5 +142,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -43,9 +43,9 @@
|
|||||||
|
|
||||||
if(count($GroupIDs) == 0) { error('No results found'); }
|
if(count($GroupIDs) == 0) { error('No results found'); }
|
||||||
|
|
||||||
$Results = get_groups($GroupIDs);
|
$Results = Torrents::get_groups($GroupIDs);
|
||||||
|
|
||||||
show_header('Transcode Uploads');
|
View::show_header('Transcode Uploads');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<table width="100%" class="torrent_table">
|
<table width="100%" class="torrent_table">
|
||||||
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
if(count($Artists)>0) {
|
if(count($Artists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$Artists));
|
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||||
}
|
}
|
||||||
$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."]"; }
|
||||||
@ -103,5 +103,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
enforce_login();
|
enforce_login();
|
||||||
|
|
||||||
define('ANNOUNCEMENT_FORUM_ID', 19);
|
define('ANNOUNCEMENT_FORUM_ID', 19);
|
||||||
show_header('Blog','bbcode');
|
View::show_header('Blog','bbcode');
|
||||||
require(SERVER_ROOT.'/classes/class_text.php');
|
require(SERVER_ROOT.'/classes/class_text.php');
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
header('Location: blog.php');
|
header('Location: blog.php');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ThreadID = 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);
|
||||||
}
|
}
|
||||||
@ -169,5 +169,5 @@
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
if ($Freeleech == "1") { $Title .= " / Freeleech!"; }
|
if ($Freeleech == "1") { $Title .= " / Freeleech!"; }
|
||||||
if ($Freeleech == "2") { $Title .= " / Neutral leech!"; }
|
if ($Freeleech == "2") { $Title .= " / Neutral leech!"; }
|
||||||
|
|
||||||
$UploaderInfo = user_info($UploaderID);
|
$UploaderInfo = Users::user_info($UploaderID);
|
||||||
$Item = $Feed->item($Title,
|
$Item = $Feed->item($Title,
|
||||||
$Text->strip_bbcode($Body),
|
$Text->strip_bbcode($Body),
|
||||||
'torrents.php?action=download&authkey=[[AUTHKEY]]&torrent_pass=[[PASSKEY]]&id='.$TorrentID,
|
'torrents.php?action=download&authkey=[[AUTHKEY]]&torrent_pass=[[PASSKEY]]&id='.$TorrentID,
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
$Title = ($Sneaky)?"$Username's bookmarked artists":'Your bookmarked artists';
|
$Title = ($Sneaky)?"$Username's bookmarked artists":'Your bookmarked artists';
|
||||||
|
|
||||||
show_header($Title,'browse');
|
View::show_header($Title,'browse');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!--content-->
|
</div><!--content-->
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
die();
|
die();
|
||||||
} ?>
|
} ?>
|
||||||
<table width="100%" class="artist_table">
|
<table width="100%" class="artist_table">
|
||||||
@ -92,6 +92,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
$Cache->cache_value('bookmarks_'.$UserID, serialize(array(array($Username, $TorrentList, $CollageDataList))), 3600);
|
$Cache->cache_value('bookmarks_'.$UserID, serialize(array(array($Username, $TorrentList, $CollageDataList))), 3600);
|
||||||
?>
|
?>
|
||||||
|
@ -43,7 +43,7 @@ function compare($X, $Y){
|
|||||||
$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) {
|
||||||
$TorrentList = get_groups($GroupIDs);
|
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -103,9 +103,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName = display_artists($ExtendedArtists);
|
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName = display_artists(array('1'=>$GroupArtists));
|
$DisplayName = Artists::display_artists(array('1'=>$GroupArtists));
|
||||||
} else {
|
} else {
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
}
|
}
|
||||||
@ -210,9 +210,9 @@ function compare($X, $Y){
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||||
</span>
|
</span>
|
||||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=torrent_info($Torrent)?></a>
|
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||||
</td>
|
</td>
|
||||||
<td class="nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -255,7 +255,7 @@ function compare($X, $Y){
|
|||||||
<span style="float:right;"><?=time_diff($AddedTime);?></span>
|
<span style="float:right;"><?=time_diff($AddedTime);?></span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -272,9 +272,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName .= display_artists($ExtendedArtists, false);
|
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName .= display_artists(array('1'=>$GroupArtists), false);
|
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
|
||||||
}
|
}
|
||||||
$DisplayName .= $GroupName;
|
$DisplayName .= $GroupName;
|
||||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||||
@ -308,7 +308,7 @@ function compare($X, $Y){
|
|||||||
$CollagePages[] = $CollagePage;
|
$CollagePages[] = $CollagePage;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header($Title, 'browse,collage');
|
View::show_header($Title, 'browse,collage');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -330,7 +330,7 @@ function compare($X, $Y){
|
|||||||
</div>
|
</div>
|
||||||
</div><!--content-->
|
</div><!--content-->
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
die();
|
die();
|
||||||
} ?>
|
} ?>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
@ -423,6 +423,6 @@ function compare($X, $Y){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
$Cache->cache_value('bookmarks_torrent_'.$UserID.'_full', serialize(array(array($TorrentList, $CollageDataList))), 3600);
|
$Cache->cache_value('bookmarks_torrent_'.$UserID.'_full', serialize(array(array($TorrentList, $CollageDataList))), 3600);
|
||||||
?>
|
?>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
enforce_login();
|
enforce_login();
|
||||||
show_header('IRC');
|
View::show_header('IRC');
|
||||||
|
|
||||||
$DB->query("SELECT IRCKey FROM users_main WHERE ID = $LoggedUser[ID]");
|
$DB->query("SELECT IRCKey FROM users_main WHERE ID = $LoggedUser[ID]");
|
||||||
list($IRCKey) = $DB->next_record();
|
list($IRCKey) = $DB->next_record();
|
||||||
@ -89,5 +89,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(POSTS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(POSTS_PER_PAGE);
|
||||||
|
|
||||||
//Get the cache catalogue
|
//Get the cache catalogue
|
||||||
$CatalogueID = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE);
|
$CatalogueID = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||||
@ -50,7 +50,7 @@
|
|||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
|
|
||||||
// Start printing
|
// Start printing
|
||||||
show_header('Comments for collage '.$Name, 'comments,bbcode');
|
View::show_header('Comments for collage '.$Name, 'comments,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -60,7 +60,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div class="linkbox">
|
<div class="linkbox">
|
||||||
<?
|
<?
|
||||||
$Pages=get_pages($Page,$Posts,POSTS_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$Posts,POSTS_PER_PAGE,9);
|
||||||
echo $Pages;
|
echo $Pages;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -70,13 +70,13 @@
|
|||||||
//---------- Begin printing
|
//---------- Begin printing
|
||||||
foreach($Thread as $Post){
|
foreach($Thread as $Post){
|
||||||
list($PostID, $AuthorID, $AddedTime, $Body) = $Post;
|
list($PostID, $AuthorID, $AddedTime, $Body) = $Post;
|
||||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||||
?>
|
?>
|
||||||
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a>
|
<span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a>
|
||||||
by <?=format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&type=collages_comment&id=<?=$PostID?>">[Report Comment]</a>
|
by <?=Users::format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&type=collages_comment&id=<?=$PostID?>">[Report Comment]</a>
|
||||||
<? if (!$ThreadInfo['IsLocked']){ ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a><? }
|
<? if (!$ThreadInfo['IsLocked']){ ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a><? }
|
||||||
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');">[Edit]</a><? }
|
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');">[Edit]</a><? }
|
||||||
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
|
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
|
||||||
@ -130,4 +130,4 @@
|
|||||||
<?=$Pages?>
|
<?=$Pages?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(COLLAGES_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(COLLAGES_PER_PAGE);
|
||||||
|
|
||||||
|
|
||||||
$OrderVals = array('Time', 'Name', 'Torrents');
|
$OrderVals = array('Time', 'Name', 'Torrents');
|
||||||
@ -32,7 +32,7 @@
|
|||||||
if(!empty($_GET['tags'])) {
|
if(!empty($_GET['tags'])) {
|
||||||
$Tags = explode(',',db_string(trim($_GET['tags'])));
|
$Tags = explode(',',db_string(trim($_GET['tags'])));
|
||||||
foreach($Tags as $ID=>$Tag) {
|
foreach($Tags as $ID=>$Tag) {
|
||||||
$Tags[$ID] = sanitize_tag($Tag);
|
$Tags[$ID] = Misc::sanitize_tag($Tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +102,8 @@
|
|||||||
if(!is_number($UserID)) {
|
if(!is_number($UserID)) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
$User = user_info($UserID);
|
$User = Users::user_info($UserID);
|
||||||
$Perms = get_permissions($User['PermissionID']);
|
$Perms = Permissions::get_permissions($User['PermissionID']);
|
||||||
$UserClass = $Perms['Class'];
|
$UserClass = $Perms['Class'];
|
||||||
|
|
||||||
$UserLink = '<a href="user.php?id='.$UserID.'">'.$User['Username'].'</a>';
|
$UserLink = '<a href="user.php?id='.$UserID.'">'.$User['Username'].'</a>';
|
||||||
@ -138,7 +138,7 @@
|
|||||||
$DB->query("SELECT FOUND_ROWS()");
|
$DB->query("SELECT FOUND_ROWS()");
|
||||||
list($NumResults) = $DB->next_record();
|
list($NumResults) = $DB->next_record();
|
||||||
|
|
||||||
show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages');
|
View::show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -247,7 +247,7 @@
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<?
|
<?
|
||||||
$Pages=get_pages($Page,$NumResults,COLLAGES_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$NumResults,COLLAGES_PER_PAGE,9);
|
||||||
echo $Pages;
|
echo $Pages;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -261,7 +261,7 @@
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
</div><!--box-->
|
</div><!--box-->
|
||||||
</div><!--content-->
|
</div><!--content-->
|
||||||
<? show_footer(); die();
|
<? View::show_footer(); die();
|
||||||
} ?>
|
} ?>
|
||||||
<table width="100%" class="collage_table">
|
<table width="100%" class="collage_table">
|
||||||
<tr class="colhead">
|
<tr class="colhead">
|
||||||
@ -304,12 +304,12 @@
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?=(int)$NumTorrents?></td>
|
<td><?=(int)$NumTorrents?></td>
|
||||||
<td><?=format_username($UserID, false, false, false)?></td>
|
<td><?=Users::format_username($UserID, false, false, false)?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</table>
|
</table>
|
||||||
<div class="linkbox"><?=$Pages?></div>
|
<div class="linkbox"><?=$Pages?></div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -83,7 +83,7 @@ function compare($X, $Y){
|
|||||||
$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) {
|
||||||
$TorrentList = get_groups($GroupIDs);
|
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -157,9 +157,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName .= display_artists($ExtendedArtists);
|
$DisplayName .= Artists::display_artists($ExtendedArtists);
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName .= display_artists(array('1'=>$GroupArtists));
|
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
|
||||||
}
|
}
|
||||||
|
|
||||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
@ -255,9 +255,9 @@ function compare($X, $Y){
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||||
</span>
|
</span>
|
||||||
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=torrent_info($Torrent)?></a>
|
» <a href="torrents.php?id=<?=$GroupID?>&torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
|
||||||
</td>
|
</td>
|
||||||
<td class="nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -295,7 +295,7 @@ function compare($X, $Y){
|
|||||||
<strong><?=$DisplayName?></strong>
|
<strong><?=$DisplayName?></strong>
|
||||||
<?=$TorrentTags?>
|
<?=$TorrentTags?>
|
||||||
</td>
|
</td>
|
||||||
<td class="nobr"><?=get_size($Torrent['Size'])?></td>
|
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||||
@ -312,9 +312,9 @@ function compare($X, $Y){
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName .= display_artists($ExtendedArtists, false);
|
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName .= display_artists(array('1'=>$GroupArtists), false);
|
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false);
|
||||||
}
|
}
|
||||||
$DisplayName .= $GroupName;
|
$DisplayName .= $GroupName;
|
||||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||||
@ -361,7 +361,7 @@ function compare($X, $Y){
|
|||||||
$CollagePages[] = $CollagePage;
|
$CollagePages[] = $CollagePage;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header($Name,'browse,collage,bbcode');
|
View::show_header($Name,'browse,collage,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -521,7 +521,7 @@ function compare($X, $Y){
|
|||||||
$i++;
|
$i++;
|
||||||
if($i>5) { break; }
|
if($i>5) { break; }
|
||||||
?>
|
?>
|
||||||
<li><?=format_username($ID, false, false, false)?> (<?=$User['count']?>)</li>
|
<li><?=Users::format_username($ID, false, false, false)?> (<?=$User['count']?>)</li>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -575,7 +575,7 @@ function compare($X, $Y){
|
|||||||
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
|
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
|
||||||
?>
|
?>
|
||||||
<div class="box comment">
|
<div class="box comment">
|
||||||
<div class="head">By <?=format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?> <a href="reports.php?action=report&type=collages_comment&id=<?=$CommentID?>">[Report Comment]</a></div>
|
<div class="head">By <?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?> <a href="reports.php?action=report&type=collages_comment&id=<?=$CommentID?>">[Report Comment]</a></div>
|
||||||
<div class="pad"><?=$Text->full_format($Body)?></div>
|
<div class="pad"><?=$Text->full_format($Body)?></div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
@ -648,7 +648,7 @@ function compare($X, $Y){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
|
|
||||||
$Cache->cache_value('collage_'.$CollageID, serialize(array(array($Name, $Description, $CollageDataList, $TorrentList, $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser))), 3600);
|
$Cache->cache_value('collage_'.$CollageID, serialize(array(array($Name, $Description, $CollageDataList, $TorrentList, $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser))), 3600);
|
||||||
?>
|
?>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Delete collage');
|
View::show_header('Delete collage');
|
||||||
?>
|
?>
|
||||||
<div class="thin center">
|
<div class="thin center">
|
||||||
<div class="box" style="width:600px; margin:0px auto;">
|
<div class="box" style="width:600px; margin:0px auto;">
|
||||||
@ -32,5 +32,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
$DB->query($SQL);
|
$DB->query($SQL);
|
||||||
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
|
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
|
||||||
$Artists = get_artists($DB->collect('GroupID'), false);
|
$Artists = Artists::get_artists($DB->collect('GroupID'), false);
|
||||||
$Skips = array();
|
$Skips = array();
|
||||||
$TotalSize = 0;
|
$TotalSize = 0;
|
||||||
|
|
||||||
@ -135,10 +135,10 @@
|
|||||||
|
|
||||||
require(SERVER_ROOT.'/classes/class_torrent.php');
|
require(SERVER_ROOT.'/classes/class_torrent.php');
|
||||||
require(SERVER_ROOT.'/classes/class_zip.php');
|
require(SERVER_ROOT.'/classes/class_zip.php');
|
||||||
$Zip = new ZIP(file_string($CollageName));
|
$Zip = new ZIP(Misc::file_string($CollageName));
|
||||||
foreach($Downloads as $Download) {
|
foreach($Downloads as $Download) {
|
||||||
list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $Year, $Album, $Size) = $Download;
|
list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $Year, $Album, $Size) = $Download;
|
||||||
$Artist = display_artists($Artists[$GroupID],false,true,false);
|
$Artist = Artists::display_artists($Artists[$GroupID],false,true,false);
|
||||||
if ($Rank == 100) {
|
if ($Rank == 100) {
|
||||||
$Skips[] = $Artist.$Album.' '.$Year;
|
$Skips[] = $Artist.$Album.' '.$Year;
|
||||||
continue;
|
continue;
|
||||||
@ -152,23 +152,23 @@
|
|||||||
// We need this section for long file names :/
|
// We need this section for long file names :/
|
||||||
$TorrentName='';
|
$TorrentName='';
|
||||||
$TorrentInfo='';
|
$TorrentInfo='';
|
||||||
$TorrentName = file_string($Artist.$Album);
|
$TorrentName = Misc::file_string($Artist.$Album);
|
||||||
if ($Year > 0) { $TorrentName.=' - '.file_string($Year); }
|
if ($Year > 0) { $TorrentName.=' - '.Misc::file_string($Year); }
|
||||||
if ($Media != '') { $TorrentInfo .= file_string($Media); }
|
if ($Media != '') { $TorrentInfo .= Misc::file_string($Media); }
|
||||||
if ($Format != '') {
|
if ($Format != '') {
|
||||||
if ($TorrentInfo!='') { $TorrentInfo .= ' - '; }
|
if ($TorrentInfo!='') { $TorrentInfo .= ' - '; }
|
||||||
$TorrentInfo .= file_string($Format);
|
$TorrentInfo .= Misc::file_string($Format);
|
||||||
}
|
}
|
||||||
if ($Encoding!='') {
|
if ($Encoding!='') {
|
||||||
if ($TorrentInfo != '') { $TorrentInfo.=' - '; }
|
if ($TorrentInfo != '') { $TorrentInfo.=' - '; }
|
||||||
$TorrentInfo .= file_string($Encoding);
|
$TorrentInfo .= Misc::file_string($Encoding);
|
||||||
}
|
}
|
||||||
if ($TorrentInfo != '') { $TorrentInfo = " ($TorrentInfo)"; }
|
if ($TorrentInfo != '') { $TorrentInfo = " ($TorrentInfo)"; }
|
||||||
if (strlen($TorrentName) + strlen($TorrentInfo) + 3 > 200) {
|
if (strlen($TorrentName) + strlen($TorrentInfo) + 3 > 200) {
|
||||||
$TorrentName = file_string($Album).(($Year>0)?(' - '.file_string($Year)):'');
|
$TorrentName = Misc::file_string($Album).(($Year>0)?(' - '.Misc::file_string($Year)):'');
|
||||||
}
|
}
|
||||||
$FileName = $TorrentName.$TorrentInfo;
|
$FileName = $TorrentName.$TorrentInfo;
|
||||||
$FileName = cut_string($FileName, 192, true, false);
|
$FileName = Format::cut_string($FileName, 192, true, false);
|
||||||
|
|
||||||
$Zip->add_file($Tor->enc(), $FileName.'.torrent');
|
$Zip->add_file($Tor->enc(), $FileName.'.torrent');
|
||||||
}
|
}
|
||||||
@ -176,9 +176,9 @@
|
|||||||
$Skipped = count($Skips);
|
$Skipped = count($Skips);
|
||||||
$Downloaded = $Analyzed - $Skipped;
|
$Downloaded = $Analyzed - $Skipped;
|
||||||
$Time = number_format(((microtime(true)-$ScriptStartTime)*1000),5).' ms';
|
$Time = number_format(((microtime(true)-$ScriptStartTime)*1000),5).' ms';
|
||||||
$Used = get_size(memory_get_usage(true));
|
$Used = Format::get_size(memory_get_usage(true));
|
||||||
$Date = date('M d Y, H:i');
|
$Date = date('M d Y, H:i');
|
||||||
$Zip->add_file('Collector Download Summary - '.SITE_NAME."\r\n\r\nUser:\t\t$LoggedUser[Username]\r\nPasskey:\t$LoggedUser[torrent_pass]\r\n\r\nTime:\t\t$Time\r\nUsed:\t\t$Used\r\nDate:\t\t$Date\r\n\r\nTorrents Analyzed:\t\t$Analyzed\r\nTorrents Filtered:\t\t$Skipped\r\nTorrents Downloaded:\t$Downloaded\r\n\r\nTotal Size of Torrents (Ratio Hit): ".get_size($TotalSize)."\r\n\r\nAlbums Unavailable within your criteria (consider making a request for your desired format):\r\n".implode("\r\n",$Skips), 'Summary.txt');
|
$Zip->add_file('Collector Download Summary - '.SITE_NAME."\r\n\r\nUser:\t\t$LoggedUser[Username]\r\nPasskey:\t$LoggedUser[torrent_pass]\r\n\r\nTime:\t\t$Time\r\nUsed:\t\t$Used\r\nDate:\t\t$Date\r\n\r\nTorrents Analyzed:\t\t$Analyzed\r\nTorrents Filtered:\t\t$Skipped\r\nTorrents Downloaded:\t$Downloaded\r\n\r\nTotal Size of Torrents (Ratio Hit): ".Format::get_size($TotalSize)."\r\n\r\nAlbums Unavailable within your criteria (consider making a request for your desired format):\r\n".implode("\r\n",$Skips), 'Summary.txt');
|
||||||
$Settings = array(implode(':',$_REQUEST['list']),$_REQUEST['preference']);
|
$Settings = array(implode(':',$_REQUEST['list']),$_REQUEST['preference']);
|
||||||
$Zip->close_stream();
|
$Zip->close_stream();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
|
if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
|
||||||
|
|
||||||
show_header('Edit collage');
|
View::show_header('Edit collage');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -76,4 +76,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
$TagList = explode(',',$_POST['tags']);
|
$TagList = explode(',',$_POST['tags']);
|
||||||
foreach($TagList as $ID=>$Tag) {
|
foreach($TagList as $ID=>$Tag) {
|
||||||
$TagList[$ID] = sanitize_tag($Tag);
|
$TagList[$ID] = Misc::sanitize_tag($Tag);
|
||||||
}
|
}
|
||||||
$TagList = implode(' ',$TagList);
|
$TagList = implode(' ',$TagList);
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
|
$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||||
if(count($GroupIDs)>0) {
|
if(count($GroupIDs)>0) {
|
||||||
$TorrentList = get_groups($GroupIDs);
|
$TorrentList = Torrents::get_groups($GroupIDs);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Manage collage '.$Name);
|
View::show_header('Manage collage '.$Name);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -85,9 +85,9 @@
|
|||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
unset($ExtendedArtists[3]);
|
unset($ExtendedArtists[3]);
|
||||||
$DisplayName .= display_artists($ExtendedArtists, true, false);
|
$DisplayName .= Artists::display_artists($ExtendedArtists, true, false);
|
||||||
} elseif(count($GroupArtists)>0) {
|
} elseif(count($GroupArtists)>0) {
|
||||||
$DisplayName .= display_artists(array('1'=>$GroupArtists), true, false);
|
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), true, false);
|
||||||
}
|
}
|
||||||
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||||
$GroupYear = $GroupYear > 0 ? $GroupYear : '';
|
$GroupYear = $GroupYear > 0 ? $GroupYear : '';
|
||||||
@ -104,7 +104,7 @@
|
|||||||
<td><?=$GroupYear?></td>
|
<td><?=$GroupYear?></td>
|
||||||
<td><?=$DisplayName?> </td>
|
<td><?=$DisplayName?> </td>
|
||||||
<td><?=$TorrentLink?></td>
|
<td><?=$TorrentLink?></td>
|
||||||
<td class="nobr"><?=format_username($UserID, $Username)?></td>
|
<td class="nobr"><?=Users::format_username($UserID, $Username)?></td>
|
||||||
<td class="nobr">
|
<td class="nobr">
|
||||||
<input type="hidden" name="action" value="manage_handle" />
|
<input type="hidden" name="action" value="manage_handle" />
|
||||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||||
@ -131,4 +131,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
show_header('Create a collage');
|
View::show_header('Create a collage');
|
||||||
|
|
||||||
if (!check_perms('site_collages_renamepersonal')) {
|
if (!check_perms('site_collages_renamepersonal')) {
|
||||||
$ChangeJS = "OnChange=\"if ( this.options[this.selectedIndex].value == '0') { $('#namebox').hide(); $('#personal').show(); } else { $('#namebox').show(); $('#personal').hide(); }\"";
|
$ChangeJS = "OnChange=\"if ( this.options[this.selectedIndex].value == '0') { $('#namebox').hide(); $('#personal').show(); } else { $('#namebox').show(); $('#personal').hide(); }\"";
|
||||||
@ -86,4 +86,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
$TagList = explode(',',$_POST['tags']);
|
$TagList = explode(',',$_POST['tags']);
|
||||||
foreach($TagList as $ID=>$Tag) {
|
foreach($TagList as $ID=>$Tag) {
|
||||||
$TagList[$ID] = sanitize_tag($Tag);
|
$TagList[$ID] = Misc::sanitize_tag($Tag);
|
||||||
}
|
}
|
||||||
$TagList = implode(' ',$TagList);
|
$TagList = implode(' ',$TagList);
|
||||||
|
|
||||||
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
$CollageID = $DB->inserted_id();
|
$CollageID = $DB->inserted_id();
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
write_log("Collage ".$CollageID." (".$_POST['name'].") was created by ".$LoggedUser['Username']);
|
Misc::write_log("Collage ".$CollageID." (".$_POST['name'].") was created by ".$LoggedUser['Username']);
|
||||||
header('Location: collages.php?id='.$CollageID);
|
header('Location: collages.php?id='.$CollageID);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
} else {
|
} else {
|
||||||
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID");
|
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID");
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
write_log("Collage ".$CollageID." was recovered by ".$LoggedUser['Username']);
|
Misc::write_log("Collage ".$CollageID." was recovered by ".$LoggedUser['Username']);
|
||||||
header("Location: collages.php?id=$CollageID");
|
header("Location: collages.php?id=$CollageID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show_header("Collage recovery!");
|
View::show_header("Collage recovery!");
|
||||||
?>
|
?>
|
||||||
<div class="thin center">
|
<div class="thin center">
|
||||||
<div class="box" style="width:600px; margin:0px auto;">
|
<div class="box" style="width:600px; margin:0px auto;">
|
||||||
@ -35,5 +35,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer();
|
<? View::show_footer();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
$DB->query("UPDATE collages SET Deleted = '1' WHERE ID='$CollageID'");
|
$DB->query("UPDATE collages SET Deleted = '1' WHERE ID='$CollageID'");
|
||||||
}
|
}
|
||||||
|
|
||||||
write_log("Collage ".$CollageID." (".$Name.") was deleted by ".$LoggedUser['Username'].": ".$Reason);
|
Misc::write_log("Collage ".$CollageID." (".$Name.") was deleted by ".$LoggedUser['Username'].": ".$Reason);
|
||||||
|
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
header('Location: collages.php');
|
header('Location: collages.php');
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
if(!is_number($UserID)) {
|
if(!is_number($UserID)) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
$UserInfo = 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;
|
||||||
} else {
|
} else {
|
||||||
$Self = false;
|
$Self = false;
|
||||||
}
|
}
|
||||||
$Perms = get_permissions($UserInfo['PermissionID']);
|
$Perms = Permissions::get_permissions($UserInfo['PermissionID']);
|
||||||
$UserClass = $Perms['Class'];
|
$UserClass = $Perms['Class'];
|
||||||
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID)) { error(403); }
|
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID)) { error(403); }
|
||||||
} else {
|
} else {
|
||||||
@ -39,7 +39,7 @@
|
|||||||
$PerPage = POSTS_PER_PAGE;
|
$PerPage = POSTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit($PerPage);
|
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||||
$OtherLink = '';
|
$OtherLink = '';
|
||||||
|
|
||||||
if($MyTorrents) {
|
if($MyTorrents) {
|
||||||
@ -51,7 +51,7 @@
|
|||||||
else {
|
else {
|
||||||
$Conditions = "WHERE tc.AuthorID = $UserID";
|
$Conditions = "WHERE tc.AuthorID = $UserID";
|
||||||
$Title = 'Comments made by '.($Self?'you':$Username);
|
$Title = 'Comments made by '.($Self?'you':$Username);
|
||||||
$Header = 'Torrent comments left by '.($Self?'you':format_username($UserID, false, false, false)).'';
|
$Header = 'Torrent comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).'';
|
||||||
if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>';
|
if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,14 +82,14 @@
|
|||||||
|
|
||||||
$DB->query("SELECT FOUND_ROWS()");
|
$DB->query("SELECT FOUND_ROWS()");
|
||||||
list($Results) = $DB->next_record();
|
list($Results) = $DB->next_record();
|
||||||
$Pages=get_pages($Page,$Results,$PerPage, 11);
|
$Pages=Format::get_pages($Page,$Results,$PerPage, 11);
|
||||||
|
|
||||||
$DB->set_query_id($Comments);
|
$DB->set_query_id($Comments);
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
|
|
||||||
$Artists = get_artists($GroupIDs);
|
$Artists = Artists::get_artists($GroupIDs);
|
||||||
|
|
||||||
show_header($Title,'bbcode');
|
View::show_header($Title,'bbcode');
|
||||||
$DB->set_query_id($Comments);
|
$DB->set_query_id($Comments);
|
||||||
|
|
||||||
?><div class="thin">
|
?><div class="thin">
|
||||||
@ -107,14 +107,14 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
|
while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
|
||||||
$UserInfo = user_info($UserID);
|
$UserInfo = Users::user_info($UserID);
|
||||||
?>
|
?>
|
||||||
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span style="float:left;"><a href="torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
<span style="float:left;"><a href="torrents.php?id=<?=$GroupID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||||
by <strong><?=format_username($UserID, true, true, true, true, false)?></strong> <?=time_diff($AddedTime) ?>
|
by <strong><?=Users::format_username($UserID, true, true, true, true, false)?></strong> <?=time_diff($AddedTime) ?>
|
||||||
on <?=display_artists($Artists[$GroupID])?><a href="torrents.php?id=<?=$GroupID?>"><?=$Title?></a>
|
on <?=Artists::display_artists($Artists[$GroupID])?><a href="torrents.php?id=<?=$GroupID?>"><?=$Title?></a>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -144,7 +144,7 @@
|
|||||||
?>
|
?>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
Last edited by
|
Last edited by
|
||||||
<?=format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
|
<?=Users::format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -164,6 +164,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
show_footer();
|
View::show_footer();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
enforce_login();
|
enforce_login();
|
||||||
show_header('Donation Canceled');
|
View::show_header('Donation Canceled');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -10,4 +10,4 @@
|
|||||||
<p>It's the thought that counts. Please reconsider donating in the future.</p>
|
<p>It's the thought that counts. Please reconsider donating in the future.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
enforce_login();
|
enforce_login();
|
||||||
show_header('Donation Complete');
|
View::show_header('Donation Complete');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -10,4 +10,4 @@
|
|||||||
<p>Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a <img src="<?=STATIC_SERVER?>common/symbols/donor.png" alt="Donor" />.</p>
|
<p>Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a <img src="<?=STATIC_SERVER?>common/symbols/donor.png" alt="Donor" />.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer();?>
|
<? View::show_footer();?>
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
|
|
||||||
$DonorPerms = get_permissions(DONOR);
|
$DonorPerms = Permissions::get_permissions(DONOR);
|
||||||
|
|
||||||
if ($_GET['miner']) { $LoggedUser['BitcoinMiner'] = 1; $_GET['showminer'] = 1; }
|
if ($_GET['miner']) { $LoggedUser['BitcoinMiner'] = 1; $_GET['showminer'] = 1; }
|
||||||
show_header('Donate');
|
View::show_header('Donate');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -103,4 +103,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END Donate -->
|
<!-- END Donate -->
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
|
|
||||||
$DonorPerms = get_permissions(DONOR);
|
$DonorPerms = Permissions::get_permissions(DONOR);
|
||||||
|
|
||||||
show_header('Donate');
|
View::show_header('Donate');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -105,4 +105,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END Donate -->
|
<!-- END Donate -->
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -47,10 +47,10 @@
|
|||||||
$Cache->begin_transaction('user_info_heavy_'.$_POST['custom']);
|
$Cache->begin_transaction('user_info_heavy_'.$_POST['custom']);
|
||||||
$Cache->update_row(false, array('Invites' => $Invites));
|
$Cache->update_row(false, array('Invites' => $Invites));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
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. Because this is your first time donating, you have now been awarded Donor status as represented by the <3 found on your profile and next to your username where it appears. This has entitled you to a additional site features which you can now explore, and has granted you '.DONOR_INVITES.' invitations to share with others. Thank you for supporting '.SITE_NAME.'.'),'');
|
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. Because this is your first time donating, you have now been awarded Donor status as represented by the <3 found on your profile and next to your username where it appears. This has entitled you to a additional site features which you can now explore, and has granted you '.DONOR_INVITES.' invitations to share with others. Thank you for supporting '.SITE_NAME.'.'),'');
|
||||||
} else {
|
} else {
|
||||||
//Repeat donor
|
//Repeat donor
|
||||||
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.'),'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if ($_POST['mc_gross'] > 0) {
|
if ($_POST['mc_gross'] > 0) {
|
||||||
//Donation less than minimum
|
//Donation less than minimum
|
||||||
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. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.'),'');
|
Misc::send_pm($_POST['custom'],0,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. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.'),'');
|
||||||
} else {
|
} else {
|
||||||
//Failed pending donation
|
//Failed pending donation
|
||||||
$Message = "User http://".NONSSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned.";
|
$Message = "User http://".NONSSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned.";
|
||||||
@ -83,7 +83,7 @@
|
|||||||
$Cache->begin_transaction('user_info_heavy_'.$_POST['custom']);
|
$Cache->begin_transaction('user_info_heavy_'.$_POST['custom']);
|
||||||
$Cache->update_row(false, array('Invites' => $Invites));
|
$Cache->update_row(false, array('Invites' => $Invites));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
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);
|
||||||
@ -100,7 +100,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$DB->query("INSERT INTO ip_bans
|
$DB->query("INSERT INTO ip_bans
|
||||||
(FromIP, ToIP, Reason) VALUES
|
(FromIP, ToIP, Reason) VALUES
|
||||||
('".ip2unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
|
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
|
||||||
}
|
}
|
||||||
fclose ($Socket);
|
fclose ($Socket);
|
||||||
if (check_perms('site_debug')) {
|
if (check_perms('site_debug')) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
function notify ($Channel, $Message) {
|
function notify ($Channel, $Message) {
|
||||||
global $LoggedUser;
|
global $LoggedUser;
|
||||||
send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? "https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SSL_SITE_URL."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
|
send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? "https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SSL_SITE_URL."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
$Errors = array('403','404','413','504');
|
$Errors = array('403','404','413','504');
|
||||||
@ -47,7 +47,7 @@ function notify ($Channel, $Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(empty($Ajax) && $Error != -1) {
|
if(empty($Ajax) && $Error != -1) {
|
||||||
show_header($Title);
|
View::show_header($Title);
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -58,7 +58,7 @@ function notify ($Channel, $Message) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
} else {
|
} else {
|
||||||
echo $Description;
|
echo $Description;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
<? if($Depth < count($Edits)) { ?>
|
<? if($Depth < count($Edits)) { ?>
|
||||||
<a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth + 1)?>); return false;">«</a>
|
<a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth + 1)?>); return false;">«</a>
|
||||||
<?=(($Depth == 0) ? 'Last edited by' : 'Edited by')?>
|
<?=(($Depth == 0) ? 'Last edited by' : 'Edited by')?>
|
||||||
<?=format_username($UserID, false, false, false) ?> <?=time_diff($Time,2,true,true)?>
|
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($Time,2,true,true)?>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<em>Original Post</em>
|
<em>Original Post</em>
|
||||||
<? }
|
<? }
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
$DB->query("SELECT ThreadID FROM forums_specific_rules WHERE ForumID = ".$ForumID);
|
$DB->query("SELECT ThreadID FROM forums_specific_rules WHERE ForumID = ".$ForumID);
|
||||||
$ThreadIDs = $DB->collect('ThreadID');
|
$ThreadIDs = $DB->collect('ThreadID');
|
||||||
|
|
||||||
show_header();
|
View::show_header();
|
||||||
?>
|
?>
|
||||||
<div class="thin box pad">
|
<div class="thin box pad">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -70,5 +70,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
show_footer();
|
View::show_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
$PerPage = POSTS_PER_PAGE;
|
$PerPage = POSTS_PER_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(TOPICS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(TOPICS_PER_PAGE);
|
||||||
|
|
||||||
//---------- Get some data to start processing
|
//---------- Get some data to start processing
|
||||||
|
|
||||||
@ -64,7 +64,7 @@
|
|||||||
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
|
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
|
||||||
|
|
||||||
// Start printing
|
// Start printing
|
||||||
show_header('Forums > '. $Forums[$ForumID]['Name']);
|
View::show_header('Forums > '. $Forums[$ForumID]['Name']);
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2><a href="forums.php">Forums</a> > <?=$ForumName?></h2>
|
<h2><a href="forums.php">Forums</a> > <?=$ForumName?></h2>
|
||||||
@ -137,7 +137,7 @@
|
|||||||
<? } ?>
|
<? } ?>
|
||||||
<div class="linkbox pager">
|
<div class="linkbox pager">
|
||||||
<?
|
<?
|
||||||
$Pages=get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9);
|
||||||
echo $Pages;
|
echo $Pages;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -222,7 +222,7 @@
|
|||||||
unset($PageLinks);
|
unset($PageLinks);
|
||||||
?>
|
?>
|
||||||
<strong>
|
<strong>
|
||||||
<a href="forums.php?action=viewthread&threadid=<?=$TopicID?>" title="<?=display_str($Title)?>"><?=display_str(cut_string($Title, $TopicLength)) ?></a>
|
<a href="forums.php?action=viewthread&threadid=<?=$TopicID?>" title="<?=display_str($Title)?>"><?=display_str(Format::cut_string($Title, $TopicLength)) ?></a>
|
||||||
</strong>
|
</strong>
|
||||||
<?=$PagesText?>
|
<?=$PagesText?>
|
||||||
</span>
|
</span>
|
||||||
@ -232,11 +232,11 @@
|
|||||||
</span>
|
</span>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<span style="float:right;" class="last_poster">
|
<span style="float:right;" class="last_poster">
|
||||||
by <?=format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?>
|
by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td><?=number_format($PostCount-1)?></td>
|
<td><?=number_format($PostCount-1)?></td>
|
||||||
<td><?=format_username($AuthorID, false, false, false)?></td>
|
<td><?=Users::format_username($AuthorID, false, false, false)?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<? }
|
<? }
|
||||||
} ?>
|
} ?>
|
||||||
@ -249,4 +249,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="linkbox">[<a href="forums.php?action=catchup&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a>]</div>
|
<div class="linkbox">[<a href="forums.php?action=catchup&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a>]</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
$LastRead = array();
|
$LastRead = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
show_header('Forums');
|
View::show_header('Forums');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2>Forums</h2>
|
<h2>Forums</h2>
|
||||||
@ -91,14 +91,14 @@
|
|||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<td>
|
<td>
|
||||||
<span style="float:left;" class="last_topic">
|
<span style="float:left;" class="last_topic">
|
||||||
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>" title="<?=display_str($LastTopic)?>"><?=display_str(cut_string($LastTopic, 50, 1))?></a>
|
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>" title="<?=display_str($LastTopic)?>"><?=display_str(Format::cut_string($LastTopic, 50, 1))?></a>
|
||||||
</span>
|
</span>
|
||||||
<? if (!empty($LastRead[$LastTopicID])) { ?>
|
<? if (!empty($LastRead[$LastTopicID])) { ?>
|
||||||
<span style="float: left;" class="last_read" title="Jump to last read">
|
<span style="float: left;" class="last_read" title="Jump to last read">
|
||||||
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>&page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a>
|
<a href="forums.php?action=viewthread&threadid=<?=$LastTopicID?>&page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a>
|
||||||
</span>
|
</span>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<span style="float:right;" class="last_poster">by <?=format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?></span>
|
<span style="float:right;" class="last_poster">by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?></span>
|
||||||
</td>
|
</td>
|
||||||
<td><?=number_format($NumTopics)?></td>
|
<td><?=number_format($NumTopics)?></td>
|
||||||
<td><?=number_format($NumPosts)?></td>
|
<td><?=number_format($NumPosts)?></td>
|
||||||
@ -108,4 +108,4 @@
|
|||||||
</table>
|
</table>
|
||||||
<div class="linkbox"><a href="forums.php?action=catchup&forumid=all&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a></div>
|
<div class="linkbox"><a href="forums.php?action=catchup&forumid=all&auth=<?=$LoggedUser['AuthKey']?>">Catch up</a></div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer();
|
<? View::show_footer();
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
$UpdateArray = array(
|
$UpdateArray = array(
|
||||||
'IsSticky'=>$Sticky,
|
'IsSticky'=>$Sticky,
|
||||||
'IsLocked'=>$Locked,
|
'IsLocked'=>$Locked,
|
||||||
'Title'=>cut_string($RawTitle, 150, 1, 0),
|
'Title'=>Format::cut_string($RawTitle, 150, 1, 0),
|
||||||
'ForumID'=>$ForumID
|
'ForumID'=>$ForumID
|
||||||
);
|
);
|
||||||
$Cache->update_row(false, $UpdateArray);
|
$Cache->update_row(false, $UpdateArray);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
if(!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { error(403); }
|
if(!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { error(403); }
|
||||||
show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode');
|
View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2><a href="forums.php">Forums</a> > <a href="forums.php?action=viewforum&forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> > <span id="newthreadtitle">New Topic</span></h2>
|
<h2><a href="forums.php">Forums</a> > <a href="forums.php?action=viewforum&forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> > <span id="newthreadtitle">New Topic</span></h2>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span style="float:left;"><a href='#newthreadpreview'>#XXXXXX</a>
|
<span style="float:left;"><a href='#newthreadpreview'>#XXXXXX</a>
|
||||||
by <strong><?=format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
|
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
|
||||||
Just now
|
Just now
|
||||||
</span>
|
</span>
|
||||||
<span id="barpreview" style="float:right;">
|
<span id="barpreview" style="float:right;">
|
||||||
@ -149,4 +149,4 @@ function RemoveAnswerField() {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
include(SERVER_ROOT.'/classes/class_text.php');
|
include(SERVER_ROOT.'/classes/class_text.php');
|
||||||
$Text = new TEXT;
|
$Text = new TEXT;
|
||||||
|
|
||||||
list($Page,$Limit) = page_limit(POSTS_PER_PAGE);
|
list($Page,$Limit) = Format::page_limit(POSTS_PER_PAGE);
|
||||||
|
|
||||||
if($LoggedUser['CustomForums']) {
|
if($LoggedUser['CustomForums']) {
|
||||||
unset($LoggedUser['CustomForums']['']);
|
unset($LoggedUser['CustomForums']['']);
|
||||||
@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Let's hope we got some results - start printing out the content.
|
// Let's hope we got some results - start printing out the content.
|
||||||
show_header('Forums'.' > '.'Search', 'bbcode');
|
View::show_header('Forums'.' > '.'Search', 'bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2><a href="forums.php">Forums</a> > Search<?=$Title?></h2>
|
<h2><a href="forums.php">Forums</a> > Search<?=$Title?></h2>
|
||||||
@ -257,7 +257,7 @@
|
|||||||
list($Results) = $DB->next_record();
|
list($Results) = $DB->next_record();
|
||||||
$DB->set_query_id($Records);
|
$DB->set_query_id($Records);
|
||||||
|
|
||||||
$Pages=get_pages($Page,$Results,POSTS_PER_PAGE,9);
|
$Pages=Format::get_pages($Page,$Results,POSTS_PER_PAGE,9);
|
||||||
echo $Pages;
|
echo $Pages;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -282,9 +282,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<? if(empty($ThreadID)) { ?>
|
<? if(empty($ThreadID)) { ?>
|
||||||
<a href="forums.php?action=viewthread&threadid=<?=$ID?>"><?=cut_string($Title, 80); ?></a>
|
<a href="forums.php?action=viewthread&threadid=<?=$ID?>"><?=Format::cut_string($Title, 80); ?></a>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<?=cut_string($Title, 80); ?>
|
<?=Format::cut_string($Title, 80); ?>
|
||||||
<? }
|
<? }
|
||||||
if ($Type == 'body') { ?>
|
if ($Type == 'body') { ?>
|
||||||
<a href="#" onclick="$('#post_<?=$PostID?>_text').toggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&threadid=<?=$ID?><? if(!empty($PostID)) { echo '&postid='.$PostID.'#post'.$PostID; } ?>"></a></span>
|
<a href="#" onclick="$('#post_<?=$PostID?>_text').toggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&threadid=<?=$ID?><? if(!empty($PostID)) { echo '&postid='.$PostID.'#post'.$PostID; } ?>"></a></span>
|
||||||
@ -308,4 +308,4 @@
|
|||||||
<?=$Pages?>
|
<?=$Pages?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer(); ?>
|
<? View::show_footer(); ?>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
error('Your posting rights have been removed');
|
error('Your posting rights have been removed');
|
||||||
}
|
}
|
||||||
|
|
||||||
$Title = cut_string(trim($_POST['title']), 150, 1, 0);
|
$Title = Format::cut_string(trim($_POST['title']), 150, 1, 0);
|
||||||
|
|
||||||
|
|
||||||
$ForumID = $_POST['forum'];
|
$ForumID = $_POST['forum'];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!check_perms('users_warn')) { error(404);
|
if (!check_perms('users_warn')) { error(404);
|
||||||
}
|
}
|
||||||
isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'postid', 'userid'));
|
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'postid', 'userid'));
|
||||||
|
|
||||||
$Reason = db_string($_POST['reason']);
|
$Reason = db_string($_POST['reason']);
|
||||||
$PrivateMessage = db_string($_POST['privatemessage']);
|
$PrivateMessage = db_string($_POST['privatemessage']);
|
||||||
@ -12,7 +12,7 @@
|
|||||||
$Key = (int)$_POST['key'];
|
$Key = (int)$_POST['key'];
|
||||||
$SQLTime = sqltime();
|
$SQLTime = sqltime();
|
||||||
|
|
||||||
$UserInfo = user_info($UserID);
|
$UserInfo = Users::user_info($UserID);
|
||||||
if($UserInfo['Class'] > $LoggedUser['Class']) {
|
if($UserInfo['Class'] > $LoggedUser['Class']) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@
|
|||||||
$URL = "https://".SSL_SITE_URL."/forums.php?action=viewthread&postid=$PostID#post$PostID";
|
$URL = "https://".SSL_SITE_URL."/forums.php?action=viewthread&postid=$PostID#post$PostID";
|
||||||
if ($Length != 'verbal') {
|
if ($Length != 'verbal') {
|
||||||
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
||||||
warn_user($UserID, $Time, "$URL - " . $Reason);
|
Tools::warn_user($UserID, $Time, "$URL - " . $Reason);
|
||||||
$Subject = "You have received a warning";
|
$Subject = "You have received a warning";
|
||||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
$DB -> query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
|
$DB -> query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
|
||||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||||
send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||||
|
|
||||||
//edit the post
|
//edit the post
|
||||||
$DB -> query("SELECT
|
$DB -> query("SELECT
|
||||||
|
@ -71,11 +71,11 @@
|
|||||||
} else {
|
} else {
|
||||||
$PostNum = 1;
|
$PostNum = 1;
|
||||||
}
|
}
|
||||||
list($Page,$Limit) = page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
|
||||||
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
if(($Page-1)*$PerPage > $ThreadInfo['Posts']) {
|
||||||
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
$Page = ceil($ThreadInfo['Posts']/$PerPage);
|
||||||
}
|
}
|
||||||
list($CatalogueID,$CatalogueLimit) = catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
||||||
|
|
||||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||||
if(!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
if(!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
$Thread = Format::catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
||||||
|
|
||||||
if($_GET['updatelastread'] != '0') {
|
if($_GET['updatelastread'] != '0') {
|
||||||
$LastPost = end($Thread);
|
$LastPost = end($Thread);
|
||||||
@ -138,7 +138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start printing
|
// Start printing
|
||||||
show_header('Forums'.' > '.$Forums[$ForumID]['Name'].' > '.$ThreadInfo['Title'],'comments,subscriptions,bbcode');
|
View::show_header('Forums'.' > '.$Forums[$ForumID]['Name'].' > '.$ThreadInfo['Title'],'comments,subscriptions,bbcode');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2>
|
<h2>
|
||||||
@ -176,7 +176,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
$Pages=get_pages($Page,$ThreadInfo['Posts'],$PerPage,9);
|
$Pages=Format::get_pages($Page,$ThreadInfo['Posts'],$PerPage,9);
|
||||||
echo $Pages;
|
echo $Pages;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -381,13 +381,13 @@
|
|||||||
|
|
||||||
foreach($Thread as $Key => $Post){
|
foreach($Thread as $Key => $Post){
|
||||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
||||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
|
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||||
?>
|
?>
|
||||||
<table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?>" id="post<?=$PostID?>">
|
<table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?>" id="post<?=$PostID?>">
|
||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div style="float:left;"><a class="post_id" href='forums.php?action=viewthread&threadid=<?=$ThreadID?>&postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
|
<div style="float:left;"><a class="post_id" href="forums.php?action=viewthread&threadid=<?=$ThreadID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||||
<?=format_username($AuthorID, true, true, true, true, true)?>
|
<?=Users::format_username($AuthorID, true, true, true, true, true)?>
|
||||||
<?=time_diff($AddedTime,2)?>
|
<?=time_diff($AddedTime,2)?>
|
||||||
<? if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')){ ?>
|
<? if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')){ ?>
|
||||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>', true);">[Quote]</a>
|
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>', true);">[Quote]</a>
|
||||||
@ -414,7 +414,7 @@
|
|||||||
<a href="reports.php?action=report&type=post&id=<?=$PostID?>">[Report]</a>
|
<a href="reports.php?action=report&type=post&id=<?=$PostID?>">[Report]</a>
|
||||||
<?
|
<?
|
||||||
if(check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
if(check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||||
$AuthorInfo = user_info($AuthorID);
|
$AuthorInfo = Users::user_info($AuthorID);
|
||||||
if($LoggedUser['Class'] >= $AuthorInfo['Class']) { ?>
|
if($LoggedUser['Class'] >= $AuthorInfo['Class']) { ?>
|
||||||
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
|
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
|
||||||
<input type="hidden" name="action" value="warn" />
|
<input type="hidden" name="action" value="warn" />
|
||||||
@ -451,7 +451,7 @@
|
|||||||
<a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">«</a>
|
<a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">«</a>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
Last edited by
|
Last edited by
|
||||||
<?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
|
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -478,7 +478,7 @@
|
|||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
|
||||||
by <?=format_username($LoggedUser['ID'], true, true, true, true, true)?> Just now
|
by <?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?> Just now
|
||||||
</span>
|
</span>
|
||||||
<span id="barpreview" style="float:right;">
|
<span id="barpreview" style="float:right;">
|
||||||
<a href="#quickreplypreview">[Report Post]</a>
|
<a href="#quickreplypreview">[Report Post]</a>
|
||||||
@ -606,4 +606,4 @@
|
|||||||
} // If user is moderator
|
} // If user is moderator
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<? show_footer();
|
<? View::show_footer();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user