Empty commit

This commit is contained in:
Git 2013-05-01 08:00:16 +00:00
parent b055e9c6f1
commit 1ad3d86466
75 changed files with 619 additions and 552 deletions

View File

@ -223,7 +223,7 @@ public static function delete_artist($ArtistID) {
// Delete requests // Delete requests
$DB->query("SELECT RequestID FROM requests_artists WHERE ArtistID=".$ArtistID." AND ArtistID != 0"); $DB->query("SELECT RequestID FROM requests_artists WHERE ArtistID=".$ArtistID." AND ArtistID != 0");
$Requests = $DB->to_array(); $Requests = $DB->to_array();
foreach($Requests AS $Request) { foreach ($Requests AS $Request) {
list($RequestID) = $Request; list($RequestID) = $Request;
$DB->query('DELETE FROM requests WHERE ID='.$RequestID); $DB->query('DELETE FROM requests WHERE ID='.$RequestID);
$DB->query('DELETE FROM requests_votes WHERE RequestID='.$RequestID); $DB->query('DELETE FROM requests_votes WHERE RequestID='.$RequestID);

View File

@ -162,7 +162,6 @@ public static function proxy_url($Url) {
* @return string * @return string
*/ */
public static function process($Url, $Thumb = false) { public static function process($Url, $Thumb = false) {
global $LoggedUser;
if (empty($Url)) { if (empty($Url)) {
return ''; return '';
} }
@ -182,20 +181,11 @@ public static function process($Url, $Thumb = false) {
} }
} }
if (isset($LoggedUser['Permissions'])) { if (check_perms('site_proxy_images')) {
/* $ProcessedUrl = self::proxy_url($ProcessedUrl);
* We only want to apply the proxy and store the processed URL if the
* permissions were loaded before. This is necessary because self::process
* is used in Users::user_info which is called in script_start.php before
* the permissions are loaded, causing the own avatar to always load without
* proxy later on.
*/
if (check_perms('site_proxy_images')) {
$ProcessedUrl = self::proxy_url($ProcessedUrl);
}
self::store($Url . ($Thumb ? '_thumb' : ''), $ProcessedUrl);
} }
self::store($Url . ($Thumb ? '_thumb' : ''), $ProcessedUrl);
return $ProcessedUrl; return $ProcessedUrl;
} }

View File

@ -206,10 +206,10 @@ public function set($Name, $Value) {
*/ */
private function build_options() { private function build_options() {
$Options = array(); $Options = array();
foreach($this->Options as $Option => $Value) { foreach ($this->Options as $Option => $Value) {
$Options[] = "$Option = $Value"; $Options[] = "$Option = $Value";
} }
return implode(", ", $Options); return implode(', ', $Options);
} }
/** /**
@ -221,7 +221,7 @@ private function build_query() {
} }
$this->QueryString = "SELECT $this->Select\nFROM $this->Indexes"; $this->QueryString = "SELECT $this->Select\nFROM $this->Indexes";
if (!empty($this->Expressions)) { if (!empty($this->Expressions)) {
$this->Filters['expr'] = "MATCH('".implode(" ", $this->Expressions)."')"; $this->Filters['expr'] = "MATCH('".implode(' ', $this->Expressions)."')";
} }
if (!empty($this->Filters)) { if (!empty($this->Filters)) {
$this->QueryString .= "\nWHERE ".implode("\n\tAND ", $this->Filters); $this->QueryString .= "\nWHERE ".implode("\n\tAND ", $this->Filters);

View File

@ -412,7 +412,7 @@ private function parse ($Str) {
} }
// 6) Depending on what type of tag we're dealing with, create an array with the attribute and block. // 6) Depending on what type of tag we're dealing with, create an array with the attribute and block.
switch($TagName) { switch ($TagName) {
case 'inlineurl': case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>''); $Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
break; break;

View File

@ -362,7 +362,7 @@ function parse($Str) {
} }
// 6) Depending on what type of tag we're dealing with, create an array with the attribute and block. // 6) Depending on what type of tag we're dealing with, create an array with the attribute and block.
switch($TagName) { switch ($TagName) {
case 'inlineurl': case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>''); $Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
break; break;
@ -455,7 +455,7 @@ function to_html($Array) {
$Str.=$this->smileys($Block); $Str.=$this->smileys($Block);
continue; continue;
} }
switch($Block['Type']) { switch ($Block['Type']) {
case 'b': case 'b':
$Str.='<strong>'.$this->to_html($Block['Val']).'</strong>'; $Str.='<strong>'.$this->to_html($Block['Val']).'</strong>';
break; break;
@ -616,7 +616,7 @@ function raw_text($Array) {
$Str.=$Block; $Str.=$Block;
continue; continue;
} }
switch($Block['Type']) { switch ($Block['Type']) {
case 'b': case 'b':
case 'u': case 'u':

View File

@ -322,14 +322,14 @@ function parse($Str) {
// Find the internal block inside the tag // Find the internal block inside the tag
$Block = substr($Str, $i, $CloseTag-$i); // 5c) Get the contents between [open] and [/close] and call it the block. $Block = substr($Str, $i, $CloseTag - $i); // 5c) Get the contents between [open] and [/close] and call it the block.
$i = $CloseTag+strlen($TagName)+3; // 5d) Move the pointer past the end of the [/close] tag. $i = $CloseTag + strlen($TagName) + 3; // 5d) Move the pointer past the end of the [/close] tag.
} }
// 6) Depending on what type of tag we're dealing with, create an array with the attribute and block. // 6) Depending on what type of tag we're dealing with, create an array with the attribute and block.
switch($TagName) { switch ($TagName) {
case 'inlineurl': case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>''); $Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
break; break;
@ -419,7 +419,7 @@ function to_html($Array) {
$Str.=$this->smileys($Block); $Str.=$this->smileys($Block);
continue; continue;
} }
switch($Block['Type']) { switch ($Block['Type']) {
case 'b': case 'b':
$Str.='<strong>'.$this->to_html($Block['Val']).'</strong>'; $Str.='<strong>'.$this->to_html($Block['Val']).'</strong>';
break; break;
@ -577,7 +577,7 @@ function raw_text($Array) {
$Str.=$Block; $Str.=$Block;
continue; continue;
} }
switch($Block['Type']) { switch ($Block['Type']) {
case 'b': case 'b':
case 'u': case 'u':

View File

@ -466,12 +466,13 @@ public static function update_hash($GroupID) {
*/ */
public static function regenerate_filelist($TorrentID) { public static function regenerate_filelist($TorrentID) {
global $DB, $Cache; global $DB, $Cache;
$DB->query("SELECT tg.ID, $DB->query("
SELECT tg.ID,
tf.File tf.File
FROM torrents_files AS tf FROM torrents_files AS tf
JOIN torrents AS t ON t.ID=tf.TorrentID JOIN torrents AS t ON t.ID=tf.TorrentID
JOIN torrents_group AS tg ON tg.ID=t.GroupID JOIN torrents_group AS tg ON tg.ID=t.GroupID
WHERE tf.TorrentID = ".$TorrentID); WHERE tf.TorrentID = ".$TorrentID);
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false); list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
if (Misc::is_new_torrent($Contents)) { if (Misc::is_new_torrent($Contents)) {
@ -482,7 +483,7 @@ public static function regenerate_filelist($TorrentID) {
$FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : ''; $FilePath = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : '';
} }
list($TotalSize, $FileList) = $Tor->file_list(); list($TotalSize, $FileList) = $Tor->file_list();
foreach($FileList as $File) { foreach ($FileList as $File) {
$TmpFileList[] = self::filelist_format_file($File); $TmpFileList[] = self::filelist_format_file($File);
} }
$FileString = implode("\n", $TmpFileList); $FileString = implode("\n", $TmpFileList);

View File

@ -25,13 +25,13 @@ function build_table($MemKey, $Query) {
$Table = $DB->to_array(); $Table = $DB->to_array();
// Give a little variation to the cache length, so all the tables don't expire at the same time // Give a little variation to the cache length, so all the tables don't expire at the same time
$Cache->cache_value($MemKey, $Table, 3600*24*rand(800,1000)*0.001); $Cache->cache_value($MemKey, $Table, 3600 * 24 * rand(800, 1000) * 0.001);
return $Table; return $Table;
} }
function table_query($TableName) { function table_query($TableName) {
switch($TableName) { switch ($TableName) {
case 'uploaded': case 'uploaded':
$Query = "SELECT Uploaded FROM users_main WHERE Enabled='1' AND Uploaded>0 ORDER BY Uploaded;"; $Query = "SELECT Uploaded FROM users_main WHERE Enabled='1' AND Uploaded>0 ORDER BY Uploaded;";
break; break;
@ -98,14 +98,14 @@ function overall_score($Uploaded, $Downloaded, $Uploads, $Requests, $Posts, $Bou
if (in_array(false, func_get_args(), true)) { if (in_array(false, func_get_args(), true)) {
return false; return false;
} }
$TotalScore += $Uploaded*15; $TotalScore += $Uploaded * 15;
$TotalScore += $Downloaded*8; $TotalScore += $Downloaded * 8;
$TotalScore += $Uploads*25; $TotalScore += $Uploads * 25;
$TotalScore += $Requests*2; $TotalScore += $Requests * 2;
$TotalScore += $Posts; $TotalScore += $Posts;
$TotalScore += $Bounty; $TotalScore += $Bounty;
$TotalScore += $Artists; $TotalScore += $Artists;
$TotalScore /= (15+8+25+2+1+1+1); $TotalScore /= (15 + 8 + 25 + 2 + 1 + 1 + 1);
$TotalScore *= $Ratio; $TotalScore *= $Ratio;
return $TotalScore; return $TotalScore;
} }

View File

@ -103,8 +103,6 @@ public static function user_info($UserID) {
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000); $Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
} }
// Image proxy
$UserInfo['Avatar'] = ImageTools::process($UserInfo['Avatar']);
return $UserInfo; return $UserInfo;
} }
@ -542,6 +540,7 @@ public static function get_bookmarks ($UserID)
*/ */
public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $ReturnHTML = True) { public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $ReturnHTML = True) {
global $LoggedUser; global $LoggedUser;
$Avatar = ImageTools::process($Avatar);
// case 1 is avatars disabled // case 1 is avatars disabled
switch ($Setting) { switch ($Setting) {
case 0: case 0:

View File

@ -2,8 +2,8 @@
//Include all the basic stuff... //Include all the basic stuff...
enforce_login(); enforce_login();
if(isset($_GET['method'])) { if (isset($_GET['method'])) {
switch($_GET['method']) { switch ($_GET['method']) {
case 'transcode': case 'transcode':
include(SERVER_ROOT.'/sections/ajax/better/transcode.php'); include(SERVER_ROOT.'/sections/ajax/better/transcode.php');
break; break;

View File

@ -61,7 +61,7 @@
if(empty($_GET['type']) || $_GET['type'] == 'main') { if(empty($_GET['type']) || $_GET['type'] == 'main') {
include(SERVER_ROOT.'/sections/ajax/forum/main.php'); include(SERVER_ROOT.'/sections/ajax/forum/main.php');
} else { } else {
switch($_GET['type']) { switch ($_GET['type']) {
case 'viewforum': case 'viewforum':
include(SERVER_ROOT.'/sections/ajax/forum/forum.php'); include(SERVER_ROOT.'/sections/ajax/forum/forum.php');
break; break;

View File

@ -21,7 +21,7 @@
$SS->set_filter('visible', array(1)); $SS->set_filter('visible', array(1));
} }
} else { } else {
switch($_GET['type']) { switch ($_GET['type']) {
case 'created': case 'created':
$Title = 'My requests'; $Title = 'My requests';
$SS->set_filter('userid', array($LoggedUser['ID'])); $SS->set_filter('userid', array($LoggedUser['ID']));
@ -231,27 +231,27 @@
} }
} }
switch($CurrentOrder) { switch ($CurrentOrder) {
case 'votes' : case 'votes' :
$OrderBy = "Votes"; $OrderBy = 'Votes';
break; break;
case 'bounty' : case 'bounty' :
$OrderBy = "Bounty"; $OrderBy = 'Bounty';
break; break;
case 'created' : case 'created' :
$OrderBy = "TimeAdded"; $OrderBy = 'TimeAdded';
break; break;
case 'lastvote' : case 'lastvote' :
$OrderBy = "LastVote"; $OrderBy = 'LastVote';
break; break;
case 'filled' : case 'filled' :
$OrderBy = "TimeFilled"; $OrderBy = 'TimeFilled';
break; break;
case 'year' : case 'year' :
$OrderBy = "Year"; $OrderBy = 'Year';
break; break;
default : default :
$OrderBy = "TimeAdded"; $OrderBy = 'TimeAdded';
break; break;
} }
//print($Way); print($OrderBy); die(); //print($Way); print($OrderBy); die();

View File

@ -2,16 +2,16 @@
// Already done in /sections/ajax/index.php // Already done in /sections/ajax/index.php
//enforce_login(); //enforce_login();
if(!check_perms('site_top10')){ if (!check_perms('site_top10')){
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die(); die();
} }
if(empty($_GET['type']) || $_GET['type'] == 'torrents') { if (empty($_GET['type']) || $_GET['type'] == 'torrents') {
include(SERVER_ROOT.'/sections/ajax/top10/torrents.php'); include(SERVER_ROOT.'/sections/ajax/top10/torrents.php');
} else { } else {
switch($_GET['type']) { switch ($_GET['type']) {
case 'users' : case 'users' :
include(SERVER_ROOT.'/sections/ajax/top10/users.php'); include(SERVER_ROOT.'/sections/ajax/top10/users.php');
break; break;

View File

@ -211,7 +211,7 @@ function compare($X, $Y) {
<div class="box center"> <div class="box center">
<? <?
foreach ($UsedReleases as $ReleaseID) { foreach ($UsedReleases as $ReleaseID) {
switch($ReleaseTypes[$ReleaseID]) { switch ($ReleaseTypes[$ReleaseID]) {
case "Remix" : case "Remix" :
$DisplayName = "Remixes"; $DisplayName = "Remixes";
break; break;
@ -300,7 +300,7 @@ function compare($X, $Y) {
$TorrentTags = new Tags($TagList, false); $TorrentTags = new Tags($TagList, false);
if ($ReleaseType != $LastReleaseType) { if ($ReleaseType != $LastReleaseType) {
switch($ReleaseTypes[$ReleaseType]) { switch ($ReleaseTypes[$ReleaseType]) {
case "Remix" : case "Remix" :
$DisplayName = "Remixes"; $DisplayName = "Remixes";
break; break;
@ -339,7 +339,7 @@ function compare($X, $Y) {
} }
switch($ReleaseType){ switch ($ReleaseType){
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
case 1024: case 1024:
case 1021: case 1021:

View File

@ -2,8 +2,8 @@
//Include all the basic stuff... //Include all the basic stuff...
enforce_login(); enforce_login();
if(isset($_GET['method'])) { if (isset($_GET['method'])) {
switch($_GET['method']) { switch ($_GET['method']) {
case 'transcode': case 'transcode':
include(SERVER_ROOT.'/sections/better/transcode.php'); include(SERVER_ROOT.'/sections/better/transcode.php');
break; break;

View File

@ -5,8 +5,10 @@
// Number of users per page // Number of users per page
define('BOOKMARKS_PER_PAGE', '20'); define('BOOKMARKS_PER_PAGE', '20');
if (empty($_REQUEST['action'])) { $_REQUEST['action'] = 'view'; } if (empty($_REQUEST['action'])) {
switch($_REQUEST['action']) { $_REQUEST['action'] = 'view';
}
switch ($_REQUEST['action']) {
case 'add': case 'add':
require(SERVER_ROOT.'/sections/bookmarks/add.php'); require(SERVER_ROOT.'/sections/bookmarks/add.php');
break; break;
@ -31,7 +33,9 @@
break; break;
case 'edit': case 'edit':
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = false; } if (empty($_REQUEST['type'])) {
$_REQUEST['type'] = false;
}
switch ($_REQUEST['type']) { switch ($_REQUEST['type']) {
case 'torrents': case 'torrents':
require(SERVER_ROOT.'/sections/bookmarks/edit_torrents.php'); require(SERVER_ROOT.'/sections/bookmarks/edit_torrents.php');
@ -42,7 +46,9 @@
case 'view': case 'view':
if (empty($_REQUEST['type'])) { $_REQUEST['type'] = 'torrents'; } if (empty($_REQUEST['type'])) {
$_REQUEST['type'] = 'torrents';
}
switch ($_REQUEST['type']) { switch ($_REQUEST['type']) {
case 'torrents': case 'torrents':
require(SERVER_ROOT.'/sections/bookmarks/torrents.php'); require(SERVER_ROOT.'/sections/bookmarks/torrents.php');

View File

@ -8,21 +8,23 @@
require(SERVER_ROOT.'/sections/comments/post.php'); // Post formatting function. require(SERVER_ROOT.'/sections/comments/post.php'); // Post formatting function.
$action = ''; $action = '';
if(!empty($_REQUEST['action'])) if (!empty($_REQUEST['action'])) {
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
}
/** /**
* Getting a userid if applicable * Getting a userid if applicable
*/ */
if(isset($_GET['id'])) { if (isset($_GET['id'])) {
$UserID = $_GET['id']; $UserID = $_GET['id'];
if(!is_number($UserID)) if (!is_number($UserID)) {
error(404); error(404);
}
$UserInfo = Users::user_info($UserID); $UserInfo = Users::user_info($UserID);
$Username = $UserInfo['Username']; $Username = $UserInfo['Username'];
if($LoggedUser['ID'] == $UserID) { if ($LoggedUser['ID'] == $UserID) {
$Self = true; $Self = true;
} else { } else {
$Self = false; $Self = false;
@ -47,7 +49,7 @@
} }
list($Page,$Limit) = Format::page_limit($PerPage); list($Page,$Limit) = Format::page_limit($PerPage);
switch($action) { switch ($action) {
case 'requests': case 'requests':
require (SERVER_ROOT.'/sections/comments/requestcomments.php'); require (SERVER_ROOT.'/sections/comments/requestcomments.php');
break; break;

View File

@ -21,26 +21,22 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
?> ?>
<table class="forum_post box vertical_margin<?=$noavatar ? ' noavatar' : '' ?>" id="post<?=$PostID?>"> <table class="forum_post box vertical_margin<?=$noavatar ? ' noavatar' : '' ?>" id="post<?=$PostID?>">
<colgroup> <colgroup>
<? if (empty($UserInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="<?=empty($UserInfo['DisableAvatars']) ? 2 : 1 ?>"> <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
<span style="float: left;"><a href="<?=$permalink ?>">#<?=$PostID?></a> <span style="float: left;"><a href="<?=$permalink ?>">#<?=$PostID?></a>
<?=$postheader ?> <?=$postheader ?>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? if ($UserInfo['Avatar']) { ?> <?=Users::show_avatar($UserInfo['Avatar'], $UserInfo['Username'], $HeavyInfo['DisableAvatars'])?>
<img src="<?=$UserInfo['Avatar']?>" width="150" alt="<?=$UserInfo['Username']?>'s avatar" />
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
<? } ?>
</td> </td>
<? } ?> <? } ?>
<td class="body" valign="top"> <td class="body" valign="top">

View File

@ -5,8 +5,8 @@
if (!isset($_REQUEST['action'])) { if (!isset($_REQUEST['action'])) {
include(SERVER_ROOT.'/sections/donate/donate.php'); include(SERVER_ROOT.'/sections/donate/donate.php');
} else { } else {
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'ipn': // Paypal hits this page when a donation is received case 'ipn': // PayPal hits this page when a donation is received
include(SERVER_ROOT.'/sections/donate/ipn.php'); include(SERVER_ROOT.'/sections/donate/ipn.php');
break; break;

View File

@ -1,21 +1,21 @@
<? <?
if(!check_perms('site_admin_forums')) { if (!check_perms('site_admin_forums')) {
error(403); error(403);
} }
if(empty($_GET['postid']) || !is_number($_GET['postid'])) { if (empty($_GET['postid']) || !is_number($_GET['postid'])) {
die(); die();
} }
$PostID = $_GET['postid']; $PostID = $_GET['postid'];
if(!isset($_GET['depth']) || !is_number($_GET['depth'])) { if (!isset($_GET['depth']) || !is_number($_GET['depth'])) {
die(); die();
} }
$Depth = $_GET['depth']; $Depth = $_GET['depth'];
if(empty($_GET['type']) || !in_array($_GET['type'], array('forums', 'collages', 'requests', 'torrents', 'artist'))) { if (empty($_GET['type']) || !in_array($_GET['type'], array('forums', 'collages', 'requests', 'torrents', 'artist'))) {
die(); die();
} }
$Type = $_GET['type']; $Type = $_GET['type'];
@ -24,7 +24,7 @@
$Text = new TEXT; $Text = new TEXT;
$Edits = $Cache->get_value($Type.'_edits_'.$PostID); $Edits = $Cache->get_value($Type.'_edits_'.$PostID);
if(!is_array($Edits)) { if (!is_array($Edits)) {
$DB->query("SELECT ce.EditUser, ce.EditTime, ce.Body $DB->query("SELECT ce.EditUser, ce.EditTime, ce.Body
FROM comments_edits AS ce FROM comments_edits AS ce
WHERE Page = '".$Type."' AND PostID = ".$PostID." WHERE Page = '".$Type."' AND PostID = ".$PostID."
@ -34,11 +34,11 @@
} }
list($UserID, $Time) = $Edits[$Depth]; list($UserID, $Time) = $Edits[$Depth];
if($Depth != 0) { if ($Depth != 0) {
list(,,$Body) = $Edits[$Depth - 1]; list(,,$Body) = $Edits[$Depth - 1];
} else { } else {
//Not an edit, have to get from the original //Not an edit, have to get from the original
switch($Type) { switch ($Type) {
case 'forums' : case 'forums' :
//Get from normal forum stuffs //Get from normal forum stuffs
$DB->query("SELECT Body $DB->query("SELECT Body
@ -63,7 +63,7 @@
<br /> <br />
<br /> <br />
<? if($Depth < count($Edits)) { ?> <? if ($Depth < count($Edits)) { ?>
<a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth + 1)?>); return false;">&laquo;</a> <a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth + 1)?>); return false;">&laquo;</a>
<?=(($Depth == 0) ? 'Last edited by' : 'Edited by')?> <?=(($Depth == 0) ? 'Last edited by' : 'Edited by')?>
<?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($Time,2,true,true)?> <?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($Time,2,true,true)?>
@ -71,7 +71,7 @@
<em>Original Post</em> <em>Original Post</em>
<? } <? }
if($Depth > 0) { ?> if ($Depth > 0) { ?>
<a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth - 1)?>); return false;">&raquo;</a> <a href="#edit_info_<?=$PostID?>" onclick="LoadEdit('<?=$Type?>', <?=$PostID?>, <?=($Depth - 1)?>); return false;">&raquo;</a>
<? } ?> <? } ?>

View File

@ -46,13 +46,13 @@
<? } ?> <? } ?>
<table class="forum_post box vertical_margin" style="text-align: left;"> <table class="forum_post box vertical_margin" style="text-align: left;">
<colgroup> <colgroup>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>"> <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
<span style="float: left;"><a href="#newthreadpreview">#XXXXXX</a> <span style="float: left;"><a href="#newthreadpreview">#XXXXXX</a>
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong> by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
Just now Just now
@ -65,13 +65,11 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? if (!empty($LoggedUser['Avatar'])) { ?> <?=Users::show_avatar($LoggedUser['Avatar'], $LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
<? } ?>
</td> </td>
<? } ?>
<td class="body" valign="top"> <td class="body" valign="top">
<div id="contentpreview" style="text-align: left;"></div> <div id="contentpreview" style="text-align: left;"></div>
</td> </td>

View File

@ -72,7 +72,7 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table class="friends_table vertical_margin"> <table class="friends_table vertical_margin">
<tr class="colhead"> <tr class="colhead">
<td colspan="3"> <td colspan="<?=Users::has_avatars_enabled() ? 3 : 2?>">
<span style="float: left;"><?=Users::format_username($FriendID, true, true, true, true)?> <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> &nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
@ -90,20 +90,15 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="50px" valign="top"> <? if (Users::has_avatars_enabled()) { ?>
<? <td class="col_avatar avatar" valign="top">
if (empty($HeavyInfo['DisableAvatars'])) { <?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
if (!empty($Avatar)) { ?>
<img src="<?=ImageTools::process($Avatar)?>" alt="<?=$Username?>'s avatar" width="50px" />
<? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="50px" alt="Default avatar" />
<? }
} ?>
</td> </td>
<? }?>
<td valign="top"> <td valign="top">
<input type="hidden" name="friendid" value="<?=$FriendID?>" /> <input type="hidden" name="friendid" value="<?=$FriendID?>" />
<textarea name="comment" rows="4" cols="80"><?=$Comment?></textarea> <textarea name="comment" rows="4" cols="65"><?=$Comment?></textarea>
</td> </td>
<td class="left" valign="top"> <td class="left" valign="top">
<input type="submit" name="action" value="Update" /><br /> <input type="submit" name="action" value="Update" /><br />

View File

@ -1,21 +1,24 @@
<? <?
enforce_login(); enforce_login();
$StaffIDs = $Cache->get_value("staff_ids"); $StaffIDs = $Cache->get_value('staff_ids');
if(!is_array($StaffIDs)) { if (!is_array($StaffIDs)) {
$DB->query("SELECT m.ID, m.Username $DB->query("
SELECT m.ID, m.Username
FROM users_main AS m FROM users_main AS m
JOIN permissions AS p ON p.ID=m.PermissionID JOIN permissions AS p ON p.ID=m.PermissionID
WHERE p.DisplayStaff='1'"); WHERE p.DisplayStaff='1'");
while(list($StaffID, $StaffName) = $DB->next_record()) { while (list($StaffID, $StaffName) = $DB->next_record()) {
$StaffIDs[$StaffID] = $StaffName; $StaffIDs[$StaffID] = $StaffName;
} }
uasort($StaffIDs, 'strcasecmp'); uasort($StaffIDs, 'strcasecmp');
$Cache->cache_value("staff_ids", $StaffIDs); $Cache->cache_value('staff_ids', $StaffIDs);
} }
if(!isset($_REQUEST['action'])) { $_REQUEST['action'] = ''; } if (!isset($_REQUEST['action'])) {
switch($_REQUEST['action']) { $_REQUEST['action'] = '';
}
switch ($_REQUEST['action']) {
case 'takecompose': case 'takecompose':
require('takecompose.php'); require('takecompose.php');
break; break;

View File

@ -1,17 +1,17 @@
<? <?
if(!check_perms('site_moderate_forums')) { if (!check_perms('site_moderate_forums')) {
error(403); error(403);
} }
if(empty($Return)) { if (empty($Return)) {
$ToID = $_GET['to']; $ToID = $_GET['to'];
if($ToID == $LoggedUser['ID']) { if ($ToID == $LoggedUser['ID']) {
error("You cannot start a conversation with yourself!"); error("You cannot start a conversation with yourself!");
header('Location: inbox.php'); header('Location: inbox.php');
} }
} }
if(!$ToID || !is_number($ToID)) { if (!$ToID || !is_number($ToID)) {
error(404); error(404);
} }
@ -19,26 +19,26 @@
$Type = $_GET['type']; $Type = $_GET['type'];
$ThingID= $_GET['thingid']; $ThingID= $_GET['thingid'];
if(!$ReportID || !is_number($ReportID) || !$ThingID || !is_number($ThingID) || !$Type) { if (!$ReportID || !is_number($ReportID) || !$ThingID || !is_number($ThingID) || !$Type) {
error(403); error(403);
} }
if(!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) { if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) {
error(403); error(403);
} }
$DB->query("SELECT Username FROM users_main WHERE ID='$ToID'"); $DB->query("SELECT Username FROM users_main WHERE ID='$ToID'");
list($ComposeToUsername) = $DB->next_record(); list($ComposeToUsername) = $DB->next_record();
if(!$ComposeToUsername) { if (!$ComposeToUsername) {
error(404); error(404);
} }
View::show_header('Compose', 'inbox,bbcode'); View::show_header('Compose', 'inbox,bbcode');
// $TypeLink is placed directly in the <textarea> when composing a PM // $TypeLink is placed directly in the <textarea> when composing a PM
switch($Type) { switch ($Type) {
case "user" : case "user" :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ThingID); $DB->query("SELECT Username FROM users_main WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No user with the reported ID found"; $Error = "No user with the reported ID found";
} else { } else {
list($Username) = $DB->next_record(); list($Username) = $DB->next_record();
@ -49,7 +49,7 @@
case "request" : case "request" :
case "request_update" : case "request_update" :
$DB->query("SELECT Title FROM requests WHERE ID=".$ThingID); $DB->query("SELECT Title FROM requests WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No request with the reported ID found"; $Error = "No request with the reported ID found";
} else { } else {
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
@ -59,7 +59,7 @@
break; break;
case "collage" : case "collage" :
$DB->query("SELECT Name FROM collages WHERE ID=".$ThingID); $DB->query("SELECT Name FROM collages WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No collage with the reported ID found"; $Error = "No collage with the reported ID found";
} else { } else {
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
@ -69,7 +69,7 @@
break; break;
case "thread" : case "thread" :
$DB->query("SELECT Title FROM forums_topics WHERE ID=".$ThingID); $DB->query("SELECT Title FROM forums_topics WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No forum thread with the reported ID found"; $Error = "No forum thread with the reported ID found";
} else { } else {
list($Title) = $DB->next_record(); list($Title) = $DB->next_record();
@ -84,7 +84,7 @@
$PerPage = POSTS_PER_PAGE; $PerPage = POSTS_PER_PAGE;
} }
$DB->query("SELECT p.ID, p.Body, p.TopicID, (SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = p.TopicID AND forums_posts.ID<=p.ID) AS PostNum FROM forums_posts AS p WHERE ID=".$ThingID); $DB->query("SELECT p.ID, p.Body, p.TopicID, (SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = p.TopicID AND forums_posts.ID<=p.ID) AS PostNum FROM forums_posts AS p WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No forum post with the reported ID found"; $Error = "No forum post with the reported ID found";
} else { } else {
list($PostID,$Body,$TopicID,$PostNum) = $DB->next_record(); list($PostID,$Body,$TopicID,$PostNum) = $DB->next_record();
@ -94,7 +94,7 @@
break; break;
case "requests_comment" : case "requests_comment" :
$DB->query("SELECT rc.RequestID, rc.Body, (SELECT COUNT(ID) FROM requests_comments WHERE ID <= ".$ThingID." AND requests_comments.RequestID = rc.RequestID) AS CommentNum FROM requests_comments AS rc WHERE ID=".$ThingID); $DB->query("SELECT rc.RequestID, rc.Body, (SELECT COUNT(ID) FROM requests_comments WHERE ID <= ".$ThingID." AND requests_comments.RequestID = rc.RequestID) AS CommentNum FROM requests_comments AS rc WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No request comment with the reported ID found"; $Error = "No request comment with the reported ID found";
} else { } else {
list($RequestID, $Body, $PostNum) = $DB->next_record(); list($RequestID, $Body, $PostNum) = $DB->next_record();
@ -105,7 +105,7 @@
break; break;
case "torrents_comment" : case "torrents_comment" :
$DB->query("SELECT tc.GroupID, tc.Body, (SELECT COUNT(ID) FROM torrents_comments WHERE ID <= ".$ThingID." AND torrents_comments.GroupID = tc.GroupID) AS CommentNum FROM torrents_comments AS tc WHERE ID=".$ThingID); $DB->query("SELECT tc.GroupID, tc.Body, (SELECT COUNT(ID) FROM torrents_comments WHERE ID <= ".$ThingID." AND torrents_comments.GroupID = tc.GroupID) AS CommentNum FROM torrents_comments AS tc WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No torrent comment with the reported ID found"; $Error = "No torrent comment with the reported ID found";
} else { } else {
list($GroupID, $Body, $PostNum) = $DB->next_record(); list($GroupID, $Body, $PostNum) = $DB->next_record();
@ -116,7 +116,7 @@
break; break;
case "collages_comment" : case "collages_comment" :
$DB->query("SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$ThingID." AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID=".$ThingID); $DB->query("SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$ThingID." AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID=".$ThingID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No collage comment with the reported ID found"; $Error = "No collage comment with the reported ID found";
} else { } else {
list($CollageID, $Body, $PostNum) = $DB->next_record(); list($CollageID, $Body, $PostNum) = $DB->next_record();
@ -130,7 +130,7 @@
error("Incorrect type"); error("Incorrect type");
break; break;
} }
if(isset($Error)) { if (isset($Error)) {
error($Error); error($Error);
} }

View File

@ -5,7 +5,7 @@
$_REQUEST['action'] = ''; $_REQUEST['action'] = '';
} }
switch($_REQUEST['action']){ switch ($_REQUEST['action']){
case 'report': case 'report':
include('report.php'); include('report.php');
break; break;

View File

@ -2,30 +2,32 @@
authorize(); authorize();
if(empty($_POST['toid'])) { error(404); } if (empty($_POST['toid'])) {
error(404);
}
if(!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$_POST['toid']])) { if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$_POST['toid']])) {
error(403); error(403);
} }
if (isset($_POST['convid']) && is_number($_POST['convid'])) { if (isset($_POST['convid']) && is_number($_POST['convid'])) {
$ConvID = $_POST['convid']; $ConvID = $_POST['convid'];
$Subject=''; $Subject = '';
$ToID = explode(',', $_POST['toid']); $ToID = explode(',', $_POST['toid']);
foreach($ToID as $TID) { foreach ($ToID as $TID) {
if(!is_number($TID)) { if (!is_number($TID)) {
$Err = "A recipient does not exist."; $Err = 'A recipient does not exist.';
} }
} }
$DB->query("SELECT UserID FROM pm_conversations_users WHERE UserID='$LoggedUser[ID]' AND ConvID='$ConvID'"); $DB->query("SELECT UserID FROM pm_conversations_users WHERE UserID='$LoggedUser[ID]' AND ConvID='$ConvID'");
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
error(403); error(403);
} }
} else { } else {
$ConvID=''; $ConvID = '';
if(!is_number($_POST['toid'])) { if (!is_number($_POST['toid'])) {
$Err = "This recipient does not exist."; $Err = 'This recipient does not exist.';
} else { } else {
$ToID = $_POST['toid']; $ToID = $_POST['toid'];
} }
@ -35,11 +37,11 @@
} }
} }
$Body = trim($_POST['body']); $Body = trim($_POST['body']);
if($Body === '' || $Body === false) { if ($Body === '' || $Body === false) {
$Err = "You can't send a message without a body!"; $Err = "You can't send a message without a body!";
} }
if(!empty($Err)) { if (!empty($Err)) {
error($Err); error($Err);
//header('Location: inbox.php?action=compose&to='.$_POST['toid']); //header('Location: inbox.php?action=compose&to='.$_POST['toid']);
$ToID = $_POST['toid']; $ToID = $_POST['toid'];

View File

@ -1,20 +1,20 @@
<? <?
authorize(); authorize();
if(empty($_POST['id']) || !is_number($_POST['id']) || empty($_POST['type']) || ($_POST['type'] != "request_update" && empty($_POST['reason']))) { if (empty($_POST['id']) || !is_number($_POST['id']) || empty($_POST['type']) || ($_POST['type'] != 'request_update' && empty($_POST['reason']))) {
error(404); error(404);
} }
include(SERVER_ROOT.'/sections/reports/array.php'); include(SERVER_ROOT.'/sections/reports/array.php');
if(!array_key_exists($_POST['type'], $Types)) { if (!array_key_exists($_POST['type'], $Types)) {
error(403); error(403);
} }
$Short = $_POST['type']; $Short = $_POST['type'];
$Type = $Types[$Short]; $Type = $Types[$Short];
$ID = $_POST['id']; $ID = $_POST['id'];
if($Short == "request_update") { if ($Short == "request_update") {
if(empty($_POST['year']) || !is_number($_POST['year'])) { if (empty($_POST['year']) || !is_number($_POST['year'])) {
error('Year must be specified.'); error('Year must be specified.');
header('Location: reports.php?action=report&type=request_update&id='.$ID); header('Location: reports.php?action=report&type=request_update&id='.$ID);
die(); die();
@ -27,7 +27,7 @@
$Reason = $_POST['reason']; $Reason = $_POST['reason'];
} }
switch($Short) { switch ($Short) {
case "request" : case "request" :
case "request_update" : case "request_update" :
$Link = 'requests.php?action=view&id='.$ID; $Link = 'requests.php?action=view&id='.$ID;

View File

@ -8,8 +8,8 @@
include('array.php'); include('array.php');
if(isset($_REQUEST['action'])) { if (isset($_REQUEST['action'])) {
switch($_REQUEST['action']){ switch ($_REQUEST['action']){
case 'report': case 'report':
include('report.php'); include('report.php');
break; break;
@ -57,7 +57,7 @@
break; break;
} }
} else { } else {
if(isset($_GET['view'])) { if (isset($_GET['view'])) {
include(SERVER_ROOT.'/sections/reportsv2/static.php'); include(SERVER_ROOT.'/sections/reportsv2/static.php');
} else { } else {
include(SERVER_ROOT.'/sections/reportsv2/views.php'); include(SERVER_ROOT.'/sections/reportsv2/views.php');

View File

@ -39,7 +39,7 @@
$Order = "ORDER BY r.ReportedTime ASC"; $Order = "ORDER BY r.ReportedTime ASC";
if (!$ID) { if (!$ID) {
switch($View) { switch ($View) {
case 'resolved' : case 'resolved' :
$Title = 'All the old smelly reports'; $Title = 'All the old smelly reports';
$Where = "WHERE r.Status = 'Resolved'"; $Where = "WHERE r.Status = 'Resolved'";
@ -54,7 +54,7 @@
break; break;
} }
} else { } else {
switch($View) { switch ($View) {
case 'staff' : case 'staff' :
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID); $DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
list($Username) = $DB->next_record(); list($Username) = $DB->next_record();

View File

@ -15,7 +15,7 @@
if (!isset($_REQUEST['action'])) { if (!isset($_REQUEST['action'])) {
include(SERVER_ROOT.'/sections/requests/requests.php'); include(SERVER_ROOT.'/sections/requests/requests.php');
} else { } else {
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'new': case 'new':
case 'edit': case 'edit':
include(SERVER_ROOT.'/sections/requests/new_edit.php'); include(SERVER_ROOT.'/sections/requests/new_edit.php');
@ -187,9 +187,9 @@
$DB->query("DELETE FROM requests_comments WHERE ID='".db_string($_GET['postid'])."'"); $DB->query("DELETE FROM requests_comments WHERE ID='".db_string($_GET['postid'])."'");
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post //We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE); $ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE); $LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) { for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('request_comments_'.$RequestID.'_catalogue_'.$i); $Cache->delete('request_comments_'.$RequestID.'_catalogue_'.$i);
} }

View File

@ -302,27 +302,27 @@
} }
} }
switch($CurrentOrder) { switch ($CurrentOrder) {
case 'votes' : case 'votes' :
$OrderBy = "Votes"; $OrderBy = 'Votes';
break; break;
case 'bounty' : case 'bounty' :
$OrderBy = "Bounty"; $OrderBy = 'Bounty';
break; break;
case 'created' : case 'created' :
$OrderBy = "TimeAdded"; $OrderBy = 'TimeAdded';
break; break;
case 'lastvote' : case 'lastvote' :
$OrderBy = "LastVote"; $OrderBy = 'LastVote';
break; break;
case 'filled' : case 'filled' :
$OrderBy = "TimeFilled"; $OrderBy = 'TimeFilled';
break; break;
case 'year' : case 'year' :
$OrderBy = "Year"; $OrderBy = 'Year';
break; break;
default : default :
$OrderBy = "TimeAdded"; $OrderBy = 'TimeAdded';
break; break;
} }
//print($Way); print($OrderBy); die(); //print($Way); print($OrderBy); die();
@ -390,8 +390,8 @@
<td class="label">Tags (comma-separated):</td> <td class="label">Tags (comma-separated):</td>
<td> <td>
<input type="text" name="tags" size="60" value="<?= (!empty($TagNames) ? display_str(implode(', ', $TagNames)) : '') ?>" />&nbsp; <input type="text" name="tags" size="60" value="<?= (!empty($TagNames) ? display_str(implode(', ', $TagNames)) : '') ?>" />&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_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_type1" value="1"<? Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td> </td>
</tr> </tr>
<tr id="include_filled"> <tr id="include_filled">

View File

@ -118,7 +118,7 @@ if (empty($_GET['type'])) {
$Wheres[] = "(TorrentID = 0 OR (TimeFilled > (NOW() - INTERVAL 3 DAY)))"; $Wheres[] = "(TorrentID = 0 OR (TimeFilled > (NOW() - INTERVAL 3 DAY)))";
} }
} else { } else {
switch($_GET['type']) { switch ($_GET['type']) {
case 'created': case 'created':
$Title = 'My requests'; $Title = 'My requests';
$Wheres[] = "r.UserID = ".$LoggedUser['ID']; $Wheres[] = "r.UserID = ".$LoggedUser['ID'];
@ -161,7 +161,7 @@ if (empty($_GET['order'])) {
$CurrentURL = get_url(array('order', 'sort')); $CurrentURL = get_url(array('order', 'sort'));
switch($CurrentOrder) { switch ($CurrentOrder) {
case 'name' : case 'name' :
$OrderBy = "r.Title"; $OrderBy = "r.Title";
break; break;

View File

@ -1,10 +1,10 @@
<? <?
//Include all the basic stuff... //Include all the basic stuff...
enforce_login(); enforce_login();
if(!isset($_GET['p'])) { if (!isset($_GET['p'])) {
require(SERVER_ROOT.'/sections/rules/rules.php'); require(SERVER_ROOT.'/sections/rules/rules.php');
} else { } else {
switch($_GET['p']) { switch ($_GET['p']) {
case 'ratio': case 'ratio':
require(SERVER_ROOT.'/sections/rules/ratio.php'); require(SERVER_ROOT.'/sections/rules/ratio.php');
break; break;

View File

@ -1,8 +1,9 @@
<? <?
enforce_login(); enforce_login();
if(!isset($_REQUEST['action'])) if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = ''; $_REQUEST['action'] = '';
}
// Get user level // Get user level
$DB->query(" $DB->query("
@ -10,8 +11,8 @@
i.SupportFor, i.SupportFor,
p.DisplayStaff p.DisplayStaff
FROM users_info as i FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID JOIN permissions as p ON p.ID = m.PermissionID
WHERE i.UserID = ".$LoggedUser['ID'] WHERE i.UserID = ".$LoggedUser['ID']
); );
list($SupportFor, $DisplayStaff) = $DB->next_record(); list($SupportFor, $DisplayStaff) = $DB->next_record();
@ -20,7 +21,7 @@
// Logged in user is Staff or FLS // Logged in user is Staff or FLS
$IsFLS = ($IsStaff || $LoggedUser['ExtraClasses'][41]); $IsFLS = ($IsStaff || $LoggedUser['ExtraClasses'][41]);
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'viewconv': case 'viewconv':
require('viewconv.php'); require('viewconv.php');
break; break;

View File

@ -1,21 +1,24 @@
<? <?
if(!check_perms('admin_login_watch')) { error(403); } if (!check_perms('admin_login_watch')) {
error(403);
}
if(isset($_POST['submit']) && isset($_POST['id']) && $_POST['submit'] == 'Unban' && is_number($_POST['id'])){ if (isset($_POST['submit']) && isset($_POST['id']) && $_POST['submit'] == 'Unban' && is_number($_POST['id'])) {
authorize(); authorize();
$DB->query('DELETE FROM login_attempts WHERE ID='.$_POST['id']); $DB->query('DELETE FROM login_attempts WHERE ID='.$_POST['id']);
} }
View::show_header('Login Watch'); View::show_header('Login Watch');
$DB->query('SELECT $DB->query('
l.ID, SELECT
l.IP, l.ID,
l.UserID, l.IP,
l.LastAttempt, l.UserID,
l.Attempts, l.LastAttempt,
l.BannedUntil, l.Attempts,
l.Bans l.BannedUntil,
l.Bans
FROM login_attempts AS l FROM login_attempts AS l
WHERE l.BannedUntil > "'.sqltime().'" WHERE l.BannedUntil > "'.sqltime().'"
ORDER BY l.BannedUntil ASC'); ORDER BY l.BannedUntil ASC');
@ -31,11 +34,13 @@
<td>Bans</td> <td>Bans</td>
<td>Remaining</td> <td>Remaining</td>
<td>Submit</td> <td>Submit</td>
<? if(check_perms('admin_manage_ipbans')) { ?> <td>Submit</td><? } ?> <? if (check_perms('admin_manage_ipbans')) { ?>
<td>Submit</td>
<? } ?>
</tr> </tr>
<? <?
$Row = 'b'; $Row = 'b';
while(list($ID, $IP, $UserID, $LastAttempt, $Attempts, $BannedUntil, $Bans) = $DB->next_record()){ while (list($ID, $IP, $UserID, $LastAttempt, $Attempts, $BannedUntil, $Bans) = $DB->next_record()) {
$Row = ($Row === 'a' ? 'b' : 'a'); $Row = ($Row === 'a' ? 'b' : 'a');
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
@ -59,7 +64,7 @@
<input type="submit" name="submit" value="Unban" /> <input type="submit" name="submit" value="Unban" />
</form> </form>
</td> </td>
<? if(check_perms('admin_manage_ipbans')) { ?> <? if (check_perms('admin_manage_ipbans')) { ?>
<td> <td>
<form class="manage_form" name="bans" action="" method="post"> <form class="manage_form" name="bans" action="" method="post">
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />

View File

@ -25,7 +25,7 @@
if (!empty($Cond)) { if (!empty($Cond)) {
$Query = "UPDATE users_freeleeches SET Expired=TRUE WHERE ".implode(" OR ", $Cond); $Query = "UPDATE users_freeleeches SET Expired=TRUE WHERE ".implode(" OR ", $Cond);
$DB->query($Query); $DB->query($Query);
foreach($UserIDs as $UserID) { foreach ($UserIDs as $UserID) {
$Cache->delete_value('users_tokens_'.$UserID); $Cache->delete_value('users_tokens_'.$UserID);
} }
} }

View File

@ -16,7 +16,7 @@
if (empty($_GET['type']) || $_GET['type'] == 'torrents') { if (empty($_GET['type']) || $_GET['type'] == 'torrents') {
include(SERVER_ROOT.'/sections/top10/torrents.php'); include(SERVER_ROOT.'/sections/top10/torrents.php');
} else { } else {
switch($_GET['type']) { switch ($_GET['type']) {
case 'users' : case 'users' :
include(SERVER_ROOT.'/sections/top10/users.php'); include(SERVER_ROOT.'/sections/top10/users.php');
break; break;

View File

@ -1,7 +1,7 @@
<? <?
// error out on invalid requests (before caching) // error out on invalid requests (before caching)
if(isset($_GET['details'])) { if (isset($_GET['details'])) {
if(in_array($_GET['details'],array('ut','ur','v'))) { if (in_array($_GET['details'],array('ut','ur','v'))) {
$Details = $_GET['details']; $Details = $_GET['details'];
} else { } else {
error(404); error(404);
@ -29,60 +29,63 @@
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$Limit = in_array($Limit, array(10,100,250)) ? $Limit : 10; $Limit = in_array($Limit, array(10,100,250)) ? $Limit : 10;
if ($Details=='all' || $Details=='ut') { if ($Details == 'all' || $Details == 'ut') {
if (!$TopUsedTags = $Cache->get_value('topusedtag_'.$Limit)) { if (!$TopUsedTags = $Cache->get_value('topusedtag_'.$Limit)) {
$DB->query("SELECT $DB->query("
t.ID, SELECT
t.Name, t.ID,
COUNT(tt.GroupID) AS Uses, t.Name,
SUM(tt.PositiveVotes-1) AS PosVotes, COUNT(tt.GroupID) AS Uses,
SUM(tt.NegativeVotes-1) AS NegVotes SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
FROM tags AS t FROM tags AS t
JOIN torrents_tags AS tt ON tt.TagID=t.ID JOIN torrents_tags AS tt ON tt.TagID=t.ID
GROUP BY tt.TagID GROUP BY tt.TagID
ORDER BY Uses DESC ORDER BY Uses DESC
LIMIT $Limit"); LIMIT $Limit");
$TopUsedTags = $DB->to_array(); $TopUsedTags = $DB->to_array();
$Cache->cache_value('topusedtag_'.$Limit,$TopUsedTags,3600*12); $Cache->cache_value('topusedtag_'.$Limit, $TopUsedTags, 3600 * 12);
} }
generate_tag_table('Most Used Torrent Tags', 'ut', $TopUsedTags, $Limit); generate_tag_table('Most Used Torrent Tags', 'ut', $TopUsedTags, $Limit);
} }
if ($Details=='all' || $Details=='ur') { if ($Details == 'all' || $Details == 'ur') {
if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) { if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) {
$DB->query("SELECT $DB->query("
t.ID, SELECT
t.Name, t.ID,
COUNT(r.RequestID) AS Uses, t.Name,
'','' COUNT(r.RequestID) AS Uses,
'',''
FROM tags AS t FROM tags AS t
JOIN requests_tags AS r ON r.TagID=t.ID JOIN requests_tags AS r ON r.TagID=t.ID
GROUP BY r.TagID GROUP BY r.TagID
ORDER BY Uses DESC ORDER BY Uses DESC
LIMIT $Limit"); LIMIT $Limit");
$TopRequestTags = $DB->to_array(); $TopRequestTags = $DB->to_array();
$Cache->cache_value('toprequesttag_'.$Limit,$TopRequestTags,3600*12); $Cache->cache_value('toprequesttag_'.$Limit, $TopRequestTags, 3600 * 12);
} }
generate_tag_table('Most Used Request Tags', 'ur', $TopRequestTags, $Limit, false, true); generate_tag_table('Most Used Request Tags', 'ur', $TopRequestTags, $Limit, false, true);
} }
if ($Details=='all' || $Details=='v') { if ($Details == 'all' || $Details == 'v') {
if (!$TopVotedTags = $Cache->get_value('topvotedtag_'.$Limit)) { if (!$TopVotedTags = $Cache->get_value('topvotedtag_'.$Limit)) {
$DB->query("SELECT $DB->query("
t.ID, SELECT
t.Name, t.ID,
COUNT(tt.GroupID) AS Uses, t.Name,
SUM(tt.PositiveVotes-1) AS PosVotes, COUNT(tt.GroupID) AS Uses,
SUM(tt.NegativeVotes-1) AS NegVotes SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
FROM tags AS t FROM tags AS t
JOIN torrents_tags AS tt ON tt.TagID=t.ID JOIN torrents_tags AS tt ON tt.TagID=t.ID
GROUP BY tt.TagID GROUP BY tt.TagID
ORDER BY PosVotes DESC ORDER BY PosVotes DESC
LIMIT $Limit"); LIMIT $Limit");
$TopVotedTags = $DB->to_array(); $TopVotedTags = $DB->to_array();
$Cache->cache_value('topvotedtag_'.$Limit,$TopVotedTags,3600*12); $Cache->cache_value('topvotedtag_'.$Limit, $TopVotedTags, 3600 * 12);
} }
generate_tag_table('Most Highly Voted Tags', 'v', $TopVotedTags, $Limit); generate_tag_table('Most Highly Voted Tags', 'v', $TopVotedTags, $Limit);
@ -103,7 +106,7 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
<h3>Top <?=$Limit.' '.$Caption?> <h3>Top <?=$Limit.' '.$Caption?>
<small class="top10_quantity_links"> <small class="top10_quantity_links">
<? <?
switch($Limit) { switch ($Limit) {
case 100: ?> case 100: ?>
- <a href="top10.php?type=tags&amp;details=<?=$Tag?>" class="brackets">Top 10</a> - <a href="top10.php?type=tags&amp;details=<?=$Tag?>" class="brackets">Top 10</a>
- <span class="brackets">Top 100</span> - <span class="brackets">Top 100</span>
@ -126,14 +129,14 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
<td class="center">Rank</td> <td class="center">Rank</td>
<td>Tag</td> <td>Tag</td>
<td style="text-align: right;">Uses</td> <td style="text-align: right;">Uses</td>
<? if($ShowVotes) { ?> <? if ($ShowVotes) { ?>
<td style="text-align: right;">Pos. votes</td> <td style="text-align: right;">Pos. votes</td>
<td style="text-align: right;">Neg. votes</td> <td style="text-align: right;">Neg. votes</td>
<? } ?> <? } ?>
</tr> </tr>
<? <?
// in the unlikely event that query finds 0 rows... // in the unlikely event that query finds 0 rows...
if(empty($Details)) { if (empty($Details)) {
echo ' echo '
<tr class="rowb"> <tr class="rowb">
<td colspan="9" class="center"> <td colspan="9" class="center">
@ -144,9 +147,9 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
return; return;
} }
$Rank = 0; $Rank = 0;
foreach($Details as $Detail) { foreach ($Details as $Detail) {
$Rank++; $Rank++;
$Highlight = ($Rank%2 ? 'a' : 'b'); $Highlight = ($Rank % 2 ? 'a' : 'b');
// print row // print row
?> ?>
@ -154,7 +157,7 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
<td class="center"><?=$Rank?></td> <td class="center"><?=$Rank?></td>
<td><a href="<?=$URLString?><?=$Detail['Name']?>"><?=$Detail['Name']?></a></td> <td><a href="<?=$URLString?><?=$Detail['Name']?>"><?=$Detail['Name']?></a></td>
<td style="text-align: right;"><?=number_format($Detail['Uses'])?></td> <td style="text-align: right;"><?=number_format($Detail['Uses'])?></td>
<? if($ShowVotes) { ?> <? if ($ShowVotes) { ?>
<td style="text-align: right;"><?=number_format($Detail['PosVotes'])?></td> <td style="text-align: right;"><?=number_format($Detail['PosVotes'])?></td>
<td style="text-align: right;"><?=number_format($Detail['NegVotes'])?></td> <td style="text-align: right;"><?=number_format($Detail['NegVotes'])?></td>
<? } ?> <? } ?>

View File

@ -1,7 +1,7 @@
<? <?
// error out on invalid requests (before caching) // error out on invalid requests (before caching)
if(isset($_GET['details'])) { if (isset($_GET['details'])) {
if(in_array($_GET['details'],array('ul','dl','numul','uls','dls'))) { if (in_array($_GET['details'],array('ul','dl','numul','uls','dls'))) {
$Details = $_GET['details']; $Details = $_GET['details'];
} else { } else {
error(404); error(404);
@ -28,64 +28,65 @@
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10; $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$Limit = in_array($Limit, array(10,100,250)) ? $Limit : 10; $Limit = in_array($Limit, array(10,100,250)) ? $Limit : 10;
$BaseQuery = "SELECT $BaseQuery = "
u.ID, SELECT
ui.JoinDate, u.ID,
u.Uploaded, ui.JoinDate,
u.Downloaded, u.Uploaded,
ABS(u.Uploaded-524288000) / (".time()." - UNIX_TIMESTAMP(ui.JoinDate)) AS UpSpeed, u.Downloaded,
u.Downloaded / (".time()." - UNIX_TIMESTAMP(ui.JoinDate)) AS DownSpeed, ABS(u.Uploaded-524288000) / (".time()." - UNIX_TIMESTAMP(ui.JoinDate)) AS UpSpeed,
COUNT(t.ID) AS NumUploads u.Downloaded / (".time()." - UNIX_TIMESTAMP(ui.JoinDate)) AS DownSpeed,
COUNT(t.ID) AS NumUploads
FROM users_main AS u FROM users_main AS u
JOIN users_info AS ui ON ui.UserID = u.ID JOIN users_info AS ui ON ui.UserID = u.ID
LEFT JOIN torrents AS t ON t.UserID=u.ID LEFT JOIN torrents AS t ON t.UserID=u.ID
WHERE u.Enabled='1' WHERE u.Enabled='1'
AND Uploaded>'". 5*1024*1024*1024 ."' AND Uploaded>'". 5 * 1024 * 1024 * 1024 ."'
AND Downloaded>'". 5*1024*1024*1024 ."' AND Downloaded>'". 5 * 1024 * 1024 * 1024 ."'
AND (Paranoia IS NULL OR (Paranoia NOT LIKE '%\"uploaded\"%' AND Paranoia NOT LIKE '%\"downloaded\"%')) AND (Paranoia IS NULL OR (Paranoia NOT LIKE '%\"uploaded\"%' AND Paranoia NOT LIKE '%\"downloaded\"%'))
GROUP BY u.ID"; GROUP BY u.ID";
if($Details=='all' || $Details=='ul') { if ($Details == 'all' || $Details == 'ul') {
if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) { if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;"); $DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
$TopUserUploads = $DB->to_array(); $TopUserUploads = $DB->to_array();
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600*12); $Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads, 3600 * 12);
} }
generate_user_table('Uploaders', 'ul', $TopUserUploads, $Limit); generate_user_table('Uploaders', 'ul', $TopUserUploads, $Limit);
} }
if($Details=='all' || $Details=='dl') { if ($Details == 'all' || $Details == 'dl') {
if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) { if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;"); $DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
$TopUserDownloads = $DB->to_array(); $TopUserDownloads = $DB->to_array();
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600*12); $Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads, 3600 * 12);
} }
generate_user_table('Downloaders', 'dl', $TopUserDownloads, $Limit); generate_user_table('Downloaders', 'dl', $TopUserDownloads, $Limit);
} }
if($Details=='all' || $Details=='numul') { if ($Details == 'all' || $Details == 'numul') {
if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) { if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;"); $DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
$TopUserNumUploads = $DB->to_array(); $TopUserNumUploads = $DB->to_array();
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600*12); $Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads, 3600 * 12);
} }
generate_user_table('Torrents Uploaded', 'numul', $TopUserNumUploads, $Limit); generate_user_table('Torrents Uploaded', 'numul', $TopUserNumUploads, $Limit);
} }
if($Details=='all' || $Details=='uls') { if ($Details == 'all' || $Details == 'uls') {
if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) { if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;"); $DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
$TopUserUploadSpeed = $DB->to_array(); $TopUserUploadSpeed = $DB->to_array();
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600*12); $Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed, 3600 * 12);
} }
generate_user_table('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit); generate_user_table('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit);
} }
if($Details=='all' || $Details=='dls') { if ($Details == 'all' || $Details == 'dls') {
if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) { if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;"); $DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
$TopUserDownloadSpeed = $DB->to_array(); $TopUserDownloadSpeed = $DB->to_array();
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600*12); $Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed, 3600 * 12);
} }
generate_user_table('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit); generate_user_table('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit);
} }
@ -103,7 +104,7 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) {
<h3>Top <?=$Limit.' '.$Caption;?> <h3>Top <?=$Limit.' '.$Caption;?>
<small class="top10_quantity_links"> <small class="top10_quantity_links">
<? <?
switch($Limit) { switch ($Limit) {
case 100: ?> case 100: ?>
- <a href="top10.php?type=users&amp;details=<?=$Tag?>" class="brackets">Top 10</a> - <a href="top10.php?type=users&amp;details=<?=$Tag?>" class="brackets">Top 10</a>
- <span class="brackets">Top 100</span> - <span class="brackets">Top 100</span>
@ -135,7 +136,7 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) {
</tr> </tr>
<? <?
// in the unlikely event that query finds 0 rows... // in the unlikely event that query finds 0 rows...
if(empty($Details)) { if (empty($Details)) {
echo ' echo '
<tr class="rowb"> <tr class="rowb">
<td colspan="9" class="center"> <td colspan="9" class="center">
@ -146,9 +147,9 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) {
return; return;
} }
$Rank = 0; $Rank = 0;
foreach($Details as $Detail) { foreach ($Details as $Detail) {
$Rank++; $Rank++;
$Highlight = ($Rank%2 ? 'a' : 'b'); $Highlight = ($Rank % 2 ? 'a' : 'b');
?> ?>
<tr class="row<?=$Highlight?>"> <tr class="row<?=$Highlight?>">
<td class="center"><?=$Rank?></td> <td class="center"><?=$Rank?></td>

View File

@ -132,7 +132,7 @@
if (empty($_GET['advanced'])) { ?> if (empty($_GET['advanced'])) { ?>
<small class="top10_quantity_links"> <small class="top10_quantity_links">
<? <?
switch($Limit) { switch ($Limit) {
case 100: ?> case 100: ?>
- <a href="top10.php?type=votes" class="brackets">Top 25</a> - <a href="top10.php?type=votes" class="brackets">Top 25</a>
- <span class="brackets">Top 100</span> - <span class="brackets">Top 100</span>

View File

@ -12,28 +12,27 @@
} }
$Tags = explode(',', $_POST['tagname']); $Tags = explode(',', $_POST['tagname']);
foreach($Tags as $TagName) { foreach ($Tags as $TagName) {
$TagName = Misc::sanitize_tag($TagName); $TagName = Misc::sanitize_tag($TagName);
if(!empty($TagName)) { if (!empty($TagName)) {
$TagName = Misc::get_alias_tag($TagName); $TagName = Misc::get_alias_tag($TagName);
// Check DB for tag matching name // Check DB for tag matching name
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'"); $DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
list($TagID) = $DB->next_record(); list($TagID) = $DB->next_record();
if(!$TagID) { // Tag doesn't exist yet - create tag if (!$TagID) { // Tag doesn't exist yet - create tag
$DB->query("INSERT INTO tags (Name, UserID) VALUES ('".$TagName."', ".$UserID.")"); $DB->query("INSERT INTO tags (Name, UserID) VALUES ('".$TagName."', ".$UserID.")");
$TagID = $DB->inserted_id(); $TagID = $DB->inserted_id();
} else { } else {
$DB->query("SELECT TagID FROM torrents_tags_votes WHERE GroupID='$GroupID' AND TagID='$TagID' AND UserID='$UserID'"); $DB->query("SELECT TagID FROM torrents_tags_votes WHERE GroupID='$GroupID' AND TagID='$TagID' AND UserID='$UserID'");
if($DB->record_count()!=0) { // User has already voted on this tag, and is trying hax to make the rating go up if ($DB->record_count() != 0) { // User has already voted on this tag, and is trying hax to make the rating go up
header('Location: '.$_SERVER['HTTP_REFERER']); header('Location: '.$_SERVER['HTTP_REFERER']);
die(); die();
} }
} }
$DB->query("INSERT INTO torrents_tags $DB->query("INSERT INTO torrents_tags
(TagID, GroupID, PositiveVotes, UserID) VALUES (TagID, GroupID, PositiveVotes, UserID) VALUES
('$TagID', '$GroupID', '3', '$UserID') ('$TagID', '$GroupID', '3', '$UserID')

View File

@ -3,10 +3,10 @@
$GroupID = db_string($_GET['groupid']); $GroupID = db_string($_GET['groupid']);
$Importance = db_string($_GET['importance']); $Importance = db_string($_GET['importance']);
if(!is_number($ArtistID) || !is_number($GroupID) || !is_number($Importance)) { if (!is_number($ArtistID) || !is_number($GroupID) || !is_number($Importance)) {
error(404); error(404);
} }
if(!check_perms('torrents_edit')) { if (!check_perms('torrents_edit')) {
error(403); error(403);
} }
@ -30,7 +30,7 @@
WHERE ta.ArtistID IS NOT NULL WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = ".$ArtistID); AND ag.ArtistID = ".$ArtistID);
$GroupCount = $DB->record_count(); $GroupCount = $DB->record_count();
if(($ReqCount + $GroupCount) == 0) { if (($ReqCount + $GroupCount) == 0) {
//The only group to use this artist //The only group to use this artist
Artists::delete_artist($ArtistID); Artists::delete_artist($ArtistID);
} }

View File

@ -23,7 +23,7 @@
$DB->query("SELECT COUNT(GroupID) FROM torrents_tags WHERE TagID=".$TagID); $DB->query("SELECT COUNT(GroupID) FROM torrents_tags WHERE TagID=".$TagID);
list($Count) = $DB->next_record(); list($Count) = $DB->next_record();
if($Count < 1) { if ($Count < 1) {
$DB->query("SELECT Name FROM tags WHERE ID=".$TagID); $DB->query("SELECT Name FROM tags WHERE ID=".$TagID);
list($TagName) = $DB->next_record(); list($TagName) = $DB->next_record();

View File

@ -14,7 +14,9 @@
************************************************************************/ ************************************************************************/
$GroupID = $_GET['groupid']; $GroupID = $_GET['groupid'];
if(!is_number($GroupID) || !$GroupID) { error(0); } if (!is_number($GroupID) || !$GroupID) {
error(0);
}
// Get the artist name and the body of the last revision // Get the artist name and the body of the last revision
$DB->query("SELECT $DB->query("SELECT
@ -32,10 +34,14 @@
FROM torrents_group AS tg FROM torrents_group AS tg
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID=tg.RevisionID LEFT JOIN wiki_torrents AS wt ON wt.RevisionID=tg.RevisionID
WHERE tg.ID='$GroupID'"); WHERE tg.ID='$GroupID'");
if($DB->record_count() == 0) { error(404); } if ($DB->record_count() == 0) {
error(404);
}
list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID, $VanityHouse) = $DB->next_record(); list($Name, $Image, $Body, $WikiImage, $WikiBody, $Year, $RecordLabel, $CatalogueNumber, $ReleaseType, $CategoryID, $VanityHouse) = $DB->next_record();
if(!$Body) { $Body = $WikiBody; $Image = $WikiImage; } if (!$Body) {
$Body = $WikiBody; $Image = $WikiImage;
}
View::show_header('Edit torrent group'); View::show_header('Edit torrent group');
@ -55,7 +61,7 @@
<input type="text" name="image" size="92" value="<?=$Image?>" /><br /> <input type="text" name="image" size="92" value="<?=$Image?>" /><br />
<h3>Description</h3> <h3>Description</h3>
<textarea name="body" cols="91" rows="20"><?=$Body?></textarea><br /> <textarea name="body" cols="91" rows="20"><?=$Body?></textarea><br />
<? if($CategoryID == 1) { ?> <? if ($CategoryID == 1) { ?>
<select id="releasetype" name="releasetype"> <select id="releasetype" name="releasetype">
<? foreach ($ReleaseTypes as $Key => $Val) { ?> <? foreach ($ReleaseTypes as $Key => $Val) { ?>
<option value="<?=$Key?>"<?=($Key == $ReleaseType ? ' selected="selected"' : '')?>><?=$Val?></option> <option value="<?=$Key?>"<?=($Key == $ReleaseType ? ' selected="selected"' : '')?>><?=$Val?></option>
@ -76,7 +82,7 @@
</div> </div>
<? $DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID); <? $DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID);
//Users can edit the group info if they've uploaded a torrent to the group or have torrents_edit //Users can edit the group info if they've uploaded a torrent to the group or have torrents_edit
if(in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit')) { ?> if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit')) { ?>
<h3>Non-wiki group editing</h3> <h3>Non-wiki group editing</h3>
<div class="box pad"> <div class="box pad">
<form class="edit_form" name="torrent_group" action="torrents.php" method="post"> <form class="edit_form" name="torrent_group" action="torrents.php" method="post">
@ -105,7 +111,7 @@
<input type="text" name="catalogue_number" size="40" value="<?=$CatalogueNumber?>" /> <input type="text" name="catalogue_number" size="40" value="<?=$CatalogueNumber?>" />
</td> </td>
</tr> </tr>
<? if(check_perms('torrents_freeleech')) { ?> <? if (check_perms('torrents_freeleech')) { ?>
<tr> <tr>
<td class="label">Torrent <strong>group</strong> leech status</td> <td class="label">Torrent <strong>group</strong> leech status</td>
<td> <td>
@ -115,7 +121,7 @@
because because
<select name="freeleechtype"> <select name="freeleechtype">
<? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House"); <? $FL = array("N/A", "Staff Pick", "Perma-FL", "Vanity House");
foreach($FL as $Key => $FLType) { ?> foreach ($FL as $Key => $FLType) { ?>
<option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$FLType?></option> <option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$FLType?></option>
<? } ?> <? } ?>
</select> </select>
@ -128,7 +134,7 @@
</div> </div>
<? <?
} }
if(check_perms('torrents_edit')) { if (check_perms('torrents_edit')) {
?> ?>
<h3>Rename (won't merge)</h3> <h3>Rename (won't merge)</h3>
<div class="box pad"> <div class="box pad">

View File

@ -5,24 +5,26 @@
* torrent. * torrent.
****************************************************************/ ****************************************************************/
if(!check_perms('torrents_edit')) { error(403); } if (!check_perms('torrents_edit')) {
error(403);
}
$OldGroupID = $_POST['oldgroupid']; $OldGroupID = $_POST['oldgroupid'];
$GroupID = $_POST['groupid']; $GroupID = $_POST['groupid'];
$TorrentID = $_POST['torrentid']; $TorrentID = $_POST['torrentid'];
if(!is_number($OldGroupID) || !is_number($GroupID) || !is_number($TorrentID) || !$OldGroupID || !$GroupID || !$TorrentID) { if (!is_number($OldGroupID) || !is_number($GroupID) || !is_number($TorrentID) || !$OldGroupID || !$GroupID || !$TorrentID) {
error(0); error(0);
} }
if($OldGroupID == $GroupID) { if ($OldGroupID == $GroupID) {
header('Location: '.$_SERVER['HTTP_REFERER']); header('Location: '.$_SERVER['HTTP_REFERER']);
die(); die();
} }
//Everything is legit, let's just confim they're not retarded //Everything is legit, let's just confim they're not retarded
if(empty($_POST['confirm'])) { if (empty($_POST['confirm'])) {
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$OldGroupID); $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$OldGroupID);
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
//Trying to move to an empty group? I think not! //Trying to move to an empty group? I think not!
set_message("That group doesn't exist!"); set_message("That group doesn't exist!");
header('Location: '.$_SERVER['HTTP_REFERER']); header('Location: '.$_SERVER['HTTP_REFERER']);
@ -31,7 +33,7 @@
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
$DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID = ".$GroupID); $DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID = ".$GroupID);
list($CategoryID, $NewName) = $DB->next_record(); list($CategoryID, $NewName) = $DB->next_record();
if($Categories[$CategoryID-1] != 'Music') { if ($Categories[$CategoryID-1] != 'Music') {
error('Target must be a music group.'); error('Target must be a music group.');
} }
@ -71,7 +73,7 @@
// Delete old torrent group if it's empty now // Delete old torrent group if it's empty now
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$OldGroupID'"); $DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$OldGroupID'");
list($TorrentsInGroup) = $DB->next_record(); list($TorrentsInGroup) = $DB->next_record();
if($TorrentsInGroup == 0) { if ($TorrentsInGroup == 0) {
$DB->query("UPDATE torrents_comments SET GroupID='$GroupID' WHERE GroupID='$OldGroupID'"); $DB->query("UPDATE torrents_comments SET GroupID='$GroupID' WHERE GroupID='$OldGroupID'");
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0'); $Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0');
$Cache->delete_value('torrent_comments_'.$GroupID); $Cache->delete_value('torrent_comments_'.$GroupID);

View File

@ -11,11 +11,10 @@
************************************************************************/ ************************************************************************/
$GroupID = $_GET['groupid']; $GroupID = $_GET['groupid'];
if(!is_number($GroupID) || !$GroupID) { error(0); } if (!is_number($GroupID) || !$GroupID) {
error(0);
}
include(SERVER_ROOT.'/classes/class_wiki.php'); // Wiki class include(SERVER_ROOT.'/classes/class_wiki.php'); // Wiki class
$Wiki = new WIKI('wiki_torrents', $GroupID, "/torrents.php?id=$GroupID"); $Wiki = new WIKI('wiki_torrents', $GroupID, "/torrents.php?id=$GroupID");
@ -24,7 +23,9 @@
$DB->query("SELECT Name FROM torrents_group WHERE ID='$GroupID'"); $DB->query("SELECT Name FROM torrents_group WHERE ID='$GroupID'");
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
if(!$Name) { error(404); } if (!$Name) {
error(404);
}
View::show_header("Revision history for $Name"); // Set title View::show_header("Revision history for $Name"); // Set title

View File

@ -1,8 +1,8 @@
<? <?
if(empty($_POST['importance']) || empty($_POST['artists']) || empty($_POST['groupid']) || !is_number($_POST['importance']) || !is_number($_POST['groupid'])) { if (empty($_POST['importance']) || empty($_POST['artists']) || empty($_POST['groupid']) || !is_number($_POST['importance']) || !is_number($_POST['groupid'])) {
error(0); error(0);
} }
if(!check_perms('torrents_edit')) { if (!check_perms('torrents_edit')) {
error(403); error(403);
} }
authorize(); authorize();
@ -13,17 +13,17 @@
$ArtistIDs = array(); $ArtistIDs = array();
$ArtistsString = '0'; $ArtistsString = '0';
foreach($Artists as $i => $Artist) { foreach ($Artists as $i => $Artist) {
list($Importance, $ArtistID) = explode(';',$Artist); list($Importance, $ArtistID) = explode(';',$Artist);
if(is_number($ArtistID) && is_number($Importance)) { if (is_number($ArtistID) && is_number($Importance)) {
$CleanArtists[] = array($Importance, $ArtistID); $CleanArtists[] = array($Importance, $ArtistID);
$ArtistIDs[] = $ArtistID; $ArtistIDs[] = $ArtistID;
} }
} }
if(count($CleanArtists) > 0) { if (count($CleanArtists) > 0) {
$ArtistsString = implode(',', $ArtistIDs);; $ArtistsString = implode(',', $ArtistIDs);;
if($_POST['manager_action'] == 'delete') { if ($_POST['manager_action'] == 'delete') {
$DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'"); $DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'");
list($GroupName) = $DB->next_record(); list($GroupName) = $DB->next_record();
$DB->query("SELECT ArtistID, Name FROM artists_group WHERE ArtistID IN (".$ArtistsString.")"); $DB->query("SELECT ArtistID, Name FROM artists_group WHERE ArtistID IN (".$ArtistsString.")");
@ -35,15 +35,17 @@
$DB->query("DELETE FROM torrents_artists WHERE GroupID = '$GroupID' AND ArtistID = '$ArtistID' AND Importance = '$Importance'"); $DB->query("DELETE FROM torrents_artists WHERE GroupID = '$GroupID' AND ArtistID = '$ArtistID' AND Importance = '$Importance'");
$Cache->delete_value('artist_groups_'.$ArtistID); $Cache->delete_value('artist_groups_'.$ArtistID);
} }
$DB->query("SELECT ArtistID $DB->query("
FROM requests_artists SELECT ArtistID
WHERE ArtistID IN (".$ArtistsString.") FROM requests_artists
UNION SELECT ArtistID WHERE ArtistID IN (".$ArtistsString.")
FROM torrents_artists UNION
WHERE ArtistID IN (".$ArtistsString.")"); SELECT ArtistID
FROM torrents_artists
WHERE ArtistID IN (".$ArtistsString.")");
$Items = $DB->collect('ArtistID'); $Items = $DB->collect('ArtistID');
$EmptyArtists = array_diff($ArtistIDs, $Items); $EmptyArtists = array_diff($ArtistIDs, $Items);
foreach($EmptyArtists as $ArtistID) { foreach ($EmptyArtists as $ArtistID) {
Artists::delete_artist($ArtistID); Artists::delete_artist($ArtistID);
} }
} else { } else {

View File

@ -1,9 +1,12 @@
<? <?
if(!isset($_GET['id']) || !is_number($_GET['id']) || !isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) { error(0); } if (!isset($_GET['id']) || !is_number($_GET['id']) || !isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
error(0);
}
$GroupID = $_GET['id']; $GroupID = $_GET['id'];
$TorrentID = $_GET['torrentid']; $TorrentID = $_GET['torrentid'];
$DB->query("SELECT $DB->query("
SELECT
t.Media, t.Media,
t.Format, t.Format,
t.Encoding AS Bitrate, t.Encoding AS Bitrate,
@ -23,18 +26,20 @@
t.GroupID, t.GroupID,
t.UserID, t.UserID,
t.FreeTorrent t.FreeTorrent
FROM torrents AS t FROM torrents AS t
JOIN torrents_group AS tg ON tg.ID=t.GroupID JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
WHERE t.ID='$TorrentID'"); WHERE t.ID='$TorrentID'");
list($Properties) = $DB->to_array(false,MYSQLI_BOTH); list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
if(!$Properties) { error(404); } if (!$Properties) {
error(404);
}
View::show_header('Edit torrent', 'upload'); View::show_header('Edit torrent', 'upload');
if(!check_perms('site_moderate_requests')) { if (!check_perms('site_moderate_requests')) {
error(403); error(403);
} }

View File

@ -1,21 +1,27 @@
<? <?
if(!check_perms('torrents_edit')) { error(403); } if (!check_perms('torrents_edit')) {
error(403);
}
$GroupID = $_POST['groupid']; $GroupID = $_POST['groupid'];
$OldGroupID = $GroupID; $OldGroupID = $GroupID;
$NewGroupID = db_string($_POST['targetgroupid']); $NewGroupID = db_string($_POST['targetgroupid']);
if(!$GroupID || !is_number($GroupID)) { error(404); } if (!$GroupID || !is_number($GroupID)) {
if(!$NewGroupID || !is_number($NewGroupID)) { error(404); } error(404);
if($NewGroupID == $GroupID) { }
if (!$NewGroupID || !is_number($NewGroupID)) {
error(404);
}
if ($NewGroupID == $GroupID) {
error('Old group ID is the same as new group ID!'); error('Old group ID is the same as new group ID!');
} }
$DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID='$NewGroupID'"); $DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID='$NewGroupID'");
if($DB->record_count()==0) { if ($DB->record_count() == 0) {
error('Target group does not exist.'); error('Target group does not exist.');
} }
list($CategoryID, $NewName) = $DB->next_record(); list($CategoryID, $NewName) = $DB->next_record();
if($Categories[$CategoryID-1] != 'Music') { if ($Categories[$CategoryID - 1] != 'Music') {
error('Only music groups can be merged.'); error('Only music groups can be merged.');
} }
@ -23,7 +29,7 @@
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
//Everything is legit, let's just confim they're not retarded //Everything is legit, let's just confim they're not retarded
if(empty($_POST['confirm'])) { if (empty($_POST['confirm'])) {
$Artists = Artists::get_artists(array($GroupID, $NewGroupID)); $Artists = Artists::get_artists(array($GroupID, $NewGroupID));
View::show_header(); View::show_header();

View File

@ -3,30 +3,30 @@
authorize(); authorize();
//Set by system //Set by system
if(!$_POST['groupid'] || !is_number($_POST['groupid'])) { if (!$_POST['groupid'] || !is_number($_POST['groupid'])) {
error(404); error(404);
} }
$GroupID = $_POST['groupid']; $GroupID = $_POST['groupid'];
//Usual perm checks //Usual perm checks
if(!check_perms('torrents_edit')) { if (!check_perms('torrents_edit')) {
$DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID); $DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID);
if(!in_array($LoggedUser['ID'], $DB->collect('UserID'))) { if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) {
error(403); error(403);
} }
} }
if(check_perms('torrents_freeleech') && (isset($_POST['freeleech']) xor isset($_POST['neutralleech']) xor isset($_POST['unfreeleech']))) { if (check_perms('torrents_freeleech') && (isset($_POST['freeleech']) xor isset($_POST['neutralleech']) xor isset($_POST['unfreeleech']))) {
if(isset($_POST['freeleech'])) { if (isset($_POST['freeleech'])) {
$Free = 1; $Free = 1;
} elseif(isset($_POST['neutralleech'])) { } elseif (isset($_POST['neutralleech'])) {
$Free = 2; $Free = 2;
} else { } else {
$Free = 0; $Free = 0;
} }
if(isset($_POST['freeleechtype']) && in_array($_POST['freeleechtype'], array(0,1,2,3))) { if (isset($_POST['freeleechtype']) && in_array($_POST['freeleechtype'], array(0,1,2,3))) {
$FreeType = $_POST['freeleechtype']; $FreeType = $_POST['freeleechtype'];
} else { } else {
error(404); error(404);

View File

@ -135,7 +135,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
<h2>Latest notifications</h2> <h2>Latest notifications</h2>
</div> </div>
<div class="linkbox"> <div class="linkbox">
<? if($FilterID) { ?> <? if ($FilterID) { ?>
<a href="torrents.php?action=notify" class="brackets">View all</a>&nbsp;&nbsp;&nbsp; <a href="torrents.php?action=notify" class="brackets">View all</a>&nbsp;&nbsp;&nbsp;
<? } else { ?> <? } else { ?>
<a href="torrents.php?action=notify_clear&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Clear all</a>&nbsp;&nbsp;&nbsp; <a href="torrents.php?action=notify_clear&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Clear all</a>&nbsp;&nbsp;&nbsp;

View File

@ -1,5 +1,5 @@
<? <?
switch($_GET['action']) { switch ($_GET['action']) {
case 'notify_clear': case 'notify_clear':
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND UnRead = '0'"); $DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND UnRead = '0'");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']); $Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
@ -8,7 +8,7 @@
case 'notify_clear_item': case 'notify_clear_item':
case 'notify_clearitem': case 'notify_clearitem':
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) { if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
error(0); error(0);
} }
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND TorrentID = '$_GET[torrentid]'"); $DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND TorrentID = '$_GET[torrentid]'");
@ -16,7 +16,7 @@
break; break;
case 'notify_clear_items': case 'notify_clear_items':
if(!isset($_GET['torrentids'])) { if (!isset($_GET['torrentids'])) {
error(0); error(0);
} }
$TorrentIDs = explode(',', $_GET['torrentids']); $TorrentIDs = explode(',', $_GET['torrentids']);
@ -31,7 +31,7 @@
case 'notify_clear_filter': case 'notify_clear_filter':
case 'notify_cleargroup': case 'notify_cleargroup':
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) { if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
error(0); error(0);
} }
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND FilterID = '$_GET[filterid]' AND UnRead = '0'"); $DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND FilterID = '$_GET[filterid]' AND UnRead = '0'");
@ -41,18 +41,18 @@
case 'notify_catchup': case 'notify_catchup':
$DB->query("UPDATE users_notify_torrents SET UnRead = '0' WHERE UserID=$LoggedUser[ID]"); $DB->query("UPDATE users_notify_torrents SET UnRead = '0' WHERE UserID=$LoggedUser[ID]");
if($DB->affected_rows()) { if ($DB->affected_rows()) {
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']); $Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
} }
header('Location: torrents.php?action=notify'); header('Location: torrents.php?action=notify');
break; break;
case 'notify_catchup_filter': case 'notify_catchup_filter':
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) { if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
error(0); error(0);
} }
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID = $LoggedUser[ID] AND FilterID = $_GET[filterid]"); $DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID = $LoggedUser[ID] AND FilterID = $_GET[filterid]");
if($DB->affected_rows()) { if ($DB->affected_rows()) {
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']); $Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
} }
header('Location: torrents.php?action=notify'); header('Location: torrents.php?action=notify');

View File

@ -1,28 +1,31 @@
<? <?
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) { error(404); } if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
error(404);
}
$TorrentID = $_GET['torrentid']; $TorrentID = $_GET['torrentid'];
if(!empty($_GET['page']) && is_number($_GET['page'])) { if (!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = $_GET['page']; $Page = $_GET['page'];
$Limit = (string)(($Page-1)*100) .', 100'; $Limit = (string)(($Page - 1) * 100) .', 100';
} else { } else {
$Page = 1; $Page = 1;
$Limit = 100; $Limit = 100;
} }
$Result = $DB->query("SELECT SQL_CALC_FOUND_ROWS $Result = $DB->query("
xu.uid, SELECT SQL_CALC_FOUND_ROWS
t.Size, xu.uid,
xu.active, t.Size,
xu.connectable, xu.active,
xu.uploaded, xu.connectable,
xu.remaining, xu.uploaded,
xu.useragent xu.remaining,
xu.useragent
FROM xbt_files_users AS xu FROM xbt_files_users AS xu
LEFT JOIN users_main AS um ON um.ID=xu.uid LEFT JOIN users_main AS um ON um.ID=xu.uid
JOIN torrents AS t ON t.ID=xu.fid JOIN torrents AS t ON t.ID=xu.fid
WHERE xu.fid='$TorrentID' WHERE xu.fid='$TorrentID'
AND um.Visible='1' AND um.Visible='1'
ORDER BY xu.uid = '$LoggedUser[ID]' DESC, xu.uploaded DESC ORDER BY xu.uid = '$LoggedUser[ID]' DESC, xu.uploaded DESC
LIMIT $Limit"); LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()"); $DB->query("SELECT FOUND_ROWS()");
@ -31,7 +34,7 @@
?> ?>
<h4>Peer List</h4> <h4>Peer List</h4>
<? if($NumResults>100) { ?> <? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div> <div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>
@ -45,20 +48,20 @@
<td>Client</td> <td>Client</td>
</tr> </tr>
<? <?
while(list($PeerUserID, $Size, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) { while (list($PeerUserID, $Size, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) {
?> ?>
<tr> <tr>
<td><?=Users::format_username($PeerUserID, false, false, false)?></td> <td><?=Users::format_username($PeerUserID, false, false, false)?></td>
<td><?= ($Active) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td> <td><?= ($Active) ? '<span style="color: green;">Yes</span>' : '<span style="color: red;">No</span>' ?></td>
<td><?= ($Connectable) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td> <td><?= ($Connectable) ? '<span style="color: green;">Yes</span>' : '<span style="color: red;">No</span>' ?></td>
<td><?=Format::get_size($Uploaded) ?></td> <td><?=Format::get_size($Uploaded) ?></td>
<td><?=number_format(($Size-$Remaining)/$Size*100, 2)?></td> <td><?=number_format(($Size - $Remaining) / $Size * 100, 2)?></td>
<td><?=display_str($UserAgent)?></td> <td><?=display_str($UserAgent)?></td>
</tr> </tr>
<? <?
} }
?> ?>
</table> </table>
<? if($NumResults>100) { ?> <? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div> <div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>

View File

@ -5,13 +5,17 @@
$OldGroupID = $GroupID; $OldGroupID = $GroupID;
$NewName = $_POST['name']; $NewName = $_POST['name'];
if(!$GroupID || !is_number($GroupID)) { error(404); } if (!$GroupID || !is_number($GroupID)) {
error(404);
if(empty($NewName)) {
error("Albums can't have no name");
} }
if(!check_perms('torrents_edit')) { error(403); } if (empty($NewName)) {
error('Albums must have a name');
}
if (!check_perms('torrents_edit')) {
error(403);
}
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID); $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID);
list($OldName) = $DB->next_record(MYSQLI_NUM, false); list($OldName) = $DB->next_record(MYSQLI_NUM, false);

View File

@ -27,9 +27,9 @@
$Name .= $GroupName; $Name .= $GroupName;
$DB->query("SELECT uid, tstamp FROM xbt_snatched WHERE fid='$TorrentID' ORDER BY tstamp DESC LIMIT 10"); $DB->query("SELECT uid, tstamp FROM xbt_snatched WHERE fid='$TorrentID' ORDER BY tstamp DESC LIMIT 10");
if($DB->record_count()>0) { if ($DB->record_count() > 0) {
$Users = $DB->to_array(); $Users = $DB->to_array();
foreach($Users as $User) { foreach ($Users as $User) {
$UserID = $User['uid']; $UserID = $User['uid'];
$DB->query("SELECT UserID FROM top_snatchers WHERE UserID='$UserID'"); $DB->query("SELECT UserID FROM top_snatchers WHERE UserID='$UserID'");

View File

@ -1,22 +1,25 @@
<? <?
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid']) || !check_perms('site_view_torrent_snatchlist')) { error(404); } if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid']) || !check_perms('site_view_torrent_snatchlist')) {
error(404);
}
$TorrentID = $_GET['torrentid']; $TorrentID = $_GET['torrentid'];
if(!empty($_GET['page']) && is_number($_GET['page'])) { if (!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = $_GET['page']; $Page = $_GET['page'];
$Limit = (string)(($Page-1)*100) .', 100'; $Limit = (string)(($Page - 1) * 100) .', 100';
} else { } else {
$Page = 1; $Page = 1;
$Limit = 100; $Limit = 100;
} }
$Result = $DB->query("SELECT SQL_CALC_FOUND_ROWS $Result = $DB->query("
xs.uid, SELECT SQL_CALC_FOUND_ROWS
xs.tstamp xs.uid,
FROM xbt_snatched AS xs xs.tstamp
WHERE xs.fid='$TorrentID' FROM xbt_snatched AS xs
ORDER BY xs.tstamp DESC WHERE xs.fid='$TorrentID'
LIMIT $Limit"); ORDER BY xs.tstamp DESC
LIMIT $Limit");
$Results = $DB->to_array('uid', MYSQLI_ASSOC); $Results = $DB->to_array('uid', MYSQLI_ASSOC);
$DB->query("SELECT FOUND_ROWS()"); $DB->query("SELECT FOUND_ROWS()");
@ -25,7 +28,7 @@
?> ?>
<h4 title="List of users that have reported a snatch to the tracker">List of Snatchers</h4> <h4 title="List of users that have reported a snatch to the tracker">List of Snatchers</h4>
<? if($NumResults>100) { ?> <? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div> <div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>
@ -41,10 +44,10 @@
<? <?
$i = 0; $i = 0;
foreach($Results as $ID=>$Data) { foreach ($Results as $ID=>$Data) {
list($SnatcherID, $Timestamp) = array_values($Data); list($SnatcherID, $Timestamp) = array_values($Data);
if($i % 2 == 0 && $i>0) { if ($i % 2 == 0 && $i > 0) {
?> ?>
</tr> </tr>
<tr> <tr>
@ -59,6 +62,6 @@
?> ?>
</tr> </tr>
</table> </table>
<? if($NumResults>100) { ?> <? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div> <div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>

View File

@ -2,7 +2,9 @@
authorize(); authorize();
$TorrentID = $_POST['torrentid']; $TorrentID = $_POST['torrentid'];
if(!$TorrentID || !is_number($TorrentID)) { error(404); } if (!$TorrentID || !is_number($TorrentID)) {
error(404);
}
$DB->query("SELECT $DB->query("SELECT
t.UserID, t.UserID,
@ -20,16 +22,16 @@
WHERE t.ID='$TorrentID'"); WHERE t.ID='$TorrentID'");
list($UserID, $GroupID, $Size, $InfoHash, $Name, $ArtistName, $Time, $Snatches) = $DB->next_record(MYSQLI_NUM, false); list($UserID, $GroupID, $Size, $InfoHash, $Name, $ArtistName, $Time, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
if(($LoggedUser['ID']!=$UserID || time_ago($Time) > 3600*24*7 || $Snatches > 4) && !check_perms('torrents_delete')) { if (($LoggedUser['ID'] != $UserID || time_ago($Time) > 3600 * 24 * 7 || $Snatches > 4) && !check_perms('torrents_delete')) {
error(403); error(403);
} }
if($ArtistName) { if ($ArtistName) {
$Name = $ArtistName.' - '.$Name; $Name = $ArtistName.' - '.$Name;
} }
if(isset($_SESSION['logged_user']['multi_delete'])) { if (isset($_SESSION['logged_user']['multi_delete'])) {
if($_SESSION['logged_user']['multi_delete']>=3 && !check_perms('torrents_delete_fast')) { if ($_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) {
error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.'); error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.');
} }
$_SESSION['logged_user']['multi_delete']++; $_SESSION['logged_user']['multi_delete']++;
@ -39,8 +41,8 @@
$InfoHash = unpack("H*", $InfoHash); $InfoHash = unpack("H*", $InfoHash);
Torrents::delete_torrent($TorrentID, $GroupID); Torrents::delete_torrent($TorrentID, $GroupID);
Misc::write_log('Torrent '.$TorrentID.' ('.$Name.') ('.number_format($Size/(1024*1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']); Misc::write_log('Torrent '.$TorrentID.' ('.$Name.') ('.number_format($Size / (1024 * 1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']);
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent (".number_format($Size/(1024*1024), 2)." MB, ".strtoupper($InfoHash[1]).") for reason: ".$_POST['reason']." ".$_POST['extra'], 0); Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent (".number_format($Size / (1024 * 1024), 2)." MB, ".strtoupper($InfoHash[1]).") for reason: ".$_POST['reason']." ".$_POST['extra'], 0);
View::show_header('Torrent deleted'); View::show_header('Torrent deleted');
?> ?>

View File

@ -6,12 +6,14 @@
$Text = new TEXT; $Text = new TEXT;
// Quick SQL injection check // Quick SQL injection check
if(!$_REQUEST['groupid'] || !is_number($_REQUEST['groupid'])) { if (!$_REQUEST['groupid'] || !is_number($_REQUEST['groupid'])) {
error(404); error(404);
} }
// End injection check // End injection check
if(!check_perms('site_edit_wiki')) { error(403); } if (!check_perms('site_edit_wiki')) {
error(403);
}
// Variables for database input // Variables for database input
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
@ -23,12 +25,14 @@
error(404); error(404);
} }
if(!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision if (!empty($_GET['action']) && $_GET['action'] == 'revert') { // if we're reverting to a previous revision
$RevisionID=$_GET['revisionid']; $RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)) { error(0); } if (!is_number($RevisionID)) {
error(0);
}
// to cite from merge: "Everything is legit, let's just confim they're not retarded" // to cite from merge: "Everything is legit, let's just confim they're not retarded"
if(empty($_GET['confirm'])) { if (empty($_GET['confirm'])) {
View::show_header(); View::show_header();
?> ?>
<div class="center thin"> <div class="center thin">
@ -61,18 +65,18 @@
$VanityHouse = $OldVH; $VanityHouse = $OldVH;
} }
if(($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) && !isset($GroupInfo[0][0])) { if (($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) && !isset($GroupInfo[0][0])) {
$GroupCategoryID = $GroupInfo[0]['CategoryID']; $GroupCategoryID = $GroupInfo[0]['CategoryID'];
} else { } else {
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'"); $DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
list($GroupCategoryID) = $DB->next_record(); list($GroupCategoryID) = $DB->next_record();
} }
if($GroupCategoryID == 1 && !isset($ReleaseTypes[$ReleaseType]) || $GroupCategoryID != 1 && $ReleaseType) { if ($GroupCategoryID == 1 && !isset($ReleaseTypes[$ReleaseType]) || $GroupCategoryID != 1 && $ReleaseType) {
error(403); error(403);
} }
// Trickery // Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) { if (!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = ''; $Image = '';
} }
ImageTools::blacklisted($Image); ImageTools::blacklisted($Image);
@ -80,7 +84,7 @@
} }
// Insert revision // Insert revision
if(empty($RevisionID)) { // edit if (empty($RevisionID)) { // edit
$DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time) $DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time)
VALUES ('$GroupID', '".db_string($Body)."', '".db_string($Image)."', '$UserID', '$Summary', '".sqltime()."')"); VALUES ('$GroupID', '".db_string($Body)."', '".db_string($Image)."', '$UserID', '$Summary', '".sqltime()."')");
@ -90,7 +94,9 @@
else { // revert else { // revert
$DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'"); $DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'");
list($PossibleGroupID, $Body, $Image) = $DB->next_record(); list($PossibleGroupID, $Body, $Image) = $DB->next_record();
if($PossibleGroupID != $GroupID) { error(404); } if ($PossibleGroupID != $GroupID) {
error(404);
}
$DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time) $DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time)
SELECT '$GroupID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."' SELECT '$GroupID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
@ -105,7 +111,7 @@
// Update torrents table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast) // Update torrents table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE torrents_group SET $DB->query("UPDATE torrents_group SET
RevisionID='$RevisionID', RevisionID='$RevisionID',
".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : "")." ".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : '')."
WikiBody='$Body', WikiBody='$Body',
WikiImage='$Image' WikiImage='$Image'
WHERE ID='$GroupID'"); WHERE ID='$GroupID'");
@ -119,7 +125,7 @@
$Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value('torrents_details_'.$GroupID);
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'"); $DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$GroupID'");
if($DB->record_count()>0) { if ($DB->record_count() > 0) {
while(list($CollageID) = $DB->next_record()) { while(list($CollageID) = $DB->next_record()) {
$Cache->delete_value('collage_'.$CollageID); $Cache->delete_value('collage_'.$CollageID);
} }
@ -132,12 +138,12 @@
WHERE tg.ID = $GroupID"); WHERE tg.ID = $GroupID");
$UserIDs = $DB->collect('UserID'); $UserIDs = $DB->collect('UserID');
foreach($UserIDs as $UserID) { foreach ($UserIDs as $UserID) {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID); $RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if(is_array($RecentUploads)) { if (is_array($RecentUploads)) {
foreach($RecentUploads as $Key => $Recent) { foreach ($RecentUploads as $Key => $Recent) {
if($Recent['ID'] == $GroupID) { if ($Recent['ID'] == $GroupID) {
if($Recent['WikiImage'] != $Image) { if ($Recent['WikiImage'] != $Image) {
$Recent['WikiImage'] = $Image; $Recent['WikiImage'] = $Image;
$Cache->begin_transaction('recent_uploads_'.$UserID); $Cache->begin_transaction('recent_uploads_'.$UserID);
$Cache->update_row($Key, $Recent); $Cache->update_row($Key, $Recent);
@ -149,16 +155,16 @@
} }
$DB->query("SELECT ID FROM torrents WHERE GroupID = ".$GroupID); $DB->query("SELECT ID FROM torrents WHERE GroupID = ".$GroupID);
if($DB->record_count()) { if ($DB->record_count()) {
$TorrentIDs = implode(",", $DB->collect('ID')); $TorrentIDs = implode(',', $DB->collect('ID'));
$DB->query("SELECT DISTINCT uid FROM xbt_snatched WHERE fid IN (".$TorrentIDs.")"); $DB->query("SELECT DISTINCT uid FROM xbt_snatched WHERE fid IN (".$TorrentIDs.")");
$Snatchers = $DB->collect('uid'); $Snatchers = $DB->collect('uid');
foreach($Snatchers as $UserID) { foreach ($Snatchers as $UserID) {
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID); $RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
if(is_array($RecentSnatches)) { if (is_array($RecentSnatches)) {
foreach($RecentSnatches as $Key => $Recent) { foreach ($RecentSnatches as $Key => $Recent) {
if($Recent['ID'] == $GroupID) { if ($Recent['ID'] == $GroupID) {
if($Recent['WikiImage'] != $Image) { if ($Recent['WikiImage'] != $Image) {
$Recent['WikiImage'] = $Image; $Recent['WikiImage'] = $Image;
$Cache->begin_transaction('recent_snatches_'.$UserID); $Cache->begin_transaction('recent_snatches_'.$UserID);
$Cache->update_row($Key, $Recent); $Cache->update_row($Key, $Recent);

View File

@ -6,7 +6,9 @@
authorize(); authorize();
if(!check_perms('torrents_edit')) { error(403); } if (!check_perms('torrents_edit')) {
error(403);
}
$OldGroupID = $_POST['oldgroupid']; $OldGroupID = $_POST['oldgroupid'];
$TorrentID = $_POST['torrentid']; $TorrentID = $_POST['torrentid'];
@ -15,12 +17,12 @@
$Year = trim($_POST['year']); $Year = trim($_POST['year']);
$SearchText = db_string(trim($_POST['artist']) . ' ' . trim($_POST['title']) . ' ' . trim($_POST['year'])); $SearchText = db_string(trim($_POST['artist']) . ' ' . trim($_POST['title']) . ' ' . trim($_POST['year']));
if(!is_number($OldGroupID) || !is_number($TorrentID) || !is_number($Year) || !$OldGroupID || !$TorrentID || !$Year || empty($Title) || empty($ArtistName)) { if (!is_number($OldGroupID) || !is_number($TorrentID) || !is_number($Year) || !$OldGroupID || !$TorrentID || !$Year || empty($Title) || empty($ArtistName)) {
error(0); error(0);
} }
//Everything is legit, let's just confim they're not retarded //Everything is legit, let's just confim they're not retarded
if(empty($_POST['confirm'])) { if (empty($_POST['confirm'])) {
View::show_header(); View::show_header();
?> ?>
<div class="center thin"> <div class="center thin">
@ -47,7 +49,7 @@
View::show_footer(); View::show_footer();
} else { } else {
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'"); $DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'");
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
$Redirect = 0; $Redirect = 0;
$DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')"); $DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')");
$ArtistID = $DB->inserted_id(); $ArtistID = $DB->inserted_id();
@ -55,7 +57,7 @@
$AliasID = $DB->inserted_id(); $AliasID = $DB->inserted_id();
} else { } else {
list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record(); list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record();
if($Redirect) { if ($Redirect) {
$AliasID = $Redirect; $AliasID = $Redirect;
} }
} }
@ -76,7 +78,7 @@
// Delete old group if needed // Delete old group if needed
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'"); $DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
Torrents::delete_group($OldGroupID); Torrents::delete_group($OldGroupID);
} else { } else {
Torrents::update_hash($OldGroupID); Torrents::update_hash($OldGroupID);

View File

@ -4,16 +4,16 @@
$GroupID = db_string($_GET['groupid']); $GroupID = db_string($_GET['groupid']);
$Way = db_string($_GET['way']); $Way = db_string($_GET['way']);
if(!is_number($TagID) || !is_number($GroupID)) { if (!is_number($TagID) || !is_number($GroupID)) {
error(404); error(404);
} }
if(!in_array($Way, array('up', 'down'))) { if (!in_array($Way, array('up', 'down'))) {
error(404); error(404);
} }
$DB->query("SELECT TagID FROM torrents_tags_votes WHERE TagID='$TagID' AND GroupID='$GroupID' AND UserID='$UserID' AND Way='$Way'"); $DB->query("SELECT TagID FROM torrents_tags_votes WHERE TagID='$TagID' AND GroupID='$GroupID' AND UserID='$UserID' AND Way='$Way'");
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
if($Way == 'down') { if ($Way == 'down') {
$Change = 'NegativeVotes=NegativeVotes+1'; $Change = 'NegativeVotes=NegativeVotes+1';
} else { } else {
$Change = 'PositiveVotes=PositiveVotes+2'; $Change = 'PositiveVotes=PositiveVotes+2';

View File

@ -1,5 +1,7 @@
<?php <?php
if (!check_perms('users_warn')) { error(404);} if (!check_perms('users_warn')) {
error(404);
}
Misc::assert_isset_request($_POST, array('groupid', 'postid', 'userid', 'key')); Misc::assert_isset_request($_POST, array('groupid', 'postid', 'userid', 'key'));
$GroupID = (int) $_POST['groupid']; $GroupID = (int) $_POST['groupid'];
@ -43,19 +45,19 @@
<option value="1">1 week</option> <option value="1">1 week</option>
<option value="2">2 weeks</option> <option value="2">2 weeks</option>
<option value="4">4 weeks</option> <option value="4">4 weeks</option>
<? if(check_perms("users_mod")) { ?> <? if (check_perms('users_mod')) { ?>
<option value="8">8 weeks</option> <option value="8">8 weeks</option>
<? } ?> <? } ?>
</select></td> </select></td>
</tr> </tr>
<tr> <tr>
<td class="label">Private Message:</td> <td class="label">Private message:</td>
<td> <td>
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea> <textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label">Edit Post:</td> <td class="label">Edit post:</td>
<td> <td>
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea> <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
<br /> <br />

View File

@ -59,7 +59,7 @@ function date_compare($Field, $Operand, $Date1, $Date2 = '') {
$Date2 = db_string($Date2); $Date2 = db_string($Date2);
$Return = array(); $Return = array();
switch($Operand) { switch ($Operand) {
case 'on': case 'on':
$Return []= " $Field>='$Date1 00:00:00' "; $Return []= " $Field>='$Date1 00:00:00' ";
$Return []= " $Field<='$Date1 23:59:59' "; $Return []= " $Field<='$Date1 23:59:59' ";
@ -91,7 +91,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$Return = array(); $Return = array();
switch($Operand) { switch ($Operand) {
case 'equal': case 'equal':
$Return []= " $Field='$Num1' "; $Return []= " $Field='$Num1' ";
break; break;

View File

@ -14,17 +14,29 @@
$Octets[2] > 255 || $Octets[2] > 255 ||
$Octets[3] < 0 || $Octets[3] < 0 ||
$Octets[3] > 255 || $Octets[3] > 255 ||
/*
* Per RFC 1918, the following CIDR blocks should never be found on the public Internet.
* 10.0.0.0/8
* 172.16.0.0/12
* 192.168.0.0/16
*
* Per RFC 3330, the block 127.0.0.0/8 should never appear on any network.
*
*/
$Octets[0] == 127 || $Octets[0] == 127 ||
$Octets[0] == 192 $Octets[0] == 10 ||
($Octets[0] == 172 && ((16 <= $Octets[1]) && ($Octets[1] <= 31))) ||
($Octets[0] == 192 && $Octets[1] == 168)
) { ) {
die('Invalid IP'); die('Invalid IPv4 address');
} }
// Valid port numbers are defined in RFC 1700
if (empty($_GET['port']) || !is_number($_GET['port']) || $_GET['port'] < 1 || $_GET['port'] > 65535) { if (empty($_GET['port']) || !is_number($_GET['port']) || $_GET['port'] < 1 || $_GET['port'] > 65535) {
die('Invalid Port'); die('Invalid port');
} }
//Error suppression, ugh. // Error suppression, ugh.
if (@fsockopen($_GET['ip'], $_GET['port'], $Errno, $Errstr, 20)) { if (@fsockopen($_GET['ip'], $_GET['port'], $Errno, $Errstr, 20)) {
die('Port '.$_GET['port'].' on '.$_GET['ip'].' connected successfully.'); die('Port '.$_GET['port'].' on '.$_GET['ip'].' connected successfully.');
} else { } else {

View File

@ -44,7 +44,7 @@
} }
} }
switch($CurrentOrder) { switch ($CurrentOrder) {
case 'username' : case 'username' :
$OrderBy = "um.Username"; $OrderBy = "um.Username";
break; break;

View File

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

View File

@ -94,41 +94,42 @@
$DB->query("SELECT $DB->query("
m.Username, SELECT
m.IP, m.Username,
m.Email, m.IP,
m.PermissionID, m.Email,
p.Level AS Class, m.PermissionID,
m.Title, p.Level AS Class,
m.Enabled, m.Title,
m.Uploaded, m.Enabled,
m.Downloaded, m.Uploaded,
m.Invites, m.Downloaded,
m.can_leech, m.Invites,
m.Visible, m.can_leech,
i.AdminComment, m.Visible,
m.torrent_pass, i.AdminComment,
i.Donor, m.torrent_pass,
i.Artist, i.Donor,
i.Warned, i.Artist,
i.SupportFor, i.Warned,
i.RestrictedForums, i.SupportFor,
i.PermittedForums, i.RestrictedForums,
DisableAvatar, i.PermittedForums,
DisableInvites, DisableAvatar,
DisablePosting, DisableInvites,
DisableForums, DisablePosting,
DisableTagging, DisableForums,
DisableUpload, DisableTagging,
DisableWiki, DisableUpload,
DisablePM, DisableWiki,
DisableIRC, DisablePM,
m.RequiredRatio, DisableIRC,
m.FLTokens, m.RequiredRatio,
i.RatioWatchEnds, m.FLTokens,
SHA1(i.AdminComment) AS CommentHash, i.RatioWatchEnds,
GROUP_CONCAT(l.PermissionID SEPARATOR ',') AS SecondaryClasses SHA1(i.AdminComment) AS CommentHash,
GROUP_CONCAT(l.PermissionID SEPARATOR ',') AS SecondaryClasses
FROM users_main AS m FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN permissions AS p ON p.ID=m.PermissionID LEFT JOIN permissions AS p ON p.ID=m.PermissionID
@ -157,7 +158,7 @@
// If we're deleting the user, we can ignore all the other crap // If we're deleting the user, we can ignore all the other crap
if ($_POST['UserStatus'] == "delete" && check_perms('users_delete_users')) { if ($_POST['UserStatus'] == 'delete' && check_perms('users_delete_users')) {
Misc::write_log("User account ".$UserID." (".$Cur['Username'].") was deleted by ".$LoggedUser['Username']); Misc::write_log("User account ".$UserID." (".$Cur['Username'].") was deleted by ".$LoggedUser['Username']);
$DB->query("DELETE FROM users_main WHERE id=".$UserID); $DB->query("DELETE FROM users_main WHERE id=".$UserID);
$DB->query("DELETE FROM users_info WHERE UserID=".$UserID); $DB->query("DELETE FROM users_info WHERE UserID=".$UserID);
@ -221,7 +222,7 @@
if ($_POST['LogOut']) { if ($_POST['LogOut']) {
$DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID'"); $DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID'");
while(list($SessionID) = $DB->next_record()) { while (list($SessionID) = $DB->next_record()) {
$Cache->delete_value('session_'.$UserID.'_'.$SessionID); $Cache->delete_value('session_'.$UserID.'_'.$SessionID);
} }
$Cache->delete_value('users_sessions_'.$UserID); $Cache->delete_value('users_sessions_'.$UserID);
@ -720,13 +721,13 @@
header("location: user.php?id=$UserID"); header("location: user.php?id=$UserID");
function translateUserStatus($status) { function translateUserStatus($status) {
switch($status) { switch ($status) {
case 0: case 0:
return "Unconfirmed"; return 'Unconfirmed';
case 1: case 1:
return "Enabled"; return 'Enabled';
case 2: case 2:
return "Disabled"; return 'Disabled';
default: default:
return $status; return $status;
} }
@ -735,9 +736,9 @@ function translateUserStatus($status) {
function translateLeechStatus($status) { function translateLeechStatus($status) {
switch ($status) { switch ($status) {
case 0: case 0:
return "Disabled"; return 'Disabled';
case 1: case 1:
return "Enabled"; return 'Enabled';
default: default:
return $status; return $status;
} }

View File

@ -209,6 +209,7 @@ function check_paranoia_here($Setting) {
<div class="sidebar"> <div class="sidebar">
<? <?
if ($Avatar && Users::has_avatars_enabled()) { if ($Avatar && Users::has_avatars_enabled()) {
// TODO: use Users::show_avatar; why display_str in line 301??
if (check_perms('site_proxy_images') && !empty($Avatar)) { if (check_perms('site_proxy_images') && !empty($Avatar)) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar); $Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar);
} }

View File

@ -1,12 +1,12 @@
<? <?
authorize(); authorize();
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) { if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
$DB->query('SELECT TopicID FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID'])); $DB->query('SELECT TopicID FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']));
if($UserSubscriptions = $DB->collect(0)) { if ($UserSubscriptions = $DB->collect(0)) {
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0); $Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
} }
} }
if(!empty($UserSubscriptions)) { if (!empty($UserSubscriptions)) {
$DB->query("INSERT INTO forums_last_read_topics (UserID, TopicID, PostID) $DB->query("INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID FROM SELECT '$LoggedUser[ID]', ID, LastPostID FROM
forums_topics forums_topics

View File

@ -11,12 +11,21 @@
************************************************************************/ ************************************************************************/
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT ui.JoinDate, p.Level AS Class FROM users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = $UserID"); $DB->query("
SELECT
ui.JoinDate,
p.Level AS Class
FROM users_main AS um
JOIN users_info AS ui ON um.ID=ui.UserID
JOIN permissions AS p ON p.ID=um.PermissionID
WHERE um.ID = $UserID");
list($Joined, $Class) = $DB->next_record(); list($Joined, $Class) = $DB->next_record();
if(!check_perms('users_view_email', $Class)) { if (!check_perms('users_view_email', $Class)) {
error(403); error(403);
} }
@ -40,9 +49,9 @@
GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor, GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
FROM users_main AS m FROM users_main AS m
LEFT JOIN users_history_emails AS h ON h.Email=m.Email AND h.UserID<>m.ID LEFT JOIN users_history_emails AS h ON h.Email=m.Email AND h.UserID<>m.ID
LEFT JOIN users_main AS m2 ON m2.ID=h.UserID LEFT JOIN users_main AS m2 ON m2.ID=h.UserID
LEFT JOIN users_info AS i ON i.UserID=h.UserID LEFT JOIN users_info AS i ON i.UserID=h.UserID
WHERE m.ID='$UserID'" WHERE m.ID='$UserID'"
); );
$CurrentEmail = array_shift($DB->to_array()); $CurrentEmail = array_shift($DB->to_array());
@ -61,9 +70,9 @@
i2.Donor AS UsersDonor, i2.Donor AS UsersDonor,
i2.Warned AS UsersWarned i2.Warned AS UsersWarned
FROM users_history_emails AS h2 FROM users_history_emails AS h2
LEFT JOIN users_history_emails AS h3 ON h3.Email=h2.Email AND h3.UserID<>h2.UserID LEFT JOIN users_history_emails AS h3 ON h3.Email=h2.Email AND h3.UserID<>h2.UserID
LEFT JOIN users_main AS m3 ON m3.ID=h3.UserID LEFT JOIN users_main AS m3 ON m3.ID=h3.UserID
LEFT JOIN users_info AS i2 ON i2.UserID=h3.UserID LEFT JOIN users_info AS i2 ON i2.UserID=h3.UserID
WHERE h2.UserID='$UserID' WHERE h2.UserID='$UserID'
ORDER BY Time DESC" ORDER BY Time DESC"
); );
@ -85,7 +94,7 @@
$UserSetTimes=explode('|', $CurrentEmail['UserSetTimes']); $UserSetTimes=explode('|', $CurrentEmail['UserSetTimes']);
$UserIPs=explode('|', $CurrentEmail['UserIPs']); $UserIPs=explode('|', $CurrentEmail['UserIPs']);
foreach($UserIDs as $Key => $Val) { foreach ($UserIDs as $Key => $Val) {
$CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true); $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
$CurrentMatches[$Key]['IP'] = $UserIPs[$Key]; $CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
$CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key]; $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
@ -187,7 +196,7 @@
<? <?
if ($CurrentMatches) { if ($CurrentMatches) {
// Match on the current email // Match on the current email
foreach($CurrentMatches as $Match) { foreach ($CurrentMatches as $Match) {
?> ?>
<tr class="rowb"> <tr class="rowb">
<td><?=$Match['Username']?></td> <td><?=$Match['Username']?></td>

View File

@ -12,15 +12,24 @@
define('IPS_PER_PAGE', 25); define('IPS_PER_PAGE', 25);
if(!check_perms('users_mod')) { error(403); } if (!check_perms('users_mod')) {
error(403);
}
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT um.Username, p.Level AS Class FROM users_main AS um LEFT JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = ".$UserID); $DB->query("
SELECT um.Username,
p.Level AS Class
FROM users_main AS um
LEFT JOIN permissions AS p ON p.ID=um.PermissionID
WHERE um.ID = ".$UserID);
list($Username, $Class) = $DB->next_record(); list($Username, $Class) = $DB->next_record();
if(!check_perms('users_view_ips', $Class)) { if (!check_perms('users_view_ips', $Class)) {
error(403); error(403);
} }
@ -58,7 +67,7 @@ function ShowIPs(rowname) {
</tr> </tr>
<? <?
$Results = $DB->to_array(); $Results = $DB->to_array();
foreach($Results as $Index => $Result) { foreach ($Results as $Index => $Result) {
list($IP, $TorrentID, $Time) = $Result; list($IP, $TorrentID, $Time) = $Result;
?> ?>
@ -68,7 +77,7 @@ function ShowIPs(rowname) {
<a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" class="brackets" title="Search WIMIA.com">WI</a> <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" class="brackets" title="Search WIMIA.com">WI</a>
</td> </td>
<td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td> <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td>
<td><?=date("Y-m-d g:i:s", $Time)?></td> <td><?=date('Y-m-d g:i:s', $Time)?></td>
</tr> </tr>
<? <?
} }

View File

@ -251,15 +251,15 @@
<? <?
while (list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()) { while (list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()) {
?> ?>
<table class="forum_post vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : '' ?>" id="post<?=$PostID ?>"> <table class="forum_post vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : '' ?>" id="post<?=$PostID ?>">
<colgroup> <colgroup>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>"> <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
<span style="float: left;"> <span style="float: left;">
<?=time_diff($AddedTime) ?> <?=time_diff($AddedTime) ?>
in <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a> in <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a>
@ -294,21 +294,11 @@
if (!$ShowGrouped) { if (!$ShowGrouped) {
?> ?>
<tr> <tr>
<? <? if (Users::has_avatars_enabled()) { ?>
if (empty($HeavyInfo['DisableAvatars'])) {
?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? <?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
if ($Avatar) {
?>
<img src="<?=ImageTools::process($Avatar)?>" width="150" style="max-height:400px;" alt="<?=$Username?>'s avatar" />
<?
}
?>
</td> </td>
<? <? } ?>
}
?>
<td class="body" valign="top"> <td class="body" valign="top">
<div id="content<?=$PostID?>"> <div id="content<?=$PostID?>">
<?=$Text->full_format($Body)?> <?=$Text->full_format($Body)?>

View File

@ -14,26 +14,30 @@
$ShowAll = !empty($_GET['showall']); $ShowAll = !empty($_GET['showall']);
if (!$ShowAll) { if (!$ShowAll) {
$sql = "SELECT c.ID, $sql = "
c.Name, SELECT
c.NumTorrents, c.ID,
s.LastVisit c.Name,
FROM collages AS c c.NumTorrents,
JOIN users_collage_subs AS s ON s.CollageID = c.ID s.LastVisit
JOIN collages_torrents AS ct ON ct.CollageID = c.ID FROM collages AS c
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0' JOIN users_collage_subs AS s ON s.CollageID = c.ID
AND ct.AddedOn>s.LastVisit JOIN collages_torrents AS ct ON ct.CollageID = c.ID
GROUP BY c.ID"; WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
AND ct.AddedOn>s.LastVisit
GROUP BY c.ID";
} else { } else {
$sql = "SELECT c.ID, $sql = "
c.Name, SELECT
c.NumTorrents, c.ID,
s.LastVisit c.Name,
FROM collages AS c c.NumTorrents,
JOIN users_collage_subs AS s ON s.CollageID = c.ID s.LastVisit
LEFT JOIN collages_torrents AS ct ON ct.CollageID = c.ID FROM collages AS c
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0' JOIN users_collage_subs AS s ON s.CollageID = c.ID
GROUP BY c.ID"; LEFT JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
GROUP BY c.ID";
} }
$DB->query($sql); $DB->query($sql);
@ -69,9 +73,9 @@
</div> </div>
<? <?
} else { } else {
$HideGroup=''; $HideGroup = '';
$ActionTitle="Hide"; $ActionTitle = 'Hide';
$ActionURL="hide"; $ActionURL = 'hide';
$ShowGroups = 0; $ShowGroups = 0;
foreach ($CollageSubs as $Collage) { foreach ($CollageSubs as $Collage) {
@ -188,7 +192,7 @@
</td> </td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td> <td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td> <td><?=number_format($Torrent['Leechers'])?></td>
</tr> </tr>
<? <?
@ -231,7 +235,7 @@
</td> </td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td> <td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td> <td><?=number_format($Torrent['Snatched'])?></td>
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td> <td<?=($Torrent['Seeders'] == 0) ? ' class="r00"' : '' ?>><?=number_format($Torrent['Seeders'])?></td>
<td><?=number_format($Torrent['Leechers'])?></td> <td><?=number_format($Torrent['Leechers'])?></td>
</tr> </tr>
<? <?
@ -239,15 +243,15 @@
$TorrentTable.=ob_get_clean(); $TorrentTable.=ob_get_clean();
} ?> } ?>
<!-- I hate that proton is making me do it like this --> <!-- I hate that proton is making me do it like this -->
<!--<div class="head colhead_dark" style="margin-top: 8px">--> <!--<div class="head colhead_dark" style="margin-top: 8px;">-->
<table style="margin-top: 8px" class="subscribed_collages_table"> <table style="margin-top: 8px;" class="subscribed_collages_table">
<tr class="colhead_dark"> <tr class="colhead_dark">
<td> <td>
<span style="float:left;"> <span style="float: left;">
<strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount==1?'':'s')?>) <strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount == 1 ? '' : 's')?>)
</span>&nbsp; </span>&nbsp;
<span style="float:right;"> <span style="float: right;">
<a href="#" onclick="$('#discog_table_<?=$CollageID?>').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets"><?=$ShowAll?'Show':'Hide'?></a>&nbsp;&nbsp;&nbsp;<a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;collageid=<?=$CollageID?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>" class="brackets">Unsubscribe</a> <a href="#" onclick="$('#discog_table_<?=$CollageID?>').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets"><?=$ShowAll ? 'Show' : 'Hide' ?></a>&nbsp;&nbsp;&nbsp;<a href="userhistory.php?action=catchup_collages&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;collageid=<?=$CollageID?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>" class="brackets">Unsubscribe</a>
</span> </span>
</td> </td>
</tr> </tr>
@ -264,7 +268,7 @@
</tr> </tr>
<?=$TorrentTable?> <?=$TorrentTable?>
</table> </table>
<? } // foreach() ?> <? } // foreach () ?>
<? <?
} // else -- if (empty($NumResults)) ?> } // else -- if (empty($NumResults)) ?>
</div> </div>

View File

@ -139,21 +139,21 @@
<? <?
while (list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()) { while (list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()) {
?> ?>
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : '' ?>"> <table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : '' ?>">
<colgroup> <colgroup>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" /> <col class="col_avatar" />
<? } ?> <? } ?>
<col class="col_post_body" /> <col class="col_post_body" />
</colgroup> </colgroup>
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>"> <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
<span style="float:left;"> <span style="float:left;">
<a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$ForumName?></a> &gt; <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$ForumName?></a> &gt;
<a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a>
<? if ($PostID < $LastPostID && !$Locked) { ?> <? if ($PostID < $LastPostID && !$Locked) { ?>
<span class="new">(New!)</span> <span class="new">(New!)</span>
<? } ?> <? } ?>
</span> </span>
<span style="float:left;" class="last_read" title="Jump to last read"> <span style="float:left;" class="last_read" title="Jump to last read">
<a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID.($PostID?'&amp;postid='.$PostID.'#post'.$PostID:'')?>"></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID.($PostID?'&amp;postid='.$PostID.'#post'.$PostID:'')?>"></a>
@ -166,13 +166,9 @@
</td> </td>
</tr> </tr>
<tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>"> <tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>">
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? if ($AuthorAvatar) { ?> <?=Users::show_avatar($AuthorAvatar, $AuthorName, $HeavyInfo['DisableAvatars'])?>
<img src="<?=ImageTools::process($AuthorAvatar)?>" width="150" style="max-height: 400px;" alt="<?=$AuthorName?>'s avatar" />
<? } else { ?>
<img src="<?=STATIC_SERVER.'common/avatars/default.png'?>" width="150" style="max-height: 400px;" alt="Default avatar" />
<? } ?>
</td> </td>
<? } ?> <? } ?>
<td class="body" valign="top"> <td class="body" valign="top">

View File

@ -19,8 +19,8 @@
$Perms = Permissions::get_permissions($UserInfo['PermissionID']); $Perms = Permissions::get_permissions($UserInfo['PermissionID']);
$UserClass = $Perms['Class']; $UserClass = $Perms['Class'];
if(!check_perms('users_mod')) { if (!check_perms('users_mod')) {
if($LoggedUser['ID'] != $UserID && !check_paranoia(false, $User['Paranoia'], $UserClass, $UserID)) { if ($LoggedUser['ID'] != $UserID && !check_paranoia(false, $User['Paranoia'], $UserClass, $UserID)) {
error(403); error(403);
} }
} }
@ -93,10 +93,10 @@
list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Uses, $Name, $Format, $Encoding) = $Token; list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Uses, $Name, $Format, $Encoding) = $Token;
$Name = "<a href=\"torrents.php?torrentid=$TorrentID\">$Name</a>"; $Name = "<a href=\"torrents.php?torrentid=$TorrentID\">$Name</a>";
$ArtistName = Artists::display_artists($Artists[$GroupID]); $ArtistName = Artists::display_artists($Artists[$GroupID]);
if($ArtistName) { if ($ArtistName) {
$Name = $ArtistName.$Name; $Name = $ArtistName.$Name;
} }
if($Format && $Encoding) { if ($Format && $Encoding) {
$Name.=' ['.$Format.' / '.$Encoding.']'; $Name.=' ['.$Format.' / '.$Encoding.']';
} }
?> ?>

View File

@ -6,7 +6,7 @@
$DB->query("SELECT Title FROM wiki_articles WHERE ID = $ID"); $DB->query("SELECT Title FROM wiki_articles WHERE ID = $ID");
if($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error(404); error(404);
} }