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
$DB->query("SELECT RequestID FROM requests_artists WHERE ArtistID=".$ArtistID." AND ArtistID != 0");
$Requests = $DB->to_array();
foreach($Requests AS $Request) {
foreach ($Requests AS $Request) {
list($RequestID) = $Request;
$DB->query('DELETE FROM requests WHERE ID='.$RequestID);
$DB->query('DELETE FROM requests_votes WHERE RequestID='.$RequestID);

View File

@ -162,7 +162,6 @@ public static function proxy_url($Url) {
* @return string
*/
public static function process($Url, $Thumb = false) {
global $LoggedUser;
if (empty($Url)) {
return '';
}
@ -182,20 +181,11 @@ public static function process($Url, $Thumb = false) {
}
}
if (isset($LoggedUser['Permissions'])) {
/*
* 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);
if (check_perms('site_proxy_images')) {
$ProcessedUrl = self::proxy_url($ProcessedUrl);
}
self::store($Url . ($Thumb ? '_thumb' : ''), $ProcessedUrl);
return $ProcessedUrl;
}

View File

@ -206,10 +206,10 @@ public function set($Name, $Value) {
*/
private function build_options() {
$Options = array();
foreach($this->Options as $Option => $Value) {
foreach ($this->Options as $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";
if (!empty($this->Expressions)) {
$this->Filters['expr'] = "MATCH('".implode(" ", $this->Expressions)."')";
$this->Filters['expr'] = "MATCH('".implode(' ', $this->Expressions)."')";
}
if (!empty($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.
switch($TagName) {
switch ($TagName) {
case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
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.
switch($TagName) {
switch ($TagName) {
case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
break;
@ -455,7 +455,7 @@ function to_html($Array) {
$Str.=$this->smileys($Block);
continue;
}
switch($Block['Type']) {
switch ($Block['Type']) {
case 'b':
$Str.='<strong>'.$this->to_html($Block['Val']).'</strong>';
break;
@ -616,7 +616,7 @@ function raw_text($Array) {
$Str.=$Block;
continue;
}
switch($Block['Type']) {
switch ($Block['Type']) {
case 'b':
case 'u':

View File

@ -322,14 +322,14 @@ function parse($Str) {
// 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.
switch($TagName) {
switch ($TagName) {
case 'inlineurl':
$Array[$ArrayPos] = array('Type'=>'inlineurl', 'Attr'=>$Block, 'Val'=>'');
break;
@ -419,7 +419,7 @@ function to_html($Array) {
$Str.=$this->smileys($Block);
continue;
}
switch($Block['Type']) {
switch ($Block['Type']) {
case 'b':
$Str.='<strong>'.$this->to_html($Block['Val']).'</strong>';
break;
@ -577,7 +577,7 @@ function raw_text($Array) {
$Str.=$Block;
continue;
}
switch($Block['Type']) {
switch ($Block['Type']) {
case 'b':
case 'u':

View File

@ -466,12 +466,13 @@ public static function update_hash($GroupID) {
*/
public static function regenerate_filelist($TorrentID) {
global $DB, $Cache;
$DB->query("SELECT tg.ID,
$DB->query("
SELECT tg.ID,
tf.File
FROM torrents_files AS tf
JOIN torrents AS t ON t.ID=tf.TorrentID
JOIN torrents_group AS tg ON tg.ID=t.GroupID
WHERE tf.TorrentID = ".$TorrentID);
WHERE tf.TorrentID = ".$TorrentID);
if ($DB->record_count() > 0) {
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
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()) : '';
}
list($TotalSize, $FileList) = $Tor->file_list();
foreach($FileList as $File) {
foreach ($FileList as $File) {
$TmpFileList[] = self::filelist_format_file($File);
}
$FileString = implode("\n", $TmpFileList);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -211,7 +211,7 @@ function compare($X, $Y) {
<div class="box center">
<?
foreach ($UsedReleases as $ReleaseID) {
switch($ReleaseTypes[$ReleaseID]) {
switch ($ReleaseTypes[$ReleaseID]) {
case "Remix" :
$DisplayName = "Remixes";
break;
@ -300,7 +300,7 @@ function compare($X, $Y) {
$TorrentTags = new Tags($TagList, false);
if ($ReleaseType != $LastReleaseType) {
switch($ReleaseTypes[$ReleaseType]) {
switch ($ReleaseTypes[$ReleaseType]) {
case "Remix" :
$DisplayName = "Remixes";
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 1024:
case 1021:

View File

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

View File

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

View File

@ -8,21 +8,23 @@
require(SERVER_ROOT.'/sections/comments/post.php'); // Post formatting function.
$action = '';
if(!empty($_REQUEST['action']))
if (!empty($_REQUEST['action'])) {
$action = $_REQUEST['action'];
}
/**
* Getting a userid if applicable
*/
if(isset($_GET['id'])) {
if (isset($_GET['id'])) {
$UserID = $_GET['id'];
if(!is_number($UserID))
if (!is_number($UserID)) {
error(404);
}
$UserInfo = Users::user_info($UserID);
$Username = $UserInfo['Username'];
if($LoggedUser['ID'] == $UserID) {
if ($LoggedUser['ID'] == $UserID) {
$Self = true;
} else {
$Self = false;
@ -47,7 +49,7 @@
}
list($Page,$Limit) = Format::page_limit($PerPage);
switch($action) {
switch ($action) {
case 'requests':
require (SERVER_ROOT.'/sections/comments/requestcomments.php');
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?>">
<colgroup>
<? if (empty($UserInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<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>
<?=$postheader ?>
</span>
</td>
</tr>
<tr>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top">
<? if ($UserInfo['Avatar']) { ?>
<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" />
<? } ?>
<?=Users::show_avatar($UserInfo['Avatar'], $UserInfo['Username'], $HeavyInfo['DisableAvatars'])?>
</td>
<? } ?>
<td class="body" valign="top">

View File

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

View File

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

View File

@ -46,13 +46,13 @@
<? } ?>
<table class="forum_post box vertical_margin" style="text-align: left;">
<colgroup>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<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>
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
Just now
@ -65,13 +65,11 @@
</td>
</tr>
<tr>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top">
<? if (!empty($LoggedUser['Avatar'])) { ?>
<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" />
<? } ?>
<?=Users::show_avatar($LoggedUser['Avatar'], $LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
</td>
<? } ?>
<td class="body" valign="top">
<div id="contentpreview" style="text-align: left;"></div>
</td>

View File

@ -72,7 +72,7 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table class="friends_table vertical_margin">
<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)?>
<? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
@ -90,20 +90,15 @@
</td>
</tr>
<tr>
<td width="50px" valign="top">
<?
if (empty($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" />
<? }
} ?>
<? if (Users::has_avatars_enabled()) { ?>
<td class="col_avatar avatar" valign="top">
<?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
</td>
<? }?>
<td valign="top">
<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 class="left" valign="top">
<input type="submit" name="action" value="Update" /><br />

View File

@ -1,21 +1,24 @@
<?
enforce_login();
$StaffIDs = $Cache->get_value("staff_ids");
if(!is_array($StaffIDs)) {
$DB->query("SELECT m.ID, m.Username
$StaffIDs = $Cache->get_value('staff_ids');
if (!is_array($StaffIDs)) {
$DB->query("
SELECT m.ID, m.Username
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'");
while(list($StaffID, $StaffName) = $DB->next_record()) {
while (list($StaffID, $StaffName) = $DB->next_record()) {
$StaffIDs[$StaffID] = $StaffName;
}
uasort($StaffIDs, 'strcasecmp');
$Cache->cache_value("staff_ids", $StaffIDs);
$Cache->cache_value('staff_ids', $StaffIDs);
}
if(!isset($_REQUEST['action'])) { $_REQUEST['action'] = ''; }
switch($_REQUEST['action']) {
if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = '';
}
switch ($_REQUEST['action']) {
case 'takecompose':
require('takecompose.php');
break;

View File

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

View File

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

View File

@ -2,30 +2,32 @@
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);
}
if (isset($_POST['convid']) && is_number($_POST['convid'])) {
$ConvID = $_POST['convid'];
$Subject='';
$Subject = '';
$ToID = explode(',', $_POST['toid']);
foreach($ToID as $TID) {
if(!is_number($TID)) {
$Err = "A recipient does not exist.";
foreach ($ToID as $TID) {
if (!is_number($TID)) {
$Err = 'A recipient does not exist.';
}
}
$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);
}
} else {
$ConvID='';
if(!is_number($_POST['toid'])) {
$Err = "This recipient does not exist.";
$ConvID = '';
if (!is_number($_POST['toid'])) {
$Err = 'This recipient does not exist.';
} else {
$ToID = $_POST['toid'];
}
@ -35,11 +37,11 @@
}
}
$Body = trim($_POST['body']);
if($Body === '' || $Body === false) {
if ($Body === '' || $Body === false) {
$Err = "You can't send a message without a body!";
}
if(!empty($Err)) {
if (!empty($Err)) {
error($Err);
//header('Location: inbox.php?action=compose&to='.$_POST['toid']);
$ToID = $_POST['toid'];

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@
if (!isset($_REQUEST['action'])) {
include(SERVER_ROOT.'/sections/requests/requests.php');
} else {
switch($_REQUEST['action']) {
switch ($_REQUEST['action']) {
case 'new':
case 'edit':
include(SERVER_ROOT.'/sections/requests/new_edit.php');
@ -187,9 +187,9 @@
$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
$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);
for($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$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);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete('request_comments_'.$RequestID.'_catalogue_'.$i);
}

View File

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

View File

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

View File

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

View File

@ -1,8 +1,9 @@
<?
enforce_login();
if(!isset($_REQUEST['action']))
if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = '';
}
// Get user level
$DB->query("
@ -10,8 +11,8 @@
i.SupportFor,
p.DisplayStaff
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
WHERE i.UserID = ".$LoggedUser['ID']
);
list($SupportFor, $DisplayStaff) = $DB->next_record();
@ -20,7 +21,7 @@
// Logged in user is Staff or FLS
$IsFLS = ($IsStaff || $LoggedUser['ExtraClasses'][41]);
switch($_REQUEST['action']) {
switch ($_REQUEST['action']) {
case 'viewconv':
require('viewconv.php');
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();
$DB->query('DELETE FROM login_attempts WHERE ID='.$_POST['id']);
}
View::show_header('Login Watch');
$DB->query('SELECT
l.ID,
l.IP,
l.UserID,
l.LastAttempt,
l.Attempts,
l.BannedUntil,
l.Bans
$DB->query('
SELECT
l.ID,
l.IP,
l.UserID,
l.LastAttempt,
l.Attempts,
l.BannedUntil,
l.Bans
FROM login_attempts AS l
WHERE l.BannedUntil > "'.sqltime().'"
ORDER BY l.BannedUntil ASC');
@ -31,11 +34,13 @@
<td>Bans</td>
<td>Remaining</td>
<td>Submit</td>
<? if(check_perms('admin_manage_ipbans')) { ?> <td>Submit</td><? } ?>
<? if (check_perms('admin_manage_ipbans')) { ?>
<td>Submit</td>
<? } ?>
</tr>
<?
$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');
?>
<tr class="row<?=$Row?>">
@ -59,7 +64,7 @@
<input type="submit" name="submit" value="Unban" />
</form>
</td>
<? if(check_perms('admin_manage_ipbans')) { ?>
<? if (check_perms('admin_manage_ipbans')) { ?>
<td>
<form class="manage_form" name="bans" action="" method="post">
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -78,4 +83,4 @@
?>
</table>
</div>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?
// error out on invalid requests (before caching)
if(isset($_GET['details'])) {
if(in_array($_GET['details'],array('ut','ur','v'))) {
if (isset($_GET['details'])) {
if (in_array($_GET['details'],array('ut','ur','v'))) {
$Details = $_GET['details'];
} else {
error(404);
@ -29,60 +29,63 @@
$Limit = isset($_GET['limit']) ? intval($_GET['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)) {
$DB->query("SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
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
ORDER BY Uses DESC
LIMIT $Limit");
$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);
}
if ($Details=='all' || $Details=='ur') {
if ($Details == 'all' || $Details == 'ur') {
if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) {
$DB->query("SELECT
t.ID,
t.Name,
COUNT(r.RequestID) AS Uses,
'',''
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(r.RequestID) AS Uses,
'',''
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
ORDER BY Uses DESC
LIMIT $Limit");
$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);
}
if ($Details=='all' || $Details=='v') {
if ($Details == 'all' || $Details == 'v') {
if (!$TopVotedTags = $Cache->get_value('topvotedtag_'.$Limit)) {
$DB->query("SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
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
ORDER BY PosVotes DESC
LIMIT $Limit");
$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);
@ -103,7 +106,7 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
<h3>Top <?=$Limit.' '.$Caption?>
<small class="top10_quantity_links">
<?
switch($Limit) {
switch ($Limit) {
case 100: ?>
- <a href="top10.php?type=tags&amp;details=<?=$Tag?>" class="brackets">Top 10</a>
- <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>Tag</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;">Neg. votes</td>
<? } ?>
</tr>
<?
// in the unlikely event that query finds 0 rows...
if(empty($Details)) {
if (empty($Details)) {
echo '
<tr class="rowb">
<td colspan="9" class="center">
@ -144,9 +147,9 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
return;
}
$Rank = 0;
foreach($Details as $Detail) {
foreach ($Details as $Detail) {
$Rank++;
$Highlight = ($Rank%2 ? 'a' : 'b');
$Highlight = ($Rank % 2 ? 'a' : 'b');
// print row
?>
@ -154,7 +157,7 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
<td class="center"><?=$Rank?></td>
<td><a href="<?=$URLString?><?=$Detail['Name']?>"><?=$Detail['Name']?></a></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['NegVotes'])?></td>
<? } ?>

View File

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

View File

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

View File

@ -12,27 +12,26 @@
}
$Tags = explode(',', $_POST['tagname']);
foreach($Tags as $TagName) {
foreach ($Tags as $TagName) {
$TagName = Misc::sanitize_tag($TagName);
if(!empty($TagName)) {
if (!empty($TagName)) {
$TagName = Misc::get_alias_tag($TagName);
// Check DB for tag matching name
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
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.")");
$TagID = $DB->inserted_id();
} else {
$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']);
die();
}
}
$DB->query("INSERT INTO torrents_tags
(TagID, GroupID, PositiveVotes, UserID) VALUES

View File

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

View File

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

View File

@ -14,7 +14,9 @@
************************************************************************/
$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
$DB->query("SELECT
@ -32,10 +34,14 @@
FROM torrents_group AS tg
LEFT JOIN wiki_torrents AS wt ON wt.RevisionID=tg.RevisionID
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();
if(!$Body) { $Body = $WikiBody; $Image = $WikiImage; }
if (!$Body) {
$Body = $WikiBody; $Image = $WikiImage;
}
View::show_header('Edit torrent group');
@ -55,7 +61,7 @@
<input type="text" name="image" size="92" value="<?=$Image?>" /><br />
<h3>Description</h3>
<textarea name="body" cols="91" rows="20"><?=$Body?></textarea><br />
<? if($CategoryID == 1) { ?>
<? if ($CategoryID == 1) { ?>
<select id="releasetype" name="releasetype">
<? foreach ($ReleaseTypes as $Key => $Val) { ?>
<option value="<?=$Key?>"<?=($Key == $ReleaseType ? ' selected="selected"' : '')?>><?=$Val?></option>
@ -76,7 +82,7 @@
</div>
<? $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
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>
<div class="box pad">
<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?>" />
</td>
</tr>
<? if(check_perms('torrents_freeleech')) { ?>
<? if (check_perms('torrents_freeleech')) { ?>
<tr>
<td class="label">Torrent <strong>group</strong> leech status</td>
<td>
@ -115,7 +121,7 @@
because
<select name="freeleechtype">
<? $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>
<? } ?>
</select>
@ -128,7 +134,7 @@
</div>
<?
}
if(check_perms('torrents_edit')) {
if (check_perms('torrents_edit')) {
?>
<h3>Rename (won't merge)</h3>
<div class="box pad">

View File

@ -5,24 +5,26 @@
* torrent.
****************************************************************/
if(!check_perms('torrents_edit')) { error(403); }
if (!check_perms('torrents_edit')) {
error(403);
}
$OldGroupID = $_POST['oldgroupid'];
$GroupID = $_POST['groupid'];
$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);
}
if($OldGroupID == $GroupID) {
if ($OldGroupID == $GroupID) {
header('Location: '.$_SERVER['HTTP_REFERER']);
die();
}
//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);
if($DB->record_count() < 1) {
if ($DB->record_count() < 1) {
//Trying to move to an empty group? I think not!
set_message("That group doesn't exist!");
header('Location: '.$_SERVER['HTTP_REFERER']);
@ -31,7 +33,7 @@
list($Name) = $DB->next_record();
$DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID = ".$GroupID);
list($CategoryID, $NewName) = $DB->next_record();
if($Categories[$CategoryID-1] != 'Music') {
if ($Categories[$CategoryID-1] != 'Music') {
error('Target must be a music group.');
}
@ -71,7 +73,7 @@
// Delete old torrent group if it's empty now
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$OldGroupID'");
list($TorrentsInGroup) = $DB->next_record();
if($TorrentsInGroup == 0) {
if ($TorrentsInGroup == 0) {
$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);
@ -90,4 +92,4 @@
header("Location: torrents.php?id=$GroupID");
}
?>
?>

View File

@ -11,11 +11,10 @@
************************************************************************/
$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
$Wiki = new WIKI('wiki_torrents', $GroupID, "/torrents.php?id=$GroupID");
@ -24,7 +23,9 @@
$DB->query("SELECT Name FROM torrents_group WHERE ID='$GroupID'");
list($Name) = $DB->next_record();
if(!$Name) { error(404); }
if (!$Name) {
error(404);
}
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);
}
if(!check_perms('torrents_edit')) {
if (!check_perms('torrents_edit')) {
error(403);
}
authorize();
@ -13,17 +13,17 @@
$ArtistIDs = array();
$ArtistsString = '0';
foreach($Artists as $i => $Artist) {
foreach ($Artists as $i => $Artist) {
list($Importance, $ArtistID) = explode(';',$Artist);
if(is_number($ArtistID) && is_number($Importance)) {
if (is_number($ArtistID) && is_number($Importance)) {
$CleanArtists[] = array($Importance, $ArtistID);
$ArtistIDs[] = $ArtistID;
}
}
if(count($CleanArtists) > 0) {
if (count($CleanArtists) > 0) {
$ArtistsString = implode(',', $ArtistIDs);;
if($_POST['manager_action'] == 'delete') {
if ($_POST['manager_action'] == 'delete') {
$DB->query("SELECT Name FROM torrents_group WHERE ID = '".$_POST['groupid']."'");
list($GroupName) = $DB->next_record();
$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'");
$Cache->delete_value('artist_groups_'.$ArtistID);
}
$DB->query("SELECT ArtistID
FROM requests_artists
WHERE ArtistID IN (".$ArtistsString.")
UNION SELECT ArtistID
FROM torrents_artists
WHERE ArtistID IN (".$ArtistsString.")");
$DB->query("
SELECT ArtistID
FROM requests_artists
WHERE ArtistID IN (".$ArtistsString.")
UNION
SELECT ArtistID
FROM torrents_artists
WHERE ArtistID IN (".$ArtistsString.")");
$Items = $DB->collect('ArtistID');
$EmptyArtists = array_diff($ArtistIDs, $Items);
foreach($EmptyArtists as $ArtistID) {
foreach ($EmptyArtists as $ArtistID) {
Artists::delete_artist($ArtistID);
}
} 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'];
$TorrentID = $_GET['torrentid'];
$DB->query("SELECT
$DB->query("
SELECT
t.Media,
t.Format,
t.Encoding AS Bitrate,
@ -23,18 +26,20 @@
t.GroupID,
t.UserID,
t.FreeTorrent
FROM torrents AS t
FROM torrents AS t
JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
WHERE t.ID='$TorrentID'");
WHERE t.ID='$TorrentID'");
list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
if(!$Properties) { error(404); }
if (!$Properties) {
error(404);
}
View::show_header('Edit torrent', 'upload');
if(!check_perms('site_moderate_requests')) {
if (!check_perms('site_moderate_requests')) {
error(403);
}
@ -69,4 +74,4 @@
</table>
</form>
</div>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

@ -1,21 +1,27 @@
<?
if(!check_perms('torrents_edit')) { error(403); }
if (!check_perms('torrents_edit')) {
error(403);
}
$GroupID = $_POST['groupid'];
$OldGroupID = $GroupID;
$NewGroupID = db_string($_POST['targetgroupid']);
if(!$GroupID || !is_number($GroupID)) { error(404); }
if(!$NewGroupID || !is_number($NewGroupID)) { error(404); }
if($NewGroupID == $GroupID) {
if (!$GroupID || !is_number($GroupID)) {
error(404);
}
if (!$NewGroupID || !is_number($NewGroupID)) {
error(404);
}
if ($NewGroupID == $GroupID) {
error('Old group ID is the same as new group ID!');
}
$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.');
}
list($CategoryID, $NewName) = $DB->next_record();
if($Categories[$CategoryID-1] != 'Music') {
if ($Categories[$CategoryID - 1] != 'Music') {
error('Only music groups can be merged.');
}
@ -23,7 +29,7 @@
list($Name) = $DB->next_record();
//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));
View::show_header();

View File

@ -3,30 +3,30 @@
authorize();
//Set by system
if(!$_POST['groupid'] || !is_number($_POST['groupid'])) {
if (!$_POST['groupid'] || !is_number($_POST['groupid'])) {
error(404);
}
$GroupID = $_POST['groupid'];
//Usual perm checks
if(!check_perms('torrents_edit')) {
if (!check_perms('torrents_edit')) {
$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);
}
}
if(check_perms('torrents_freeleech') && (isset($_POST['freeleech']) xor isset($_POST['neutralleech']) xor isset($_POST['unfreeleech']))) {
if(isset($_POST['freeleech'])) {
if (check_perms('torrents_freeleech') && (isset($_POST['freeleech']) xor isset($_POST['neutralleech']) xor isset($_POST['unfreeleech']))) {
if (isset($_POST['freeleech'])) {
$Free = 1;
} elseif(isset($_POST['neutralleech'])) {
} elseif (isset($_POST['neutralleech'])) {
$Free = 2;
} else {
$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'];
} else {
error(404);

View File

@ -135,7 +135,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
<h2>Latest notifications</h2>
</div>
<div class="linkbox">
<? if($FilterID) { ?>
<? if ($FilterID) { ?>
<a href="torrents.php?action=notify" class="brackets">View all</a>&nbsp;&nbsp;&nbsp;
<? } else { ?>
<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':
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND UnRead = '0'");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
@ -8,7 +8,7 @@
case 'notify_clear_item':
case 'notify_clearitem':
if(!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
error(0);
}
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND TorrentID = '$_GET[torrentid]'");
@ -16,7 +16,7 @@
break;
case 'notify_clear_items':
if(!isset($_GET['torrentids'])) {
if (!isset($_GET['torrentids'])) {
error(0);
}
$TorrentIDs = explode(',', $_GET['torrentids']);
@ -31,7 +31,7 @@
case 'notify_clear_filter':
case 'notify_cleargroup':
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
error(0);
}
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND FilterID = '$_GET[filterid]' AND UnRead = '0'");
@ -41,22 +41,22 @@
case 'notify_catchup':
$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']);
}
header('Location: torrents.php?action=notify');
break;
case 'notify_catchup_filter':
if(!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
error(0);
}
$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']);
}
header('Location: torrents.php?action=notify');
break;
default:
error(0);
}
}

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'];
if(!empty($_GET['page']) && is_number($_GET['page'])) {
if (!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = $_GET['page'];
$Limit = (string)(($Page-1)*100) .', 100';
$Limit = (string)(($Page - 1) * 100) .', 100';
} else {
$Page = 1;
$Limit = 100;
}
$Result = $DB->query("SELECT SQL_CALC_FOUND_ROWS
xu.uid,
t.Size,
xu.active,
xu.connectable,
xu.uploaded,
xu.remaining,
xu.useragent
$Result = $DB->query("
SELECT SQL_CALC_FOUND_ROWS
xu.uid,
t.Size,
xu.active,
xu.connectable,
xu.uploaded,
xu.remaining,
xu.useragent
FROM xbt_files_users AS xu
LEFT JOIN users_main AS um ON um.ID=xu.uid
JOIN torrents AS t ON t.ID=xu.fid
LEFT JOIN users_main AS um ON um.ID=xu.uid
JOIN torrents AS t ON t.ID=xu.fid
WHERE xu.fid='$TorrentID'
AND um.Visible='1'
AND um.Visible='1'
ORDER BY xu.uid = '$LoggedUser[ID]' DESC, xu.uploaded DESC
LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
@ -31,7 +34,7 @@
?>
<h4>Peer List</h4>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>
@ -45,20 +48,20 @@
<td>Client</td>
</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>
<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><?= ($Connectable) ? '<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><?=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>
</tr>
<?
}
?>
</table>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>

View File

@ -5,13 +5,17 @@
$OldGroupID = $GroupID;
$NewName = $_POST['name'];
if(!$GroupID || !is_number($GroupID)) { error(404); }
if(empty($NewName)) {
error("Albums can't have no name");
if (!$GroupID || !is_number($GroupID)) {
error(404);
}
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);
list($OldName) = $DB->next_record(MYSQLI_NUM, false);

View File

@ -27,9 +27,9 @@
$Name .= $GroupName;
$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();
foreach($Users as $User) {
foreach ($Users as $User) {
$UserID = $User['uid'];
$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'];
if(!empty($_GET['page']) && is_number($_GET['page'])) {
if (!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = $_GET['page'];
$Limit = (string)(($Page-1)*100) .', 100';
$Limit = (string)(($Page - 1) * 100) .', 100';
} else {
$Page = 1;
$Limit = 100;
}
$Result = $DB->query("SELECT SQL_CALC_FOUND_ROWS
xs.uid,
xs.tstamp
FROM xbt_snatched AS xs
WHERE xs.fid='$TorrentID'
ORDER BY xs.tstamp DESC
LIMIT $Limit");
$Result = $DB->query("
SELECT SQL_CALC_FOUND_ROWS
xs.uid,
xs.tstamp
FROM xbt_snatched AS xs
WHERE xs.fid='$TorrentID'
ORDER BY xs.tstamp DESC
LIMIT $Limit");
$Results = $DB->to_array('uid', MYSQLI_ASSOC);
$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>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>
@ -41,10 +44,10 @@
<?
$i = 0;
foreach($Results as $ID=>$Data) {
foreach ($Results as $ID=>$Data) {
list($SnatcherID, $Timestamp) = array_values($Data);
if($i % 2 == 0 && $i>0) {
if ($i % 2 == 0 && $i > 0) {
?>
</tr>
<tr>
@ -59,6 +62,6 @@
?>
</tr>
</table>
<? if($NumResults>100) { ?>
<? if ($NumResults > 100) { ?>
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>

View File

@ -2,7 +2,9 @@
authorize();
$TorrentID = $_POST['torrentid'];
if(!$TorrentID || !is_number($TorrentID)) { error(404); }
if (!$TorrentID || !is_number($TorrentID)) {
error(404);
}
$DB->query("SELECT
t.UserID,
@ -20,16 +22,16 @@
WHERE t.ID='$TorrentID'");
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);
}
if($ArtistName) {
if ($ArtistName) {
$Name = $ArtistName.' - '.$Name;
}
if(isset($_SESSION['logged_user']['multi_delete'])) {
if($_SESSION['logged_user']['multi_delete']>=3 && !check_perms('torrents_delete_fast')) {
if (isset($_SESSION['logged_user']['multi_delete'])) {
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.');
}
$_SESSION['logged_user']['multi_delete']++;
@ -39,8 +41,8 @@
$InfoHash = unpack("H*", $InfoHash);
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']);
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);
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);
View::show_header('Torrent deleted');
?>

View File

@ -6,12 +6,14 @@
$Text = new TEXT;
// Quick SQL injection check
if(!$_REQUEST['groupid'] || !is_number($_REQUEST['groupid'])) {
if (!$_REQUEST['groupid'] || !is_number($_REQUEST['groupid'])) {
error(404);
}
// End injection check
if(!check_perms('site_edit_wiki')) { error(403); }
if (!check_perms('site_edit_wiki')) {
error(403);
}
// Variables for database input
$UserID = $LoggedUser['ID'];
@ -23,12 +25,14 @@
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'];
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"
if(empty($_GET['confirm'])) {
if (empty($_GET['confirm'])) {
View::show_header();
?>
<div class="center thin">
@ -61,18 +65,18 @@
$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'];
} else {
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
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);
}
// Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
if (!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = '';
}
ImageTools::blacklisted($Image);
@ -80,7 +84,7 @@
}
// Insert revision
if(empty($RevisionID)) { // edit
if (empty($RevisionID)) { // edit
$DB->query("INSERT INTO wiki_torrents (PageID, Body, Image, UserID, Summary, Time)
VALUES ('$GroupID', '".db_string($Body)."', '".db_string($Image)."', '$UserID', '$Summary', '".sqltime()."')");
@ -90,7 +94,9 @@
else { // revert
$DB->query("SELECT PageID,Body,Image FROM wiki_torrents WHERE RevisionID='$RevisionID'");
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)
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)
$DB->query("UPDATE torrents_group SET
RevisionID='$RevisionID',
".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : "")."
".((isset($VanityHouse)) ? "VanityHouse='$VanityHouse'," : '')."
WikiBody='$Body',
WikiImage='$Image'
WHERE ID='$GroupID'");
@ -119,7 +125,7 @@
$Cache->delete_value('torrents_details_'.$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()) {
$Cache->delete_value('collage_'.$CollageID);
}
@ -132,12 +138,12 @@
WHERE tg.ID = $GroupID");
$UserIDs = $DB->collect('UserID');
foreach($UserIDs as $UserID) {
foreach ($UserIDs as $UserID) {
$RecentUploads = $Cache->get_value('recent_uploads_'.$UserID);
if(is_array($RecentUploads)) {
foreach($RecentUploads as $Key => $Recent) {
if($Recent['ID'] == $GroupID) {
if($Recent['WikiImage'] != $Image) {
if (is_array($RecentUploads)) {
foreach ($RecentUploads as $Key => $Recent) {
if ($Recent['ID'] == $GroupID) {
if ($Recent['WikiImage'] != $Image) {
$Recent['WikiImage'] = $Image;
$Cache->begin_transaction('recent_uploads_'.$UserID);
$Cache->update_row($Key, $Recent);
@ -149,16 +155,16 @@
}
$DB->query("SELECT ID FROM torrents WHERE GroupID = ".$GroupID);
if($DB->record_count()) {
$TorrentIDs = implode(",", $DB->collect('ID'));
if ($DB->record_count()) {
$TorrentIDs = implode(',', $DB->collect('ID'));
$DB->query("SELECT DISTINCT uid FROM xbt_snatched WHERE fid IN (".$TorrentIDs.")");
$Snatchers = $DB->collect('uid');
foreach($Snatchers as $UserID) {
foreach ($Snatchers as $UserID) {
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
if(is_array($RecentSnatches)) {
foreach($RecentSnatches as $Key => $Recent) {
if($Recent['ID'] == $GroupID) {
if($Recent['WikiImage'] != $Image) {
if (is_array($RecentSnatches)) {
foreach ($RecentSnatches as $Key => $Recent) {
if ($Recent['ID'] == $GroupID) {
if ($Recent['WikiImage'] != $Image) {
$Recent['WikiImage'] = $Image;
$Cache->begin_transaction('recent_snatches_'.$UserID);
$Cache->update_row($Key, $Recent);

View File

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

View File

@ -4,16 +4,16 @@
$GroupID = db_string($_GET['groupid']);
$Way = db_string($_GET['way']);
if(!is_number($TagID) || !is_number($GroupID)) {
if (!is_number($TagID) || !is_number($GroupID)) {
error(404);
}
if(!in_array($Way, array('up', 'down'))) {
if (!in_array($Way, array('up', 'down'))) {
error(404);
}
$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($Way == 'down') {
if ($DB->record_count() == 0) {
if ($Way == 'down') {
$Change = 'NegativeVotes=NegativeVotes+1';
} else {
$Change = 'PositiveVotes=PositiveVotes+2';

View File

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

View File

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

View File

@ -14,17 +14,29 @@
$Octets[2] > 255 ||
$Octets[3] < 0 ||
$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] == 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) {
die('Invalid Port');
die('Invalid port');
}
//Error suppression, ugh.
// Error suppression, ugh.
if (@fsockopen($_GET['ip'], $_GET['port'], $Errno, $Errstr, 20)) {
die('Port '.$_GET['port'].' on '.$_GET['ip'].' connected successfully.');
} else {

View File

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

View File

@ -1,12 +1,12 @@
<?php
ini_set('display_errors', '1');authorize();
ini_set('display_errors', '1');
authorize();
$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]')");
}
elseif($_GET['perform'] == 'remove') {
} elseif ($_GET['perform'] == 'remove') {
$DB->query("DELETE FROM subscribed_users WHERE UserID = '$UserID' AND SubscriberID = '$LoggedUser[ID]'");
}
header('Location: user.php?id=' . $UserID);

View File

@ -94,41 +94,42 @@
$DB->query("SELECT
m.Username,
m.IP,
m.Email,
m.PermissionID,
p.Level AS Class,
m.Title,
m.Enabled,
m.Uploaded,
m.Downloaded,
m.Invites,
m.can_leech,
m.Visible,
i.AdminComment,
m.torrent_pass,
i.Donor,
i.Artist,
i.Warned,
i.SupportFor,
i.RestrictedForums,
i.PermittedForums,
DisableAvatar,
DisableInvites,
DisablePosting,
DisableForums,
DisableTagging,
DisableUpload,
DisableWiki,
DisablePM,
DisableIRC,
m.RequiredRatio,
m.FLTokens,
i.RatioWatchEnds,
SHA1(i.AdminComment) AS CommentHash,
GROUP_CONCAT(l.PermissionID SEPARATOR ',') AS SecondaryClasses
$DB->query("
SELECT
m.Username,
m.IP,
m.Email,
m.PermissionID,
p.Level AS Class,
m.Title,
m.Enabled,
m.Uploaded,
m.Downloaded,
m.Invites,
m.can_leech,
m.Visible,
i.AdminComment,
m.torrent_pass,
i.Donor,
i.Artist,
i.Warned,
i.SupportFor,
i.RestrictedForums,
i.PermittedForums,
DisableAvatar,
DisableInvites,
DisablePosting,
DisableForums,
DisableTagging,
DisableUpload,
DisableWiki,
DisablePM,
DisableIRC,
m.RequiredRatio,
m.FLTokens,
i.RatioWatchEnds,
SHA1(i.AdminComment) AS CommentHash,
GROUP_CONCAT(l.PermissionID SEPARATOR ',') AS SecondaryClasses
FROM users_main AS m
JOIN users_info AS i ON i.UserID = m.ID
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 ($_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']);
$DB->query("DELETE FROM users_main WHERE id=".$UserID);
$DB->query("DELETE FROM users_info WHERE UserID=".$UserID);
@ -221,7 +222,7 @@
if ($_POST['LogOut']) {
$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('users_sessions_'.$UserID);
@ -720,13 +721,13 @@
header("location: user.php?id=$UserID");
function translateUserStatus($status) {
switch($status) {
switch ($status) {
case 0:
return "Unconfirmed";
return 'Unconfirmed';
case 1:
return "Enabled";
return 'Enabled';
case 2:
return "Disabled";
return 'Disabled';
default:
return $status;
}
@ -735,9 +736,9 @@ function translateUserStatus($status) {
function translateLeechStatus($status) {
switch ($status) {
case 0:
return "Disabled";
return 'Disabled';
case 1:
return "Enabled";
return 'Enabled';
default:
return $status;
}

View File

@ -209,6 +209,7 @@ function check_paranoia_here($Setting) {
<div class="sidebar">
<?
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)) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar);
}

View File

@ -1,12 +1,12 @@
<?
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']));
if($UserSubscriptions = $DB->collect(0)) {
if ($UserSubscriptions = $DB->collect(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)
SELECT '$LoggedUser[ID]', ID, LastPostID FROM
forums_topics

View File

@ -11,12 +11,21 @@
************************************************************************/
$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();
if(!check_perms('users_view_email', $Class)) {
if (!check_perms('users_view_email', $Class)) {
error(403);
}
@ -40,9 +49,9 @@
GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
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_main AS m2 ON m2.ID=h.UserID
LEFT JOIN users_info AS i ON i.UserID=h.UserID
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_info AS i ON i.UserID=h.UserID
WHERE m.ID='$UserID'"
);
$CurrentEmail = array_shift($DB->to_array());
@ -61,9 +70,9 @@
i2.Donor AS UsersDonor,
i2.Warned AS UsersWarned
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_main AS m3 ON m3.ID=h3.UserID
LEFT JOIN users_info AS i2 ON i2.UserID=h3.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_info AS i2 ON i2.UserID=h3.UserID
WHERE h2.UserID='$UserID'
ORDER BY Time DESC"
);
@ -85,7 +94,7 @@
$UserSetTimes=explode('|', $CurrentEmail['UserSetTimes']);
$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]['IP'] = $UserIPs[$Key];
$CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
@ -187,7 +196,7 @@
<?
if ($CurrentMatches) {
// Match on the current email
foreach($CurrentMatches as $Match) {
foreach ($CurrentMatches as $Match) {
?>
<tr class="rowb">
<td><?=$Match['Username']?></td>

View File

@ -12,15 +12,24 @@
define('IPS_PER_PAGE', 25);
if(!check_perms('users_mod')) { error(403); }
if (!check_perms('users_mod')) {
error(403);
}
$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();
if(!check_perms('users_view_ips', $Class)) {
if (!check_perms('users_view_ips', $Class)) {
error(403);
}
@ -58,7 +67,7 @@ function ShowIPs(rowname) {
</tr>
<?
$Results = $DB->to_array();
foreach($Results as $Index => $Result) {
foreach ($Results as $Index => $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>
</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>
<?
}

View File

@ -251,15 +251,15 @@
<?
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>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<tr class="colhead_dark">
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>">
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
<span style="float: left;">
<?=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>
@ -294,21 +294,11 @@
if (!$ShowGrouped) {
?>
<tr>
<?
if (empty($HeavyInfo['DisableAvatars'])) {
?>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top">
<?
if ($Avatar) {
?>
<img src="<?=ImageTools::process($Avatar)?>" width="150" style="max-height:400px;" alt="<?=$Username?>'s avatar" />
<?
}
?>
<?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
</td>
<?
}
?>
<? } ?>
<td class="body" valign="top">
<div id="content<?=$PostID?>">
<?=$Text->full_format($Body)?>

View File

@ -14,26 +14,30 @@
$ShowAll = !empty($_GET['showall']);
if (!$ShowAll) {
$sql = "SELECT c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
AND ct.AddedOn>s.LastVisit
GROUP BY c.ID";
$sql = "
SELECT
c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = c.ID
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID=$LoggedUser[ID] AND c.Deleted='0'
AND ct.AddedOn>s.LastVisit
GROUP BY c.ID";
} else {
$sql = "SELECT c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = 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";
$sql = "
SELECT
c.ID,
c.Name,
c.NumTorrents,
s.LastVisit
FROM collages AS c
JOIN users_collage_subs AS s ON s.CollageID = 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);
@ -69,9 +73,9 @@
</div>
<?
} else {
$HideGroup='';
$ActionTitle="Hide";
$ActionURL="hide";
$HideGroup = '';
$ActionTitle = 'Hide';
$ActionURL = 'hide';
$ShowGroups = 0;
foreach ($CollageSubs as $Collage) {
@ -188,7 +192,7 @@
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></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>
</tr>
<?
@ -231,7 +235,7 @@
</td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></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>
</tr>
<?
@ -239,15 +243,15 @@
$TorrentTable.=ob_get_clean();
} ?>
<!-- I hate that proton is making me do it like this -->
<!--<div class="head colhead_dark" style="margin-top: 8px">-->
<table style="margin-top: 8px" class="subscribed_collages_table">
<!--<div class="head colhead_dark" style="margin-top: 8px;">-->
<table style="margin-top: 8px;" class="subscribed_collages_table">
<tr class="colhead_dark">
<td>
<span style="float:left;">
<strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount==1?'':'s')?>)
<span style="float: left;">
<strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount == 1 ? '' : 's')?>)
</span>&nbsp;
<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>
<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>
</span>
</td>
</tr>
@ -264,7 +268,7 @@
</tr>
<?=$TorrentTable?>
</table>
<? } // foreach() ?>
<? } // foreach () ?>
<?
} // else -- if (empty($NumResults)) ?>
</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()) {
?>
<table class="forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : '' ?>">
<table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : '' ?>">
<colgroup>
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
<? } ?>
<col class="col_post_body" />
</colgroup>
<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="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>
<? if ($PostID < $LastPostID && !$Locked) { ?>
<? if ($PostID < $LastPostID && !$Locked) { ?>
<span class="new">(New!)</span>
<? } ?>
<? } ?>
</span>
<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>
@ -166,13 +166,9 @@
</td>
</tr>
<tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>">
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top">
<? if ($AuthorAvatar) { ?>
<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" />
<? } ?>
<?=Users::show_avatar($AuthorAvatar, $AuthorName, $HeavyInfo['DisableAvatars'])?>
</td>
<? } ?>
<td class="body" valign="top">

View File

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

View File

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