Edit file File name : GoogleContacts.php Content :<?PHP include "googlecontacts/MyCurlContacts.php"; class GoogleContactsGC extends MyCurlContacts { var $email; var $password; var $feed_url = "http://www.google.com/calendar/feeds/default/private/full"; var $fAuth; var $isLogged = false; var $feed_url_prepared; function GoogleCalendarWrapper($email, $password,$cusr="",$assigned_link="") { global $current_user; $this->feed_url = "http://www.google.com/calendar/feeds/default/private/full"; if (trim($current_user->google_mcalendar_c)!='' and trim($current_user->google_mcalendar_c)!='1'){ $this->feed_url = $current_user->google_mcalendar_c; } if (trim($cusr->google_mcalendar_c)!='' and trim($cusr->google_mcalendar_c)!='1'){ $this->feed_url = $cusr->google_mcalendar_c; } if ($assigned_link!=""){ $this->feed_url = $assigned_link; } $this->email = $email; $this->password = $password; $this->feed_url_prepared = $this->feed_url; parent::MyCurl(); } function login() { $this->fCookieFile=$this->email; debugg("new cookie".$this->email); $post_data = array(); $post_data['Email'] = $this->email; $post_data['Passwd'] = $this->password; $post_data['source'] = "exampleCo-exampleApp-1"; $post_data['service'] = "cl"; $post_data['accountType'] = "HOSTED_OR_GOOGLE"; $this->getHeaders = true; $this->getContent = true; $response = $this->post_login("https://www.google.com/accounts/ClientLogin", $post_data, null, $http_code); if(200==$http_code or $http_code="HTTP/1.1 200 OK") { $this->fAuth = parent::get_parsed($response, "Auth="); $this->isLogged = true; return 1; } $this->isLogged = false; return 0; } //to make the feed URL writable, it should be ended with "private/full" //check this: http://code.google.com/apis/gdata/calendar.html#get_feed function prepare_feed_url() { $url = parse_url($this->feed_url); $path = explode("/", $url["path"]); $size = sizeof($path); if($size>4) { $path[$size-1] = "full"; $path[$size-2] = "private"; $path = implode("/", $path); } $this->feed_url_prepared = $url["scheme"]."://".$url["host"].$path; } //adds new event into calendar //filled $settings array should be provided function get_all_cts_list($user_data,$docid,$sugarid,$google_mdocsafterdater_c,$limit,$current_user){ $this->prepare_feed_url(); $this->get_all_contacts_list($user_data,$docid,$sugarid,$google_mdocsafterdater_c,$limit,$current_user); } function add_cnt_onl($file,$filename,$file_ext,$file_mime_type,$user_data,$evid,$bean){ $this->prepare_feed_url(); $this->insert_cnt_onl($file,$filename,$file_ext,$file_mime_type,$user_data,$evid,$revision,$bean); } function delete_cnt_onl($file,$filename,$file_ext,$file_mime_type,$user_data,$evid,$bean){ # echo "aaa"; # exit; $this->prepare_feed_url(); $this->delete_contact_onl($file,$filename,$file_ext,$file_mime_type,$user_data,$evid,$revision,$bean); } } if (!function_exists("debugg")){ function debugg($text){ // echo "<br>\n ".$text."\n<br>"; ################### if ($_SESSION["allow_logs"]=="" or !isset($_SESSION["allow_logs"])) { $sq = "select * from config where category='info' and name='allow_logs_user_change'"; global $db; $result= $db->query($sq, true); while($row = $db->fetchByAssoc($result)) { $alogsusers = $row['value']; } $_SESSION["allow_logs"]=$alogsusers; } ###################### $filename = 'google_logs.log'; if ($_SESSION["allow_logs"]==1 or $_SESSION["allow_logs"]==true){ //dmc sugarondemand. //enable or disable next 2 lines for sugarondemand $handle = fopen($filename, 'a+'); fwrite($handle, $text."\n"); //////end enable or disable next 2 lines for sugarondemand } } function get_user_email_pass1($username){ require_once("modules/Users/User.php"); $user = new User(); $user->retrieve($username) ; $a=array($user->google_mmail_c,$user->google_mpass_c); return $a; } function get_user_email_pass_cts($username){ require_once("modules/Users/User.php"); $user = new User(); $user->retrieve($username) ; $a=array($user->google_mmail_cts_c,$user->google_mpass_cts_c); return $a; } } ?>Save