From bc0ed096c45e6dd3b31859cb8adc577b6a548d39 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 5 Nov 2012 08:29:09 +0000 Subject: remove error logs and few fixes. --- lib/session.php | 2 -- openid_server_include.php | 8 +------- server.php | 27 ++++++++++----------------- start.php | 25 +++++++++---------------- views/default/forms/openid_server/trust.php | 2 +- views/default/openid_server/metatags.php | 7 ++++++- views/default/openid_server/metatags.php.old | 23 ----------------------- views/xrds/openid_server/service.php | 8 +++++++- 8 files changed, 34 insertions(+), 68 deletions(-) delete mode 100755 views/default/openid_server/metatags.php.old diff --git a/lib/session.php b/lib/session.php index 25940b3bb..f0f38f7c9 100755 --- a/lib/session.php +++ b/lib/session.php @@ -77,7 +77,6 @@ function getServer() global $CONFIG; static $server; $op_endpoint = getServerURL(); - error_log("In getServer()"); if (!isset($server)) { $server =& new Auth_OpenID_Server(getOpenIDServerStore(),$op_endpoint); } @@ -131,7 +130,6 @@ function getRequestInfo() function setRequestInfo($info=null) { - error_log("in setRequestInfo"); if (!isset($info)) { unset($_SESSION['openid_server_request']); } else { diff --git a/openid_server_include.php b/openid_server_include.php index ae3227659..6fbd319c4 100755 --- a/openid_server_include.php +++ b/openid_server_include.php @@ -13,7 +13,7 @@ require_once 'Auth/OpenID.php'; require_once 'Auth/OpenID/Interface.php'; require_once 'Auth/OpenID/Consumer.php'; try { - include_once "Auth/OpenID/HMACSHA1.php"; + // include_once "Auth/OpenID/HMACSHA1.php"; } catch(Exception $e) { // new way :P require_once "Auth/OpenID/HMAC.php"; @@ -68,7 +68,6 @@ class OpenIDServer_ElggStore extends Auth_OpenID_OpenIDStore { } if (!$assocs || (count($assocs) == 0)) { - error_log("in getAssociations - cannot get associations for server url: $server_url, handle: $handle"); return null; } else { $associations = array(); @@ -138,8 +137,6 @@ class OpenIDServer_ElggStore extends Auth_OpenID_OpenIDStore { $association_obj->access_id = 2; $association_obj->title = 'association'; - error_log("in storeAssociation, attempting to save association with new handle: ".$association->handle); - if ($association_obj->save()) { $association_obj->server_url = $server_url; $association_obj->handle = $association->handle; @@ -147,7 +144,6 @@ class OpenIDServer_ElggStore extends Auth_OpenID_OpenIDStore { $association_obj->issued = $association->issued; $association_obj->lifetime = $association->lifetime; $association_obj->assoc_type = $association->assoc_type; - error_log("in storeAssociation, saved association with new handle: ".$association->handle); return true; } else { return false; @@ -201,7 +197,6 @@ class OpenIDServer_ElggStore extends Auth_OpenID_OpenIDStore { if ($results) { foreach ($results as $site) { $sites[] = $site->trust_root; - error_log("GET TRUST".$site->trust_root); } } return $sites; @@ -249,7 +244,6 @@ class OpenIDServer_ElggStore extends Auth_OpenID_OpenIDStore { function setTrustedSite($trust_root) { $openid_url = getLoggedInUser(); $site = new ElggObject(); - error_log("SET TRUST-"."X".$trust_root->site_name."X".$trust_root->trust_root.":-:".$openid_url); $site->subtype = 'openid_server::trust_root'; $site->owner_guid = 0; $site->title = 'association'; diff --git a/server.php b/server.php index 889812614..7ebe70dd4 100755 --- a/server.php +++ b/server.php @@ -4,36 +4,29 @@ require_once('openid_server_include.php'); require_once 'lib/session.php'; require_once 'lib/actions.php'; -error_log('translations: '.print_r($CONFIG->translations,true)); +if (elgg_get_viewtype() == 'xrds') { + echo elgg_view_page($title, $body); + exit(0); +} -error_log('in server.php - trying to get server $_SESSION = '.print_r($_SESSION,true)); $store = getOpenIDServerStore(); $server =& getServer(); -error_log('in server.php - trying to decode request, action='.getAction()); - $request = $server->decodeRequest(); -//error_log('in server.php - request:'.print_r($request,true)); setRequestInfo($request); -error_log('in server.php - after setRequestInfo'); + $action = getAction(); if (!function_exists($action)) { $action = 'action_default'; } -error_log('in server.php - dispatching action '.$action); - $resp = $action(); - -writeResponse($resp); -/*if (isloggedin()) { - error_log('in server.php - about to forward'); - forward($CONFIG->wwwroot.'mod/openid_server/actions/trust.php'); +if (!empty($resp)) { + writeResponse($resp); } else { - error_log('in server.php - not logged in'); - system_message(elgg_echo('openid_server:not_logged_in')); - forward(); -}*/ + echo elgg_view_page($title, $body); + exit(0); +} ?> diff --git a/start.php b/start.php index a00811ab9..b9a480b6e 100755 --- a/start.php +++ b/start.php @@ -10,25 +10,17 @@ * @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/'); +if (get_include_path()) + set_include_path(get_include_path() . PATH_SEPARATOR . $CONFIG->path . 'mod/openid_api/vendors/php-openid/' . PATH_SEPARATOR . $CONFIG->path . 'mod/openid_server/'); +else + set_include_path($CONFIG->path . 'mod/openid_api/vendors/php-openid/' . PATH_SEPARATOR . $CONFIG->path . 'mod/openid_server/'); elgg_register_event_handler('init','system','openid_server_init',1); function openid_server_init() { - global $CONFIG; + global $CONFIG; elgg_register_event_handler('login','user','openid_server_handle_login'); elgg_register_event_handler('logout','user','openid_server_handle_logout'); @@ -37,9 +29,10 @@ function openid_server_init() { $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"); + elgg_extend_view("metatags", "openid_server/metatags"); + elgg_extend_view("page/elements/head", "openid_server/metatags"); + elgg_extend_view("xrds/services", "openid_server/service"); + elgg_extend_view("profile/wrapper", "openid_server/profile"); } diff --git a/views/default/forms/openid_server/trust.php b/views/default/forms/openid_server/trust.php index 3dac9b648..b9e4c3333 100755 --- a/views/default/forms/openid_server/trust.php +++ b/views/default/forms/openid_server/trust.php @@ -18,7 +18,7 @@ $user = elgg_get_logged_in_user_entity(); $openid_trust_root = elgg_extract('openid_trust_root', $vars); -echo '
' . elgg_echo('openid_server:trust_question', array($openid_trust_root, elgg_get_site_entity()->name, $user->username)); +echo '
' . elgg_echo('openid_server:trust_question', array($openid_trust_root, elgg_get_site_entity()->name . ":" . $user->username)); /*echo '
'.elgg_view('input/checkbox', array( 'name' => 'name', diff --git a/views/default/openid_server/metatags.php b/views/default/openid_server/metatags.php index 9b486568e..422e3b74d 100755 --- a/views/default/openid_server/metatags.php +++ b/views/default/openid_server/metatags.php @@ -1,7 +1,7 @@ + diff --git a/views/default/openid_server/metatags.php.old b/views/default/openid_server/metatags.php.old deleted file mode 100755 index fddca8ceb..000000000 --- a/views/default/openid_server/metatags.php.old +++ /dev/null @@ -1,23 +0,0 @@ - - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.org/ - * - */ - -?> - - \ No newline at end of file diff --git a/views/xrds/openid_server/service.php b/views/xrds/openid_server/service.php index 7daafbbed..269df5c2e 100644 --- a/views/xrds/openid_server/service.php +++ b/views/xrds/openid_server/service.php @@ -1,9 +1,15 @@ http://specs.eaut.org/1.0/template profile/%7Busername%7D + + http://specs.openid.net/auth/2.0/server + mod/openid_server/server.php + + -- cgit v1.2.3