Empty commit

This commit is contained in:
Git 2012-03-28 08:00:20 +00:00
parent 41c48c8972
commit c35708e845
89 changed files with 676 additions and 648 deletions

View File

@ -43,8 +43,7 @@ class CACHE extends Memcache {
public $CanClear = false; public $CanClear = false;
function __construct() { function __construct() {
$this->pconnect('192.168.5.6', 11211); $this->pconnect(MEMCACHED_HOST, MEMCACHED_PORT);
// $this->pconnect(MEMCACHED_HOST, MEMCACHED_PORT);
//$this->connect('localhost', 11211); //$this->connect('localhost', 11211);
} }

View File

@ -41,12 +41,10 @@ function make_tree(){
if(!$TreeID){ return; } if(!$TreeID){ return; }
$TreeQuery = $DB->query(" $TreeQuery = $DB->query("
SELECT SELECT
it.UserID, it.UserID,
Username,
Donor,
Warned,
Enabled, Enabled,
PermissionID, PermissionID,
Donor,
Uploaded, Uploaded,
Downloaded, Downloaded,
Paranoia, Paranoia,
@ -85,7 +83,7 @@ function make_tree(){
// We store this in an output buffer, so we can show the summary at the top without having to loop through twice // We store this in an output buffer, so we can show the summary at the top without having to loop through twice
ob_start(); ob_start();
while(list($ID, $Username, $Donor, $Warned, $Enabled, $Class, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = $DB->next_record()){ while(list($ID, $Enabled, $Class, $Donor, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = $DB->next_record()){
// Do stats // Do stats
$Count++; $Count++;
@ -116,7 +114,7 @@ function make_tree(){
} }
?> ?>
<li> <li>
<strong><?=format_username($ID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $Class)?></strong> <strong><?=format_username($ID, true, true, $Enabled != 2 ? false : true, true)?></strong>
<? <?
if(check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) { if(check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
$TotalUpload += $Uploaded; $TotalUpload += $Uploaded;

View File

@ -329,6 +329,10 @@ function set_query_id(&$ResultSet){
$this->QueryID = $ResultSet; $this->QueryID = $ResultSet;
$this->Row = 0; $this->Row = 0;
} }
function get_query_id() {
return $this->QueryID;
}
function beginning() { function beginning() {
mysqli_data_seek($this->QueryID, 0); mysqli_data_seek($this->QueryID, 0);

View File

@ -59,7 +59,6 @@ function table_query($TableName) {
} }
function get_rank($TableName, $Value) { function get_rank($TableName, $Value) {
return false;
if($Value == 0) { return 0; } if($Value == 0) { return 0; }
global $Cache, $DB; global $Cache, $DB;

View File

@ -73,7 +73,7 @@
// Get permissions // Get permissions
list($Classes, $ClassLevels) = $Cache->get_value('classes'); list($Classes, $ClassLevels) = $Cache->get_value('classes');
if(!$Classes || !$ClassLevels) { if(!$Classes || !$ClassLevels) {
$DB->query('SELECT ID, Name, Level FROM permissions ORDER BY Level'); $DB->query('SELECT ID, Name, Level, Secondary FROM permissions ORDER BY Level');
$Classes = $DB->to_array('ID'); $Classes = $DB->to_array('ID');
$ClassLevels = $DB->to_array('Level'); $ClassLevels = $DB->to_array('Level');
$Cache->cache_value('classes', array($Classes, $ClassLevels), 0); $Cache->cache_value('classes', array($Classes, $ClassLevels), 0);
@ -260,10 +260,11 @@
// Get cached user info, is used for the user loading the page and usernames all over the site // Get cached user info, is used for the user loading the page and usernames all over the site
function user_info($UserID) { function user_info($UserID) {
global $DB, $Cache; global $DB, $Cache, $Classes;
$UserInfo = $Cache->get_value('user_info_'.$UserID); $UserInfo = $Cache->get_value('user_info_'.$UserID);
// the !isset($UserInfo['Paranoia']) can be removed after a transition period // the !isset($UserInfo['Paranoia']) can be removed after a transition period
if(empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia'])) { if(empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia'])) {
$OldQueryID = $DB->get_query_id();
$DB->query("SELECT $DB->query("SELECT
@ -278,9 +279,11 @@ function user_info($UserID) {
m.Enabled, m.Enabled,
m.Title, m.Title,
i.CatchupTime, i.CatchupTime,
m.Visible m.Visible,
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels
FROM users_main AS m FROM users_main AS m
INNER JOIN users_info AS i ON i.UserID=m.ID INNER JOIN users_info AS i ON i.UserID=m.ID
JOIN users_levels AS ul ON ul.UserID = m.ID
WHERE m.ID='$UserID'"); WHERE m.ID='$UserID'");
if($DB->record_count() == 0) { // Deleted user, maybe? if($DB->record_count() == 0) { // Deleted user, maybe?
$UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1'); $UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1');
@ -293,7 +296,21 @@ function user_info($UserID) {
$UserInfo['Paranoia'] = array(); $UserInfo['Paranoia'] = array();
} }
} }
if (!empty($UserInfo['Levels'])) {
$UserInfo['ExtraClasses'] = array_fill_keys(explode(',', $UserInfo['Levels']), 1);
} else {
$UserInfo['ExtraClasses'] = array();
}
unset($UserInfo['Levels']);
$EffectiveClass = $Classes[$UserInfo['PermissionID']]['Level'];
foreach($UserInfo['ExtraClasses'] as $Class => $Val) {
$EffectiveClass = max($EffectiveClass, $Classes[$Class]['Level']);
}
$UserInfo['EffectiveClass'] = $EffectiveClass;
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000); $Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
$DB->set_query_id($OldQueryID);
} }
if(strtotime($UserInfo['Warned']) < time()) { if(strtotime($UserInfo['Warned']) < time()) {
$UserInfo['Warned'] = '0000-00-00 00:00:00'; $UserInfo['Warned'] = '0000-00-00 00:00:00';
@ -337,7 +354,8 @@ function user_heavy_info($UserID) {
i.LastReadNews, i.LastReadNews,
i.RestrictedForums, i.RestrictedForums,
i.PermittedForums, i.PermittedForums,
m.FLTokens m.FLTokens,
m.PermissionID
FROM users_main AS m FROM users_main AS m
INNER JOIN users_info AS i ON i.UserID=m.ID INNER JOIN users_info AS i ON i.UserID=m.ID
WHERE m.ID='$UserID'"); WHERE m.ID='$UserID'");
@ -348,7 +366,7 @@ function user_heavy_info($UserID) {
} else { } else {
$HeavyInfo['CustomPermissions'] = array(); $HeavyInfo['CustomPermissions'] = array();
} }
if (!empty($HeavyInfo['RestrictedForums'])) { if (!empty($HeavyInfo['RestrictedForums'])) {
$RestrictedForums = explode(',', $HeavyInfo['RestrictedForums']); $RestrictedForums = explode(',', $HeavyInfo['RestrictedForums']);
} else { } else {
@ -361,6 +379,19 @@ function user_heavy_info($UserID) {
$PermittedForums = array(); $PermittedForums = array();
} }
unset($HeavyInfo['PermittedForums']); unset($HeavyInfo['PermittedForums']);
$DB->query("SELECT PermissionID FROM users_levels WHERE UserID = $UserID");
$PermIDs = $DB->collect('PermissionID');
foreach ($PermIDs AS $PermID) {
$Perms = get_permissions($PermID);
if(!empty($Perms['PermittedForums'])) {
$PermittedForums = array_merge($PermittedForums,explode(',',$Perms['PermittedForums']));
}
}
$Perms = get_permissions($HeavyInfo['PermissionID']);
unset($HeavyInfo['PermissionID']);
$PermittedForums = array_merge($PermittedForums,explode(',',$Perms['PermittedForums']));
if (!empty($PermittedForums) || !empty($RestrictedForums)) { if (!empty($PermittedForums) || !empty($RestrictedForums)) {
$HeavyInfo['CustomForums'] = array(); $HeavyInfo['CustomForums'] = array();
foreach ($RestrictedForums as $ForumID) { foreach ($RestrictedForums as $ForumID) {
@ -422,7 +453,7 @@ function get_permissions($PermissionID) {
global $DB, $Cache; global $DB, $Cache;
$Permission = $Cache->get_value('perm_'.$PermissionID); $Permission = $Cache->get_value('perm_'.$PermissionID);
if(empty($Permission)) { if(empty($Permission)) {
$DB->query("SELECT p.Level AS Class, p.Values as Permissions FROM permissions AS p WHERE ID='$PermissionID'"); $DB->query("SELECT p.Level AS Class, p.Values as Permissions, p.Secondary, p.PermittedForums FROM permissions AS p WHERE ID='$PermissionID'");
$Permission = $DB->next_record(MYSQLI_ASSOC, array('Permissions')); $Permission = $DB->next_record(MYSQLI_ASSOC, array('Permissions'));
$Permission['Permissions'] = unserialize($Permission['Permissions']); $Permission['Permissions'] = unserialize($Permission['Permissions']);
$Cache->cache_value('perm_'.$PermissionID, $Permission, 2592000); $Cache->cache_value('perm_'.$PermissionID, $Permission, 2592000);
@ -448,17 +479,14 @@ function get_permissions_for_user($UserID, $CustomPermissions = false) {
$Permissions = get_permissions($UserInfo['PermissionID']); $Permissions = get_permissions($UserInfo['PermissionID']);
// Manage 'special' inherited permissions // Manage 'special' inherited permissions
if($UserInfo['Artist']) { $BonusPerms = array();
$ArtistPerms = get_permissions(ARTIST); $BonusCollages = 0;
} else { foreach ($UserInfo['ExtraClasses'] as $PermID => $Value) {
$ArtistPerms = array('Permissions' => array()); $ClassPerms = get_permissions($PermID);
} $BonusCollages += $ClassPerms['Permissions']['MaxCollages'];
unset($ClassPerms['Permissions']['MaxCollages']);
if($UserInfo['Donor']) { $BonusPerms = array_merge($BonusPerms, $ClassPerms['Permissions']);
$DonorPerms = get_permissions(DONOR);
} else {
$DonorPerms = array('Permissions' => array());
} }
if(!empty($CustomPermissions)) { if(!empty($CustomPermissions)) {
@ -467,10 +495,20 @@ function get_permissions_for_user($UserID, $CustomPermissions = false) {
$CustomPerms = array(); $CustomPerms = array();
} }
$MaxCollages = $Permissions['Permissions']['MaxCollages'] + $DonorPerms['Permissions']['MaxCollages'] + $ArtistPerms['Permissions']['MaxCollages'] + $CustomPerms['MaxCollages']; // This is legacy donor cruft
if($UserInfo['Donor']) {
$DonorPerms = get_permissions(DONOR);
} else {
$DonorPerms = array('Permissions' => array());
}
$MaxCollages = $Permissions['Permissions']['MaxCollages'] + $BonusCollages + $CustomPerms['MaxCollages'] + $DonorPerms['Permissions']['MaxCollages'];
//Combine the permissions //Combine the permissions
return array_merge($Permissions['Permissions'], $DonorPerms['Permissions'], $ArtistPerms['Permissions'], $CustomPerms, array('MaxCollages' => $MaxCollages)); return array_merge($Permissions['Permissions'], $BonusPerms, $CustomPerms, $DonorPerms['Permissions'], array('MaxCollages' => $MaxCollages));
//$MaxCollages = $Permissions['Permissions']['MaxCollages'] + $BonusCollages + $CustomPerms['MaxCollages'];
//Combine the permissions
//return array_merge($Permissions['Permissions'], $BonusPerms, $CustomPerms, array('MaxCollages' => $MaxCollages));
} }
// This function is slow. Don't call it unless somebody's logging in. // This function is slow. Don't call it unless somebody's logging in.
@ -1044,21 +1082,62 @@ function make_hash($Str,$Secret) {
$Class and $Title can be omitted for an abbreviated version $Class and $Title can be omitted for an abbreviated version
$IsDonor, $IsWarned and $IsEnabled can be omitted for a *very* abbreviated version $IsDonor, $IsWarned and $IsEnabled can be omitted for a *very* abbreviated version
*/ */
function format_username($UserID, $Username, $IsDonor = false, $IsWarned = '0000-00-00 00:00:00', $IsEnabled = true, $Class = false, $Title = false) { function format_username($UserID, $Badges = false, $IsWarned = true, $IsEnabled = true, $Class = false, $Title = false) {
global $Classes;
if($UserID == 0) { if($UserID == 0) {
return 'System'; return 'System';
} elseif($Username == '') { }
$UserInfo = user_info($UserID);
if($UserInfo['Username'] == '') {
return "Unknown [$UserID]"; return "Unknown [$UserID]";
} }
$str='<a href="user.php?id='.$UserID.'">'.$Username.'</a>';
$str.=($IsDonor) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" title="Donor" /></a>' : ''; $str = '';
if ($Title) {
$str .= '<strong>';
}
$str.='<a href="user.php?id='.$UserID.'">'.$UserInfo['Username'].'</a>';
if ($Title) {
$str .= '</strong>';
}
if ($Badges) {
$str.=($UserInfo['Donor'] == 1) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" title="Donor" /></a>' : '';
}
$str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned" /></a>' : '';
$str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? '<a href="rules.php"><img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" /></a>' : '';
}
$str.=($IsWarned!='0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned" />' : ''; $str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? '<img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned" />' : '';
$str.=(!$IsEnabled) ? '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" />' : ''; $str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" />' : '';
$str.=($Class) ? ' ('.make_class_string($Class).')' : ''; if ($Title && $Class) {
$str.=($Title) ? ' ('.$Title.')' : ''; $str .= '<strong>';
}
$str.=($Class) ? ' ('.make_class_string($UserInfo['PermissionID']).')' : '';
if ($Title && $Class) {
$str .= '</strong>';
}
if ($Title) {
// Image proxy CTs
if(check_perms('site_proxy_images') && !empty($UserTitle)) {
$UserTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Matches[2]).$Matches[3];
}, $UserTitle);
}
$str.='</strong>';
if ($UserInfo['Title']) {
$str.= ' <span class="user_title">('.$UserInfo['Title'].')</span>';
}
}
return $str; return $str;
} }
@ -1579,7 +1658,8 @@ function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
// Check to see if a user has the permission to perform an action // Check to see if a user has the permission to perform an action
function check_perms($PermissionName,$MinClass = 0) { function check_perms($PermissionName,$MinClass = 0) {
global $LoggedUser; global $LoggedUser;
return (isset($LoggedUser['Permissions'][$PermissionName]) && $LoggedUser['Permissions'][$PermissionName] && $LoggedUser['Class']>=$MinClass)?true:false; return (isset($LoggedUser['Permissions'][$PermissionName]) && $LoggedUser['Permissions'][$PermissionName]
&& ($LoggedUser['Class']>=$MinClass || $LoggedUser['EffectiveClass']>=$MinClass))?true:false;
} }
// TODO: make stricter, e.g. on all whitespace characters or Unicode normalisation // TODO: make stricter, e.g. on all whitespace characters or Unicode normalisation

View File

@ -168,7 +168,7 @@
<li id="nav_requests"><a href="requests.php">Requests</a></li> <li id="nav_requests"><a href="requests.php">Requests</a></li>
<li id="nav_forums"><a href="forums.php">Forums</a></li> <li id="nav_forums"><a href="forums.php">Forums</a></li>
<li id="nav_irc"><a href="chat.php">IRC</a></li> <li id="nav_irc"><a href="chat.php">IRC</a></li>
<!-- <li id="nav_top10"><a href="top10.php">Top 10</a></li>--> <li id="nav_top10"><a href="top10.php">Top 10</a></li>
<li id="nav_rules"><a href="rules.php">Rules</a></li> <li id="nav_rules"><a href="rules.php">Rules</a></li>
<li id="nav_wiki"><a href="wiki.php">Wiki</a></li> <li id="nav_wiki"><a href="wiki.php">Wiki</a></li>
<li id="nav_staff"><a href="staff.php">Staff</a></li> <li id="nav_staff"><a href="staff.php">Staff</a></li>

View File

@ -1,34 +0,0 @@
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=downslayer&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=MrBillhelm&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Fowler&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=MrBillhelm&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=mistersofty&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=oinky&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=mistersofty&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=mistersofty&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=mistersofty&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=jofwolves&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=jofwolves&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=zdeevfm&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=ulchm&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=celexicdream&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=cfstras&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=cfstras&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044
PHP Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=jofwolves&limit=1&api_key=LASTFM_API_KEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/vhosts/what/sections/irc/index.php on line 1044

View File

@ -43,17 +43,13 @@
t.ID, t.ID,
t.Title, t.Title,
t.AuthorID, t.AuthorID,
author.Username AS AuthorUsername,
t.IsLocked, t.IsLocked,
t.IsSticky, t.IsSticky,
t.NumPosts, t.NumPosts,
t.LastPostID, t.LastPostID,
t.LastPostTime, t.LastPostTime,
t.LastPostAuthorID, t.LastPostAuthorID,
last_author.Username AS LastPostUsername
FROM forums_topics AS t FROM forums_topics AS t
LEFT JOIN users_main AS last_author ON last_author.ID = t.LastPostAuthorID
LEFT JOIN users_main AS author ON author.ID = t.AuthorID
WHERE t.ForumID = '$ForumID' WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post LIMIT $Limit"); // Can be cached until someone makes a new post
@ -114,7 +110,7 @@
$JsonTopics = array(); $JsonTopics = array();
foreach ($Forum as $Topic) { foreach ($Forum as $Topic) {
list($TopicID, $Title, $AuthorID, $AuthorName, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID, $LastAuthorName) = array_values($Topic); list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
// handle read/unread posts - the reason we can't cache the whole page // handle read/unread posts - the reason we can't cache the whole page
if((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID']<$LastID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) { if((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID']<$LastID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) {
@ -122,6 +118,10 @@
} else { } else {
$Read = 'read'; $Read = 'read';
} }
$UserInfo = user_info($AuthorID);
$AuthorName = $UserInfo['Username'];
$UserInfo = user_info($LastAuthorID);
$LastAuthorName = $UserInfo['Username'];
$JsonTopics[] = array( $JsonTopics[] = array(
'topicId' => (int) $TopicID, 'topicId' => (int) $TopicID,

View File

@ -34,7 +34,6 @@
f.NumPosts, f.NumPosts,
f.LastPostID, f.LastPostID,
f.LastPostAuthorID, f.LastPostAuthorID,
um.Username,
f.LastPostTopicID, f.LastPostTopicID,
f.LastPostTime, f.LastPostTime,
COUNT(sr.ThreadID) AS SpecificRules, COUNT(sr.ThreadID) AS SpecificRules,
@ -44,7 +43,6 @@
FROM forums AS f FROM forums AS f
JOIN forums_categories AS fc ON fc.ID = f.CategoryID JOIN forums_categories AS fc ON fc.ID = f.CategoryID
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN users_main AS um ON um.ID=f.LastPostAuthorID
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
GROUP BY f.ID GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort");

View File

@ -39,7 +39,7 @@
$JsonCategory = array(); $JsonCategory = array();
$JsonForums = array(); $JsonForums = array();
foreach ($Forums as $Forum) { foreach ($Forums as $Forum) {
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastPostAuthorName, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum); list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) { if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) {
continue; continue;
} }
@ -63,7 +63,8 @@
} else { } else {
$Read = 'read'; $Read = 'read';
} }
$UserInfo = user_info($LastAuthorID);
$JsonForums[] = array( $JsonForums[] = array(
'forumId' => (int) $ForumID, 'forumId' => (int) $ForumID,
'forumName' => $ForumName, 'forumName' => $ForumName,
@ -72,7 +73,7 @@
'numPosts' => (float) $NumPosts, 'numPosts' => (float) $NumPosts,
'lastPostId' => (float) $LastPostID, 'lastPostId' => (float) $LastPostID,
'lastAuthorId' => (float) $LastAuthorID, 'lastAuthorId' => (float) $LastAuthorID,
'lastPostAuthorName' => $LastPostAuthorName, 'lastPostAuthorName' => $UserInfo['Username'],
'lastTopicId' => (float) $LastTopicID, 'lastTopicId' => (float) $LastTopicID,
'lastTime' => $LastTime, 'lastTime' => $LastTime,
'specificRules' => $SpecificRules, 'specificRules' => $SpecificRules,

View File

@ -86,9 +86,7 @@
p.Body, p.Body,
p.EditedUserID, p.EditedUserID,
p.EditedTime, p.EditedTime,
ed.Username
FROM forums_posts as p FROM forums_posts as p
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
WHERE p.TopicID = '$ThreadID' AND p.ID != '".$ThreadInfo['StickyPostID']."' WHERE p.TopicID = '$ThreadID' AND p.ID != '".$ThreadInfo['StickyPostID']."'
LIMIT $CatalogueLimit"); LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC); $Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
@ -217,15 +215,16 @@
$JsonPosts = array(); $JsonPosts = array();
foreach ($Thread as $Key => $Post) { foreach ($Thread as $Key => $Post) {
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post); list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID)); list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
$UserInfo = user_info($EditedUserID);
$JsonPosts[] = array( $JsonPosts[] = array(
'postId' => (int) $PostID, 'postId' => (int) $PostID,
'addedTime' => $AddedTime, 'addedTime' => $AddedTime,
'body' => $Text->full_format($Body), 'body' => $Text->full_format($Body),
'editedUserId' => (int) $EditedUserID, 'editedUserId' => (int) $EditedUserID,
'editedTime' => $EditedTime, 'editedTime' => $EditedTime,
'editedUsername' => $EditedUsername, 'editedUsername' => $UserInfo['Username'],
'author' => array( 'author' => array(
'authorId' => (int) $AuthorID, 'authorId' => (int) $AuthorID,
'authorName' => $Username, 'authorName' => $Username,

View File

@ -39,15 +39,14 @@
WHERE c.ID='$ConvID' AND UserID='$UserID'"); WHERE c.ID='$ConvID' AND UserID='$UserID'");
list($Subject, $Sticky, $UnRead, $ForwardedID, $ForwardedName) = $DB->next_record(); list($Subject, $Sticky, $UnRead, $ForwardedID, $ForwardedName) = $DB->next_record();
$DB->query("SELECT UserID, Username, PermissionID, Enabled, Donor, Warned $DB->query("SELECT um.ID, Username
FROM pm_messages AS pm FROM pm_messages AS pm
JOIN users_info AS ui ON ui.UserID=pm.SenderID
JOIN users_main AS um ON um.ID=pm.SenderID JOIN users_main AS um ON um.ID=pm.SenderID
WHERE pm.ConvID='$ConvID'"); WHERE pm.ConvID='$ConvID'");
while(list($PMUserID, $Username, $PermissionID, $Enabled, $Donor, $Warned) = $DB->next_record()) { while(list($PMUserID, $Username) = $DB->next_record()) {
$PMUserID = (int)$PMUserID; $PMUserID = (int)$PMUserID;
$Users[$PMUserID]['UserStr'] = format_username($PMUserID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $PermissionID); $Users[$PMUserID]['UserStr'] = format_username($PMUserID, true, true, true, true);
$Users[$PMUserID]['Username'] = $Username; $Users[$PMUserID]['Username'] = $Username;
} }
$Users[0]['UserStr'] = 'System'; // in case it's a message from the system $Users[0]['UserStr'] = 'System'; // in case it's a message from the system

View File

@ -2,7 +2,7 @@
// Already done in /sections/ajax/index.php // Already done in /sections/ajax/index.php
//enforce_login(); //enforce_login();
if(1 || !check_perms('site_top10')){ if(!check_perms('site_top10')){
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die(); die();
} }

View File

@ -74,7 +74,7 @@
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a> <span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a>
by <strong><?=format_username($AuthorID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></strong> <? if ($UserTitle) { echo '('.$UserTitle.')'; }?> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$PostID?>">[Report Comment]</a> by <?=format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$PostID?>">[Report Comment]</a>
<? if (!$ThreadInfo['IsLocked']){ ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a><? } <? if (!$ThreadInfo['IsLocked']){ ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a><? }
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');">[Edit]</a><? } if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');">[Edit]</a><? }
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?> if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>

View File

@ -74,11 +74,9 @@
c.NumTorrents, c.NumTorrents,
c.TagList, c.TagList,
c.CategoryID, c.CategoryID,
c.UserID, c.UserID
um.Username
FROM collages AS c FROM collages AS c
$BookmarkJoin $BookmarkJoin
LEFT JOIN users_main AS um ON um.ID=c.UserID
WHERE Deleted = '0'"; WHERE Deleted = '0'";
if ($BookmarkView) { if ($BookmarkView) {
@ -271,7 +269,7 @@
<? <?
$Row = 'a'; // For the pretty colours $Row = 'a'; // For the pretty colours
foreach ($Collages as $Collage) { foreach ($Collages as $Collage) {
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID, $Username) = $Collage; list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID) = $Collage;
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
$TagList = explode(' ', $TagList); $TagList = explode(' ', $TagList);
$Tags = array(); $Tags = array();
@ -298,7 +296,7 @@
</div> </div>
</td> </td>
<td><?=(int)$NumTorrents?></td> <td><?=(int)$NumTorrents?></td>
<td><?=format_username($UserID, $Username)?></td> <td><?=format_username($UserID, false, false, false)?></td>
</tr> </tr>
<? } ?> <? } ?>
</table> </table>

View File

@ -515,7 +515,7 @@ function compare($X, $Y){
$i++; $i++;
if($i>5) { break; } if($i>5) { break; }
?> ?>
<li><?=format_username($ID, $User['name'])?> (<?=$User['count']?>)</li> <li><?=format_username($ID, false, false, false)?> (<?=$User['count']?>)</li>
<? <?
} }
?> ?>
@ -569,7 +569,7 @@ function compare($X, $Y){
list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
?> ?>
<div class="box"> <div class="box">
<div class="head">By <?=format_username($UserID, $Username) ?> <?=time_diff($CommentTime) ?> <a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>">[Report Comment]</a></div> <div class="head">By <?=format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?> <a href="reports.php?action=report&amp;type=collages_comment&amp;id=<?=$CommentID?>">[Report Comment]</a></div>
<div class="pad"><?=$Text->full_format($Body)?></div> <div class="pad"><?=$Text->full_format($Body)?></div>
</div> </div>
<? <?

View File

@ -7,12 +7,10 @@
if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); } if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
$DB->query("SELECT ct.GroupID, $DB->query("SELECT ct.GroupID,
um.ID, ct.UserID,
um.Username,
ct.Sort ct.Sort
FROM collages_torrents AS ct FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID JOIN torrents_group AS tg ON tg.ID=ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID
WHERE ct.CollageID='$CollageID' WHERE ct.CollageID='$CollageID'
ORDER BY ct.Sort"); ORDER BY ct.Sort");
@ -43,7 +41,7 @@
$Number = 0; $Number = 0;
foreach ($TorrentList as $GroupID=>$Group) { foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group); list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
list($GroupID2, $UserID, $Username, $Sort) = array_values($CollageDataList[$GroupID]); list($GroupID2, $UserID, $Sort) = array_values($CollageDataList[$GroupID]);
$Number++; $Number++;
@ -74,7 +72,7 @@
<?=$DisplayName?> <?=$DisplayName?>
</td> </td>
<td> <td>
<?=format_username($UserID, $Username)?> <?=format_username($UserID, false, false, false)?>
</td> </td>
<td> <td>
<input type="submit" name="submit" value="Edit" /> <input type="submit" name="submit" value="Edit" />

View File

@ -51,40 +51,25 @@
else { else {
$Conditions = "WHERE tc.AuthorID = $UserID"; $Conditions = "WHERE tc.AuthorID = $UserID";
$Title = 'Comments made by '.($Self?'you':$Username); $Title = 'Comments made by '.($Self?'you':$Username);
$Header = 'Torrent comments left by '.($Self?'you':format_username($UserID, $Username)).''; $Header = 'Torrent comments left by '.($Self?'you':format_username($UserID, false, false, false)).'';
if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>'; if($Self) $OtherLink = '<a href="comments.php?action=my_torrents">Display comments left on your uploads</a>';
} }
$Comments = $DB->query("SELECT $Comments = $DB->query("SELECT
SQL_CALC_FOUND_ROWS SQL_CALC_FOUND_ROWS
m.ID, tc.AuthorID,
m.Username,
m.PermissionID,
m.Enabled,
i.Avatar,
i.Donor,
i.Warned,
t.ID, t.ID,
t.GroupID, t.GroupID,
tg.Name, tg.Name,
tc.ID, tc.ID,
tc.Body, tc.Body,
tc.AddedTime, tc.AddedTime,
tc.EditedTime, tc.EditedTime,
tc.EditedUserID as EditorID
em.ID as EditorID,
em.Username as EditorUsername
FROM torrents as t FROM torrents as t
JOIN torrents_comments as tc ON tc.GroupID = t.GroupID JOIN torrents_comments as tc ON tc.GroupID = t.GroupID
JOIN users_main as m ON tc.AuthorID = m.ID
JOIN users_info as i ON i.UserID = m.ID
JOIN torrents_group as tg ON t.GroupID = tg.ID JOIN torrents_group as tg ON t.GroupID = tg.ID
LEFT JOIN users_main as em ON em.ID = tc.EditedUserID
$Conditions $Conditions
@ -119,13 +104,14 @@
</div> </div>
<?php <?php
while(list($UserID, $Username, $Class, $Enabled, $Avatar, $Donor, $Warned, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID, $EditorUsername) = $DB->next_record()) { while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) {
$UserInfo = user_info($UserID);
?> ?>
<table class='forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>' id="post<?=$PostID?>"> <table class='forum_post box vertical_margin<?=$HeavyInfo['DisableAvatars'] ? ' noavatar' : ''?>' id="post<?=$PostID?>">
<tr class='colhead_dark'> <tr class='colhead_dark'>
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a> <span style="float:left;"><a href='torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
by <strong><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $Class)?></strong> <?=time_diff($AddedTime) ?> by <strong><?=format_username($UserID, true, true, true, true, false)?></strong> <?=time_diff($AddedTime) ?>
on <?=display_artists($Artists[$GroupID])?><a href="torrents.php?id=<?=$GroupID?>"><?=$Title?></a> on <?=display_artists($Artists[$GroupID])?><a href="torrents.php?id=<?=$GroupID?>"><?=$Title?></a>
</span> </span>
</td> </td>
@ -136,9 +122,9 @@
?> ?>
<td class='avatar' valign="top"> <td class='avatar' valign="top">
<? <?
if($Avatar){ if($UserInfo['Avatar']){
?> ?>
<img src='<?=$Avatar?>' width='150' alt="<?=$Username ?>'s avatar" /> <img src='<?=$UserInfo['Avatar']?>' width='150' alt="<?=$UserInfo['Username']?>'s avatar" />
<? <?
} else { ?> } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" /> <img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
@ -156,7 +142,7 @@
?> ?>
<br /><br /> <br /><br />
Last edited by Last edited by
<?=format_username($EditorID, $EditorUsername) ?> <?=time_diff($EditedTime)?> <?=format_username($EditorID, false, false, false) ?> <?=time_diff($EditedTime)?>
<? <?
} }
?> ?>

View File

@ -25,18 +25,17 @@
$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, um.Username, ce.EditTime, ce.Body $DB->query("SELECT ce.EditUser, ce.EditTime, ce.Body
FROM comments_edits AS ce FROM comments_edits AS ce
JOIN users_main AS um ON um.ID=ce.EditUser
WHERE Page = '".$Type."' AND PostID = ".$PostID." WHERE Page = '".$Type."' AND PostID = ".$PostID."
ORDER BY ce.EditTime DESC"); ORDER BY ce.EditTime DESC");
$Edits = $DB->to_array(); $Edits = $DB->to_array();
$Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0); $Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0);
} }
list($UserID, $Username, $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) {
@ -66,7 +65,7 @@
<? 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')?>
<?=format_username($UserID, $Username) ?> <?=time_diff($Time,2,true,true)?> <?=format_username($UserID, false, false, false) ?> <?=time_diff($Time,2,true,true)?>
<? } else { ?> <? } else { ?>
<em>Original Post</em> <em>Original Post</em>
<? } <? }

View File

@ -58,7 +58,6 @@
'NumPosts' => '-1', 'NumPosts' => '-1',
'LastPostID' => $LastTopicPostID, 'LastPostID' => $LastTopicPostID,
'LastPostAuthorID' => $LastTopicAuthorID, 'LastPostAuthorID' => $LastTopicAuthorID,
'Username' => $LastTopicAuthorName,
'LastPostTime' => $LastTopicPostTime, 'LastPostTime' => $LastTopicPostTime,
'LastPostTopicID' => $LastTopicID, 'LastPostTopicID' => $LastTopicID,
'Title' => $LastTopicTitle); 'Title' => $LastTopicTitle);
@ -68,7 +67,6 @@
'NumPosts' => '-1', 'NumPosts' => '-1',
'LastPostID' => $LastID, 'LastPostID' => $LastID,
'LastPostAuthorID' => $LastAuthorID, 'LastPostAuthorID' => $LastAuthorID,
'Username' => $LastAuthorName,
'LastPostTime' => $LastTime); 'LastPostTime' => $LastTime);
} }
$UpdateArrayThread = array('Posts' => '-1', 'LastPostAuthorID' => $LastAuthorID); $UpdateArrayThread = array('Posts' => '-1', 'LastPostAuthorID' => $LastAuthorID);

View File

@ -36,17 +36,13 @@
t.ID, t.ID,
t.Title, t.Title,
t.AuthorID, t.AuthorID,
author.Username AS AuthorUsername,
t.IsLocked, t.IsLocked,
t.IsSticky, t.IsSticky,
t.NumPosts, t.NumPosts,
t.LastPostID, t.LastPostID,
t.LastPostTime, t.LastPostTime,
t.LastPostAuthorID, t.LastPostAuthorID
last_author.Username AS LastPostUsername
FROM forums_topics AS t FROM forums_topics AS t
LEFT JOIN users_main AS last_author ON last_author.ID = t.LastPostAuthorID
LEFT JOIN users_main AS author ON author.ID = t.AuthorID
WHERE t.ForumID = '$ForumID' WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC ORDER BY t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post LIMIT $Limit"); // Can be cached until someone makes a new post
@ -63,6 +59,7 @@
if (!check_perms('site_moderate_forums')) { if (!check_perms('site_moderate_forums')) {
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); } if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); }
} }
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); } if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
// Start printing // Start printing
@ -162,7 +159,7 @@
$Row='a'; $Row='a';
foreach($Forum as $Topic){ foreach($Forum as $Topic){
list($TopicID, $Title, $AuthorID, $AuthorName, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID, $LastAuthorName) = array_values($Topic); list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
// Build list of page links // Build list of page links
@ -216,11 +213,11 @@
</span> </span>
<? } ?> <? } ?>
<span style="float:right;" class="last_poster"> <span style="float:right;" class="last_poster">
by <?=format_username($LastAuthorID, $LastAuthorName)?> <?=time_diff($LastTime,1)?> by <?=format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?>
</span> </span>
</td> </td>
<td><?=number_format($PostCount-1)?></td> <td><?=number_format($PostCount-1)?></td>
<td><?=format_username($AuthorID, $AuthorName)?></td> <td><?=format_username($AuthorID, false, false, false)?></td>
</tr> </tr>
<? } <? }
} ?> } ?>

