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
74
75
76
77
78
79
80
81
82
83
|
<?php
/**
* Elgg powered plugin
*
* @package
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author lorea
* @copyright lorea
* @link http://lorea.cc
*/
function elgg_foafssl_createkey($modulus, $exponent, $user, $webid, $name) {
error_log("create foaf ssl key:".$modulus.":".$exponent);
$user_guid = $user->getGUID();
$key = new ElggObject();
$key->name = $name;
$key->title = $name;
$key->subtype = 'sslkey';
$key->owner_guid = $user_guid;
$key->container_guid = $user_guid;
$key->access_id = ACCESS_PUBLIC;
$key->save();
$key->webid = $webid;
$key->modulus = $modulus;
$key->exponent = $exponent;
return $key;
}
function foafssl_page_handler($page) {
global $CONFIG;
switch ($page[0]) {
case 'manage':
include($CONFIG->pluginspath.'foafssl/manage.php');
break;
case 'add':
include($CONFIG->pluginspath.'foafssl/add.php');
break;
case 'generate':
include($CONFIG->pluginspath.'foafssl/generate.php');
break;
case 'login':
include($CONFIG->pluginspath.'foafssl/authenticationlogin.php');
break;
}
}
function foafssl_pagesetup() {
global $CONFIG;
if (get_context() == 'settings') {
add_submenu_item(elgg_echo('foafssl:manage'), $CONFIG->wwwroot . "pg/foafssl/manage");
}
}
function foafssl_init(){
global $CONFIG;
register_action("foafssl/add",false, $CONFIG->pluginspath . "foafssl/actions/add.php");
register_action("foafssl/generate",false, $CONFIG->pluginspath . "foafssl/actions/generate.php");
register_action("foafssl/suck",false, $CONFIG->pluginspath . "foafssl/actions/suck.php");
register_action("foafssl/delete",false, $CONFIG->pluginspath . "foafssl/actions/delete.php");
register_action('entities/delete');
register_page_handler('foafssl','foafssl_page_handler');
register_elgg_event_handler('pagesetup','system','foafssl_pagesetup');
elgg_extend_view("account/forms/login", "foafssl/loginbox");
register_action("foafssl/register",true, $CONFIG->pluginspath . "foafssl/actions/register.php");
//elgg_extend_view("canvas/layouts/widgets", "foafssl/profile");
/*
register_action("microthemes/clear",false, $CONFIG->pluginspath . "microthemes/actions/microthemes/clear.php");
register_action("microthemes/edit",false, $CONFIG->pluginspath . "microthemes/actions/microthemes/edit.php");
register_action("microthemes/choose",false, $CONFIG->pluginspath . "microthemes/actions/microthemes/choose.php");
register_plugin_hook('entity:icon:url', 'object', 'microthemes_tasksicon_hook');
register_elgg_event_handler('pagesetup','system','microthemes_pagesetup');
elgg_extend_view("metatags", "microthemes/metatags");
//elgg_extend_view('profile/menu/linksownpage','microthemes/profilemenu');*/
}
register_elgg_event_handler('init','system','foafssl_init');
?>
|