forked from cosmocode/confmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.php
56 lines (48 loc) · 1.12 KB
/
remote.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
use dokuwiki\Remote\AccessDeniedException;
/**
* Class remote_plugin_confmanager
*/
class remote_plugin_confmanager extends DokuWiki_Remote_Plugin {
/**
* @var helper_plugin_confmanager
*/
private $helper;
/**
* Constructor
*/
public function __construct() {
parent::__construct();
$this->helper = $this->loadHelper('confmanager', null);
}
/**
* Get all available methods with remote access.
*
* @return array Information about all provided methods.
*/
public function _getMethods() {
return [
'getConfigs' => [
'args' => [],
'return' => 'array'
]
];
}
/**
* @return mixed
* @throws AccessDeniedException
*/
public function getConfigs() {
$this->ensureAdmin();
$this->helper->getConfigFiles();
return $this->getApi()->toDate(time());
}
/**
* @throws AccessDeniedException
*/
private function ensureAdmin() {
if (!auth_isadmin()) {
throw new AccessDeniedException();
}
}
}