{ return $Checked ? ' checked="checked"' : ''; } 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">
/** * Generate HTML for a user's avatar or just return the avatar URL * @param unknown $Avatar * @param unknown $UserID * @param unknown $Username * @param unknown $Setting * @param number $Size * @param string $ReturnHTML * @return string */ public static function show_avatar($Avatar, $UserID, $Username, $Setting, $Size = 150, $ReturnHTML = True) { $Avatar = ImageTools::process($Avatar, false, 'avatar', $UserID); $Style = 'style="max-height: 400px;"'; $AvatarMouseOverText = ''; $SecondAvatar = ''; $Class = 'class="double_avatar"'; $EnabledRewards = Donations::get_enabled_rewards($UserID); if ($EnabledRewards['HasAvatarMouseOverText']) { $Rewards = Donations::get_rewards($UserID); $AvatarMouseOverText = $Rewards['AvatarMouseOverText']; } if (!empty($AvatarMouseOverText)) { $AvatarMouseOverText = "title=\"{$AvatarMouseOverText}\" alt=\"{$AvatarMouseOverText}\""; } else { $AvatarMouseOverText = "alt=\"{$Username}'s avatar\""; } if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) { $SecondAvatar = ' data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar'], false, 'avatar2', $UserID) . '"'; } // case 1 is avatars disabled switch ($Setting) { case 0: if (!empty($Avatar)) { $ToReturn = $ReturnHTML ? "<div><img src=\"{$Avatar}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $Avatar; } else { $URL = STATIC_SERVER . 'common/avatars/default.png'; $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} /></div>" : $URL; } break; case 2: $ShowAvatar = true; // Fallthrough // Fallthrough case 3: switch (G::$LoggedUser['Identicons']) { case 0: $Type = 'identicon'; break; case 1: $Type = 'monsterid'; break; case 2: $Type = 'wavatar'; break; case 3: $Type = 'retro'; break; case 4: $Type = '1'; $Robot = true; break; case 5: $Type = '2'; $Robot = true; break; case 6: $Type = '3'; $Robot = true; break; default: $Type = 'identicon'; } $Rating = 'pg'; if (!$Robot) { $URL = 'https://secure.gravatar.com/avatar/' . md5(strtolower(trim($Username))) . "?s={$Size}&d={$Type}&r={$Rating}"; } else { $URL = 'https://robohash.org/' . md5($Username) . "?set=set{$Type}&size={$Size}x{$Size}"; } if ($ShowAvatar == true && !empty($Avatar)) { $ToReturn = $ReturnHTML ? "<div><img src=\"{$Avatar}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $Avatar; } else { $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $URL; } break; default: $URL = STATIC_SERVER . 'common/avatars/default.png'; $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class}/></div>" : $URL; } return $ToReturn; }