aboutsummaryrefslogtreecommitdiff
path: root/start.php
blob: 2c0be69f2d2398532647c1f0eab5a0fcfda84061 (plain)
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
69
70
71
72
73
<?php

/**
 * Elgg openid server plugin
 * 
 * @package ElggOpenID
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Kevin Jardine <kevin@radagast.biz>
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 */
 
 /*
 
 To do here:
 
 - put server link in profile page
 
*/
/*FIXME check if this extend is working or delete it*/
//extend_view('page_elements/header_contents', 'page_elements/openid_linkrel');

//set_include_path(get_include_path() . PATH_SEPARATOR . $CONFIG->path . 'mod/openid_server/');
global $CONFIG;
set_include_path($CONFIG->path . 'mod/openid_api/vendors/php-openid/' . PATH_SEPARATOR . $CONFIG->path . 'mod/openid_server/');

register_elgg_event_handler('init','system','openid_server_init',1);

function openid_server_init() {

	 global $CONFIG;
	elgg_register_event_handler('login','user','openid_server_handle_login');
	elgg_register_event_handler('logout','user','openid_server_handle_logout');
 
	 set_view_location("openid_server/forms/trust", $CONFIG->path.'mod/openid_server/views/');
    
	$base = elgg_get_plugins_path() . 'openid_server/actions';
	elgg_register_action('openid_server/trust', "$base/trust.php", 'public');

     //elgg_extend_view("metatags", "openid_server/metatags");
     elgg_extend_view("page/elements/head", "openid_server/metatags");
     elgg_extend_view("xrds/services", "openid_server/service");
}


function openid_server_handle_login($event, $object_type, $object) {
    global $CONFIG;
    
    require_once('openid_server_include.php');
    
    $store = getOpenIDServerStore();
    
    if ($store->getAutoLoginSites()) {    
        forward($CONFIG->wwwroot.'mod/openid_server/actions/autologin.php');
    }
    
    return true;
}

function openid_server_handle_logout($event, $object_type, $object) {
    global $CONFIG;
    
    /*$store = getOpenIDServerStore();
    
    if ($store->getAutoLogoutSites()) {    
        forward($CONFIG->wwwroot.'mod/openid_server/actions/autologout.php');
    }*/
    
    return true;
}

 
?>