Empty commit

This commit is contained in:
Git 2013-04-17 08:00:58 +00:00
parent cbc1680acf
commit fec9c0ca19
68 changed files with 4036 additions and 3174 deletions

View File

@ -1,6 +1,5 @@
<?
class Format
{
class Format {
/**
* Torrent Labels
* Map a common display string to a CSS class
@ -53,10 +52,14 @@ public static function cut_string($Str, $Length, $Hard = false, $ShowDots = true
array_pop($DescArr);
$CutDesc = implode(' ', $DescArr);
}
if ($ShowDots) { $CutDesc .= '...'; }
if ($ShowDots) {
$CutDesc .= '...';
}
} else {
$CutDesc = mb_substr($Str, 0, $Length, 'UTF-8');
if ($ShowDots) { $CutDesc .= '...'; }
if ($ShowDots) {
$CutDesc .= '...';
}
}
return $CutDesc;
} else {
@ -96,19 +99,22 @@ public static function get_ratio_color($Ratio) {
* @param boolean $Color if true, ratio will be coloured.
* @return string formatted ratio HTML
*/
public static function get_ratio_html($Dividend, $Divisor, $Color = true)
{
public static function get_ratio_html($Dividend, $Divisor, $Color = true) {
$Ratio = self::get_ratio($Dividend, $Divisor);
if ($Ratio === false) return '--';
if ($Ratio === '∞') return '<span class="r99" title="Infinite">∞</span>';
if ($Color)
if ($Ratio === false) {
return '--';
}
if ($Ratio === '∞') {
return '<span class="r99" title="Infinite">∞</span>';
}
if ($Color) {
$Ratio = sprintf('<span class="%s" title="%s">%s</span>',
self::get_ratio_color($Ratio),
self::get_ratio($Dividend, $Divisor, 5),
$Ratio
);
}
return $Ratio;
}
@ -120,11 +126,14 @@ public static function get_ratio_html($Dividend, $Divisor, $Color = true)
* @param int $Decimal floor to n decimals (eg Subtract .005 to floor to 2 decimals)
* @return boolean|string
*/
public function get_ratio ($Dividend, $Divisor, $Decimal = 2)
{
if ($Divisor == 0 && $Dividend == 0) return false;
if ($Divisor == 0) return '∞';
return number_format(max($Dividend/$Divisor - (0.5/pow(10, $Decimal)), 0), $Decimal);
public function get_ratio ($Dividend, $Divisor, $Decimal = 2) {
if ($Divisor == 0 && $Dividend == 0) {
return false;
}
if ($Divisor == 0) {
return '∞';
}
return number_format(max($Dividend / $Divisor - (0.5 / pow(10, $Decimal)), 0), $Decimal);
}
/**
@ -188,8 +197,8 @@ public static function catalogue_limit($Page, $PerPage, $CatalogueSize=500) {
return array($CatalogueID, $CatalogueLimit);
}
public static function catalogue_select($Catalogue, $Page, $PerPage, $CatalogueSize=500) {
return array_slice($Catalogue,(($PerPage*$Page-$PerPage)%$CatalogueSize),$PerPage,true);
public static function catalogue_select($Catalogue, $Page, $PerPage, $CatalogueSize = 500) {
return array_slice($Catalogue,(($PerPage * $Page - $PerPage) % $CatalogueSize),$PerPage,true);
}
@ -197,41 +206,41 @@ public static function catalogue_select($Catalogue, $Page, $PerPage, $CatalogueS
* 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.
* e.g. 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.
* e.g. 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.
* e.g. 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.
* e.g. 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'
* e.g. '#comment12'
* @return A sanitized HTML page listing.
*/
public static function get_pages($StartPage,$TotalRecords,$ItemsPerPage,$ShowPages=11,$Anchor='') {
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));
$StartPage = min($StartPage, ceil($TotalRecords / $ItemsPerPage));
$ShowPages--;
$TotalPages = ceil($TotalRecords/$ItemsPerPage);
$TotalPages = ceil($TotalRecords / $ItemsPerPage);
if ($TotalPages > $ShowPages) {
$StartPosition = $StartPage-round($ShowPages/2);
$StartPosition = $StartPage - round($ShowPages / 2);
if ($StartPosition <= 0) {
$StartPosition = 1;
} else {
if ($StartPosition >= ($TotalPages-$ShowPages)) {
$StartPosition = $TotalPages-$ShowPages;
if ($StartPosition >= ($TotalPages - $ShowPages)) {
$StartPosition = $TotalPages - $ShowPages;
}
}
$StopPage = $ShowPages+$StartPosition;
$StopPage = $ShowPages + $StartPosition;
} else {
$StopPage = $TotalPages;
@ -259,18 +268,18 @@ public static function get_pages($StartPage,$TotalRecords,$ItemsPerPage,$ShowPag
$Pages .= '<a href="'.$Location.'?page='.$i.$QueryString.$Anchor.'">';
}
$Pages .= "<strong>";
if ($i*$ItemsPerPage > $TotalRecords) {
$Pages .= ((($i-1)*$ItemsPerPage)+1).'-'.($TotalRecords);
if ($i * $ItemsPerPage > $TotalRecords) {
$Pages .= ((($i - 1) * $ItemsPerPage) + 1).'-'.($TotalRecords);
} else {
$Pages .= ((($i-1)*$ItemsPerPage)+1).'-'.($i*$ItemsPerPage);
$Pages .= ((($i - 1) * $ItemsPerPage) + 1).'-'.($i * $ItemsPerPage);
}
$Pages .= "</strong>";
$Pages .= '</strong>';
if ($i != $StartPage) {
$Pages.='</a>';
}
if ($i < $StopPage) {
$Pages.=" | ";
$Pages.=' | ';
}
}
} else {
@ -278,7 +287,7 @@ public static function get_pages($StartPage,$TotalRecords,$ItemsPerPage,$ShowPag
}
if ($StartPage && $StartPage < $TotalPages) {
$Pages .= ' | <a href="'.$Location.'?page='.($StartPage+1).$QueryString.$Anchor.'" class="pager_next"><strong>Next &gt;</strong></a> ';
$Pages .= ' | <a href="'.$Location.'?page='.($StartPage + 1).$QueryString.$Anchor.'" class="pager_next"><strong>Next &gt;</strong></a> ';
$Pages .= '<a href="'.$Location.'?page='.$TotalPages.$QueryString.$Anchor.'"><strong> Last &gt;&gt;</strong></a>';
}
}
@ -314,9 +323,9 @@ public static function get_size($Size, $Levels = 2) {
*/
public static function human_format($Number) {
$Steps = 0;
while($Number>=1000) {
while ($Number >= 1000) {
$Steps++;
$Number=$Number/1000;
$Number = $Number / 1000;
}
switch ($Steps) {
case 0: return round($Number); break;
@ -393,11 +402,11 @@ public static function form($Index, $Return = false) {
* @param $Array The array the option is in, defaults to GET.
* @return
*/
public static function selected($Name, $Value, $Attribute='selected', $Array = array()) {
public static function selected($Name, $Value, $Attribute = 'selected', $Array = array()) {
if (empty($Array)) {
$Array = $_GET;
}
if (isset($Array[$Name]) && $Array[$Name]!=='') {
if (isset($Array[$Name]) && $Array[$Name] !== '') {
if ($Array[$Name] == $Value) {
echo ' '.$Attribute.'="'.$Attribute.'"';
}
@ -468,12 +477,21 @@ public static function add_class($Target, $Tests, $ClassName, $AddAttribute, $Us
* @return UTF-8 encoded version of $Str
*/
public static function make_utf8($Str) {
if ($Str!="") {
if (self::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); }
if ($Str != '') {
if (self::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);
}
}
}
@ -508,9 +526,12 @@ public static function is_utf8($Str) {
public static function find_torrent_label_class ($text)
{
$index = mb_eregi_replace('(?:[^\w\d\s]+)', '', strtolower($text));
if (isset(self::$TorrentLabels[$index])) return self::$TorrentLabels[$index];
if (isset(self::$TorrentLabels[$index])) {
return self::$TorrentLabels[$index];
} else {
return self::$TorrentLabels['default'];
}
}
/**
* Creates a strong element that notes the torrent's state.
@ -522,9 +543,11 @@ public static function find_torrent_label_class ($text)
* @param string $class Custom CSS class
* @return string Strong element
*/
public static function torrent_label ($text, $class='')
public static function torrent_label ($text, $class = '')
{
if (empty($class)) $class = self::find_torrent_label_class($text);
if (empty($class)) {
$class = self::find_torrent_label_class($text);
}
return sprintf('<strong class="torrent_label %1$s" title="%2$s">%2$s</strong>',
display_str($class), display_str($text));
}

View File

@ -180,6 +180,7 @@ protected function listen() {
}
if (isset($this->DisabledUsers[$Nick[1]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[1]]);
}
}
@ -187,6 +188,7 @@ protected function listen() {
if (preg_match("/:([^!]+)![^\s]* PART #what.cd-disabled/", $this->Data, $Nick)) {
if (isset($this->DisabledUsers[$Nick[1]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[1]]);
}
}
@ -195,6 +197,7 @@ protected function listen() {
$Nick = explode(" ", $Nick[0]);
if (isset($this->DisabledUsers[$Nick[3]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[3] . "'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[3]]);
}
}

View File

@ -15,9 +15,9 @@
$BookmarkView = false;
if(empty($_GET['type'])) {
if (empty($_GET['type'])) {
$Title = 'Requests';
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
if (!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
$SS->set_filter('visible', array(1));
}
} else {
@ -27,8 +27,8 @@
$SS->set_filter('userid', array($LoggedUser['ID']));
break;
case 'voted':
if(!empty($_GET['userid'])) {
if(is_number($_GET['userid'])) {
if (!empty($_GET['userid'])) {
if (is_number($_GET['userid'])) {
if (!check_paranoia('requestsvoted_list', $UserInfo['Paranoia'], $Perms['Class'], $_GET['userid'])) {
print json_encode(array('status' => 'failure'));
die();
@ -45,7 +45,7 @@
}
break;
case 'filled':
if(empty($_GET['userid']) || !is_number($_GET['userid'])) {
if (empty($_GET['userid']) || !is_number($_GET['userid'])) {
print json_encode(array('status' => 'failure'));
die();
} else {
@ -68,132 +68,132 @@
}
}
if($Submitted && empty($_GET['show_filled'])) {
if ($Submitted && empty($_GET['show_filled'])) {
$SS->set_filter('torrentid', array(0));
}
if(!empty($_GET['search'])) {
if (!empty($_GET['search'])) {
$Words = explode(' ', $_GET['search']);
foreach($Words as $Key => &$Word) {
if($Word[0] == '!' && strlen($Word) > 2) {
if(strpos($Word,'!',1) === false) {
foreach ($Words as $Key => &$Word) {
if ($Word[0] == '!' && strlen($Word) > 2) {
if (strpos($Word,'!',1) === false) {
$Word = '!'.$SS->EscapeString(substr($Word,1));
} else {
$Word = $SS->EscapeString($Word);
}
} elseif(strlen($Word) >= 2) {
} elseif (strlen($Word) >= 2) {
$Word = $SS->EscapeString($Word);
} else {
unset($Words[$Key]);
}
}
if(!empty($Words)) {
if (!empty($Words)) {
$Queries[] = "@* ".implode(' ', $Words);
}
}
if(!empty($_GET['tags'])){
if (!empty($_GET['tags'])){
$Tags = explode(',', $_GET['tags']);
$TagNames = array();
foreach ($Tags as $Tag) {
$Tag = Misc::sanitize_tag($Tag);
if(!empty($Tag)) {
if (!empty($Tag)) {
$TagNames[] = $Tag;
}
}
$Tags = Misc::get_tags($TagNames);
}
if(empty($_GET['tags_type']) && !empty($Tags)) {
if (empty($_GET['tags_type']) && !empty($Tags)) {
$_GET['tags_type'] = '0';
$SS->set_filter('tagid', array_keys($Tags));
} elseif(!empty($Tags)) {
foreach(array_keys($Tags) as $Tag) {
} elseif (!empty($Tags)) {
foreach (array_keys($Tags) as $Tag) {
$SS->set_filter('tagid', array($Tag));
}
} else {
$_GET['tags_type'] = '1';
}
if(!empty($_GET['filter_cat'])) {
if (!empty($_GET['filter_cat'])) {
$CategoryArray = array_keys($_GET['filter_cat']);
if(count($CategoryArray) != count($Categories)) {
foreach($CategoryArray as $Key => $Index) {
if(!isset($Categories[$Index-1])) {
if (count($CategoryArray) != count($Categories)) {
foreach ($CategoryArray as $Key => $Index) {
if (!isset($Categories[$Index-1])) {
unset($CategoryArray[$Key]);
}
}
if(count($CategoryArray) >= 1) {
if (count($CategoryArray) >= 1) {
$SS->set_filter('categoryid', $CategoryArray);
}
}
}
if(!empty($_GET['releases'])) {
if (!empty($_GET['releases'])) {
$ReleaseArray = $_GET['releases'];
if(count($ReleaseArray) != count($ReleaseTypes)) {
foreach($ReleaseArray as $Index => $Value) {
if(!isset($ReleaseTypes[$Value])) {
if (count($ReleaseArray) != count($ReleaseTypes)) {
foreach ($ReleaseArray as $Index => $Value) {
if (!isset($ReleaseTypes[$Value])) {
unset($ReleaseArray[$Index]);
}
}
if(count($ReleaseArray) >= 1) {
if (count($ReleaseArray) >= 1) {
$SS->set_filter('releasetype', $ReleaseArray);
}
}
}
if(!empty($_GET['formats'])) {
if (!empty($_GET['formats'])) {
$FormatArray = $_GET['formats'];
if(count($FormatArray) != count($Formats)) {
if (count($FormatArray) != count($Formats)) {
$FormatNameArray = array();
foreach($FormatArray as $Index => $MasterIndex) {
if(isset($Formats[$MasterIndex])) {
foreach ($FormatArray as $Index => $MasterIndex) {
if (isset($Formats[$MasterIndex])) {
$FormatNameArray[$Index] = '"'.strtr($Formats[$MasterIndex], '-.', ' ').'"';
}
}
if(count($FormatNameArray) >= 1) {
if (count($FormatNameArray) >= 1) {
$Queries[]='@formatlist (any | '.implode(' | ', $FormatNameArray).')';
}
}
}
if(!empty($_GET['media'])) {
if (!empty($_GET['media'])) {
$MediaArray = $_GET['media'];
if(count($MediaArray) != count($Media)) {
if (count($MediaArray) != count($Media)) {
$MediaNameArray = array();
foreach($MediaArray as $Index => $MasterIndex) {
if(isset($Media[$MasterIndex])) {
foreach ($MediaArray as $Index => $MasterIndex) {
if (isset($Media[$MasterIndex])) {
$MediaNameArray[$Index] = '"'.strtr($Media[$MasterIndex], '-.', ' ').'"';
}
}
if(count($MediaNameArray) >= 1) {
if (count($MediaNameArray) >= 1) {
$Queries[]='@medialist (any | '.implode(' | ', $MediaNameArray).')';
}
}
}
if(!empty($_GET['bitrates'])) {
if (!empty($_GET['bitrates'])) {
$BitrateArray = $_GET['bitrates'];
if(count($BitrateArray) != count($Bitrates)) {
if (count($BitrateArray) != count($Bitrates)) {
$BitrateNameArray = array();
foreach($BitrateArray as $Index => $MasterIndex) {
if(isset($Bitrates[$MasterIndex])) {
foreach ($BitrateArray as $Index => $MasterIndex) {
if (isset($Bitrates[$MasterIndex])) {
$BitrateNameArray[$Index] = '"'.strtr($SS->EscapeString($Bitrates[$MasterIndex]), '-.', ' ').'"';
}
}
if(count($BitrateNameArray) >= 1) {
if (count($BitrateNameArray) >= 1) {
$Queries[]='@bitratelist (any | '.implode(' | ', $BitrateNameArray).')';
}
}
}
if(!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
if(is_number($_GET['requestor'])) {
if (!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
if (is_number($_GET['requestor'])) {
$SS->set_filter('userid', array($_GET['requestor']));
} else {
print json_encode(array('status' => 'failure'));
@ -201,8 +201,8 @@
}
}
if(isset($_GET['year'])) {
if(is_number($_GET['year']) || $_GET['year'] == 0) {
if (isset($_GET['year'])) {
if (is_number($_GET['year']) || $_GET['year'] == 0) {
$SS->set_filter('year', array($_GET['year']));
} else {
print json_encode(array('status' => 'failure'));
@ -210,7 +210,7 @@
}
}
if(!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
$Page = $_GET['page'];
$SS->limit(($Page - 1) * REQUESTS_PER_PAGE, REQUESTS_PER_PAGE);
} else {
@ -218,15 +218,15 @@
$SS->limit(0, REQUESTS_PER_PAGE);
}
if(empty($_GET['order'])) {
if (empty($_GET['order'])) {
$CurrentOrder = 'created';
$CurrentSort = 'desc';
$Way = SPH_SORT_ATTR_DESC;
$NewSort = 'asc';
} else {
if(in_array($_GET['order'], $OrderWays)) {
if (in_array($_GET['order'], $OrderWays)) {
$CurrentOrder = $_GET['order'];
if($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
$CurrentSort = $_GET['sort'];
$Way = ($CurrentSort == 'asc' ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC);
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
@ -266,10 +266,10 @@
//print($Way); print($OrderBy); die();
$SS->SetSortMode($Way, $OrderBy);
if(count($Queries) > 0) {
if (count($Queries) > 0) {
$Query = implode(' ',$Queries);
} else {
$Query='';
$Query = '';
}
$SS->set_index('requests requests_delta');
@ -277,19 +277,19 @@
$NumResults = $SS->TotalResults;
//We don't use sphinxapi's default cache searcher, we use our own functions
if(!empty($SphinxResults['notfound'])) {
if (!empty($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
reset($SQLResults['notfound']);
foreach($SQLResults['notfound'] as $ID) {
foreach ($SQLResults['notfound'] as $ID) {
unset($SQLResults['matches'][$ID]);
unset($SphinxResults['matches'][$ID]);
}
}
// Merge SQL results with memcached results
foreach($SQLResults['matches'] as $ID => $SQLResult) {
foreach ($SQLResults['matches'] as $ID => $SQLResult) {
$SphinxResults['matches'][$ID] = $SQLResult;
//$Requests['matches'][$ID] = array_merge($Requests['matches'][$ID], $SQLResult);
@ -328,14 +328,14 @@
$VoteCount = count($RequestVotes['Voters']);
if($CategoryID == 0) {
if ($CategoryID == 0) {
$CategoryName = "Unknown";
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
$JsonArtists = array();
if($CategoryName == "Music") {
if ($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
$JsonArtists = array_values($ArtistForm);
}

View File

@ -1,8 +1,6 @@
<?
if(isset($_GET['details'])) {
if(in_array($_GET['details'],array('ul','dl','numul','uls','dls'))) {
if (isset($_GET['details'])) {
if (in_array($_GET['details'],array('ul','dl','numul','uls','dls'))) {
$Details = $_GET['details'];
} else {
print json_encode(array('status' => 'failure'));
@ -16,7 +14,8 @@
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$Limit = in_array($Limit, array(10,100,250)) ? $Limit : 10;
$BaseQuery = "SELECT
$BaseQuery = "
SELECT
u.ID,
u.Username,
ui.JoinDate,
@ -29,54 +28,54 @@
JOIN users_info AS ui ON ui.UserID = u.ID
LEFT JOIN torrents AS t ON t.UserID=u.ID
WHERE u.Enabled='1'
AND Uploaded>'". 5*1024*1024*1024 ."'
AND Downloaded>'". 5*1024*1024*1024 ."'
AND Uploaded>'". 5 * 1024 * 1024 * 1024 ."'
AND Downloaded>'". 5 * 1024 * 1024 * 1024 ."'
AND (Paranoia IS NULL OR (Paranoia NOT LIKE '%\"uploaded\"%' AND Paranoia NOT LIKE '%\"downloaded\"%'))
GROUP BY u.ID";
$OuterResults = array();
if($Details == 'all' || $Details == 'ul') {
if ($Details == 'all' || $Details == 'ul') {
if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
$TopUserUploads = $DB->to_array();
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600*12);
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600 * 12);
}
$OuterResults[] = generate_user_json('Uploaders', 'ul', $TopUserUploads, $Limit);
}
if($Details == 'all' || $Details == 'dl') {
if ($Details == 'all' || $Details == 'dl') {
if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
$TopUserDownloads = $DB->to_array();
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600*12);
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600 * 12);
}
$OuterResults[] = generate_user_json('Downloaders', 'dl', $TopUserDownloads, $Limit);
}
if($Details == 'all' || $Details == 'numul') {
if ($Details == 'all' || $Details == 'numul') {
if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
$TopUserNumUploads = $DB->to_array();
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600*12);
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600 * 12);
}
$OuterResults[] = generate_user_json('Torrents Uploaded', 'numul', $TopUserNumUploads, $Limit);
}
if($Details == 'all' || $Details == 'uls') {
if ($Details == 'all' || $Details == 'uls') {
if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
$TopUserUploadSpeed = $DB->to_array();
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600*12);
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600 * 12);
}
$OuterResults[] = generate_user_json('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit);
}
if($Details == 'all' || $Details == 'dls') {
if ($Details == 'all' || $Details == 'dls') {
if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
$TopUserDownloadSpeed = $DB->to_array();
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600*12);
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600 * 12);
}
$OuterResults[] = generate_user_json('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit);
}
@ -91,7 +90,7 @@
function generate_user_json($Caption, $Tag, $Details, $Limit) {
$results = array();
foreach($Details as $Details) {
foreach ($Details as $Details) {
$results[] = array(
'id' => (int) $Detail['ID'],
'username' => $Detail['Username'],

View File

@ -11,8 +11,7 @@
array('status' => 'failure')
);
}
}
else {
} else {
print json_encode(
array('status' => 'failure')
);

View File

@ -13,7 +13,7 @@ function error_out($reason = '') {
}
if (!empty($LoggedUser['DisableForums'])) {
error_out("You do not have access to the forums!");
error_out('You do not have access to the forums!');
}
@ -23,7 +23,7 @@ function error_out($reason = '') {
$UserID = empty($_GET['userid']) ? $LoggedUser['ID'] : $_GET['userid'];
if (!is_number($UserID)) {
error_out("User does not exist!");
error_out('User does not exist!');
}
if (isset($LoggedUser['PostsPerPage'])) {
@ -47,7 +47,7 @@ function error_out($reason = '') {
WHERE m.ID = $UserID");
if ($DB->record_count() == 0){ // If user doesn't exist
error_out("User does not exist!");
error_out('User does not exist!');
}
list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record();
} else {

View File

@ -2,7 +2,7 @@
//~~~~~~~~~~~ Main artist page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//For sorting tags
function compare($X, $Y){
function compare($X, $Y) {
return($Y['count'] - $X['count']);
}
@ -18,12 +18,14 @@ function compare($X, $Y){
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
$ArtistID = $_GET['id'];
if(!is_number($ArtistID)) { error(0); }
if (!is_number($ArtistID)) {
error(0);
}
if(!empty($_GET['revisionid'])) { // if they're viewing an old revision
if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
$RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)) {
if (!is_number($RevisionID)) {
error(0);
}
$Data = $Cache->get_value("artist_$ArtistID"."_revision_$RevisionID", true);
@ -32,7 +34,7 @@ function compare($X, $Y){
$RevisionID = false;
}
if($Data) {
if ($Data) {
if (!is_array($Data)) {
$Data = unserialize($Data);
}
@ -60,7 +62,9 @@ function compare($X, $Y){
$sql .= " GROUP BY a.ArtistID";
$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));
}
@ -72,7 +76,7 @@ function compare($X, $Y){
// Requests
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
if(!is_array($Requests)) {
if (!is_array($Requests)) {
$DB->query("SELECT
r.ID,
r.CategoryID,
@ -89,7 +93,7 @@ function compare($X, $Y){
GROUP BY r.ID
ORDER BY Votes DESC");
if($DB->record_count() > 0) {
if ($DB->record_count() > 0) {
$Requests = $DB->to_array();
} else {
$Requests = array();
@ -206,7 +210,7 @@ function compare($X, $Y){
if (!empty($UsedReleases)) { ?>
<div class="box center">
<?
foreach($UsedReleases as $ReleaseID) {
foreach ($UsedReleases as $ReleaseID) {
switch($ReleaseTypes[$ReleaseID]) {
case "Remix" :
$DisplayName = "Remixes";
@ -295,7 +299,7 @@ function compare($X, $Y){
$TorrentTags = new Tags($TagList, false);
if($ReleaseType!=$LastReleaseType) {
if ($ReleaseType != $LastReleaseType) {
switch($ReleaseTypes[$ReleaseType]) {
case "Remix" :
$DisplayName = "Remixes";
@ -312,7 +316,7 @@ function compare($X, $Y){
}
$ReleaseTypeLabel = strtolower(str_replace(' ','_',$ReleaseTypes[$ReleaseType]));
if($OpenTable) { ?>
if ($OpenTable) { ?>
</table>
<? } ?>
<table class="torrent_table grouped release_table" id="torrents_<?=$ReleaseTypeLabel?>">
@ -330,7 +334,7 @@ function compare($X, $Y){
$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&amp;groupid='.$GroupID.'&amp;artistid='.$ArtistID.'&amp;auth='.$LoggedUser['AuthKey'].'" class="brackets" title="Fix ghost DB entry">Fix</a>';
}
@ -344,7 +348,7 @@ function compare($X, $Y){
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
} elseif(count($GroupArtists)>0) {
} elseif (count($GroupArtists) > 0) {
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
}
break;
@ -354,7 +358,7 @@ function compare($X, $Y){
unset($ExtendedArtists[3]);
unset($ExtendedArtists[6]);
$DisplayName = Artists::display_artists($ExtendedArtists).$DisplayName;
} elseif(count($GroupArtists)>0) {
} elseif (count($GroupArtists) > 0) {
$DisplayName = Artists::display_artists(array(1 => $Artists), true, true).$DisplayName;
}
break;
@ -364,9 +368,13 @@ function compare($X, $Y){
}
}
if($GroupYear>0) { $DisplayName = $GroupYear. ' - '.$DisplayName; }
if ($GroupYear > 0) {
$DisplayName = $GroupYear. ' - '.$DisplayName;
}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
?>
@ -410,8 +418,9 @@ function compare($X, $Y){
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] !=
$LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
@ -445,7 +454,7 @@ function compare($X, $Y){
<?
}
}
if(!empty($TorrentList)) { ?>
if (!empty($TorrentList)) { ?>
</table>
</div>
<?}
@ -481,7 +490,7 @@ function compare($X, $Y){
}
}
if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
if (Bookmarks::has_bookmarked('artist', $ArtistID)) {
?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Unbookmark('artist', <?=$ArtistID?>,'Bookmark');return false;" class="brackets">Remove bookmark</a>
@ -490,12 +499,12 @@ function compare($X, $Y){
?>
<a href="#" id="bookmarklink_artist_<?=$ArtistID?>" onclick="Bookmark('artist', <?=$ArtistID?>,'Remove bookmark');return false;" class="brackets">Bookmark</a>
<?
}
}
?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a>
-->
<?
if (check_perms('site_edit_wiki')) {
if (check_perms('site_edit_wiki')) {
?>
<a href="artist.php?action=edit&amp;artistid=<?=$ArtistID?>" class="brackets">Edit</a>
<? } ?>
@ -509,7 +518,7 @@ function compare($X, $Y){
<a href="artist.php?action=delete&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Delete</a>
<? }
if ($RevisionID && check_perms('site_edit_wiki')) {
if ($RevisionID && check_perms('site_edit_wiki')) {
?>
<a href="artist.php?action=revert&amp;artistid=<?=$ArtistID?>&amp;revisionid=<?=$RevisionID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">
Revert to this revision
@ -519,10 +528,10 @@ function compare($X, $Y){
</div>
<? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
<div class="sidebar">
<? if($Image) { ?>
<? if ($Image) { ?>
<div class="box box_image">
<div class="head"><strong><?=$Name?></strong></div>
<div style="text-align:center;padding:10px 0px;">
<div style="text-align: center; padding: 10px 0px;">
<img style="max-width: 220px;" src="<?=ImageTools::thumbnail($Image)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$Image?>',220);" />
</div>
</div>
@ -543,8 +552,8 @@ function compare($X, $Y){
</div>
<?
if(check_perms('zip_downloader')){
if(isset($LoggedUser['Collector'])) {
if (check_perms('zip_downloader')) {
if (isset($LoggedUser['Collector'])) {
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
$ZIPList = explode(':',$ZIPList);
} else {
@ -563,40 +572,40 @@ function compare($X, $Y){
<? foreach ($ZIPList as $ListItem) { ?>
<li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span style="float:left;"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float:right;" class="brackets" title="Remove format from the Collector">X</a></span>
<br style="clear:all;" />
<span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float: right;" class="brackets" title="Remove format from the Collector">X</a></span>
<br style="clear: all;" />
</li>
<? } ?>
</ul>
<select id="formats" style="width:180px">
<select id="formats" style="width: 180px;">
<?
$OpenGroup = false;
$LastGroupID=-1;
$LastGroupID = -1;
foreach ($ZIPOptions as $Option) {
list($GroupID,$OptionID,$OptName) = $Option;
if($GroupID!=$LastGroupID) {
$LastGroupID=$GroupID;
if($OpenGroup) { ?>
if ($GroupID != $LastGroupID) {
$LastGroupID = $GroupID;
if ($OpenGroup) { ?>
</optgroup>
<? } ?>
<optgroup label="<?=$ZIPGroups[$GroupID]?>">
<? $OpenGroup = true;
}
?>
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if(in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
<?
}
?>
</optgroup>
</select>
<button type="button" onclick="add_selection()">+</button>
<select name="preference" style="width:210px">
<option value="0"<? if($ZIPPrefs==0){ echo ' selected="selected"'; } ?>>Prefer Original</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>
<select name="preference" style="width: 210px">
<option value="0"<? if ($ZIPPrefs == 0){ echo ' selected="selected"'; } ?>>Prefer Original</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>
</select>
<input type="submit" style="width:210px" value="Download" />
</form>
@ -628,7 +637,7 @@ function compare($X, $Y){
<?
if(empty($SimilarArray)) {
if (empty($SimilarArray)) {
$DB->query("
SELECT
s2.ArtistID,
@ -651,14 +660,14 @@ function compare($X, $Y){
<div class="head"><strong>Similar artists</strong></div>
<ul class="stats nobullet">
<?
if($NumSimilar == 0) { ?>
if ($NumSimilar == 0) { ?>
<li><span style="font-style: italic;">None found</span></li>
<? }
$First = true;
foreach ($SimilarArray as $SimilarArtist) {
list($Artist2ID, $Artist2Name, $Score, $SimilarID) = $SimilarArtist;
$Score = $Score/100;
if($First) {
$Score = $Score / 100;
if ($First) {
$Max = $Score + 1;
$First = false;
}
@ -667,11 +676,11 @@ function compare($X, $Y){
?>
<li>
<span title="<?=$Score?>"><a href="artist.php?id=<?=$Artist2ID?>" style="float:left; display:block;"><?=$Artist2Name?></a></span>
<div style="float:right; display:block; letter-spacing: -1px;">
<span title="<?=$Score?>"><a href="artist.php?id=<?=$Artist2ID?>" style="float: left; display: block;"><?=$Artist2Name?></a></span>
<div style="float: right; display: block; letter-spacing: -1px;">
<a href="artist.php?action=vote_similar&amp;artistid=<?=$ArtistID?>&amp;similarid=<?=$SimilarID?>&amp;way=down" style="font-family: monospace;" title="Vote down this similar artist. Use this when you feel that the two artists are not all that similar." class="brackets">&minus;</a>
<a href="artist.php?action=vote_similar&amp;artistid=<?=$ArtistID?>&amp;similarid=<?=$SimilarID?>&amp;way=up" style="font-family: monospace;" title="Vote up this similar artist. Use this when you feel that the two artists are quite similar." class="brackets">+</a>
<? if(check_perms('site_delete_tag')) { ?>
<? if (check_perms('site_delete_tag')) { ?>
<span class="remove remove_artist"><a href="artist.php?action=delete_similar&amp;similarid=<?=$SimilarID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" title="Remove this similar artist" class="brackets">X</a></span>
<? } ?>
</div>
@ -700,7 +709,7 @@ function compare($X, $Y){
echo $TorrentDisplayList;
if($NumRequests > 0) {
if ($NumRequests > 0) {
?>
<table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
@ -720,16 +729,16 @@ function compare($X, $Y){
</td>
</tr>
<?
foreach($Requests as $Request) {
foreach ($Requests as $Request) {
list($RequestID, $CategoryID, $Title, $Year, $TimeAdded, $Votes, $Bounty) = $Request;
$CategoryName = $Categories[$CategoryID - 1];
if($CategoryName == "Music") {
if ($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else if($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
} elseif ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
$FullName = "<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else {
$FullName ="<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title."</a>";
@ -739,7 +748,7 @@ function compare($X, $Y){
$Tags = get_request_tags($RequestID);
$ReqTagList = array();
foreach($Tags as $TagID => $TagName) {
foreach ($Tags as $TagID => $TagName) {
$ReqTagList[] = "<a href='requests.php?tags=".$TagName."'>".display_str($TagName)."</a>";
}
$ReqTagList = implode(', ', $ReqTagList);
@ -751,7 +760,7 @@ function compare($X, $Y){
</td>
<td>
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>
<? if(check_perms('site_vote')){ ?>
<? if (check_perms('site_vote')){ ?>
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
<? } ?>
@ -770,15 +779,15 @@ function compare($X, $Y){
// Similar artist map
if($NumSimilar>0) {
if($SimilarData = $Cache->get_value('similar_positions_'.$ArtistID)) {
if ($NumSimilar > 0) {
if ($SimilarData = $Cache->get_value('similar_positions_'.$ArtistID)) {
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->load_data($SimilarData);
if(!(current($Similar->Artists)->NameLength)) {
if (!(current($Similar->Artists)->NameLength)) {
unset($Similar);
}
}
if(empty($Similar) || empty($Similar->Artists)) {
if (empty($Similar) || empty($Similar->Artists)) {
include(SERVER_ROOT.'/classes/class_image.php');
$Img = new IMAGE;
$Img->create(WIDTH, HEIGHT);
@ -820,13 +829,13 @@ function compare($X, $Y){
function flipView() {
var state = document.getElementById('flip_view_1').style.display == 'block';
if(state) {
if (state) {
document.getElementById('flip_view_1').style.display='none';
document.getElementById('flip_view_2').style.display='block';
document.getElementById('flipper_title').innerHTML = 'Similar artist cloud';
document.getElementById('flip_to').innerHTML = 'Switch to map';
if(!cloudLoaded) {
if (!cloudLoaded) {
require("static/functions/jquery.js", function () {
require("static/functions/tagcanvas.js", function () {
require("static/functions/artist_cloud.js", function () {
@ -882,7 +891,7 @@ function require(file, callback) {
// gets the amount of comments for this group
$Results = $Cache->get_value('artist_comments_'.$ArtistID);
if($Results === false) {
if ($Results === false) {
$DB->query("SELECT
COUNT(c.ID)
FROM artist_comments as c
@ -891,7 +900,7 @@ function require(file, callback) {
$Cache->cache_value('artist_comments_'.$ArtistID, $Results, 0);
}
if(isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
$DB->query("SELECT COUNT(ID) FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
@ -907,7 +916,7 @@ function require(file, callback) {
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID);
if($Catalogue === false) {
if ($Catalogue === false) {
$DB->query("SELECT
c.ID,
c.AuthorID,
@ -938,7 +947,7 @@ function require(file, callback) {
<?
//---------- Begin printing
foreach($Thread as $Key => $Post) {
foreach ($Thread as $Key => $Post) {
list($PostID, $AuthorID, $AddedTime, $CommentBody, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
?>

View File

@ -28,16 +28,15 @@
<a href="#">&uarr;</a>&nbsp;<strong>Upcoming concerts</strong>
<a href="#" class="brackets" onclick="$('#concertsbody').toggle(); return false;">Toggle</a>
</div>
<div id="concertsbody"<?=$Hidden ? ' class="hidden"' : ''?>>
<div id="concertsbody"<?=$Hidden ? ' class="hidden"' : '' ?>>
<?=$Concerts?>
</div>
</div>
<?
function make_concert_link($Event)
{
function make_concert_link($Event) {
// The event doesn't have a start date (this should never happen)
if ($Event['startDate'] == "") {
if ($Event['startDate'] == '') {
return;
}
$Date = get_date_title($Event['startDate']);
@ -46,22 +45,21 @@ function make_concert_link($Event)
$Concert = "<a href='" . $Event['url'] . "'>" . $ConcertTitle . "</a>";
?>
<form class="hidden" action="" id="concert<?=$Event['id']?>" method="post">
<input type="hidden" name="action" value="concert_thread"/>
<input type="hidden" name="concert_title" value="<?="[Concert] " . display_str($Name) . " - " . $ConcertTitle?>"/>
<input type="hidden" name="concert_id" value="<?=$Event['id']?>"/>
<input type="hidden" name="concert_template" value="<?=get_concert_post_template($Name, $Event)?>"/>
<input type="hidden" name="action" value="concert_thread" />
<input type="hidden" name="concert_title" value="<?="[Concert] " . display_str($Name) . " - " . $ConcertTitle?>" />
<input type="hidden" name="concert_id" value="<?=$Event['id']?>" />
<input type="hidden" name="concert_template" value="<?=get_concert_post_template($Name, $Event)?>" />
</form>
<li><?=$Concert?> - <a href="#" class="brackets" onclick="$('#concert<?=$Event['id']?>').raw().submit(); return false;">Go to thread</a></li>
<?
}
function get_concert_post_template($Artist, $Event)
{
$With = "";
$EventTitle = "";
$Location = "";
$Directions = "";
$Website = "";
function get_concert_post_template($Artist, $Event) {
$With = '';
$EventTitle = '';
$Location = '';
$Directions = '';
$Website = '';
if (!empty($Event['venue']['website'])) {
$Url = $Event['venue']['website'];
if (strpos ($Url, '://') === false) {
@ -82,7 +80,7 @@ function get_concert_post_template($Artist, $Event)
if (strpos ($Url, '://') === false) {
$Url = 'http://' . $Url;
}
$Website = "[b]Web site:[/b] " . $Url;
$Website = '[b]Web site:[/b] ' . $Url;
}
if (isset($Event['artists']['artist']) && (count($Event['artists']['artist']) == 1 && strtolower($Event['artists']['artist'][1]) == strtolower($Artist))) {
$i = 0;
@ -111,17 +109,15 @@ function get_concert_post_template($Artist, $Event)
[align=center]. . . . . . . . . .[/align]";
}
function get_date_title($Str)
{
function get_date_title($Str) {
$Exploded = explode(' ', $Str);
$Date = $Exploded[2] . " " . $Exploded[1] . ", " . $Exploded[3];
$Date = $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3];
return $Date;
}
function get_date_post($Str)
{
function get_date_post($Str) {
$Exploded = explode(' ', $Str);
$Date = $Exploded[2] . " " . $Exploded[1] . ", " . $Exploded[3] . " (" . rtrim($Exploded[0], ',') . ")";
$Date = $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3] . ' (' . rtrim($Exploded[0], ',') . ')';
return $Date;
}

View File

@ -1,5 +1,7 @@
<?php
if (!check_perms('users_warn')) { error(404);}
if (!check_perms('users_warn')) {
error(404);
}
Misc::assert_isset_request($_POST, array('artistid', 'postid', 'userid', 'key'));
$ArtistID = (int) $_POST['artistid'];
@ -23,11 +25,11 @@
</div>
<div class="thin box pad">
<form class="create_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
<input type="hidden" name="artistid" value="<?=$ArtistID?>"/>
<input type="hidden" name="postid" value="<?=$PostID?>"/>
<input type="hidden" name="userid" value="<?=$UserID?>"/>
<input type="hidden" name="key" value="<?=$Key?>"/>
<input type="hidden" name="action" value="take_warn"/>
<input type="hidden" name="artistid" value="<?=$ArtistID?>" />
<input type="hidden" name="postid" value="<?=$PostID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="key" value="<?=$Key?>" />
<input type="hidden" name="action" value="take_warn" />
<table class="layout" align="center">
<tr>
<td class="label">Reason:</td>
@ -41,25 +43,25 @@
<select name="length">
<option value="verbal">Verbal</option>
<option value="1">1 week</option>
<option value="2">2 week</option>
<option value="4">4 week</option>
<? if(check_perms("users_mod")) { ?>
<option value="8">8 week</option>
<? } ?>
<option value="2">2 weeks</option>
<option value="4">4 weeks</option>
<? if(check_perms('users_mod')) { ?>
<option value="8">8 weeks</option>
<? } ?>
</select></td>
</tr>
<tr>
<td class="label">Private Message:</td>
<td class="label">Private message:</td>
<td>
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
</td>
</tr>
<tr>
<td class="label">Edit Post:</td>
<td class="label">Edit post:</td>
<td>
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
<br />
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
<input type="submit" id="submit_button" value="Warn user" tabindex="1" />
</td>
</tr>
</table>

View File

@ -1,7 +1,7 @@
<?
function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false) {
global $DB, $Cache;
if((!$ThreadInfo = $Cache->get_value('thread_'.$ThreadID.'_info')) || !isset($ThreadInfo['OP'])) {
if ((!$ThreadInfo = $Cache->get_value('thread_'.$ThreadID.'_info')) || !isset($ThreadInfo['OP'])) {
$DB->query("SELECT
t.Title,
t.ForumID,
@ -17,9 +17,11 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false) {
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
WHERE t.ID = '$ThreadID'
GROUP BY fp.TopicID");
if($DB->record_count()==0) { error(404); }
if ($DB->record_count() == 0) {
error(404);
}
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC, false);
if($ThreadInfo['StickyPostID']) {
if ($ThreadInfo['StickyPostID']) {
$ThreadInfo['Posts']--;
$DB->query("SELECT
p.ID,
@ -34,11 +36,11 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false) {
WHERE p.TopicID = '$ThreadID' AND p.ID = '".$ThreadInfo['StickyPostID']."'");
list($ThreadInfo['StickyPost']) = $DB->to_array(false, MYSQLI_ASSOC);
}
if(!$SelectiveCache || !$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
if (!$SelectiveCache || !$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$Cache->cache_value('thread_'.$ThreadID.'_info', $ThreadInfo, 0);
}
}
if($Return) {
if ($Return) {
return $ThreadInfo;
}
}
@ -48,10 +50,10 @@ function check_forumperm($ForumID, $Perm = 'Read') {
if ($LoggedUser['CustomForums'][$ForumID] == 1) {
return true;
}
if($Forums[$ForumID]['MinClass'.$Perm] > $LoggedUser['Class'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) {
if ($Forums[$ForumID]['MinClass'.$Perm] > $LoggedUser['Class'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) {
return false;
}
if(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0) {
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0) {
return false;
}
return true;
@ -62,7 +64,7 @@ function check_forumperm($ForumID, $Perm = 'Read') {
function get_forum_info($ForumID) {
global $DB, $Cache;
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
if(!$Forum) {
if (!$Forum) {
$DB->query("SELECT
Name,
MinClassRead,
@ -73,7 +75,7 @@ function get_forum_info($ForumID) {
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
WHERE forums.ID='$ForumID'
GROUP BY ForumID");
if($DB->record_count() == 0) {
if ($DB->record_count() == 0) {
return false;
}
// Makes an array, with $Forum['Name'], etc.

View File

@ -1,12 +1,12 @@
<?php
ini_set('display_errors', '1');authorize();
ini_set('display_errors', '1');
authorize();
$ForumID = db_string($_GET['forumid']);
if($_GET['perform'] == 'add') {
if ($_GET['perform'] == 'add') {
$DB->query("INSERT IGNORE INTO subscribed_forums (ForumID, SubscriberID) VALUES ('$ForumID', '$LoggedUser[ID]')");
}
elseif($_GET['perform'] == 'remove') {
} elseif ($_GET['perform'] == 'remove') {
$DB->query("DELETE FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID = '$LoggedUser[ID]'");
}
header('Location: forums.php?action=viewforum&forumid=' . $ForumID);

View File

@ -18,20 +18,20 @@
error(403);
}
$URL = "https://" . SSL_SITE_URL . "/forums.php?action=viewthread&amp;postid=$PostID#post$PostID";
$URL = 'https://' . SSL_SITE_URL . "/forums.php?action=viewthread&amp;postid=$PostID#post$PostID";
if ($Length != 'verbal') {
$Time = ((int) $Length) * (7 * 24 * 60 * 60);
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;
$WarnTime = time_plus($Time);
$AdminComment = date("Y-m-d") . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} else {
$Subject = "You have received a verbal warning";
$Subject = 'You have received a verbal warning';
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post[/url].\n\n" . $PrivateMessage;
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
Tools::update_user_notes($UserID, $AdminComment);
}
@ -45,12 +45,11 @@
p.AuthorID,
p.TopicID,
t.ForumID,
CEIL((SELECT COUNT(ID)
CEIL( (SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= '$PostID')/" . POSTS_PER_PAGE
. ")
AS Page
. ") AS Page
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
JOIN forums as f ON t.ForumID=f.ID
@ -58,8 +57,8 @@
list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB->next_record();
// Perform the update
$DB->query("UPDATE forums_posts SET
Body = '" . db_string($Body) . "',
$DB->query("UPDATE forums_posts
SET Body = '" . db_string($Body) . "',
EditedUserID = '$UserID',
EditedTime = '" . $SQLTime . "'
WHERE ID='$PostID'");

View File

@ -5,9 +5,11 @@
$UserID = (int)$_POST['userid'];
$Key = (int)$_POST['key'];
$UserInfo = Users::user_info($UserID);
$DB -> query("SELECT
p.Body, t.ForumID
FROM forums_posts as p JOIN forums_topics as t on p.TopicID = t.ID
$DB -> query(" SELECT
p.Body,
t.ForumID
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
WHERE p.ID='$PostID'");
list($PostBody, $ForumID) = $DB -> next_record();
View::show_header('Warn User');
@ -38,9 +40,9 @@
<option value="1">1 week</option>
<option value="2">2 weeks</option>
<option value="4">4 weeks</option>
<? if(check_perms("users_mod")) { ?>
<? if(check_perms("users_mod")) { ?>
<option value="8">8 weeks</option>
<? } ?>
<? } ?>
</select></td>
</tr>
<tr>

View File

@ -37,7 +37,8 @@
JOIN users_main AS m ON f.FriendID=m.ID
JOIN users_info AS i ON f.FriendID=i.UserID
WHERE f.UserID='$UserID'
ORDER BY Username LIMIT $Limit");
ORDER BY Username
LIMIT $Limit");
$Friends = $DB->to_array(false, MYSQLI_BOTH, array(6, 'Paranoia'));
// Number of results (for pagination)
@ -53,17 +54,17 @@
<div class="linkbox">
<?
// Pagination
$Pages=Format::get_pages($Page,$Results,FRIENDS_PER_PAGE,9);
$Pages = Format::get_pages($Page, $Results, FRIENDS_PER_PAGE, 9);
echo $Pages;
?>
</div>
<div class="box pad">
<?
if($Results == 0) {
if ($Results == 0) {
echo '<p>You have no friends! :(</p>';
}
// Start printing out friends
foreach($Friends as $Friend) {
foreach ($Friends as $Friend) {
list($FriendID, $Comment, $Username, $Uploaded, $Downloaded, $Class, $Paranoia, $LastAccess, $Avatar) = $Friend;
?>
<form class="manage_form" name="friends" action="friends.php" method="post">
@ -72,17 +73,17 @@
<tr class="colhead">
<td colspan="3">
<span style="float:left;"><?=Users::format_username($FriendID, true, true, true, true)?>
<? if(check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
<? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
<? } ?>
<? if(check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) { ?>
<? }
if (check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Up: <strong><?=Format::get_size($Uploaded)?></strong>
<? } ?>
<? if(check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) { ?>
<? }
if (check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Down: <strong><?=Format::get_size($Downloaded)?></strong>
<? } ?>
</span>
<? if(check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) { ?>
<? if (check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) { ?>
<span style="float:right;"><?=time_diff($LastAccess)?></span>
<? } ?>
</td>
@ -90,17 +91,16 @@
<tr>
<td width="50px" valign="top">
<?
if(empty($HeavyInfo['DisableAvatars'])) {
if(!empty($Avatar)) {
if(check_perms('site_proxy_images')) {
if (empty($HeavyInfo['DisableAvatars'])) {
if (!empty($Avatar)) {
if (check_perms('site_proxy_images')) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Avatar);
}
?>
} ?>
<img src="<?=$Avatar?>" alt="<?=$Username?>'s avatar" width="50px" />
<? } else { ?>
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="50px" alt="Default avatar" />
<? }
}?>
<? }
} ?>
</td>
<td valign="top">
<input type="hidden" name="friendid" value="<?=$FriendID?>" />
@ -109,9 +109,8 @@
</td>
<td class="left" valign="top">
<input type="submit" name="action" value="Update" /><br />
<input type="submit" name="action" value="Defriend" /><br />
<input type="submit" name="action" value="Remove friend" /><br />
<input type="submit" name="action" value="Contact" /><br />
</td>
</tr>
</table>

View File

@ -1,6 +1,6 @@
<?
View::show_header('Disabled');
if(empty($_POST['submit']) || empty($_POST['username'])) {
if (empty($_POST['submit']) || empty($_POST['username'])) {
?>
<p class="warning">
Your account has been disabled.<br />
@ -10,12 +10,12 @@
<strong>Be honest.</strong> At this point, lying will get you nowhere.<br /><br /><br />
</p>
<strong>Before joining the disabled channel, please read our <br /> <span style="color:gold;">Golden Rules</span> which can be found <a style="color:#1464F4;" href="#" onclick="toggle_visibility('golden_rules')">here.</a></strong> <br /><br />
<strong>Before joining the disabled channel, please read our <br /> <span style="color: gold;">Golden Rules</span> which can be found <a style="color: #1464F4;" href="#" onclick="toggle_visibility('golden_rules')">here</a>.</strong> <br /><br />
<script type="text/javascript">
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
if (e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
@ -56,11 +56,11 @@ function toggle_visibility(id) {
} else {
$nick = $_POST['username'];
$nick = preg_replace('/[^a-zA-Z0-9\[\]\\`\^\{\}\|_]/', '', $nick);
if(strlen($nick) == 0) {
$nick = "WhatGuest????";
if (strlen($nick) == 0) {
$nick = 'WhatGuest????';
} else {
if(is_numeric(substr($nick, 0, 1))) {
$nick = "_" . $nick;
if (is_numeric(substr($nick, 0, 1))) {
$nick = '_' . $nick;
}
}
?>
@ -68,8 +68,8 @@ function toggle_visibility(id) {
<div class="header">
<h3 id="general">Disabled IRC</h3>
</div>
<div class="box pad" style="padding:10px 0px 10px 0px;">
<div style="padding:0px 10px 10px 20px;">
<div class="box pad" style="padding: 10px 0px 10px 0px;">
<div style="padding: 0px 10px 10px 20px;">
<p>Please read the topic carefully.</p>
</div>
<applet codebase="static/irc/" code="IRCApplet.class" archive="irc.jar,sbox.jar" width="800" height="600" align="center">

View File

@ -2,11 +2,11 @@
include(SERVER_ROOT.'/sections/reports/array.php');
if(empty($_GET['type']) || empty($_GET['id']) || !is_number($_GET['id'])) {
if (empty($_GET['type']) || empty($_GET['id']) || !is_number($_GET['id'])) {
error(404);
}
if(!array_key_exists($_GET['type'], $Types)) {
if (!array_key_exists($_GET['type'], $Types)) {
error(403);
}
$Short = $_GET['type'];
@ -14,10 +14,10 @@
$ID = $_GET['id'];
switch($Short) {
switch ($Short) {
case "user" :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Username) = $DB->next_record();
@ -26,18 +26,18 @@
case "request_update" :
$NoReason = true;
$DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
if($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != "Music" || $Year != 0))) {
if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != "Music" || $Year != 0))) {
error(403);
}
break;
case "request" :
$DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc, $Filled) = $DB->next_record();
@ -45,7 +45,7 @@
case "collage" :
$DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc) = $DB->next_record();
@ -53,13 +53,13 @@
case "thread" :
$DB->query("SELECT ft.Title, ft.ForumID, um.Username FROM forums_topics AS ft JOIN users_main AS um ON um.ID=ft.AuthorID WHERE ft.ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Title, $ForumID, $Username) = $DB->next_record();
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
list($MinClassRead) = $DB->next_record();
if(!empty($LoggedUser['DisableForums']) ||
if (!empty($LoggedUser['DisableForums']) ||
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
@ -68,7 +68,7 @@
case "post" :
$DB->query("SELECT fp.Body, fp.TopicID, um.Username FROM forums_posts AS fp JOIN users_main AS um ON um.ID=fp.AuthorID WHERE fp.ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Body, $TopicID, $Username) = $DB->next_record();
@ -76,7 +76,7 @@
list($ForumID) = $DB->next_record();
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
list($MinClassRead) = $DB->next_record();
if(!empty($LoggedUser['DisableForums']) ||
if (!empty($LoggedUser['DisableForums']) ||
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
@ -88,13 +88,13 @@
case "artist_comment":
case "collages_comment" :
$Table = $Short.'s';
if($Short == "collages_comment") {
if ($Short == "collages_comment") {
$Column = "UserID";
} else {
$Column = "AuthorID";
}
$DB->query("SELECT ".$Short.".Body, um.Username FROM ".$Table." AS ".$Short." JOIN users_main AS um ON um.ID=".$Short.".".$Column." WHERE ".$Short.".ID=".$ID);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
error(404);
}
list($Body, $Username) = $DB->next_record();
@ -112,7 +112,7 @@
<p>Following these guidelines will help the moderators deal with your report in a timely fashion. </p>
<ul>
<?
foreach($Type['guidelines'] as $Guideline) {
foreach ($Type['guidelines'] as $Guideline) {
?>
<li><?=$Guideline?></li>
<? } ?>
@ -125,7 +125,7 @@
$Text = new TEXT;
switch($Short) {
switch ($Short) {
case "user" :
?>
<p>You are reporting the user <strong><?=display_str($Username)?></strong></p>
@ -271,7 +271,7 @@
<?
break;
}
if(empty($NoReason)) {
if (empty($NoReason)) {
?>
<h3>Reason</h3>
<div class="box pad center">

View File

@ -40,7 +40,7 @@
$Where .= " AND Type = 'request_update'";
}
if (check_perms('site_moderate_forums')) {
$Where .= " AND Type IN('collages_comment', 'Post', 'requests_comment', 'thread', 'torrents_comment', 'torrent_comments')";
$Where .= " AND Type IN('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment', 'torrent_comments', 'artist_comment')";
}
}
@ -83,13 +83,13 @@
</div>
</div>
<div class="linkbox">
<?
<?
// pagination
$Pages = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
echo $Pages;
?>
</div>
<?
<?
while (list($ReportID, $SnitchID, $SnitchName, $ThingID, $Short, $ReportedTime, $Reason, $Status, $ClaimerID, $Notes, $ResolverID) = $DB->next_record()) {
$Type = $Types[$Short];
$Reference = "reports.php?id=" . $ReportID . "#report" . $ReportID;
@ -106,8 +106,7 @@
<tr>
<td class="center" colspan="2">
<strong>
<?
switch ($Short) {
<? switch ($Short) {
case "user" :
$DB->query("SELECT Username FROM users_main WHERE ID=" . $ThingID);
if ($DB->record_count() < 1) {
@ -211,13 +210,13 @@
</tr>
<tr>
<td colspan="2">
<? if ($ClaimerID == $LoggedUser['ID']) { ?>
<? if ($ClaimerID == $LoggedUser['ID']) { ?>
<span id="claimed_<?=$ReportID?>">Claimed by <?=Users::format_username($ClaimerID, false, false, false, false)?> <a href="#" onclick="unClaim(<?=$ReportID?>); return false;" class="brackets">Unclaim</a></span>
<? } else if ($ClaimerID) { ?>
<? } else if ($ClaimerID) { ?>
<span id="claimed_<?=$ReportID?>">Claimed by <?=Users::format_username($ClaimerID, false, false, false, false)?></span>
<? } else { ?>
<? } else { ?>
<a href="#" id="claim_<?=$ReportID?>" onclick="claim(<?=$ReportID?>); return false;" class="brackets">Claim</a>
<? } ?>
<? } ?>
&nbsp;&nbsp;
<a href="#" onclick="toggleNotes(<?=$ReportID?>); return false;" class="brackets">Toggle notes</a>
@ -228,17 +227,17 @@
</div>
</td>
</tr>
<? if ($Status != "Resolved") { ?>
<? if ($Status != "Resolved") { ?>
<tr>
<td class="center" colspan="2">
<form id="report_form_<?=$ReportID?>" action="">
<input type="hidden" name="reportid" value="<?=$ReportID?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="submit" onclick="return resolve(<?=$ReportID?>, <?=($ClaimerID == $LoggedUser['ID'] || !$ClaimerID) ? "true" : "false"?>)" name="submit" value="Resolve" />
<input type="submit" onclick="return resolve(<?=$ReportID?>, <?=($ClaimerID == $LoggedUser['ID'] || !$ClaimerID) ? 'true' : 'false' ?>)" name="submit" value="Resolve" />
</form>
</td>
</tr>
<? } else {
<? } else {
$ResolverInfo = Users::user_info($ResolverID);
?>
<tr>
@ -246,16 +245,16 @@
Resolved by <a href="users.php?id=<?=$ResolverID?>"><?=$ResolverInfo['Username']?></a>
</td>
</tr>
<? } ?>
<? } ?>
</table>
</div>
<br />
<?
<?
$DB->set_query_id($Reports);
}
?>
<div class="linkbox">
<?
<?
echo $Pages;
?>
</div>

View File

@ -1,6 +1,6 @@
<?
if(!check_perms('admin_reports') && !check_perms('site_moderate_forums')){
if (!check_perms('admin_reports') && !check_perms('site_moderate_forums')) {
error(403);
}
View::show_header('Other reports stats');
@ -14,11 +14,18 @@
<a href="reports.php?action=stats">Stats</a>
</div>
</div>
<div class="box pad thin" style="padding: 0px 0px 0px 20px; margin-left: auto; margin-right: auto">
<div class="box pad thin" style="padding: 0px 0px 0px 20px; margin-left: auto; margin-right: auto;">
<table class="layout">
<?
if(check_perms('admin_reports')) {
$DB->query("SELECT um.Username, COUNT(r.ID) AS Reports FROM reports AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.ReportedTime > '2009-08-21 22:39:41' AND r.ReportedTime > NOW() - INTERVAL 24 HOUR GROUP BY r.ResolverID ORDER BY Reports DESC");
if (check_perms('admin_reports')) :
$DB->query("SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID=r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 24 HOUR
GROUP BY r.ResolverID
ORDER BY Reports DESC");
$Results = $DB->to_array();
?>
<tr>
@ -29,7 +36,7 @@
<td class="head colhead_dark">Username</td>
<td class="head colhead_dark">Reports</td>
</tr>
<? foreach($Results as $Result) {
<? foreach ($Results as $Result) {
list($Username, $Reports) = $Result;
?>
<tr>
@ -42,7 +49,14 @@
</tr>
<tr>
<?
$DB->query("SELECT um.Username, COUNT(r.ID) AS Reports FROM reports AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.ReportedTime > '2009-08-21 22:39:41' AND r.ReportedTime > NOW() - INTERVAL 1 WEEK GROUP BY r.ResolverID ORDER BY Reports DESC");
$DB->query("SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID=r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 1 WEEK
GROUP BY r.ResolverID
ORDER BY Reports DESC");
$Results = $DB->to_array();
?>
<td class="label"><strong>Reports resolved in the last week</strong></td>
@ -52,7 +66,7 @@
<td class="head colhead_dark">Username</td>
<td class="head colhead_dark">Reports</td>
</tr>
<? foreach($Results as $Result) {
<? foreach ($Results as $Result) {
list($Username, $Reports) = $Result;
?>
<tr>
@ -65,7 +79,14 @@
</tr>
<tr>
<?
$DB->query("SELECT um.Username, COUNT(r.ID) AS Reports FROM reports AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.ReportedTime > '2009-08-21 22:39:41' AND r.ReportedTime > NOW() - INTERVAL 1 MONTH GROUP BY r.ResolverID ORDER BY Reports DESC");
$DB->query("SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID=r.ResolverID
WHERE r.ReportedTime > '2009-08-21 22:39:41'
AND r.ReportedTime > NOW() - INTERVAL 1 MONTH
GROUP BY r.ResolverID
ORDER BY Reports DESC");
$Results = $DB->to_array();
?>
<td class="label"><strong>Reports resolved in the last month</strong></td>
@ -75,7 +96,7 @@
<td class="head colhead_dark">Username</td>
<td class="head colhead_dark">Reports</td>
</tr>
<? foreach($Results as $Result) {
<? foreach ($Results as $Result) {
list($Username, $Reports) = $Result;
?>
<tr>
@ -88,17 +109,22 @@
</tr>
<tr>
<?
$DB->query("SELECT um.Username, COUNT(r.ID) AS Reports FROM reports AS r JOIN users_main AS um ON um.ID=r.ResolverID GROUP BY r.ResolverID ORDER BY Reports DESC");
$DB->query("SELECT um.Username,
COUNT(r.ID) AS Reports
FROM reports AS r
JOIN users_main AS um ON um.ID=r.ResolverID
GROUP BY r.ResolverID
ORDER BY Reports DESC");
$Results = $DB->to_array();
?>
<td class="label"><strong>Reports resolved since 'other' reports (2009-08-21)</strong></td>
<td class="label"><strong>Reports resolved since "other" reports (2009-08-21)</strong></td>
<td>
<table style="width: 50%; margin-left: auto; margin-right: auto;" class="border">
<tr>
<td class="head colhead_dark">Username</td>
<td class="head colhead_dark">Reports</td>
</tr>
<? foreach($Results as $Result) {
<? foreach ($Results as $Result) {
list($Username, $Reports) = $Result;
?>
<tr>
@ -109,10 +135,17 @@
</table>
</td>
</tr>
<? } ?>
<? endif; ?>
<tr>
<?
$DB->query("select u.Username, count(LastPostAuthorID) as Trashed from forums_topics as f left join users_main as u on u.id = LastPostAuthorID where ForumID = 12 group by LastPostAuthorID order by Trashed desc limit 30;");
<?
$DB->query("SELECT u.Username,
count(LastPostAuthorID) as Trashed
FROM forums_topics as f
LEFT JOIN users_main as u on u.id = LastPostAuthorID
WHERE ForumID = 12
GROUP BY LastPostAuthorID
ORDER BY Trashed DESC
LIMIT 30;");
$Results = $DB->to_array();
?>
<td class="label"><strong>Threads trashed since the beginning of time</strong></td>
@ -123,9 +156,9 @@
<td class="head colhead_dark">Username</td>
<td class="head colhead_dark">Trashed</td>
</tr>
<?
<?
$i = 1;
foreach($Results as $Result) {
foreach ($Results as $Result) {
list($Username, $Trashed) = $Result;
?>
<tr>
@ -133,7 +166,8 @@
<td><?=$Username?></td>
<td><?=number_format($Trashed)?></td>
</tr>
<? $i++; } ?>
<? $i++;
} ?>
</table>
</td>
</tr>

View File

@ -5,7 +5,7 @@
* replicated on static.php.
*/
if(!check_perms('admin_reports')){
if (!check_perms('admin_reports')) {
error(403);
}
@ -74,7 +74,7 @@
LIMIT 1");
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
die();
}
@ -83,10 +83,10 @@
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record(MYSQLI_BOTH, array("ModComment"));
if(!$GroupID) {
if (!$GroupID) {
//Torrent already deleted
$DB->query("UPDATE reportsv2 SET
Status='Resolved',
$DB->query("UPDATE reportsv2
SET Status='Resolved',
LastChangeTime='".sqltime()."',
ModComment='Report already dealt with (torrent deleted)'
WHERE ID=".$ReportID);
@ -103,14 +103,14 @@
<?
die();
}
$DB->query("UPDATE reportsv2 SET Status='InProgress',
$DB->query("UPDATE reportsv2
SET Status='InProgress',
ResolverID=".$LoggedUser['ID']."
WHERE ID=".$ReportID);
if (array_key_exists($Type, $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$Type];
} else if(array_key_exists($Type,$Types['master'])) {
} elseif (array_key_exists($Type,$Types['master'])) {
$ReportType = $Types['master'][$Type];
} else {
//There was a type but it wasn't an option!
@ -154,7 +154,7 @@
<tr>
<td class="label"><a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Reported</a> torrent:</td>
<td colspan="3">
<? if(!$GroupID) { ?>
<? if (!$GroupID) { ?>
<a href="log.php?search=Torrent+<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)
<? } else { ?>
<?=$LinkName?>
@ -162,29 +162,29 @@
uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
<br />
<div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
<? $DB->query("SELECT r.ID
<? $DB->query("SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
$GroupOthers = ($DB->record_count() - 1);
if($GroupOthers > 0) { ?>
if ($GroupOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrents in this group</a>
</div>
<? $DB->query("SELECT t.UserID
<? $DB->query("SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
$UploaderOthers = ($DB->record_count() - 1);
if($UploaderOthers > 0) { ?>
if ($UploaderOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=uploader&amp;id=<?=$UploaderID?>">There <?=(($UploaderOthers > 1) ? "are $UploaderOthers other reports" : "is 1 other report")?> for torrents uploaded by this user</a>
</div>
<? }
<? }
$DB->query("SELECT DISTINCT req.ID,
req.FillerID,
@ -198,59 +198,54 @@
AND req.TimeFilled > '2010-03-04 02:31:49'
AND req.TorrentID=$TorrentID");
$Requests = ($DB->record_count());
if($Requests > 0) {
if ($Requests > 0) {
while(list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
?>
<div style="text-align: right;">
<strong class="important_text"><a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=view&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?></strong>
</div>
<? }
<? }
}
}
}
?>
</td>
</tr>
<? if($Tracks) { ?>
<? if ($Tracks) { ?>
<tr>
<td class="label">Relevant tracks:</td>
<td colspan="3">
<?=str_replace(" ", ", ", $Tracks)?>
</td>
</tr>
<? }
<? }
if($Links) {
?>
if ($Links) { ?>
<tr>
<td class="label">Relevant links:</td>
<td colspan="3">
<?
<?
$Links = explode(" ", $Links);
foreach($Links as $Link) {
foreach ($Links as $Link) {
if ($local_url = $Text->local_url($Link)) {
$Link = $local_url;
}
?>
} ?>
<a href="<?=$Link?>"><?=$Link?></a>
<?
}
?>
<?
} ?>
</td>
</tr>
<?
<?
}
if($ExtraIDs) {
?>
if ($ExtraIDs) { ?>
<tr>
<td class="label">Relevant other torrents:</td>
<td colspan="3">
<?
<?
$First = true;
$Extras = explode(" ", $ExtraIDs);
foreach($Extras as $ExtraID) {
foreach ($Extras as $ExtraID) {
$DB->query("SELECT
@ -292,7 +287,7 @@
$ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record());
if($ExtraGroupName) {
if ($ExtraGroupName) {
if ($ArtistID == 0 && empty($ArtistName)) {
$ExtraLinkName = "<a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
@ -302,44 +297,39 @@
}
?>
<?=($First ? "" : "<br />")?>
<?=($First ? '' : '<br />')?>
<?=$ExtraLinkName?>
<a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a>
<?
<?
$First = false;
}
}
?>
} ?>
</td>
</tr>
<?
<?
}
if($Images) {
?>
if ($Images) { ?>
<tr>
<td class="label">Relevant images:</td>
<td colspan="3">
<?
<?
$Images = explode(" ", $Images);
foreach($Images as $Image) {
foreach ($Images as $Image) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Image);
?>
<img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=$Image?>" alt="Relevant image" />
<?
}
?>
<?
} ?>
</td>
</tr>
<?
}
?>
<?
} ?>
<tr>
<td class="label">User comment:</td>
<td colspan="3"><?=$Text->full_format($UserComment)?></td>
</tr>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
<tr>
<td class="label">Report comment:</td>
<td colspan="3">
@ -361,13 +351,13 @@
}
array_multisort($Priorities, SORT_ASC, $TypeList);
foreach($TypeList as $Type => $Data) {
foreach ($TypeList as $Type => $Data) {
?>
<option value="<?=$Type?>"><?=$Data['title']?></option>
<? } ?>
</select>
<span id="options<?=$ReportID?>">
<? if(check_perms('users_mod')) { ?>
<? if (check_perms('users_mod')) { ?>
<span title="Delete torrent?">
<label for="delete<?=$ReportID?>"><strong>Delete</strong></label>
<input type="checkbox" name="delete" id="delete<?=$ReportID?>" />
@ -414,14 +404,14 @@
<tr>
<td class="label"><strong>Extra</strong> log message:</td>
<td>
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40" <? if($ExtraIDs) {
$Extras = explode(" ", $ExtraIDs);
$Value = "";
foreach($Extras as $ExtraID) {
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40"<? if ($ExtraIDs) {
$Extras = explode(' ', $ExtraIDs);
$Value = '';
foreach ($Extras as $ExtraID) {
$Value .= 'https://'.SSL_SITE_URL.'/torrents.php?torrentid='.$ExtraID.' ';
}
echo 'value="'.trim($Value).'"';
} ?>/>
echo ' value="'.trim($Value).'"';
} ?> />
</td>
<td class="label"><strong>Extra</strong> staff notes:</td>
<td>

View File

@ -4,6 +4,11 @@
* they visit reportsv2.php?id=xxx
*/
include(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT;
//If we're not coming from torrents.php, check we're being returned because of an error.
if(!isset($_GET['id']) || !is_number($_GET['id'])) {
if(!isset($Err)) {
@ -11,11 +16,52 @@
}
} else {
$TorrentID = $_GET['id'];
$DB->query("SELECT tg.CategoryID FROM torrents_group AS tg LEFT JOIN torrents AS t ON t.GroupID=tg.ID WHERE t.ID=".$_GET['id']);
list($CategoryID) = $DB->next_record();
$DB->query("SELECT tg.CategoryID, t.GroupID FROM torrents_group AS tg LEFT JOIN torrents AS t ON t.GroupID=tg.ID WHERE t.ID=" . $_GET['id']);
list($CategoryID, $GroupID) = $DB->next_record();
$Artists = Artists::get_artist($GroupID);
$TorrentCache = get_group_info($GroupID, true, $RevisionID);
$GroupDetails = $TorrentCache[0];
$TorrentList = $TorrentCache[1];
//Resolve the torrentlist to the one specific torrent being reported
foreach ($TorrentList as &$Torrent) {
//Remove unneeded entries
if ($Torrent["ID"] != $TorrentID)
unset($TorrentList[$Torrent["ID"]]);
}
// Group details
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear,
$GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID,
$GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs,
$TagPositiveVotes, $TagNegativeVotes, $GroupFlags) = array_values($GroupDetails);
$DisplayName = $GroupName;
$AltName = $GroupName; // Goes in the alt text of the image
$Title = $GroupName; // goes in <title>
$WikiBody = $Text->full_format($WikiBody);
//Get the artist name, group name etc.
$Artists = Artists::get_artist($GroupID);
if ($Artists) {
$DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . '<a href="torrents.php?torrentid=' . $TorrentID . '">' .$DisplayName . '</a></span>';
$AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
$Title = $AltName;
}
if ($GroupYear > 0) {
$DisplayName.=' [' . $GroupYear . ']';
$AltName.=' [' . $GroupYear . ']';
$Title.= ' [' . $GroupYear . ']';
}
if ($GroupVanityHouse) {
$DisplayName.=' [Vanity House]';
$AltName.=' [Vanity House]';
}
if ($GroupCategoryID == 1) {
$DisplayName.=' [' . $ReleaseTypes[$ReleaseType] . ']';
$AltName.=' [' . $ReleaseTypes[$ReleaseType] . ']';
}
}
View::show_header('Report', 'reportsv2');
View::show_header('Report', 'reportsv2,jquery,browse,torrent,bbcode,recommend');
?>
<div class="thin">
@ -23,6 +69,24 @@
<h2>Report a torrent</h2>
</div>
<div class="header">
<h3><?=$DisplayName?></h3>
</div>
<div class="thin">
<table class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : ''?>" id="torrent_details">
<tr class="colhead_dark">
<td width="80%"><strong>Reported torrent</strong></td>
<td><strong>Size</strong></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
</tr>
<?
build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Text, $Username, $ReportedTimes);
?>
</table>
</div>
<form class="create_form" name="report" action="reportsv2.php?action=takereport" enctype="multipart/form-data" method="post" id="reportform">
<div>
<input type="hidden" name="submit" value="true" />
@ -30,12 +94,15 @@
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" name="categoryid" value="<?=$CategoryID?>" />
</div>
<h3>Report information</h3>
<div class="box pad">
<table class="layout">
<tr>
<td class="label">Reason :</td>
<td class="label">Reason:</td>
<td>
<select id="type" name="type" onchange="ChangeReportType()">
<?
<?
if (!empty($Types[$CategoryID])) {
$TypeList = $Types['master'] + $Types[$CategoryID];
$Priorities = array();
@ -46,17 +113,14 @@
} else {
$TypeList = $Types['master'];
}
foreach($TypeList as $Type => $Data) {
?>
<option value="<?=$Type?>"><?=$Data['title']?></option>
<? } ?>
foreach ($TypeList as $Type => $Data) {
?>
<option value="<?= $Type ?>"><?= $Data['title'] ?></option>
<? } ?>
</select>
</td>
</tr>
</table>
<h3>Reporting guidelines</h3>
<div class="box pad">
<p>Fields that contain lists of values (for example, listing more than one track number) should be separated by a space.</p>
<br />
<p><strong>Following the below report type specific guidelines will help the moderators deal with your report in a timely fashion. </strong></p>

View File

@ -7,27 +7,27 @@ $ExtraJoins = array();
$Submitted = !empty($_GET['submit']);
if(!empty($_GET['search'])) {
if (!empty($_GET['search'])) {
$Words = explode(' ', $_GET['search']);
$SearchWords = array();
foreach($Words AS $Word) {
foreach ($Words AS $Word) {
$Wheres[] = "LOCATE('".db_string($Word)."', r.Title)";
}
}
$TagMatcher = (!empty($_GET['tagmatcher']) && $_GET['tagmatcher'] == "any") ? "any" : "all";
if(!empty($_GET['tags'])){
if (!empty($_GET['tags'])) {
$Tags = explode(',', $_GET['tags']);
$TagNames = array();
foreach ($Tags as $Tag){
foreach ($Tags as $Tag) {
$Tag = Misc::sanitize_tag($Tag);
if(!empty($Tag)) {
if (!empty($Tag)) {
$TagNames[] = $Tag;
}
}
if($TagMatcher == "any") {
if ($TagMatcher == "any") {
$ExtraJoins[] = "LEFT JOIN requests_tags AS rt ON r.ID=rt.RequestID";
$ExtraJoins[] = "LEFT JOIN tags AS t ON t.ID=rt.TagID";
$Wheres[] = "t.Name IN ('".implode("', '", $TagNames)."')";
@ -36,20 +36,20 @@ if(!empty($_GET['tags'])){
}
}
if(!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
if (!empty($_GET['requestor']) && check_perms('site_see_old_requests')) {
$Wheres[] = "u.Username LIKE ".db_string($_GET['requestor']);
}
if(!empty($_GET['filter_cat'])) {
if (!empty($_GET['filter_cat'])) {
$Keys = array_keys($_GET['filter_cat']);
$Wheres[] = "r.CategoryID IN (".implode(", ", $Keys).")";
}
if(!empty($_GET['releases'])) {
if (!empty($_GET['releases'])) {
$ReleaseArray = $_GET['releases'];
if(count($ReleaseArray) != count($ReleaseTypes)) {
foreach($ReleaseArray as $Index => $Value) {
if(is_number($Value)) {
if (count($ReleaseArray) != count($ReleaseTypes)) {
foreach ($ReleaseArray as $Index => $Value) {
if (is_number($Value)) {
$Wheres[] = "r.ReleaseType = ".$Value;
} else {
error(0);
@ -58,63 +58,63 @@ if(!empty($_GET['releases'])) {
}
}
if(!empty($_GET['formats'])) {
if (!empty($_GET['formats'])) {
$FormatArray = $_GET['formats'];
if(count($FormatArray) != count($Formats)) {
if (count($FormatArray) != count($Formats)) {
$FormatNameArray = array();
foreach($FormatArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Formats)) {
foreach ($FormatArray as $Index => $MasterIndex) {
if (array_key_exists($Index, $Formats)) {
$FormatNameArray[$Index] = $Formats[$MasterIndex];
} else {
//Hax
error(0);
}
}
foreach($FormatNameArray as $Index => $Name) {
foreach ($FormatNameArray as $Index => $Name) {
$Wheres[] = "LOCATE('".db_string($Name)."', r.FormatList)";
}
}
}
if(!empty($_GET['media'])) {
if (!empty($_GET['media'])) {
$MediaArray = $_GET['media'];
if(count($MediaArray) != count($Media)) {
if (count($MediaArray) != count($Media)) {
$MediaNameArray = array();
foreach($MediaArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Media)) {
foreach ($MediaArray as $Index => $MasterIndex) {
if (array_key_exists($Index, $Media)) {
$MediaNameArray[$Index] = $Media[$MasterIndex];
} else {
//Hax
error(0);
}
}
foreach($MediaNameArray as $Index => $Name) {
foreach ($MediaNameArray as $Index => $Name) {
$Wheres[] = "LOCATE('".db_string($Name)."', r.MediaList)";
}
}
}
if(!empty($_GET['bitrates'])) {
if (!empty($_GET['bitrates'])) {
$BitrateArray = $_GET['bitrates'];
if(count($BitrateArray) != count($Bitrates)) {
if (count($BitrateArray) != count($Bitrates)) {
$BitrateNameArray = array();
foreach($BitrateArray as $Index => $MasterIndex) {
if(array_key_exists($Index, $Bitrates)) {
foreach ($BitrateArray as $Index => $MasterIndex) {
if (array_key_exists($Index, $Bitrates)) {
$BitrateNameArray[$Index] = $Bitrates[$MasterIndex];
} else {
//Hax
error(0);
}
}
foreach($BitrateNameArray as $Index => $Name) {
foreach ($BitrateNameArray as $Index => $Name) {
$Wheres[] = "LOCATE('".db_string($Name)."', r.BitrateList)";
}
}
}
if(empty($_GET['type'])) {
if (empty($_GET['type'])) {
$Title = 'Requests';
if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
if (!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
$Wheres[] = "(TorrentID = 0 OR (TimeFilled > (NOW() - INTERVAL 3 DAY)))";
}
} else {
@ -129,7 +129,7 @@ if(empty($_GET['type'])) {
$ExtraJoins[] = "LEFT JOIN requests_votes AS _rv ON _rv.RequestID=r.ID";
break;
case 'filled':
if(empty($_GET['userid']) || !is_number($_GET['userid'])) {
if (empty($_GET['userid']) || !is_number($_GET['userid'])) {
error(404);
} else {
$Title = "Requests filled";
@ -141,14 +141,14 @@ if(empty($_GET['type'])) {
}
if(empty($_GET['order'])) {
if (empty($_GET['order'])) {
$CurrentOrder = 'created';
$CurrentSort = 'desc';
$NewSort = 'asc';
} else {
if(in_array($_GET['order'], $OrderWays)) {
if (in_array($_GET['order'], $OrderWays)) {
$CurrentOrder = $_GET['order'];
if($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
$CurrentSort = $_GET['sort'];
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
} else {
@ -192,17 +192,17 @@ switch($CurrentOrder) {
}
$OrderBy = $OrderBy." ".$CurrentSort;
$Matcher = "AND";
if(count($Wheres)) {
$Where = "WHERE (".implode(") ".$Matcher." (", $Wheres).")";
$Matcher = 'AND';
if (count($Wheres)) {
$Where = 'WHERE ('.implode(") ".$Matcher." (", $Wheres).")";
} else {
$Where = "";
$Where = '';
}
if(count($ExtraJoins)) {
$ExtraJoin = implode(" ", $ExtraJoins);
if (count($ExtraJoins)) {
$ExtraJoin = implode(' ', $ExtraJoins);
} else {
$ExtraJoin = "";
$ExtraJoin = '';
}
// Build SQL query
@ -248,11 +248,11 @@ show_header($Title, 'requests');
<div class="header">
<h2><?=$Title?></h2>
<div class="linkbox">
<? if(check_perms('site_submit_requests')){ ?>
<? if (check_perms('site_submit_requests')) { ?>
<a href="requests.php?action=new" class="brackets">New request</a>
<a href="requests.php?type=created" class="brackets">My requests</a>
<? }
if(check_perms('site_vote')){?>
if (check_perms('site_vote')) { ?>
<a href="requests.php?type=voted" class="brackets">Requests I've voted on</a>
<? } ?>
</div>
@ -264,23 +264,23 @@ show_header($Title, 'requests');
<tr>
<td class="label">Search terms:</td>
<td>
<input type="text" name="search" size="75" value="<?if(isset($_GET['search'])) { echo display_str($_GET['search']); } ?>" />
<input type="text" name="search" size="75" value="<? if (isset($_GET['search'])) { echo display_str($_GET['search']); } ?>" />
</td>
</tr>
<tr>
<td class="label">Tags (comma-separated):</td>
<td>
<input type="text" name="tags" size="60" value="<?=display_str(implode(', ', $TagNames))?>" />
<input type="radio" name="tagmatcher" value="any" <?=((empty($TagMatcher) || $TagMatcher == "any") ? ' checked="checked" ' : '')?>/>Any &nbsp;
<input type="radio" name="tagmatcher" value="all" <?=((!empty($TagMatcher) && $TagMatcher == "all") ? ' checked="checked" ' : '')?>/>All
<input type="radio" name="tagmatcher" value="any"<?=((empty($TagMatcher) || $TagMatcher == 'any') ? ' checked="checked"' : '') ?> />Any &nbsp;
<input type="radio" name="tagmatcher" value="all"<?=((!empty($TagMatcher) && $TagMatcher == 'all') ? ' checked="checked"' : '') ?> />All
</td>
</tr>
<? if(check_perms('site_see_old_requests')){ ?>
<? if (check_perms('site_see_old_requests')) { ?>
<tr>
<td class="label">Include filled:</td>
<td>
<input type="checkbox" name="showall" <? if($_GET['showall']) {?>checked="checked"<? } ?> />
<input type="checkbox" name="showall"<? if ($_GET['showall']) { ?> checked="checked"<? } ?> />
</td>
</tr>
<? /* ?>
@ -294,19 +294,19 @@ show_header($Title, 'requests');
</table>
<table class="layout cat_list">
<?
$x=1;
$x = 1;
reset($Categories);
foreach($Categories as $CatKey => $CatName) {
if($x%8==0 || $x==1) {
foreach ($Categories as $CatKey => $CatName) {
if ($x % 8 == 0 || $x == 1) {
?>
<tr class="cat_list">
<? } ?>
<td>
<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1" <? if(isset($_GET['filter_cat'][$CatKey+1])) { ?>checked="checked"<? } ?> />
<label for="cat_<?=($CatKey+1)?>"><?=$CatName?></label>
<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1"<? if (isset($_GET['filter_cat'][$CatKey + 1])) { ?> checked="checked"<? } ?> />
<label for="cat_<?=($CatKey + 1)?>"><?=$CatName?></label>
</td>
<?
if($x%7==0) {
if ($x % 7 == 0) {
?>
</tr>
<?
@ -322,7 +322,7 @@ foreach($Categories as $CatKey => $CatName) {
<input type="checkbox" id="toggle_releases" onchange="Toggle('releases');" /> Toggle All
<? $i = 0;
foreach ($ReleaseTypes as $Key => $Val) {
if($i % 8 == 0) echo "<br />";?>
if ($i % 8 == 0) echo "<br />";?>
<input type="checkbox" name="releases[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($ReleaseArray) && in_array($Key, $ReleaseArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -335,7 +335,7 @@ foreach($Categories as $CatKey => $CatName) {
<td>
<input type="checkbox" id="toggle_formats" onchange="Toggle('formats');" /> Toggle All
<? foreach ($Formats as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="formats[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($FormatArray) && in_array($Key, $FormatArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -347,7 +347,7 @@ foreach($Categories as $CatKey => $CatName) {
<td>
<input type="checkbox" id="toggle_bitrates" onchange="Toggle('bitrates');" /> Toggle All
<? foreach ($Bitrates as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($BitrateArray) && in_array($Key, $BitrateArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -359,7 +359,7 @@ foreach($Categories as $CatKey => $CatName) {
<td>
<input type="checkbox" id="toggle_media" onchange="Toggle('media');" /> Toggle All
<? foreach ($Media as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
if ($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="media[]" value="<?=$Key?>"
<?=(((!$Submitted) || !empty($MediaArray) && in_array($Key, $MediaArray)) ? ' checked="checked" ' : '')?>
/> <?=$Val?>
@ -405,7 +405,7 @@ foreach($Categories as $CatKey => $CatName) {
</td>
</tr>
<? if($Results == 0){ ?>
<? if ($Results == 0) { ?>
<tr class="rowb">
<td colspan="7">
Nothing found!
@ -419,11 +419,11 @@ foreach($Categories as $CatKey => $CatName) {
$CategoryName = $Categories[$CategoryID - 1];
$IsFilled = ($TorrentID != 0);
if($CategoryName == "Music") {
if ($CategoryName == "Music") {
$ArtistForm = get_request_artists($RequestID);
$ArtistLink = display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} elseif($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title." [".$Year."]</a>";
} else {
$FullName ="<a href='requests.php?action=view&amp;id=".$RequestID."'>".$Title."</a>";
@ -439,7 +439,7 @@ foreach($Categories as $CatKey => $CatName) {
<div class="tags">
<?
$TagList = array();
foreach($Tags as $TagID => $TagName) {
foreach ($Tags as $TagID => $TagName) {
$TagList[] = "<a href='requests.php?tag=".$TagID."'>".display_str($TagName)."</a>";
}
$TagList = implode(', ', $TagList);
@ -449,7 +449,7 @@ foreach($Categories as $CatKey => $CatName) {
</td>
<td>
<?=$Votes?>
<? if(!$IsFilled && check_perms('site_vote')){ ?>
<? if (!$IsFilled && check_perms('site_vote')) { ?>
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
&nbsp;&nbsp; <a href="javascript:Vote()" class="brackets"><strong>+</strong></a>
<? } ?>
@ -458,14 +458,14 @@ foreach($Categories as $CatKey => $CatName) {
<?=get_size($Bounty)?>
</td>
<td>
<? if($IsFilled){ ?>
<? if ($IsFilled) { ?>
<a href="torrents.php?id=<?=$TorrentID?>"><strong>Yes - <?=$TimeFilled?></strong></a>
<? } else { ?>
<strong>No - <a href="upload.php?requestid=<?=$RequestID?>" class="brackets">Upload</a></strong>
<? } ?>
</td>
<td>
<? if($IsFilled){ ?>
<? if ($IsFilled) { ?>
<a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a>
<? } else { ?>
--

View File

@ -10,30 +10,24 @@
<br />
<strong>Ratio System Overview:</strong><br />
<ul>
<li>Your <strong>ratio</strong> is calculated by dividing the amount of data you&#39;ve uploaded by the amount of data you&#39;ve downloaded. You can view your ratio in the site header, or
in the &#39;stats&#39; section of your user profile.
<li>Your <strong>ratio</strong> is calculated by dividing the amount of data you&#39;ve uploaded by the amount of data you&#39;ve downloaded. You can view your ratio in the site header, or in the &#39;stats&#39; section of your user profile.
</li>
<li>To maintain <strong>leeching privileges</strong>, your ratio must remain above a minimum value. This minimum value is your <strong>required ratio</strong>.</li>
<li>If your ratio falls below your required ratio, you will be given two weeks to raise your ratio back above your required ratio. During this period, you are on <strong>ratio
watch</strong>.
<li>If your ratio falls below your required ratio, you will be given two weeks to raise your ratio back above your required ratio. During this period, you are on <strong>ratio watch</strong>.
</li>
<li>If you fail to raise your ratio above your required required ratio in the allotted time, your leeching privileges will be revoked. You will be unable to download more data. Your
account will remain enabled.
<li>If you fail to raise your ratio above your required required ratio in the allotted time, your leeching privileges will be revoked. You will be unable to download more data. Your account will remain enabled.
</li>
</ul>
<br />
<br />
<strong>Required Ratio Overview:</strong><br />
<ul>
<li>Your required ratio represents the minimum ratio you must maintain to avoid ratio watch. You can view your required ratio in the site header after the word &#39;required,&#39; or in
the &#39;stats&#39; section of your user profile.
<li>Your required ratio represents the minimum ratio you must maintain to avoid ratio watch. You can view your required ratio in the site header after the word &#39;required,&#39; or in the &#39;stats&#39; section of your user profile.
</li>
<li>Your required ratio is unique; each person&#39;s required ratio is calculated for their account specifically.</li>
<li>Your required ratio is calculated using (1) the total amount of data you&#39;ve downloaded and (2) the total number of torrents you&#39;re seeding. The seeding total is not limited to
snatched torrents (completed downloads)&mdash;the total includes, but is not limited to, your uploaded torrents.
<li>Your required ratio is calculated using (1) the total amount of data you&#39;ve downloaded and (2) the total number of torrents you&#39;re seeding. The seeding total is not limited to snatched torrents (completed downloads)&mdash;the total includes, but is not limited to, your uploaded torrents.
</li>
<li>The required ratio system lowers your required ratio when you seed a greater number of torrents. The more torrents you seed, the lower your required ratio will be. The lower your
required ratio is, the less likely it is that you&#39;ll enter ratio watch.
<li>The required ratio system lowers your required ratio when you seed a greater number of torrents. The more torrents you seed, the lower your required ratio will be. The lower your required ratio is, the less likely it is that you&#39;ll enter ratio watch.
</li>
</ul>
<br />
@ -150,8 +144,7 @@
<br />
<strong>Required Ratio Example:</strong><br />
<ul>
<li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20-30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his
minimum required ratio (100% seeded) is 0.05.
<li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20-30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05.
</li>
<li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li>
<li>To calculate Rippy&#39;s actual required ratio, we take his maximum required ratio (0% seeded), which is 0.30, and multiply it by [1 - seeding/snatched] (which is 0.50). Written out:
@ -183,8 +176,7 @@
<li>To leave ratio watch, you must either raise your ratio by uploading more, or lower your required ratio by seeding more. Your ratio must be equal to or above your required ratio in
order for ratio watch to end.
</li>
<li>If you fail to improve your ratio by the time ratio watch expires and lose leeching privileges, your required ratio will be temporarily set to the maximum possible requirement (as if
0% of snatched torrents were being seeded).
<li>If you fail to improve your ratio by the time ratio watch expires and lose leeching privileges, your required ratio will be temporarily set to the maximum possible requirement (as if 0% of snatched torrents were being seeded).
</li>
<li>After losing leeching privileges, in order to adjust the required ratio so that it reflects the actual number of torrents being seeded, you must seed for a combined 72 hours within a weeklong period. After 72
hours of seeding occur, the required ratio will update to reflect your current seeding total, just as it would for a leech-enabled user.
@ -193,9 +185,9 @@
</ul>
<br />
<br />
<? include('jump.php'); ?>
<? include('jump.php'); ?>
</div>
</div>
<?
<?
View::show_footer();
?>
?>

View File

@ -20,7 +20,7 @@
function next_biweek() {
$Date = date('d');
if($Date < 22 && $Date >=8) {
if ($Date < 22 && $Date >=8) {
$Return = 22;
} else {
$Return = 8;
@ -29,12 +29,12 @@ function next_biweek() {
}
function next_day() {
$Tomorrow = time(0,0,0,date('m'),date('d')+1,date('Y'));
$Tomorrow = time(0,0,0,date('m'),date('d') + 1,date('Y'));
return date('d', $Tomorrow);
}
function next_hour() {
$Hour = time(date('H')+1,0,0,date('m'),date('d'),date('Y'));
$Hour = time(date('H') + 1,0,0,date('m'),date('d'),date('Y'));
return date('H', $Hour);
}
@ -73,14 +73,24 @@ function next_hour() {
//We use this to control 6 hour freeleeches. They're actually 7 hour, but don't tell anyone.
/*
$TimeMinus = time_minus(3600*7);
$TimeMinus = time_minus(3600 * 7);
$DB->query("SELECT DISTINCT GroupID FROM torrents WHERE FreeTorrent='1' AND FreeLeechType='3' AND Time<'$TimeMinus'");
while(list($GroupID) = $DB->next_record()) {
$DB->query("SELECT DISTINCT GroupID
FROM torrents
WHERE FreeTorrent='1'
AND FreeLeechType='3'
AND Time<'$TimeMinus'");
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_group_'.$GroupID);
}
$DB->query("UPDATE torrents SET FreeTorrent='0',FreeLeechType='0',flags='2' WHERE FreeTorrent='1' AND FreeLeechType='3' AND Time<'$TimeMinus'");
$DB->query("UPDATE torrents
SET FreeTorrent='0',
FreeLeechType='0',
flags='2'
WHERE FreeTorrent='1'
AND FreeLeechType='3'
AND Time<'$TimeMinus'");
*/
sleep(5);
//------------- Delete unpopular tags -----------------------------------//
@ -113,7 +123,7 @@ function next_hour() {
\*************************************************************************/
if($Hour != next_hour() || $_GET['runhour'] || isset($argv[2])){
if ($Hour != next_hour() || $_GET['runhour'] || isset($argv[2])) {
echo "Ran hourly functions\n";
//------------- Front page stats ----------------------------------------//
@ -126,7 +136,11 @@ function next_hour() {
$Cache->cache_value('stats_snatches',$SnatchStats,0);
}
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid) FROM xbt_files_users WHERE active=1 GROUP BY Type");
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type,
COUNT(uid)
FROM xbt_files_users
WHERE active=1
GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$SeederCount = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0;
$LeecherCount = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0;
@ -178,14 +192,21 @@ function next_hour() {
$Criteria[]=array('From'=>TORRENT_MASTER, 'To'=>POWER_TM, 'MinUpload'=>500*1024*1024*1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600*24*7*8), 'Extra'=>'(SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID=users_main.ID) >= 500');
$Criteria[]=array('From'=>POWER_TM, 'To'=>ELITE_TM, 'MinUpload'=>500*1024*1024*1024, 'MinRatio'=>1.05, 'MinUploads'=>500, 'MaxTime'=>time_minus(3600*24*7*8), 'Extra'=>"(SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = users_main.ID) >= 500");
foreach($Criteria as $L){ // $L = Level
$Query = "SELECT ID FROM users_main JOIN users_info ON users_main.ID = users_info.UserID
foreach ($Criteria as $L) { // $L = Level
$Query = "
SELECT ID
FROM users_main
JOIN users_info ON users_main.ID = users_info.UserID
WHERE PermissionID=".$L['From']."
AND Warned= '0000-00-00 00:00:00'
AND Uploaded>='$L[MinUpload]'
AND (Uploaded/Downloaded >='$L[MinRatio]' OR (Uploaded/Downloaded IS NULL))
AND JoinDate<'$L[MaxTime]'
AND (SELECT COUNT(ID) FROM torrents WHERE UserID=users_main.ID)>='$L[MinUploads]'
AND (
SELECT COUNT(ID)
FROM torrents
WHERE UserID=users_main.ID
) >= '$L[MinUploads]'
AND Enabled='1'";
if (!empty($L['Extra'])) {
$Query .= ' AND '.$L['Extra'];
@ -196,7 +217,7 @@ function next_hour() {
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
/*$Cache->begin_transaction('user_info_'.$UserID);
$Cache->update_row(false, array('PermissionID'=>$L['To']));
$Cache->commit_transaction(0);*/
@ -204,17 +225,25 @@ function next_hour() {
$Cache->delete_value('user_info_heavy_'.$UserID);
$Cache->delete_value('user_stats_'.$UserID);
$Cache->delete_value('enabled_'.$UserID);
$DB->query("UPDATE users_info SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['To'])." by System\n\n', AdminComment) WHERE UserID = ".$UserID);
$DB->query("UPDATE users_info
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['To'])." by System\n\n', AdminComment)
WHERE UserID = ".$UserID);
}
$DB->query("UPDATE users_main SET PermissionID=".$L['To']." WHERE ID IN(".implode(',',$UserIDs).")");
}
// Demote users with less than the required uploads
$Query = "SELECT ID FROM users_main JOIN users_info ON users_main.ID = users_info.UserID
$Query = "
SELECT ID
FROM users_main
JOIN users_info ON users_main.ID = users_info.UserID
WHERE PermissionID='$L[To]'
AND ( Uploaded<'$L[MinUpload]'
OR (SELECT COUNT(ID) FROM torrents WHERE UserID=users_main.ID)<'$L[MinUploads]'";
OR (
SELECT COUNT(ID)
FROM torrents
WHERE UserID=users_main.ID)<'$L[MinUploads]'";
if (!empty($L['Extra'])) {
$Query .= " OR NOT ".$L['Extra'];
}
@ -226,7 +255,7 @@ function next_hour() {
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
/*$Cache->begin_transaction('user_info_'.$UserID);
$Cache->update_row(false, array('PermissionID'=>$L['From']));
$Cache->commit_transaction(0);*/
@ -234,7 +263,9 @@ function next_hour() {
$Cache->delete_value('user_info_heavy_'.$UserID);
$Cache->delete_value('user_stats_'.$UserID);
$Cache->delete_value('enabled_'.$UserID);
$DB->query("UPDATE users_info SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['From'])." by System\n\n', AdminComment) WHERE UserID = ".$UserID);
$DB->query("UPDATE users_info
SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($L['From'])." by System\n\n', AdminComment)
WHERE UserID = ".$UserID);
}
$DB->query("UPDATE users_main SET PermissionID=".$L['From']." WHERE ID IN(".implode(',',$UserIDs).")");
}
@ -270,16 +301,17 @@ function next_hour() {
//------------- Remove dead sessions ---------------------------------------//
sleep(3);
$AgoMins = time_minus(60*30);
$AgoDays = time_minus(3600*24*30);
$AgoMins = time_minus(60 * 30);
$AgoDays = time_minus(3600 * 24 * 30);
$SessionQuery = $DB->query("SELECT UserID, SessionID FROM users_sessions
$SessionQuery = $DB->query("SELECT UserID, SessionID
FROM users_sessions
WHERE (LastUpdate<'$AgoDays' AND KeepLogged='1') OR (LastUpdate<'$AgoMins' AND KeepLogged='0')");
$DB->query("DELETE FROM users_sessions WHERE (LastUpdate<'$AgoDays' AND KeepLogged='1') OR (LastUpdate<'$AgoMins' AND KeepLogged='0')");
$DB->set_query_id($SessionQuery);
while(list($UserID, $SessionID) = $DB->next_record()) {
while (list($UserID, $SessionID) = $DB->next_record()) {
$Cache->begin_transaction('users_sessions_'.$UserID);
$Cache->delete_row($SessionID);
$Cache->commit_transaction(0);
@ -292,7 +324,7 @@ function next_hour() {
//------------- Remove expired warnings ---------------------------------//
$DB->query("SELECT UserID FROM users_info WHERE Warned<'$sqltime'");
while(list($UserID) = $DB->next_record()) {
while (list($UserID) = $DB->next_record()) {
$Cache->begin_transaction('user_info_'.$UserID);
$Cache->update_row(false, array('Warned'=>'0000-00-00 00:00:00'));
$Cache->commit_transaction(2592000);
@ -302,28 +334,28 @@ function next_hour() {
// If a user has downloaded more than 10 GiBs while on ratio watch, disable leeching privileges and send the user a message
$DB->query("SELECT ID FROM users_info AS i JOIN users_main AS m ON m.ID=i.UserID
$DB->query("SELECT ID
FROM users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
WHERE i.RatioWatchEnds!='0000-00-00 00:00:00'
AND i.RatioWatchDownload+10*1024*1024*1024<m.Downloaded
AND m.Enabled='1'
AND m.can_leech='1'");
$UserIDs = $DB->collect('ID' );
if(count($UserIDs) > 0) {
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
$Subject = 'Leeching Disabled';
$Message = 'You have downloaded more then 10 GiB while on Ratio Watch. Your leeching privileges have been disabled. Please reread the rules and refer to this guide on how to improve your ratio https://what.cd/wiki.php?action=article&amp;id=110';
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
Misc::send_pm($UserID, 0, $Subject, $Message);
send_irc("PRIVMSG #reports :!leechdisabled Downloaded 10 GB+ on Ratio Watch. https://".NONSSL_SITE_URL."/user.php?id=$UserID");
send_irc('PRIVMSG #reports :!leechdisabled Downloaded 10 GB+ on Ratio Watch. https://'.SSL_SITE_URL."/user.php?id=$UserID");
}
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
SET
m.can_leech='0',
i.AdminComment=CONCAT('$sqltime - Leech disabled by ratio watch system for downloading more than 10 GBs on ratio watch. - required ratio: ', m.RequiredRatio,'
' , i.AdminComment)
WHERE m.ID IN(".implode(',',$UserIDs).")");
$DB->query("UPDATE users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
SET m.can_leech='0',
i.AdminComment=CONCAT('$sqltime - Leech disabled by ratio watch system for downloading more than 10 GBs on ratio watch. - required ratio: ', m.RequiredRatio,'', i.AdminComment)
WHERE m.ID IN(".implode(',',$UserIDs).")");
}
}
@ -334,9 +366,9 @@ function next_hour() {
\*************************************************************************/
if(!$NoDaily && $Day != next_day() || $_GET['runday']){
if (!$NoDaily && $Day != next_day() || $_GET['runday']) {
echo "Ran daily functions\n";
if($Day%2 == 0) { // If we should generate the drive database (at the end)
if ($Day % 2 == 0) { // If we should generate the drive database (at the end)
$GenerateDriveDB = true;
}
@ -377,29 +409,35 @@ function next_hour() {
WHERE s.NumSnatches>0;");
$RatioRequirements = array(
array(80*1024*1024*1024, 0.60, 0.50),
array(60*1024*1024*1024, 0.60, 0.40),
array(50*1024*1024*1024, 0.60, 0.30),
array(40*1024*1024*1024, 0.50, 0.20),
array(30*1024*1024*1024, 0.40, 0.10),
array(20*1024*1024*1024, 0.30, 0.05),
array(10*1024*1024*1024, 0.20, 0.0),
array(5*1024*1024*1024, 0.15, 0.0)
array(80 * 1024 * 1024 * 1024, 0.60, 0.50),
array(60 * 1024 * 1024 * 1024, 0.60, 0.40),
array(50 * 1024 * 1024 * 1024, 0.60, 0.30),
array(40 * 1024 * 1024 * 1024, 0.50, 0.20),
array(30 * 1024 * 1024 * 1024, 0.40, 0.10),
array(20 * 1024 * 1024 * 1024, 0.30, 0.05),
array(10 * 1024 * 1024 * 1024, 0.20, 0.0),
array(5 * 1024 * 1024 * 1024, 0.15, 0.0)
);
$DB->query("UPDATE users_main SET RequiredRatio=0.60 WHERE Downloaded>100*1024*1024*1024");
$DownloadBarrier = 100*1024*1024*1024;
foreach($RatioRequirements as $Requirement) {
$DownloadBarrier = 100 * 1024 * 1024 * 1024;
foreach ($RatioRequirements as $Requirement) {
list($Download, $Ratio, $MinRatio) = $Requirement;
$DB->query("UPDATE users_main SET RequiredRatio=RequiredRatioWork*$Ratio WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier'");
$DB->query("UPDATE users_main
SET RequiredRatio=RequiredRatioWork*$Ratio
WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier'");
$DB->query("UPDATE users_main SET RequiredRatio=$MinRatio WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND RequiredRatio<$MinRatio");
$DB->query("UPDATE users_main
SET RequiredRatio=$MinRatio
WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND RequiredRatio<$MinRatio");
//$DB->query("UPDATE users_main SET RequiredRatio=$Ratio WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND can_leech='0' AND Enabled='1'");
//$DB->query("UPDATE users_main
// SET RequiredRatio=$Ratio
// WHERE Downloaded >= '$Download' AND Downloaded < '$DownloadBarrier' AND can_leech='0' AND Enabled='1'");
$DownloadBarrier = $Download;
}
@ -412,42 +450,52 @@ function next_hour() {
$OnRatioWatch = array();
// Take users off ratio watch and enable leeching
$UserQuery = $DB->query("SELECT m.ID, torrent_pass FROM users_info AS i JOIN users_main AS m ON m.ID=i.UserID
$UserQuery = $DB->query("
SELECT
m.ID,
torrent_pass
FROM users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
AND i.RatioWatchEnds!='0000-00-00 00:00:00'
AND m.can_leech='0'
AND m.Enabled='1'");
$OffRatioWatch = $DB->collect('ID');
if(count($OffRatioWatch)>0) {
if (count($OffRatioWatch) > 0) {
$DB->query("UPDATE users_info AS ui
JOIN users_main AS um ON um.ID = ui.UserID
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
ui.RatioWatchDownload='0',
um.can_leech='1',
ui.AdminComment = CONCAT('".$sqltime." - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
WHERE ui.UserID IN(".implode(",", $OffRatioWatch).")");
ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
}
foreach($OffRatioWatch as $UserID) {
foreach ($OffRatioWatch as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0','CanLeech'=>1));
$Cache->commit_transaction(0);
Misc::send_pm($UserID, 0, "You have been taken off Ratio Watch", "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n");
Misc::send_pm($UserID, 0, 'You have been taken off Ratio Watch', "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=https://".SSL_SITE_URL."/rules.php?p=ratio]here[/url].\n");
echo "Ratio watch off: $UserID\n";
}
$DB->set_query_id($UserQuery);
$Passkeys = $DB->collect('torrent_pass');
foreach($Passkeys as $Passkey) {
foreach ($Passkeys as $Passkey) {
Tracker::update_tracker('update_user', array('passkey' => $Passkey, 'can_leech' => '1'));
}
// Take users off ratio watch
$UserQuery = $DB->query("SELECT m.ID, torrent_pass FROM users_info AS i JOIN users_main AS m ON m.ID=i.UserID
$UserQuery = $DB->query("
SELECT
m.ID,
torrent_pass
FROM users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
AND i.RatioWatchEnds!='0000-00-00 00:00:00'
AND m.Enabled='1'");
$OffRatioWatch = $DB->collect('ID');
if(count($OffRatioWatch)>0) {
if (count($OffRatioWatch) > 0) {
$DB->query("UPDATE users_info AS ui
JOIN users_main AS um ON um.ID = ui.UserID
SET ui.RatioWatchEnds='0000-00-00 00:00:00',
@ -456,42 +504,45 @@ function next_hour() {
WHERE ui.UserID IN(".implode(",", $OffRatioWatch).")");
}
foreach($OffRatioWatch as $UserID) {
foreach ($OffRatioWatch as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchEnds'=>'0000-00-00 00:00:00','RatioWatchDownload'=>'0','CanLeech'=>1));
$Cache->commit_transaction(0);
Misc::send_pm($UserID, 0, "You have been taken off Ratio Watch", "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n");
Misc::send_pm($UserID, 0, "You have been taken off Ratio Watch", "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=https://".SSL_SITE_URL."/rules.php?p=ratio]here[/url].\n");
echo "Ratio watch off: $UserID\n";
}
$DB->set_query_id($UserQuery);
$Passkeys = $DB->collect('torrent_pass');
foreach($Passkeys as $Passkey) {
foreach ($Passkeys as $Passkey) {
Tracker::update_tracker('update_user', array('passkey' => $Passkey, 'can_leech' => '1'));
}
// Put user on ratio watch if he doesn't meet the standards
sleep(10);
$DB->query("SELECT m.ID, m.Downloaded FROM users_info AS i JOIN users_main AS m ON m.ID=i.UserID
$DB->query("SELECT m.ID,
m.Downloaded
FROM users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
WHERE m.Uploaded/m.Downloaded < m.RequiredRatio
AND i.RatioWatchEnds='0000-00-00 00:00:00'
AND m.Enabled='1'
AND m.can_leech='1'");
$OnRatioWatch = $DB->collect('ID');
if(count($OnRatioWatch)>0) {
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
SET i.RatioWatchEnds='".time_plus(60*60*24*14)."',
if (count($OnRatioWatch)>0) {
$DB->query("UPDATE users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
SET i.RatioWatchEnds='".time_plus(60 * 60 * 24 * 14)."',
i.RatioWatchTimes = i.RatioWatchTimes+1,
i.RatioWatchDownload = m.Downloaded
WHERE m.ID IN(".implode(",", $OnRatioWatch).")");
}
foreach($OnRatioWatch as $UserID) {
foreach ($OnRatioWatch as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchEnds'=>time_plus(60*60*24*14),'RatioWatchDownload'=>0));
$Cache->update_row(false, array('RatioWatchEnds'=>time_plus(60 * 60 * 24 * 14),'RatioWatchDownload'=>0));
$Cache->commit_transaction(0);
Misc::send_pm($UserID, 0, "You have been put on Ratio Watch", "This happens when your ratio falls below the requirements we have outlined in the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n For information about ratio watch, click the link above.");
Misc::send_pm($UserID, 0, 'You have been put on Ratio Watch', "This happens when your ratio falls below the requirements we have outlined in the rules located [url=https://".SSL_SITE_URL."/rules.php?p=ratio]here[/url].\n For information about ratio watch, click the link above.");
echo "Ratio watch on: $UserID\n";
}
@ -499,7 +550,11 @@ function next_hour() {
//------------- Rescore 0.95 logs of disabled users
$LogQuery = $DB->query("SELECT DISTINCT t.ID FROM torrents AS t JOIN users_main AS um ON t.UserID = um.ID JOIN torrents_logs_new AS tl ON tl.TorrentID = t.ID WHERE um.Enabled = '2' and t.HasLog = '1' and LogScore = 100 and Log LIKE 'EAC extraction logfile from%'");
$LogQuery = $DB->query("SELECT DISTINCT t.ID
FROM torrents AS t
JOIN users_main AS um ON t.UserID = um.ID
JOIN torrents_logs_new AS tl ON tl.TorrentID = t.ID
WHERE um.Enabled = '2' and t.HasLog = '1' and LogScore = 100 and Log LIKE 'EAC extraction logfile from%'");
$Details = array();
$Details[] = "Ripped with EAC v0.95, -1 point [1]";
$Details = serialize($Details);
@ -513,82 +568,85 @@ function next_hour() {
//------------- Disable downloading ability of users on ratio watch
$UserQuery = $DB->query("SELECT ID, torrent_pass FROM users_info AS i JOIN users_main AS m ON m.ID=i.UserID
$UserQuery = $DB->query("SELECT ID, torrent_pass
FROM users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
WHERE i.RatioWatchEnds!='0000-00-00 00:00:00'
AND i.RatioWatchEnds<'$sqltime'
AND m.Enabled='1'
AND m.can_leech!='0'");
$UserIDs = $DB->collect('ID');
if(count($UserIDs) > 0) {
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
SET
m.can_leech='0',
i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'
' , i.AdminComment)
if (count($UserIDs) > 0) {
$DB->query("UPDATE users_info AS i
JOIN users_main AS m ON m.ID=i.UserID
SET m.can_leech='0',
i.AdminComment=CONCAT('$sqltime - Leeching ability disabled by ratio watch system - required ratio: ', m.RequiredRatio,'', i.AdminComment)
WHERE m.ID IN(".implode(',',$UserIDs).")");
$DB->query("DELETE FROM users_torrent_history WHERE UserID IN (".implode(',',$UserIDs).")");
}
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('RatioWatchDownload'=>0, 'CanLeech'=>0));
$Cache->commit_transaction(0);
Misc::send_pm($UserID, 0, "Your downloading rights have been disabled", "As you did not raise your ratio in time, your downloading rights have been revoked. You will not be able to download any torrents until your ratio is above your new required ratio.");
Misc::send_pm($UserID, 0, 'Your downloading rights have been disabled', "As you did not raise your ratio in time, your downloading rights have been revoked. You will not be able to download any torrents until your ratio is above your new required ratio.");
echo "Ratio watch disabled: $UserID\n";
}
$DB->set_query_id($UserQuery);
$Passkeys = $DB->collect('torrent_pass');
foreach($Passkeys as $Passkey) {
foreach ($Passkeys as $Passkey) {
Tracker::update_tracker('update_user', array('passkey' => $Passkey, 'can_leech' => '0'));
}
//------------- Disable inactive user accounts --------------------------//
sleep(5);
// Send email
$DB->query("SELECT um.Username, um.Email FROM users_info AS ui JOIN users_main AS um ON um.ID=ui.UserID
$DB->query("SELECT um.Username, um.Email
FROM users_info AS ui
JOIN users_main AS um ON um.ID=ui.UserID
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
WHERE um.PermissionID IN ('".USER."', '".MEMBER ."')
AND um.LastAccess<'".time_minus(3600*24*110, true)."'
AND um.LastAccess>'".time_minus(3600*24*111, true)."'
AND um.LastAccess<'".time_minus(3600 * 24 * 110, true)."'
AND um.LastAccess>'".time_minus(3600 * 24 * 111, true)."'
AND um.LastAccess!='0000-00-00 00:00:00'
AND ui.Donor='0'
AND um.Enabled!='2'
AND ul.UserID IS NULL
GROUP BY um.ID");
while(list($Username, $Email) = $DB->next_record()) {
while (list($Username, $Email) = $DB->next_record()) {
$Body = "Hi $Username, \n\nIt has been almost 4 months since you used your account at http://".NONSSL_SITE_URL.". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in. ";
Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body);
}
$DB->query("SELECT um.ID FROM users_info AS ui JOIN users_main AS um ON um.ID=ui.UserID
$DB->query("SELECT um.ID
FROM users_info AS ui
JOIN users_main AS um ON um.ID=ui.UserID
LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
WHERE um.PermissionID IN ('".USER."', '".MEMBER ."')
AND um.LastAccess<'".time_minus(3600*24*30*4)."'
AND um.LastAccess<'".time_minus(3600 * 24 * 30 * 4)."'
AND um.LastAccess!='0000-00-00 00:00:00'
AND ui.Donor='0'
AND um.Enabled!='2'
AND ul.UserID IS NULL
GROUP BY um.ID");
if($DB->record_count() > 0) {
Tools::disable_users($DB->collect('ID'), "Disabled for inactivity.", 3);
if ($DB->record_count() > 0) {
Tools::disable_users($DB->collect('ID'), 'Disabled for inactivity.', 3);
}
//------------- Disable unconfirmed users ------------------------------//
sleep(10);
$DB->query("UPDATE users_info AS ui JOIN users_main AS um ON um.ID=ui.UserID
$DB->query("UPDATE users_info AS ui
JOIN users_main AS um ON um.ID=ui.UserID
SET um.Enabled='2',
ui.BanDate='$sqltime',
ui.BanReason='3',
ui.AdminComment=CONCAT('$sqltime - Disabled for inactivity (never logged in)
', ui.AdminComment)
ui.AdminComment=CONCAT('$sqltime - Disabled for inactivity (never logged in)', ui.AdminComment)
WHERE um.LastAccess='0000-00-00 00:00:00'
AND ui.JoinDate<'".time_minus(60*60*24*7)."'
AND ui.JoinDate<'".time_minus(60 * 60 * 24 * 7)."'
AND um.Enabled!='2'
");
$Cache->decrement('stats_user_count',$DB->affected_rows());
@ -597,26 +655,42 @@ function next_hour() {
//------------- Demote users --------------------------------------------//
sleep(10);
$DB->query('SELECT um.ID FROM users_main AS um WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded/Downloaded < 0.95 OR PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded < 25*1024*1024*1024');
$DB->query('SELECT um.ID
FROM users_main AS um
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded/Downloaded < 0.95
OR PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded < 25*1024*1024*1024');
echo "demoted 1\n";
while(list($UserID) = $DB->next_record()) {
while (list($UserID) = $DB->next_record()) {
$Cache->begin_transaction('user_info_'.$UserID);
$Cache->update_row(false, array('PermissionID'=>MEMBER));
$Cache->commit_transaction(2592000);
}
$DB->query('UPDATE users_main SET PermissionID='.MEMBER.' WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded/Downloaded < 0.95 OR PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded < 25*1024*1024*1024');
$DB->query('UPDATE users_main
SET PermissionID='.MEMBER.'
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded/Downloaded < 0.95
OR PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded < 25*1024*1024*1024');
echo "demoted 2\n";
$DB->query('SELECT um.ID FROM users_main AS um WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded/Downloaded < 0.65');
$DB->query('SELECT um.ID
FROM users_main AS um
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded/Downloaded < 0.65');
echo "demoted 3\n";
while(list($UserID) = $DB->next_record()) {
while (list($UserID) = $DB->next_record()) {
$Cache->begin_transaction('user_info_'.$UserID);
$Cache->update_row(false, array('PermissionID'=>USER));
$Cache->commit_transaction(2592000);
}
$DB->query('UPDATE users_main SET PermissionID='.USER.' WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.') AND Uploaded/Downloaded < 0.65');
$DB->query('UPDATE users_main
SET PermissionID='.USER.'
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded/Downloaded < 0.65');
echo "demoted 4\n";
//------------- Lock old threads ----------------------------------------//
@ -629,18 +703,18 @@ function next_hour() {
AND f.AutoLock = '1'");
$IDs = $DB->collect('ID');
if(count($IDs) > 0) {
if (count($IDs) > 0) {
$LockIDs = implode(',', $IDs);
$DB->query("UPDATE forums_topics SET IsLocked='1' WHERE ID IN($LockIDs)");
sleep(2);
$DB->query("DELETE FROM forums_last_read_topics WHERE TopicID IN($LockIDs)");
foreach($IDs as $ID) {
foreach ($IDs as $ID) {
$Cache->begin_transaction('thread_'.$ID.'_info');
$Cache->update_row(false, array('IsLocked'=>'1'));
$Cache->commit_transaction(3600*24*30);
$Cache->expire_value('thread_'.$TopicID.'_catalogue_0',3600*24*30);
$Cache->expire_value('thread_'.$TopicID.'_info',3600*24*30);
$Cache->commit_transaction(3600 * 24 * 30);
$Cache->expire_value('thread_'.$TopicID.'_catalogue_0',3600 * 24 * 30);
$Cache->expire_value('thread_'.$TopicID.'_info',3600 * 24 * 30);
}
}
echo "Old threads locked\n";
@ -670,12 +744,12 @@ function next_hour() {
FROM torrents AS t
JOIN torrents_group AS tg ON tg.ID = t.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID = tg.ArtistID
WHERE t.last_action < '".time_minus(3600*24*28)."'
WHERE t.last_action < '".time_minus(3600 * 24 * 28)."'
AND t.last_action != 0
OR t.Time < '".time_minus(3600*24*2)."'
OR t.Time < '".time_minus(3600 * 24 * 2)."'
AND t.last_action = 0");
$TorrentIDs = $DB->to_array();
echo "Found ".count($TorrentIDs)." inactive torrents to be deleted.\n";
echo 'Found '.count($TorrentIDs)." inactive torrents to be deleted.\n";
$LogEntries = array();
@ -689,11 +763,11 @@ function next_hour() {
// don't delete the torrent!
continue;
}
if($ArtistName) {
if ($ArtistName) {
$Name = $ArtistName.' - '.$Name;
}
if($Format && $Encoding) {
$Name.=' ['.(empty($Media)?'':"$Media / ").$Format.' / '.$Encoding.']';
if ($Format && $Encoding) {
$Name.= ' ['.(empty($Media) ? '' : "$Media / ").$Format.' / '.$Encoding.']';
}
Torrents::delete_torrent($ID, $GroupID);
$LogEntries[] = "Torrent ".$ID." (".$Name.") (".strtoupper($InfoHash).") was deleted for inactivity (unseeded)";
@ -711,13 +785,13 @@ function next_hour() {
}
echo "$i torrents deleted for inactivity.\n";
foreach($DeleteNotes as $UserID => $MessageInfo){
foreach ($DeleteNotes as $UserID => $MessageInfo) {
$Singular = ($MessageInfo['Count'] == 1) ? true : false;
Misc::send_pm($UserID, 0, $MessageInfo['Count'].' of your torrents '.($Singular?'has':'have').' been deleted for inactivity', ($Singular?'One':'Some').' of your uploads '.($Singular?'has':'have').' been deleted for being unseeded. Since '.($Singular?'it':'they').' didn\'t break any rules (we hope), please feel free to re-upload '.($Singular?'it':'them').".\n\nThe following torrent".($Singular?' was':'s were').' deleted:'.$MessageInfo['Msg']);
Misc::send_pm($UserID, 0, $MessageInfo['Count'].' of your torrents '.($Singular ? 'has' : 'have').' been deleted for inactivity', ($Singular ? 'One' : 'Some').' of your uploads '.($Singular ? 'has' : 'have').' been deleted for being unseeded. Since '.($Singular ? 'it' : 'they').' didn\'t break any rules (we hope), please feel free to re-upload '.($Singular ? 'it' : 'them').".\n\nThe following torrent".($Singular ? ' was' : 's were').' deleted:'.$MessageInfo['Msg']);
}
unset($DeleteNotes);
if(count($LogEntries) > 0) {
if (count($LogEntries) > 0) {
$Values = "('".implode("', '".$sqltime."'), ('",$LogEntries)."', '".$sqltime."')";
$DB->query('INSERT INTO log (Message, Time) VALUES '.$Values);
echo "\nDeleted $i torrents for inactivity\n";
@ -726,7 +800,7 @@ function next_hour() {
$DB->query("SELECT SimilarID FROM artists_similar_scores WHERE Score<=0");
$SimilarIDs = implode(',',$DB->collect('SimilarID'));
if($SimilarIDs) {
if ($SimilarIDs) {
$DB->query("DELETE FROM artists_similar WHERE SimilarID IN($SimilarIDs)");
$DB->query("DELETE FROM artists_similar_scores WHERE SimilarID IN($SimilarIDs)");
$DB->query("DELETE FROM artists_similar_votes WHERE SimilarID IN($SimilarIDs)");
@ -739,7 +813,7 @@ function next_hour() {
$HistoryID = $DB->inserted_id();
$Top10 = $Cache->get_value('top10tor_day_10');
if($Top10 === false) {
if ($Top10 === false) {
$DB->query("SELECT
t.ID,
g.ID,
@ -763,7 +837,7 @@ function next_hour() {
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
WHERE t.Seeders>0
AND t.Time > ('".$sqltime."' - INTERVAL 1 DAY)
AND t.Time > ('$sqltime' - INTERVAL 1 DAY)
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT 10;");
@ -771,7 +845,7 @@ function next_hour() {
}
$i = 1;
foreach($Top10 as $Torrent) {
foreach ($Top10 as $Torrent) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Torrent;
@ -780,29 +854,29 @@ function next_hour() {
$Artists = Artists::get_artist($GroupID);
if(!empty($Artists)) {
if (!empty($Artists)) {
$DisplayName = Artists::display_artists($Artists, false, true);
}
$DisplayName.= $GroupName;
if($GroupCategoryID==1 && $GroupYear>0) {
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName.= " [$GroupYear]";
}
// append extra info to torrent title
$ExtraInfo='';
$AddExtra='';
if($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
if ($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if ($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
// "FLAC / Lossless / Log (100%) / Cue / CD";
if($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if($ExtraInfo!='') {
if ($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if ($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if ($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if ($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if ($Year > 0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if ($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
@ -819,12 +893,12 @@ function next_hour() {
// Weekly top 10 history.
// We need to haxxor it to work on a Sunday as we don't have a weekly schedule
if(date('w') == 0) {
if (date('w') == 0) {
$DB->query("INSERT INTO top10_history (Date, Type) VALUES ('".$sqltime."', 'Weekly')");
$HistoryID = $DB->inserted_id();
$Top10 = $Cache->get_value('top10tor_week_10');
if($Top10 === false) {
if ($Top10 === false) {
$DB->query("SELECT
t.ID,
g.ID,
@ -856,38 +930,61 @@ function next_hour() {
}
$i = 1;
foreach($Top10 as $Torrent) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Torrent;
foreach ($Top10 as $Torrent) :
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $TorrentTags,
$Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear,
$RemasterTitle, $Snatched, $Seeders, $Leechers, $Data) = $Torrent;
$DisplayName='';
$Artists = Artists::get_artist($GroupID);
if(!empty($Artists)) {
if (!empty($Artists)) {
$DisplayName = Artists::display_artists($Artists, false, true);
}
$DisplayName.= $GroupName;
if($GroupCategoryID==1 && $GroupYear>0) {
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName.= " [$GroupYear]";
}
// append extra info to torrent title
$ExtraInfo='';
$AddExtra='';
if($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
$ExtraInfo = '';
$AddExtra = '';
if ($Format) {
$ExtraInfo.=$Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.=$AddExtra.$Encoding;
$AddExtra = ' / ';
}
// "FLAC / Lossless / Log (100%) / Cue / CD";
if($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if($ExtraInfo!='') {
if ($HasLog) {
$ExtraInfo.=$AddExtra.'Log ('.$LogScore.'%)';
$AddExtra = ' / ';
}
if ($HasCue) {
$ExtraInfo.=$AddExtra.'Cue';
$AddExtra = ' / ';
}
if ($Media) {
$ExtraInfo.=$AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.=$AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.=$AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.=$AddExtra.$RemasterTitle;
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
@ -895,15 +992,16 @@ function next_hour() {
$TagString = str_replace("|", " ", $TorrentTags);
$DB->query("INSERT INTO top10_history_torrents
$DB->query('INSERT INTO top10_history_torrents
(HistoryID, Rank, TorrentID, TitleString, TagString)
VALUES
(".$HistoryID.", ".$i.", ".$TorrentID.", '".db_string($TitleString)."', '".db_string($TagString)."')");
('.$HistoryID.", ".$i.", ".$TorrentID.", '".db_string($TitleString)."', '".db_string($TagString)."')");
$i++;
}
endforeach;
// Send warnings to uploaders of torrents that will be deleted this week
$DB->query("SELECT
$DB->query("
SELECT
t.ID,
t.GroupID,
tg.Name,
@ -931,23 +1029,25 @@ function next_hour() {
if (!array_key_exists($UserID, $TorrentAlerts))
$TorrentAlerts[$UserID] = array('Count' => 0, 'Msg' => '');
$ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
if($ArtistName) {
if ($ArtistName) {
$Name = $ArtistName.' - '.$Name;
}
if($Format && $Encoding) {
if ($Format && $Encoding) {
$Name.=' ['.$Format.' / '.$Encoding.']';
}
$TorrentAlerts[$UserID]['Msg'] .= "\n[url=http://".NONSSL_SITE_URL."/torrents.php?torrentid=$ID]".$Name."[/url]";
$TorrentAlerts[$UserID]['Msg'] .= "\n[url=https://".SSL_SITE_URL."/torrents.php?torrentid=$ID]".$Name."[/url]";
$TorrentAlerts[$UserID]['Count']++;
}
foreach($TorrentAlerts as $UserID => $MessageInfo){
Misc::send_pm($UserID, 0, 'Unseeded torrent notification', $MessageInfo['Count']." of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=https://what.cd/wiki.php?action=article&amp;id=663]here[/url].\n\nThe following torrent".($MessageInfo['Count']>1?'s':'')." will be removed for inactivity:".$MessageInfo['Msg']."\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings.");
foreach ($TorrentAlerts as $UserID => $MessageInfo) {
Misc::send_pm($UserID, 0, 'Unseeded torrent notification', $MessageInfo['Count']." of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=https://what.cd/wiki.php?action=article&amp;id=663]here[/url].\n\nThe following torrent".($MessageInfo['Count'] > 1 ? 's' : '').' will be removed for inactivity:'.$MessageInfo['Msg']."\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings.");
}
}
$DB->query("UPDATE staff_pm_conversations
SET Status = 'Resolved', ResolverID = '0'
WHERE Date < NOW() - INTERVAL 1 MONTH AND Status = 'Open' AND AssignedToUser IS NULL");
WHERE Date < NOW() - INTERVAL 1 MONTH
AND Status = 'Open'
AND AssignedToUser IS NULL");
}
/*************************************************************************\
@ -957,7 +1057,7 @@ function next_hour() {
\*************************************************************************/
if($BiWeek != next_biweek() || $_GET['runbiweek']) {
if ($BiWeek != next_biweek() || $_GET['runbiweek']) {
echo "Ran bi-weekly functions\n";
//------------- Cycle auth keys -----------------------------------------//
@ -997,11 +1097,16 @@ function next_hour() {
$DB->query("SELECT ID
FROM users_main AS um
JOIN users_info AS ui on ui.UserID=um.ID
WHERE um.Enabled='1' AND ui.DisableInvites = '0'
AND ((um.PermissionID = ".POWER." AND um.Invites < 2) OR (um.PermissionID = ".ELITE." AND um.Invites < 4))");
WHERE um.Enabled='1'
AND ui.DisableInvites = '0'
AND ((um.PermissionID = ".POWER."
AND um.Invites < 2
) OR (um.PermissionID = ".ELITE."
AND um.Invites < 4)
)");
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('Invites' => '+1'));
$Cache->commit_transaction(0);
@ -1010,15 +1115,16 @@ function next_hour() {
}
$BonusReqs = array(
array(0.75, 2*1024*1024*1024),
array(2.0, 10*1024*1024*1024),
array(3.0, 20*1024*1024*1024));
array(0.75, 2 * 1024 * 1024 * 1024),
array(2.0, 10 * 1024 * 1024 * 1024),
array(3.0, 20 * 1024 * 1024 * 1024));
// Since MySQL doesn't like subselecting from the target table during an update, we must create a temporary table.
$DB->query("CREATE TEMPORARY TABLE temp_sections_schedule_index
SELECT SUM(Uploaded) AS Upload,SUM(Downloaded) AS Download,Inviter
FROM users_main AS um JOIN users_info AS ui ON ui.UserID=um.ID
FROM users_main AS um
JOIN users_info AS ui ON ui.UserID=um.ID
GROUP BY Inviter");
foreach ($BonusReqs as $BonusReq) {
@ -1028,11 +1134,16 @@ function next_hour() {
JOIN users_info AS ui ON ui.UserID=um.ID
JOIN temp_sections_schedule_index AS u ON u.Inviter = um.ID
WHERE u.Upload>$Upload AND u.Upload/u.Download>$Ratio
AND um.Enabled = '1' AND ui.DisableInvites = '0'
AND ((um.PermissionID = ".POWER." AND um.Invites < 2) OR (um.PermissionID = ".ELITE." AND um.Invites < 4))");
AND um.Enabled = '1'
AND ui.DisableInvites = '0'
AND ((um.PermissionID = ".POWER."
AND um.Invites < 2
) OR (um.PermissionID = ".ELITE."
AND um.Invites < 4)
)");
$UserIDs = $DB->collect('ID');
if (count($UserIDs) > 0) {
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
$Cache->begin_transaction('user_info_heavy_'.$UserID);
$Cache->update_row(false, array('Invites' => '+1'));
$Cache->commit_transaction(0);
@ -1041,10 +1152,15 @@ function next_hour() {
}
}
if($BiWeek == 8) {
$DB->query("TRUNCATE TABLE top_snatchers;");
if ($BiWeek == 8) {
$DB->query('TRUNCATE TABLE top_snatchers;');
$DB->query("INSERT INTO top_snatchers (UserID) SELECT uid FROM xbt_snatched GROUP BY uid ORDER BY COUNT(uid) DESC LIMIT 100;");
$DB->query("INSERT INTO top_snatchers (UserID)
SELECT uid
FROM xbt_snatched
GROUP BY uid
ORDER BY COUNT(uid) DESC
LIMIT 100;");
}
}

View File

@ -11,9 +11,9 @@
if ($Level == 0) {
// FLS conversation, assign to staff (moderator)
if(!empty($_GET['to'])) {
if (!empty($_GET['to'])) {
$Level = 0;
switch($_GET['to']) {
switch ($_GET['to']) {
case 'forum' :
$Level = 650;
break;
@ -25,7 +25,10 @@
break;
}
$DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', Level=".$Level." WHERE ID=$ConvID");
$DB->query("UPDATE staff_pm_conversations
SET Status='Unanswered',
Level=$Level
WHERE ID=$ConvID");
header('Location: staffpm.php');
} else {
error(404);
@ -46,12 +49,16 @@
if ($LevelType == 'class') {
// Assign to class
$DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', Level=$NewLevel, AssignedToUser=NULL WHERE ID=$ConvID");
$DB->query("UPDATE staff_pm_conversations
SET Status='Unanswered',
Level=$NewLevel,
AssignedToUser=NULL
WHERE ID=$ConvID");
} else {
$UserInfo = Users::user_info($NewLevel);
$Level = $Classes[$UserInfo['PermissionID']]['Level'];
if (!$Level) {
error("Assign to user not found.");
error('Assign to user not found.');
}
// Assign to user
@ -66,7 +73,7 @@
}
} else {
// No id
// No ID
header('Location: staffpm.php');
}
?>

View File

@ -62,7 +62,7 @@
// List common responses
$DB->query("SELECT ID, Message, Name FROM staff_pm_responses ORDER BY ID DESC");
while(list($ID, $Message, $Name) = $DB->next_record()) {
while (list($ID, $Message, $Name) = $DB->next_record()) {
?>
<br />

View File

@ -12,7 +12,7 @@
\*********************************************************************/
// Quick SQL injection check
if(!$_GET['post'] || !is_number($_GET['post'])){
if (!$_GET['post'] || !is_number($_GET['post'])) {
error(0);
}

View File

@ -20,24 +20,28 @@
$Message = "Thank for for helping to support the site. It's users like you who make all of this possible.";
if ((int)$Donor === 0) {
$Msg = db_string(sqltime() . ' - Donated: http://'.NONSSL_SITE_URL."/staffpm.php?action=viewconv&amp;id=$ConvID\n\n");
$Msg = db_string(sqltime() . ' - Donated: https://'.SSL_SITE_URL."/staffpm.php?action=viewconv&amp;id=$ConvID\n\n");
$DB->query("UPDATE users_info
SET Donor='1',
AdminComment = CONCAT('$Msg',AdminComment)
WHERE UserID = $UserID");
$DB->query("UPDATE users_main SET Invites=Invites+2 WHERE ID = $UserID");
$DB->query("UPDATE users_main
SET Invites=Invites+2
WHERE ID = $UserID");
$Cache->delete_value('user_info_'.$UserID);
$Cache->delete_value('user_info_heavy_'.$UserID);
$Message .= " Enjoy your new love from us!";
$Message .= ' Enjoy your new love from us!';
} else {
$Message .= " ";
$Message .= ' ';
}
$DB->query("INSERT INTO staff_pm_messages (UserID, SentDate, Message, ConvID)
VALUES (".$LoggedUser['ID'].", '".sqltime()."', '".db_string($Message)."', $ConvID)");
$DB->query("UPDATE staff_pm_conversations
SET Date='".sqltime()."', Unread=true,
Status='Resolved', ResolverID=".$LoggedUser['ID']."
SET Date='".sqltime()."',
Unread=true,
Status='Resolved',
ResolverID=".$LoggedUser['ID']."
WHERE ID=$ConvID");
header('Location: staffpm.php');
?>

View File

@ -6,37 +6,37 @@
$UserLevel = $LoggedUser['EffectiveClass'];
// Setup for current view mode
$SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, ";
$SortStr = 'IF(AssignedToUser = '.$LoggedUser['ID'].',0,1) ASC, ';
switch ($View) {
case 'unanswered':
$ViewString = "Unanswered";
$ViewString = 'Unanswered';
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
break;
case 'open':
$ViewString = "All open";
$ViewString = 'All open';
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status IN ('Open', 'Unanswered')";
$SortStr = '';
break;
case 'resolved':
$ViewString = "Resolved";
$ViewString = 'Resolved';
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Resolved'";
$SortStr = '';
break;
case 'my':
$ViewString = "My unanswered";
$ViewString = 'My unanswered';
$WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
break;
default:
if ($UserLevel >= 700) {
$ViewString = "My unanswered";
$ViewString = 'My unanswered';
$WhereCondition = "WHERE ((Level >= ".max($Classes[MOD]['Level'],700)." AND Level <= $UserLevel) OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
} elseif ($UserLevel == 650) {
// Forum Mods
$ViewString = "My Unanswered";
$ViewString = 'My unanswered';
$WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
} else {
// FLS
$ViewString = "Unanswered";
$ViewString = 'Unanswered';
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
}
break;
@ -67,10 +67,10 @@
$DB->set_query_id($StaffPMs);
$CurURL = Format::get_url();
if(empty($CurURL)) {
$CurURL = "staffpm.php?";
if (empty($CurURL)) {
$CurURL = 'staffpm.php?';
} else {
$CurURL = "staffpm.php?".$CurURL."&";
$CurURL = 'staffpm.php?'.$CurURL.'&';
}
$Pages=Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9);
@ -82,8 +82,8 @@
<div class="header">
<h2><?=$ViewString?> Staff PMs</h2>
<div class="linkbox">
<? if ($IsStaff) {
?> <a href="staffpm.php" class="brackets">My unanswered</a>
<? if ($IsStaff) { ?>
<a href="staffpm.php" class="brackets">My unanswered</a>
<? } ?>
<a href="staffpm.php?view=unanswered" class="brackets">All unanswered</a>
<a href="staffpm.php?view=open" class="brackets">Open</a>
@ -101,13 +101,13 @@
<div class="box pad" id="inbox">
<?
if ($DB->record_count() == 0) {
if ($DB->record_count() == 0) :
// No messages
?>
<h2>No messages</h2>
<?
} else {
else:
// Messages, draw table
if ($ViewString != 'Resolved' && $IsStaff) {
// Open multiresolve form
@ -120,7 +120,7 @@
// Table head
?>
<table class="message_table<?=($ViewString != 'Resolved' && $IsStaff)?' checkboxes':''?>">
<table class="message_table<?=($ViewString != 'Resolved' && $IsStaff) ? ' checkboxes' : '' ?>">
<tr class="colhead">
<? if ($ViewString != 'Resolved' && $IsStaff) { ?>
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform',this)" /></td>
@ -136,7 +136,7 @@
<?
// List messages
while(list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $ResolverID) = $DB->next_record()) {
while (list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $ResolverID) = $DB->next_record()) :
$Row = ($Row === 'a') ? 'b' : 'a';
$RowClass = 'row'.$Row;
@ -146,7 +146,7 @@
// Get assigned
if ($AssignedToUser == '') {
// Assigned to class
$Assigned = ($Level == 0) ? "First Line Support" : $ClassLevels[$Level]['Name'];
$Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
// No + on Sysops
if ($Assigned != 'Sysop') { $Assigned .= "+"; }
@ -180,7 +180,7 @@
<?
$DB->set_query_id($StaffPMs);
}
endwhile;
// Close table and multiresolve form
?>
@ -190,7 +190,7 @@
</form>
<?
}
}
endif;
?>
</div>
<div class="linkbox">

View File

@ -6,7 +6,7 @@
if ($UserID == $LoggedUser['ID'] || ($IsFLS && $Level == 0) ||
$AssignedToUser == $LoggedUser['ID'] || ($IsStaff && $Level <= $LoggedUser['EffectiveClass'])) {
/*if($Level != 0 && $IsStaff == false) {
/*if ($Level != 0 && $IsStaff == false) {
error(403);
}*/
@ -21,7 +21,7 @@
error(403);
}
} else {
// No id
// No ID
header('Location: staffpm.php');
}
?>

View File

@ -64,7 +64,7 @@
// Get messages
$StaffPMs = $DB->query("SELECT UserID, SentDate, Message, ID FROM staff_pm_messages WHERE ConvID=$ConvID");
while(list($UserID, $SentDate, $Message, $MessageID) = $DB->next_record()) {
while (list($UserID, $SentDate, $Message, $MessageID) = $DB->next_record()) {
// Set user string
if ($UserID == $OwnerID) {
// User, use prepared string
@ -112,7 +112,7 @@
<?
// List common responses
$DB->query("SELECT ID, Name FROM staff_pm_responses");
while(list($ID, $Name) = $DB->next_record()) {
while (list($ID, $Name) = $DB->next_record()) {
?>
<option value="<?=$ID?>"><?=$Name?></option>
<? } ?>
@ -172,7 +172,7 @@
WHERE p.DisplayStaff='1'
ORDER BY p.Level DESC, m.Username ASC"
);
while(list($ID, $Name) = $DB->next_record()) {
while (list($ID, $Name) = $DB->next_record()) {
// Create one <option> for each staff member
$Selected = ($AssignedToUser == $ID) ? ' selected="selected"' : '';
?>
@ -192,7 +192,7 @@
WHERE p.DisplayStaff!='1' AND i.SupportFor!=''
ORDER BY m.Username ASC
");
while(list($ID, $Name) = $DB->next_record()) {
while (list($ID, $Name) = $DB->next_record()) {
// Create one <option> for each FLS user
$Selected = ($AssignedToUser == $ID) ? ' selected="selected"' : '';
?>
@ -229,6 +229,6 @@
View::show_footer();
} else {
// No id
// No ID
header('Location: staffpm.php');
}

View File

@ -17,7 +17,7 @@
$_REQUEST['action'] = $argv[1];
} else {
if (empty($_REQUEST['action']) || ($_REQUEST['action'] != "public_sandbox" && $_REQUEST['action'] != "ocelot")) {
if (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'public_sandbox' && $_REQUEST['action'] != 'ocelot')) {
enforce_login();
}
}
@ -40,14 +40,16 @@
}
include(SERVER_ROOT."/classes/class_validate.php");
$Val=NEW VALIDATE;
$Val = new VALIDATE;
include(SERVER_ROOT.'/classes/class_feed.php');
$Feed = new FEED;
switch ($_REQUEST['action']){
case 'phpinfo':
if (!check_perms('site_debug')) error(403);
if (!check_perms('site_debug')) {
error(403);
}
phpinfo();
break;
//Services
@ -124,7 +126,10 @@
error(403);
}
if (is_number($_POST['newsid'])){
$DB->query("UPDATE news SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['newsid'])."'");
$DB->query("UPDATE news
SET Title='".db_string($_POST['title'])."',
Body='".db_string($_POST['body'])."'
WHERE ID='".db_string($_POST['newsid'])."'");
$Cache->delete_value('news');
$Cache->delete_value('feed_news');
}
@ -155,7 +160,8 @@
error(403);
}
$DB->query("INSERT INTO news (UserID, Title, Body, Time) VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')");
$DB->query("INSERT INTO news (UserID, Title, Body, Time)
VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')");
@ -190,7 +196,11 @@
//$Val->SetFields('test',true,'number','You did not enter a valid level for this permission set.');
if (is_numeric($_REQUEST['id'])) {
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,p.PermittedForums,p.Values,p.DisplayStaff,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID WHERE p.ID='".db_string($_REQUEST['id'])."' GROUP BY p.ID");
$DB->query("SELECT p.ID, p.Name, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, COUNT(u.ID)
FROM permissions AS p
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
WHERE p.ID='".db_string($_REQUEST['id'])."'
GROUP BY p.ID");
list($ID,$Name,$Level,$Secondary,$Forums,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(5));
if ($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) {
@ -207,7 +217,7 @@
list($DupeCheck)=$DB->next_record();
if ($DupeCheck) {
$Err = "There is already a permission class with that level.";
$Err = 'There is already a permission class with that level.';
}
}
@ -235,7 +245,8 @@
'".db_string(serialize($Values))."',
'".db_string($DisplayStaff)."')");
} else {
$DB->query("UPDATE permissions SET Level='".db_string($Level)."',
$DB->query("UPDATE permissions
SET Level='".db_string($Level)."',
Name='".db_string($Name)."',
Secondary=".$Secondary.",
PermittedForums='".db_string($Forums)."',

View File

@ -1,14 +1,16 @@
<?
function class_list($Selected=0){
function class_list($Selected = 0) {
global $Classes;
$Return = '';
foreach ($Classes as $ID => $Class) {
if ($Class['Secondary']) { continue; }
if ($Class['Secondary']) {
continue;
}
$Name = $Class['Name'];
$Level = $Class['Level'];
$Return.='<option value="'.$Level.'"';
if($Selected == $Level){
if ($Selected == $Level) {
$Return.=' selected="selected"';
}
$Return.='>'.Format::cut_string($Name, 20, 1).'</option>'."\n";
@ -17,7 +19,9 @@ function class_list($Selected=0){
return $Return;
}
if(!check_perms('admin_manage_forums')) { error(403); }
if (!check_perms('admin_manage_forums')) {
error(403);
}
View::show_header('Forum Management');
$DB->query('SELECT ID, Name FROM forums ORDER BY Sort');
@ -27,7 +31,7 @@ function class_list($Selected=0){
unset($ForumCats);
$ForumCats = $Cache->get_value('forums_categories');
if ($ForumCats === false) {
$DB->query("SELECT ID, Name FROM forums_categories");
$DB->query('SELECT ID, Name FROM forums_categories');
$ForumCats = array();
while (list($ID, $Name) = $DB->next_record()) {
$ForumCats[$ID] = $Name;
@ -35,7 +39,8 @@ function class_list($Selected=0){
$Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache.
}
$DB->query('SELECT
$DB->query('
SELECT
ID,
CategoryID,
Sort,
@ -68,7 +73,7 @@ function class_list($Selected=0){
</tr>
<?
$Row = 'b';
while(list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinClassWrite, $MinClassCreate, $AutoLock, $AutoLockWeeks) = $DB->next_record()){
while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinClassWrite, $MinClassCreate, $AutoLock, $AutoLockWeeks) = $DB->next_record()) {
$Row = ($Row === 'a' ? 'b' : 'a');
?>
<tr class="row<?=$Row?>">
@ -81,7 +86,7 @@ function class_list($Selected=0){
<? reset($ForumCats);
foreach ($ForumCats as $CurCat => $CatName) {
?>
<option value="<?=$CurCat?>" <? if($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
<option value="<?=$CurCat?>" <? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
<? } ?>
</select>
</td>
@ -110,7 +115,7 @@ function class_list($Selected=0){
</select>
</td>
<td>
<input type="checkbox" name="autolock" <?=($AutoLock == '1')?'checked ':''?>/>
<input type="checkbox" name="autolock"<?=($AutoLock == '1') ? ' checked="checked"' : ''?> />
</td>
<td>
<input type="text" name="autolockweeks" value="<?=$AutoLockWeeks?>" />
@ -135,8 +140,8 @@ function class_list($Selected=0){
<td>
<select name="categoryid">
<? reset($ForumCats);
while(list($CurCat, $CatName) = each($ForumCats)) { ?>
<option value="<?=$CurCat?>" <? if($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
while (list($CurCat, $CatName) = each($ForumCats)) { ?>
<option value="<?=$CurCat?>"<? if ($CurCat == $CategoryID) { echo ' selected="selected"'; } ?>><?=$CatName?></option>
<? } ?>
</select>
</td>
@ -165,7 +170,7 @@ function class_list($Selected=0){
</select>
</td>
<td>
<input type="checkbox" name="autolock" checked />
<input type="checkbox" name="autolock" checked="checked" />
</td>
<td>
<input type="text" name="autolockweeks" value="4" />

View File

@ -1,14 +1,14 @@
<?
//******************************************************************************//
//--------------- Restore all VH-recommended torrents to NL -------------------//
//--------------- Restore all VH-recommended torrents to NL --------------------//
//---- For use after resetting the FL/NL database (after sitewide freeleech) ---//
authorize();
if(!check_perms('site_manage_recommendations')){
if (!check_perms('site_manage_recommendations')) {
error(403);
}
$DB->query("SELECT GroupID FROM torrents_recommended");
$DB->query('SELECT GroupID FROM torrents_recommended');
$ToNL = $DB->next_record();
Torrents::freeleech_groups($ToNL, 2, 3);
?>

View File

@ -1,11 +1,15 @@
<?
if (!check_perms('users_mod')) { error(403); }
if (!check_perms('users_mod')) {
error(403);
}
if (isset($_REQUEST['addtokens'])) {
authorize();
$Tokens = $_REQUEST['numtokens'];
if (!is_number($Tokens) || ($Tokens < 0)) { error("Please enter a valid number of tokens."); }
if (!is_number($Tokens) || ($Tokens < 0)) {
error('Please enter a valid number of tokens.');
}
$sql = "UPDATE users_main SET FLTokens = FLTokens + $Tokens WHERE Enabled = '1'";
if (!isset($_REQUEST['leechdisabled'])) {
$sql .= " AND can_leech = 1";
@ -19,12 +23,14 @@
while (list($UserID) = $DB->next_record()) {
$Cache->delete_value('user_info_heavy_'.$UserID);
}
$message = "<strong>$Tokens freeleech tokens added to all enabled users" . (!isset($_REQUEST['leechdisabled'])?' with enabled leeching privs':'') . '.</strong><br /><br />';
$message = '<strong>' . number_format($Tokens) . 'freeleech tokens added to all enabled users' . (!isset($_REQUEST['leechdisabled']) ? ' with enabled leeching privs' : '') . '.</strong><br /><br />';
} elseif (isset($_REQUEST['cleartokens'])) {
authorize();
$Tokens = $_REQUEST['numtokens'];
if (!is_number($Tokens) || ($Tokens < 0)) { error("Please enter a valid number of tokens."); }
if (!is_number($Tokens) || ($Tokens < 0)) {
error('Please enter a valid number of tokens.');
}
if (isset($_REQUEST['onlydrop'])) {
$Where = "WHERE FLTokens > $Tokens";
@ -42,7 +48,7 @@
$Cache->delete_value('user_info_heavy_'.$UserID);
}
$where = "";
$where = '';
}
@ -55,26 +61,26 @@
<a href="tools.php?action=tokens&amp;showabusers=1" class="brackets">Show abusers</a>
</div>
</div>
<div class="box pad" style="margin-left: auto; margin-right: auto; text-align:center; max-width: 40%">
<div class="box pad" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
<?=$message?>
<form class="add_form" name="fltokens" action="" method="post">
<input type="hidden" name="action" value="tokens" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
Tokens to add: <input type="text" name="numtokens" size="5" style="text-align: right" value="0"><br /><br />
<label for="leechdisabled">Grant tokens to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1"><br /><br />
<input type="submit" name="addtokens" value="Add tokens">
Tokens to add: <input type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
<label for="leechdisabled">Grant tokens to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" /><br /><br />
<input type="submit" name="addtokens" value="Add tokens" />
</form>
</div>
<br />
<div class="box pad" style="margin-left: auto; margin-right: auto; text-align:center; max-width: 40%">
<div class="box pad" style="margin-left: auto; margin-right: auto; text-align: center; max-width: 40%;">
<?=$message?>
<form class="manage_form" name="fltokens" action="" method="post">
<input type="hidden" name="action" value="tokens" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
Tokens to set: <input type="text" name="numtokens" size="5" style="text-align: right" value="0"><br /><br />
<span id="droptokens" class=""><label for="onlydrop">Only affect users with at least this many tokens: </label><input type="checkbox" id="onlydrop" name="onlydrop" value="1" onchange="$('#disabled').toggle();return true;"></span><br />
<span id="disabled" class=""><label for="leechdisabled">Also add tokens (as needed) to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" onchange="$('#droptokens').toggle();return true;"></span><br /><br />
<input type="submit" name="cleartokens" value="Set token total">
Tokens to set: <input type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
<span id="droptokens" class=""><label for="onlydrop">Only affect users with at least this many tokens: </label><input type="checkbox" id="onlydrop" name="onlydrop" value="1" onchange="$('#disabled').toggle();return true;" /></span><br />
<span id="disabled" class=""><label for="leechdisabled">Also add tokens (as needed) to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" onchange="$('#droptokens').toggle();return true;" /></span><br /><br />
<input type="submit" name="cleartokens" value="Set token total" />
</form>
</div>
<?

View File

@ -44,7 +44,7 @@
<tr class="colhead"><td>Data</td></tr>
<?
if (check_perms('admin_donor_log')) { ?>
if (check_perms('admin_donor_log')) { ?>
<tr><td><a href="tools.php?action=donation_log">Donation log</a></td></tr>
<tr><td><a href="tools.php?action=bitcoin_balance">Bitcoin donation balance</a></td></tr>
<? } if (check_perms('users_view_ips') && check_perms('users_view_email')) { ?>
@ -73,7 +73,7 @@
<? if (check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=manipulate_tree">Manipulate tree</a></td></tr>
<? }
if (check_perms('admin_update_geoip')) { ?>
if (check_perms('admin_update_geoip')) { ?>
<tr><td><a href="tools.php?action=update_geoip">Update GeoIP </a></td></tr>
<? } if (check_perms('admin_create_users')) { ?>
<tr><td><a href="tools.php?action=create_user">Create user</a></td></tr>
@ -93,7 +93,7 @@
<tr><td><a href="tools.php?action=sandbox8">Sandbox (8)</a></td></tr>
<tr><td><a href="schedule.php?auth=<?=$LoggedUser['AuthKey']?>">Schedule</a></td></tr>
<? }?>
<? } ?>
<? if (check_perms('users_mod')) { ?>
<tr><td><strong><a href="tools.php?action=public_sandbox">Public sandbox</a></strong></td></tr>
<? } ?>

View File

@ -1,6 +1,10 @@
<?
if(!check_perms('users_mod')) { error(404); }
//if(!check_perms('site_top10_history')) { error(403); }
if (!check_perms('users_mod')) {
error(404);
}
// if (!check_perms('site_top10_history')) {
// error(403);
// }
View::show_header('Top 10 Torrents history!');
?>
<div class="thin">
@ -21,7 +25,7 @@
<table class="layout">
<tr>
<td class="label">Date:</td>
<td><input type="text" id="date" name="date" value="<?=!empty($_GET['date']) ? display_str($_GET['date']) : 'YYYY-MM-DD'?>" onfocus="if($('#date').raw().value == 'YYYY-MM-DD') $('#date').raw().value = ''" /></td>
<td><input type="text" id="date" name="date" value="<?=!empty($_GET['date']) ? display_str($_GET['date']) : 'YYYY-MM-DD'?>" onfocus="if ($('#date').raw().value == 'YYYY-MM-DD') $('#date').raw().value = ''" /></td>
</tr>
<tr>
<td class="label">Type:</td>
@ -39,14 +43,14 @@
</form>
</div>
<?
if(!empty($_GET['date'])) {
if (!empty($_GET['date'])) {
$Date = $_GET['date'];
$SQLTime = $Date." 00:00:00";
if(!validDate($SQLTime)) {
$SQLTime = $Date.' 00:00:00';
if (!validDate($SQLTime)) {
error('Something is wrong with the date you provided');
}
if(empty($_GET['datetype']) || $_GET['datetype'] == "day") {
if (empty($_GET['datetype']) || $_GET['datetype'] == 'day') {
$Type = 'day';
$Where = "WHERE th.Date BETWEEN '".$SQLTime."' AND '".$SQLTime."' + INTERVAL 24 HOUR AND Type='Daily'";
} else {
@ -55,7 +59,7 @@
}
$Details = $Cache->get_value('top10_history_'.$SQLTime);
if($Details === false) {
if ($Details === false) {
$DB->query("SELECT
tht.Rank,
tht.TitleString,
@ -93,12 +97,12 @@
<h3>Top 10 for <?=($Type == 'day' ? $Date : 'the first week after '.$Date)?></h3>
<table class="torrent_table cats numbering border">
<tr class="colhead">
<td class="center" style="width:15px;"></td>
<td class="center" style="width: 15px;"></td>
<td class="center"></td>
<td><strong>Name</strong></td>
</tr>
<?
foreach ($Details as $Detail) {
foreach ($Details as $Detail) :
list($Rank, $TitleString, $TagString, $TorrentID, $GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;
@ -106,48 +110,71 @@
// highlight every other row
$Highlight = ($Rank % 2 ? 'a' : 'b');
if($GroupID) {
if ($GroupID) :
//Group still exists
$DisplayName='';
$Artists = Artists::get_artist($GroupID);
if(!empty($Artists)) {
if (!empty($Artists)) {
$DisplayName = Artists::display_artists($Artists, true, true);
}
$DisplayName .= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID' title='View Torrent'>$GroupName</a>";
if($GroupCategoryID==1 && $GroupYear>0) {
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName.= " [$GroupYear]";
}
// append extra info to torrent title
$ExtraInfo='';
$AddExtra='';
if($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
"FLAC / Lossless / Log (100%) / Cue / CD";
if($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if($ExtraInfo!='') {
$ExtraInfo = '';
$AddExtra = '';
if ($Format) {
$ExtraInfo.=$Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.=$AddExtra.$Encoding;
$AddExtra = ' / ';
}
//"FLAC / Lossless / Log (100%) / Cue / CD";
if ($HasLog) {
$ExtraInfo.=$AddExtra."Log (".$LogScore."%)";
$AddExtra = ' / ';
}
if ($HasCue) {
$ExtraInfo.=$AddExtra."Cue";
$AddExtra = ' / ';
}
if ($Media) {
$ExtraInfo.=$AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.=$AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.=$AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.=$AddExtra.$RemasterTitle;
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
$DisplayName .= $ExtraInfo;
$TorrentTags = new Tags($TorrentTags);
} else {
$DisplayName = $TitleString." (Deleted)";
else:
$DisplayName = $TitleString.' (Deleted)';
$TorrentTags = new Tags($TagString);
}
endif;
?>
<tr class="group_torrent row<?=$Highlight?>">
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
<td style="padding: 8px; text-align: center;"><strong><?=$Rank?></strong></td>
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td>
<span><?=($GroupID ? '<a href="torrents.php?action=download&amp;id='.$TorrentID.'&amp;authkey='.$LoggedUser['AuthKey'].'&amp;torrent_pass='.$LoggedUser['torrent_pass'].' title="Download" class="brackets">DL</a>' : '(Deleted)')?></span>
@ -156,7 +183,7 @@
</td>
</tr>
<?
}
endforeach;
?>
</table><br />
</div>

View File

@ -12,6 +12,7 @@
die();
}
include(SERVER_ROOT.'/sections/torrents/functions.php'); //Has get_reports($TorrentID);
if(empty($_GET['type']) || $_GET['type'] == 'torrents') {
include(SERVER_ROOT.'/sections/top10/torrents.php');
} else {

View File

@ -33,8 +33,8 @@
} else {
// error out on invalid requests (before caching)
if(isset($_GET['details'])) {
if(in_array($_GET['details'], array('day','week','overall','snatched','data','seeded','month','year'))) {
if (isset($_GET['details'])) {
if (in_array($_GET['details'], array('day','week','overall','snatched','data','seeded','month','year'))) {
$Details = $_GET['details'];
} else {
error(404);
@ -62,7 +62,7 @@
</div>
<?
if(check_perms('site_advanced_top10')) {
if (check_perms('site_advanced_top10')) {
?>
<form class="search_form" name="torrents" action="" method="get">
<input type="hidden" name="advanced" value="1" />
@ -70,7 +70,7 @@
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td class="ft_taglist">
<input type="text" name="tags" size="75" value="<? if(!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="text" name="tags" size="75" value="<? if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall']!='any'?' checked="checked"':'')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall']=='any'?' checked="checked"':'')?> /><label for="rdoAny"> Any</label>
</td>
@ -81,7 +81,7 @@
<select name="format" style="width:auto;" class="ft_format">
<option value="">Any</option>
<? foreach ($Formats as $FormatName) { ?>
<option value="<?=display_str($FormatName)?>"<? if(isset($_GET['format']) && $FormatName==$_GET['format']) { ?> selected="selected"<? } ?>><?=display_str($FormatName)?></option>
<option value="<?=display_str($FormatName)?>"<? if (isset($_GET['format']) && $FormatName==$_GET['format']) { ?> selected="selected"<? } ?>><?=display_str($FormatName)?></option>
<? } ?> </select>
</td>
</tr>
@ -98,7 +98,7 @@
// default setting to have them shown
$DisableFreeTorrentTop10 = (isset($LoggedUser['DisableFreeTorrentTop10']) ? $LoggedUser['DisableFreeTorrentTop10'] : 0);
// did they just toggle it?
if(isset($_GET['freeleech'])) {
if (isset($_GET['freeleech'])) {
// what did they choose?
$NewPref = ($_GET['freeleech'] == 'hide') ? 1 : 0;
@ -161,7 +161,7 @@
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
if($Details=='all' || $Details=='day') {
if ($Details=='all' || $Details=='day') {
$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastDay === false) {
if ($Cache->get_query_lock('top10')) {
@ -182,7 +182,7 @@
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
}
if($Details=='all' || $Details=='week') {
if ($Details=='all' || $Details=='week') {
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastWeek === false) {
if ($Cache->get_query_lock('top10')) {
@ -204,7 +204,7 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
}
if($Details=='all' || $Details=='month') {
if ($Details=='all' || $Details=='month') {
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastMonth === false) {
if ($Cache->get_query_lock('top10')) {
@ -225,7 +225,7 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
}
if($Details=='all' || $Details=='year') {
if ($Details=='all' || $Details=='year') {
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastYear === false) {
if ($Cache->get_query_lock('top10')) {
@ -251,7 +251,7 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
}
if($Details=='all' || $Details=='overall') {
if ($Details=='all' || $Details=='overall') {
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum);
if ($TopTorrentsActiveAllTime === false) {
if ($Cache->get_query_lock('top10')) {
@ -276,7 +276,7 @@
generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
}
if(($Details=='all' || $Details=='snatched') && !$Filtered) {
if (($Details=='all' || $Details=='snatched') && !$Filtered) {
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum);
if ($TopTorrentsSnatched === false) {
if ($Cache->get_query_lock('top10')) {
@ -296,7 +296,7 @@
generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
}
if(($Details=='all' || $Details=='data') && !$Filtered) {
if (($Details=='all' || $Details=='data') && !$Filtered) {
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum);
if ($TopTorrentsTransferred === false) {
if ($Cache->get_query_lock('top10')) {
@ -320,7 +320,7 @@
generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
}
if(($Details=='all' || $Details=='seeded') && !$Filtered) {
if (($Details=='all' || $Details=='seeded') && !$Filtered) {
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum);
if ($TopTorrentsSeeded === false) {
if ($Cache->get_query_lock('top10')) {
@ -350,7 +350,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories,$ReleaseTypes;
?>
<h3>Top <?=$Limit.' '.$Caption?>
<? if(empty($_GET['advanced'])){ ?>
<? if (empty($_GET['advanced'])){ ?>
<small class="top10_quantity_links">
<?
switch($Limit) {
@ -415,7 +415,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
}
$Artists = Artists::get_artists($GroupIDs);
foreach ($Details as $Detail) {
foreach ($Details as $Detail) :
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TagsList,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;
@ -428,41 +428,48 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
$Highlight = ($Rank % 2 ? 'a' : 'b');
// generate torrent's title
$DisplayName='';
$DisplayName = '';
if(!empty($Artists[$GroupID])) {
if (!empty($Artists[$GroupID])) {
$DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
}
$DisplayName.= "<a href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
if($GroupCategoryID==1 && $GroupYear>0) {
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName.= " [$GroupYear]";
}
if($GroupCategoryID==1 && $ReleaseType > 0) {
if ($GroupCategoryID == 1 && $ReleaseType > 0) {
$DisplayName.= ' ['.$ReleaseTypes[$ReleaseType].']';
}
// append extra info to torrent title
$ExtraInfo='';
$AddExtra='';
if($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
if ($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if ($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
// "FLAC / Lossless / Log (100%) / Cue / CD";
if($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if($IsSnatched) { if($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo.= Format::torrent_label('Snatched!'); }
if($ExtraInfo!='') {
if ($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if ($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if ($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if ($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if ($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if ($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
if ($IsSnatched) { if ($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo.= Format::torrent_label('Snatched!'); }
if ($ExtraInfo!='') {
$ExtraInfo = "- [$ExtraInfo]";
}
$TorrentTags = new Tags($TagsList);
//Get report info, use the cache if available, if not, add to it.
$Reported = false;
$Reports = get_reports($TorrentID);
if (count($Reports) > 0) {
$Reported = true;
}
// print row
?>
<tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
@ -476,12 +483,12 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<? endif; ?>
<div class="group_info clear">
<span>[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]</span>
<span><a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a></span>
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
<span class="bookmark" style="float:right;">
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?><?if($Reported){?> - <strong class="torrent_label tl_reported" title="Reported">Reported</strong><?}?>
<span class="bookmark" style="float: right;">
<?
if($IsBookmarked) {
if ($IsBookmarked) {
?>
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<? } else { ?>
@ -492,15 +499,15 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
</div>
</td>
<td style="text-align:right" class="nobr"><?=Format::get_size($Size)?></td>
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
<td style="text-align:right"><?=number_format((double) $Snatched)?></td>
<td style="text-align:right"><?=number_format((double) $Seeders)?></td>
<td style="text-align:right"><?=number_format((double) $Leechers)?></td>
<td style="text-align:right"><?=number_format($Seeders+$Leechers)?></td>
<td style="text-align: right;" class="nobr"><?=Format::get_size($Size)?></td>
<td style="text-align: right;" class="nobr"><?=Format::get_size($Data)?></td>
<td style="text-align: right;"><?=number_format((double) $Snatched)?></td>
<td style="text-align: right;"><?=number_format((double) $Seeders)?></td>
<td style="text-align: right;"><?=number_format((double) $Leechers)?></td>
<td style="text-align: right;"><?=number_format($Seeders + $Leechers)?></td>
</tr>
<?
}
endforeach;
?>
</table><br />
<?

View File

@ -5,15 +5,15 @@
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
if(!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
if (!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
$Details = 'all';
$Limit = 25;
if($_GET['tags']) {
if ($_GET['tags']) {
$Tags = explode(',', str_replace(".","_",trim($_GET['tags'])));
foreach ($Tags as $Tag) {
$Tag = preg_replace('/[^a-z0-9_]/', '', $Tag);
if($Tag != '') {
if ($Tag != '') {
$Where[]="g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
}
}
@ -45,13 +45,13 @@
// Unlike the other top 10s, this query just gets some raw stats
// We'll need to do some fancy-pants stuff to translate it into
// BPCI scores before getting the torrent data
$Query = "SELECT v.GroupID, v.Ups, v.Total, v.Score
FROM torrents_votes AS v";
$Query = 'SELECT v.GroupID, v.Ups, v.Total, v.Score
FROM torrents_votes AS v';
if (!empty($Where)) {
$Query .= " JOIN torrents_group AS g ON g.ID = v.GroupID
WHERE $Where AND ";
} else {
$Query .= " WHERE ";
$Query .= ' WHERE ';
}
$Query .= "Score > 0 ORDER BY Score DESC LIMIT $Limit";
@ -94,7 +94,7 @@
</div>
<?
if(check_perms('site_advanced_top10')) { ?>
if (check_perms('site_advanced_top10')) { ?>
<form class="search_form" name="votes" action="" method="get">
<input type="hidden" name="advanced" value="1" />
<input type="hidden" name="type" value="votes" />
@ -102,17 +102,17 @@
<tr id="tagfilter">
<td class="label">Tags (comma-separated):</td>
<td class="ft_taglist">
<input type="text" name="tags" size="75" value="<? if(!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall']!='any'?' checked="checked"':'')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall']=='any'?' checked="checked"':'')?> /><label for="rdoAny"> Any</label>
<input type="text" name="tags" size="75" value="<? if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall'] != 'any' ? ' checked="checked"' : '')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall'] == 'any' ? ' checked="checked"' : '')?> /><label for="rdoAny"> Any</label>
</td>
</tr>
<tr id="yearfilter">
<td class="label">Year:</td>
<td class="ft_year">
<input type="text" name="year1" size="4" value="<? if(!empty($_GET['year1'])) { echo display_str($_GET['year1']);} ?>" />
<input type="text" name="year1" size="4" value="<? if (!empty($_GET['year1'])) { echo display_str($_GET['year1']);} ?>" />
to
<input type="text" name="year2" size="4" value="<? if(!empty($_GET['year2'])) { echo display_str($_GET['year2']);} ?>" />
<input type="text" name="year2" size="4" value="<? if (!empty($_GET['year2'])) { echo display_str($_GET['year2']);} ?>" />
</td>
</tr>
<tr>
@ -129,7 +129,7 @@
?>
<h3>Top <?=$Limit.' '.$Caption?>
<?
if(empty($_GET['advanced'])){ ?>
if (empty($_GET['advanced'])) { ?>
<small class="top10_quantity_links">
<?
switch($Limit) {
@ -137,12 +137,12 @@
- <a href="top10.php?type=votes" class="brackets">Top 25</a>
- <span class="brackets">Top 100</span>
- <a href="top10.php?type=votes&amp;limit=250" class="brackets">Top 250</a>
<? break;
<? break;
case 250: ?>
- <a href="top10.php?type=votes" class="brackets">Top 25</a>
- <a href="top10.php?type=votes&amp;limit=100" class="brackets">Top 100</a>
- <span class="brackets">Top 250</span>
<? break;
<? break;
default: ?>
- <span class="brackets">Top 25</span>
- <a href="top10.php?type=votes&amp;limit=100" class="brackets">Top 100</a>
@ -177,17 +177,21 @@
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif(count($GroupArtists)>0) {
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupYear > 0) {
$DisplayName = $DisplayName. " [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]';
}
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents) > 1 || $GroupCategoryID == 1) {
if (count($Torrents) > 1 || $GroupCategoryID == 1) :
// Grouped torrents
$GroupSnatched = false;
foreach ($Torrents as &$Torrent) {
@ -216,16 +220,16 @@
<div class="group_info clear">
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<? if($IsBookmarked) { ?>
<span class="bookmark" style="float:right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?>
<span class="bookmark" style="float:right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?>
<? if ($IsBookmarked) { ?>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<? } else { ?>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<? } ?>
<div class="tags"><?=$TorrentTags->format()?></div>
</div>
</td>
<td colspan="4" class="votes_info_td"><strong><?=number_format($Ups)?></strong> upvotes out of <strong><?=number_format($Total)?></strong> total (<span title="Score: <?=number_format($Score*100,4)?>">Score: <?=number_format($Score*100)?></span>).</td>
<td colspan="4" class="votes_info_td"><strong><?=number_format($Ups)?></strong> upvotes out of <strong><?=number_format($Total)?></strong> total (<span title="Score: <?=number_format($Score * 100,4)?>">Score: <?=number_format($Score * 100)?></span>).</td>
</tr>
<?
$LastRemasterYear = '-';
@ -237,13 +241,19 @@
$EditionID = 0;
unset($FirstUnknown);
foreach ($Torrents as $TorrentID => $Torrent) {
foreach ($Torrents as $TorrentID => $Torrent) :
//Get report info, use the cache if available, if not, add to it.
$Reported = false;
$Reports = get_reports($TorrentID);
if (count($Reports) > 0) {
$Reported = true;
}
if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
?>
@ -267,7 +277,7 @@
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
&nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
&nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?><?if($Reported){?> / <strong class="torrent_label tl_reported" title="Reported">Reported</strong><?}?></a>
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
@ -275,15 +285,15 @@
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
} else {
endforeach;
else:
// Viewing a type that does not require grouping
list($TorrentID, $Torrent) = each($Torrents);
$Torrent['IsSnatched'] = Torrents::has_snatched($TorrentID);
$DisplayName = $Number .' - <a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($Torrent['IsSnatched']) {
if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
}
if ($Torrent['FreeTorrent'] == '1') {
@ -291,7 +301,7 @@
} elseif ($Torrent['FreeTorrent'] == '2') {
$DisplayName .= ' ' . Format::torrent_label('Neutral leech!');
} elseif (Torrents::has_token($TorrentID)) {
$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
$DisplayName .= ' ' . Format::torrent_label('Personal freeleech!');
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
?>
@ -314,7 +324,7 @@
| <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;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="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
<? if($IsBookmarked) { ?>
<? if ($IsBookmarked) { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
<? } else { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
@ -330,8 +340,8 @@
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td>
</tr>
<?
}
<?
endif;
$TorrentTable.=ob_get_clean();
}
?>
@ -346,7 +356,7 @@
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
</tr>
<?
if($TorrentList === false) { ?>
if ($TorrentList === false) { ?>
<tr>
<td colspan="7" class="center">Server is busy processing another top list request. Please try again in a minute.</td>
</tr>

File diff suppressed because it is too large Load Diff

View File

@ -537,8 +537,8 @@ function header_link($SortKey,$DefaultWay="desc") {
$HideFilter = isset($LoggedUser['ShowTorFilter']) && $LoggedUser['ShowTorFilter'] == 0;
// This is kinda ugly, but the enormous if paragraph was really hard to read
$AdvancedSearch = !empty($_GET['action']) && $_GET['action'] == "advanced";
$AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] == "advanced");
$AdvancedSearch = !empty($_GET['action']) && $_GET['action'] == 'advanced';
$AdvancedSearch |= !empty($LoggedUser['SearchType']) && (empty($_GET['action']) || $_GET['action'] == 'advanced');
$AdvancedSearch &= check_perms('site_advanced_search');
if ($AdvancedSearch) {
$Action = 'action=advanced';
@ -647,24 +647,24 @@ function header_link($SortKey,$DefaultWay="desc") {
<select id="bitrate" name="encoding" class="ft_bitrate fti_advanced">
<option value="">Bitrate</option>
<? foreach ($Bitrates as $BitrateName) { ?>
<option value="<?=display_str($BitrateName); ?>" <?Format::selected('encoding', $BitrateName)?>><?=display_str($BitrateName); ?></option>
<option value="<?=display_str($BitrateName); ?>"<?Format::selected('encoding', $BitrateName)?>><?=display_str($BitrateName); ?></option>
<? } ?> </select>
<select name="format" class="ft_format fti_advanced">
<option value="">Format</option>
<? foreach ($Formats as $FormatName) { ?>
<option value="<?=display_str($FormatName); ?>" <?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option>
<option value="<?=display_str($FormatName); ?>"<?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option>
<? } ?> </select>
<select name="media" class="ft_media fti_advanced">
<option value="">Media</option>
<? foreach ($Media as $MediaName) { ?>
<option value="<?=display_str($MediaName); ?>" <?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option>
<option value="<?=display_str($MediaName); ?>"<?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option>
<? } ?>
</select>
<select name="releasetype" class="ft_releasetype fti_advanced">
<option value="">Release type</option>
<? foreach ($ReleaseTypes as $ID=>$Type) { ?>
<option value="<?=display_str($ID); ?>" <?Format::selected('releasetype',$ID)?>><?=display_str($Type); ?></option>
<option value="<?=display_str($ID); ?>"<?Format::selected('releasetype',$ID)?>><?=display_str($Type); ?></option>
<? } ?>
</select>
</td>
@ -674,32 +674,32 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="nobr ft_misc" colspan="3">
<select name="haslog" class="ft_haslog fti_advanced">
<option value="">Has Log</option>
<option value="1" <?Format::selected('haslog','1')?>>Yes</option>
<option value="0" <?Format::selected('haslog','0')?>>No</option>
<option value="100" <?Format::selected('haslog','100')?>>100% only</option>
<option value="-1" <?Format::selected('haslog','-1')?>>&lt;100%/Unscored</option>
<option value="1"<?Format::selected('haslog','1')?>>Yes</option>
<option value="0"<?Format::selected('haslog','0')?>>No</option>
<option value="100"<?Format::selected('haslog','100')?>>100% only</option>
<option value="-1"<?Format::selected('haslog','-1')?>>&lt;100%/Unscored</option>
</select>
<select name="hascue" class="ft_hascue fti_advanced">
<option value="">Has Cue</option>
<option value="1" <?Format::selected('hascue',1)?>>Yes</option>
<option value="0" <?Format::selected('hascue',0)?>>No</option>
<option value="1"<?Format::selected('hascue',1)?>>Yes</option>
<option value="0"<?Format::selected('hascue',0)?>>No</option>
</select>
<select name="scene" class="ft_scene fti_advanced">
<option value="">Scene</option>
<option value="1" <?Format::selected('scene',1)?>>Yes</option>
<option value="0" <?Format::selected('scene',0)?>>No</option>
<option value="1"<?Format::selected('scene',1)?>>Yes</option>
<option value="0"<?Format::selected('scene',0)?>>No</option>
</select>
<select name="vanityhouse" class="ft_vanityhouse fti_advanced">
<option value="">Vanity House</option>
<option value="1" <?Format::selected('vanityhouse',1)?>>Yes</option>
<option value="0" <?Format::selected('vanityhouse',0)?>>No</option>
<option value="1"<?Format::selected('vanityhouse',1)?>>Yes</option>
<option value="0"<?Format::selected('vanityhouse',0)?>>No</option>
</select>
<select name="freetorrent" class="ft_freetorrent fti_advanced">
<option value="">Leech Status</option>
<option value="1" <?Format::selected('freetorrent',1)?>>Freeleech</option>
<option value="2" <?Format::selected('freetorrent',2)?>>Neutral Leech</option>
<option value="3" <?Format::selected('freetorrent',3)?>>Either</option>
<option value="0" <?Format::selected('freetorrent',0)?>>Normal</option>
<option value="1"<?Format::selected('freetorrent',1)?>>Freeleech</option>
<option value="2"<?Format::selected('freetorrent',2)?>>Neutral Leech</option>
<option value="3"<?Format::selected('freetorrent',3)?>>Either</option>
<option value="0"<?Format::selected('freetorrent',0)?>>Normal</option>
</select>
</td>
</tr>
@ -713,13 +713,13 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="label">Tags (comma-separated):</td>
<td colspan="3" class="ft_taglist">
<input type="text" size="40" id="tags" name="taglist" class="inputtext smaller" title="Use !tag to exclude tag" value="<?=str_replace('_','.',Format::form('taglist', true))?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0" <?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1" <?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td>
</tr>
<tr id="order">
<td class="label">Order by:</td>
<td colspan="3" colspan="3" class="ft_order">
<td colspan="3" class="ft_order">
<select name="order_by" style="width:auto;" class="ft_order_by">
<option value="time"<?Format::selected('order_by','time')?>>Time added</option>
<option value="year"<?Format::selected('order_by','year')?>>Year</option>
@ -731,7 +731,7 @@ function header_link($SortKey,$DefaultWay="desc") {
</select>
<select name="order_way" class="ft_order_way">
<option value="desc"<?Format::selected('order_way','desc')?>>Descending</option>
<option value="asc" <?Format::selected('order_way','asc')?>>Ascending</option>
<option value="asc"<?Format::selected('order_way','asc')?>>Ascending</option>
</select>
</td>
</tr>
@ -740,16 +740,16 @@ function header_link($SortKey,$DefaultWay="desc") {
<label for="group_results">Group by release:</label>
</td>
<td colspan="3" class="ft_group_results">
<input type="checkbox" value="1" name="group_results" id="group_results" <?Format::selected('group_results',1,'checked')?> />
<input type="checkbox" value="1" name="group_results" id="group_results"<?Format::selected('group_results',1,'checked')?> />
</td>
</tr>
</table>
<table class="layout cat_list ft_cat_list">
<?
$x=0;
$x = 0;
reset($Categories);
foreach ($Categories as $CatKey => $CatName) {
if ($x%7==0) {
if ($x % 7 == 0) {
if ($x > 0) {
?>
</tr>
@ -760,8 +760,8 @@ function header_link($SortKey,$DefaultWay="desc") {
$x++;
?>
<td>
<input type="checkbox" name="filter_cat[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1" <? if (isset($_GET['filter_cat'][$CatKey+1])) { ?>checked="checked" <? } ?>/>
<label for="cat_<?=($CatKey+1)?>"><?=$CatName?></label>
<input type="checkbox" name="filter_cat[<?=($CatKey + 1) ?>]" id="cat_<?=($CatKey + 1) ?>" value="1"<? if (isset($_GET['filter_cat'][$CatKey + 1])) { ?> checked="checked" <? } ?>/>
<label for="cat_<?=($CatKey + 1) ?>"><?=$CatName?></label>
</td>
<?
}
@ -775,7 +775,7 @@ function header_link($SortKey,$DefaultWay="desc") {
if (!$GenreTags) {
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name');
$GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
}
$x = 0;
@ -784,41 +784,41 @@ function header_link($SortKey,$DefaultWay="desc") {
<td width="12.5%"><a href="#" onclick="add_tag('<?=$Tag?>');return false;"><?=$Tag?></a></td>
<?
$x++;
if ($x%7==0) {
if ($x % 7 == 0) {
?>
</tr>
<tr>
<?
}
}
if ($x%7!=0) { // Padding
if ($x % 7 != 0) { // Padding
?>
<td colspan="<?=7-($x%7)?>"> </td>
<td colspan="<?=7 - ($x % 7) ?>"> </td>
<? } ?>
</tr>
</table>
<table class="layout cat_list" width="100%">
<tr>
<td class="label">
<a class="brackets" href="#" onclick="$('#taglist').toggle(); if (this.innerHTML=='View tags'){this.innerHTML='Hide tags';} else {this.innerHTML='View tags';}; return false;"><?=(empty($LoggedUser['ShowTags'])) ? 'View tags' : 'Hide tags'?></a>
<a class="brackets" href="#" onclick="$('#taglist').toggle(); if (this.innerHTML=='View tags') {this.innerHTML='Hide tags';} else {this.innerHTML='View tags';}; return false;"><?=(empty($LoggedUser['ShowTags'])) ? 'View tags' : 'Hide tags'?></a>
</td>
</tr>
</table>
<div class="submit ft_submit">
<span style="float:left;"><?=number_format($TorrentCount)?> Results</span>
<input type="submit" value="Filter Torrents" />
<span style="float: left;"><?=number_format($TorrentCount)?> Results</span>
<input type="submit" value="Filter torrents" />
<input type="hidden" name="action" id="ft_type" value="<?=$AdvancedSearch ? 'advanced' : 'basic'?>" />
<input type="hidden" name="searchsubmit" value="1" />
<input type="button" value="Reset" onclick="location.href='torrents.php<? if (isset($_GET['action']) && $_GET['action']=="advanced") { ?>?action=advanced<? } ?>'" />
<input type="button" value="Reset" onclick="location.href='torrents.php<? if (isset($_GET['action']) && $_GET['action'] == 'advanced') { ?>?action=advanced<? } ?>'" />
&nbsp;&nbsp;
<? if ($Filtered) { ?>
<input type="submit" name="setdefault" value="Make Default" />
<input type="submit" name="setdefault" value="Make default" />
<?
}
}
if (!empty($LoggedUser['DefaultSearch'])) {
if (!empty($LoggedUser['DefaultSearch'])) {
?>
<input type="submit" name="cleardefault" value="Clear Default" />
<input type="submit" name="cleardefault" value="Clear default" />
<? } ?>
</div>
</div>
@ -847,20 +847,20 @@ function header_link($SortKey,$DefaultWay="desc") {
<div class="box pad" align="center">
<h2>Your search did not match anything.</h2>
<p>Make sure all names are spelled correctly, or try making your search less specific.</p>
<p>You might like (Beta): <? while (list($Tag)=$DB->next_record()) { ?><a href="torrents.php?taglist=<?=$Tag?>"><?=$Tag?></a> <? } ?></p>
<p>You might like (beta): <? while (list($Tag) = $DB->next_record()) { ?><a href="torrents.php?taglist=<?=$Tag?>"><?=$Tag?></a><? } ?></p>
</div>
</div>
<?
View::show_footer();die();
}
if ($TorrentCount < ($Page-1)*TORRENTS_PER_PAGE+1) {
$LastPage = ceil($TorrentCount/TORRENTS_PER_PAGE);
if ($TorrentCount < ($Page - 1) * TORRENTS_PER_PAGE + 1) {
$LastPage = ceil($TorrentCount / TORRENTS_PER_PAGE);
$Pages = Format::get_pages(0, $TorrentCount, TORRENTS_PER_PAGE);
?>
<div class="box pad" align="center">
<h2>The requested page contains no matches.</h2>
<p>You are requesting page <?=$Page?>, but the search returned only <?=$LastPage?> pages.</p>
<p>You are requesting page <?=$Page?>, but the search returned only <?=number_format($LastPage) ?> pages.</p>
</div>
<div class="linkbox">Go to page <?=$Pages?></div>
</div>
@ -937,7 +937,7 @@ function header_link($SortKey,$DefaultWay="desc") {
// These torrents are in a group
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]';
@ -998,12 +998,19 @@ function header_link($SortKey,$DefaultWay="desc") {
continue;
}
//Get report info for each torrent, use the cache if available, if not, add to it.
$Reported = false;
$Reports = get_reports($TorrentID);
if (count($Reports) > 0) {
$Reported = true;
}
if ($Data['Remastered'] && !$Data['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown);
}
$SnatchedTorrentClass = $Data['IsSnatched'] ? ' snatched_torrent' : '';
if (isset($GroupedCategories[$CategoryID-1])
if (isset($GroupedCategories[$CategoryID - 1])
&& ($Data['RemasterTitle'] != $LastRemasterTitle
|| $Data['RemasterYear'] != $LastRemasterYear
|| $Data['RemasterRecordLabel'] != $LastRemasterRecordLabel
@ -1024,7 +1031,7 @@ function header_link($SortKey,$DefaultWay="desc") {
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber'];
$LastMedia = $Data['Media'];
?>
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1 ? ' hidden' : '')?>">
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<td colspan="3">
<span>
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Data['HasFile'] ? 'DL' : 'Missing'?></a>
@ -1033,13 +1040,13 @@ function header_link($SortKey,$DefaultWay="desc") {
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
&raquo; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Data)?></a>
&raquo; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Data)?><?if($Reported){?> / <strong class="torrent_label tl_reported" title="Reported">Reported</strong><?}?></a>
</td>
<td><?=$Data['FileCount']?></td>
<td class="nobr"><?=time_diff($Data['Time'], 1)?></td>
<td class="nobr"><?=Format::get_size($Data['Size'])?></td>
<td><?=number_format($Data['Snatched'])?></td>
<td<?=($Data['Seeders']==0)?' class="r00"':''?>><?=number_format($Data['Seeders'])?></td>
<td<?=($Data['Seeders'] == 0) ? ' class="r00"' : ''?>><?=number_format($Data['Seeders'])?></td>
<td><?=number_format($Data['Leechers'])?></td>
</tr>
<?
@ -1049,9 +1056,9 @@ function header_link($SortKey,$DefaultWay="desc") {
list($TorrentID, $Data) = each($Torrents);
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'#torrent'.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if (isset($GroupedCategories[$CategoryID-1])) {
if (isset($GroupedCategories[$CategoryID - 1])) {
if ($GroupYear) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($CategoryID == 1 && $ReleaseType > 0) {
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
@ -1094,7 +1101,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="nobr"><?=time_diff($Data['Time'],1)?></td>
<td class="nobr"><?=Format::get_size($Data['Size'])?></td>
<td><?=number_format($Data['Snatched'])?></td>
<td<?=($Data['Seeders']==0)?' class="r00"':''?>><?=number_format($Data['Seeders'])?></td>
<td<?=($Data['Seeders'] == 0) ? ' class="r00"' : ''?>><?=number_format($Data['Seeders'])?></td>
<td><?=number_format($Data['Leechers'])?></td>
</tr>
<?

View File

@ -30,9 +30,9 @@ function compare($X, $Y) {
$GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs,
$TagPositiveVotes, $TagNegativeVotes, $GroupFlags) = array_values($TorrentDetails);
$DisplayName=$GroupName;
$AltName=$GroupName; // Goes in the alt text of the image
$Title=$GroupName; // goes in <title>
$DisplayName = $GroupName;
$AltName = $GroupName; // Goes in the alt text of the image
$Title = $GroupName; // goes in <title>
$WikiBody = $Text->full_format($WikiBody);
$Artists = Artists::get_artist($GroupID);
@ -44,11 +44,11 @@ function compare($X, $Y) {
}
if ($GroupYear > 0) {
$DisplayName.=' ['.$GroupYear.']';
$AltName.=' ['.$GroupYear.']';
$Title.= ' ['.$GroupYear.']';
$DisplayName.= " [$GroupYear]";
$AltName.= " [$GroupYear]";
$Title.= " [$GroupYear]";
}
if ($GroupVanityHouse){
if ($GroupVanityHouse) {
$DisplayName.=' [Vanity House]';
$AltName.=' [Vanity House]';
}
@ -59,17 +59,17 @@ function compare($X, $Y) {
$Tags = array();
if ($TorrentTags != '') {
$TorrentTags=explode('|',$TorrentTags);
$TorrentTagIDs=explode('|',$TorrentTagIDs);
$TorrentTagUserIDs=explode('|',$TorrentTagUserIDs);
$TagPositiveVotes=explode('|',$TagPositiveVotes);
$TagNegativeVotes=explode('|',$TagNegativeVotes);
$TorrentTags = explode('|',$TorrentTags);
$TorrentTagIDs = explode('|',$TorrentTagIDs);
$TorrentTagUserIDs = explode('|',$TorrentTagUserIDs);
$TagPositiveVotes = explode('|',$TagPositiveVotes);
$TagNegativeVotes = explode('|',$TagNegativeVotes);
foreach ($TorrentTags as $TagKey => $TagName) {
$Tags[$TagKey]['name'] = $TagName;
$Tags[$TagKey]['score'] = ($TagPositiveVotes[$TagKey] - $TagNegativeVotes[$TagKey]);
$Tags[$TagKey]['id']=$TorrentTagIDs[$TagKey];
$Tags[$TagKey]['userid']=$TorrentTagUserIDs[$TagKey];
$Tags[$TagKey]['id'] = $TorrentTagIDs[$TagKey];
$Tags[$TagKey]['userid'] = $TorrentTagUserIDs[$TagKey];
}
uasort($Tags, 'compare');
}
@ -93,7 +93,7 @@ function compare($X, $Y) {
<? } ?>
<a href="torrents.php?action=history&amp;groupid=<?=$GroupID?>" class="brackets">View history</a>
<? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
<a href="/torrents.php?action=revert&amp;groupid=<?=$GroupID ?>&amp;revisionid=<?=$RevisionID ?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
<a href="torrents.php?action=revert&amp;groupid=<?=$GroupID ?>&amp;revisionid=<?=$RevisionID ?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
<? }
if (Bookmarks::has_bookmarked('torrent', $GroupID)) {
?>
@ -118,7 +118,7 @@ function compare($X, $Y) {
<div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated -->
<div class="head"><strong>Cover</strong></div>
<?
if ($WikiImage != "") {
if ($WikiImage != '') {
$WikiImageThumb = ImageTools::wiki_image($WikiImage);
if (check_perms('site_proxy_images')) {
$WikiImage = ImageTools::proxy_url($WikiImage);
@ -128,18 +128,18 @@ function compare($X, $Y) {
<?
} else {
?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID-1]?>" alt="<?=$Categories[$GroupCategoryID-1]?>" title="<?=$Categories[$GroupCategoryID-1]?>" width="220" height="220" border="0" /></p>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID - 1]?>" alt="<?=$Categories[$GroupCategoryID - 1]?>" title="<?=$Categories[$GroupCategoryID - 1]?>" width="220" height="220" border="0" /></p>
<?
}
?>
</div>
<?
if ($Categories[$GroupCategoryID-1] == 'Music') {
if ($Categories[$GroupCategoryID - 1] == 'Music') {
$ShownWith = false;
?>
<div class="box box_artists">
<div class="head"><strong>Artists</strong>
<?=(check_perms('torrents_edit')) ? '<span style="float:right;" class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets">Edit</a></span>' : ''?>
<?=(check_perms('torrents_edit')) ? '<span style="float: right;" class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets">Edit</a></span>' : ''?>
</div>
<ul class="stats nobullet" id="artist_list">
<? if (!empty($Artists[4]) && count($Artists[4]) > 0) {

View File

@ -176,3 +176,302 @@ function get_group_requests($GroupID) {
$Requests = Requests::get_requests($Requests);
return $Requests['matches'];
}
//Used to get reports info on a unison cache in both browsing pages and torrent pages.
function get_reports($TorrentID){
global $Cache, $DB;
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
if ($Reports === false) {
$DB->query("SELECT r.ID,
r.ReporterID,
r.Type,
r.UserComment,
r.ReportedTime
FROM reportsv2 AS r
WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'");
$Reports = $DB->to_array();
$Cache->cache_value('reports_torrent_' . $TorrentID, $Reports, 0);
}
return $Reports;
}
//Used by both sections/torrents/details.php and sections/reportsv2/report.php
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Text, $Username, $ReportedTimes) {
function filelist($Str) {
return "</td><td>" . Format::get_size($Str[1]) . "</td></tr>";
}
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$EditionID = 0;
foreach ($TorrentList as $Torrent) {
//t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear,
//t.RemasterTitle, t.RemasterRecordLabel, t.RemasterCatalogueNumber, t.Scene,
//t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers,
//t.Snatched, t.FreeTorrent, t.Time, t.Description, t.FileList,
//t.FilePath, t.UserID, t.last_action, HEX(t.info_hash), (bad tags), (bad folders), (bad filenames),
//(cassette approved), (lossy master approved), (lossy web approved), t.LastReseedRequest,
//LogInDB, (has file), Torrents::torrent_properties()
list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear,
$RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, $Scene,
$HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers,
$Snatched, $FreeTorrent, $TorrentTime, $Description, $FileList,
$FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
$CassetteApproved, $LossymasterApproved, $LossywebApproved, $LastReseedRequest,
$LogInDB, $HasFile, $PersonalFL, $IsSnatched) = array_values($Torrent);
if ($Remastered && !$RemasterYear) {
$FirstUnknown = !isset($FirstUnknown);
}
$Reported = false;
unset($ReportedTimes);
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
if ($Reports === false) {
$DB->query("SELECT r.ID,
r.ReporterID,
r.Type,
r.UserComment,
r.ReportedTime
FROM reportsv2 AS r
WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'");
$Reports = $DB->to_array();
$Cache->cache_value('reports_torrent_' . $TorrentID, $Reports, 0);
}
if (count($Reports) > 0) {
$Reported = true;
include(SERVER_ROOT . '/sections/reportsv2/array.php');
$ReportInfo = '<table><tr class="colhead_dark" style="font-weight: bold;"><td>This torrent has ' . count($Reports) . ' active ' . (count($Reports) > 1 ? "reports" : "report") . ':</td></tr>';
foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) {
$ReportType = $Types[$GroupCategoryID][$ReportType];
} else if (array_key_exists($ReportType, $Types['master'])) {
$ReportType = $Types['master'][$ReportType];
} else {
//There was a type but it wasn't an option!
$ReportType = $Types['master']['other'];
}
$ReportInfo .= "<tr><td>" . (check_perms('admin_reports') ? "<a href='user.php?id=$ReporterID'>$ReporterName</a> <a href='reportsv2.php?view=report&amp;id=$ReportID'>reported it</a> " : "Someone reported it ") . time_diff($ReportedTime, 2, true, true) . " for the reason '" . $ReportType['title'] . "':";
$ReportInfo .= "<blockquote>" . $Text->full_format($ReportReason) . "</blockquote></td></tr>";
}
$ReportInfo .= "</table>";
}
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
$RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid=' . $TorrentID . '" class="brackets">Regenerate</a>' : '';
$FileTable = '
<table class="filelist_table">
<tr class="colhead_dark"><td>
<div class="filelist_title" style="float: left;">File Name' . $RegenLink . '</div>
<div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
</td><td>
<strong>Size</strong>
</td></tr>';
if (substr($FileList, -3) == '}}}') { // Old style
$FileListSplit = explode('|||', $FileList);
foreach ($FileListSplit as $File) {
$NameEnd = strrpos($File, '{{{');
$Name = substr($File, 0, $NameEnd);
if ($Spaces = strspn($Name, ' ')) {
$Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
}
$FileSize = substr($File, $NameEnd + 3, -3);
$FileTable .= sprintf("\n<tr><td>%s</td><td>%s</td></tr>", $Name, Format::get_size($FileSize));
}
} else {
$FileListSplit = explode("\n", $FileList);
foreach ($FileListSplit as $File) {
$FileInfo = Torrents::filelist_get_file($File);
$FileTable .= sprintf("\n<tr><td>%s</td><td>%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
}
}
$FileTable .= '
</table>';
$ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
$AddExtra = ''; // Separator between torrent properties
$TorrentUploader = $Username; // Save this for "Uploaded by:" below
// similar to Torrents::torrent_info()
if ($Format) {
$ExtraInfo.=display_str($Format);
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.=$AddExtra . display_str($Encoding);
$AddExtra = ' / ';
}
if ($HasLog) {
$ExtraInfo.=$AddExtra . 'Log';
$AddExtra = ' / ';
}
if ($HasLog && $LogInDB) {
$ExtraInfo.=' (' . (int) $LogScore . '%)';
}
if ($HasCue) {
$ExtraInfo.=$AddExtra . 'Cue';
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.=$AddExtra . 'Scene';
$AddExtra = ' / ';
}
if (!$ExtraInfo) {
$ExtraInfo = $GroupName;
$AddExtra = ' / ';
}
if ($IsSnatched) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Snatched!');
$AddExtra = ' / ';
}
if ($FreeTorrent == '1') {
$ExtraInfo.=$AddExtra . Format::torrent_label('Freeleech!');
$AddExtra = ' / ';
}
if ($FreeTorrent == '2') {
$ExtraInfo.=$AddExtra . Format::torrent_label('Neutral Leech!');
$AddExtra = ' / ';
}
if ($PersonalFL) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Personal Freeleech!');
$AddExtra = ' / ';
}
if ($Reported) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Reported');
$AddExtra = ' / ';
}
if (!empty($BadTags)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Bad Tags');
$AddExtra = ' / ';
}
if (!empty($BadFolders)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Bad Folders');
$AddExtra = ' / ';
}
if (!empty($CassetteApproved)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Cassette Approved');
$AddExtra = ' / ';
}
if (!empty($LossymasterApproved)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Lossy Master Approved');
$AddExtra = ' / ';
}
if (!empty($LossywebApproved)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Lossy WEB Approved');
$AddExtra = ' / ';
}
if (!empty($BadFiles)) {
$ExtraInfo.=$AddExtra . Format::torrent_label('Bad File Names');
$AddExtra = ' / ';
}
if ($GroupCategoryID == 1
&& ($RemasterTitle != $LastRemasterTitle
|| $RemasterYear != $LastRemasterYear
|| $RemasterRecordLabel != $LastRemasterRecordLabel
|| $RemasterCatalogueNumber != $LastRemasterCatalogueNumber
|| $FirstUnknown
|| $Media != $LastMedia)) {
$EditionID++;
?>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?= $GroupID ?>, <?= $EditionID ?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
</tr>
<?
}
$LastRemasterTitle = $RemasterTitle;
$LastRemasterYear = $RemasterYear;
$LastRemasterRecordLabel = $RemasterRecordLabel;
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media;
?>
<tr class="torrent_row releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> group_torrent<?= $IsSnatched ? ' snatched_torrent' : '' ?>" style="font-weight: normal;" id="torrent<?= $TorrentID ?>">
<td>
<span>[ <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>" title="Download"><?= $HasFile ? 'DL' : 'Missing' ?></a>
<? if (Torrents::can_use_token($Torrent)) { ?>
| <a href="torrents.php?action=download&amp;id=<?= $TorrentID ?>&amp;authkey=<?= $LoggedUser['AuthKey'] ?>&amp;torrent_pass=<?= $LoggedUser['torrent_pass'] ?>&amp;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="reportsv2.php?action=report&amp;id=<?= $TorrentID ?>" title="Report">RP</a>
<? if ($CanEdit) { ?>
| <a href="torrents.php?action=edit&amp;id=<?= $TorrentID ?>" title="Edit">ED</a>
<? } ?>
<? if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| <a href="torrents.php?action=delete&amp;torrentid=<?= $TorrentID ?>" title="Remove">RM</a>
<? } ?>
| <a href="torrents.php?torrentid=<?= $TorrentID ?>" title="Permalink">PL</a>
]</span>
&raquo; <a href="#" onclick="$('#torrent_<?= $TorrentID ?>').toggle(); return false;"><?= $ExtraInfo; ?></a>
</td>
<td class="nobr"><?= Format::get_size($Size) ?></td>
<td><?= number_format($Snatched) ?></td>
<td><?= number_format($Seeders) ?></td>
<td><?= number_format($Leechers) ?></td>
</tr>
<tr class="releases_<?= $ReleaseType ?> groupid_<?= $GroupID ?> edition_<?= $EditionID ?> torrentdetails pad <? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?>hidden<? } ?>" id="torrent_<?= $TorrentID; ?>">
<td colspan="5">
<blockquote>
Uploaded by <?= Users::format_username($UserID, false, false, false) ?> <?= time_diff($TorrentTime); ?>
<? if ($Seeders == 0) { ?>
<? if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
<br /><strong>Last active: <?= time_diff($LastActive); ?></strong>
<? } else { ?>
<br />Last active: <?= time_diff($LastActive); ?>
<? } ?>
<? if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?= $TorrentID ?>&amp;groupid=<?= $GroupID ?>" class="brackets">Request re-seed</a>
<? } ?>
<? } ?>
</blockquote>
<? if (check_perms('site_moderate_requests')) { ?>
<div class="linkbox">
<a href="torrents.php?action=masspm&amp;id=<?= $GroupID ?>&amp;torrentid=<?= $TorrentID ?>" class="brackets">Mass PM snatchers</a>
</div>
<? } ?>
<div class="linkbox">
<a href="#" class="brackets" onclick="show_peers('<?= $TorrentID ?>', 0);return false;">View peer list</a>
<? if (check_perms('site_view_torrent_snatchlist')) { ?>
<a href="#" class="brackets" onclick="show_downloads('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets" onclick="show_snatches('<?= $TorrentID ?>', 0);return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<? } ?>
<a href="#" class="brackets" onclick="show_files('<?= $TorrentID ?>');return false;">View file list</a>
<? if ($Reported) { ?>
<a href="#" class="brackets" onclick="show_reported('<?= $TorrentID ?>');return false;">View report information</a>
<? } ?>
</div>
<div id="peers_<?= $TorrentID ?>" class="hidden"></div>
<div id="downloads_<?= $TorrentID ?>" class="hidden"></div>
<div id="snatches_<?= $TorrentID ?>" class="hidden"></div>
<div id="files_<?= $TorrentID ?>" class="hidden"><?= $FileTable ?></div>
<? if ($Reported) { ?>
<div id="reported_<?= $TorrentID ?>" class="hidden"><?= $ReportInfo ?></div>
<? } ?>
<?
if (!empty($Description)) {
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';
}
?>
</td>
</tr>
<?
}
}

View File

@ -17,21 +17,21 @@
if ($UserInfo['Class'] > $LoggedUser['Class']) {
error(403);
}
$URL = "https://" . SSL_SITE_URL . "/torrents.php?id=$GroupID&postid=$PostID#post$PostID";
$URL = 'https://' . SSL_SITE_URL . "/torrents.php?id=$GroupID&postid=$PostID#post$PostID";
if ($Length != 'verbal') {
$Time = ((int) $Length) * (7 * 24 * 60 * 60);
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;
$WarnTime = time_plus($Time);
$AdminComment = date("Y-m-d") . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} else {
$Subject = "You have received a verbal warning";
$Subject = 'You have received a verbal warning';
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
}
$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)");
Tools::update_user_notes($UserID, $AdminComment);
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
@ -46,12 +46,14 @@
WHERE tc.ID='$PostID'");
list($OldBody, $AuthorID, $GroupID, $AddedTime) = $DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $PostID");
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
FROM torrents_comments
WHERE GroupID = $GroupID AND ID <= $PostID");
list($Page) = $DB->next_record();
// Perform the update
$DB->query("UPDATE torrents_comments SET
Body = '" . db_string($Body) . "',
$DB->query("UPDATE torrents_comments
SET Body = '" . db_string($Body) . "',
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
EditedTime = '" . sqltime() . "'
WHERE ID='$PostID'");
@ -65,8 +67,7 @@
$Cache->commit_transaction(0);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('torrents', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody)
. "')");
VALUES ('torrents', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
header("Location: torrents.php?id=$GroupID&postid=$PostID#post$PostID");
?>

View File

@ -4,19 +4,19 @@
$Rankings = Votes::get_ranking($GroupID, $GroupYear);
$LIs = '';
// Display information for the return categories of get_ranking()
$GroupDecade = $GroupYear-($GroupYear%10);
$GroupDecade = $GroupYear - ($GroupYear % 10);
$names = array('overall'=>'<a href="top10.php?type=votes">overall</a>',
'decade'=>check_perms('site_advanced_top10') ? 'for the <a href="top10.php?advanced=1&type=votes&year1='.$GroupDecade.'&year2='.($GroupDecade+9).'">'.$GroupDecade.'s</a>' : 'for the '.$GroupDecade.'s',
'year'=>check_perms('site_advanced_top10') ? 'for <a href="top10.php?advanced=1&type=votes&year1='.$GroupYear.'&year2=">'.$GroupYear.'</a>' : "for $GroupYear");
'decade'=>check_perms('site_advanced_top10') ? 'for the <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupDecade.'&amp;year2='.($GroupDecade+9).'">'.$GroupDecade.'s</a>' : 'for the '.$GroupDecade.'s',
'year'=>check_perms('site_advanced_top10') ? 'for <a href="top10.php?advanced=1&amp;type=votes&amp;year1='.$GroupYear.'&amp;year2=">'.$GroupYear.'</a>' : "for $GroupYear");
foreach ($names as $key => $text) {
if ($Rank = $Rankings[$key]) {
if ($Rank <= 10) {
$Class = "vr_top_10";
$Class = 'vr_top_10';
} elseif ($Rank <= 25) {
$Class = "vr_top_25";
$Class = 'vr_top_25';
} elseif ($Rank <= 50) {
$Class = "vr_top_50";
$Class = 'vr_top_50';
}
$LIs .= '<li id="vote_rank_'.$key.'" class="'.$Class.'">No. '.$Rank.' '.$text.'</li>';

View File

@ -2,7 +2,10 @@
// These stats used to be all together in one UNION'd query
// But we broke them up because they had a habit of locking each other to death.
// They all run really quickly anyways.
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'");
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid)
FROM xbt_snatched AS x
INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID'");
list($Snatched, $UniqueSnatched) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'");
@ -17,51 +20,65 @@
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
list($NumCollages) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT CollageID) FROM collages_torrents AS ct JOIN collages ON CollageID = ID WHERE Deleted='0' AND ct.UserID='$UserID'");
$DB->query("SELECT COUNT(DISTINCT CollageID)
FROM collages_torrents AS ct
JOIN collages ON CollageID = ID
WHERE Deleted='0' AND ct.UserID='$UserID'");
list($NumCollageContribs) = $DB->next_record();
$DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'");
list($UniqueGroups) = $DB->next_record();
$DB->query("SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = '$UserID'");
$DB->query("SELECT COUNT(ID)
FROM torrents
WHERE ((LogScore = 100 AND Format = 'FLAC')
OR (Media = 'Vinyl' AND Format = 'FLAC')
OR (Media = 'WEB' AND Format = 'FLAC')
OR (Media = 'DVD' AND Format = 'FLAC')
OR (Media = 'Soundboard' AND Format = 'FLAC')
OR (Media = 'Cassette' AND Format = 'FLAC')
OR (Media = 'SACD' AND Format = 'FLAC')
OR (Media = 'Blu-ray' AND Format = 'FLAC')
OR (Media = 'DAT' AND Format = 'FLAC'))
AND UserID = '$UserID'");
list($PerfectFLACs) = $DB->next_record();
?>
<div class="box box_info box_userinfo_community">
<div class="head colhead_dark">Community</div>
<ul class="stats nobullet">
<li>Forum posts: <?=number_format($ForumPosts)?> <a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>" class="brackets" title="View">View</a></li>
<? if (($Override=check_paranoia_here('torrentcomments+'))) { ?>
<? if (($Override = check_paranoia_here('torrentcomments+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Torrent comments: <?=number_format($NumComments)?>
<? if ($Override=check_paranoia_here('torrentcomments')) { ?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Artist comments: <?=number_format($NumArtistComments)?>
<? if ($Override=check_paranoia_here('torrentcomments')) { ?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>&amp;action=artists" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Request comments: <?=number_format($NumRequestComments)?>
<? if ($Override=check_paranoia_here('torrentcomments')) { ?>
<? if ($Override = check_paranoia_here('torrentcomments')) { ?>
<a href="comments.php?id=<?=$UserID?>&amp;action=requests" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('collages+'))) { ?>
<? }
if (($Override = check_paranoia_here('collages+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages started: <?=number_format($NumCollages)?>
<? if (($Override=check_paranoia_here('collages'))) { ?>
<? if (($Override = check_paranoia_here('collages'))) { ?>
<a href="collages.php?userid=<?=$UserID?>" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('collagecontribs+'))) { ?>
<? }
if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
<? if (($Override=check_paranoia_here('collagecontribs'))) { ?>
<? if (($Override = check_paranoia_here('collagecontribs'))) { ?>
<a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?= ($Override===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<? } ?>
<?
<? }
//Let's see if we can view requests because of reasons
$ViewAll = check_paranoia_here('requestsfilled_list');
$ViewCount = check_paranoia_here('requestsfilled_count');
@ -75,12 +92,12 @@
<li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?></li>
<? } elseif ($ViewAll) { ?>
<li>
<span<?= ($ViewCount===2) ? ' class="paranoia_override"' : ''?>>Requests filled: <?=number_format($RequestsFilled)?></span>
<span<?= ($ViewBounty===2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalBounty) ?></span>
<a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests filled: <?=number_format($RequestsFilled)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalBounty) ?></span>
<a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll === 2) ? ' paranoia_override' : '' ?>" title="View">View</a>
</li>
<? } ?>
<?
<? }
//Let's see if we can view requests because of reasons
$ViewAll = check_paranoia_here('requestsvoted_list');
$ViewCount = check_paranoia_here('requestsvoted_count');
@ -94,86 +111,93 @@
<li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li>
<? } elseif ($ViewAll) { ?>
<li>
<span<?= ($ViewCount===2) ? ' class="paranoia_override"' : ''?>>Requests voted: <?=number_format($RequestsVoted)?></span>
<span<?= ($ViewBounty===2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalSpent)?></span>
<a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll===2) ? ' paranoia_override' : '' ?>" title="View">View</a>
<span<?= ($ViewCount === 2) ? ' class="paranoia_override"' : ''?>>Requests voted: <?=number_format($RequestsVoted)?></span>
<span<?= ($ViewBounty === 2) ? ' class="paranoia_override"' : ''?>> for <?=Format::get_size($TotalSpent)?></span>
<a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?= ($ViewAll === 2) ? ' paranoia_override' : '' ?>" title="View">View</a>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('uploads+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Uploaded: <?=number_format($Uploads)?>
<? if (($Override=check_paranoia_here('uploads'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
if (($Override = check_paranoia_here('uploads+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Uploaded: <?=number_format($Uploads)?>
<? if (($Override = check_paranoia_here('uploads'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? if (check_perms('zip_downloader')) { ?>
<a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="Download">Download</a>
<a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="Download">Download</a>
<? }
}
?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('uniquegroups+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Unique groups: <? echo number_format($UniqueGroups); ?>
<? if (($Override=check_paranoia_here('uniquegroups'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
if (($Override = check_paranoia_here('uniquegroups+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Unique groups: <? echo number_format($UniqueGroups); ?>
<? if (($Override = check_paranoia_here('uniquegroups'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('perfectflacs+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>"Perfect" FLACs: <? echo number_format($PerfectFLACs); ?>
<? if (($Override=check_paranoia_here('perfectflacs'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=perfectflac" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
if (($Override = check_paranoia_here('perfectflacs+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>"Perfect" FLACs: <? echo number_format($PerfectFLACs); ?>
<? if (($Override = check_paranoia_here('perfectflacs'))) { ?>
<a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=perfectflac" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? } ?>
</li>
<? } ?>
<? if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.active=1 GROUP BY Type");
<? }
if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
$DB->query("SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid)
FROM xbt_files_users AS x
INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID' AND x.active=1
GROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$Seeding = isset($PeerCount['Seeding'][1]) ? $PeerCount['Seeding'][1] : 0;
$Leeching = isset($PeerCount['Leeching'][1]) ? $PeerCount['Leeching'][1] : 0;
} ?>
<? if (($Override=check_paranoia_here('seeding+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Seeding: <?=number_format($Seeding)?>
<? if (($AOverride=check_paranoia_here('seeding'))) {
echo ((($Override=check_paranoia_here('snatched')) && $UniqueSnatched > 0 )
? '<span'.($Override===2 ? ' class="paranoia_override"' : '').'> (' . 100*min(1,round($Seeding/$UniqueSnatched,2)).'%)</span>' : ''); ?>
<a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" class="brackets<?= $AOverride===2 ? ' paranoia_override' :'' ?>" title="View">View</a>
<? if (($Override = check_paranoia_here('seeding+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Seeding: <?=number_format($Seeding)?>
<? if (($AOverride = check_paranoia_here('seeding'))) {
echo ((($Override = check_paranoia_here('snatched')) && $UniqueSnatched > 0 )
? '<span'.($Override === 2 ? ' class="paranoia_override"' : '').'> (' . 100 * min(1,round($Seeding / $UniqueSnatched,2)).'%)</span>' : ''); ?>
<a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" class="brackets<?= $AOverride === 2 ? ' paranoia_override' :'' ?>" title="View">View</a>
<? if (check_perms('zip_downloader')) { ?>
<a href="torrents.php?action=redownload&amp;type=seeding&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');" class="brackets" title="Download">Download</a>
<? }
}
?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('leeching+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Leeching: <? echo number_format($Leeching); ?>
<? if (($Override=check_paranoia_here('leeching'))) { ?>
<a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
if (($Override = check_paranoia_here('leeching+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Leeching: <? echo number_format($Leeching); ?>
<? if (($Override = check_paranoia_here('leeching'))) { ?>
<a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
echo ($DisableLeech == 0 && check_perms('users_view_ips')) ? ' <strong>(Disabled)</strong>' : ''
?>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('snatched+'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Snatched: <?=number_format($Snatched)?>
<? if (($Override=check_perms('site_view_torrent_snatchlist', $Class))) { ?>
<? }
if (($Override = check_paranoia_here('snatched+'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Snatched: <?=number_format($Snatched)?>
<? if (($Override = check_perms('site_view_torrent_snatchlist', $Class))) { ?>
(<?= $Override === 2 ? '<span class="paranoia_override">'.number_format($UniqueSnatched).'</span>' : number_format($UniqueSnatched) ?>)
<? } ?>
<? } ?>
<? if (($Override=check_paranoia_here('snatched'))) { ?>
<a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>" class="brackets<?= $Override===2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? }
}
if (($Override = check_paranoia_here('snatched'))) { ?>
<a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>" class="brackets<?= $Override === 2 ? ' paranoia_override' : '' ?>" title="View">View</a>
<? if (check_perms('zip_downloader')) { ?>
<a href="torrents.php?action=redownload&amp;type=snatches&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected, be sure to check the size of all torrents before redownloading.');" class="brackets" title="Download">Download</a>
<? } ?>
</li>
<? } ?>
<? if (($Override=check_perms('site_view_torrent_snatchlist', $Class))) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID) FROM users_downloads AS ud INNER JOIN torrents AS t ON t.ID=ud.TorrentID WHERE ud.UserID='$UserID'");
<? }
if (($Override = check_perms('site_view_torrent_snatchlist', $Class))) {
$DB->query("SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID)
FROM users_downloads AS ud
INNER JOIN torrents AS t ON t.ID=ud.TorrentID
WHERE ud.UserID='$UserID'");
list($NumDownloads, $UniqueDownloads) = $DB->next_record();
?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>)
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Downloaded: <?=number_format($NumDownloads)?> (<?=number_format($UniqueDownloads)?>)
<a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>" class="brackets" title="View">View</a>
</li>
<? } ?>
<? if (($Override=check_paranoia_here('invitedcount'))) {
<? }
if (($Override=check_paranoia_here('invitedcount'))) {
$DB->query("SELECT COUNT(UserID) FROM users_info WHERE Inviter='$UserID'");
list($Invited) = $DB->next_record();
?>

View File

@ -1,7 +1,6 @@
<?
$UserID = $_REQUEST['userid'];
if(!is_number($UserID)){
if (!is_number($UserID)) {
error(404);
}
@ -27,12 +26,12 @@
list($Username,$Email,$IRCKey,$Paranoia,$Info,$Avatar,$Country,$StyleID,$StyleURL,$SiteOptions,$UnseededAlerts,$Class)=$DB->next_record(MYSQLI_NUM, array(3,9));
if($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
error(403);
}
$Paranoia = unserialize($Paranoia);
if(!is_array($Paranoia)) {
if (!is_array($Paranoia)) {
$Paranoia = array();
}
@ -63,7 +62,7 @@ function checked($Checked) {
$DB->query("SELECT username FROM lastfm_users WHERE ID = '$UserID'");
$LastFMUsername = "";
$LastFMUsername = '';
list($LastFMUsername) = $DB->next_record();
echo $Val->GenerateJS('userform');
@ -88,7 +87,7 @@ function checked($Checked) {
<td class="label"><strong>Stylesheet</strong></td>
<td>
<select name="stylesheet" id="stylesheet">
<? foreach($Stylesheets as $Style) { ?>
<? foreach ($Stylesheets as $Style) { ?>
<option value="<?=$Style['ID']?>"<? if ($Style['ID'] == $StyleID) { ?> selected="selected"<? } ?>><?=$Style['ProperName']?></option>
<? } ?>
</select>
@ -242,19 +241,19 @@ function checked($Checked) {
<td class="label"><strong>Avatars</strong></td>
<td>
<select name="disableavatars" id="disableavatars" onclick="ToggleIdenticons();">
<option value="1"<? if($SiteOptions['DisableAvatars'] == 1) { ?> selected="selected"<? } ?>>Disable avatars</option>
<option value="0"<? if($SiteOptions['DisableAvatars'] == 0) { ?> selected="selected"<? } ?>>Show avatars</option>
<option value="2"<? if($SiteOptions['DisableAvatars'] == 2) { ?> selected="selected"<? } ?>>Show avatars or:</option>
<option value="3"<? if($SiteOptions['DisableAvatars'] == 3) { ?> selected="selected"<? } ?>>Replace all avatars with:</option>
<option value="1"<? if ($SiteOptions['DisableAvatars'] == 1) { ?> selected="selected"<? } ?>>Disable avatars</option>
<option value="0"<? if ($SiteOptions['DisableAvatars'] == 0) { ?> selected="selected"<? } ?>>Show avatars</option>
<option value="2"<? if ($SiteOptions['DisableAvatars'] == 2) { ?> selected="selected"<? } ?>>Show avatars or:</option>
<option value="3"<? if ($SiteOptions['DisableAvatars'] == 3) { ?> selected="selected"<? } ?>>Replace all avatars with:</option>
</select>
<select name="identicons" id="identicons">
<option value="0"<? if($SiteOptions['Identicons'] == 0) { ?> selected="selected"<? } ?>>Identicon</option>
<option value="1"<? if($SiteOptions['Identicons'] == 1) { ?> selected="selected"<? } ?>>MonsterID</option>
<option value="2"<? if($SiteOptions['Identicons'] == 2) { ?> selected="selected"<? } ?>>Wavatar</option>
<option value="3"<? if($SiteOptions['Identicons'] == 3) { ?> selected="selected"<? } ?>>Retro</option>
<option value="4"<? if($SiteOptions['Identicons'] == 4) { ?> selected="selected"<? } ?>>Robots 1</option>
<option value="5"<? if($SiteOptions['Identicons'] == 5) { ?> selected="selected"<? } ?>>Robots 2</option>
<option value="6"<? if($SiteOptions['Identicons'] == 6) { ?> selected="selected"<? } ?>>Robots 3</option>
<option value="0"<? if ($SiteOptions['Identicons'] == 0) { ?> selected="selected"<? } ?>>Identicon</option>
<option value="1"<? if ($SiteOptions['Identicons'] == 1) { ?> selected="selected"<? } ?>>MonsterID</option>
<option value="2"<? if ($SiteOptions['Identicons'] == 2) { ?> selected="selected"<? } ?>>Wavatar</option>
<option value="3"<? if ($SiteOptions['Identicons'] == 3) { ?> selected="selected"<? } ?>>Retro</option>
<option value="4"<? if ($SiteOptions['Identicons'] == 4) { ?> selected="selected"<? } ?>>Robots 1</option>
<option value="5"<? if ($SiteOptions['Identicons'] == 5) { ?> selected="selected"<? } ?>>Robots 2</option>
<option value="6"<? if ($SiteOptions['Identicons'] == 6) { ?> selected="selected"<? } ?>>Robots 3</option>
</select>
</td>
</tr>

View File

@ -9,7 +9,9 @@
include(SERVER_ROOT."/classes/class_validate.php");
$Val=NEW VALIDATE;
if(empty($_REQUEST['action'])) { $_REQUEST['action']=''; }
if (empty($_REQUEST['action'])) {
$_REQUEST['action'] = '';
}
switch ($_REQUEST['action']) {
case 'notify':

View File

@ -1,11 +1,13 @@
<?
if(isset($_GET['userid']) && check_perms('users_view_invites')){
if(!is_number($_GET['userid'])){ error(403); }
if (isset($_GET['userid']) && check_perms('users_view_invites')) {
if (!is_number($_GET['userid'])) {
error(403);
}
$UserID=$_GET['userid'];
$Sneaky = true;
} else {
if(!$UserCount = $Cache->get_value('stats_user_count')){
if (!$UserCount = $Cache->get_value('stats_user_count')) {
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
list($UserCount) = $DB->next_record();
$Cache->cache_value('stats_user_count', $UserCount, 0);
@ -22,16 +24,16 @@
$DB->query("SELECT InviteKey, Email, Expires FROM invites WHERE InviterID='$UserID' ORDER BY Expires");
$Pending = $DB->to_array();
$OrderWays = array("username", "email", "joined", "lastseen", "uploaded", "downloaded", "ratio");
$OrderWays = array('username', 'email', 'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
if(empty($_GET['order'])) {
$CurrentOrder = "id";
$CurrentSort = "asc";
$NewSort = "desc";
if (empty($_GET['order'])) {
$CurrentOrder = 'id';
$CurrentSort = 'asc';
$NewSort = 'desc';
} else {
if(in_array($_GET['order'], $OrderWays)) {
if (in_array($_GET['order'], $OrderWays)) {
$CurrentOrder = $_GET['order'];
if($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
$CurrentSort = $_GET['sort'];
$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
} else {
@ -91,7 +93,7 @@
<div class="header">
<h2><?=Users::format_username($UserID, false, false, false)?> &gt; Invites</h2>
<div class="linkbox">
<a href="user.php?action=invitetree<? if($Sneaky){ echo '&amp;userid='.$UserID; }?>" class="brackets">Invite tree</a>
<a href="user.php?action=invitetree<? if ($Sneaky) { echo '&amp;userid='.$UserID; } ?>" class="brackets">Invite tree</a>
</div>
</div>
<? if ($UserCount >= USER_LIMIT && !check_perms('site_can_invite_always')) { ?>
@ -112,13 +114,13 @@
$DB->query("SELECT can_leech FROM users_main WHERE ID = ".$UserID);
list($CanLeech) = $DB->next_record();
if(!$Sneaky
if (!$Sneaky
&& !$LoggedUser['RatioWatch']
&& $CanLeech
&& empty($LoggedUser['DisableInvites'])
&& ($LoggedUser['Invites']>0 || check_perms('site_send_unlimited_invites'))
&& ($LoggedUser['Invites'] > 0 || check_perms('site_send_unlimited_invites'))
&& ($UserCount <= USER_LIMIT || USER_LIMIT == 0 || check_perms('site_can_invite_always'))
){ ?>
) { ?>
<div class="box pad">
<p>Please note that the selling, trading or public giving away of our invitations, or responding to public requests, is strictly forbidden, and may result in you and your entire invite tree being banned. This includes offering to give away our invitations on any forum which is not a class-restricted forum on another private tracker.</p>
<p>Remember that you are responsible for ALL invitees, and your account and/or privileges may be disabled due to your invitees' actions. You should know the person you're inviting. If you aren't familiar enough with the user to trust them, we suggest not inviting them.</p>
@ -141,7 +143,7 @@
</form>
</div>
<?
} elseif (!empty($LoggedUser['DisableInvites'])) {?>
} elseif (!empty($LoggedUser['DisableInvites'])) { ?>
<div class="box pad" style="text-align: center">
<strong class="important_text">Your invites have been disabled. Please read <a href="wiki.php?action=article&amp;id=310">this article</a> for more information.</strong>
</div>

View File

@ -1,11 +1,13 @@
<?
if(isset($_GET['userid']) && check_perms('users_view_invites')){
if(!is_number($_GET['userid'])){ error(403); }
if (isset($_GET['userid']) && check_perms('users_view_invites')) {
if (!is_number($_GET['userid'])) {
error(403);
}
$UserID=$_GET['userid'];
$UserID = $_GET['userid'];
$Sneaky = true;
} else {
if(!$UserCount = $Cache->get_value('stats_user_count')){
if (!$UserCount = $Cache->get_value('stats_user_count')) {
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
list($UserCount) = $DB->next_record();
$Cache->cache_value('stats_user_count', $UserCount, 0);

View File

@ -10,13 +10,13 @@
<div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet">
<li>
Username: <a id="lastfm_username" href="<?= $LastFMInfo['user']['url'] ?>" target="_blank" title="<?= $LastFMInfo['user']['name'] ?> on Last.fm: <?= $LastFMInfo['user']['playcount'] ?> plays, <?= $LastFMInfo['user']['playlists'] ?> playlists."><?= $LastFMInfo['user']['name'] ?></a>
Username: <a id="lastfm_username" href="<?= $LastFMInfo['user']['url'] ?>" target="_blank" title="<?= $LastFMInfo['user']['name'] ?> on Last.fm: <?= number_format($LastFMInfo['user']['playcount']) ?> plays, <?= number_format($LastFMInfo['user']['playlists']) ?> playlists."><?= $LastFMInfo['user']['name'] ?></a>
</li>
<div id="lastfm_stats" <? if ($OwnProfile == true): ?>data-uid="<?= $OwnProfile ?>"<? endif; ?>>
<div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?= $OwnProfile ?>"<? endif; ?>>
</div>
<li>
<a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a>
<?
<?
//Append the reload stats button only if allowed on the current user page.
$Response = $Cache->get_value('lastfm_clear_cache_' . $LoggedUser . '_' . $_GET['id']);
if (empty($Response)) :
@ -24,8 +24,9 @@
<span id="lastfm_reload_container">
<a href="#" id="lastfm_reload" onclick="return false" class="brackets">Reload stats</a>
</span>
<? endif; ?>
<? endif; ?>
</li>
</ul>
</div>
<? } ?>
<?
} ?>

View File

@ -1,14 +1,14 @@
<?
authorize();
include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
authorize();
include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
if (!check_perms('users_mod')) {
if (!check_perms('users_mod')) {
error(403);
}
}
$UserID = $_REQUEST['userid'];
$UserID = $_REQUEST['userid'];
switch ($_REQUEST['dupeaction']) {
switch ($_REQUEST['dupeaction']) {
case 'remove':
unlink_user($_REQUEST['removeid']);
break;
@ -34,7 +34,7 @@
default:
error(403);
}
echo '\o/';
header("Location: user.php?id=$UserID");
}
echo '\o/';
header("Location: user.php?id=$UserID");
?>

View File

@ -2,14 +2,16 @@
//TODO: restrict to viewing bellow class, username in h2
if(isset($_GET['userid']) && check_perms('users_view_ips') && check_perms('users_logout')) {
if(!is_number($_GET['userid'])) { error(404); }
if (isset($_GET['userid']) && check_perms('users_view_ips') && check_perms('users_logout')) {
if (!is_number($_GET['userid'])) {
error(404);
}
$UserID = $_GET['userid'];
} else {
$UserID = $LoggedUser['ID'];
}
if(isset($_POST['all'])) {
if (isset($_POST['all'])) {
authorize();
$DB->query("DELETE FROM users_sessions WHERE UserID='$UserID' AND SessionID<>'$SessionID'");
@ -24,7 +26,7 @@
}
$UserSessions = $Cache->get_value('users_sessions_'.$UserID);
if(!is_array($UserSessions)) {
if (!is_array($UserSessions)) {
$DB->query("SELECT
SessionID,
Browser,
@ -64,7 +66,7 @@
</tr>
<?
$Row = 'a';
foreach($UserSessions as $Session) {
foreach ($UserSessions as $Session) {
list($ThisSessionID,$Browser,$OperatingSystem,$IP,$LastUpdate) = array_values($Session);
$Row = ($Row == 'a') ? 'b' : 'a';
?>
@ -78,7 +80,7 @@
<input type="hidden" name="action" value="sessions" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="session" value="<?=$ThisSessionID?>" />
<input type="submit" value="<?=(($ThisSessionID == $SessionID)?'Current" disabled="disabled':'Log out')?>" />
<input type="submit" value="<?=(($ThisSessionID == $SessionID) ? 'Current" disabled="disabled' : 'Log out') ?>" />
</form>
</td>
</tr>

View File

@ -175,7 +175,9 @@
$EditSummary = array();
if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
$DB->query("UPDATE users_info SET RatioWatchEnds='0000-00-00 00:00:00', RatioWatchDownload='0', RatioWatchTimes='0' WHERE UserID='$UserID'");
$DB->query("UPDATE users_info
SET RatioWatchEnds='0000-00-00 00:00:00', RatioWatchDownload='0', RatioWatchTimes='0'
WHERE UserID='$UserID'");
$EditSummary[] = 'RatioWatch history reset';
}
@ -191,9 +193,11 @@
if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
$DB->query("DELETE FROM users_history_emails WHERE UserID='$UserID'");
if ($_POST['ResetIPHistory']) {
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP) VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','127.0.0.1')");
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP)
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','127.0.0.1')");
} else {
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP) VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','".$Cur['IP']."')");
$DB->query("INSERT INTO users_history_emails (UserID, Email, Time, IP)
VALUES ('$UserID','$Username@".SITE_URL."','0000-00-00 00:00:00','".$Cur['IP']."')");
}
$DB->query("UPDATE users_main SET Email='$Username@".SITE_URL."' WHERE ID='$UserID'");
$EditSummary[] = 'Email history cleared';
@ -230,18 +234,24 @@
if ($Logs095 !== 0) {
$TargetScore = $Logs095 === 100 ? 99 : 100;
$Logs = $DB->query("SELECT DISTINCT TorrentID FROM torrents_logs_new JOIN torrents ON ID = TorrentID WHERE Log LIKE 'EAC extraction logfile%' AND UserID = ".$UserID." AND Score = ".$TargetScore." AND (Adjusted = '0' OR Adjusted = '')");
$Logs = $DB->query("SELECT DISTINCT TorrentID
FROM torrents_logs_new
JOIN torrents ON ID = TorrentID
WHERE Log LIKE 'EAC extraction logfile%'
AND UserID = $UserID
AND Score = $TargetScore
AND (Adjusted = '0' OR Adjusted = '')");
while (list($TorrentID) = $DB->next_record()) {
$Results = array();
if ($Logs095 === 100) {
$Details = "";
$Details = '';
} else {
$Results[] = "The original uploader has chosen to allow this log to be deducted one point for using EAC v0.95., -1 point [1]";
$Results[] = 'The original uploader has chosen to allow this log to be deducted one point for using EAC v0.95., -1 point [1]';
$Details = db_string(serialize($Results));
}
$DB->query("UPDATE torrents SET LogScore = ".$Logs095." WHERE ID = ".$TorrentID);
$DB->query("UPDATE torrents_logs_new SET Score = ".$Logs095.", Details = '".$Details."' WHERE TorrentID = ".$TorrentID);
$DB->query("UPDATE torrents SET LogScore = $Logs095 WHERE ID = $TorrentID");
$DB->query("UPDATE torrents_logs_new SET Score = $Logs095, Details = '$Details' WHERE TorrentID = $TorrentID");
$DB->set_query_id($Logs);
}
$EditSummary[] = 'EAC v0.95 logs rescored to '.$Logs095;
@ -252,9 +262,9 @@
// Start building SQL query and edit summary
if ($Classes[$Class]['Level'] != $Cur['Class'] && (
($Classes[$Class]['Level'] < $LoggedUser['Class'] && check_perms('users_promote_below', $Cur['Class']))
|| ($Classes[$Class]['Level'] <= $LoggedUser['Class'] && check_perms('users_promote_to', $Cur['Class']-1)))) {
|| ($Classes[$Class]['Level'] <= $LoggedUser['Class'] && check_perms('users_promote_to', $Cur['Class'] - 1)))) {
$UpdateSet[] = "PermissionID='$Class'";
$EditSummary[] = "class changed to ".Users::make_class_string($Class);
$EditSummary[] = 'class changed to '.Users::make_class_string($Class);
$LightUpdates['PermissionID'] = $Class;
$DeleteKeys = true;
@ -267,12 +277,12 @@
}
}
if ($Username != $Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class']-1)) {
if ($Username != $Cur['Username'] && check_perms('users_edit_usernames', $Cur['Class'] - 1)) {
$DB->query("SELECT ID FROM users_main WHERE Username = '".$Username."'");
if ($DB->next_record() > 0) {
list($UsedUsernameID) = $DB->next_record();
error("Username already in use by <a href='user.php?id=".$UsedUsernameID."'>".$Username."</a>");
header("Location: user.php?id=".$UserID);
error('Username already in use by <a href="user.php?id='.$UsedUsernameID."\">$Username</a>");
header('Location: user.php?id='.$UserID);
die();
} else {
$UpdateSet[] = "Username='".$Username."'";
@ -296,7 +306,7 @@
if ($Donor != $Cur['Donor'] && check_perms('users_give_donor')) {
$UpdateSet[] = "Donor='$Donor'";
$EditSummary[] = "donor status changed";
$EditSummary[] = 'donor status changed';
$LightUpdates['Donor'] = $Donor;
}
@ -309,7 +319,7 @@
foreach ($DroppedClasses as $PermID) {
$ClassChanges[] = $Classes[$PermID]['Name'];
}
$EditSummary[] = "Secondary classes dropped: ".implode(', ',$ClassChanges);
$EditSummary[] = 'Secondary classes dropped: '.implode(', ',$ClassChanges);
$DB->query("DELETE FROM users_levels WHERE UserID = '$UserID' AND PermissionID IN (".implode(',',$DroppedClasses).")");
if (count($SecondaryClasses) > 0) {
$LightUpdates['ExtraClasses'] = array_fill_keys($SecondaryClasses, 1);

View File

@ -223,25 +223,25 @@ function check_paranoia_here($Setting) {
<ul class="stats nobullet">
<li>Joined: <?=$JoinedDate?></li>
<? if (($Override = check_paranoia_here('lastseen'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Last seen: <?=$LastAccess?></li>
<? } ?>
<? if (($Override=check_paranoia_here('uploaded'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('downloaded'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('ratio'))) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
<? } ?>
<? if (($Override=check_paranoia_here('requiredratio')) && isset($RequiredRatio)) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
<? } ?>
<? if ($OwnProfile || ($Override=check_paranoia_here(false)) || check_perms('users_mod')) { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Last seen: <?=$LastAccess?></li>
<? }
if (($Override=check_paranoia_here('uploaded'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li>
<? }
if (($Override=check_paranoia_here('downloaded'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li>
<? }
if (($Override=check_paranoia_here('ratio'))) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
<? }
if (($Override=check_paranoia_here('requiredratio')) && isset($RequiredRatio)) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Required ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
<? }
if ($OwnProfile || ($Override=check_paranoia_here(false)) || check_perms('users_mod')) { ?>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
<? }
if (($OwnProfile || check_perms('users_mod')) && $Warned!='0000-00-00 00:00:00') { ?>
<li<?= $Override===2 ? ' class="paranoia_override"' : ''?>>Warning expires: <?= date('Y-m-d H:i', strtotime($Warned)) ?></li>
<li<?= $Override === 2 ? ' class="paranoia_override"' : ''?>>Warning expires: <?= date('Y-m-d H:i', strtotime($Warned)) ?></li>
<? } ?>
</ul>
</div>
@ -252,7 +252,12 @@ function check_paranoia_here($Setting) {
include(SERVER_ROOT.'/sections/user/lastfm.php');
if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
$DB->query("SELECT COUNT(DISTINCT r.ID), SUM(rv.Bounty) FROM requests AS r LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID WHERE r.FillerID = ".$UserID);
$DB->query("SELECT
COUNT(DISTINCT r.ID),
SUM(rv.Bounty)
FROM requests AS r
LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID
WHERE r.FillerID = ".$UserID);
list($RequestsFilled, $TotalBounty) = $DB->next_record();
} else {
$RequestsFilled = $TotalBounty = 0;
@ -485,17 +490,17 @@ function check_paranoia_here($Setting) {
<? } ?>
<div class="box">
<div class="head">
<span style="float:left;">Profile<? if ($CustomTitle) {?>&nbsp;-&nbsp;</span>
<span style="float: left;">Profile<? if ($CustomTitle) {?>&nbsp;-&nbsp;</span>
<span class="user_title"><? echo html_entity_decode($DisplayCustomTitle); } ?></span>
<span style="float:right;"><?=!empty($Badges)?"$Badges&nbsp;&nbsp;":''?><a href="#" onclick="$('#profilediv').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets">Hide</a></span>&nbsp;
<span style="float: right;"><?=!empty($Badges)?"$Badges&nbsp;&nbsp;":''?><a href="#" onclick="$('#profilediv').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets">Hide</a></span>&nbsp;
</div>
<div class="pad" id="profilediv">
<? if (!$Info) { ?>
This profile is currently empty.
<?
} else {
} else {
echo $Text->full_format($Info);
}
}
?>
</div>
@ -1104,19 +1109,19 @@ function check_paranoia_here($Setting) {
<tr>
<td class="label">Disable:</td>
<td>
<input type="checkbox" name="DisablePosting" id="DisablePosting"<? if ($DisablePosting==1) { ?> checked="checked"<? } ?> /> <label for="DisablePosting">Posting</label>
<input type="checkbox" name="DisablePosting" id="DisablePosting"<? if ($DisablePosting == 1) { ?> checked="checked"<? } ?> /> <label for="DisablePosting">Posting</label>
<? if (check_perms('users_disable_any')) { ?> |
<input type="checkbox" name="DisableAvatar" id="DisableAvatar"<? if ($DisableAvatar==1) { ?> checked="checked"<? } ?> /> <label for="DisableAvatar">Avatar</label> |
<input type="checkbox" name="DisableInvites" id="DisableInvites"<? if ($DisableInvites==1) { ?> checked="checked"<? } ?> /> <label for="DisableInvites">Invites</label> |
<input type="checkbox" name="DisableForums" id="DisableForums"<? if ($DisableForums==1) { ?> checked="checked"<? } ?> /> <label for="DisableForums">Forums</label> |
<input type="checkbox" name="DisableTagging" id="DisableTagging"<? if ($DisableTagging==1) { ?> checked="checked"<? } ?> /> <label for="DisableTagging" title="This only disables a user's ability to delete tags.">Tagging</label> |
<input type="checkbox" name="DisableRequests" id="DisableRequests"<? if ($DisableRequests==1) { ?> checked="checked"<? } ?> /> <label for="DisableRequests">Requests</label>
<input type="checkbox" name="DisableAvatar" id="DisableAvatar"<? if ($DisableAvatar == 1) { ?> checked="checked"<? } ?> /> <label for="DisableAvatar">Avatar</label> |
<input type="checkbox" name="DisableInvites" id="DisableInvites"<? if ($DisableInvites == 1) { ?> checked="checked"<? } ?> /> <label for="DisableInvites">Invites</label> |
<input type="checkbox" name="DisableForums" id="DisableForums"<? if ($DisableForums == 1) { ?> checked="checked"<? } ?> /> <label for="DisableForums">Forums</label> |
<input type="checkbox" name="DisableTagging" id="DisableTagging"<? if ($DisableTagging == 1) { ?> checked="checked"<? } ?> /> <label for="DisableTagging" title="This only disables a user's ability to delete tags.">Tagging</label> |
<input type="checkbox" name="DisableRequests" id="DisableRequests"<? if ($DisableRequests == 1) { ?> checked="checked"<? } ?> /> <label for="DisableRequests">Requests</label>
<br />
<input type="checkbox" name="DisableUpload" id="DisableUpload"<? if ($DisableUpload==1) { ?> checked="checked"<? } ?> /> <label for="DisableUpload">Upload</label> |
<input type="checkbox" name="DisableWiki" id="DisableWiki"<? if ($DisableWiki==1) { ?> checked="checked"<? } ?> /> <label for="DisableWiki">Wiki</label> |
<input type="checkbox" name="DisableLeech" id="DisableLeech"<? if ($DisableLeech==0) { ?> checked="checked"<? } ?> /> <label for="DisableLeech">Leech</label> |
<input type="checkbox" name="DisablePM" id="DisablePM"<? if ($DisablePM==1) { ?> checked="checked"<? } ?> /> <label for="DisablePM">PM</label> |
<input type="checkbox" name="DisableIRC" id="DisableIRC"<? if ($DisableIRC==1) { ?> checked="checked"<? } ?> /> <label for="DisableIRC">IRC</label>
<input type="checkbox" name="DisableUpload" id="DisableUpload"<? if ($DisableUpload == 1) { ?> checked="checked"<? } ?> /> <label for="DisableUpload">Upload</label> |
<input type="checkbox" name="DisableWiki" id="DisableWiki"<? if ($DisableWiki == 1) { ?> checked="checked"<? } ?> /> <label for="DisableWiki">Wiki</label> |
<input type="checkbox" name="DisableLeech" id="DisableLeech"<? if ($DisableLeech == 0) { ?> checked="checked"<? } ?> /> <label for="DisableLeech">Leech</label> |
<input type="checkbox" name="DisablePM" id="DisablePM"<? if ($DisablePM == 1) { ?> checked="checked"<? } ?> /> <label for="DisablePM">PM</label> |
<input type="checkbox" name="DisableIRC" id="DisableIRC"<? if ($DisableIRC == 1) { ?> checked="checked"<? } ?> /> <label for="DisableIRC">IRC</label>
</td>
</tr>
<tr>

View File

@ -2,7 +2,9 @@
/*
User collage subscription page
*/
if(!check_perms('site_collages_subscribe')) { error(403); }
if (!check_perms('site_collages_subscribe')) {
error(403);
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
@ -40,11 +42,11 @@
?>
<div class="thin">
<div class="header">
<h2>Subscribed collages<?=($ShowAll?'':' with new additions')?></h2>
<h2>Subscribed collages<?=($ShowAll ? '' : ' with new additions')?></h2>
<div class="linkbox">
<?
if($ShowAll) {
if ($ShowAll) {
?>
<br /><br />
<a href="userhistory.php?action=subscribed_collages&amp;showall=0" class="brackets">Only display collages with new additions</a>&nbsp;&nbsp;&nbsp;
@ -60,7 +62,7 @@
</div>
</div>
<?
if(!$NumResults) {
if (!$NumResults) {
?>
<div class="center">
No subscribed collages<?=($ShowAll ? '' : ' with new additions')?>
@ -85,7 +87,7 @@
//$Artists = Artists::get_artists($GroupID);
$GroupIDs = $DB->collect('GroupID');
if(count($GroupIDs)>0) {
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = $TorrentList['matches'];
} else {
@ -110,18 +112,22 @@
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif(count($Artists)>0) {
} elseif (count($Artists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$Artists));
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupYear > 0) {
$DisplayName = $DisplayName. " [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
?>
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$CollageID?><?=$GroupID?>">
<td class="center">
@ -158,7 +164,7 @@
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
$EditionID++;
?>
@ -194,10 +200,10 @@
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($Torrent['IsSnatched']) {
if ($Torrent['IsSnatched']) {
$DisplayName .=' ' . Format::torrent_label('Snatched!');
}
if(!empty($Torrent['FreeTorrent'])) {
if (!empty($Torrent['FreeTorrent'])) {
$DisplayName .=' ' . Format::torrent_label('Freeleech!');
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
@ -260,7 +266,7 @@
</table>
<? } // foreach() ?>
<?
} // else -- if(empty($NumResults)) ?>
} // else -- if (empty($NumResults)) ?>
</div>
<?

View File

@ -113,30 +113,30 @@ input {
input[type="submit"], input[type="reset"], input[type="button"], button {
font-family: Arial, Sans-Serif;
line-height: 13px !important;
font-size:12pt;
-moz-border-radius:5px 5px 5px 5px;
-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25);
-webkit-border-radius:5px 5px 5px 5px;
-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25);
font-size: 12pt;
-moz-border-radius: 5px 5px 5px 5px;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
-webkit-border-radius: 5px 5px 5px 5px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
background: #8E2FA4 url("images/overlay-button.png") repeat-x scroll 0 0;
border: 0 none;
border-bottom:1px solid rgba(0, 0, 0, 0.25);
color:#FFF;
cursor:pointer;
font-size:13px;
font-weight:bold;
line-height:1;
overflow:visible;
border-bottom: 1px solid rgba(0, 0, 0, 0.25);
color: #FFF;
cursor: pointer;
font-size: 13px;
font-weight: bold;
line-height: 1;
overflow: visible;
padding: 3px 15px;
position:relative;
text-decoration:none;
text-shadow:0 -1px 1px rgba(0, 0, 0, 0.25);
width:auto;
position: relative;
text-decoration: none;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
width: auto;
display: inline-block;
}
/* [type="button"]:hover,input[type="submit']:hover,input[type="reset"] input:hover {*/
input[type="submit"]:hover, input[type="reset"]:hover, input[type="button"]:hover, button:hover {
background-color:#6e257f;
background-color: #6e257f;
}
/* ************************************************************************** */
@ -587,15 +587,15 @@ ul#userinfo_stats li {
font-size: 14pt;
}
/* artists */
#searchbars ul li + li form input {left: 160px; width: 65px;}
#searchbars ul li + li form input { left: 160px; width: 65px; }
/* requests */
#searchbars ul li + li + li form input { left: 252px; width: 80px;}
#searchbars ul li + li + li form input { left: 252px; width: 80px; }
/* forums */
#searchbars ul li + li + li + li form input { left: 360px; width: 70px;}
#searchbars ul li + li + li + li form input { left: 360px; width: 70px; }
/* log */
#searchbars ul li + li + li + li + li form input { left: 475px; width: 50px;}
#searchbars ul li + li + li + li + li form input { left: 475px; width: 50px; }
/* users */
#searchbars ul li + li + li + li + li + li form input { left: 570px; width: 60px;}
#searchbars ul li + li + li + li + li + li form input { left: 570px; width: 60px; }
#searchbars ul li form {
display: inline;
}
@ -617,15 +617,15 @@ ul#userinfo_stats li {
background: transparent url("images/hey-you-guys-T.png") no-repeat scroll 0;
}
/* artists */
#searchbars ul li + li form input:focus { background-image: url("images/hey-you-guys-A.png");}
#searchbars ul li + li form input:focus {background-image: url("images/hey-you-guys-A.png");}
/* requests */
#searchbars ul li + li + li form input:focus { background-image: url("images/hey-you-guys-R.png");}
#searchbars ul li + li + li form input:focus {background-image: url("images/hey-you-guys-R.png");}
/* forums */
#searchbars ul li + li + li + li form input:focus { background-image: url("images/hey-you-guys-F.png");}
#searchbars ul li + li + li + li form input:focus {background-image: url("images/hey-you-guys-F.png");}
/* log */
#searchbars ul li + li + li + li + li form input:focus { background-image: url("images/hey-you-guys-L.png");}
#searchbars ul li + li + li + li + li form input:focus {background-image: url("images/hey-you-guys-L.png");}
/* users */
#searchbars ul li + li + li + li + li + li form input:focus { background-image: url("images/hey-you-guys-U.png");}
#searchbars ul li + li + li + li + li + li form input:focus {background-image: url("images/hey-you-guys-U.png");}
/* artist autocomplete */
ul#artistcomplete {
@ -787,8 +787,8 @@ body#torrents .filter_torrents {
padding: 10px;
width: 75%;
margin: 0 auto 40px;
-moz-box-shadow:0 3px 10px #01A9D3, 0 -1px 5px #01A9D3;
-webkit-box-shadow:0 3px 10px #01A9D3, 0 -1px 5px #01A9D3;
-moz-box-shadow: 0 3px 10px #01A9D3, 0 -1px 5px #01A9D3;
-webkit-box-shadow: 0 3px 10px #01A9D3, 0 -1px 5px #01A9D3;
background: #222;
font-size: 85%;
}
@ -1037,7 +1037,7 @@ body#requests #content .main_column tr td {
}
body#requests #content .main_column tr td.label {
text-align: right;
font-weight:bold;
font-weight: bold;
}
body#requests #content .main_column tr td {
border: 1px dotted #555;
@ -1327,9 +1327,9 @@ body#forums .poll li.graph {
.poll span.right_poll {
background-color: #01a9d3;
opacity: 0.75;
display:block;
height:13px;
float:left
display: block;
height: 13px;
float: left;
}
.poll span.left_poll,
.poll span.right_poll {

View File

@ -750,9 +750,9 @@ ul .invitetree {
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
z-index: 1001;
-moz-opacity: 0.8;
opacity:.80;
opacity: .80;
filter: alpha(opacity=80);
}
@ -764,7 +764,7 @@ ul .invitetree {
width: 90%;
height: 90%;
padding: 0px;
z-index:1002;
z-index: 1002;
overflow: auto;
}

View File

@ -321,7 +321,7 @@ ul.thin li {
}
#searchbars ul li ul li {
margin: 0
margin: 0;
padding: 0;
display: block;
width: 100%;

View File

@ -2,7 +2,7 @@
.last_read {width: 15px; height: 15px; background: url(images/go_last_read.png) no-repeat center center; margin-left: 5px;}
.last_read a { border: none; width: 100%; height: 100%; display: block; }
.last_read a:hover { border: none; }
strong.quoteheader {color: #666}
strong.quoteheader {color: #666;}
ul.collage_images {
width: 650px !important;
@ -27,8 +27,8 @@ ul.collage_images img {
}
tr.torrent .bookmark > a:before { content:""; }
tr.torrent .bookmark > a:after { content:""; }
tr.torrent .bookmark > a:before { content: ""; }
tr.torrent .bookmark > a:after { content: ""; }
.navigation_list li {
margin-left: 20px;

View File

@ -765,8 +765,8 @@ ul.collage_images img {
}
tr.torrent .bookmark > a:before { content:""; }
tr.torrent .bookmark > a:after { content:""; }
tr.torrent .bookmark > a:before { content: ""; }
tr.torrent .bookmark > a:after { content: ""; }
.navigation_list li {
margin-left: 20px;