-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathadmin.php
More file actions
78 lines (68 loc) · 1.85 KB
/
admin.php
File metadata and controls
78 lines (68 loc) · 1.85 KB
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
72
73
74
75
76
77
78
<?php
/**
* Redirect plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
/**
* Class admin_plugin_redirect
*
* Provide editing mechanism for configuration
*/
class admin_plugin_redirect extends DokuWiki_Admin_Plugin {
/** @var helper_plugin_redirect */
protected $hlp;
/**
* admin_plugin_redirect constructor.
*/
public function __construct() {
$this->hlp = plugin_load('helper', 'redirect');
}
/**
* Access for managers allowed
*/
public function forAdminOnly() {
return false;
}
/**
* 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('redirdata')) {
if($this->hlp->saveConfigFile($INPUT->post->str('redirdata'))) {
msg($this->getLang('saved'), 1);
}
}
}
/**
* output appropriate html
*/
public function html() {
global $lang;
echo $this->locale_xhtml('intro');
echo '<form action="" method="post" >';
echo '<input type="hidden" name="do" value="admin" />';
echo '<input type="hidden" name="page" value="redirect" />';
echo '<textarea class="edit" rows="15" cols="80" style="height: 300px" name="redirdata">';
echo formtext($this->hlp->loadConfigFile());
echo '</textarea><br />';
echo '<input type="submit" value="' . $lang['btn_save'] . '" class="button" />';
echo '</form>';
}
}