if (get_magic_quotes_gpc()) { $q = stripslashes($q); } $gdata = new Zend_Gdata_Base($client); $gdata->setQuery($q); $feed = $gdata->getBaseFeed(); } /** * Filter php_self to avoid a security vulnerability. */ $php_self = htmlentities(substr($_SERVER['PHP_SELF'], 0, strcspn($_SERVER['PHP_SELF'], "\n\r")), ENT_QUOTES); /** * Logout and revoke AuthSub token when we are done with it. */ if (isset($_GET['logout'])) { Zend_Gdata_AuthSub::AuthSubRevokeToken($_SESSION['base_token']); unset($_SESSION['base_token']); header('Location: ' . $php_self); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Google Base Demo</title> <style> body{ font-family: Arial; } input,select{font-size: 32px;} </style> </head>
function revokeToken($client) { $sessionToken = $client->getAuthSubToken(); return Zend_Gdata_AuthSub::AuthSubRevokeToken($sessionToken, $client); }
/** * @expectedException Zend_Gdata_App_HttpException */ public function testAuthSubRevokeTokenCatchesHttpClientException() { $adapter = new Zend_Http_Client_Adapter_Test(); $adapter->setNextRequestWillFail(true); $client = new Zend_Gdata_HttpClient(); $client->setUri('http://example.com/AuthSub'); $client->setAdapter($adapter); $revoked = Zend_Gdata_AuthSub::AuthSubRevokeToken($this->token, $client); }
/** * If there are some discrepancies in the session or user * wants not to connect his/her Google Calendars with ATutor * then this function will securely log out the user. * * @return void */ public function logout() { // Carefully construct this value to avoid application security problems. $php_self = htmlentities(substr($_SERVER['PHP_SELF'], 0, strcspn($_SERVER['PHP_SELF'], "\n\r")), ENT_QUOTES); //Revoke access for the stored token Zend_Gdata_AuthSub::AuthSubRevokeToken($_SESSION['sessionToken']); unset($_SESSION['sessionToken']); //Close this popup window echo "<script>window.opener.location.reload(true);window.close();</script>"; exit; }
public function revokeTokenAction() { $this->_helper->layout->disableLayout(); Zend_Gdata_AuthSub::AuthSubRevokeToken($_SESSION['sessionToken']); unset($_SESSION['sessionToken']); }