Пример #1
0
/**
 * Parse the WordPress request.  
 *
 * @param WP $wp WP instance for the current request
 */
function openid_server_parse_request($wp)
{
    if (array_key_exists('openid_server', $_REQUEST)) {
        openid_server_request($_REQUEST['action']);
    }
}
Пример #2
0
/**
 * Parse the WordPress request.  If the query var 'openid' is present, then
 * handle the request accordingly.
 *
 * @param WP $wp WP instance for the current request
 */
function openid_parse_request($wp) {
	if (array_key_exists('openid', $wp->query_vars)) {

		openid_clean_request();

		switch ($wp->query_vars['openid']) {
			case 'consumer':
				@session_start();

				$action = $_SESSION['openid_action'];

				// no action, which probably means OP-initiated login.  Set
				// action to 'login', and redirect to home page when finished
				if (empty($action)) {
					$action = 'login';
					if (empty($_SESSION['openid_finish_url'])) {
						//$_SESSION['openid_finish_url'] = get_option('home');
					}
				}

				finish_openid($action);
				break;

			case 'server':
				openid_server_request($_REQUEST['action']);
				break;

			case 'ajax':
				if ( check_admin_referer('openid_ajax') ) {
					header('Content-Type: application/json');
					echo '{ valid:' . ( is_url_openid( $_REQUEST['url'] ) ? 'true' : 'false' ) . ', nonce:"' . wp_create_nonce('openid_ajax') . '" }';
					exit;
				}
		}
	}
}