* @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 */ global $CONFIG; $trust = $vars['trust']; if (!$trust->ident) { $trust->ident = 0; } $trust_root_msg = elgg_echo('openid_server:trust_root'); $trust_site_msg = elgg_echo('openid_server:trust_site'); $auto_login_msg = elgg_echo('openid_server:autologin_url'); $auto_logout_msg = elgg_echo('openid_server:autologout_url'); $iframe_width_msg = elgg_echo('openid_server:iframe_width'); $iframe_height_msg = elgg_echo('openid_server:iframe_height'); $explanation = elgg_echo('openid_server:admin_explanation'); if ($trust->action == 'change') { $button_msg = elgg_echo('openid_server:change_button'); } else { $button_msg = elgg_echo('openid_server:add_button'); } $form = <<< END $explanation






END; return $form; } if (logged_on && run("users:flags:get", array("admin", $_SESSION['userid']))) { $action = trim(optional_param('action')); $trust_id = optional_param('trust_id',0,PARAM_INT); $show_full_form = true; $body = ''; if ($action) { $trust = new StdClass; $trust->trust_root = optional_param('trust_root'); $trust->site_name = optional_param('site_name'); $trust->auto_login = optional_param('auto_login'); $trust->auto_logout = optional_param('auto_logout'); $trust->width = optional_param('width'); $trust->height = optional_param('height'); switch($action) { case 'change': $trust->ident = $trust_id; update_record('openid_server_trust',$trust); $messages[] = gettext("Trust root updated"); break; case 'add': insert_record('openid_server_trust',$trust,false); $messages[] = gettext("Trust root added"); break; case 'delete': delete_records('openid_server_trust','ident',$trust_id); $messages[] = gettext("Trust root deleted"); break; } } else { if ($trust_id) { $trust = get_record('openid_server_trust','ident',$trust_id); $trust->action = 'change'; $body = generate_trust_form($trust); $title = gettext("Edit trust record"); $show_full_form = false; } } if ($show_full_form) { $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 = gettext("Manage default trust roots"); $results = get_records_sql("SELECT ident, site_name, trust_root FROM {$CFG->prefix}openid_server_trust WHERE openid_url IS NULL OR openid_url = ''"); if ($results) { $body .= '

'.gettext("Default trust roots").'

'."\n"; $body.= ''."\n"; foreach($results as $item) { $body .= ''."\n"; } } $body .= "
'.$item->site_name.''.$item->trust_root.''.gettext("Edit").''.gettext("Delete").'
\n"; $body .= '

'.gettext("Add default trust root").'

'; $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); } } define("context", "admin"); templates_page_setup(); echo templates_page_draw( array( sitename, templates_draw(array( 'body' => $body, 'title' => $title, 'context' => 'contentholder' ) ) ) ); ?>