/**
  * Export Contacts List
  *
  * @access public
  * @static
  * @return bool 
  * @param string $format
  * @author (damien DOT flament AT smoofy DOT org)
  * @since 1 Feb 2007
  * THIS METHOD IS EXPERIMENTAL AND HAS NOT BEEN TESTED 
  */
 function exportContacts($format)
 {
     if ($this->isConnected() == true) {
         $postdata["at"] = $this->at_value();
         if ($format == 'outlook') {
             $postdata["ecf"] = 'o';
         } else {
             $postdata["ecf"] = 'g';
         }
         $postdata["ac"] = 'Export Contacts';
         $this->gmail_data = $this->gmail_data = GMailer::execute_curl($this->GM_LNK_GMAIL . "?view=fec", $this->GM_LNK_GMAIL . "?view=sec", 'post', $postdata, "noheader");
         $a = array("action" => "export contacts", "status" => "success", "message" => "Contacts exported", "contacts" => $this->gmail_data);
         array_unshift($this->return_status, $a);
         return true;
     } else {
         $a = array("action" => "export contacts", "status" => "failed", "message" => "libgmailer: not connected");
         array_unshift($this->return_status, $a);
         return false;
     }
 }
Exemple #2
0
 /**
  * Personalities / Custom FROM addresses
  *
  * @return bool Success or not.
  * @param string $action An action to perform: [set this address to] default, delete, reply_sent, reply_default, edit, edit_google, send_verify, verify_code
  * @param string $email
  * @param string $name
  * @param string $reply_to
  * @param integer $code Verification code for an added custom from address
  * @desc Custom From Address features
  * @author Neerav
  * @since 25 Feb 2006
  */
 function customFrom($action, $email, $name = "", $reply_to = "", $code = "")
 {
     if ($this->isConnected()) {
         $url = "&ik=&view=up";
         $refer = "&view=pr&pnl=g" . $this->proxy_defeat();
         $method = 'post';
         switch ($action) {
             case "default":
                 $postdata = "act=mcf_" . urlencode($email);
                 $postdata .= "&at=" . $this->at_value();
                 break;
             case "delete":
                 $postdata = "act=dcf_" . urlencode($email);
                 $postdata .= "&at=" . $this->at_value();
                 break;
             case "reply_sent":
                 $postdata = "act=crf_1";
                 $postdata .= "&at=" . $this->at_value();
                 $postdata .= "&search=";
                 break;
             case "reply_default":
                 $postdata = "act=crf_0";
                 $postdata .= "&at=" . $this->at_value();
                 $postdata .= "&search=";
                 break;
             case "edit":
                 $postdata = "cfrp=1&cfe=1&cfn=" . urlencode($name) . "&cfrt=" . urlencode($reply_to);
                 $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat();
                 $refer = $url;
                 break;
             case "edit_google":
                 $postdata['cfrp'] = 1;
                 $postdata['cfe'] = 1;
                 $postdata['cfgnr'] = $name != "" ? 1 : 0;
                 $postdata['cfgn'] = $name;
                 $postdata['cfrt'] = $reply_to;
                 $url = "&view=cf&cfe=true&cfa=" . urlencode($email) . $this->proxy_defeat();
                 $refer = $url;
                 break;
                 /* 				case "add_pre": */
                 /* 					$postdata 	= ""; */
                 /* 					$url 		= "&view=cf".$this->proxy_defeat(); */
                 /* 					$method		= 'get'; */
                 /*  					break; */
                 /* 				case "add": */
                 /* 					$postdata		 	= array(); */
                 /* 					$postdata['cfrp'] 	= 1; */
                 /* 					$postdata['cfn'] 	= $name; */
                 /* 					$postdata['cfa'] 	= $email; */
                 /* 					$postdata['cfrt'] 	= $reply_to; */
                 /* 					$url 				= "&view=cf"; */
                 /* 					$refer 				= $url; */
                 /*  					break; */
             /* 				case "add_pre": */
             /* 					$postdata 	= ""; */
             /* 					$url 		= "&view=cf".$this->proxy_defeat(); */
             /* 					$method		= 'get'; */
             /*  					break; */
             /* 				case "add": */
             /* 					$postdata		 	= array(); */
             /* 					$postdata['cfrp'] 	= 1; */
             /* 					$postdata['cfn'] 	= $name; */
             /* 					$postdata['cfa'] 	= $email; */
             /* 					$postdata['cfrt'] 	= $reply_to; */
             /* 					$url 				= "&view=cf"; */
             /* 					$refer 				= $url; */
             /*  					break; */
             case "send_verify":
                 $postdata = array();
                 $postdata['cfrp'] = 2;
                 $postdata['cfn'] = $name;
                 $postdata['cfa'] = $email;
                 $postdata['cfrt'] = $reply_to;
                 $postdata['submit'] = "Send Verification";
                 $url = "&view=cf";
                 $refer = $url;
                 break;
             case "verify_code":
                 $postdata = array();
                 $postdata['cfrp'] = 3;
                 $postdata['cfrs'] = "false";
                 $postdata['cfn'] = $name;
                 $postdata['cfa'] = $email;
                 $postdata['cfrt'] = $reply_to;
                 $postdata['cfvc'] = $code;
                 $url = "&view=cf";
                 $refer = $url;
                 break;
             default:
                 array_unshift($this->return_status, array("action" => "custom from: {$action}", "status" => "failed", "message" => "libgmailer: Invalid action"));
                 return 0;
         }
         $this->gmail_data = GMailer::execute_curl(GM_LNK_GMAIL . "?" . $url, GM_LNK_GMAIL . "?" . $refer, $method, $postdata);
         GMailer::parse_gmail_response($this->gmail_data);
         if ($action == "send_verify" or $action == "add" or $action == "add_pre" or $action == "verify_code") {
             $status = 1;
         } else {
             $status = isset($this->raw["cfs"]) ? 1 : 0;
         }
         /* 			$status = (isset($this->raw["ar"][1])) ? $this->raw["ar"][1] : 0; */
         $message = isset($this->raw["ar"][2]) ? $this->raw["ar"][2] : "";
         $a = array("action" => "custom from: {$action}", "status" => $status ? "success" : "failed", "message" => $message);
         array_unshift($this->return_status, $a);
         return $status;
     } else {
         $a = array("action" => "custom from", "status" => "failed", "message" => "libgmailer: not connected");
         array_unshift($this->return_status, $a);
         return false;
     }
 }