[Vtigercrm-commits] [vtiger-commits] r6514 - /vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri May 26 22:11:23 EDT 2006
Author: mmbrich
Date: Fri May 26 20:11:22 2006
New Revision: 6514
Log:
fix for tagcloud errors
Modified:
vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
Modified: vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/WebmailsAjax.php (original)
+++ vtigercrm/trunk/modules/Webmails/WebmailsAjax.php Fri May 26 20:11:22 2006
@@ -9,67 +9,69 @@
*
********************************************************************************/
-session_start();
-if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] == "") {exit();}
+if($_POST["command"]) {
-ini_set("include_path","../../");
-require_once('config.php');
-require_once('include/database/PearDatabase.php');
-require_once('include/logging.php');
-require_once('include/utils/utils.php');
-require_once('include/utils/UserInfoUtil.php');
-require_once('modules/Webmails/MailParse.php');
+ session_start();
+ if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] == "") {exit();}
-global $adb,$mbox,$current_user;
+ ini_set("include_path","../../");
+ require_once('config.php');
+ require_once('include/database/PearDatabase.php');
+ require_once('include/logging.php');
+ require_once('include/utils/utils.php');
+ require_once('include/utils/UserInfoUtil.php');
+ require_once('modules/Webmails/MailParse.php');
-$sql = "select * from mail_accounts where status=1 and user_id='".$_SESSION["authenticated_user_id"]."'";
-$mailInfo = $adb->query($sql);
+ global $adb,$mbox,$current_user;
-if($adb->num_rows($mailInfo) < 1) {
- echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
- exit();
+ $sql = "select * from mail_accounts where status=1 and user_id='".$_SESSION["authenticated_user_id"]."'";
+ $mailInfo = $adb->query($sql);
+
+ if($adb->num_rows($mailInfo) < 1) {
+ echo "<center><font color='red'><h3>Please configure your mail settings</h3></font></center>";
+ exit();
+ }
+
+ $temprow = $adb->fetch_array($mailInfo);
+ $imapServerAddress=$temprow["mail_servername"];
+ $box_refresh=$temprow["box_refresh"];
+ $mails_per_page=$temprow["mails_per_page"];
+ $account_name=$temprow["account_name"];
+ $show_hidden=$_REQUEST["show_hidden"];
+
+ $mbox = getImapMbox($mailbox,$temprow);
+
+ $search = imap_search($mbox, "NEW ALL");
+ if($search === false) {echo "";flush();exit();}
+
+ $data = imap_fetch_overview($mbox,implode(',',$search));
+ $num=sizeof($data);
+
+ $ret = '';
+ if($num > 0) {
+ $ret = '{"mails":[';
+ for($i=0;$i<$num;$i++) {
+ $ret .= '{"mail":';
+ $ret .= '{';
+ $ret .= '"mailid":"'.$data[$i]->msgno.'",';
+ $ret .= '"subject":"'.substr($data[$i]->subject,0,40).'",';
+ $ret .= '"date":"'.substr($data[$i]->date,0,30).'",';
+ $ret .= '"from":"'.substr($data[$i]->from,0,20).'",';
+ $ret .= '"to":"'.$data[$i]->to.'",';
+ if(getAttachmentDetails($data[$i]->msgno,$mbox) || getInlineAttachments($data[$i]->msgno,$mbox))
+ $ret .= '"attachments":"1"}';
+ else
+ $ret .= '"attachments":"0"}';
+ if(($i+1) == $num)
+ $ret .= '}';
+ else
+ $ret .= '},';
+ }
+ $ret .= ']}';
+ }
+
+ echo $ret;
+ flush();
+ imap_close($mbox);
}
-
-$temprow = $adb->fetch_array($mailInfo);
-$imapServerAddress=$temprow["mail_servername"];
-$box_refresh=$temprow["box_refresh"];
-$mails_per_page=$temprow["mails_per_page"];
-$account_name=$temprow["account_name"];
-$show_hidden=$_REQUEST["show_hidden"];
-
-$mbox = getImapMbox($mailbox,$temprow);
-
-$search = imap_search($mbox, "NEW ALL");
-if($search === false) {echo "";flush();exit();}
-
-$data = imap_fetch_overview($mbox,implode(',',$search));
-$num=sizeof($data);
-
-$ret = '';
-if($num > 0) {
- $ret = '{"mails":[';
- for($i=0;$i<$num;$i++) {
- $part = imap_fetchstructure($mbox,$data[$i]->msgno);
- $ret .= '{"mail":';
- $ret .= '{';
- $ret .= '"mailid":"'.$data[$i]->msgno.'",';
- $ret .= '"subject":"'.substr($data[$i]->subject,0,40).'",';
- $ret .= '"date":"'.substr($data[$i]->date,0,30).'",';
- $ret .= '"from":"'.substr($data[$i]->from,0,20).'",';
- $ret .= '"to":"'.$data[$i]->to.'",';
- if(getAttachmentDetails($data[$i]->msgno,$mbox) || getInlineAttachments($data[$i]->msgno,$mbox))
- $ret .= '"attachments":"1"}';
- else
- $ret .= '"attachments":"0"}';
- if(($i+1) == $num)
- $ret .= '}';
- else
- $ret .= '},';
- }
- $ret .= ']}';
-}
-
-echo $ret;
-flush();
-imap_close($mbox);
?>
More information about the vtigercrm-commits
mailing list