Beispiel #1
0
 /**
  * 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&amp;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 .= '&nbsp;' . implode('&nbsp;', $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;
 }
Beispiel #2
0
    public static function render_donor_stats($UserID)
    {
        $OwnProfile = G::$LoggedUser['ID'] == $UserID;
        if (check_perms("users_mod") || $OwnProfile || Donations::is_visible($UserID)) {
            ?>
			<div class="box box_info box_userinfo_donor_stats">
				<div class="head colhead_dark">Donor Statistics</div>
				<ul class="stats nobullet">
<?php 
            if (Donations::is_donor($UserID)) {
                if (check_perms('users_mod') || $OwnProfile) {
                    ?>
					<li>
						Total donor points: <?php 
                    echo Donations::get_total_rank($UserID);
                    ?>
					</li>
<?php 
                }
                ?>
					<li>
						Current donor rank: <?php 
                echo self::render_rank(Donations::get_rank($UserID), Donations::get_special_rank($UserID), true);
                ?>
					</li>
					<li>
						Leaderboard position: <?php 
                echo Donations::get_leaderboard_position($UserID);
                ?>
					</li>
					<li>
						Last donated: <?php 
                echo time_diff(Donations::get_donation_time($UserID));
                ?>
					</li>
					<li>
						Rank expires: <?php 
                echo Donations::get_rank_expiration($UserID);
                ?>
					</li>
<?php 
            } else {
                ?>
					<li>
						This user hasn't donated.
					</li>
<?php 
            }
            ?>
				</ul>
			</div>
<?php 
        }
    }
Beispiel #3
0
        echo $NewDonations[$Address];
        ?>
 (<?php 
        echo "{$DonationEUR} EUR";
        ?>
)</td>
			<td><?php 
        echo $AllDonations[$Address];
        ?>
</td>
			<td><?php 
        echo (int) Donations::get_rank($UserID);
        ?>
</td>
			<td><?php 
        echo (int) Donations::get_special_rank($UserID);
        ?>
</td>
		</tr>
<?php 
    }
} else {
    ?>
		<tr>
			<td colspan="7">No unprocessed Bitcoin donations</td>
		</tr>
<?php 
}
?>
	</table>
</div>