View File

@ -34,7 +34,6 @@
f.NumPosts, f.NumPosts,
f.LastPostID, f.LastPostID,
f.LastPostAuthorID, f.LastPostAuthorID,
um.Username,
f.LastPostTopicID, f.LastPostTopicID,
f.LastPostTime, f.LastPostTime,
COUNT(sr.ThreadID) AS SpecificRules, COUNT(sr.ThreadID) AS SpecificRules,
@ -44,7 +43,6 @@
FROM forums AS f FROM forums AS f
JOIN forums_categories AS fc ON fc.ID = f.CategoryID JOIN forums_categories AS fc ON fc.ID = f.CategoryID
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN users_main AS um ON um.ID=f.LastPostAuthorID
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
GROUP BY f.ID GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort");

View File

@ -41,7 +41,7 @@
$RestrictedForums = explode(',', $RestrictedForums); $RestrictedForums = explode(',', $RestrictedForums);
$PermittedForums = array_keys($LoggedUser['PermittedForums']); $PermittedForums = array_keys($LoggedUser['PermittedForums']);
foreach ($Forums as $Forum) { foreach ($Forums as $Forum) {
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastPostAuthorName, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum); list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) { if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== FALSE)) {
continue; continue;
} }
@ -98,7 +98,7 @@
<a href="forums.php?action=viewthread&amp;threadid=<?=$LastTopicID?>&amp;page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$LastTopicID?>&amp;page=<?=$LastRead[$LastTopicID]['Page']?>#post<?=$LastRead[$LastTopicID]['PostID']?>"></a>
</span> </span>
<? } ?> <? } ?>
<span style="float:right;" class="last_poster">by <?=format_username($LastAuthorID, $LastPostAuthorName)?> <?=time_diff($LastTime,1)?></span> <span style="float:right;" class="last_poster">by <?=format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?></span>
</td> </td>
<td><?=number_format($NumTopics)?></td> <td><?=number_format($NumTopics)?></td>
<td><?=number_format($NumPosts)?></td> <td><?=number_format($NumPosts)?></td>

