} if ($SiteOptions) { $SiteOptions = unserialize($SiteOptions); } else { $SiteOptions = array(); } View::show_header("{$Username} > Settings", 'user,jquery-ui,release_sort,password_validate,validate,cssgallery,preview_paranoia,bbcode,user_settings,donor_titles'); $DonorRank = Donations::get_rank($UserID); $DonorIsVisible = Donations::is_visible($UserID); if ($DonorIsVisible === null) { $DonorIsVisible = true; } extract(Donations::get_enabled_rewards($UserID)); $Rewards = Donations::get_rewards($UserID); $ProfileRewards = Donations::get_profile_rewards($UserID); $DonorTitles = Donations::get_titles($UserID); $DB->query("\n\tSELECT username\n\tFROM lastfm_users\n\tWHERE ID = '{$UserID}'"); $LastFMUsername = ''; list($LastFMUsername) = $DB->next_record(); echo $Val->GenerateJS('userform'); ?> <div class="thin"> <div class="header"> <h2><?php echo Users::format_username($UserID, false, false, false); ?> > Settings</h2> </div> <form class="edit_form" name="user" id="userform" action="" method="post" autocomplete="off"> <div class="sidebar settings_sidebar"> <div class="box box2" id="settings_sections">
/** * Returns a username string for display * * @param int $UserID * @param boolean $Badges whether or not badges (donor, warned, enabled) should be shown * @param boolean $IsWarned -- TODO: Why the f**k do we need this? * @param boolean $IsEnabled -- TODO: Why the f**k do we need this? * @param boolean $Class whether or not to show the class * @param boolean $Title whether or not to show the title * @param boolean $IsDonorForum for displaying donor forum honorific prefixes and suffixes * @return HTML formatted username */ public static function format_username($UserID, $Badges = false, $IsWarned = true, $IsEnabled = true, $Class = false, $Title = false, $IsDonorForum = false) { global $Classes; // This array is a hack that should be made less retarded, but whatevs // PermID => ShortForm $SecondaryClasses = array(); if ($UserID == 0) { return 'System'; } $UserInfo = self::user_info($UserID); if ($UserInfo['Username'] == '') { return "Unknown [{$UserID}]"; } $Str = ''; $Username = $UserInfo['Username']; $Paranoia = $UserInfo['Paranoia']; if ($UserInfo['Class'] < $Classes[MOD]['Level']) { $OverrideParanoia = check_perms('users_override_paranoia', $UserInfo['Class']); } else { // Don't override paranoia for mods who don't want to show their donor heart $OverrideParanoia = false; } $ShowDonorIcon = !in_array('hide_donor_heart', $Paranoia) || $OverrideParanoia; if ($IsDonorForum) { list($Prefix, $Suffix, $HasComma) = Donations::get_titles($UserID); $Username = "******" . ($HasComma ? ', ' : ' ') . "{$Suffix} "; } if ($Title) { $Str .= "<strong><a href=\"user.php?id={$UserID}\">{$Username}</a></strong>"; } else { $Str .= "<a href=\"user.php?id={$UserID}\">{$Username}</a>"; } if ($Badges) { $DonorRank = Donations::get_rank($UserID); if ($DonorRank == 0 && $UserInfo['Donor'] == 1) { $DonorRank = 1; } if ($ShowDonorIcon && $DonorRank > 0) { $IconLink = 'donate.php'; $IconImage = 'donor.png'; $IconText = 'Donor'; $DonorHeart = $DonorRank; $SpecialRank = Donations::get_special_rank($UserID); $EnabledRewards = Donations::get_enabled_rewards($UserID); $DonorRewards = Donations::get_rewards($UserID); if ($EnabledRewards['HasDonorIconMouseOverText'] && !empty($DonorRewards['IconMouseOverText'])) { $IconText = display_str($DonorRewards['IconMouseOverText']); } if ($EnabledRewards['HasDonorIconLink'] && !empty($DonorRewards['CustomIconLink'])) { $IconLink = display_str($DonorRewards['CustomIconLink']); } if ($EnabledRewards['HasCustomDonorIcon'] && !empty($DonorRewards['CustomIcon'])) { $IconImage = ImageTools::process($DonorRewards['CustomIcon'], false, 'donoricon', $UserID); } else { if ($SpecialRank === MAX_SPECIAL_RANK) { $DonorHeart = 6; } elseif ($DonorRank === 5) { $DonorHeart = 4; // Two points between rank 4 and 5 } elseif ($DonorRank >= MAX_RANK) { $DonorHeart = 5; } if ($DonorHeart === 1) { $IconImage = STATIC_SERVER . 'common/symbols/donor.png'; } else { $IconImage = STATIC_SERVER . "common/symbols/donor_{$DonorHeart}.png"; } } $Str .= "<a target=\"_blank\" href=\"{$IconLink}\"><img class=\"donor_icon tooltip\" src=\"{$IconImage}\" alt=\"{$IconText}\" title=\"{$IconText}\" /></a>"; } } $Str .= $IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00' ? '<a href="wiki.php?action=article&id=218"' . '><img src="' . STATIC_SERVER . 'common/symbols/warned.png" alt="Warned" title="Warned' . (G::$LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d H:i', strtotime($UserInfo['Warned'])) : '') . '" class="tooltip" /></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" class="tooltip" /></a>' : ''; if ($Badges) { $ClassesDisplay = array(); foreach (array_intersect_key($SecondaryClasses, $UserInfo['ExtraClasses']) as $PermID => $PermShort) { $ClassesDisplay[] = '<span class="tooltip secondary_class" title="' . $Classes[$PermID]['Name'] . '">' . $PermShort . '</span>'; } if (!empty($ClassesDisplay)) { $Str .= ' ' . implode(' ', $ClassesDisplay); } } if ($Class) { if ($Title) { $Str .= ' <strong>(' . Users::make_class_string($UserInfo['PermissionID']) . ')</strong>'; } else { $Str .= ' (' . Users::make_class_string($UserInfo['PermissionID']) . ')'; } } if ($Title) { // Image proxy CTs if (check_perms('site_proxy_images') && !empty($UserInfo['Title'])) { $UserInfo['Title'] = preg_replace_callback('~src=("?)(http.+?)(["\\s>])~', function ($Matches) { return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; }, $UserInfo['Title']); } if ($UserInfo['Title']) { $Str .= ' <span class="user_title">(' . $UserInfo['Title'] . ')</span>'; } } return $Str; }