aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/settings/avatar.php
blob: 31bd7050233ff41eedb3f603242a83b4db533e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class Settings_AvatarController extends AuthenticatedController
{
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);
        // Ensure user is logged in
        $GLOBALS['auth']->login_if($action !== 'logout' && $GLOBALS['auth']->auth['uid'] === 'nobody');

        if (!$GLOBALS['perm']->have_profile_perm('user', User::findCurrent()->id)) {
            throw new AccessDeniedException(_('Sie dürfen dieses Profil nicht bearbeiten'));
        }
    }
    public function index_action()
    {
        PageLayout::setTitle(_('Profilbild anpassen'));
        Navigation::activateItem('/profile/edit/avatar');
        $this->user_id = User::findCurrent()->id;
        $avatar = Avatar::getAvatar($this->user_id);
        $this->avatar_url = $avatar->getURL(Avatar::NORMAL);
    }
}