Example #1
0
/**
 * Outputs a request to the user to login to their Google account, including
 * a link to the AuthSub URL.
 *
 * Uses getAuthSubUrl() to get the URL which the user must visit to authenticate
 *
 * @return void
 */
function requestUserLogin($linkText)
{
    $authSubUrl = getAuthSubUrl();
    echo "<a href=\"{$authSubUrl}\">{$linkText}</a>";
}
    $host = $_SERVER['HTTP_HOST'];
    if ($_SERVER['SERVER_PORT'] != '' && ($protocol == 'http://' && $_SERVER['SERVER_PORT'] != '80' || $protocol == 'https://' && $_SERVER['SERVER_PORT'] != '443')) {
        $port = ':' . $_SERVER['SERVER_PORT'];
    } else {
        $port = '';
    }
    return $protocol . $host . $port . $php_request_uri;
}
function getAuthSubUrl()
{
    $next = getCurrentUrl();
    $scope = 'http://picasaweb.google.com/data';
    $secure = 0;
    $session = 1;
    return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}
?>

			<div id="login-div" class="row">
				<a id="login-link" class="btn btn-danger btn-lg" href="<?php 
echo getAuthSubUrl();
?>
">
					Google
				</a>
			</div>

		</div>
	</body>
</html>