View File

@ -91,7 +91,6 @@
'NumTopics'=>'-1', 'NumTopics'=>'-1',
'LastPostID'=>$NewLastPostID, 'LastPostID'=>$NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID'=>$NewLastAuthorID,
'Username'=>$NewLastAuthorName,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID'=>$NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime'=>$NewLastAddedTime,
'Title'=>$NewLastTitle, 'Title'=>$NewLastTitle,
@ -176,7 +175,6 @@
'NumTopics'=>'-1', 'NumTopics'=>'-1',
'LastPostID'=>$NewLastPostID, 'LastPostID'=>$NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID'=>$NewLastAuthorID,
'Username'=>$NewLastAuthorName,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID'=>$NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime'=>$NewLastAddedTime,
'Title'=>$NewLastTitle, 'Title'=>$NewLastTitle,
@ -219,7 +217,6 @@
'NumTopics'=>'+1', 'NumTopics'=>'+1',
'LastPostID'=>$NewLastPostID, 'LastPostID'=>$NewLastPostID,
'LastPostAuthorID'=>$NewLastAuthorID, 'LastPostAuthorID'=>$NewLastAuthorID,
'Username'=>$NewLastAuthorName,
'LastPostTopicID'=>$NewLastTopic, 'LastPostTopicID'=>$NewLastTopic,
'LastPostTime'=>$NewLastAddedTime, 'LastPostTime'=>$NewLastAddedTime,
'Title'=>$NewLastTitle 'Title'=>$NewLastTitle

View File

@ -46,7 +46,7 @@
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#newthreadpreview'>#XXXXXX</a> <span style="float:left;"><a href='#newthreadpreview'>#XXXXXX</a>
by <strong><?=format_username($LoggedUser['ID'], $LoggedUser['Username'], $LoggedUser['Donor'], $LoggedUser['Warned'], $LoggedUser['Enabled'] == 2 ? false : true, $LoggedUser['PermissionID'])?></strong> <? if (!empty($LoggedUser['Title'])) { echo '('.$LoggedUser['Title'].')'; }?> by <strong><?=format_username($LoggedUser['ID'], true, true, true, true, true)?></strong> <? if (!empty($LoggedUser['Title'])) { echo '('.$LoggedUser['Title'].')'; }?>
Just now Just now
</span> </span>
<span id="barpreview" style="float:right;"> <span id="barpreview" style="float:right;">

View File

@ -136,7 +136,6 @@
'ID' => $TopicID, 'ID' => $TopicID,
'Title' => $Title, 'Title' => $Title,
'AuthorID' => $LoggedUser['ID'], 'AuthorID' => $LoggedUser['ID'],
'AuthorUsername' => $LoggedUser['Username'],
'IsLocked' => 0, 'IsLocked' => 0,
'IsSticky' => 0, 'IsSticky' => 0,
'NumPosts' => 1, 'NumPosts' => 1,
@ -157,7 +156,6 @@
'NumTopics'=>'+1', 'NumTopics'=>'+1',
'LastPostID'=>$PostID, 'LastPostID'=>$PostID,
'LastPostAuthorID'=>$LoggedUser['ID'], 'LastPostAuthorID'=>$LoggedUser['ID'],
'Username'=>$LoggedUser['Username'],
'LastPostTopicID'=>$TopicID, 'LastPostTopicID'=>$TopicID,
'LastPostTime'=>sqltime(), 'LastPostTime'=>sqltime(),
'Title'=>$Title, 'Title'=>$Title,
@ -178,7 +176,6 @@
'Body'=>$Body, 'Body'=>$Body,
'EditedUserID'=>0, 'EditedUserID'=>0,
'EditedTime'=>'0000-00-00 00:00:00', 'EditedTime'=>'0000-00-00 00:00:00',
'Username'=>''
); );
$Cache->insert('', $Post); $Cache->insert('', $Post);
$Cache->commit_transaction(0); $Cache->commit_transaction(0);

View File

