From 0b8b67d74a51586c5a45012e9e0f7bbe54f7e954 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 17 Oct 2012 02:38:11 +0000 Subject: Elgg OpenID server adapted for Elgg 1.8. --- actions/admin.php | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 actions/admin.php (limited to 'actions/admin.php') diff --git a/actions/admin.php b/actions/admin.php new file mode 100755 index 000000000..a2dbb7af3 --- /dev/null +++ b/actions/admin.php @@ -0,0 +1,90 @@ + + * @copyright Curverider Ltd 2008-2009 + * @link http://elgg.com/ + * + * @uses the following values in $vars: + * + * 'trust' the trust object with the database information and action type + */ + +require_once('../openid_server_include.php'); + +if (isadminloggedin()) { + $action = trim(get_input('action')); + $trust_id = get_input('trust_id'); + $show_full_form = true; + $body = ''; + if ($action) { + $trust = new StdClass; + $trust->trust_root = get_input('trust_root'); + $trust->site_name = get_input('site_name'); + $trust->auto_login = get_input('auto_login'); + $trust->auto_logout = get_input('auto_logout'); + $trust->width = get_input('width'); + $trust->height = get_input('height'); + + switch($action) { + case 'change': + $trust->ident = $trust_id; + $store->update_default_trust_root($trust_id,$trust); + system_message(elgg_echo('openid_server:trust_root_updated')); + break; + case 'add': + $store->insert_default_trust_root($trust); + system_message(elgg_echo('openid_server:trust_root_added')); + break; + case 'delete': + $store->delete_default_trust_root($trust_id); + system_message(elgg_echo('openid_server:trust_root_deleted')); + break; + } + } else { + if ($trust_id) { + $trust = $store->get_trust_root($trust_id); + $trust->action = 'change'; + $body = generate_trust_form($trust); + $title = elgg_echo('openid_server:edit_trust_root_title'); + $show_full_form = false; + } + } + + if ($show_full_form) { + + // KJ - TODO: Move this into a separate form view + $edit_url = $CFG->wwwroot.'mod/openid_server/admin.php?trust_id='; + $delete_url = $CFG->wwwroot.'mod/openid_server/admin.php?action=delete&trust_id='; + $title = elgg_echo('openid_server:manage_trust_root_title'); + $results = $store->get_all_default_trust_roots(); + if ($results) { + $body .= '

'.elgg_echo('openid_server:trust_root_title').'

'."\n"; + $body.= ''."\n"; + foreach($results as $item) { + $body .= ''."\n"; + } + } + $body .= "
'.$item->site_name.''.$item->trust_root.''.elgg_echo('openid_server:edit_option').''.elgg_echo('openid_server:delete_option').'
\n"; + $body .= '

'.elgg_echo('openid_server:add_trust_root_title').'

'; + $trust = new StdClass; + $trust->trust_root = ''; + $trust->site_name = ''; + $trust->auto_login = ''; + $trust->auto_logout = ''; + $trust->width = 0; + $trust->height = 0; + $trust->action = 'add'; + $body .= generate_trust_form($trust); + } +} + +page_draw($title,$body); + +?> -- cgit v1.2.3