register_hook('HTML_LOGINFORM_OUTPUT', 'AFTER', $this, 'handle_html_loginform_output'); $controller->register_hook('AUTH_LOGIN_CHECK', 'AFTER', $this, 'handle_login'); } public function handle_html_loginform_output(Doku_Event &$event, $param) { global $auth; if(!($auth instanceof auth_plugin_sfauth)) { return; } $this->displayLogin(); } /** * Displays the Salesforce Login Button * * Note: We always use the main instance to start the oauth workflow because it doesn't matter. Salesforce * will use the redirect URI configured in the instance of the user that logged in and that will contain the * correct instance number for all subsequent API calls. this way we only need one login button */ protected function displayLogin() { global $ID; echo '
'; if($this->getConf('consumer key')) { echo ''; echo $this->getLang('login'); echo ' '; } echo '
'; } /** * Redirect to the page that initially started the auth process * * @param Doku_Event $event * @param $param */ public function handle_login(Doku_Event &$event, $param) { if($_SERVER['REMOTE_USER'] && isset($_SESSION['sfauth_id'])) { $id = $_SESSION['sfauth_id']; unset($_SESSION['sfauth_id']); send_redirect(wl($id, '', true, '&')); } } } // vim:ts=4:sw=4:et: