Пример #1
0
 public function getAvatar()
 {
     if ((int) $this->get('avatarType') == AVATAR_TYPE_GALLERY) {
         $gallery = new AvatarGallery();
         return $gallery->get($this->get('avatar'));
     } else {
         if ((int) $this->get('avatarType') == AVATAR_TYPE_UPLOAD) {
             return new Avatar(0, $this->get('avatar'), 0, AVATAR_TYPE_UPLOAD);
         }
     }
     return false;
 }
Пример #2
0
     //prepare the avatar
     if ((int) $userInfo['avatarType'] == AVATAR_TYPE_GALLERY) {
         $gallery = new AvatarGallery();
         $Avatar = $gallery->get((int) $userInfo['avatar']);
         unset($gallery);
     } else {
         if ((int) $userInfo['avatarType'] == AVATAR_TYPE_UPLOAD) {
             $Avatar = new Avatar(0, $userInfo['avatar'], 0, AVATAR_TYPE_UPLOAD);
         }
     }
 } else {
     $userRank = new UserRank(0);
     $arr['author_str'] = 'Unknown';
     $arr['author_rank'] = 'Unknown';
     $gallery = new AvatarGallery();
     $Avatar = $gallery->get(0);
     unset($gallery);
 }
 //format the time
 $arr['added'] = date('D M j, Y, h:i A', strtotime($arr['added']));
 //Is staff post
 $staffPost = $CORE->hasFlag((int) $arr['flags'], WCF_FLAGS_STAFF_POST);
 //Is deleted
 $deletedPost = (int) $arr['deleted_by'] > 0 ? true : false;
 //Resolve the deletion author
 if ($deletedPost) {
     $userInfo = WCF::getAuthorInfo($arr['deleted_by']);
     $arr['deleted_by_str'] = $userInfo['displayName'];
     unset($userInfo);
     $arr['deleted_time'] = date('D M j, Y, h:i A', strtotime($arr['deleted_time']));
 }
Пример #3
0
    $authRes = $AUTH_DB->prepare("SELECT * FROM `account` WHERE `id` = :acc LIMIT 1;");
    $authRes->bindParam(':acc', $account, PDO::PARAM_INT);
    $authRes->execute();
    //Fetch it
    $authRecord = $authRes->fetch();
    echo '
					<div class="column left">
						<h3>Web Record</h3>
						<table>';
    //Setup the rank
    $Rank = new UserRank($webRecord['rank']);
    //Setup the avatr
    //prepare the avatar
    if ((int) $webRecord['avatarType'] == AVATAR_TYPE_GALLERY) {
        $gallery = new AvatarGallery();
        $Avatar = $gallery->get((int) $webRecord['avatar']);
        unset($gallery);
    } else {
        if ((int) $webRecord['avatarType'] == AVATAR_TYPE_UPLOAD) {
            $Avatar = new Avatar(0, $webRecord['avatar'], 0, AVATAR_TYPE_UPLOAD);
        }
    }
    echo '
							<tr><td>ID</td><td>', $webRecord['id'], '</td></tr>
							<tr><td>Display Name</td><td>', $webRecord['displayName'], '</td></tr>
							<tr><td>Silver</td><td>', $webRecord['silver'], '</td></tr>
							<tr><td>Gold</td><td>', $webRecord['gold'], '</td>
							<tr><td>Birthday</td><td>', $webRecord['birthday'], '</td></tr>
							<tr><td>Gender</td><td>', $webRecord['gender'], '</td></tr>
							<tr><td>Country</td><td>', $webRecord['country'], '</td></tr>
							<tr><td style="vertical-align: top">Avatar</td><td><img src="', $Avatar->type() == AVATAR_TYPE_GALLERY ? $config['BaseURL'] . '/resources/avatars/' . $Avatar->string() : $Avatar->string(), '" /></td></tr>
Пример #4
0
if (!defined('init_ajax')) {
    header('HTTP/1.0 404 not found');
    exit;
}
if (!$CURUSER->isOnline()) {
    echo 'You must be logged in!';
    die;
}
$avatarId = isset($_GET['id']) ? (int) $_GET['id'] : false;
if ($avatarId === false) {
    echo 'You must select an avatar first.';
    die;
}
$storage = new AvatarGallery();
//validate the avatar
$newAvatar = $storage->get($avatarId);
if (!$newAvatar) {
    echo 'The selected avatar is invalid.';
    die;
}
unset($storage);
//Let's validate the ranking requirements
if ($newAvatar->rank() > $CURUSER->getRank()->int()) {
    echo 'The selected avatar requires greater user rank.';
    die;
}
$update = $DB->prepare("UPDATE `account_data` SET `avatar` = :avatar, `avatarType` = :type WHERE `id` = :account LIMIT 1;");
$update->bindParam(':account', $CURUSER->get('id'), PDO::PARAM_INT);
$update->bindParam(':avatar', $newAvatar->int(), PDO::PARAM_INT);
$update->bindParam(':type', $newAvatar->type(), PDO::PARAM_INT);
$update->execute();