<?php require_once 'Gdata_OAuth_Helper.php'; require_once 'siteUtils.php'; require_once 'siteConfig.php'; require_once 'dbFuncs.php'; session_start(); require_once 'openIdAuth.php'; $APP_URL = getAppUrl(); $openId = new Gamut_OpenId(); $consumer = new Gdata_OAuth_Helper($CONSUMER_KEY, $CONSUMER_SEC); $dbFuncsObj = new dbFuncs(false); $dbFuncsObj->doConnect(); /** * This switch statement performs selective processing * based on the supplied 'action'. **/ switch (@$_REQUEST['action']) { case 'request_token': $_SESSION['ACCESS_TOKEN'] = $dbFuncsObj->getAccessToken('*****@*****.**'); if (isset($_SESSION['ACCESS_TOKEN'])) { $accessToken = unserialize($_SESSION['ACCESS_TOKEN']); //print $accessToken; $httpClient = $accessToken->getHttpClient($consumer->getOauthOptions()); $emailService = new Zend_Gdata_EMail($httpClient); $emailId = $emailService->getEMailFeed(); print $emailId; renderHTML('User logged-in with access token: <br> <a href="' . getRedirectUrl() . '" >Logout </a>', false); } else { $_SESSION['REQUEST_TOKEN'] = serialize($consumer->fetchRequestToken(implode(' ', $SCOPES), $APP_URL . '?action=' . getActionString('access'))); $consumer->authorizeRequestToken();
<?php require_once 'siteConfig.php'; require_once 'siteUtils.php'; require_once 'dbFuncs.php'; session_start(); $dbFuncsObj = new dbFuncs(false); $dbFuncsObj->doConnect(); print $dbFuncsObj->validateAccessToken($_SESSION['ACCESS_TOKEN'], $_SESSION['OPENID_EMAIL']); if (!isset($_SESSION['ACCESS_TOKEN']) || !isset($_SESSION['OPENID_EMAIL']) || !$dbFuncsObj->validateAccessToken($_SESSION['OPENID_EMAIL'], $_SESSION['ACCESS_TOKEN'])) { header('Location: ' . constructPageUrl('index.php')); } $dbFuncsObj->doDisconnect(); ?> <html> <head> <title> GMail Parser </title> </head> <body> <object width="800" height="600"> <param name="movie" value="LifeParserWeb.swf"> <embed src="LifeParserWeb.swf" width="800" height="600"> </embed> </object> </body> </html>