'Iain Hallam',
'email' => 'iain@iainhallam.com',
'date' => '2009-09-22',
'name' => 'SSO CAS Plugin',
'desc' => 'Authenticate DokuWiki users via CAS',
'url' => 'http://www.dokuwiki.org/plugin:ssocas',
);
}
function register (Doku_Event_Handler $controller) {
if ($this->getConf('server') != '') {
$controller->register_hook ('HTML_LOGINFORM_OUTPUT', 'BEFORE', $this, 'handle_login_form');
$controller->register_hook ('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_action');
$controller->register_hook ('TPL_ACT_UNKNOWN', 'BEFORE', $this, 'handle_template');
}
}
function _self () {
global $ID;
return wl($ID, '', true, '');
}
function _selfdo ($do) {
global $ID;
return wl($ID, 'do=' . $do, true, '&');
}
function _redirect ($url) {
header ('Location: ' . $url);
exit;
}
function handle_login_form (&$event, $param) {
global $auth;
global $conf;
global $lang;
global $ID;
// Remove the register and resendpwd links, if they exist.
for ($formPosition = 0; $formPosition < count($event->data->_content); $formPosition++) {
$formElement = $event->data->getElementAt($formPosition);
if ((! is_array($formElement)) and (substr($formElement, 0, 2) == '
data->replaceElement ($formPosition, NULL);
}
}
$insertElement = 5;
if($auth && $auth->canDo('addUser') && actionOK('register')){
$event->data->insertElement($insertElement,'
'.$lang['reghere'].': '.$lang['register'].'
');
$insertElement = 6;
}
if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) {
$event->data->insertElement($insertElement,''.$lang['pwdforget'].': '.$lang['btn_resendpwd'].'
');
}
if ($this->getConf('logourl') != '') {
$caslogo = ' ';
} else {
$caslogo = '';
}
$event->data->insertElement(0,'');
if ($this->getConf('jshidelocal')) {
$event->data->insertElement(3,'Show '.$this->getConf('localname').'
Only use this if you cannot use the '.$this->getConf('name').' above.
');
$event->data->replaceElement(4,'