@ -124,7 +124,6 @@
$Thread['LastPostID'] = $PostID; //Set postid for read/unread $Thread['LastPostID'] = $PostID; //Set postid for read/unread
$Thread['LastPostTime'] = sqltime(); //Time of last post $Thread['LastPostTime'] = sqltime(); //Time of last post
$Thread['LastPostAuthorID'] = $LoggedUser['ID']; //Last poster id $Thread['LastPostAuthorID'] = $LoggedUser['ID']; //Last poster id
$Thread['LastPostUsername'] = $LoggedUser['Username']; //Last poster username
$Part2 = array($TopicID=>$Thread); //Bumped thread $Part2 = array($TopicID=>$Thread); //Bumped thread
//if we're bumping from an older page //if we're bumping from an older page
@ -136,20 +135,18 @@
//Never know if we get a page full of stickies... //Never know if we get a page full of stickies...
if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) { if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) {
//Pull the data for the thread we're bumping //Pull the data for the thread we're bumping
$DB->query("SELECT f.AuthorID, f.IsLocked, f.IsSticky, f.NumPosts, u.Username, ISNULL(p.TopicID) AS NoPoll FROM forums_topics AS f INNER JOIN users_main AS u ON u.ID=f.AuthorID LEFT JOIN forums_polls AS p ON p.TopicID=f.ID WHERE f.ID ='$TopicID'"); $DB->query("SELECT f.AuthorID, f.IsLocked, f.IsSticky, f.NumPosts, ISNULL(p.TopicID) AS NoPoll FROM forums_topics AS f LEFT JOIN forums_polls AS p ON p.TopicID=f.ID WHERE f.ID ='$TopicID'");
list($AuthorID,$IsLocked,$IsSticky,$NumPosts,$AuthorName,$NoPoll) = $DB->next_record(); list($AuthorID,$IsLocked,$IsSticky,$NumPosts,$NoPoll) = $DB->next_record();
$Part2 = array($TopicID => array( $Part2 = array($TopicID => array(
'ID' => $TopicID, 'ID' => $TopicID,
'Title' => $ThreadInfo['Title'], 'Title' => $ThreadInfo['Title'],
'AuthorID' => $AuthorID, 'AuthorID' => $AuthorID,
'AuthorUsername' => $AuthorName,
'IsLocked' => $IsLocked, 'IsLocked' => $IsLocked,
'IsSticky' => $IsSticky, 'IsSticky' => $IsSticky,
'NumPosts' => $NumPosts, 'NumPosts' => $NumPosts,
'LastPostID' => $PostID, 'LastPostID' => $PostID,
'LastPostTime' => sqltime(), 'LastPostTime' => sqltime(),
'LastPostAuthorID' => $LoggedUser['ID'], 'LastPostAuthorID' => $LoggedUser['ID'],
'LastPostUsername' => $LoggedUser['Username'],
'NoPoll' => $NoPoll 'NoPoll' => $NoPoll
)); //Bumped )); //Bumped
} else { } else {
@ -178,7 +175,6 @@
'NumPosts'=>'+1', 'NumPosts'=>'+1',
'LastPostID'=>$PostID, 'LastPostID'=>$PostID,
'LastPostAuthorID'=>$LoggedUser['ID'], 'LastPostAuthorID'=>$LoggedUser['ID'],
'Username'=>$LoggedUser['Username'],
'LastPostTopicID'=>$TopicID, 'LastPostTopicID'=>$TopicID,
'LastPostTime'=>sqltime(), 'LastPostTime'=>sqltime(),
'Title'=>$ThreadInfo['Title'], 'Title'=>$ThreadInfo['Title'],

View File

@ -366,20 +366,12 @@
foreach($Thread as $Key => $Post){ foreach($Thread as $Key => $Post){
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post); list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID)); list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(user_info($AuthorID));
// Image proxy CTs
if(check_perms('site_proxy_images') && !empty($UserTitle)) {
$UserTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Matches[2]).$Matches[3];
}, $UserTitle);
}
?> ?>
<table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?>" id="post<?=$PostID?>"> <table class="forum_post box vertical_margin<? if (((!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) && $PostID>$LastRead && strtotime($AddedTime)>$LoggedUser['CatchupTime']) || (isset($RequestKey) && $Key==$RequestKey)) { echo ' forum_unread'; } if($HeavyInfo['DisableAvatars']) { echo ' noavatar'; } ?>" id="post<?=$PostID?>">
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a class="post_id" href='forums.php?action=viewthread&amp;threadid=<?=$ThreadID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a> <span style="float:left;"><a class="post_id" href='forums.php?action=viewthread&amp;threadid=<?=$ThreadID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
<strong><?=format_username($AuthorID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $PermissionID)?></strong> <?=format_username($AuthorID, true, true, true, true, true)?>
<span class="user_title"><?=!empty($UserTitle) ? '('.$UserTitle.')' : '' ?></span>
<?=time_diff($AddedTime,2)?> <?=time_diff($AddedTime,2)?>
<? if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')){ ?> <? if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')){ ?>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
@ -429,7 +421,7 @@
<a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit('forums', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=format_username($EditedUserID, $EditedUsername) ?> <?=time_diff($EditedTime,2,true,true)?> <?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>
@ -456,8 +448,7 @@
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a> <span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
by <strong><?=format_username($LoggedUser['ID'], $LoggedUser['Username'], $LoggedUser['Donor'], $LoggedUser['Warned'], $LoggedUser['Enabled'] == 2 ? false : true, $LoggedUser['PermissionID'])?></strong> <? if (!empty($LoggedUser['Title'])) { echo '('.$LoggedUser['Title'].')'; }?> by <?=format_username($LoggedUser['ID'], true, true, true, true, true)?> Just now
Just now
</span> </span>
<span id="barpreview" style="float:right;"> <span id="barpreview" style="float:right;">
<a href="#quickreplypreview">[Report Post]</a> <a href="#quickreplypreview">[Report Post]</a>

View File

@ -29,11 +29,7 @@
m.Uploaded, m.Uploaded,
m.Downloaded, m.Downloaded,
m.PermissionID, m.PermissionID,
m.Enabled,
m.Paranoia, m.Paranoia,
i.Donor,
i.Warned,
m.Title,
m.LastAccess, m.LastAccess,
i.Avatar i.Avatar
FROM friends AS f FROM friends AS f
@ -65,14 +61,14 @@
} }
// Start printing out friends // Start printing out friends
foreach($Friends as $Friend) { foreach($Friends as $Friend) {
list($FriendID, $Comment, $Username, $Uploaded, $Downloaded, $Class, $Enabled, $Paranoia, $Donor, $Warned, $Title, $LastAccess, $Avatar) = $Friend; list($FriendID, $Comment, $Username, $Uploaded, $Downloaded, $Class, $Paranoia, $LastAccess, $Avatar) = $Friend;
?> ?>
<form action="friends.php" method="post"> <form action="friends.php" method="post">
<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> <tr>
<td class="colhead" colspan="3"> <td class="colhead" colspan="3">
<span style="float:left;"><?=format_username($FriendID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $Class)?> <span style="float:left;"><?=format_username($FriendID, true, true, true, true)?>
<? if(check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?> <? if(check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Ratio: <strong><?=ratio($Uploaded, $Downloaded)?></strong> &nbsp;Ratio: <strong><?=ratio($Uploaded, $Downloaded)?></strong>
<? } ?> <? } ?>

View File

@ -27,23 +27,20 @@
c.Subject, c.Subject,
cu.Sticky, cu.Sticky,
cu.UnRead, cu.UnRead,
cu.ForwardedTo, cu.ForwardedTo
um.Username
FROM pm_conversations AS c FROM pm_conversations AS c
JOIN pm_conversations_users AS cu ON c.ID=cu.ConvID JOIN pm_conversations_users AS cu ON c.ID=cu.ConvID
LEFT JOIN users_main AS um ON um.ID=cu.ForwardedTo
WHERE c.ID='$ConvID' AND UserID='$UserID'"); WHERE c.ID='$ConvID' AND UserID='$UserID'");
list($Subject, $Sticky, $UnRead, $ForwardedID, $ForwardedName) = $DB->next_record(); list($Subject, $Sticky, $UnRead, $ForwardedID) = $DB->next_record();
$DB->query("SELECT UserID, Username, PermissionID, Enabled, Donor, Warned $DB->query("SELECT um.ID, Username
FROM pm_messages AS pm FROM pm_messages AS pm
JOIN users_info AS ui ON ui.UserID=pm.SenderID
JOIN users_main AS um ON um.ID=pm.SenderID JOIN users_main AS um ON um.ID=pm.SenderID
WHERE pm.ConvID='$ConvID'"); WHERE pm.ConvID='$ConvID'");
while(list($PMUserID, $Username, $PermissionID, $Enabled, $Donor, $Warned) = $DB->next_record()) { while(list($PMUserID, $Username) = $DB->next_record()) {
$PMUserID = (int)$PMUserID; $PMUserID = (int)$PMUserID;
$Users[$PMUserID]['UserStr'] = format_username($PMUserID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $PermissionID); $Users[$PMUserID]['UserStr'] = format_username($PMUserID, true, true, true, true);
$Users[$PMUserID]['Username'] = $Username; $Users[$PMUserID]['Username'] = $Username;
} }
$Users[0]['UserStr'] = 'System'; // in case it's a message from the system $Users[0]['UserStr'] = 'System'; // in case it's a message from the system

View File

@ -38,20 +38,13 @@
cu.Unread, cu.Unread,
cu.Sticky, cu.Sticky,
cu.ForwardedTo, cu.ForwardedTo,
um2.Username AS ForwardedName, cu2.UserID,";
cu2.UserID,
um.Username,
ui.Donor,
ui.Warned,
um.Enabled,";
$sql .= ($Section == 'sentbox')? ' cu.SentDate ' : ' cu.ReceivedDate '; $sql .= ($Section == 'sentbox')? ' cu.SentDate ' : ' cu.ReceivedDate ';
$sql .= "AS Date $sql .= "AS Date
FROM pm_conversations AS c FROM pm_conversations AS c
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID=c.ID AND cu.UserID='$UserID' LEFT JOIN pm_conversations_users AS cu ON cu.ConvID=c.ID AND cu.UserID='$UserID'
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID=c.ID AND cu2.UserID!='$UserID' AND cu2.ForwardedTo=0 LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID=c.ID AND cu2.UserID!='$UserID' AND cu2.ForwardedTo=0
LEFT JOIN users_main AS um ON um.ID=cu2.UserID LEFT JOIN users_main AS um ON um.ID=cu2.UserID";
LEFT JOIN users_info AS ui ON ui.UserID=um.ID
LEFT JOIN users_main AS um2 ON um2.ID=cu.ForwardedTo";
if(!empty($_GET['search']) && $_GET['searchtype'] == "message") { if(!empty($_GET['search']) && $_GET['searchtype'] == "message") {
$sql .= " JOIN pm_messages AS m ON c.ID=m.ConvID"; $sql .= " JOIN pm_messages AS m ON c.ID=m.ConvID";
@ -130,7 +123,7 @@
</tr> </tr>
<? <?
$Row = 'a'; $Row = 'a';
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) { while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $SenderID, $Date) = $DB->next_record()) {
if($Unread === '1') { if($Unread === '1') {
$RowClass = 'unreadpm'; $RowClass = 'unreadpm';
} else { } else {
@ -148,10 +141,10 @@
<? <?
if($Unread) { echo '</strong>';} ?> if($Unread) { echo '</strong>';} ?>
</td> </td>
<td><?=format_username($SenderID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true)?></td> <td><?=format_username($SenderID, true, true, true, true)?></td>
<td><?=time_diff($Date)?></td> <td><?=time_diff($Date)?></td>
<? if(check_perms('users_mod')) { ?> <? if(check_perms('users_mod')) { ?>
<td><?=($ForwardedID && $ForwardedID != $LoggedUser['ID'] ? format_username($ForwardedID, $ForwardedName):'')?></td> <td><?=($ForwardedID && $ForwardedID != $LoggedUser['ID'] ? format_username($ForwardedID, false, false, false):'')?></td>
<? } ?> <? } ?>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -30,11 +30,11 @@
<div class="sidebar"> <div class="sidebar">
<? <?
$DB->query("SELECT lc.UserID, $DB->query("SELECT lc.UserID,
SUM(lc.Points), SUM(lc.Points)
um.Username, FROM library_contest AS lc
ui.Donor, GROUP BY lc.UserID
ui.Warned, ORDER BY SUM(lc.Points) DESC
um.Enabled, um.PermissionID FROM library_contest AS lc JOIN users_main AS um ON um.ID=lc.UserID JOIN users_info AS ui ON ui.UserID=um.ID GROUP BY lc.UserID ORDER BY SUM(lc.Points) DESC LIMIT 10"); LIMIT 10");
$Contest = $DB->to_array(); $Contest = $DB->to_array();
?> ?>
<div class="box"> <div class="box">
@ -55,7 +55,7 @@
?> ?>
<tr class="row<?=$Class?>"> <tr class="row<?=$Class?>">
<td><strong><?=$Num?></td> <td><strong><?=$Num?></td>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=number_format($Uploads)?></td> <td><?=number_format($Uploads)?></td>
</tr> </tr>
<? <?
@ -432,7 +432,7 @@
<tr> <tr>
<td> <td>
<?=display_artists($Recommend_artists[$GroupID]) ?> <?=display_artists($Recommend_artists[$GroupID]) ?>
<a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=format_username($UserID, $Username)?>) <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=format_username($UserID, false, false, false)?>)
<?=$TagStr?> <?=$TagStr?>
</td> </td>
</tr> </tr>
@ -506,7 +506,7 @@ function contest() {
foreach ($Contest as $User) { foreach ($Contest as $User) {
list($UserID, $Points, $Username) = $User; list($UserID, $Points, $Username) = $User;
?> ?>
<li><?=format_username($UserID, $Username)?> (<?=number_format($Points)?>)</li> <li><?=format_username($UserID, false, false, false)?> (<?=number_format($Points)?>)</li>
<? <?
} }
?> ?>

View File

@ -60,7 +60,7 @@
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID); $DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
list($MinClassRead) = $DB->next_record(); list($MinClassRead) = $DB->next_record();
if(!empty($LoggedUser['DisableForums']) || if(!empty($LoggedUser['DisableForums']) ||
($MinClassRead > $LoggedUser['Class'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) { (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403); error(403);
} }
@ -77,7 +77,7 @@
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID); $DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
list($MinClassRead) = $DB->next_record(); list($MinClassRead) = $DB->next_record();
if(!empty($LoggedUser['DisableForums']) || if(!empty($LoggedUser['DisableForums']) ||
($MinClassRead > $LoggedUser['Class'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) { (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403); error(403);
} }

View File

@ -254,7 +254,7 @@
<tr> <tr>
<td class="label">Created</td> <td class="label">Created</td>
<td> <td>
<?=time_diff($TimeAdded)?> by <strong><?=format_username($RequestorID, $RequestorName)?></strong> <?=time_diff($TimeAdded)?> by <strong><?=format_username($RequestorID, false, false, false)?></strong>
</td> </td>
</tr> </tr>
<? if($CategoryName == "Music") { <? if($CategoryName == "Music") {
@ -373,7 +373,7 @@
<td class="label">Filled</td> <td class="label">Filled</td>
<td> <td>
<strong><a href="torrents.php?<?=(strtotime($TimeFilled)<$TimeCompare?'id=':'torrentid=').$TorrentID?>">Yes</a></strong>, <strong><a href="torrents.php?<?=(strtotime($TimeFilled)<$TimeCompare?'id=':'torrentid=').$TorrentID?>">Yes</a></strong>,
by user <?=format_username($FillerID, $FillerName)?> by user <?=format_username($FillerID, false, false, false)?>
<? if($LoggedUser['ID'] == $RequestorID || $LoggedUser['ID'] == $FillerID || check_perms('site_moderate_requests')) { ?> <? if($LoggedUser['ID'] == $RequestorID || $LoggedUser['ID'] == $FillerID || check_perms('site_moderate_requests')) { ?>
<strong><a href="requests.php?action=unfill&amp;id=<?=$RequestID?>">(Unfill)</a></strong> Unfilling a request without a valid, nontrivial reason will result in a warning. <strong><a href="requests.php?action=unfill&amp;id=<?=$RequestID?>">(Unfill)</a></strong> Unfilling a request without a valid, nontrivial reason will result in a warning.
<? } ?> <? } ?>
@ -470,7 +470,7 @@
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a> <span style="float:left;"><a href='#post<?=$PostID?>'>#<?=$PostID?></a>
by <strong><?=format_username($AuthorID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=requests_comment&amp;id=<?=$PostID?>">[Report Comment]</a> by <strong><?=format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=requests_comment&amp;id=<?=$PostID?>">[Report Comment]</a>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
<?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? } <?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? }
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?> if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
@ -504,7 +504,7 @@
<a href="#content<?=$PostID?>" onclick="LoadEdit('requests', <?=$PostID?>, 1); return false;">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit('requests', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=format_username($EditedUserID, $EditedUsername) ?> <?=time_diff($EditedTime,2,true,true)?> <?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>
@ -523,8 +523,7 @@
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a> <span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
by <strong><?=format_username($LoggedUser['ID'], $LoggedUser['Username'], $LoggedUser['Donor'], $LoggedUser['Warned'], $LoggedUser['Enabled'] == 2 ? false : true, $LoggedUser['PermissionID'])?></strong> <? if (!empty($LoggedUser['Title'])) { echo '('.$LoggedUser['Title'].')'; }?> by <strong><?=format_username($LoggedUser['ID'], true, true, true, true)?> Just now
Just now
<a href="#quickreplypreview">[Report Comment]</a> <a href="#quickreplypreview">[Report Comment]</a>
</span> </span>
<span style="float:right;"> <span style="float:right;">

View File

@ -36,7 +36,7 @@
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td class="nobr"> <td class="nobr">
<?=format_username($ID, $Username)?> <?=format_username($ID, false, false, false)?>
</td> </td>
<td class="nobr"> <td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?> <? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?>
@ -66,7 +66,7 @@
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td class="nobr"> <td class="nobr">
<?=format_username($ID, $Username)?> <?=format_username($ID, false, false, false)?>
</td> </td>
<td class="nobr"> <td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?> <? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by user'; }?>
@ -109,7 +109,7 @@
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td class="nobr"> <td class="nobr">
<?=format_username($ID, $Username)?> <?=format_username($ID, false, false, false)?>
</td> </td>
<td class="nobr"> <td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by staff member'; }?> <? if (check_paranoia('lastseen', $Paranoia, $Class)) { echo time_diff($LastAccess); } else { echo 'Hidden by staff member'; }?>

View File

@ -40,7 +40,7 @@
$DB->query("SELECT Level, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID"); $DB->query("SELECT Level, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
list($Level, $AssignedToUser) = $DB->next_record; list($Level, $AssignedToUser) = $DB->next_record;
if ($LoggedUser['Class'] >= $Level || $AssignedToUser == $LoggedUser['ID']) { if ($LoggedUser['EffectiveClass'] >= $Level || $AssignedToUser == $LoggedUser['ID']) {
// Staff member is allowed to assign conversation, assign // Staff member is allowed to assign conversation, assign
list($LevelType, $NewLevel) = explode("_", db_string($_POST['assign'])); list($LevelType, $NewLevel) = explode("_", db_string($_POST['assign']));

View File

@ -3,7 +3,7 @@
show_header('Staff Inbox'); show_header('Staff Inbox');
$View = display_str($_GET['view']); $View = display_str($_GET['view']);
$UserLevel = $LoggedUser['Class']; $UserLevel = $LoggedUser['EffectiveClass'];
// Setup for current view mode // Setup for current view mode
$SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, "; $SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, ";
@ -133,8 +133,8 @@
$Row = ($Row === 'a') ? 'b' : 'a'; $Row = ($Row === 'a') ? 'b' : 'a';
$RowClass = 'row'.$Row; $RowClass = 'row'.$Row;
$UserInfo = user_info($UserID); //$UserInfo = user_info($UserID);
$UserStr = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); $UserStr = format_username($UserID, true, true, true, true);
// Get assigned // Get assigned
if ($AssignedToUser == '') { if ($AssignedToUser == '') {
@ -145,15 +145,15 @@
} else { } else {
// Assigned to user // Assigned to user
$UserInfo = user_info($AssignedToUser); // $UserInfo = user_info($AssignedToUser);
$Assigned = format_username($AssignedToUser, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); $Assigned = format_username($AssignedToUser, true, true, true, true);
} }
// Get resolver // Get resolver
if ($ViewString == 'Resolved') { if ($ViewString == 'Resolved') {
$UserInfo = user_info($ResolverID); //$UserInfo = user_info($ResolverID);
$ResolverStr = format_username($ResolverID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); $ResolverStr = format_username($ResolverID, true, true, true, true);
} }
// Table row // Table row

View File

@ -5,7 +5,7 @@
list($UserID, $Level, $AssignedToUser) = $DB->next_record(); list($UserID, $Level, $AssignedToUser) = $DB->next_record();
if ($UserID == $LoggedUser['ID'] || ($IsFLS && $Level == 0) || if ($UserID == $LoggedUser['ID'] || ($IsFLS && $Level == 0) ||
$AssignedToUser == $LoggedUser['ID'] || ($IsStaff && $Level <= $LoggedUser['Class'])) { $AssignedToUser == $LoggedUser['ID'] || ($IsStaff && $Level <= $LoggedUser['EffectiveClass'])) {
/*if($Level != 0 && $IsStaff == false) { /*if($Level != 0 && $IsStaff == false) {
error(403); error(403);
}*/ }*/

View File

@ -9,7 +9,7 @@
$DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID"); $DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID");
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record(); list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
if (!(($UserID == $LoggedUser['ID']) || ($AssignedToUser == $LoggedUser['ID']) || (($Level > 0 && $Level <= $LoggedUser['Class']) || ($Level == 0 && $IsFLS)))) { if (!(($UserID == $LoggedUser['ID']) || ($AssignedToUser == $LoggedUser['ID']) || (($Level > 0 && $Level <= $LoggedUser['EffectiveClass']) || ($Level == 0 && $IsFLS)))) {
// User is trying to view someone else's conversation // User is trying to view someone else's conversation
error(403); error(403);
} }
@ -22,8 +22,8 @@
show_header('Staff PM', 'staffpm,bbcode'); show_header('Staff PM', 'staffpm,bbcode');
$UserInfo = user_info($UserID); //$UserInfo = user_info($UserID);
$UserStr = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); $UserStr = format_username($UserID, true, true, true, true);
$OwnerID = $UserID; $OwnerID = $UserID;
$OwnerName = $UserInfo['Username']; $OwnerName = $UserInfo['Username'];
@ -72,7 +72,7 @@
} else { } else {
// Staff/FLS // Staff/FLS
$UserInfo = user_info($UserID); $UserInfo = user_info($UserID);
$UserString = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); $UserString = format_username($UserID, true, true, true, true);
$Username = $UserInfo['Username']; $Username = $UserInfo['Username'];
} }
?> ?>

View File

@ -7,7 +7,7 @@
$Balance = btc_balance() . " BTC"; $Balance = btc_balance() . " BTC";
$Receiveds = btc_received(); $Receiveds = btc_received();
$DB->query("SELECT m.ID, m.Username, i.Donor, i.BitcoinAddress FROM users_main m INNER JOIN users_info i ON m.ID = i.UserID WHERE BitcoinAddress IS NOT NULL"); $DB->query("SELECT i.UserID, i.BitcoinAddress FROM users_info AS i WHERE BitcoinAddress IS NOT NULL");
?> ?>
<div class="thin"> <div class="thin">
<h3><?=$Balance?></h3> <h3><?=$Balance?></h3>
@ -28,7 +28,7 @@
if ($amount === false) { continue; } if ($amount === false) { continue; }
?> ?>
<tr> <tr>
<td><?=format_username($row['ID'],$row['Username'],$row['Donor'])?></td> <td><?=format_username($row['UserID'], true, false, false, false)?></td>
<td><tt><?=$row['BitcoinAddress']?></tt></td> <td><tt><?=$row['BitcoinAddress']?></tt></td>
<td><?=$amount?></td> <td><?=$amount?></td>
</tr> </tr>

View File

@ -13,15 +13,8 @@
d.Amount, d.Amount,
d.Currency, d.Currency,
d.Email, d.Email,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned,
d.Time d.Time
FROM donations AS d FROM donations AS d ";
LEFT JOIN users_main AS m ON m.ID=d.UserID
LEFT JOIN users_info AS i ON i.UserID=d.UserID ";
if(!empty($_GET['search'])) { if(!empty($_GET['search'])) {
$sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' "; $sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' ";
} }
@ -89,10 +82,10 @@
</tr> </tr>
<? <?
foreach($Donations as $Donation) { foreach($Donations as $Donation) {
list($UserID, $Amount, $Currency, $Email, $Username, $PermissionID, $Enabled, $Donor, $Warned, $DonationTime) = $Donation; list($UserID, $Amount, $Currency, $Email, $DonationTime) = $Donation;
?> ?>
<tr> <tr>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=display_str($Amount)?> <?=$Currency?></td> <td><?=display_str($Amount)?> <?=$Currency?></td>
<td><?=display_str($Email)?></td> <td><?=display_str($Email)?></td>
<td><?=time_diff($DonationTime)?></td> <td><?=time_diff($DonationTime)?></td>

View File

@ -19,17 +19,11 @@
$sql = "SELECT $sql = "SELECT
SQL_CALC_FOUND_ROWS SQL_CALC_FOUND_ROWS
um.ID, um.ID,
um.Username,
um.PermissionID,
um.Enabled,
ui.Donor,
ui.Warned,
i.InviteKey, i.InviteKey,
i.Expires, i.Expires,
i.Email i.Email
FROM invites as i FROM invites as i
JOIN users_main AS um ON um.ID=i.InviterID JOIN users_main AS um ON um.ID=i.InviterID ";
JOIN users_info AS ui ON ui.UserID=um.ID ";
if($Search) { if($Search) {
$sql .= "WHERE i.Email LIKE '%$Search%' "; $sql .= "WHERE i.Email LIKE '%$Search%' ";
} }
@ -78,11 +72,11 @@
</tr> </tr>
<? <?
$Row = 'b'; $Row = 'b';
while(list($UserID, $Username, $PermissionID, $Enabled, $Donor, $Warned, $InviteKey, $Expires, $Email)=$DB->next_record()) { while(list($UserID, $InviteKey, $Expires, $Email)=$DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b'; $Row = ($Row == 'b') ? 'a' : 'b';
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=display_str($Email)?></td> <td><?=display_str($Email)?></td>
<td><?=display_str($InviteKey)?></td> <td><?=display_str($InviteKey)?></td>
<td><?=time_diff($Expires)?></td> <td><?=time_diff($Expires)?></td>

View File

@ -63,7 +63,7 @@
$Row = ($IP == $InviterIP) ? 'a' : 'b'; $Row = ($IP == $InviterIP) ? 'a' : 'b';
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?><br /><?=format_username($InviterID, $InviterUsername, $InviterDonor, $InviterWarned, $InviterEnabled, $InviterPermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?><br /><?=format_username($InviterID, true, true, true, true)?></td>
<td><?=ratio($Uploaded,$Downloaded)?><br /><?=ratio($InviterUploaded,$InviterDownloaded)?></td> <td><?=ratio($Uploaded,$Downloaded)?><br /><?=ratio($InviterUploaded,$InviterDownloaded)?></td>
<td> <td>
<span style="float:left;"><?=display_str($Email)?></span> <span style="float:left;"><?=display_str($Email)?></span>

View File

@ -4,15 +4,7 @@
?> ?>
<div class="thin"> <div class="thin">
<? <?
$DB->query("SELECT $DB->query("SELECT m.ID FROM users_main AS m
m.ID,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID=m.ID
WHERE m.CustomPermissions != '' WHERE m.CustomPermissions != ''
AND m.CustomPermissions != 'a:0:{}'"); AND m.CustomPermissions != 'a:0:{}'");
if($DB->record_count()) { if($DB->record_count()) {
@ -23,10 +15,10 @@
<td>Access</td> <td>Access</td>
</tr> </tr>
<? <?
while(list($UserID, $Username, $PermissionID, $Enabled, $Donor, $Warned)=$DB->next_record()) { while(list($UserID)=$DB->next_record()) {
?> ?>
<tr> <tr>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><a href="user.php?action=permissions&amp;userid=<?=$UserID?>">Manage</a></td> <td><a href="user.php?action=permissions&amp;userid=<?=$UserID?>">Manage</a></td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -59,7 +59,7 @@
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=get_size($Uploaded)?></td> <td><?=get_size($Uploaded)?></td>
<td><?=get_size($Downloaded)?></td> <td><?=get_size($Downloaded)?></td>
<td><?=ratio($Uploaded, $Downloaded)?></td> <td><?=ratio($Uploaded, $Downloaded)?></td>

View File

@ -167,20 +167,15 @@
$Val->SetFields('maxcollages',true,'number','You did not enter a valid number of personal collages.'); $Val->SetFields('maxcollages',true,'number','You did not enter a valid number of personal collages.');
//$Val->SetFields('test',true,'number','You did not enter a valid level for this permission set.'); //$Val->SetFields('test',true,'number','You did not enter a valid level for this permission set.');
$Values=array();
if (is_numeric($_REQUEST['id'])) { if (is_numeric($_REQUEST['id'])) {
$DB->query("SELECT p.ID,p.Name,p.Level,p.Values,p.DisplayStaff,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID WHERE p.ID='".db_string($_REQUEST['id'])."' GROUP BY p.ID"); $DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,p.PermittedForums,p.Values,p.DisplayStaff,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID WHERE p.ID='".db_string($_REQUEST['id'])."' GROUP BY p.ID");
list($ID,$Name,$Level,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(3)); list($ID,$Name,$Level,$Secondary,$Forums,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(5));
if($Level > $LoggedUser['Class'] || $_REQUEST['level'] > $LoggedUser['Class']) { if($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) {
error(403); error(403);
} }
$Values = unserialize($Values);
}
$Values=unserialize($Values);
}
if (!empty($_POST['submit'])) { if (!empty($_POST['submit'])) {
$Err = $Val->ValidateForm($_POST); $Err = $Val->ValidateForm($_POST);
@ -201,15 +196,35 @@
$Name=$_REQUEST['name']; $Name=$_REQUEST['name'];
$Level=$_REQUEST['level']; $Level=$_REQUEST['level'];
$Secondary=empty($_REQUEST['secondary'])?0:1;
$Forums = $_REQUEST['forums'];
$DisplayStaff=$_REQUEST['displaystaff']; $DisplayStaff=$_REQUEST['displaystaff'];
$Values['MaxCollages']=$_REQUEST['maxcollages']; $Values['MaxCollages']=$_REQUEST['maxcollages'];
if (!$Err) { if (!$Err) {
if (!is_numeric($_REQUEST['id'])) { if (!is_numeric($_REQUEST['id'])) {
$DB->query("INSERT INTO permissions (Level,Name,`Values`,DisplayStaff) VALUES ('".db_string($Level)."','".db_string($Name)."','".db_string(serialize($Values))."','".db_string($DisplayStaff)."')"); $DB->query("INSERT INTO permissions (Level,Name,Secondary,PermittedForums,`Values`,DisplayStaff)
VALUES ('".db_string($Level)."',
'".db_string($Name)."',
".$Secondary.",
'".db_string($Forums)."',
'".db_string(serialize($Values))."',
'".db_string($DisplayStaff)."')");
} else { } else {
$DB->query("UPDATE permissions SET Level='".db_string($Level)."',Name='".db_string($Name)."',`Values`='".db_string(serialize($Values))."',DisplayStaff='".db_string($DisplayStaff)."' WHERE ID='".db_string($_REQUEST['id'])."'"); $DB->query("UPDATE permissions SET Level='".db_string($Level)."',
Name='".db_string($Name)."',
Secondary=".$Secondary.",
PermittedForums='".db_string($Forums)."',
`Values`='".db_string(serialize($Values))."',
DisplayStaff='".db_string($DisplayStaff)."'
WHERE ID='".db_string($_REQUEST['id'])."'");
$Cache->delete_value('perm_'.$_REQUEST['id']); $Cache->delete_value('perm_'.$_REQUEST['id']);
if ($Secondary) {
$DB->query("SELECT DISTINCT UserID FROM users_levels WHERE PermissionID = ".db_string($_REQUEST['id']));
while ($UserID = $DB->next_record()) {
$Cache->delete_value('user_info_heavy_'.$UserID);
}
}
} }
$Cache->delete_value('classes'); $Cache->delete_value('classes');
} else { } else {
@ -222,6 +237,17 @@
} else { } else {
if (!empty($_REQUEST['removeid'])) { if (!empty($_REQUEST['removeid'])) {
$DB->query("DELETE FROM permissions WHERE ID='".db_string($_REQUEST['removeid'])."'"); $DB->query("DELETE FROM permissions WHERE ID='".db_string($_REQUEST['removeid'])."'");
$DB->query("SELECT UserID FROM users_levels WHERE PermissionID='".db_string($_REQUEST['removeid'])."'");
while (list($UserID) = $DB->next_record()) {
$Cache->delete_value('user_info_'.$UserID);
$Cache->delete_value('user_info_heavy_'.$UserID);
}
$DB->query("DELETE FROM users_levels WHERE PermissionID='".db_string($_REQUEST['removeid'])."'");
$DB->query("SELECT ID FROM users_main WHERE PermissionID='".db_string($_REQUEST['removeid'])."'");
while (list($UserID) = $DB->next_record()) {
$Cache->delete_value('user_info_'.$UserID);
$Cache->delete_value('user_info_heavy_'.$UserID);
}
$DB->query("UPDATE users_main SET PermissionID='".USER."' WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); $DB->query("UPDATE users_main SET PermissionID='".USER."' WHERE PermissionID='".db_string($_REQUEST['removeid'])."'");
$Cache->delete_value('classes'); $Cache->delete_value('classes');

View File

@ -7,7 +7,6 @@
d.Name, d.Name,
d.Comment, d.Comment,
d.UserID, d.UserID,
um.Username,
d.Time d.Time
FROM do_not_upload as d FROM do_not_upload as d
LEFT JOIN users_main AS um ON um.ID=d.UserID LEFT JOIN users_main AS um ON um.ID=d.UserID
@ -21,7 +20,7 @@
<td>Added</td> <td>Added</td>
<td>Submit</td> <td>Submit</td>
</tr> </tr>
<? while(list($ID, $Name, $Comment, $UserID, $Username, $DNUTime) = $DB->next_record()){ ?> <? while(list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()){ ?>
<tr> <tr>
<form action="tools.php" method="post"> <form action="tools.php" method="post">
<td> <td>
@ -34,7 +33,7 @@
<input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" /> <input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" />
</td> </td>
<td> <td>
<?=format_username($UserID, $Username)?><br /> <?=format_username($UserID, false, false, false)?><br />
<?=time_diff($DNUTime, 1)?></td> <?=time_diff($DNUTime, 1)?></td>
<td> <td>
<input type="submit" name="submit" value="Edit" /> <input type="submit" name="submit" value="Edit" />

View File

@ -8,9 +8,7 @@
eb.Time, eb.Time,
eb.Email, eb.Email,
eb.Comment, eb.Comment,
um.Username
FROM email_blacklist AS eb FROM email_blacklist AS eb
LEFT JOIN users_main AS um ON um.ID=eb.UserID
ORDER BY eb.Time DESC"); ORDER BY eb.Time DESC");
?> ?>
<h2>Email Blacklist</h2> <h2>Email Blacklist</h2>
@ -21,7 +19,7 @@
<td>Added</td> <td>Added</td>
<td>Submit</td> <td>Submit</td>
</tr> </tr>
<? while(list($ID, $UserID, $Time, $Email, $Comment, $Username) = $DB->next_record()) { ?> <? while(list($ID, $UserID, $Time, $Email, $Comment) = $DB->next_record()) { ?>
<tr> <tr>
<form action="tools.php" method="post"> <form action="tools.php" method="post">
<td> <td>
@ -34,7 +32,7 @@
<input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" /> <input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" />
</td> </td>
<td> <td>
<?=format_username($UserID, $Username)?><br /> <?=format_username($UserID, false, false, false)?><br />
<?=time_diff($Time, 1)?></td> <?=time_diff($Time, 1)?></td>
<td> <td>
<input type="submit" name="submit" value="Edit" /> <input type="submit" name="submit" value="Edit" />

View File

@ -3,6 +3,8 @@ function class_list($Selected=0){
global $Classes; global $Classes;
$Return = ''; $Return = '';
foreach ($Classes as $ID => $Class) { foreach ($Classes as $ID => $Class) {
if ($Class['Secondary']) { continue; }
$Name = $Class['Name']; $Name = $Class['Name'];
$Level = $Class['Level']; $Level = $Class['Level'];
$Return.='<option value="'.$Level.'"'; $Return.='<option value="'.$Level.'"';

View File

@ -14,14 +14,7 @@
l.Attempts, l.Attempts,
l.BannedUntil, l.BannedUntil,
l.Bans, l.Bans,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned
FROM login_attempts AS l FROM login_attempts AS l
LEFT JOIN users_main AS m ON m.ID=l.UserID
LEFT JOIN users_info AS i ON i.UserID=l.UserID
WHERE l.BannedUntil > "'.sqltime().'" WHERE l.BannedUntil > "'.sqltime().'"
ORDER BY l.BannedUntil ASC'); ORDER BY l.BannedUntil ASC');
@ -41,7 +34,7 @@
</tr> </tr>
<? <?
$Row = 'b'; $Row = 'b';
while(list($ID, $IP, $UserID, $LastAttempt, $Attempts, $BannedUntil, $Bans, $Username, $PermissionID, $Enabled, $Donor, $Warned) = $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?>">
@ -49,7 +42,7 @@
<?=$IP?> <?=$IP?>
</td> </td>
<td> <td>
<? if ($UserID != 0) { echo format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID); } ?> <? if ($UserID != 0) { echo format_username($UserID, true, true, true, true); } ?>
</td> </td>
<td> <td>
<?=$Bans?> <?=$Bans?>

View File

@ -28,6 +28,10 @@ function display_perm($Key,$Title) {
<td class="label">Class Level</td> <td class="label">Class Level</td>
<td><input type="text" name="level" id="level" value="<?=(!empty($Level) ? display_str($Level) : '')?>" /></td> <td><input type="text" name="level" id="level" value="<?=(!empty($Level) ? display_str($Level) : '')?>" /></td>
</tr> </tr>
<tr>
<td class="label">Secondary Class</td>
<td><input type="checkbox" name="secondary" value="1" <? if (!empty($Secondary)) { ?>checked<? } ?> /></td>
</tr>
<tr> <tr>
<td class="label">Show on Staff page</td> <td class="label">Show on Staff page</td>
<td><input type="checkbox" name="displaystaff" value="1" <? if (!empty($DisplayStaff)) { ?>checked<? } ?> /></td> <td><input type="checkbox" name="displaystaff" value="1" <? if (!empty($DisplayStaff)) { ?>checked<? } ?> /></td>
@ -36,6 +40,10 @@ function display_perm($Key,$Title) {
<td class="label">Maximum number of personal collages</td> <td class="label">Maximum number of personal collages</td>
<td><input type="text" name="maxcollages" size="5" value="<?=$Values['MaxCollages']?>" /></td> <td><input type="text" name="maxcollages" size="5" value="<?=$Values['MaxCollages']?>" /></td>
</tr> </tr>
<tr>
<td class="label">Additional Forums</td>
<td><input type="text" size="30" name="forums" value="<?=display_str($Forums)?>" /></td>
</tr>
<? if (is_numeric($_REQUEST['id'])) { ?> <? if (is_numeric($_REQUEST['id'])) { ?>
<tr> <tr>
<td class="label">Current users in this class</td> <td class="label">Current users in this class</td>

View File

@ -17,7 +17,11 @@ function confirmDelete(id) {
[<a href="tools.php">Back to Tools</a>] [<a href="tools.php">Back to Tools</a>]
</div> </div>
<? <?
$DB->query("SELECT p.ID,p.Name,p.Level,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID GROUP BY p.ID ORDER BY p.Level ASC"); $DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,COUNT(u.ID)+COUNT(DISTINCT l.UserID)
FROM permissions AS p
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
GROUP BY p.ID ORDER BY p.Secondary ASC, p.Level ASC");
if($DB->record_count()) { if($DB->record_count()) {
?> ?>
<table width="100%"> <table width="100%">
@ -27,10 +31,10 @@ function confirmDelete(id) {
<td>User Count</td> <td>User Count</td>
<td class="center">Actions</td> <td class="center">Actions</td>
</tr> </tr>
<? while(list($ID,$Name,$Level,$UserCount)=$DB->next_record()) { ?> <? while(list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
<tr> <tr>
<td><?=display_str($Name); ?></td> <td><?=display_str($Name); ?></td>
<td><?=$Level; ?></td> <td><?=($Secondary?'Secondary':$Level) ?></td>
<td><?=number_format($UserCount); ?></td> <td><?=number_format($UserCount); ?></td>
<td class="center">[<a href="tools.php?action=permissions&amp;id=<?=$ID ?>">Edit</a> | <a href="#" onclick="return confirmDelete(<?=$ID?>)">Remove</a>]</td> <td class="center">[<a href="tools.php?action=permissions&amp;id=<?=$ID ?>">Edit</a> | <a href="#" onclick="return confirmDelete(<?=$ID?>)">Remove</a>]</td>
</tr> </tr>

View File

@ -7,14 +7,12 @@
$DB->query("SELECT $DB->query("SELECT
tr.GroupID, tr.GroupID,
tr.UserID, tr.UserID,
u.Username,
tg.Name, tg.Name,
tg.ArtistID, tg.ArtistID,
ag.Name ag.Name
FROM torrents_recommended AS tr FROM torrents_recommended AS tr
JOIN torrents_group AS tg ON tg.ID=tr.GroupID JOIN torrents_group AS tg ON tg.ID=tr.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
LEFT JOIN users_main AS u ON u.ID=tr.UserID
ORDER BY tr.Time DESC ORDER BY tr.Time DESC
LIMIT 10 LIMIT 10
"); ");
@ -42,10 +40,10 @@
<? } ?> <? } ?>
<ul class="nobullet"> <ul class="nobullet">
<? <?
while(list($GroupID, $UserID, $Username, $GroupName, $ArtistID, $ArtistName)=$DB->next_record()) { while(list($GroupID, $UserID, $GroupName, $ArtistID, $ArtistName)=$DB->next_record()) {
?> ?>
<li> <li>
<strong><?=format_username($UserID, $Username)?></strong> <strong><?=format_username($UserID, false, false, false)?></strong>
<? if($ArtistID){ ?> <? if($ArtistID){ ?>
- <a href="artist.php?id=<?=$ArtistID?>"><?=$ArtistName?></a> - <a href="artist.php?id=<?=$ArtistID?>"><?=$ArtistName?></a>
<? } ?> <? } ?>

View File

@ -47,7 +47,7 @@
$Row = ($Row == 'b') ? 'a' : 'b'; $Row = ($Row == 'b') ? 'a' : 'b';
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><span style="float:left;"><?=get_host($IP)." ($IP)"?></span><span style="float:right;">[<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History">H</a>|<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search">S</a>]</span></td> <td><span style="float:left;"><?=get_host($IP)." ($IP)"?></span><span style="float:right;">[<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History">H</a>|<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search">S</a>]</span></td>
<td><?=display_str($Uses)?></td> <td><?=display_str($Uses)?></td>
<td><?=time_diff($Joined)?></td> <td><?=time_diff($Joined)?></td>

View File

@ -1,7 +1,7 @@
<? <?
enforce_login(); enforce_login();
if(1 || !check_perms('site_top10')){ if(!check_perms('site_top10')){
show_header(); show_header();
?> ?>
<div class="content_basiccontainer"> <div class="content_basiccontainer">

View File

@ -28,7 +28,6 @@
$BaseQuery = "SELECT $BaseQuery = "SELECT
u.ID, u.ID,
u.Username,
ui.JoinDate, ui.JoinDate,
u.Uploaded, u.Uploaded,
u.Downloaded, u.Downloaded,
@ -151,7 +150,7 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) {
?> ?>
<tr class="row<?=$Highlight?>"> <tr class="row<?=$Highlight?>">
<td class="center"><?=$Rank?></td> <td class="center"><?=$Rank?></td>
<td><?=format_username($Detail['ID'],$Detail['Username'])?></td> <td><?=format_username($Detail['ID'], false, false, false)?></td>
<td style="text-align:right"><?=get_size($Detail['Uploaded'])?></td> <td style="text-align:right"><?=get_size($Detail['Uploaded'])?></td>
<td style="text-align:right"><?=get_size($Detail['UpSpeed'])?>/s</td> <td style="text-align:right"><?=get_size($Detail['UpSpeed'])?>/s</td>
<td style="text-align:right"><?=get_size($Detail['Downloaded'])?></td> <td style="text-align:right"><?=get_size($Detail['Downloaded'])?></td>

View File

@ -4,7 +4,7 @@ function compare($X, $Y){
return($Y['score'] - $X['score']); return($Y['score'] - $X['score']);
} }
define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default define(MAX_PERS_COLLAGES, 3); // How many personal collages should be shown by default
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
@ -385,12 +385,12 @@ function filelist($Str) {
//t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear, t.RemasterTitle, t.RemasterRecordLabel,t.RemasterCatalogueNumber, //t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear, t.RemasterTitle, t.RemasterRecordLabel,t.RemasterCatalogueNumber,
//t.Scene, t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers, t.Snatched, t.FreeTorrent, t.Time, t.Description, //t.Scene, t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers, t.Snatched, t.FreeTorrent, t.Time, t.Description,
//t.FileList, t.FilePath, t.UserID, um.Username, t.last_action, //t.FileList, t.FilePath, t.UserID, t.last_action,
//(bad tags), (bad folders), (bad filenames), (cassette approved), (lossy master approved), t.LastReseedRequest, LogInDB //(bad tags), (bad folders), (bad filenames), (cassette approved), (lossy master approved), t.LastReseedRequest, LogInDB
list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber,
$Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description, $Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description,
$FileList, $FilePath, $UserID, $Username, $LastActive, $FileList, $FilePath, $UserID, $LastActive,
$BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent; $BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent;
if($Remastered && !$RemasterYear) { if($Remastered && !$RemasterYear) {
@ -544,7 +544,7 @@ function filelist($Str) {
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition_<?=$EditionID?> torrentdetails pad <? if(!isset($_GET['torrentid']) || $_GET['torrentid']!=$TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>"> <tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition_<?=$EditionID?> torrentdetails pad <? if(!isset($_GET['torrentid']) || $_GET['torrentid']!=$TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>">
<td colspan="5"> <td colspan="5">
<blockquote> <blockquote>
Uploaded by <?=format_username($UserID, $TorrentUploader)?> <?=time_diff($TorrentTime);?> Uploaded by <?=format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
<? if($Seeders == 0){ ?> <? if($Seeders == 0){ ?>
<? <?
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?> if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
@ -664,7 +664,7 @@ function filelist($Str) {
$PersonalCollages = $Cache->get_value('torrent_collages_personal_'.$GroupID); $PersonalCollages = $Cache->get_value('torrent_collages_personal_'.$GroupID);
if(!is_array($PersonalCollages)) { if(!is_array($PersonalCollages)) {
$DB->query("SELECT c.Name, c.NumTorrents, c.ID FROM collages AS c JOIN collages_torrents AS ct ON ct.CollageID=c.ID WHERE ct.GroupID='$GroupID' AND Deleted='0' AND CategoryID='0'"); $DB->query("SELECT c.Name, c.NumTorrents, c.ID FROM collages AS c JOIN collages_torrents AS ct ON ct.CollageID=c.ID WHERE ct.GroupID='$GroupID' AND Deleted='0' AND CategoryID='0'");
$PersonalCollages = $DB->to_array(false, MYSQLI_NUM); $PersonalCollages = $DB->to_array(false, MYSQL_NUM);
$Cache->cache_value('torrent_collages_personal_'.$GroupID, $PersonalCollages, 3600*6); $Cache->cache_value('torrent_collages_personal_'.$GroupID, $PersonalCollages, 3600*6);
} }
@ -776,7 +776,7 @@ function filelist($Str) {
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a class="post_id" href='torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a> <span style="float:left;"><a class="post_id" href='torrents.php?id=<?=$GroupID?>&amp;postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
<strong><?=format_username($AuthorID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $PermissionID)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=torrents_comment&amp;id=<?=$PostID?>">[Report]</a> <strong><?=format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?> <a href="reports.php?action=report&amp;type=torrents_comment&amp;id=<?=$PostID?>">[Report]</a>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');">[Quote]</a>
<?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? } <?if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');">[Edit]</a><? }
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?> if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');">[Delete]</a> <? } ?>
@ -810,7 +810,7 @@ function filelist($Str) {
<a href="#content<?=$PostID?>" onclick="LoadEdit('torrents', <?=$PostID?>, 1); return false;">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit('torrents', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=format_username($EditedUserID, $EditedUsername) ?> <?=time_diff($EditedTime,2,true,true)?> <?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>
@ -829,8 +829,7 @@ function filelist($Str) {
<tr class="colhead_dark"> <tr class="colhead_dark">
<td colspan="2"> <td colspan="2">
<span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a> <span style="float:left;"><a href='#quickreplypreview'>#XXXXXX</a>
by <strong><?=format_username($LoggedUser['ID'], $LoggedUser['Username'], $LoggedUser['Donor'], $LoggedUser['Warned'], $LoggedUser['Enabled'] == 2 ? false : true, $LoggedUser['PermissionID'])?></strong> by <strong><?=format_username($LoggedUser['ID'], true, true, true, true)?></strong> Just now
Just now
<a href="#quickreplypreview">[Report Comment]</a> <a href="#quickreplypreview">[Report Comment]</a>
</span> </span>
<span id="barpreview" style="float:right;"> <span id="barpreview" style="float:right;">

View File

@ -1,84 +1,83 @@
<? <?
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;
} }
$DB->query("SELECT SQL_CALC_FOUND_ROWS $DB->query("SELECT SQL_CALC_FOUND_ROWS
ud.UserID, ud.UserID,
ud.Time ud.Time
FROM users_downloads AS ud FROM users_downloads AS ud
WHERE ud.TorrentID='$TorrentID' WHERE ud.TorrentID='$TorrentID'
ORDER BY ud.Time DESC ORDER BY ud.Time DESC
LIMIT $Limit"); LIMIT $Limit");
$UserIDs = $DB->collect('UserID'); $UserIDs = $DB->collect('UserID');
$Results = $DB->to_array('UserID', MYSQLI_ASSOC); $Results = $DB->to_array('UserID', MYSQLI_ASSOC);
$DB->query("SELECT FOUND_ROWS()"); $DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record(); list($NumResults) = $DB->next_record();
if(count($UserIDs)>0) { if(count($UserIDs)>0) {
$UserIDs = implode(',',$UserIDs); $UserIDs = implode(',',$UserIDs);
$DB->query("SELECT uid FROM xbt_snatched WHERE fid='$TorrentID' AND uid IN($UserIDs)"); $DB->query("SELECT uid FROM xbt_snatched WHERE fid='$TorrentID' AND uid IN($UserIDs)");
$Snatched = $DB->to_array('uid'); $Snatched = $DB->to_array('uid');
$DB->query("SELECT uid FROM xbt_files_users WHERE fid='$TorrentID' AND Remaining=0 AND uid IN($UserIDs)"); $DB->query("SELECT uid FROM xbt_files_users WHERE fid='$TorrentID' AND Remaining=0 AND uid IN($UserIDs)");
$Seeding = $DB->to_array('uid'); $Seeding = $DB->to_array('uid');
} }
?> ?>
<h4>Downloadlist</h4> <h4>Downloadlist</h4>
<? if($NumResults>100) { ?> <? if($NumResults>100) { ?>
<div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div> <div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>
<table> <table>
<tr class="colhead_dark" style="font-weight: bold;"> <tr class="colhead_dark" style="font-weight: bold;">
<td>User</td> <td>User</td>
<td>Time</td> <td>Time</td>
<td>User</td> <td>User</td>
<td>Time</td> <td>Time</td>
</tr> </tr>
<tr> <tr>
<? <?
$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);
$UserInfo = user_info($SnatcherID);
$User = format_username($SnatcherID, true, true, true, true);
$User = format_username($SnatcherID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']);
if(!array_key_exists($SnatcherID, $Snatched) && $SnatcherID!=$UserID) {
if(!array_key_exists($SnatcherID, $Snatched) && $SnatcherID!=$UserID) { $User = '<em>'.$User.'</em>';
$User = '<em>'.$User.'</em>'; if(array_key_exists($SnatcherID, $Seeding)) {
if(array_key_exists($SnatcherID, $Seeding)) { $User = '<strong>'.$User.'</strong>';
$User = '<strong>'.$User.'</strong>'; }
} }
} if($i % 2 == 0 && $i>0){ ?>
if($i % 2 == 0 && $i>0){ ?> </tr>
</tr> <tr>
<tr> <?
<? }
} ?>
?> <td><?=$User?></td>
<td><?=$User?></td> <td><?=time_diff($Timestamp)?></td>
<td><?=time_diff($Timestamp)?></td> <?
<? $i++;
$i++; }
} ?>
?> </tr>
</tr> </table>
</table> <? if($NumResults>100) { ?>
<? if($NumResults>100) { ?> <div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div>
<div class="linkbox"><?=js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?> <? } ?>

View File

@ -82,7 +82,6 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
t.FileList, t.FileList,
t.FilePath, t.FilePath,
t.UserID, t.UserID,
um.Username,
t.last_action, t.last_action,
tbt.TorrentID, tbt.TorrentID,
tbf.TorrentID, tbf.TorrentID,
@ -93,7 +92,6 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
tln.TorrentID AS LogInDB, tln.TorrentID AS LogInDB,
t.ID AS HasFile t.ID AS HasFile
FROM torrents AS t FROM torrents AS t
LEFT JOIN users_main AS um ON um.ID=t.UserID
LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID=t.ID LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID=t.ID
LEFT JOIN torrents_bad_folders AS tbf on tbf.TorrentID=t.ID LEFT JOIN torrents_bad_folders AS tbf on tbf.TorrentID=t.ID
LEFT JOIN torrents_bad_files AS tfi on tfi.TorrentID=t.ID LEFT JOIN torrents_bad_files AS tfi on tfi.TorrentID=t.ID

View File

@ -42,13 +42,8 @@
<? } <? }
} else { ?> } else { ?>
<td /> <td />
<? } <? } ?>
<td><?=format_username($UserID, false, false, false)?></td>
$DB->query("SELECT Username FROM users_main WHERE ID = ".$UserID);
list($Username) = $DB->next_record();
$DB->set_query_id($Log);
?>
<td><?=format_username($UserID, $Username)?></td>
<td><?=$Info?></td> <td><?=$Info?></td>
</tr> </tr>
<? <?

View File

@ -1,69 +1,64 @@
<? <?
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("SELECT SQL_CALC_FOUND_ROWS
xu.uid, xu.uid,
t.Size, t.Size,
um.Username, xu.active,
xu.active, xu.connectable,
xu.connectable, xu.uploaded,
xu.uploaded, xu.remaining,
xu.remaining, xu.useragent
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.uploaded DESC
ORDER BY xu.uploaded DESC LIMIT $Limit");
LIMIT $Limit"); $DB->query("SELECT FOUND_ROWS()");
$DB->query("SELECT FOUND_ROWS()"); list($NumResults) = $DB->next_record();
list($NumResults) = $DB->next_record(); $DB->set_query_id($Result);
$DB->set_query_id($Result);
?>
?> <h4>Peerlist</h4>
<h4>Peerlist</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> <? } ?>
<? } ?>
<table>
<table> <tr class="colhead_dark" style="font-weight: bold;">
<tr class="colhead_dark" style="font-weight: bold;"> <td>User</td>
<td>User</td> <td>Active</td>
<td>Active</td> <td>Connectable</td>
<td>Up</td>
<td>Connectable</td> <td>%</td>
<td>Client</td>
<td>Up</td> </tr>
<td>%</td> <?
<td>Client</td> while(list($PeerUserID, $Size, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) {
</tr> ?>
<? <tr>
while(list($PeerUserID, $Size, $Username, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) { <td><?=format_username($PeerUserID, false, false, false)?></td>
?> <td><?= ($Active) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td>
<tr> <td><?= ($Connectable) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td>
<td><?=format_username($PeerUserID, $Username)?></td> <td><?=get_size($Uploaded) ?></td>
<td><?= ($Active) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td> <td><?=number_format(($Size-$Remaining)/$Size*100, 2)?></td>
<td><?=display_str($UserAgent)?></td>
<td><?= ($Connectable) ? '<span style="color:green">Yes</span>' : '<span style="color:red">No</span>' ?></td> </tr>
<?
<td><?=get_size($Uploaded) ?></td> }
<td><?=number_format(($Size-$Remaining)/$Size*100, 2)?></td> ?>
<td><?=display_str($UserAgent)?></td> </table>
</tr> <? if($NumResults>100) { ?>
<? <div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
} <? } ?>
?>
</table>
<? if($NumResults>100) { ?>
<div class="linkbox"><?=js_pages('show_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>

View File

@ -1,68 +1,64 @@
<? <?
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("SELECT SQL_CALC_FOUND_ROWS
xs.uid, xs.uid,
xs.tstamp xs.tstamp
FROM xbt_snatched AS xs FROM xbt_snatched AS xs
WHERE xs.fid='$TorrentID' WHERE xs.fid='$TorrentID'
ORDER BY xs.tstamp DESC ORDER BY xs.tstamp DESC
LIMIT $Limit"); 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()");
list($NumResults) = $DB->next_record(); list($NumResults) = $DB->next_record();
?> ?>
<h4>Snatches</h4> <h4>Snatches</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>
<? } ?> <? } ?>
<table> <table>
<tr class="colhead_dark" style="font-weight: bold;"> <tr class="colhead_dark" style="font-weight: bold;">
<td>User</td> <td>User</td>
<td>Time</td> <td>Time</td>
<td>User</td> <td>User</td>
<td>Time</td> <td>Time</td>
</tr> </tr>
<tr> <tr>
<? <?
$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);
$UserInfo = user_info($SnatcherID); if($i % 2 == 0 && $i>0) {
?>
$User = format_username($SnatcherID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); </tr>
<tr>
if($i % 2 == 0 && $i>0){ <?
?> }
</tr> ?>
<tr> <td><?=format_username($SnatcherID, true, true, true, true)?></td>
<? <td><?=time_diff($Timestamp)?></td>
} <?
?> $i++;
<td><?=$User?></td> }
<td><?=time_diff($Timestamp)?></td> ?>
<? </tr>
$i++; </table>
} <? if($NumResults>100) { ?>
?> <div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
</tr> <? } ?>
</table>
<? if($NumResults>100) { ?>
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>

View File

@ -461,7 +461,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){
<td> <td>
<select name="class"> <select name="class">
<option value="" <? if($_GET['class']==='') {echo ' selected="selected"';}?>>Any</option> <option value="" <? if($_GET['class']==='') {echo ' selected="selected"';}?>>Any</option>
<? foreach($ClassLevels as $Class){ ?> <? foreach($ClassLevels as $Class){
if ($Class['Secondary']) { continue; }
?>
<option value="<?=$Class['ID'] ?>" <? if($_GET['class']===$Class['ID']) {echo ' selected="selected"';}?>><?=cut_string($Class['Name'], 10, 1, 1).' ('.$Class['Level'].')'?></option> <option value="<?=$Class['ID'] ?>" <? if($_GET['class']===$Class['ID']) {echo ' selected="selected"';}?>><?=cut_string($Class['Name'], 10, 1, 1).' ('.$Class['Level'].')'?></option>
<? } ?> <? } ?>
</select> </select>
@ -697,7 +699,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){
<? <?
while(list($UserID, $Username, $Uploaded, $Downloaded, $Snatched, $Class, $Email, $Enabled, $IP, $Invites, $DisableInvites, $Warned, $Donor, $JoinDate, $LastAccess) = $DB->next_record()){ ?> while(list($UserID, $Username, $Uploaded, $Downloaded, $Snatched, $Class, $Email, $Enabled, $IP, $Invites, $DisableInvites, $Warned, $Donor, $JoinDate, $LastAccess) = $DB->next_record()){ ?>
<tr> <tr>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $Class)?></td> <td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=ratio($Uploaded, $Downloaded)?></td> <td><?=ratio($Uploaded, $Downloaded)?></td>
<td><?=display_str($IP)?></td> <td><?=display_str($IP)?></td>
<td><?=display_str($Email)?></td> <td><?=display_str($Email)?></td>

View File

@ -65,7 +65,7 @@ function checked($Checked) {
echo $Val->GenerateJS('userform'); echo $Val->GenerateJS('userform');
?> ?>
<div class="thin"> <div class="thin">
<h2><?=format_username($UserID,$Username)?> &gt; Settings</h2> <h2><?=format_username($UserID, false, false, false)?> &gt; Settings</h2>
<form id="userform" name="userform" action="" method="post" onsubmit="return formVal();" autocomplete="off"> <form id="userform" name="userform" action="" method="post" onsubmit="return formVal();" autocomplete="off">
<div> <div>
<input type="hidden" name="action" value="takeedit" /> <input type="hidden" name="action" value="takeedit" />

View File

@ -74,11 +74,6 @@
$DB->query("SELECT $DB->query("SELECT
ID, ID,
Username,
Donor,
Warned,
Enabled,
PermissionID,
Email, Email,
Uploaded, Uploaded,
Downloaded, Downloaded,
@ -94,7 +89,7 @@
show_header('Invites'); show_header('Invites');
?> ?>
<div class="thin"> <div class="thin">
<h2><?=format_username($UserID,$Username)?> &gt; Invites</h2> <h2><?=format_username($UserID, false, false, false)?> &gt; Invites</h2>
<div class="linkbox"> <div class="linkbox">
[<a href="user.php?action=invitetree<? if($Sneaky){ echo '&amp;userid='.$UserID; }?>">Invite tree</a>] [<a href="user.php?action=invitetree<? if($Sneaky){ echo '&amp;userid='.$UserID; }?>">Invite tree</a>]
</div> </div>
@ -198,11 +193,11 @@
<? <?
$Row = 'a'; $Row = 'a';
foreach ($Invited as $User) { foreach ($Invited as $User) {
list($ID, $Username, $Donor, $Warned, $Enabled, $Class, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User; list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=format_username($ID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true, $Class)?></td> <td><?=format_username($ID, true, true, true, true)?></td>
<td><?=display_str($Email)?></td> <td><?=display_str($Email)?></td>
<td><?=time_diff($JoinDate,1)?></td> <td><?=time_diff($JoinDate,1)?></td>
<td><?=time_diff($LastAccess,1);?></td> <td><?=time_diff($LastAccess,1);?></td>

View File

@ -1,31 +1,31 @@
<? <?
if(isset($_GET['userid']) && check_perms('users_view_invites')){ if(isset($_GET['userid']) && check_perms('users_view_invites')){
if(!is_number($_GET['userid'])){ error(403); } if(!is_number($_GET['userid'])){ error(403); }
$UserID=$_GET['userid']; $UserID=$_GET['userid'];
$Sneaky = true; $Sneaky = true;
} else { } else {
if(!$UserCount = $Cache->get_value('stats_user_count')){ if(!$UserCount = $Cache->get_value('stats_user_count')){
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'"); $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
list($UserCount) = $DB->next_record(); list($UserCount) = $DB->next_record();
$Cache->cache_value('stats_user_count', $UserCount, 0); $Cache->cache_value('stats_user_count', $UserCount, 0);
} }
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
$Sneaky = false; $Sneaky = false;
} }
list($UserID, $Username, $PermissionID) = array_values(user_info($UserID)); list($UserID, $Username, $PermissionID) = array_values(user_info($UserID));
include(SERVER_ROOT.'/classes/class_invite_tree.php'); include(SERVER_ROOT.'/classes/class_invite_tree.php');
$Tree = new INVITE_TREE($UserID); $Tree = new INVITE_TREE($UserID);
show_header($Username.' &gt; Invites &gt; Tree'); show_header($Username.' &gt; Invites &gt; Tree');
?> ?>
<div class="thin"> <div class="thin">
<h2><?=format_username($UserID,$Username)?> &gt; <a href="user.php?action=invite&amp;userid=<?=$UserID?>">Invites</a> &gt; Tree</h2> <h2><?=format_username($UserID, false, false, false)?> &gt; <a href="user.php?action=invite&amp;userid=<?=$UserID?>">Invites</a> &gt; Tree</h2>
<div class="box pad"> <div class="box pad">
<? $Tree->make_tree(); ?> <? $Tree->make_tree(); ?>
</div> </div>
</div> </div>
<? show_footer(); ?> <? show_footer(); ?>

View File

@ -177,7 +177,7 @@ function user_dupes_table($UserID) {
list($DupeID) = $Dupe; list($DupeID) = $Dupe;
$DupeInfo = user_info($DupeID); $DupeInfo = user_info($DupeID);
?> ?>
<td align="left"><?=format_username($DupeID, $DupeInfo['Username'], $DupeInfo['Donor'], $DupeInfo['Warned'], ($DupeInfo['Enabled']==2)?false:true)?> <td align="left"><?=format_username($DupeID, true, true, true, true)?>
(<a href="user.php?action=dupes&dupeaction=remove&auth=<?=$LoggedUser['AuthKey']?>&userid=<?=$UserID?>&removeid=<?=$DupeID?>" onClick="return confirm('Are you sure you wish to remove <?=$DupeInfo['Username']?> from this group?');">x</a>)</td> (<a href="user.php?action=dupes&dupeaction=remove&auth=<?=$LoggedUser['AuthKey']?>&userid=<?=$UserID?>&removeid=<?=$DupeID?>" onClick="return confirm('Are you sure you wish to remove <?=$DupeInfo['Username']?> from this group?');">x</a>)</td>
<? <?
if ($i == 5) { if ($i == 5) {

View File

@ -31,12 +31,13 @@
<a href="feeds.php?feed=torrents_notify_<?=$N['ID']?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($N['Label'])?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a> <a href="feeds.php?feed=torrents_notify_<?=$N['ID']?>_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode($N['Label'])?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a>
<?=display_str($N['Label'])?> <?=display_str($N['Label'])?>
<a href="user.php?action=notify_delete&amp;id=<?=$N['ID']?>&amp;auth=<?=$LoggedUser['AuthKey']?>">(Delete)</a> <a href="user.php?action=notify_delete&amp;id=<?=$N['ID']?>&amp;auth=<?=$LoggedUser['AuthKey']?>">(Delete)</a>
<a href="#" onClick="$('#filter_<?=$N['ID']?>').toggle(); return false;">(Show)</a>
</h3> </h3>
<? } ?> <? } ?>
<form action="user.php" method="post"> <form action="user.php" method="post">
<input type="hidden" name="action" value="notify_handle" /> <input type="hidden" name="action" value="notify_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table> <table <?=($i<=$NumFilters)?'id="filter_'.$N['ID'].'" class="hidden"':''?>>
<? if($i>$NumFilters){ ?> <? if($i>$NumFilters){ ?>
<tr> <tr>
<td class="label"><strong>Label</strong></td> <td class="label"><strong>Label</strong></td>
@ -143,8 +144,10 @@
</tr> </tr>
</table> </table>
</form> </form>
<? if($i==$NumFilters){ ?>
<br /><br /> <br /><br />
<? } ?> <? }
} ?>
</div> </div>
<? <?
show_footer(); show_footer();

View File

@ -64,7 +64,7 @@ function reset() {
} }
} }
</script> </script>
<h2><?=format_username($UserID,$Username)?> > Permissions</h2> <h2><?=format_username($UserID, false, false, false)?> > Permissions</h2>
<div class="linkbox"> <div class="linkbox">
[<a href="#" onclick="reset();return false;">Defaults</a>] [<a href="#" onclick="reset();return false;">Defaults</a>]
</div> </div>

View File

@ -72,7 +72,7 @@
list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result; list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result;
?> ?>
<tr> <tr>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled == 2 ? false : true);?></td> <td><?=format_username($UserID, true, true, true, true);?></td>
<td><?=make_class_string($PermissionID);?></td> <td><?=make_class_string($PermissionID);?></td>
</tr> </tr>
<? } ?> <? } ?>

View File

@ -24,6 +24,10 @@
$AdminComment = db_string($_POST['AdminComment']); $AdminComment = db_string($_POST['AdminComment']);
$Donor = (isset($_POST['Donor']))? 1 : 0; $Donor = (isset($_POST['Donor']))? 1 : 0;
$Artist = (isset($_POST['Artist']))? 1 : 0; $Artist = (isset($_POST['Artist']))? 1 : 0;
$SecondaryClasses = isset($_POST['secondary_classes'])?$_POST['secondary_classes']:array();
foreach ($SecondaryClasses as $i => $Val) {
if(!is_number($Val)) { unset($SecondaryClasses[$i]); }
}
$Visible = (isset($_POST['Visible']))? 1 : 0; $Visible = (isset($_POST['Visible']))? 1 : 0;
$Invites = (int)$_POST['Invites']; $Invites = (int)$_POST['Invites'];
$SupportFor = db_string($_POST['SupportFor']); $SupportFor = db_string($_POST['SupportFor']);
@ -120,11 +124,14 @@
m.RequiredRatio, m.RequiredRatio,
m.FLTokens, m.FLTokens,
i.RatioWatchEnds, i.RatioWatchEnds,
SHA1(i.AdminComment) AS CommentHash 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
WHERE m.ID = $UserID"); LEFT JOIN users_levels AS l ON l.UserID = m.ID
WHERE m.ID = $UserID
GROUP BY m.ID");
if ($DB->record_count() == 0) { // If user doesn't exist if ($DB->record_count() == 0) { // If user doesn't exist
header("Location: log.php?search=User+".$UserID); header("Location: log.php?search=User+".$UserID);
@ -301,6 +308,36 @@
} }
} }
// Secondary classes
$OldClasses = $Cur['SecondaryClasses']?explode(',', $Cur['SecondaryClasses']):array();
$DroppedClasses = array_diff($OldClasses, $SecondaryClasses);
$AddedClasses = array_diff($SecondaryClasses, $OldClasses);
if (count($DroppedClasses) > 0) {
$ClassChanges = array();
foreach ($DroppedClasses as $PermID) {
$ClassChanges[] = $Classes[$PermID]['Name'];
}
$EditSummary[] = "Secondary classes dropped: ".implode(', ',$ClassChanges);
$DB->query("DELETE FROM users_levels WHERE UserID = '$UserID' AND PermissionID IN (".implode(',',$DroppedClasses).")");
if (count($SecondaryClasses) > 0) {
$LightUpdates['ExtraClasses']= array_fill_keys($SecondaryClasses, 1);
} else {
$LightUpdates['ExtraClasses']= array();
}
}
if (count($AddedClasses) > 0) {
$ClassChanges = array();
foreach ($AddedClasses as $PermID) {
$ClassChanges[] = $Classes[$PermID]['Name'];
}
$EditSummary[] = "Secondary classes added: ".implode(', ',$ClassChanges);
$Values = array();
foreach ($AddedClasses as $PermID) {
$Values[] = "($UserID, $PermID)";
}
$DB->query("INSERT INTO users_levels (UserID, PermissionID) VALUES ".implode(', ',$Values));
$LightUpdates['ExtraClasses']= array_fill_keys($SecondaryClasses, 1);
}
if ($Visible!=$Cur['Visible'] && check_perms('users_make_invisible')) { if ($Visible!=$Cur['Visible'] && check_perms('users_make_invisible')) {
$UpdateSet[]="Visible='$Visible'"; $UpdateSet[]="Visible='$Visible'";
@ -385,7 +422,7 @@
$ForumSet=explode(',',$PermittedForums); $ForumSet=explode(',',$PermittedForums);
$ForumList = array(); $ForumList = array();
foreach ($ForumSet as $ForumID) { foreach ($ForumSet as $ForumID) {
if ($Forums[$ForumID]['MinClassCreate'] <= $LoggedUser['Class']) { if ($Forums[$ForumID]['MinClassCreate'] <= $LoggedUser['EffectiveClass']) {
$ForumList[] = $ForumID; $ForumList[] = $ForumID;
} }
} }

View File

@ -366,6 +366,20 @@ function check_paranoia_here($Setting) {
<ul class="stats nobullet"> <ul class="stats nobullet">
<li>Class: <?=$ClassLevels[$Class]['Name']?></li> <li>Class: <?=$ClassLevels[$Class]['Name']?></li>
<? <?
$UserInfo = user_info($UserID);
if (!empty($UserInfo['ExtraClasses'])) {
?>
<li>
<ul class="stats">
<?
foreach($UserInfo['ExtraClasses'] as $PermID => $Val) { ?>
<li><?=$Classes[$PermID]['Name']?></li>
<? }
?>
</ul>
</li>
<?
}
// An easy way for people to measure the paranoia of a user, for e.g. contest eligibility // An easy way for people to measure the paranoia of a user, for e.g. contest eligibility
if($ParanoiaLevel == 0) { if($ParanoiaLevel == 0) {
$ParanoiaLevelText = 'Off'; $ParanoiaLevelText = 'Off';
@ -854,7 +868,7 @@ function check_paranoia_here($Setting) {
} }
} }
if (check_perms('users_mod', $Class) || $IsFLS) { if (check_perms('users_mod', $Class) || $IsFLS) {
$UserLevel = $LoggedUser['Class']; $UserLevel = $LoggedUser['EffectiveClass'];
$DB->query("SELECT $DB->query("SELECT
SQL_CALC_FOUND_ROWS SQL_CALC_FOUND_ROWS
ID, ID,
@ -890,13 +904,11 @@ function check_paranoia_here($Setting) {
} else { } else {
// Assigned to user // Assigned to user
$UserInfo = user_info($AssignedToUser); $Assigned = format_username($UserID, true, true, true, true);
$Assigned = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']);
} }
if ($ResolverID) { if ($ResolverID) {
$UserInfo = user_info($ResolverID); $Resolver = format_username($ResolverID, true, true, true, true);
$Resolver = format_username($ResolverID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']);
} else { } else {
$Resolver = "(unresolved)"; $Resolver = "(unresolved)";
} }
@ -965,8 +977,9 @@ function check_paranoia_here($Setting) {
<select name="Class"> <select name="Class">
<? <?
foreach ($ClassLevels as $CurClass) { foreach ($ClassLevels as $CurClass) {
if (check_perms('users_promote_below', $Class) && $CurClass['ID']>=$LoggedUser['Class']) { break; } if (check_perms('users_promote_below', $Class) && $CurClass['ID']>=$LoggedUser['EffectiveClass']) { break; }
if ($CurClass['ID']>$LoggedUser['Class']) { break; } if ($CurClass['ID']>$LoggedUser['EffectiveClass']) { break; }
if ($CurClass['Secondary']) { continue; }
if ($Class===$CurClass['Level']) { $Selected='selected="selected"'; } else { $Selected=""; } if ($Class===$CurClass['Level']) { $Selected='selected="selected"'; } else { $Selected=""; }
?> ?>
<option value="<?=$CurClass['ID']?>" <?=$Selected?>><?=$CurClass['Name'].' ('.$CurClass['Level'].')'?></option> <option value="<?=$CurClass['ID']?>" <?=$Selected?>><?=$CurClass['Name'].' ('.$CurClass['Level'].')'?></option>
@ -985,14 +998,26 @@ function check_paranoia_here($Setting) {
</tr> </tr>
<? <?
} }
if (check_perms('users_promote_below') || check_perms('users_promote_to')) { if (check_perms('users_promote_below') || check_perms('users_promote_to')) { ?>
?> <tr>
<tr> <td class="label">Secondary Classes:</td>
<td class="label">Artist:</td> <td>
<td><input type="checkbox" name="Artist" <? if ($Artist == 1) { ?>checked="checked" <? } ?> /></td>
</tr>
<? <?
} $DB->query("SELECT p.ID, p.Name, l.UserID
FROM permissions AS p
LEFT JOIN users_levels AS l ON l.PermissionID = p.ID AND l.UserID = '$UserID'
WHERE p.Secondary = 1
ORDER BY p.Name");
$i = 0;
while (list($PermID, $PermName, $IsSet) = $DB->next_record()) {
$i++;
?>
<input type="checkbox" id="perm_<?=$PermID?>" name="secondary_classes[]" value="<?=$PermID?>" <? if ($IsSet) { ?>checked="checked" <? } ?> />&nbsp;<label for="perm_<?=$PermID?>" style="margin-right: 10px;"><?=$PermName?></label>
<? if ($i % 5 == 0) { echo '<br />'; }
} ?>
</td>
</tr>
<? }
if (check_perms('users_make_invisible')) { if (check_perms('users_make_invisible')) {
?> ?>
<tr> <tr>

View File

@ -14,8 +14,8 @@
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) { error(404); }
$DB->query("SELECT um.Username, 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($Username, $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);
@ -94,7 +94,7 @@
<? <?
if ($UsersOnly == 1) { if ($UsersOnly == 1) {
$ueQuery = $DB->query("SELECT ue.UserID, Username, ue.Time, ue.IP FROM users_history_emails AS ue, users_main WHERE ue.Email = '".db_string($Values['Email'])."' AND UserID != ".$UserID." AND ID = UserID"); $ueQuery = $DB->query("SELECT ue.UserID, Username, ue.Time, ue.IP FROM users_history_emails AS ue, users_main WHERE ue.Email = '".db_string($Values['Email'])."' AND UserID != ".$UserID." AND ID = UserID");
while (list($UserID2, $Username, $Time, $IP) = $DB->next_record()) { ?> while (list($UserID2, $Time, $IP) = $DB->next_record()) { ?>
</tr> </tr>
<tr> <tr>
<td /> <td />
@ -105,7 +105,7 @@
list($Enabled)=$DB->next_record(); list($Enabled)=$DB->next_record();
$DB->set_query_id($ueQuery); $DB->set_query_id($ueQuery);
?> ?>
<td><a href="<?=display_str($UserURL)?>"><?=format_username($UserID2, $Username, 0, 0, $Enabled == 2 ? false : true, "")?></a></td> <td><a href="<?=display_str($UserURL)?>"><?=format_username($UserID2, false, false, true)?></a></td>
</tr> </tr>
<? <?
} }

View File

@ -13,8 +13,8 @@
$UserID = $_GET['userid']; $UserID = $_GET['userid'];
if (!is_number($UserID)) { error(404); } if (!is_number($UserID)) { error(404); }
$DB->query("SELECT um.Username, 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($Username, $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);
@ -84,7 +84,7 @@
$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;'.format_username($Val, $Usernames[$Key], $UsersDonor[$Key], $UsersWarned[$Key], $UsersEnabled[$Key] == 2 ? false : true); $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.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];
} }
@ -130,7 +130,7 @@
if ($Val['Usernames'] != '') { if ($Val['Usernames'] != '') {
// Match with old email // Match with old email
$OldMatches[$Key]['Email'] = $Val['Email']; $OldMatches[$Key]['Email'] = $Val['Email'];
$OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.format_username($Val['UserIDs'], $Val['Usernames'], $Val['UsersDonor'], $Val['UsersWarned'], $Val['UsersEnabled'] == 2 ? false : true); $OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.format_username($Val['UserIDs'], true, true, true);
$OldMatches[$Key]['EndTime'] = $Val['UserSetTimes']; $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
$OldMatches[$Key]['IP'] = $Val['UserIPs']; $OldMatches[$Key]['IP'] = $Val['UserIPs'];
} }

View File

@ -127,7 +127,7 @@ function ShowIPs(rowname) {
if(!$UserEndTimes[$Key]){ $UserEndTimes[$Key] = sqltime(); } if(!$UserEndTimes[$Key]){ $UserEndTimes[$Key] = sqltime(); }
?> ?>
<tr class="rowb<?=($HideMe ? ' hidden' : '')?>" name="<?=$Index?>"> <tr class="rowb<?=($HideMe ? ' hidden' : '')?>" name="<?=$Index?>">
<td>&nbsp;&nbsp;&#187;&nbsp;<?=format_username($Val, $Usernames[$Key], $UsersDonor[$Key], $UsersWarned[$Key], $UsersEnabled[$Key] == 2 ? false : true)?></td> <td>&nbsp;&nbsp;&#187;&nbsp;<?=format_username($Val, true, true, true)?></td>
<td><?=time_diff($UserStartTimes[$Key])?></td> <td><?=time_diff($UserStartTimes[$Key])?></td>
<td><?=time_diff($UserEndTimes[$Key])?></td> <td><?=time_diff($UserEndTimes[$Key])?></td>
<td><?//time_diff(strtotime($UserStartTimes[$Key]), strtotime($UserEndTimes[$Key])); ?></td> <td><?//time_diff(strtotime($UserStartTimes[$Key]), strtotime($UserEndTimes[$Key])); ?></td>

View File

@ -72,7 +72,7 @@
$sql .= ' $sql .= '
LEFT JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums AS f ON f.ID = t.ForumID
WHERE p.AuthorID = '.$UserID.' WHERE p.AuthorID = '.$UserID.'
AND ((f.MinClassRead <= '.$LoggedUser['Class']; AND ((f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
if(!empty($RestrictedForums)) { if(!empty($RestrictedForums)) {
$sql.=' $sql.='
AND f.ID NOT IN (\''.$RestrictedForums.'\')'; AND f.ID NOT IN (\''.$RestrictedForums.'\')';
@ -153,7 +153,7 @@
JOIN forums AS f ON f.ID = t.ForumID JOIN forums AS f ON f.ID = t.ForumID
LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID
WHERE p.AuthorID = '.$UserID.' WHERE p.AuthorID = '.$UserID.'
AND f.MinClassRead <= '.$LoggedUser['Class']; AND f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
if(!empty($RestrictedForums)) { if(!empty($RestrictedForums)) {
$sql.=' $sql.='
@ -315,7 +315,7 @@
<a href="#content<?=$PostID?>" onclick="LoadEdit(<?=$PostID?>, 1)">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit(<?=$PostID?>, 1)">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=format_username($EditedUserID, $EditedUsername) ?> <?=time_diff($EditedTime,2,true,true)?> <?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>

View File

@ -169,7 +169,7 @@
<? if($EditedUserID) { ?> <? if($EditedUserID) { ?>
<br /><br /> <br /><br />
Last edited by Last edited by
<?=format_username($EditedUserID, $EditedUsername) ?> <?=time_diff($EditedTime)?> <?=format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>

View File

@ -65,7 +65,7 @@
$Pages=get_pages($Page, $NumResults, 25); $Pages=get_pages($Page, $NumResults, 25);
?> ?>
<h2>Freeleech token history for <?=format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'])?></h2> <h2>Freeleech token history for <?=format_username($UserID, true, true, true)?></h2>
<div class="linkbox"><?=$Pages?></div> <div class="linkbox"><?=$Pages?></div>
<table> <table>

View File

@ -4,7 +4,7 @@
$Latest = $Alias->article($ArticleID); $Latest = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest); list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
if($Edit > $LoggedUser['Class']){ error(404); } if($Edit > $LoggedUser['EffectiveClass']){ error(404); }
show_header($Title." Aliases"); show_header($Title." Aliases");
?> ?>

View File

@ -31,7 +31,7 @@
} }
$Article = $Alias->article($ArticleID); $Article = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article); list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
if($Read > $LoggedUser['Class']){ error(404); } if($Read > $LoggedUser['EffectiveClass']){ error(404); }
show_header($Title,'wiki,bbcode'); show_header($Title,'wiki,bbcode');
?> ?>
@ -82,7 +82,7 @@
<strong>Details:</strong> <strong>Details:</strong>
<ul> <ul>
<li>Version: r<?=$Revision?></li> <li>Version: r<?=$Revision?></li>
<li>Last edited by: <?=format_username($AuthorID, $AuthorName)?></li> <li>Last edited by: <?=format_username($AuthorID, false, false, false)?></li>
<li>Last updated: <?=time_diff($Date)?></li> <li>Last updated: <?=time_diff($Date)?></li>
</ul> </ul>
</li> </li>
@ -104,7 +104,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<? if($Edit <= $LoggedUser['Class']){ ?> <? if($Edit <= $LoggedUser['EffectiveClass']){ ?>
<div class="box"> <div class="box">
<div style="padding:5px;"> <div style="padding:5px;">
<form action="wiki.php" method="post"> <form action="wiki.php" method="post">

View File

@ -77,7 +77,7 @@ function get_body($ID, $Rev) {
$Article = $Alias->article($ArticleID); $Article = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Article); list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Article);
if($Read > $LoggedUser['Class']){ error(404); } if($Read > $LoggedUser['EffectiveClass']){ error(404); }
show_header('Compare Article Revisions'); show_header('Compare Article Revisions');
$Diff2 = get_body($ArticleID, $_GET['new']); $Diff2 = get_body($ArticleID, $_GET['new']);

View File

@ -4,7 +4,7 @@
$Article = $Alias->article($ArticleID); $Article = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $Author) = array_shift($Article); list($Revision, $Title, $Body, $Read, $Edit, $Date, $Author) = array_shift($Article);
if($Edit > $LoggedUser['Class']){ if($Edit > $LoggedUser['EffectiveClass']){
error('You do not have access to edit this article.'); error('You do not have access to edit this article.');
} }

View File

@ -13,7 +13,7 @@ function class_list($Selected=0){
global $Classes, $LoggedUser; global $Classes, $LoggedUser;
$Return = ''; $Return = '';
foreach ($Classes as $ID => $Class) { foreach ($Classes as $ID => $Class) {
if($Class['Level'] <= $LoggedUser['Class']){ if($Class['Level'] <= $LoggedUser['EffectiveClass']){
$Return.='<option value="'.$Class['Level'].'"'; $Return.='<option value="'.$Class['Level'].'"';
if($Selected == $Class['Level']){ if($Selected == $Class['Level']){
$Return.=' selected="selected"'; $Return.=' selected="selected"';

View File

@ -4,8 +4,8 @@
$Latest = $Alias->article($ArticleID); $Latest = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest); list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
if($Read > $LoggedUser['Class']){ error(404); } if($Read > $LoggedUser['EffectiveClass']){ error(404); }
if($Edit > $LoggedUser['Class']){ error(403); } if($Edit > $LoggedUser['EffectiveClass']){ error(403); }
show_header("Revisions of ".$Title); show_header("Revisions of ".$Title);
?> ?>
@ -26,7 +26,7 @@
<tr> <tr>
<td><?=$Revision?></td> <td><?=$Revision?></td>
<td><?=$Title?></td> <td><?=$Title?></td>
<td><?=format_username($AuthorID, $AuthorName)?></td> <td><?=format_username($AuthorID, false, false, false)?></td>
<td><?=time_diff($Date)?></td> <td><?=time_diff($Date)?></td>
<td><input type="radio" name="old" value="<?=$Revision?>" disabled /></td> <td><input type="radio" name="old" value="<?=$Revision?>" disabled /></td>
<td><input type="radio" name="new" value="<?=$Revision?>" /></td> <td><input type="radio" name="new" value="<?=$Revision?>" /></td>
@ -35,18 +35,16 @@
$DB->query("SELECT $DB->query("SELECT
w.Revision, w.Revision,
w.Title, w.Title,
w.Author, w.Author,
u.Username,
w.Date w.Date
FROM wiki_revisions AS w FROM wiki_revisions AS w
LEFT JOIN users_main AS u ON u.ID=w.Author
WHERE w.ID='$ArticleID' WHERE w.ID='$ArticleID'
ORDER BY Revision DESC"); ORDER BY Revision DESC");
while(list($Revision, $Title, $AuthorID, $AuthorName, $Date) = $DB->next_record()) { ?> while(list($Revision, $Title, $AuthorID, $Date) = $DB->next_record()) { ?>
<tr> <tr>
<td><?=$Revision?></td> <td><?=$Revision?></td>
<td><?=$Title?></td> <td><?=$Title?></td>
<td><?=format_username($AuthorID, $AuthorName)?></td> <td><?=format_username($AuthorID, false, false, false)?></td>
<td><?=time_diff($Date)?></td> <td><?=time_diff($Date)?></td>
<td><input type="radio" name="old" value="<?=$Revision?>" /></td> <td><input type="radio" name="old" value="<?=$Revision?>" /></td>
<td><input type="radio" name="new" value="<?=$Revision?>" /></td> <td><input type="radio" name="new" value="<?=$Revision?>" /></td>

View File

@ -36,11 +36,9 @@
w.ID, w.ID,
w.Title, w.Title,
w.Date, w.Date,
w.Author, w.Author
u.Username
FROM wiki_articles AS w FROM wiki_articles AS w
LEFT JOIN users_main AS u ON u.ID=w.Author WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
WHERE w.MinClassRead <= '".$LoggedUser['Class']."'";
if($Search!='') { if($Search!='') {
$SQL .= " AND $Type LIKE '%"; $SQL .= " AND $Type LIKE '%";
$SQL .= implode("%' AND $Type LIKE '%", $Words); $SQL .= implode("%' AND $Type LIKE '%", $Words);
@ -115,11 +113,11 @@
<td>Last Updated</td> <td>Last Updated</td>
<td>Last edited by</td> <td>Last edited by</td>
</tr> </tr>
<? while(list($ID, $Title, $Date, $UserID, $Username) = $DB->next_record()) {?> <? while(list($ID, $Title, $Date, $UserID) = $DB->next_record()) {?>
<tr> <tr>
<td><a href="wiki.php?action=article&id=<?=$ID?>"><?=$Title?></a></td> <td><a href="wiki.php?action=article&id=<?=$ID?>"><?=$Title?></a></td>
<td><?=$Date?></td> <td><?=$Date?></td>
<td><?=format_username($UserID, $Username)?></td> <td><?=format_username($UserID, false, false, false)?></td>
</tr> </tr>
<? } ?> <? } ?>
</table> </table>

View File

@ -28,7 +28,7 @@
$Edit=$_POST['minclassedit']; $Edit=$_POST['minclassedit'];
if(!is_number($Read)) { error(0); } //int? if(!is_number($Read)) { error(0); } //int?
if(!is_number($Edit)) { error(0); } if(!is_number($Edit)) { error(0); }
if($Edit > $LoggedUser['Class']){ error('You can\'t restrict articles above your own level'); } if($Edit > $LoggedUser['EffectiveClass']){ error('You can\'t restrict articles above your own level'); }
if($Edit < $Read){ $Edit = $Read; } //Human error fix. if($Edit < $Read){ $Edit = $Read; } //Human error fix.
} else { } else {
$Read=100; $Read=100;

View File

@ -18,14 +18,14 @@
$Article = $Alias->article($ArticleID); $Article = $Alias->article($ArticleID);
list($Revision, $Title, $Body, $CurRead, $CurEdit, $Date, $Author) = array_shift($Article); list($Revision, $Title, $Body, $CurRead, $CurEdit, $Date, $Author) = array_shift($Article);
if($CurEdit > $LoggedUser['Class']){ error(403); } if($CurEdit > $LoggedUser['EffectiveClass']){ error(403); }
if(check_perms('admin_manage_wiki')){ if(check_perms('admin_manage_wiki')){
$Read=$_POST['minclassread']; $Read=$_POST['minclassread'];
$Edit=$_POST['minclassedit']; $Edit=$_POST['minclassedit'];
if(!is_number($Read)) { error(0); } //int? if(!is_number($Read)) { error(0); } //int?
if(!is_number($Edit)) { error(0); } if(!is_number($Edit)) { error(0); }
if($Edit > $LoggedUser['Class']){ error('You can\'t restrict articles above your own level.'); } if($Edit > $LoggedUser['EffectiveClass']){ error('You can\'t restrict articles above your own level.'); }
if($Edit < $Read){ $Edit = $Read; } //Human error fix. if($Edit < $Read){ $Edit = $Read; } //Human error fix.
} }

View File

@ -6,11 +6,9 @@
w.ID, w.ID,
w.Title, w.Title,
w.Date, w.Date,
w.Author, w.Author
u.Username
FROM wiki_articles AS w FROM wiki_articles AS w
LEFT JOIN users_main AS u ON u.ID=w.Author WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
WHERE w.MinClassRead <= '".$LoggedUser['Class']."'";
if($Letter!=='1') { if($Letter!=='1') {
$sql .= " AND UPPER(LEFT(w.Title,1)) = '".db_string($Letter)."'"; $sql .= " AND UPPER(LEFT(w.Title,1)) = '".db_string($Letter)."'";
} else { } else {
@ -32,11 +30,11 @@
<td>Last Updated</td> <td>Last Updated</td>
<td>Last edited by</td> <td>Last edited by</td>
</tr> </tr>
<? while(list($ID, $Title, $Date, $UserID, $Username) = $DB->next_record()) {?> <? while(list($ID, $Title, $Date, $UserID) = $DB->next_record()) {?>
<tr> <tr>
<td><a href="wiki.php?action=article&id=<?=$ID?>"><?=$Title?></a></td> <td><a href="wiki.php?action=article&id=<?=$ID?>"><?=$Title?></a></td>
<td><?=$Date?></td> <td><?=$Date?></td>
<td><?=format_username($UserID, $Username)?></td> <td><?=format_username($UserID, false, false, false)?></td>
</tr> </tr>
<? } ?> <? } ?>
</table> </table>

View File

@ -172,4 +172,5 @@ span.rbt { display: block; padding: 8px 0 0; background: url('../rippy/rippy_top
span.rbm { display: block; background: url('../rippy/rippy_middle.gif') repeat bottom; padding: 2px; } span.rbm { display: block; background: url('../rippy/rippy_middle.gif') repeat bottom; padding: 2px; }
span.rbb { display: block; padding: 4px 0px 18px; margin-bottom: 5px; background: url('../rippy/rippy_bottom.gif') no-repeat bottom; } span.rbb { display: block; padding: 4px 0px 18px; margin-bottom: 5px; background: url('../rippy/rippy_bottom.gif') no-repeat bottom; }
span.secondary_class { font-size:85%; font-weight:bold; }
.breadcrumbs { font-weight: bold; text-align: right; } .breadcrumbs { font-weight: bold; text-align: right; }