-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
71 lines (63 loc) · 1.58 KB
/
admin.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* QScript Tags plugin for DokuWiki
*
* @license MIT
* @author Eli Fenton
*/
/**
*
*/
class admin_plugin_qscripttags extends DokuWiki_Admin_Plugin {
/** @type helper_plugin_qscripttags */
protected $hlp;
public function __construct() {
/** @type helper_plugin_qscripttags $this ->hlp */
$this->hlp = plugin_load('helper', 'qscripttags');
}
/**
* return sort order for position in admin menu
*/
public function getMenuSort() {
return 140;
}
/**
* return prompt for admin menu
*/
public function getMenuText($language) {
return $this->getLang('name');
}
/**
* handle user request
*/
public function handle() {
global $INPUT;
if ($INPUT->post->has('aldata')) {
if (!$this->hlp->saveConfigFile($INPUT->post->str('aldata'))) {
msg('Failed to save data', 1);
}
else {
// Break the cache, so that all pages are regenerated.
touch(DOKU_CONF."local.php");
}
}
}
/**
* output appropriate html
*/
public function html() {
global $lang;
$config = $this->hlp->loadConfigFile();
$lines = preg_split('/\r?\n/', $config);
$allTt = true;
echo $this->locale_xhtml('admin_help');
echo '<form action="" method="post" >';
echo '<input type="hidden" name="do" value="admin" />';
echo '<input type="hidden" name="page" value="qscripttags" />';
echo '<textarea class="edit plugin-qscripttags__admintext" rows="15" cols="80" style="height: 500px" name="aldata">';
echo formtext($config);
echo '</textarea><br/><br/>';
echo '<input type="submit" value="' . $lang['btn_save'] . '" class="button" />';
echo '</form>';
}
}