-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.php
More file actions
69 lines (63 loc) · 1.95 KB
/
action.php
File metadata and controls
69 lines (63 loc) · 1.95 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
<?php
/**
* DokuWiki Plugin authcorebos (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Joe Bordes <joe@tsolucio.com>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) {
die();
}
class action_plugin_authcorebos extends DokuWiki_Action_Plugin
{
/**
* Registers a callback function for a given event
*
* @param Doku_Event_Handler $controller DokuWiki's event controller object
*
* @return void
*/
public function register(Doku_Event_Handler $controller)
{
global $conf;
if($conf['authtype'] != 'authcorebos') return;
$controller->register_hook('HTML_LOGINFORM_OUTPUT', 'BEFORE', $this, 'handle_html_loginform_output');
}
/**
* [Custom event handler which performs action]
*
* Called for event:
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
*
* @return void
*/
public function handle_html_loginform_output(Doku_Event $event, $param)
{
$cbinstalls = array();
$numinstalls = $this->getConf('corebosinstalls');
for ($i = 1; $i <= $numinstalls; $i++) {
$pad = str_pad($i, 2, '0', STR_PAD_LEFT);
$cbname = $this->getConf('corebosname'.$pad);
$cburl = $this->getConf('corebosurl'.$pad);
$cbpfix = $this->getConf('corebospfix'.$pad);
if (!empty($cbname) && !empty($cburl) && $cbname!='coreBOS Name') {
$cbinstalls[$cbpfix] = $cbname;
}
}
$event->data->insertElement(
1,
form_makeListboxField(
'cb',
$cbinstalls,
'',
$this->getLang('coreBOS'),
'login__corebos',
'block'
)
);
}
}