public static function auth() { $news = new Zend_Gdata_Photos(); $svc = Zend_Gdata_Photos::AUTH_SERVICE_NAME; static::$client = Zend_Gdata_ClientLogin::getHttpClient(static::$gUser, static::$gPass, $svc); static::$service = new Zend_Gdata_Photos(static::$client, "ANO"); }
public function gdata_insert_row() { ProjectConfiguration::registerZend(); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Spreadsheets'); Zend_Loader::loadClass('Zend_Gdata_Docs'); $username = "******"; $password = "******"; //Chave do arquivo $key = "0Ak_oCZQf3sTidEJnZGQ4MHdhS0R1NUlSeG1ORkpnalE"; //Carregando o serviço do arquivo $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service); $spreadSheetService = new Zend_Gdata_Spreadsheets($client); //Pegando as planilhas do arquivo $query = new Zend_Gdata_Spreadsheets_DocumentQuery(); $query->setSpreadsheetKey($key); $feed = $spreadSheetService->getWorksheetFeed($query); //Escolhendo a planilha correta foreach ($feed->entries as $entry) { if ($entry->getTitle() == 'Disponiveis') { $worksheetId = basename($entry->getId()); } } //Configura variaveis da nova linha na planilha $assoc = $this->getAssociado(); $matricula = $this->isTitular() ? $assoc->getMatricula() : $assoc->getTitular()->getMatricula(); $dependenteId = $this->isDependente() ? $assoc->getId() : '0'; //Monta array para o serviço do arquivo $rowData = array("data" => $this->getDateTimeObject('created_at')->format('Y-m-d'), "matricula" => $matricula, "nome" => $assoc->getNome(), "dependenteid" => $dependenteId, "encaminhaid" => $this->getId()); //Insere na Planilha $insertedListEntry = $spreadSheetService->insertRow($rowData, $key, $worksheetId); }
/** * Initialize Google Client service * use ClientLogin to authenticate to Google * * @return void */ protected function _initService() { $username = $this->_config['gcal_username']; $password = $this->_config['gcal_password']; $serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $appName = 'CORE'; $loginToken = isset($_GET['token']) ? $_GET['token'] : null; $loginAnswer = isset($_GET['answer']) ? $_GET['answer'] : null; try { $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $serviceName, null, $appName, $loginToken, $loginAnswer); } catch (Zend_Gdata_App_CaptchaRequiredException $e) { echo 'Google requires you to enter this CAPTCHA image <br />'; echo '<img src="' . $e->getCaptchaUrl() . '" /><br />'; echo '<form action="/core/session/captcha" method="GET">'; echo 'Answer : <input type="text" name="answer" size="10" />'; echo '<input type="hidden" name="token" value="' . $e->getCaptchaToken() . '" />'; echo '<input type="submit" />'; echo '</form>'; exit; } catch (Zend_Gdata_App_AuthException $e) { throw new Exception($e); } $this->_service = new Zend_Gdata_Calendar($client); $this->_setFeedUrl(); }
public function getWebmastertoolsSitesAction() { $credentials = $this->getWebmastertoolsCredentials(); if ($credentials) { $username = $credentials["username"]; $password = $credentials["password"]; } if ($this->_getParam("username") && $this->_getParam("password")) { $username = $this->_getParam("username"); $password = $this->_getParam("password"); } try { $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, "sitemaps", Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient")); $service = new Zend_Gdata($client); $data = $service->getFeed("https://www.google.com/webmasters/tools/feeds/sites/"); foreach ($data->getEntry() as $e) { $verification = ""; // get verification filename foreach ($e->getExtensionElements() as $d) { $a = $d->getExtensionAttributes(); if ($a["type"]["value"] == "htmlpage") { $verification = $d->getText(); break; } } $sites[] = array("profile" => (string) $e->getTitle(), "verification" => $verification); } $this->_helper->json(array("data" => $sites)); } catch (Exception $e) { $this->_helper->json(false); } }
function beforeFilter() { $this->disableCache(); if (!$this->_loadConfig()) { $this->configured = false; return; } $this->gdata_login = Configure::read('Gdata.login'); ini_set('include_path', get_include_path() . PATH_SEPARATOR . VENDORS . 'zend_framework' . DS . 'library' . PATH_SEPARATOR . APP . DS . 'vendors' . DS . 'zend_framework' . DS . 'library'); require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Spreadsheets'); Zend_Loader::loadClass('Zend_Gdata_App_AuthException'); Zend_Loader::loadClass('Zend_Http_Client'); try { $client = Zend_Gdata_ClientLogin::getHttpClient($this->gdata_login['email'], $this->gdata_login['password'], Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME); $this->gdata_client = $client; } catch (Zend_Gdata_App_CaptchaRequiredException $cre) { $this->gdata_capthaUrl = $cre->getCaptchaUrl(); $this->gdata_token = $cre->getCaptchaToken(); var_dump($this->gdata_capthaUrl, $this->gdata_token); } catch (Zend_Gdata_App_AuthException $ae) { $this->Session->setFlash(__('Failed Authentication', true) . ':' . $ae->exception()); $this->auth_failed = true; } }
public function setPlanning($startDate, $endDate, $title, $content) { // Parameters for ClientAuth authentication ProjectConfiguration::registerZend(); Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $user = sfConfig::get('app_gmail_user'); $pass = sfConfig::get('app_gmail_pwd'); // Create an authenticated HTTP client $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); // Create an instance of the Calendar service $service = new Zend_Gdata_Calendar($client); // Create a new entry using the calendar service's magic factory method $event = $service->newEventEntry(); // Populate the event with the desired information // Note that each attribute is crated as an instance of a matching class $event->title = $service->newTitle($title); $event->where = array($service->newWhere("Paris, France")); $event->content = $service->newContent($content); // Set the date using RFC 3339 format. $tzOffset = "+02"; $when = $service->newWhen(); //$when->startTime = "{$start_date}.000{$tzOffset}:00"; //$when->endTime = "{$end_date}.000{$tzOffset}:00"; $when->startTime = "{$startDate}:00.000{$tzOffset}:00"; $when->endTime = "{$endDate}:00.000{$tzOffset}:00"; $event->when = array($when); // Upload the event to the calendar server // A copy of the event as it is recorded on the server is returned $newEvent = $service->insertEvent($event); }
function addEvent($title = 'Новый заказ', $desc = 'Описание заказа', $where = 'интернет-магазин', $startDate, $endDate, $sms_reminder) { try { set_include_path('.' . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/modules/gcalendar/' . PATH_SEPARATOR . get_include_path()); include_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_HttpClient'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); $client = Zend_Gdata_ClientLogin::getHttpClient($this->_user, $this->_pass, "cl"); $gdataCal = new Zend_Gdata_Calendar($client); $newEvent = $gdataCal->newEventEntry(); $newEvent->title = $gdataCal->newTitle($title); $newEvent->where = array($gdataCal->newWhere($where)); $newEvent->content = $gdataCal->newContent($desc); $when = $gdataCal->newWhen(); $when->startTime = $startDate; $when->endTime = $endDate; if (intval($sms_reminder)) { $reminder = $gdataCal->newReminder(); $reminder->method = "sms"; $reminder->minutes = "0"; $when->reminders = array($reminder); } $newEvent->when = array($when); $createdEvent = $gdataCal->insertEvent($newEvent); return $createdEvent->id->text; } catch (Exception $ex) { // Report the exception to the user } }
private function connectToGoogleViaZend() { set_include_path($this->root_directory . "modules/Calendar4You/"); require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); if ($this->user_login != "" && $this->user_password != "") { try { $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $this->gClient = Zend_Gdata_ClientLogin::getHttpClient($this->user_login, $this->user_password, $service); $this->status = $this->mod_strings["LBL_OK"]; $this->is_logged = true; } catch (Zend_Gdata_App_CaptchaRequiredException $cre) { $this->status = $this->mod_strings["LBL_URL_CAPTCHA_IMAGE"] . ': ' . $cre->getCaptchaUrl() . ', ' . $this->mod_strings["LBL_TOKEN_ID"] . ': ' . $cre->getCaptchaToken(); } catch (Zend_Gdata_App_AuthException $ae) { $this->status = $this->mod_strings["LBL_AUTH_PROBLEM"] . ': ' . $ae->exception() . "\n"; } } else { $this->status = $this->mod_strings["LBL_MISSING_AUTH_DATA"]; } if ($this->is_logged) { $this->gService = new Zend_Gdata_Calendar($this->gClient); try { $this->gListFeed = $this->gService->getCalendarListFeed(); } catch (Zend_Gdata_App_Exception $e) { $this->gListFeed = array(); } } set_include_path($this->root_directory); }
public function testUserCRUDOperations() { // Create a new user $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); $this->autoDelete($user); // Verify that returned values are correct $this->assertEquals($this->id, $user->login->username); $this->assertEquals(self::GIVEN_NAME, $user->name->givenName); $this->assertEquals(self::FAMILY_NAME, $user->name->familyName); // Since we can't retrieve the password or hash function via the // API, let's see if a ClientLogin auth request succeeds try { Zend_Gdata_ClientLogin::getHTTPClient($this->id . '@' . $this->domain, self::PASSWORD, 'xapi'); } catch (Zend_Gdata_App_AuthException $e) { $this->fail("Unable to authenticate new user via ClientLogin."); } // Check to make sure there are no extension elements/attributes // in the retrieved user $this->assertTrue(count($user->extensionElements) == 0); $this->assertTrue(count($user->extensionAttributes) == 0); // Try searching for the same user and make sure that they're returned $user2 = $this->gdata->retrieveUser($this->id); $this->assertEquals($user->saveXML(), $user2->saveXML()); // Delete user (uses builtin delete method, convenience delete // method tested further down) $user->delete(); // Ensure that user was deleted $deletedUser = $this->gdata->retrieveUser($this->id); $this->assertNull($deletedUser); }
function main() { $user = '******'; $pass = '******'; $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // Delete service if ?reset=true query parameter is present if (isset($_GET['reset']) && $_GET['reset'] == 'true') { echo "<p><strong>Deleting existing service object!</strong></p>"; unset($_SESSION['gdata_service']); } // Prepare client if (!isset($_SESSION['gdata_service'])) { echo "<p><strong>Creating new service object.</strong></p>"; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); $s = new Zend_Gdata_Calendar($client); $_SESSION['gdata_service'] = $s; } else { echo "<p><strong>Reusing existing service object.</strong></p>"; } $s = $_SESSION['gdata_service']; // Retrieve all calendars $eventFeed = $s->getCalendarEventFeed(); echo "<ul>\n"; foreach ($eventFeed as $event) { echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n"; echo "\t\t<ul>\n"; foreach ($event->when as $when) { echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n"; } echo "\t\t</ul>\n"; echo "\t</li>\n"; } echo "</ul>\n"; }
public function FetchContacts($credential = null) { if (!$credential) { $credential = $this->_credential; } else { $this->_credential = $credential; } $user = $credential['username']; $pass = $credential['password']; try { // perform login and set protocol version to 3.0 $client = \Zend_Gdata_ClientLogin::getHttpClient($user, $pass, 'cp'); $gdata = new \Zend_Gdata($client); $gdata->setMajorProtocolVersion(3); // perform query and get result feed $query = new \Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full'); $query->setParam("max-results", 10000); $feed = $gdata->getFeed($query); // parse feed and extract contact information // into simpler objects $results = array(); foreach ($feed as $entry) { $xml = simplexml_load_string($entry->getXML()); $obj = $this->DatatoContact($entry, $xml); $results[] = $obj; } } catch (Exception $e) { var_dump($e->getMessage()); return; } return $results; }
public function __construct($gmailAccount, $password, $spreadsheetId, $worksheet = "default") { $client = Zend_Gdata_ClientLogin::getHttpClient($gmailAccount, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME); $this->spreadsheetService = new Zend_Gdata_Spreadsheets($client); $this->spreadsheetId = $spreadsheetId; $this->worksheet = $worksheet; }
function clientLogin($username, $password, $source) { Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); $authenticationURL = 'https://www.google.com/accounts/ClientLogin'; $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, 'youtube', null, $source, null, null, $authenticationURL); return $httpClient; }
protected function getService() { $credentials = $this->getAnalyticsCredentials(); $client = Zend_Gdata_ClientLogin::getHttpClient($credentials["username"], $credentials["password"], Zend_Gdata_Analytics::AUTH_SERVICE_NAME, Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient")); $service = new Zend_Gdata_Analytics($client, "pimcore-open-source-CMS-framework"); return $service; }
public function indexAction() { $content = new Content(); $slug = $this->_getParam('slug'); if ($slug == '\\d+') { $content = new Content(); $this->view->contents = $content->getFrontContent('treports'); $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($this->_config->webservice->google->username, $this->_config->webservice->google->password, $service); $docs = new Zend_Gdata_Docs($client); $docsQuery = new Zend_Gdata_Docs_Query(); $docsQuery->setQuery('title:Treasure Annual Report'); $feed = $docs->getDocumentListFeed($docsQuery); $documents = array(); foreach ($feed->entries as $entry) { $title = $entry->title; foreach ($entry->link as $link) { if ($link->getRel() === 'alternate') { $altlink = $link->getHref(); } } $documents[] = array('title' => $title, 'altlink' => $altlink, 'updated' => $entry->updated, 'type' => $entry->content->type, 'published' => $entry->published); } $this->view->documents = $documents; } else { $this->view->contents = $content->getContent('treports', $this->_getParam('slug')); } }
public function indexAction() { $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient("*****@*****.**", "regard@amude", $service); $service = new Zend_Gdata_Calendar($client); die; }
function login($user, $pass) { $this->user = $user; $this->pass = $pass; $this->client = Zend_Gdata_ClientLogin::getHttpClient($this->user, $this->pass, $this->gcal); $this->gcal = new Zend_Gdata_Calendar($this->client); }
public function testUseH9() { $serviceName = Zend_Gdata_Health::H9_SANDBOX_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($this->user, $this->pass, $serviceName); $h9 = new Zend_Gdata_Health($client, 'google-MyPHPApp-v1.0', true); $profileListFeed = $h9->getHealthProfileListFeed(); $profileID = $profileListFeed->entry[0]->getProfileID(); $h9->setProfileID($profileID); // query profile feed $feed1 = $h9->getHealthProfileFeed(); $this->assertTrue($feed1 instanceof Zend_Gdata_Health_ProfileFeed); foreach ($feed1->getEntries() as $entry) { $this->assertTrue($entry instanceof Zend_Gdata_Health_ProfileEntry); $this->assertEquals($entry->getHttpClient(), $feed1->getHttpClient()); } // send CCR $subject = "Title of your notice goes here"; $body = "Notice body can contain <b>html</b> entities"; $type = "html"; $ccrXML = file_get_contents('Zend/Gdata/Health/_files/ccr_notice_sample.xml', true); $responseEntry = $h9->sendHealthNotice($subject, $body, $type, $ccrXML); $this->assertTrue($responseEntry instanceof Zend_Gdata_Health_ProfileEntry); $this->assertEquals($subject, $responseEntry->title->text); $this->assertEquals($body, $responseEntry->content->text); $this->assertEquals($type, $responseEntry->content->type); $this->assertXmlStringEqualsXmlString($responseEntry->getCcr()->saveXML(), $ccrXML); }
protected function getService() { $credentials = $this->getWebmastertoolsCredentials(); $client = Zend_Gdata_ClientLogin::getHttpClient($credentials["username"], $credentials["password"], "sitemaps", Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient")); $service = new Zend_Gdata_Analytics($client); return $service; }
public function __construct($email, $password) { $client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME); $this->gdClient = new Zend_Gdata_Spreadsheets($client); $this->currKey = ''; $this->currWkshtId = ''; $this->listFeed = ''; }
function setupClient() { $email = "*****@*****.**"; $password = "******"; $client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME); $gdClient = new Zend_Gdata_Spreadsheets($client); return $gdClient; }
/** * Save PHPExcel to file * * @param string $pFileName * @throws Exception */ public function save($pFilename = null) { parent::save($pFilename); $googleDocsClient = Zend_Gdata_ClientLogin::getHttpClient($this->_username, $this->_password, Zend_Gdata_Docs::AUTH_SERVICE_NAME); $googleDocsService = new Zend_Gdata_Docs($googleDocsClient); $googleDocsService->uploadFile($pFilename, basename($pFilename), null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI); @unlink($pFilename); }
private static function getZendGdata() { $id = Doctrine::getTable('SnsConfig')->get('op_kintai_spid'); $pw = Doctrine::getTable('SnsConfig')->get('op_kintai_sppw'); $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($id, $pw, $service); return new Zend_Gdata_Spreadsheets($client); }
public function setUp() { $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Zend_Gdata_Calendar($client); }
function GoogleContactsAuth($GoogleContactsEmail, $GoogleContactsPass) { include_once 'Loader.php'; Zend_Loader::registerAutoload(); $GoogleContactsService = 'cp'; $GoogleContactsClient = Zend_Gdata_ClientLogin::getHttpClient($GoogleContactsEmail, $GoogleContactsPass, $GoogleContactsService); return $GoogleContactsClient; }
public function setUp() { $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $service = 'lh2'; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); $this->photos = new Zend_Gdata_Photos($client); }
public function create_user_account($user_info) { $password = $this->createPassword(); $client = Zend_Gdata_ClientLogin::getHttpClient($this->email, $this->password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME); $gdata = new Zend_Gdata_Gapps($client, $this->domain); $res[0] = $gdata->createUser($user_info['accountname'], $user_info['givenname'], $user_info['familyname'], $password, $passwordHashFunction = null, $quota = null); $res[1] = $password; return $res; }
public function setUp() { $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); $service = 'blogger'; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Zend_Gdata($client); }
public function __construct($user, $pass, array $config = null) { $this->httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = $user, $password = $pass, $service = 'youtube', $client = null, $source = $this->clientId, $loginToken = null, $loginCaptcha = null, $this->authenticationURL); if (!is_null($config)) { $this->httpClient->setConfig($config); } $this->yt = new Zend_Gdata_YouTube($this->httpClient, $this->applicationId, $this->clientId, $this->developerKey); $this->yt->setMajorProtocolVersion(2); }
function __construct() { // Authentication $this->user = '******'; $this->pass = base64_decode("encodedpassword"); // Yes, there are more secure ways of doing this. $this->client = Zend_Gdata_ClientLogin::getHttpClient($this->user, $this->pass, Zend_Gdata_Calendar::AUTH_SERVICE_NAME); $this->service = new Zend_Gdata_Calendar($this->client); }