[Vtigercrm-commits] [vtiger-commits] r6486 - in /vtigercrm/trunk/modules/Webmails: CallRelatedList.php DetailView.php EditView.php MailParse.php Save.php WebmailsAjax.php body.php dlAttachments.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri May 26 13:32:50 EDT 2006


Author: mmbrich
Date: Fri May 26 11:32:49 2006
New Revision: 6486

Log:
moved back to rev 6445

Modified:
    vtigercrm/trunk/modules/Webmails/CallRelatedList.php
    vtigercrm/trunk/modules/Webmails/DetailView.php
    vtigercrm/trunk/modules/Webmails/EditView.php
    vtigercrm/trunk/modules/Webmails/MailParse.php
    vtigercrm/trunk/modules/Webmails/Save.php
    vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
    vtigercrm/trunk/modules/Webmails/body.php
    vtigercrm/trunk/modules/Webmails/dlAttachments.php

Modified: vtigercrm/trunk/modules/Webmails/CallRelatedList.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/CallRelatedList.php (original)
+++ vtigercrm/trunk/modules/Webmails/CallRelatedList.php Fri May 26 11:32:49 2006
@@ -15,30 +15,42 @@
 global $mod_strings;
 
 if($_REQUEST["record"]) {$mailid=$_REQUEST["record"];} else {$mailid=$_REQUEST["mailid"];}
+
+$mailInfo = getMailServerInfo($current_user);
+$temprow = $adb->fetch_array($mailInfo);
+
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
+$imapServerAddress=$temprow["mail_servername"];
+$start_message=$_REQUEST["start_message"];
+$box_refresh=$temprow["box_refresh"];
+$mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+
+if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
+global $mbox;
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
 
-$mailInfo = getMailServerInfo($current_user);
-$temprow = $adb->fetch_array($mailInfo);
-$imapServerAddress=$temprow["mail_servername"];
-$start_message=$_REQUEST["start_message"];
-$box_refresh=$temprow["box_refresh"];
-$mails_per_page=$temprow["mails_per_page"];
-$mail_protocol=$temprow["mail_protocol"];
-
-if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
-
-$mbox=getImapMbox($mailbox,$temprow);
-
-$email = new Webmail($mbox, $mailid);
-$from = $email->from;
-$subject=$email->subject;
-$date=$email->date;
-$to=$email->to;
-$cc_list=$email->cc_list;
-$reply_to=$email->replyTo;
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
 
 
-$block["Leads"]= "";
-global $adb;
+$email = new Webmail($mbox, $mailid);
+$from = $email->from;
+$subject=$email->subject;
+$date=$email->date;
+$to=$email->to;
+$cc_list=$email->cc_list;
+$reply_to=$email->replyTo;
+
+
+$block["Leads"]= "";
+global $adb;
 if($email->relationship != 0 && $email->relationship["type"] == "Leads") {
 	$q = "SELECT leaddetails.firstname, leaddetails.lastname, leaddetails.email, leaddetails.company, crmentity.smownerid from leaddetails left join crmentity on crmentity.crmid=leaddetails.leadid WHERE leaddetails.leadid='".$email->relationship["id"]."'";
 	$rs = $adb->query($q);

Modified: vtigercrm/trunk/modules/Webmails/DetailView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/DetailView.php (original)
+++ vtigercrm/trunk/modules/Webmails/DetailView.php Fri May 26 11:32:49 2006
@@ -13,17 +13,29 @@
 global $app_strings;
 global $mod_strings;
 if($_REQUEST["record"]) {$mailid=$_REQUEST["record"];} else {$mailid=$_REQUEST["mailid"];}
-
 $mailInfo = getMailServerInfo($current_user);
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $start_message=$_REQUEST["start_message"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
 
 if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
+global $mbox;
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
 
-$mbox = getImapMbox($mailbox,$temprow);
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
+
+
 
 echo ' after  in DetailView ';
 $email = new Webmail($mbox, $mailid);

Modified: vtigercrm/trunk/modules/Webmails/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/EditView.php (original)
+++ vtigercrm/trunk/modules/Webmails/EditView.php Fri May 26 11:32:49 2006
@@ -64,17 +64,27 @@
 define('SM_PATH','modules/Webmails/');
 require_once(SM_PATH . 'Webmail.php');
 require_once('include/utils/UserInfoUtil.php');
-require_once("modules/Webmails/MailParse.php");
-
 
 $mailInfo = getMailServerInfo($current_user);
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $start_message=$_REQUEST["start_message"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
-
-$mbox = getImapMbox($mailbox,$temprow);
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
+
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
+
 
 $webmail = new Webmail($mbox,$mailid);
 $webmail->loadMail();

Modified: vtigercrm/trunk/modules/Webmails/MailParse.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/MailParse.php (original)
+++ vtigercrm/trunk/modules/Webmails/MailParse.php Fri May 26 11:32:49 2006
@@ -5,43 +5,7 @@
 	$mailOverviews = @imap_fetch_overview($mbox, "1:$numEmails", 0);
 	$out = array("headers"=>$mailHeaders,"overview"=>$mailOverviews,"count"=>$numEmails);
 	return $out;
-}
-function getImapMbox($mailbox,$temprow) {
-	global $mbox;
-
-	$login_username= $temprow["mail_username"];
-	$secretkey=$temprow["mail_password"];
-	$imapServerAddress=$temprow["mail_servername"];
-	$box_refresh=$temprow["box_refresh"];
-	$mails_per_page=$temprow["mails_per_page"];
-	$mail_protocol=$temprow["mail_protocol"];
-	$ssltype=$temprow["ssltype"];
-	$sslmeth=$temprow["sslmeth"];
-	$account_name=$temprow["account_name"];
-	$show_hidden=$_REQUEST["show_hidden"];
-
-
-	// first we will try a regular old IMAP connection:
-	if($ssltype == "") {$ssltype = "notls";}
-	if($sslmeth == "") {$sslmeth = "novalidate-cert";}
-	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
-
-	if(!$mbox)
-	{
-        	if($mail_protocol == 'pop3')
-        	{
-                	$connectString = "{".$imapServerAddress."/".$mail_protocol.":110/notls}".$mailbox;
-        	}
-        	else
-        	{
-                	$connectString = "{".$imapServerAddress.":143/".$mail_protocol."/".$ssltype."}".$mailbox;
-        	}
-        	$mbox = imap_open($connectString, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
-	}
-
-	return $mbox;
-}
-
+}
 function getInlineAttachments($mailid,$mbox) {
        $struct = imap_fetchstructure($mbox, $mailid);
        $parts = $struct->parts;

Modified: vtigercrm/trunk/modules/Webmails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/Save.php (original)
+++ vtigercrm/trunk/modules/Webmails/Save.php Fri May 26 11:32:49 2006
@@ -6,9 +6,8 @@
 require_once('include/database/PearDatabase.php');
 require_once('include/utils/UserInfoUtil.php');
 require_once('include/utils/CommonUtils.php');
-require_once("modules/Webmails/MailParse.php");
+global $current_user;
 
-global $current_user;
 
 $local_log =& LoggerManager::getLogger('index');
 $focus = new Email();
@@ -29,14 +28,28 @@
 }
 
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
 $mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+$account_name=$temprow["account_name"];
 
 if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
 
-$mbox = getImapMbox($mailbox,$temprow);
+global $mbox;
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
+
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
+
+
 
 $email = new Webmail($mbox, $_REQUEST["mailid"]);
 

Modified: vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/WebmailsAjax.php (original)
+++ vtigercrm/trunk/modules/Webmails/WebmailsAjax.php Fri May 26 11:32:49 2006
@@ -18,8 +18,6 @@
 require_once('include/logging.php');
 require_once('include/utils/utils.php');
 require_once('include/utils/UserInfoUtil.php');
-require_once("modules/Webmails/MailParse.php");
-
 
 global $adb,$mbox,$current_user;
 
@@ -32,15 +30,33 @@
 }
 
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
+$account_name=$temprow["account_name"];
 $show_hidden=$_REQUEST["show_hidden"];
 
-$mbox = getImapMbox($mailbox,$temprow);
 
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+// bug in windows PHP having to do with SSL not being linked correctly
+// causes this open command to fail.
+if(!preg_match("/windows/i",php_uname()))
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$_REQUEST["mailbox"], $login_username, $secretkey);
+
+
+$check = imap_check($mbox);
+
+//if($check->Recent > 0) {
 $search = imap_search($mbox, "NEW ALL");
 if($search === false) {echo "";flush();exit();}
