***************
*** 15,98 ****
/**
* Implementation of hook_menu().
*/
- function openid_provider_menu() {
- $items['admin/settings/openid_provider'] = array(
- 'title' => 'OpenID Provider',
- 'description' => 'Configre settings for the OpenID Provider.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('openid_provider_admin_settings'),
- 'access arguments' => array('administer openid'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['openid/provider'] = array(
- 'title' => 'OpenID Login',
- 'page callback' => 'openid_provider_endpoint',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'openid_provider.pages.inc'
- );
-
- $items['openid/provider/send'] = array(
- 'title' => 'OpenID Login',
- 'page callback' => 'openid_provider_send',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'openid_provider.pages.inc'
- );
-
- $items['openid/provider/continue'] = array(
- 'title' => 'OpenID Login',
- 'page callback' => 'openid_provider_continue',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- 'file' => 'openid_provider.pages.inc'
- );
-
-
- $items['openid/xrds'] = array(
- 'page callback' => 'openid_provider_xrds',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK
- );
-
- $items['user/%user/xrds'] = array(
- 'page callback' => 'openid_provider_xrds',
- 'page arguments' => array(1),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK
- );
-
- $items['user/%user/openid_sites'] = array(
- 'title' => 'OpenID Sites',
- 'page callback' => 'openid_provider_sites',
- 'page arguments' => array(1),
- 'access callback' => TRUE,
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'openid_provider.pages.inc'
- );
-
- return $items;
- }
-
- /**
- * Implementation of hook_init()
- *
- * Add appropriate HTML headers for XRDS and Link discovery.
- */
- function openid_provider_init() {
- // Not all OpenID clients may be smart enough to do XRDS.
- drupal_add_link(array('rel' => 'openid2.provider', 'href' => url('openid/provider', array('absolute' => TRUE))));
- drupal_add_link(array('rel' => 'openid.server', 'href' => url('openid/provider', array('absolute' => TRUE))));
-
- if (arg(0) == 'user' && is_numeric(arg(1))) {
- drupal_set_header('X-XRDS-Location: '. url('user/' . arg(1) . '/xrds', array('absolute' => TRUE)));
- drupal_set_html_head('');
}
else {
- drupal_set_header('X-XRDS-Location: '. url('openid/xrds', array('absolute' => TRUE)));
- drupal_set_html_head('');
- }
}
/**
--- 16,97 ----
/**
* Implementation of hook_menu().
*/
+ function openid_provider_menu($may_cache) {
+ $items = array();
+ if ($may_cache) {
+ $items[] = array(
+ 'path' => 'admin/settings/openid_provider',
+ 'title' => 'OpenID Provider',
+ 'description' => 'Configure settings for the OpenID Provider.',
+ 'callback' => 'drupal_get_form',
+ 'callback arguments' => array('openid_provider_admin_settings'),
+ 'access' => array('administer openid'),
+ 'type' => MENU_NORMAL_ITEM,
+ );
+
+ $items[] = array(
+ 'path' => 'openid/provider',
+ 'title' => 'OpenID Login',
+ 'callback' => 'openid_provider_endpoint',
+ 'access' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items[] = array(
+ 'path' => 'openid/provider/send',
+ 'title' => 'OpenID Login',
+ 'callback' => 'openid_provider_send',
+ 'access' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items[] = array(
+ 'path' => 'openid/provider/continue',
+ 'title' => 'OpenID Login',
+ 'callback' => 'openid_provider_continue',
+ 'access' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
+
+ $items[] = array(
+ 'path' => 'openid/xrds',
+ 'callback' => 'openid_provider_xrds',
+ 'access' => TRUE,
+ 'type' => MENU_CALLBACK
+ );
}
else {
+ if (arg(0) == 'user' && is_numeric(arg(1)) && $account = user_load(array('uid' => arg(1)))) {
+ $items[] = array(
+ 'path' => 'user/'. $account->uid .'/xrds',
+ 'callback' => 'openid_provider_xrds',
+ 'callback arguments' => array(1),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK
+ );
+
+ $items[] = array(
+ 'path' => 'user/'. $account->uid .'/openid_sites',
+ 'title' => 'OpenID Sites',
+ 'callback' => 'openid_provider_sites',
+ 'callback arguments' => array(1),
+ 'access' => TRUE,
+ 'type' => MENU_LOCAL_TASK,
+ );
+
+ drupal_set_header('X-XRDS-Location: '. url('user/'. arg(1) .'/xrds', null, null, true));
+ drupal_set_html_head('');
+ }
+ else {
+ drupal_set_header('X-XRDS-Location: '. url('openid/xrds', null, null, true));
+ drupal_set_html_head('');
+ }
+ // Not all OpenID clients may be smart enough to do XRDS.
+ drupal_add_link(array('rel' => 'openid2.provider', 'href' => url('openid/provider', null, null, true)));
+ drupal_add_link(array('rel' => 'openid.server', 'href' => url('openid/provider', null, null, true)));
+ }
+ return $items;
}
/**
***************
*** 134,142 ****
foreach ($types as $type) {
$xrds .= ''. $type .'';
}
- $xrds .= '' . url('openid/provider', array('absolute'=> TRUE)) . '';
if ($account->uid) {
- $xrds .= '' . url('user/'. $account->uid, array('absolute' => TRUE)) . '';
}
$xrds .= '';
$xrds .= '';
--- 135,143 ----
foreach ($types as $type) {
$xrds .= ''. $type .'';
}
+ $xrds .= ''. url('openid/provider', NULL, NULL, TRUE) .'';
if ($account->uid) {
+ $xrds .= ''. url('user/'. $account->uid, NULL, NULL, TRUE) .'';
}
$xrds .= '';
$xrds .= '';