init
This commit is contained in:
38
modules/EcmTasks/GoogleCalendarEcmTaskUpdate.php
Normal file
38
modules/EcmTasks/GoogleCalendarEcmTaskUpdate.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
mb_internal_encoding("UTF-8");
|
||||
include_once("../../config.php");
|
||||
|
||||
global $sugar_config;
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
mysql_query ('SET NAMES utf-8');
|
||||
//die('test');
|
||||
require_once("/var/www/html/crm/Zend/Loader.php");
|
||||
Zend_Loader::loadClass('Zend_Gdata');
|
||||
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
|
||||
Zend_Loader::loadClass('Zend_Gdata_Calendar');
|
||||
Zend_Loader::loadClass('Zend_Http_Client');
|
||||
// connect to service
|
||||
$p = mysql_fetch_assoc(mysql_query("SELECT google_login,CAST(AES_DECRYPT(google_password, 'jakistamhash123') as CHAR) AS google_password,google_calendar_name FROM users WHERE id='2e72f487-d92b-954e-f50c-528b10ce81c9'"));
|
||||
if($p['google_login']!='' && $p['google_password']!=''){
|
||||
$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
|
||||
$user = $p['google_login'];
|
||||
|
||||
$pass = $p['google_password'];
|
||||
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
|
||||
$listFeed = new Zend_Gdata_Calendar($client);
|
||||
|
||||
try {
|
||||
$listFeed= $service->getCalendarListFeed();
|
||||
} catch (Zend_Gdata_App_Exception $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
echo "<h1>Calendar List Feed</h1>";
|
||||
echo "<ul>";
|
||||
foreach ($listFeed as $calendar) {
|
||||
echo "<li>" . $calendar->title .
|
||||
" (Event Feed: " . $calendar->id . ")</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
Reference in New Issue
Block a user