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