+
+//echo $search[0];flush();exit();
 
 $data = imap_fetch_overview($mbox,implode(',',$search));
 $num=sizeof($data);

Modified: vtigercrm/trunk/modules/Webmails/body.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/body.php (original)
+++ vtigercrm/trunk/modules/Webmails/body.php Fri May 26 11:32:49 2006
@@ -3,20 +3,32 @@
 require_once('include/utils/utils.php');
 require_once('include/utils/UserInfoUtil.php');
 require_once('modules/Webmails/Webmail.php');
-require_once("modules/Webmails/MailParse.php");
 
 if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] != $current_user->id) {echo "ajax failed";flush();exit();}
 
 $mailInfo = getMailServerInfo($current_user);
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
 
 $mailid=$_REQUEST["mailid"];
 if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";}
 
-$mbox = getImapMbox($mailbox,$temprow);
+global $mbox;
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
+
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
+
 
 $email = new Webmail($mbox,$mailid);
 $email->loadMail();

Modified: vtigercrm/trunk/modules/Webmails/dlAttachments.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/dlAttachments.php (original)
+++ vtigercrm/trunk/modules/Webmails/dlAttachments.php Fri May 26 11:32:49 2006
@@ -3,15 +3,27 @@
 require_once('include/utils/UserInfoUtil.php');
 require_once('include/utils/utils.php');
 require_once('modules/Webmails/Webmail.php');
-require_once("modules/Webmails/MailParse.php");
-
+
 $mailInfo = getMailServerInfo($current_user);
 $temprow = $adb->fetch_array($mailInfo);
+$login_username= $temprow["mail_username"];
+$secretkey=$temprow["mail_password"];
 $imapServerAddress=$temprow["mail_servername"];
 $box_refresh=$temprow["box_refresh"];
 $mails_per_page=$temprow["mails_per_page"];
+$mail_protocol=$temprow["mail_protocol"];
+$ssltype=$temprow["ssltype"];
+$sslmeth=$temprow["sslmeth"];
 
-$mbox = getImapMbox($mailbox,$temprow);
+if($ssltype == "") {$ssltype = "notls";}
+if($sslmeth == "") {$sslmeth = "novalidate-cert";}
+if(!preg_match("/windows/i",php_uname()))
+	$mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/".$ssltype."/".$sslmeth."}".$mailbox, $login_username, $secretkey);
+
+if(!$mbox)
+        $mbox = @imap_open("{".$imapServerAddress."/".$mail_protocol."/}".$mailbox, $login_username, $secretkey) or die("Connection to server failed ".imap_last_error());
+
+
 
 $mailid=$_REQUEST["mailid"];
 $num=$_REQUEST["num"];





More information about the vtigercrm-commits mailing list