diff --git a/classes/class_cache.php b/classes/class_cache.php index 63e79e7b..cde26a0d 100644 --- a/classes/class_cache.php +++ b/classes/class_cache.php @@ -43,8 +43,7 @@ class CACHE extends Memcache { public $CanClear = false; 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); } diff --git a/classes/class_invite_tree.php b/classes/class_invite_tree.php index a6ac25e8..8708322f 100644 --- a/classes/class_invite_tree.php +++ b/classes/class_invite_tree.php @@ -41,12 +41,10 @@ function make_tree(){ if(!$TreeID){ return; } $TreeQuery = $DB->query(" SELECT - it.UserID, - Username, - Donor, - Warned, + it.UserID, Enabled, PermissionID, + Donor, Uploaded, Downloaded, 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 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 $Count++; @@ -116,7 +114,7 @@ function make_tree(){ } ?>
  • - + QueryID = $ResultSet; $this->Row = 0; } + + function get_query_id() { + return $this->QueryID; + } function beginning() { mysqli_data_seek($this->QueryID, 0); diff --git a/classes/class_user_rank.php b/classes/class_user_rank.php index 30542e8a..0997744e 100644 --- a/classes/class_user_rank.php +++ b/classes/class_user_rank.php @@ -59,7 +59,6 @@ function table_query($TableName) { } function get_rank($TableName, $Value) { - return false; if($Value == 0) { return 0; } global $Cache, $DB; diff --git a/classes/script_start.php b/classes/script_start.php index d1839039..d79d9f86 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -73,7 +73,7 @@ // Get permissions list($Classes, $ClassLevels) = $Cache->get_value('classes'); 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'); $ClassLevels = $DB->to_array('Level'); $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 function user_info($UserID) { - global $DB, $Cache; + global $DB, $Cache, $Classes; $UserInfo = $Cache->get_value('user_info_'.$UserID); // the !isset($UserInfo['Paranoia']) can be removed after a transition period if(empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia'])) { + $OldQueryID = $DB->get_query_id(); $DB->query("SELECT @@ -278,9 +279,11 @@ function user_info($UserID) { m.Enabled, m.Title, i.CatchupTime, - m.Visible + m.Visible, + GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels FROM users_main AS m INNER JOIN users_info AS i ON i.UserID=m.ID + JOIN users_levels AS ul ON ul.UserID = m.ID WHERE m.ID='$UserID'"); 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'); @@ -293,7 +296,21 @@ function user_info($UserID) { $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); + $DB->set_query_id($OldQueryID); } if(strtotime($UserInfo['Warned']) < time()) { $UserInfo['Warned'] = '0000-00-00 00:00:00'; @@ -337,7 +354,8 @@ function user_heavy_info($UserID) { i.LastReadNews, i.RestrictedForums, i.PermittedForums, - m.FLTokens + m.FLTokens, + m.PermissionID FROM users_main AS m INNER JOIN users_info AS i ON i.UserID=m.ID WHERE m.ID='$UserID'"); @@ -348,7 +366,7 @@ function user_heavy_info($UserID) { } else { $HeavyInfo['CustomPermissions'] = array(); } - + if (!empty($HeavyInfo['RestrictedForums'])) { $RestrictedForums = explode(',', $HeavyInfo['RestrictedForums']); } else { @@ -361,6 +379,19 @@ function user_heavy_info($UserID) { $PermittedForums = array(); } 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)) { $HeavyInfo['CustomForums'] = array(); foreach ($RestrictedForums as $ForumID) { @@ -422,7 +453,7 @@ function get_permissions($PermissionID) { global $DB, $Cache; $Permission = $Cache->get_value('perm_'.$PermissionID); if(empty($Permission)) { - $DB->query("SELECT p.Level AS Class, p.Values as Permissions 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['Permissions'] = unserialize($Permission['Permissions']); $Cache->cache_value('perm_'.$PermissionID, $Permission, 2592000); @@ -448,17 +479,14 @@ function get_permissions_for_user($UserID, $CustomPermissions = false) { $Permissions = get_permissions($UserInfo['PermissionID']); - // Manage 'special' inherited permissions - if($UserInfo['Artist']) { - $ArtistPerms = get_permissions(ARTIST); - } else { - $ArtistPerms = array('Permissions' => array()); - } - - if($UserInfo['Donor']) { - $DonorPerms = get_permissions(DONOR); - } else { - $DonorPerms = array('Permissions' => array()); + // Manage 'special' inherited permissions + $BonusPerms = array(); + $BonusCollages = 0; + foreach ($UserInfo['ExtraClasses'] as $PermID => $Value) { + $ClassPerms = get_permissions($PermID); + $BonusCollages += $ClassPerms['Permissions']['MaxCollages']; + unset($ClassPerms['Permissions']['MaxCollages']); + $BonusPerms = array_merge($BonusPerms, $ClassPerms['Permissions']); } if(!empty($CustomPermissions)) { @@ -467,10 +495,20 @@ function get_permissions_for_user($UserID, $CustomPermissions = false) { $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 - 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. @@ -1044,21 +1082,62 @@ function make_hash($Str,$Secret) { $Class and $Title can be omitted for an 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) { return 'System'; - } elseif($Username == '') { + } + + $UserInfo = user_info($UserID); + if($UserInfo['Username'] == '') { return "Unknown [$UserID]"; } - $str=''.$Username.''; - $str.=($IsDonor) ? 'Donor' : ''; + + $str = ''; + + if ($Title) { + $str .= ''; + } + + $str.=''.$UserInfo['Username'].''; + if ($Title) { + $str .= ''; + } + + if ($Badges) { + $str.=($UserInfo['Donor'] == 1) ? 'Donor' : ''; + } + $str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? 'Warned' : ''; + $str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? 'Banned' : ''; + + + } - $str.=($IsWarned!='0000-00-00 00:00:00') ? 'Warned' : ''; - $str.=(!$IsEnabled) ? 'Banned' : ''; + $str.=($IsWarned && $UserInfo['Warned']!='0000-00-00 00:00:00') ? 'Warned' : ''; + $str.=($IsEnabled && $UserInfo['Enabled'] == 2) ? 'Banned' : ''; - $str.=($Class) ? ' ('.make_class_string($Class).')' : ''; - $str.=($Title) ? ' ('.$Title.')' : ''; + if ($Title && $Class) { + $str .= ''; + } + $str.=($Class) ? ' ('.make_class_string($UserInfo['PermissionID']).')' : ''; + if ($Title && $Class) { + $str .= ''; + } + 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&i='.urlencode($Matches[2]).$Matches[3]; + }, $UserTitle); + } + + $str.=''; + if ($UserInfo['Title']) { + $str.= ' ('.$UserInfo['Title'].')'; + } + } 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 function check_perms($PermissionName,$MinClass = 0) { 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 diff --git a/design/privateheader.php b/design/privateheader.php index 9c048343..39790cbf 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -168,7 +168,7 @@
  • - + diff --git a/nohup.out b/nohup.out deleted file mode 100644 index 5e21f121..00000000 --- a/nohup.out +++ /dev/null @@ -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 diff --git a/sections/ajax/forum/forum.php b/sections/ajax/forum/forum.php index 5e2c506b..1d9ae165 100644 --- a/sections/ajax/forum/forum.php +++ b/sections/ajax/forum/forum.php @@ -43,17 +43,13 @@ t.ID, t.Title, t.AuthorID, - author.Username AS AuthorUsername, t.IsLocked, t.IsSticky, t.NumPosts, t.LastPostID, t.LastPostTime, t.LastPostAuthorID, - last_author.Username AS LastPostUsername 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' ORDER BY t.IsSticky DESC, t.LastPostTime DESC LIMIT $Limit"); // Can be cached until someone makes a new post @@ -114,7 +110,7 @@ $JsonTopics = array(); 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 if((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID']<$LastID) && strtotime($LastTime)>$LoggedUser['CatchupTime'])) { @@ -122,6 +118,10 @@ } else { $Read = 'read'; } + $UserInfo = user_info($AuthorID); + $AuthorName = $UserInfo['Username']; + $UserInfo = user_info($LastAuthorID); + $LastAuthorName = $UserInfo['Username']; $JsonTopics[] = array( 'topicId' => (int) $TopicID, diff --git a/sections/ajax/forum/index.php b/sections/ajax/forum/index.php index d16b8649..16dca4de 100644 --- a/sections/ajax/forum/index.php +++ b/sections/ajax/forum/index.php @@ -34,7 +34,6 @@ f.NumPosts, f.LastPostID, f.LastPostAuthorID, - um.Username, f.LastPostTopicID, f.LastPostTime, COUNT(sr.ThreadID) AS SpecificRules, @@ -44,7 +43,6 @@ FROM forums AS f JOIN forums_categories AS fc ON fc.ID = f.CategoryID 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 GROUP BY f.ID ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); diff --git a/sections/ajax/forum/main.php b/sections/ajax/forum/main.php index 820a8fd9..5e598450 100644 --- a/sections/ajax/forum/main.php +++ b/sections/ajax/forum/main.php @@ -39,7 +39,7 @@ $JsonCategory = array(); $JsonForums = array(); 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)) { continue; } @@ -63,7 +63,8 @@ } else { $Read = 'read'; } - + $UserInfo = user_info($LastAuthorID); + $JsonForums[] = array( 'forumId' => (int) $ForumID, 'forumName' => $ForumName, @@ -72,7 +73,7 @@ 'numPosts' => (float) $NumPosts, 'lastPostId' => (float) $LastPostID, 'lastAuthorId' => (float) $LastAuthorID, - 'lastPostAuthorName' => $LastPostAuthorName, + 'lastPostAuthorName' => $UserInfo['Username'], 'lastTopicId' => (float) $LastTopicID, 'lastTime' => $LastTime, 'specificRules' => $SpecificRules, diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index 98eaac6d..24c79ef9 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -86,9 +86,7 @@ p.Body, p.EditedUserID, p.EditedTime, - ed.Username 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']."' LIMIT $CatalogueLimit"); $Catalogue = $DB->to_array(false,MYSQLI_ASSOC); @@ -217,15 +215,16 @@ $JsonPosts = array(); 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)); + $UserInfo = user_info($EditedUserID); $JsonPosts[] = array( 'postId' => (int) $PostID, 'addedTime' => $AddedTime, 'body' => $Text->full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, - 'editedUsername' => $EditedUsername, + 'editedUsername' => $UserInfo['Username'], 'author' => array( 'authorId' => (int) $AuthorID, 'authorName' => $Username, diff --git a/sections/ajax/inbox/viewconv.php b/sections/ajax/inbox/viewconv.php index b49aec47..67862840 100644 --- a/sections/ajax/inbox/viewconv.php +++ b/sections/ajax/inbox/viewconv.php @@ -39,15 +39,14 @@ WHERE c.ID='$ConvID' AND UserID='$UserID'"); 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 - JOIN users_info AS ui ON ui.UserID=pm.SenderID JOIN users_main AS um ON um.ID=pm.SenderID 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; - $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[0]['UserStr'] = 'System'; // in case it's a message from the system diff --git a/sections/ajax/top10/index.php b/sections/ajax/top10/index.php index f627320c..49ade612 100644 --- a/sections/ajax/top10/index.php +++ b/sections/ajax/top10/index.php @@ -2,7 +2,7 @@ // Already done in /sections/ajax/index.php //enforce_login(); -if(1 || !check_perms('site_top10')){ +if(!check_perms('site_top10')){ print json_encode(array('status' => 'failure')); die(); } diff --git a/sections/collages/all_comments.php b/sections/collages/all_comments.php index 68c75d3f..7b8ad680 100644 --- a/sections/collages/all_comments.php +++ b/sections/collages/all_comments.php @@ -74,7 +74,7 @@ # - by [Report Comment] + by [Report Comment] - [Quote] - [Edit] - [Delete] diff --git a/sections/collages/browse.php b/sections/collages/browse.php index 48f95659..07731b51 100644 --- a/sections/collages/browse.php +++ b/sections/collages/browse.php @@ -74,11 +74,9 @@ c.NumTorrents, c.TagList, c.CategoryID, - c.UserID, - um.Username + c.UserID FROM collages AS c $BookmarkJoin - LEFT JOIN users_main AS um ON um.ID=c.UserID WHERE Deleted = '0'"; if ($BookmarkView) { @@ -271,7 +269,7 @@ - + diff --git a/sections/collages/collage.php b/sections/collages/collage.php index e4898e03..0e7a0141 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -515,7 +515,7 @@ function compare($X, $Y){ $i++; if($i>5) { break; } ?> -
  • ()
  • +
  • ()
  • @@ -569,7 +569,7 @@ function compare($X, $Y){ list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; ?>
    - +
    full_format($Body)?>
    query("SELECT ct.GroupID, - um.ID, - um.Username, + ct.UserID, ct.Sort FROM collages_torrents AS ct 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' ORDER BY ct.Sort"); @@ -43,7 +41,7 @@ $Number = 0; foreach ($TorrentList as $GroupID=>$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++; @@ -74,7 +72,7 @@ - + diff --git a/sections/comments/index.php b/sections/comments/index.php index b789323e..045f716e 100644 --- a/sections/comments/index.php +++ b/sections/comments/index.php @@ -51,40 +51,25 @@ else { $Conditions = "WHERE tc.AuthorID = $UserID"; $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 = 'Display comments left on your uploads'; } $Comments = $DB->query("SELECT SQL_CALC_FOUND_ROWS - m.ID, - m.Username, - m.PermissionID, - m.Enabled, - - i.Avatar, - i.Donor, - i.Warned, - + tc.AuthorID, t.ID, t.GroupID, - tg.Name, - tc.ID, tc.Body, tc.AddedTime, tc.EditedTime, - - em.ID as EditorID, - em.Username as EditorUsername + tc.EditedUserID as EditorID FROM torrents as t 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 - LEFT JOIN users_main as em ON em.ID = tc.EditedUserID $Conditions @@ -119,13 +104,14 @@ next_record()) { +while(list($UserID, $TorrentID, $GroupID, $Title, $PostID, $Body, $AddedTime, $EditedTime, $EditorID) = $DB->next_record()) { + $UserInfo = user_info($UserID); ?> ' id="post"> @@ -136,9 +122,9 @@ ?> - + diff --git a/sections/forums/index.php b/sections/forums/index.php index 2930de19..2786f298 100644 --- a/sections/forums/index.php +++ b/sections/forums/index.php @@ -34,7 +34,6 @@ f.NumPosts, f.LastPostID, f.LastPostAuthorID, - um.Username, f.LastPostTopicID, f.LastPostTime, COUNT(sr.ThreadID) AS SpecificRules, @@ -44,7 +43,6 @@ FROM forums AS f JOIN forums_categories AS fc ON fc.ID = f.CategoryID 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 GROUP BY f.ID ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); diff --git a/sections/forums/main.php b/sections/forums/main.php index 20d3bf2c..94a18967 100644 --- a/sections/forums/main.php +++ b/sections/forums/main.php @@ -41,7 +41,7 @@ $RestrictedForums = explode(',', $RestrictedForums); $PermittedForums = array_keys($LoggedUser['PermittedForums']); 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)) { continue; } @@ -98,7 +98,7 @@ - by + by diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index ab205521..dc5b9113 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -91,7 +91,6 @@ 'NumTopics'=>'-1', 'LastPostID'=>$NewLastPostID, 'LastPostAuthorID'=>$NewLastAuthorID, - 'Username'=>$NewLastAuthorName, 'LastPostTopicID'=>$NewLastTopic, 'LastPostTime'=>$NewLastAddedTime, 'Title'=>$NewLastTitle, @@ -176,7 +175,6 @@ 'NumTopics'=>'-1', 'LastPostID'=>$NewLastPostID, 'LastPostAuthorID'=>$NewLastAuthorID, - 'Username'=>$NewLastAuthorName, 'LastPostTopicID'=>$NewLastTopic, 'LastPostTime'=>$NewLastAddedTime, 'Title'=>$NewLastTitle, @@ -219,7 +217,6 @@ 'NumTopics'=>'+1', 'LastPostID'=>$NewLastPostID, 'LastPostAuthorID'=>$NewLastAuthorID, - 'Username'=>$NewLastAuthorName, 'LastPostTopicID'=>$NewLastTopic, 'LastPostTime'=>$NewLastAddedTime, 'Title'=>$NewLastTitle diff --git a/sections/forums/newthread.php b/sections/forums/newthread.php index d3c3c24b..911b1d4d 100644 --- a/sections/forums/newthread.php +++ b/sections/forums/newthread.php @@ -46,7 +46,7 @@ - + diff --git a/sections/user/takemoderate.php b/sections/user/takemoderate.php index a4196bf8..b408552d 100644 --- a/sections/user/takemoderate.php +++ b/sections/user/takemoderate.php @@ -24,6 +24,10 @@ $AdminComment = db_string($_POST['AdminComment']); $Donor = (isset($_POST['Donor']))? 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; $Invites = (int)$_POST['Invites']; $SupportFor = db_string($_POST['SupportFor']); @@ -120,11 +124,14 @@ m.RequiredRatio, m.FLTokens, i.RatioWatchEnds, - SHA1(i.AdminComment) AS CommentHash + SHA1(i.AdminComment) AS CommentHash, + GROUP_CONCAT(l.PermissionID SEPARATOR ',') AS SecondaryClasses FROM users_main AS m JOIN users_info AS i ON i.UserID = m.ID LEFT JOIN permissions AS p ON p.ID=m.PermissionID - 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 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')) { $UpdateSet[]="Visible='$Visible'"; @@ -385,7 +422,7 @@ $ForumSet=explode(',',$PermittedForums); $ForumList = array(); foreach ($ForumSet as $ForumID) { - if ($Forums[$ForumID]['MinClassCreate'] <= $LoggedUser['Class']) { + if ($Forums[$ForumID]['MinClassCreate'] <= $LoggedUser['EffectiveClass']) { $ForumList[] = $ForumID; } } diff --git a/sections/user/user.php b/sections/user/user.php index f7f31095..79639534 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -366,6 +366,20 @@ function check_paranoia_here($Setting) { - - - + if (check_perms('users_promote_below') || check_perms('users_promote_to')) { ?> + + + + + diff --git a/sections/userhistory/email_history.php b/sections/userhistory/email_history.php index d7fa9576..012630f0 100644 --- a/sections/userhistory/email_history.php +++ b/sections/userhistory/email_history.php @@ -14,8 +14,8 @@ $UserID = $_GET['userid']; 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"); -list($Username, $Joined, $Class) = $DB->next_record(); +$DB->query("SELECT ui.JoinDate, p.Level AS Class FROM users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = $UserID"); +list($Joined, $Class) = $DB->next_record(); if(!check_perms('users_view_email', $Class)) { error(403); @@ -94,7 +94,7 @@ 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()) { ?> + 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"); -list($Username, $Joined, $Class) = $DB->next_record(); +$DB->query("SELECT ui.JoinDate, p.Level AS Class FROM users_main AS um JOIN users_info AS ui ON um.ID=ui.UserID JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = $UserID"); +list($Joined, $Class) = $DB->next_record(); if(!check_perms('users_view_email', $Class)) { error(403); @@ -84,7 +84,7 @@ $UserIPs=explode('|', $CurrentEmail['UserIPs']); foreach($UserIDs as $Key => $Val) { - $CurrentMatches[$Key]['Username'] = '  » '.format_username($Val, $Usernames[$Key], $UsersDonor[$Key], $UsersWarned[$Key], $UsersEnabled[$Key] == 2 ? false : true); + $CurrentMatches[$Key]['Username'] = '  » '.format_username($Val, true, true, true); $CurrentMatches[$Key]['IP'] = $UserIPs[$Key]; $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key]; } @@ -130,7 +130,7 @@ if ($Val['Usernames'] != '') { // Match with old email $OldMatches[$Key]['Email'] = $Val['Email']; - $OldMatches[$Key]['Username'] = '  » '.format_username($Val['UserIDs'], $Val['Usernames'], $Val['UsersDonor'], $Val['UsersWarned'], $Val['UsersEnabled'] == 2 ? false : true); + $OldMatches[$Key]['Username'] = '  » '.format_username($Val['UserIDs'], true, true, true); $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes']; $OldMatches[$Key]['IP'] = $Val['UserIPs']; } diff --git a/sections/userhistory/ip_history.php b/sections/userhistory/ip_history.php index 8cfe8bfc..bd2ee92a 100644 --- a/sections/userhistory/ip_history.php +++ b/sections/userhistory/ip_history.php @@ -127,7 +127,7 @@ function ShowIPs(rowname) { if(!$UserEndTimes[$Key]){ $UserEndTimes[$Key] = sqltime(); } ?> - + diff --git a/sections/userhistory/post_history.php b/sections/userhistory/post_history.php index 74cda3fe..2a1c6bb1 100644 --- a/sections/userhistory/post_history.php +++ b/sections/userhistory/post_history.php @@ -72,7 +72,7 @@ $sql .= ' LEFT JOIN forums AS f ON f.ID = t.ForumID WHERE p.AuthorID = '.$UserID.' - AND ((f.MinClassRead <= '.$LoggedUser['Class']; + AND ((f.MinClassRead <= '.$LoggedUser['EffectiveClass']; if(!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; @@ -153,7 +153,7 @@ 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 WHERE p.AuthorID = '.$UserID.' - AND f.MinClassRead <= '.$LoggedUser['Class']; + AND f.MinClassRead <= '.$LoggedUser['EffectiveClass']; if(!empty($RestrictedForums)) { $sql.=' @@ -315,7 +315,7 @@ « Last edited by - + diff --git a/sections/userhistory/subscriptions.php b/sections/userhistory/subscriptions.php index 45b83765..b926e953 100644 --- a/sections/userhistory/subscriptions.php +++ b/sections/userhistory/subscriptions.php @@ -169,7 +169,7 @@

    Last edited by - + diff --git a/sections/userhistory/token_history.php b/sections/userhistory/token_history.php index f530da67..e8c468df 100644 --- a/sections/userhistory/token_history.php +++ b/sections/userhistory/token_history.php @@ -65,7 +65,7 @@ $Pages=get_pages($Page, $NumResults, 25); ?> -

    Freeleech token history for

    +

    Freeleech token history for

    # - by + by on - <?=$Username ?>'s avatar + ' width='150' alt="'s avatar" /> Default avatar @@ -156,7 +142,7 @@ ?>

    Last edited by - + diff --git a/sections/forums/ajax_get_edit.php b/sections/forums/ajax_get_edit.php index ad01f41b..4c9cde6e 100644 --- a/sections/forums/ajax_get_edit.php +++ b/sections/forums/ajax_get_edit.php @@ -25,18 +25,17 @@ $Edits = $Cache->get_value($Type.'_edits_'.$PostID); 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 - JOIN users_main AS um ON um.ID=ce.EditUser WHERE Page = '".$Type."' AND PostID = ".$PostID." ORDER BY ce.EditTime DESC"); $Edits = $DB->to_array(); $Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0); } -list($UserID, $Username, $Time) = $Edits[$Depth]; +list($UserID, $Time) = $Edits[$Depth]; if($Depth != 0) { - list(,,,$Body) = $Edits[$Depth - 1]; + list(,,$Body) = $Edits[$Depth - 1]; } else { //Not an edit, have to get from the original switch($Type) { @@ -66,7 +65,7 @@ « - + Original Post '-1', 'LastPostID' => $LastTopicPostID, 'LastPostAuthorID' => $LastTopicAuthorID, - 'Username' => $LastTopicAuthorName, 'LastPostTime' => $LastTopicPostTime, 'LastPostTopicID' => $LastTopicID, 'Title' => $LastTopicTitle); @@ -68,7 +67,6 @@ 'NumPosts' => '-1', 'LastPostID' => $LastID, 'LastPostAuthorID' => $LastAuthorID, - 'Username' => $LastAuthorName, 'LastPostTime' => $LastTime); } $UpdateArrayThread = array('Posts' => '-1', 'LastPostAuthorID' => $LastAuthorID); diff --git a/sections/forums/forum.php b/sections/forums/forum.php index d37cea46..3658affa 100644 --- a/sections/forums/forum.php +++ b/sections/forums/forum.php @@ -36,17 +36,13 @@ t.ID, t.Title, t.AuthorID, - author.Username AS AuthorUsername, t.IsLocked, t.IsSticky, t.NumPosts, t.LastPostID, t.LastPostTime, - t.LastPostAuthorID, - last_author.Username AS LastPostUsername + t.LastPostAuthorID 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' ORDER BY t.IsSticky DESC, t.LastPostTime DESC LIMIT $Limit"); // Can be cached until someone makes a new post @@ -63,6 +59,7 @@ if (!check_perms('site_moderate_forums')) { if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); } } + if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); } // Start printing @@ -162,7 +159,7 @@ $Row='a'; 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'; // Build list of page links @@ -216,11 +213,11 @@ - by + by
    #XXXXXX - by + by Just now diff --git a/sections/forums/take_new_thread.php b/sections/forums/take_new_thread.php index d74de848..358219bf 100644 --- a/sections/forums/take_new_thread.php +++ b/sections/forums/take_new_thread.php @@ -136,7 +136,6 @@ 'ID' => $TopicID, 'Title' => $Title, 'AuthorID' => $LoggedUser['ID'], - 'AuthorUsername' => $LoggedUser['Username'], 'IsLocked' => 0, 'IsSticky' => 0, 'NumPosts' => 1, @@ -157,7 +156,6 @@ 'NumTopics'=>'+1', 'LastPostID'=>$PostID, 'LastPostAuthorID'=>$LoggedUser['ID'], - 'Username'=>$LoggedUser['Username'], 'LastPostTopicID'=>$TopicID, 'LastPostTime'=>sqltime(), 'Title'=>$Title, @@ -178,7 +176,6 @@ 'Body'=>$Body, 'EditedUserID'=>0, 'EditedTime'=>'0000-00-00 00:00:00', - 'Username'=>'' ); $Cache->insert('', $Post); $Cache->commit_transaction(0); diff --git a/sections/forums/take_reply.php b/sections/forums/take_reply.php index 25361f8f..c65d9adc 100644 --- a/sections/forums/take_reply.php +++ b/sections/forums/take_reply.php @@ -124,7 +124,6 @@ $Thread['LastPostID'] = $PostID; //Set postid for read/unread $Thread['LastPostTime'] = sqltime(); //Time of last post $Thread['LastPostAuthorID'] = $LoggedUser['ID']; //Last poster id - $Thread['LastPostUsername'] = $LoggedUser['Username']; //Last poster username $Part2 = array($TopicID=>$Thread); //Bumped thread //if we're bumping from an older page @@ -136,20 +135,18 @@ //Never know if we get a page full of stickies... if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) { //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'"); - list($AuthorID,$IsLocked,$IsSticky,$NumPosts,$AuthorName,$NoPoll) = $DB->next_record(); + $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,$NoPoll) = $DB->next_record(); $Part2 = array($TopicID => array( 'ID' => $TopicID, 'Title' => $ThreadInfo['Title'], 'AuthorID' => $AuthorID, - 'AuthorUsername' => $AuthorName, 'IsLocked' => $IsLocked, 'IsSticky' => $IsSticky, 'NumPosts' => $NumPosts, 'LastPostID' => $PostID, 'LastPostTime' => sqltime(), 'LastPostAuthorID' => $LoggedUser['ID'], - 'LastPostUsername' => $LoggedUser['Username'], 'NoPoll' => $NoPoll )); //Bumped } else { @@ -178,7 +175,6 @@ 'NumPosts'=>'+1', 'LastPostID'=>$PostID, 'LastPostAuthorID'=>$LoggedUser['ID'], - 'Username'=>$LoggedUser['Username'], 'LastPostTopicID'=>$TopicID, 'LastPostTime'=>sqltime(), 'Title'=>$ThreadInfo['Title'], diff --git a/sections/forums/thread.php b/sections/forums/thread.php index cd41aef2..81ca57d2 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -366,20 +366,12 @@ foreach($Thread as $Key => $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)); - - // 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&i='.urlencode($Matches[2]).$Matches[3]; - }, $UserTitle); - } ?> @@ -456,8 +448,7 @@ - + diff --git a/sections/user/edit.php b/sections/user/edit.php index 96377f18..f4a7dd00 100644 --- a/sections/user/edit.php +++ b/sections/user/edit.php @@ -65,7 +65,7 @@ function checked($Checked) { echo $Val->GenerateJS('userform'); ?>
    -

    > Settings

    +

    > Settings

    diff --git a/sections/user/invite.php b/sections/user/invite.php index 7eed09d0..c7c7865d 100644 --- a/sections/user/invite.php +++ b/sections/user/invite.php @@ -74,11 +74,6 @@ $DB->query("SELECT ID, - Username, - Donor, - Warned, - Enabled, - PermissionID, Email, Uploaded, Downloaded, @@ -94,7 +89,7 @@ show_header('Invites'); ?>
    -

    > Invites

    +

    > Invites

    @@ -198,11 +193,11 @@
    - + diff --git a/sections/user/invitetree.php b/sections/user/invitetree.php index 0c583bb1..fffc0773 100644 --- a/sections/user/invitetree.php +++ b/sections/user/invitetree.php @@ -1,31 +1,31 @@ -get_value('stats_user_count')){ - $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'"); - list($UserCount) = $DB->next_record(); - $Cache->cache_value('stats_user_count', $UserCount, 0); - } - - $UserID = $LoggedUser['ID']; - $Sneaky = false; -} - -list($UserID, $Username, $PermissionID) = array_values(user_info($UserID)); - -include(SERVER_ROOT.'/classes/class_invite_tree.php'); -$Tree = new INVITE_TREE($UserID); - -show_header($Username.' > Invites > Tree'); -?> -
    -

    > Invites > Tree

    -
    -make_tree(); ?> -
    -
    +get_value('stats_user_count')){ + $DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'"); + list($UserCount) = $DB->next_record(); + $Cache->cache_value('stats_user_count', $UserCount, 0); + } + + $UserID = $LoggedUser['ID']; + $Sneaky = false; +} + +list($UserID, $Username, $PermissionID) = array_values(user_info($UserID)); + +include(SERVER_ROOT.'/classes/class_invite_tree.php'); +$Tree = new INVITE_TREE($UserID); + +show_header($Username.' > Invites > Tree'); +?> +
    +

    > Invites > Tree

    +
    +make_tree(); ?> +
    +
    \ No newline at end of file diff --git a/sections/user/linkedfunctions.php b/sections/user/linkedfunctions.php index c443bee5..48962d0f 100644 --- a/sections/user/linkedfunctions.php +++ b/sections/user/linkedfunctions.php @@ -177,7 +177,7 @@ function user_dupes_table($UserID) { list($DupeID) = $Dupe; $DupeInfo = user_info($DupeID); ?> - _&user=&auth=&passkey=&authkey=&name=">RSS feed(Delete) + (Show) -
    # - - + - [Quote] @@ -429,7 +421,7 @@ « Last edited by - +
    #XXXXXX - by - Just now + by Just now [Report Post] diff --git a/sections/friends/friends.php b/sections/friends/friends.php index 27b55430..047ff3b6 100644 --- a/sections/friends/friends.php +++ b/sections/friends/friends.php @@ -29,11 +29,7 @@ m.Uploaded, m.Downloaded, m.PermissionID, - m.Enabled, m.Paranoia, - i.Donor, - i.Warned, - m.Title, m.LastAccess, i.Avatar FROM friends AS f @@ -65,14 +61,14 @@ } // Start printing out friends 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; ?>
    next_record()) { + while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $SenderID, $Date) = $DB->next_record()) { if($Unread === '1') { $RowClass = 'unreadpm'; } else { @@ -148,10 +141,10 @@ ';} ?> - + - + diff --git a/sections/index/private.php b/sections/index/private.php index 7bb5d287..9718bcb2 100644 --- a/sections/index/private.php +++ b/sections/index/private.php @@ -30,11 +30,11 @@ - + @@ -506,7 +506,7 @@ function contest() { foreach ($Contest as $User) { list($UserID, $Points, $Username) = $User; ?> -
  • ()
  • +
  • ()
  • diff --git a/sections/reports/report.php b/sections/reports/report.php index a66b4d0f..99044320 100644 --- a/sections/reports/report.php +++ b/sections/reports/report.php @@ -60,7 +60,7 @@ $DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID); list($MinClassRead) = $DB->next_record(); 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)) { error(403); } @@ -77,7 +77,7 @@ $DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID); list($MinClassRead) = $DB->next_record(); 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)) { error(403); } diff --git a/sections/requests/request.php b/sections/requests/request.php index 30c400a7..226ebf42 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -254,7 +254,7 @@ Filled @@ -523,8 +523,7 @@ - + diff --git a/sections/tools/data/donation_log.php b/sections/tools/data/donation_log.php index fbb7d876..7a6a2c9b 100644 --- a/sections/tools/data/donation_log.php +++ b/sections/tools/data/donation_log.php @@ -13,15 +13,8 @@ d.Amount, d.Currency, d.Email, - m.Username, - m.PermissionID, - m.Enabled, - i.Donor, - i.Warned, d.Time - 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 "; + FROM donations AS d "; if(!empty($_GET['search'])) { $sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' "; } @@ -89,10 +82,10 @@ - + diff --git a/sections/tools/data/invite_pool.php b/sections/tools/data/invite_pool.php index 5e170718..8bdab7f6 100644 --- a/sections/tools/data/invite_pool.php +++ b/sections/tools/data/invite_pool.php @@ -19,17 +19,11 @@ $sql = "SELECT SQL_CALC_FOUND_ROWS um.ID, - um.Username, - um.PermissionID, - um.Enabled, - ui.Donor, - ui.Warned, i.InviteKey, i.Expires, i.Email FROM invites as i - JOIN users_main AS um ON um.ID=i.InviterID - JOIN users_info AS ui ON ui.UserID=um.ID "; + JOIN users_main AS um ON um.ID=i.InviterID "; if($Search) { $sql .= "WHERE i.Email LIKE '%$Search%' "; } @@ -78,11 +72,11 @@ next_record()) { + while(list($UserID, $InviteKey, $Expires, $Email)=$DB->next_record()) { $Row = ($Row == 'b') ? 'a' : 'b'; ?> - + diff --git a/sections/tools/data/registration_log.php b/sections/tools/data/registration_log.php index 79c5c378..3637a4c6 100644 --- a/sections/tools/data/registration_log.php +++ b/sections/tools/data/registration_log.php @@ -63,7 +63,7 @@ $Row = ($IP == $InviterIP) ? 'a' : 'b'; ?> - + next_record()) { + while(list($UserID)=$DB->next_record()) { ?> - + diff --git a/sections/tools/data/upscale_pool.php b/sections/tools/data/upscale_pool.php index f23a0b4d..eca477fc 100644 --- a/sections/tools/data/upscale_pool.php +++ b/sections/tools/data/upscale_pool.php @@ -59,7 +59,7 @@ ?> - + diff --git a/sections/tools/index.php b/sections/tools/index.php index e427180a..a1a0d102 100644 --- a/sections/tools/index.php +++ b/sections/tools/index.php @@ -167,20 +167,15 @@ $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.'); - $Values=array(); 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"); - list($ID,$Name,$Level,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(3)); + $DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,p.PermittedForums,p.Values,p.DisplayStaff,COUNT(u.ID) FROM permissions AS p LEFT JOIN users_main AS u ON u.PermissionID=p.ID WHERE p.ID='".db_string($_REQUEST['id'])."' GROUP BY p.ID"); + list($ID,$Name,$Level,$Secondary,$Forums,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(5)); - if($Level > $LoggedUser['Class'] || $_REQUEST['level'] > $LoggedUser['Class']) { + if($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) { error(403); } - - - $Values=unserialize($Values); - } - - + $Values = unserialize($Values); + } if (!empty($_POST['submit'])) { $Err = $Val->ValidateForm($_POST); @@ -201,15 +196,35 @@ $Name=$_REQUEST['name']; $Level=$_REQUEST['level']; + $Secondary=empty($_REQUEST['secondary'])?0:1; + $Forums = $_REQUEST['forums']; $DisplayStaff=$_REQUEST['displaystaff']; $Values['MaxCollages']=$_REQUEST['maxcollages']; if (!$Err) { 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 { - $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']); + 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'); } else { @@ -222,6 +237,17 @@ } else { if (!empty($_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'])."'"); $Cache->delete_value('classes'); diff --git a/sections/tools/managers/dnu_list.php b/sections/tools/managers/dnu_list.php index 575d6fdd..7367f1ad 100644 --- a/sections/tools/managers/dnu_list.php +++ b/sections/tools/managers/dnu_list.php @@ -7,7 +7,6 @@ d.Name, d.Comment, d.UserID, - um.Username, d.Time FROM do_not_upload as d LEFT JOIN users_main AS um ON um.ID=d.UserID @@ -21,7 +20,7 @@ -next_record()){ ?> +next_record()){ ?> -next_record()) { ?> +next_record()) { ?> next_record()){ +while(list($ID, $IP, $UserID, $LastAttempt, $Attempts, $BannedUntil, $Bans) = $DB->next_record()){ $Row = ($Row === 'a' ? 'b' : 'a'); ?> @@ -49,7 +42,7 @@ + + + + @@ -36,6 +40,10 @@ function display_perm($Key,$Title) { + + + + diff --git a/sections/tools/managers/permissions_list.php b/sections/tools/managers/permissions_list.php index 45081a62..73522386 100644 --- a/sections/tools/managers/permissions_list.php +++ b/sections/tools/managers/permissions_list.php @@ -17,7 +17,11 @@ function confirmDelete(id) { [Back to Tools] 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()) { ?>
    - +  Ratio: diff --git a/sections/inbox/conversation.php b/sections/inbox/conversation.php index 06c116f8..659002a0 100644 --- a/sections/inbox/conversation.php +++ b/sections/inbox/conversation.php @@ -27,23 +27,20 @@ c.Subject, cu.Sticky, cu.UnRead, - cu.ForwardedTo, - um.Username + cu.ForwardedTo FROM pm_conversations AS c 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'"); -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 - JOIN users_info AS ui ON ui.UserID=pm.SenderID JOIN users_main AS um ON um.ID=pm.SenderID 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; - $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[0]['UserStr'] = 'System'; // in case it's a message from the system diff --git a/sections/inbox/inbox.php b/sections/inbox/inbox.php index ee7e42bb..91647634 100644 --- a/sections/inbox/inbox.php +++ b/sections/inbox/inbox.php @@ -38,20 +38,13 @@ cu.Unread, cu.Sticky, cu.ForwardedTo, - um2.Username AS ForwardedName, - cu2.UserID, - um.Username, - ui.Donor, - ui.Warned, - um.Enabled,"; + cu2.UserID,"; $sql .= ($Section == 'sentbox')? ' cu.SentDate ' : ' cu.ReceivedDate '; $sql .= "AS Date 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 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_info AS ui ON ui.UserID=um.ID - LEFT JOIN users_main AS um2 ON um2.ID=cu.ForwardedTo"; + LEFT JOIN users_main AS um ON um.ID=cu2.UserID"; if(!empty($_GET['search']) && $_GET['searchtype'] == "message") { $sql .= " JOIN pm_messages AS m ON c.ID=m.ConvID"; @@ -130,7 +123,7 @@
    - (by ) + (by )
    Created - by + by
    Yes, - by user + by user (Unfill) Unfilling a request without a valid, nontrivial reason will result in a warning. @@ -470,7 +470,7 @@
    # - by [Report Comment] + by [Report Comment] - [Quote] - [Edit] - [Delete] @@ -504,7 +504,7 @@ « Last edited by - +
    #XXXXXX - by - Just now + by Just now [Report Comment] diff --git a/sections/staff/index.php b/sections/staff/index.php index 44c062f0..07214178 100644 --- a/sections/staff/index.php +++ b/sections/staff/index.php @@ -36,7 +36,7 @@ ?>
    - + @@ -66,7 +66,7 @@ ?>
    - + @@ -109,7 +109,7 @@ ?>
    - + diff --git a/sections/staffpm/assign.php b/sections/staffpm/assign.php index c3322e42..1e022e5b 100644 --- a/sections/staffpm/assign.php +++ b/sections/staffpm/assign.php @@ -40,7 +40,7 @@ $DB->query("SELECT Level, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID"); 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 list($LevelType, $NewLevel) = explode("_", db_string($_POST['assign'])); diff --git a/sections/staffpm/staff_inbox.php b/sections/staffpm/staff_inbox.php index ab932adc..1cb4f31f 100644 --- a/sections/staffpm/staff_inbox.php +++ b/sections/staffpm/staff_inbox.php @@ -3,7 +3,7 @@ show_header('Staff Inbox'); $View = display_str($_GET['view']); -$UserLevel = $LoggedUser['Class']; +$UserLevel = $LoggedUser['EffectiveClass']; // Setup for current view mode $SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, "; @@ -133,8 +133,8 @@ $Row = ($Row === 'a') ? 'b' : 'a'; $RowClass = 'row'.$Row; - $UserInfo = user_info($UserID); - $UserStr = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); + //$UserInfo = user_info($UserID); + $UserStr = format_username($UserID, true, true, true, true); // Get assigned if ($AssignedToUser == '') { @@ -145,15 +145,15 @@ } else { // Assigned to user - $UserInfo = user_info($AssignedToUser); - $Assigned = format_username($AssignedToUser, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); + // $UserInfo = user_info($AssignedToUser); + $Assigned = format_username($AssignedToUser, true, true, true, true); } // Get resolver if ($ViewString == 'Resolved') { - $UserInfo = user_info($ResolverID); - $ResolverStr = format_username($ResolverID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); + //$UserInfo = user_info($ResolverID); + $ResolverStr = format_username($ResolverID, true, true, true, true); } // Table row diff --git a/sections/staffpm/unresolve.php b/sections/staffpm/unresolve.php index 040e6e6b..d91412a6 100644 --- a/sections/staffpm/unresolve.php +++ b/sections/staffpm/unresolve.php @@ -5,7 +5,7 @@ list($UserID, $Level, $AssignedToUser) = $DB->next_record(); 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) { error(403); }*/ diff --git a/sections/staffpm/viewconv.php b/sections/staffpm/viewconv.php index 5c5a8501..48548f78 100644 --- a/sections/staffpm/viewconv.php +++ b/sections/staffpm/viewconv.php @@ -9,7 +9,7 @@ $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(); - 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 error(403); } @@ -22,8 +22,8 @@ show_header('Staff PM', 'staffpm,bbcode'); - $UserInfo = user_info($UserID); - $UserStr = format_username($UserID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); + //$UserInfo = user_info($UserID); + $UserStr = format_username($UserID, true, true, true, true); $OwnerID = $UserID; $OwnerName = $UserInfo['Username']; @@ -72,7 +72,7 @@ } else { // Staff/FLS $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']; } ?> diff --git a/sections/tools/data/bitcoin_balance.php b/sections/tools/data/bitcoin_balance.php index 92287e8e..a8fb06db 100644 --- a/sections/tools/data/bitcoin_balance.php +++ b/sections/tools/data/bitcoin_balance.php @@ -7,7 +7,7 @@ $Balance = btc_balance() . " BTC"; $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"); ?>

    @@ -28,7 +28,7 @@ if ($amount === false) { continue; } ?>



    diff --git a/sections/tools/data/special_users.php b/sections/tools/data/special_users.php index 2a75b956..d6d1e9ff 100644 --- a/sections/tools/data/special_users.php +++ b/sections/tools/data/special_users.php @@ -4,15 +4,7 @@ ?>
    query("SELECT - 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 +$DB->query("SELECT m.ID FROM users_main AS m WHERE m.CustomPermissions != '' AND m.CustomPermissions != 'a:0:{}'"); if($DB->record_count()) { @@ -23,10 +15,10 @@
    Access
    Manage
    Added Submit
    @@ -34,7 +33,7 @@ -
    +
    diff --git a/sections/tools/managers/eb.php b/sections/tools/managers/eb.php index d826dd17..661ca9b5 100644 --- a/sections/tools/managers/eb.php +++ b/sections/tools/managers/eb.php @@ -8,9 +8,7 @@ eb.Time, eb.Email, eb.Comment, - um.Username FROM email_blacklist AS eb - LEFT JOIN users_main AS um ON um.ID=eb.UserID ORDER BY eb.Time DESC"); ?>

    Email Blacklist

    @@ -21,7 +19,7 @@
    Added Submit
    @@ -34,7 +32,7 @@ -
    +
    diff --git a/sections/tools/managers/forum_list.php b/sections/tools/managers/forum_list.php index 58f69982..40885ef7 100644 --- a/sections/tools/managers/forum_list.php +++ b/sections/tools/managers/forum_list.php @@ -3,6 +3,8 @@ function class_list($Selected=0){ global $Classes; $Return = ''; foreach ($Classes as $ID => $Class) { + if ($Class['Secondary']) { continue; } + $Name = $Class['Name']; $Level = $Class['Level']; $Return.='
    - + diff --git a/sections/tools/managers/permissions_alter.php b/sections/tools/managers/permissions_alter.php index 64d6cd79..7666d64f 100644 --- a/sections/tools/managers/permissions_alter.php +++ b/sections/tools/managers/permissions_alter.php @@ -28,6 +28,10 @@ function display_perm($Key,$Title) { Class Level
    Secondary Classchecked />
    Show on Staff page checked />Maximum number of personal collages
    Additional Forums
    Current users in this class
    @@ -27,10 +31,10 @@ function confirmDelete(id) { -next_record()) { ?> +next_record()) { ?> - + diff --git a/sections/tools/managers/recommend_list.php b/sections/tools/managers/recommend_list.php index 23e2b2f9..c57881e2 100644 --- a/sections/tools/managers/recommend_list.php +++ b/sections/tools/managers/recommend_list.php @@ -7,14 +7,12 @@ $DB->query("SELECT tr.GroupID, tr.UserID, - u.Username, tg.Name, tg.ArtistID, ag.Name FROM torrents_recommended AS tr JOIN torrents_group AS tg ON tg.ID=tr.GroupID 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 LIMIT 10 "); @@ -42,10 +40,10 @@
      next_record()) { + while(list($GroupID, $UserID, $GroupName, $ArtistID, $ArtistName)=$DB->next_record()) { ?>
    • - + - diff --git a/sections/tools/misc/dupe_ip.php b/sections/tools/misc/dupe_ip.php index 0e88a567..574fdcb8 100644 --- a/sections/tools/misc/dupe_ip.php +++ b/sections/tools/misc/dupe_ip.php @@ -47,7 +47,7 @@ $Row = ($Row == 'b') ? 'a' : 'b'; ?>
    - + diff --git a/sections/top10/index.php b/sections/top10/index.php index 8535f152..2a8ec4c8 100644 --- a/sections/top10/index.php +++ b/sections/top10/index.php @@ -1,7 +1,7 @@
    diff --git a/sections/top10/users.php b/sections/top10/users.php index dba58e4c..023f23bd 100644 --- a/sections/top10/users.php +++ b/sections/top10/users.php @@ -28,7 +28,6 @@ $BaseQuery = "SELECT u.ID, - u.Username, ui.JoinDate, u.Uploaded, u.Downloaded, @@ -151,7 +150,7 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) { ?>
    - + diff --git a/sections/torrents/details.php b/sections/torrents/details.php index f8d10cd5..eddab764 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -4,7 +4,7 @@ function compare($X, $Y){ 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.'/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.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 list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear, $RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, $Scene, $HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $TorrentTime, $Description, - $FileList, $FilePath, $UserID, $Username, $LastActive, + $FileList, $FilePath, $UserID, $LastActive, $BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LastReseedRequest, $LogInDB, $HasFile) = $Torrent; if($Remastered && !$RemasterYear) { @@ -544,7 +544,7 @@ function filelist($Str) { @@ -829,8 +829,7 @@ function filelist($Str) { + + query("SELECT SQL_CALC_FOUND_ROWS - xu.uid, - t.Size, - um.Username, - xu.active, - xu.connectable, - xu.uploaded, - xu.remaining, - xu.useragent - FROM xbt_files_users AS xu - LEFT JOIN users_main AS um ON um.ID=xu.uid - JOIN torrents AS t ON t.ID=xu.fid - WHERE xu.fid='$TorrentID' - AND um.Visible='1' - ORDER BY xu.uploaded DESC - LIMIT $Limit"); -$DB->query("SELECT FOUND_ROWS()"); -list($NumResults) = $DB->next_record(); -$DB->set_query_id($Result); - -?> -

    Peerlist

    -100) { ?> - - - -
    User Count Actions
    [Edit | Remove]
    [H|S]
    /s
    - Uploaded by + Uploaded by = 1209600) { ?> @@ -664,7 +664,7 @@ function filelist($Str) { $PersonalCollages = $Cache->get_value('torrent_collages_personal_'.$GroupID); 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'"); - $PersonalCollages = $DB->to_array(false, MYSQLI_NUM); + $PersonalCollages = $DB->to_array(false, MYSQL_NUM); $Cache->cache_value('torrent_collages_personal_'.$GroupID, $PersonalCollages, 3600*6); } @@ -776,7 +776,7 @@ function filelist($Str) {
    # - [Report] + [Report] - [Quote] - [Edit] - [Delete] @@ -810,7 +810,7 @@ function filelist($Str) { « Last edited by - +
    #XXXXXX - by - Just now + by Just now [Report Comment] diff --git a/sections/torrents/downloadlist.php b/sections/torrents/downloadlist.php index e811bef0..8999f483 100644 --- a/sections/torrents/downloadlist.php +++ b/sections/torrents/downloadlist.php @@ -1,84 +1,83 @@ -query("SELECT SQL_CALC_FOUND_ROWS - ud.UserID, - ud.Time - FROM users_downloads AS ud - WHERE ud.TorrentID='$TorrentID' - ORDER BY ud.Time DESC - LIMIT $Limit"); -$UserIDs = $DB->collect('UserID'); -$Results = $DB->to_array('UserID', MYSQLI_ASSOC); - -$DB->query("SELECT FOUND_ROWS()"); -list($NumResults) = $DB->next_record(); - -if(count($UserIDs)>0) { - $UserIDs = implode(',',$UserIDs); - $DB->query("SELECT uid FROM xbt_snatched WHERE fid='$TorrentID' AND uid IN($UserIDs)"); - $Snatched = $DB->to_array('uid'); - - $DB->query("SELECT uid FROM xbt_files_users WHERE fid='$TorrentID' AND Remaining=0 AND uid IN($UserIDs)"); - $Seeding = $DB->to_array('uid'); -} - - -?> -

    Downloadlist

    -100) { ?> - - - - - - - - - - - -$Data) { - list($SnatcherID, $Timestamp) = array_values($Data); - $UserInfo = user_info($SnatcherID); - - $User = format_username($SnatcherID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); - - if(!array_key_exists($SnatcherID, $Snatched) && $SnatcherID!=$UserID) { - $User = ''.$User.''; - if(array_key_exists($SnatcherID, $Seeding)) { - $User = ''.$User.''; - } - } - if($i % 2 == 0 && $i>0){ ?> - - - - - - - -
    UserTimeUserTime
    -100) { ?> - +query("SELECT SQL_CALC_FOUND_ROWS + ud.UserID, + ud.Time + FROM users_downloads AS ud + WHERE ud.TorrentID='$TorrentID' + ORDER BY ud.Time DESC + LIMIT $Limit"); +$UserIDs = $DB->collect('UserID'); +$Results = $DB->to_array('UserID', MYSQLI_ASSOC); + +$DB->query("SELECT FOUND_ROWS()"); +list($NumResults) = $DB->next_record(); + +if(count($UserIDs)>0) { + $UserIDs = implode(',',$UserIDs); + $DB->query("SELECT uid FROM xbt_snatched WHERE fid='$TorrentID' AND uid IN($UserIDs)"); + $Snatched = $DB->to_array('uid'); + + $DB->query("SELECT uid FROM xbt_files_users WHERE fid='$TorrentID' AND Remaining=0 AND uid IN($UserIDs)"); + $Seeding = $DB->to_array('uid'); +} + + +?> +

    Downloadlist

    +100) { ?> + + + + + + + + + + + +$Data) { + list($SnatcherID, $Timestamp) = array_values($Data); + + $User = format_username($SnatcherID, true, true, true, true); + + if(!array_key_exists($SnatcherID, $Snatched) && $SnatcherID!=$UserID) { + $User = ''.$User.''; + if(array_key_exists($SnatcherID, $Seeding)) { + $User = ''.$User.''; + } + } + if($i % 2 == 0 && $i>0){ ?> + + + + + + + +
    UserTimeUserTime
    +100) { ?> + \ No newline at end of file diff --git a/sections/torrents/functions.php b/sections/torrents/functions.php index 2212fcce..28cb1618 100644 --- a/sections/torrents/functions.php +++ b/sections/torrents/functions.php @@ -82,7 +82,6 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) { t.FileList, t.FilePath, t.UserID, - um.Username, t.last_action, tbt.TorrentID, tbf.TorrentID, @@ -93,7 +92,6 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) { tln.TorrentID AS LogInDB, t.ID AS HasFile 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_folders AS tbf on tbf.TorrentID=t.ID LEFT JOIN torrents_bad_files AS tfi on tfi.TorrentID=t.ID diff --git a/sections/torrents/grouplog.php b/sections/torrents/grouplog.php index bb0721dc..cb91041b 100644 --- a/sections/torrents/grouplog.php +++ b/sections/torrents/grouplog.php @@ -42,13 +42,8 @@
    -query("SELECT Username FROM users_main WHERE ID = ".$UserID); - list($Username) = $DB->next_record(); - $DB->set_query_id($Log); -?> -
    - - - - - - - - - - -next_record()) { -?> - - - - - - - - - - - -
    UserActiveConnectableUp%Client
    Yes' : 'No' ?>Yes' : 'No' ?>
    -100) { ?> - - +query("SELECT SQL_CALC_FOUND_ROWS + xu.uid, + t.Size, + xu.active, + xu.connectable, + xu.uploaded, + xu.remaining, + xu.useragent + FROM xbt_files_users AS xu + LEFT JOIN users_main AS um ON um.ID=xu.uid + JOIN torrents AS t ON t.ID=xu.fid + WHERE xu.fid='$TorrentID' + AND um.Visible='1' + ORDER BY xu.uploaded DESC + LIMIT $Limit"); +$DB->query("SELECT FOUND_ROWS()"); +list($NumResults) = $DB->next_record(); +$DB->set_query_id($Result); + +?> +

    Peerlist

    +100) { ?> + + + + + + + + + + + + +next_record()) { +?> + + + + + + + + + +
    UserActiveConnectableUp%Client
    Yes' : 'No' ?>Yes' : 'No' ?>
    +100) { ?> + + diff --git a/sections/torrents/snatchlist.php b/sections/torrents/snatchlist.php index a9c7279c..6324806a 100644 --- a/sections/torrents/snatchlist.php +++ b/sections/torrents/snatchlist.php @@ -1,68 +1,64 @@ -query("SELECT SQL_CALC_FOUND_ROWS - xs.uid, - xs.tstamp - FROM xbt_snatched AS xs - WHERE xs.fid='$TorrentID' - ORDER BY xs.tstamp DESC - LIMIT $Limit"); -$Results = $DB->to_array('uid', MYSQLI_ASSOC); - -$DB->query("SELECT FOUND_ROWS()"); -list($NumResults) = $DB->next_record(); - -?> -

    Snatches

    - -100) { ?> - - - - - - - - - - - - -$Data) { - list($SnatcherID, $Timestamp) = array_values($Data); - - $UserInfo = user_info($SnatcherID); - - $User = format_username($SnatcherID, $UserInfo['Username'], $UserInfo['Donor'], $UserInfo['Warned'], $UserInfo['Enabled'], $UserInfo['PermissionID']); - - if($i % 2 == 0 && $i>0){ -?> - - - - - - - -
    UserTimeUserTime
    -100) { ?> - - +query("SELECT SQL_CALC_FOUND_ROWS + xs.uid, + xs.tstamp + FROM xbt_snatched AS xs + WHERE xs.fid='$TorrentID' + ORDER BY xs.tstamp DESC + LIMIT $Limit"); +$Results = $DB->to_array('uid', MYSQLI_ASSOC); + +$DB->query("SELECT FOUND_ROWS()"); +list($NumResults) = $DB->next_record(); + +?> +

    Snatches

    + +100) { ?> + + + + + + + + + + + + +$Data) { + list($SnatcherID, $Timestamp) = array_values($Data); + + if($i % 2 == 0 && $i>0) { +?> + + + + + + + +
    UserTimeUserTime
    +100) { ?> + + diff --git a/sections/user/advancedsearch.php b/sections/user/advancedsearch.php index d1e9111d..62dd2342 100644 --- a/sections/user/advancedsearch.php +++ b/sections/user/advancedsearch.php @@ -461,7 +461,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){
    @@ -697,7 +699,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = ''){ next_record()){ ?>
    + (x)
    +
    > $NumFilters){ ?> @@ -143,8 +144,10 @@ +

    - + -

    > Permissions

    +

    > Permissions

    diff --git a/sections/user/search.php b/sections/user/search.php index a47ea525..63d4af87 100644 --- a/sections/user/search.php +++ b/sections/user/search.php @@ -72,7 +72,7 @@ list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned) = $Result; ?>
    Artist:checked="checked" />
    Secondary Classes: 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++; +?> + checked="checked" />  +'; } + } ?> +
    @@ -105,7 +105,7 @@ list($Enabled)=$DB->next_record(); $DB->set_query_id($ueQuery); ?> -
      »   » 
    diff --git a/sections/wiki/aliases.php b/sections/wiki/aliases.php index 55bdee18..2a4dfc9b 100644 --- a/sections/wiki/aliases.php +++ b/sections/wiki/aliases.php @@ -4,7 +4,7 @@ $Latest = $Alias->article($ArticleID); 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"); ?> diff --git a/sections/wiki/article.php b/sections/wiki/article.php index 1c3458f3..ebfe8313 100644 --- a/sections/wiki/article.php +++ b/sections/wiki/article.php @@ -31,7 +31,7 @@ } $Article = $Alias->article($ArticleID); 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'); ?> @@ -82,7 +82,7 @@ Details: @@ -104,7 +104,7 @@ - +
    diff --git a/sections/wiki/compare.php b/sections/wiki/compare.php index 6251b6d2..6c582097 100644 --- a/sections/wiki/compare.php +++ b/sections/wiki/compare.php @@ -77,7 +77,7 @@ function get_body($ID, $Rev) { $Article = $Alias->article($ArticleID); 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'); $Diff2 = get_body($ArticleID, $_GET['new']); diff --git a/sections/wiki/edit.php b/sections/wiki/edit.php index d92a1bdf..b5982ae2 100644 --- a/sections/wiki/edit.php +++ b/sections/wiki/edit.php @@ -4,7 +4,7 @@ $Article = $Alias->article($ArticleID); 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.'); } diff --git a/sections/wiki/index.php b/sections/wiki/index.php index 9f148355..121cd7e4 100644 --- a/sections/wiki/index.php +++ b/sections/wiki/index.php @@ -13,7 +13,7 @@ function class_list($Selected=0){ global $Classes, $LoggedUser; $Return = ''; foreach ($Classes as $ID => $Class) { - if($Class['Level'] <= $LoggedUser['Class']){ + if($Class['Level'] <= $LoggedUser['EffectiveClass']){ $Return.='
    - + @@ -35,18 +35,16 @@ $DB->query("SELECT w.Revision, w.Title, - w.Author, - u.Username, + w.Author, w.Date FROM wiki_revisions AS w - LEFT JOIN users_main AS u ON u.ID=w.Author WHERE w.ID='$ArticleID' ORDER BY Revision DESC"); -while(list($Revision, $Title, $AuthorID, $AuthorName, $Date) = $DB->next_record()) { ?> +while(list($Revision, $Title, $AuthorID, $Date) = $DB->next_record()) { ?> - + diff --git a/sections/wiki/search.php b/sections/wiki/search.php index 5d685acb..f1d68bfd 100644 --- a/sections/wiki/search.php +++ b/sections/wiki/search.php @@ -36,11 +36,9 @@ w.ID, w.Title, w.Date, - w.Author, - u.Username + w.Author FROM wiki_articles AS w - LEFT JOIN users_main AS u ON u.ID=w.Author - WHERE w.MinClassRead <= '".$LoggedUser['Class']."'"; + WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'"; if($Search!='') { $SQL .= " AND $Type LIKE '%"; $SQL .= implode("%' AND $Type LIKE '%", $Words); @@ -115,11 +113,11 @@ -next_record()) {?> +next_record()) {?> - +
    Last Updated Last edited by
    diff --git a/sections/wiki/takecreate.php b/sections/wiki/takecreate.php index 26febc4d..72871e73 100644 --- a/sections/wiki/takecreate.php +++ b/sections/wiki/takecreate.php @@ -28,7 +28,7 @@ $Edit=$_POST['minclassedit']; if(!is_number($Read)) { error(0); } //int? 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. } else { $Read=100; diff --git a/sections/wiki/takeedit.php b/sections/wiki/takeedit.php index 8c2bbba1..680082aa 100644 --- a/sections/wiki/takeedit.php +++ b/sections/wiki/takeedit.php @@ -18,14 +18,14 @@ $Article = $Alias->article($ArticleID); 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')){ $Read=$_POST['minclassread']; $Edit=$_POST['minclassedit']; if(!is_number($Read)) { error(0); } //int? 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. } diff --git a/sections/wiki/wiki_browse.php b/sections/wiki/wiki_browse.php index c11e51ba..f71fecff 100644 --- a/sections/wiki/wiki_browse.php +++ b/sections/wiki/wiki_browse.php @@ -6,11 +6,9 @@ w.ID, w.Title, w.Date, - w.Author, - u.Username + w.Author FROM wiki_articles AS w - LEFT JOIN users_main AS u ON u.ID=w.Author - WHERE w.MinClassRead <= '".$LoggedUser['Class']."'"; + WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'"; if($Letter!=='1') { $sql .= " AND UPPER(LEFT(w.Title,1)) = '".db_string($Letter)."'"; } else { @@ -32,11 +30,11 @@ Last Updated Last edited by -next_record()) {?> +next_record()) {?> - + diff --git a/static/styles/global.css b/static/styles/global.css index ad4d04b7..5084c849 100644 --- a/static/styles/global.css +++ b/static/styles/global.css @@ -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.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; } \ No newline at end of file