1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionAbort;
6use dokuwiki\Action\Exception\ActionDisabledException;
7use dokuwiki\Extension\AuthPlugin;
8use dokuwiki\Ui;
9
10/**
11 * Class Profile
12 *
13 * Handle the profile form
14 *
15 * @package dokuwiki\Action
16 */
17class Profile extends AbstractUserAction
18{
19    /** @inheritdoc */
20    public function minimumPermission()
21    {
22        return AUTH_NONE;
23    }
24
25    /** @inheritdoc */
26    public function checkPreconditions()
27    {
28        parent::checkPreconditions();
29
30        /** @var AuthPlugin $auth */
31        global $auth;
32        if(!$auth->canDo('Profile')) throw new ActionDisabledException();
33    }
34
35    /** @inheritdoc */
36    public function preProcess()
37    {
38        global $lang;
39        if (updateprofile()) {
40            msg($lang['profchanged'], 1);
41            throw new ActionAbort('show');
42        }
43    }
44
45    /** @inheritdoc */
46    public function tplContent()
47    {
48        (new Ui\UserProfile)->show();
49    }
50
51}
52