1<?php 2/** 3 * Action Plugin: Redirect login, for use with external auth methods 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Christopher Smith <chris@jalakai.co.uk> 7 * @date 2006-12-12 8 * @date 2013-02-14 9 */ 10 11// must be run within Dokuwiki 12if(!defined('DOKU_INC')) die(); 13 14if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 15require_once(DOKU_PLUGIN.'action.php'); 16 17/** 18 * All DokuWiki action plugins need to inherit from this class 19 */ 20class action_plugin_loginredirect extends DokuWiki_Action_Plugin { 21 22 /* 23 * plugin should use this method to register its handlers with the dokuwiki's event controller 24 */ 25 function register(Doku_Event_Handler $controller) { 26 $controller->register_hook('ACTION_ACT_PREPROCESS','BEFORE', $this, 'handle_loginredirect'); 27 } 28 29 function handle_loginredirect(&$event, $param) { 30 global $ID; 31 32 if ($event->data == 'login') { 33 $url = $this->getConf('url'); 34 if (empty($url)) return; 35 36 $return_key = $this->getConf('return_key'); 37 $query_string = $return_key ? '?'.$return_key.'='.wl($ID) : ''; 38 39 header("Location: $url{$query_string}"); 40 exit(); 41 } 42 } 43 44} 45 46//Setup VIM: ex: et ts=4 enc=utf-8 : 47