xref: /plugin/authskautis/action.php (revision 748d8f2c687462303bfb8bfa4201fd664ebed82a)
1<?php
2if (!defined('DOKU_INC')) die();
3
4define('SKAUTIS_LIBS_DIR', dirname(__FILE__).'/libs/');
5require_once SKAUTIS_LIBS_DIR. 'skautis-minify.php';
6
7
8class action_plugin_authskautis extends DokuWiki_Action_Plugin {
9
10    protected $url;
11    protected $testUrl;
12
13    /**
14     * Registers the event handlers.
15     */
16    function register(&$controller)
17    {
18        $controller->register_hook('HTML_LOGINFORM_OUTPUT', 'BEFORE',  $this, 'hook_html_loginform_output', array());
19        //$controller->register_hook('HTML_UPDATEPROFILEFORM_OUTPUT', 'BEFORE', $this, 'hook_updateprofileform_output', array());
20    }
21
22    /**
23     * Handles the login form rendering.
24     */
25    function hook_html_loginform_output(&$event, $param) {
26
27        $this->url = Skautis\Config::URL_PRODUCTION . '/Login/?appid=';
28        $this->testUrl = Skautis\Config::URL_TEST . '/Login/?appid=';
29
30        $skautisAppId = $this->getConf('skautis_app_id');
31        if($skautisAppId!=''){
32            $skautIsTestmode = $this->getConf('skautis_test_mode');
33            if ($skautIsTestmode){
34                $auth_url = $this->testUrl.$skautisAppId;
35            } else {
36                $auth_url = $this->url.$skautIsTestmode;
37            }
38
39
40            $a_style = "width: 200px;margin:0 auto;color: #666666;cursor: pointer;text-decoration: none !important;display: block;padding-bottom:1.4em;";//-moz-linear-gradient(center top , #F8F8F8, #ECECEC)
41            $div_style = "float:left;line-height: 30px;background-color: #F8F8F8;border: 1px solid #C6C6C6;border-radius: 2px 2px 2px 2px;padding: 0px 5px 0px 5px;position: relative;";
42            echo "<a href='$auth_url' style='$a_style' title='".$this->getLang('enter_skautis')."'><div style=\"$div_style\">".$this->getLang('enter_skautis')."</div>";
43            echo "<div style='clear: both;'></div></a>";
44        }
45    }
46}
47
48?>