diff --git a/oss/vtiger/trunk/modules/Webmails/CallRelatedList.php b/oss/vtiger/trunk/modules/Webmails/CallRelatedList.php new file mode 100644 index 00000000..0173a9fa --- /dev/null +++ b/oss/vtiger/trunk/modules/Webmails/CallRelatedList.php @@ -0,0 +1,93 @@ +fetch_array($mailInfo); +$imapServerAddress=$temprow["mail_servername"]; +$start_message=vtlib_purify($_REQUEST["start_message"]); +$box_refresh=$temprow["box_refresh"]; +$mails_per_page=$temprow["mails_per_page"]; + +if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=vtlib_purify($_REQUEST["mailbox"]);} else {$mailbox="INBOX";} + +global $mbox; +$mbox = getImapMbox($mailbox,$temprow); + +$email = new Webmails($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 vtiger_leaddetails.firstname, vtiger_leaddetails.lastname, vtiger_leaddetails.email, vtiger_leaddetails.company, vtiger_crmentity.smownerid from vtiger_leaddetails left join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid WHERE vtiger_leaddetails.leadid=?"; + $rs = $adb->pquery($q, array($email->relationship["id"])); + $block["Leads"]["header"]= array("0"=>"First Name","1"=>"Last Name","2"=>"Company Name","3"=>"Email Address","4"=>"Assigned To"); + $block["Leads"]["entries"]= array("0"=>array($adb->query_result($rs,0,'firstname'),"1"=>$adb->query_result($rs,0,'lastname'),2=>$adb->query_result($rs,0,'company'),3=>$adb->query_result($rs,0,'email'),4=>$adb->query_result($rs,0,'smownerid'))); +} +$block["Contacts"]= ""; +if($email->relationship != 0 && $email->relationship["type"] == "Contacts") { + $q = "SELECT vtiger_contactdetails.firstname, vtiger_contactdetails.lastname, vtiger_contactdetails.email, vtiger_contactdetails.title, vtiger_crmentity.smownerid from vtiger_contactdetails left join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid WHERE vtiger_contactdetails.contactid=?"; + $rs = $adb->pquery($q, array($email->relationship["id"])); + $block["Contacts"]["header"]= array("0"=>"First Name","1"=>"Last Name","2"=>"Title","3"=>"Email Address","4"=>"Assigned To"); + $block["Contacts"]["entries"]= array("0"=>array($adb->query_result($rs,0,'firstname'),"1"=>$adb->query_result($rs,0,'lastname'),2=>$adb->query_result($rs,0,'title'),3=>$adb->query_result($rs,0,'email'),4=>$adb->query_result($rs,0,'smownerid'))); +} +$block["Accounts"]= ""; +if($email->relationship != 0 && $email->relationship["type"] == "Accounts") { + $q = "SELECT acccount.accountname, vtiger_account.email1, vtiger_account.website, vtiger_account.industry, vtiger_crmentity.smownerid from vtiger_account left join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid WHERE vtiger_account.accountid=?"; + $rs = $adb->pquery($q, array($email->relationship["id"])); + $block["Accounts"]["header"]= array("0"=>"Account Name","1"=>"Email","2"=>"Web Site","3"=>"Industry","4"=>"Assigned To"); + $block["Accounts"]["entries"]= array("0"=>array($adb->query_result($rs,0,'accountname'),"1"=>$adb->query_result($rs,0,'email'),2=>$adb->query_result($rs,0,'website'),3=>$adb->query_result($rs,0,'industry'),4=>$adb->query_result($rs,0,'smownerid'))); +} + +global $mod_strings; +global $app_strings; +global $theme; +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; + +$smarty = new vtigerCRM_Smarty; +$smarty->assign("CATEGORY","My Home Page"); +$smarty->assign("id",vtlib_purify($_REQUEST["record"])); +$smarty->assign("NAME","From: ".$from); +$smarty->assign("RELATEDLISTS", $block); +$smarty->assign("SINGLE_MOD","Webmails"); +$smarty->assign("MODULE", "Webmails"); +$smarty->assign("ID",vtlib_purify($_REQUEST["record"])); +$smarty->assign("MOD",$mod_strings); +$smarty->assign("APP",$app_strings); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); +$smarty->display("RelatedLists.tpl"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Webmails/DetailView.php b/oss/vtiger/trunk/modules/Webmails/DetailView.php new file mode 100644 index 00000000..c25ed395 --- /dev/null +++ b/oss/vtiger/trunk/modules/Webmails/DetailView.php @@ -0,0 +1,37 @@ +mbox,$mailid); +$elist = $MailBox->mailList["overview"][($mailid-1)]; + +echo '
| '; + +echo ' |
| + + + + | +||
| : | +||
| ||
| ".$mod_strings['LBL_NO_ATTACHMENTS']." | ||
|
';
+ }
+ else
+ $attach = ' ';
+ // Check Status Line with UCB POP Server to
+ // see if this is a new message. This is a
+ // non-RFC standard line header.
+ // Set this in conf.php
+ if ($conf->have_ucb_pop_server)
+ {
+ $header_msg = $pop->fetchheader($pop->msgno($msgnum), $ev);
+ if(NoccException::isException($ev)) return;
+ $header_lines = explode("\r\n", $header_msg);
+ while (list($k, $v) = each($header_lines))
+ {
+ list ($header_field, $header_value) = explode(':', $v);
+ if ($header_field == 'Status')
+ $new_mail_from_header = $header_value;
+ }
+ }
+ else
+ {
+ if (($ref_contenu_message->Unseen == 'U') || ($ref_contenu_message->Recent == 'N'))
+ $new_mail_from_header = '';
+ else
+ $new_mail_from_header = ' ';
+ }
+ if ($new_mail_from_header == '')
+ $newmail = '
';
+ else
+ $newmail = ' ';
+ $timestamp = chop($ref_contenu_message->udate);
+ $date = format_date($timestamp, $lang);
+ $time = format_time($timestamp, $lang);
+ $msg_list[$i] = Array(
+ 'new' => $newmail,
+ 'number' => $pop->msgno($msgnum),
+ 'attach' => $attach,
+ 'to' => $to,
+ 'from' => $from,
+ 'subject' => $subject,
+ 'date' => $date,
+ 'time' => $time,
+ 'complete_date' => $date,
+ 'size' => $msg_size,
+ 'sort' => $sort,
+ 'sortdir' => $sortdir);
+ }
+ return ($msg_list);
+}
+
+
+/* ----------------------------------------------------- */
+
+// BUG: returns text/plain when Content-Type: application/x-zip (e.g.)
+
+function GetSinglePart(&$attach_tab, &$this_part, &$header, &$body)
+{
+ if (eregi('text/html', $header))
+ $full_mime_type = 'text/html';
+ else
+ $full_mime_type = 'text/plain';
+
+ if (isset($this_part->encoding))
+ {
+ switch ($this_part->encoding)
+ {
+ case 0:
+ $encoding = '7BIT';
+ break;
+ case 1:
+ $encoding = '8BIT';
+ break;
+ case 2:
+ $encoding = 'BINARY';
+ break;
+ case 3:
+ $encoding = 'BASE64';
+ break;
+ case 4:
+ $encoding = 'QUOTED-PRINTABLE';
+ break;
+ case 5:
+ $encoding = 'OTHER';
+ break;
+ default:
+ $encoding = 'none';
+ break;
+ }
+ }
+ else
+ {
+ $encoding = '7BIT';
+ }
+ $charset = '';
+ if ($this_part->ifparameters)
+ while ($obj = array_pop($this_part->parameters))
+ if (strtolower($obj->attribute) == 'charset')
+ {
+ $charset = $obj->value;
+ break;
+ }
+ $tmpvar = Array(
+ 'number' => 1,
+ 'id' => $this_part->ifid ? $this_part->id : 0,
+ 'name' => '',
+ 'mime' => $full_mime_type,
+ 'transfer' => $encoding,
+ 'disposition' => $this_part->ifdisposition ? $this_part->disposition : '',
+ 'charset' => $charset
+ );
+ if(isset($this_part->bytes))
+ $tmpvar['size'] = ($this_part->bytes > 1000) ? ceil($this_part->bytes / 1000) : 1;
+
+ array_unshift($attach_tab, $tmpvar);
+}
+
+/* ----------------------------------------------------- */
+
+function remove_stuff(&$body, &$mime)
+{
+ $PHP_SELF = $_SERVER['PHP_SELF'];
+
+ $lang = $_SESSION['nocc_lang'];
+
+ if (eregi('html', $mime))
+ {
+ $to_removed_array = array (
+ "''si",
+ "''si",
+ "']*>'si",
+ "''si",
+ "']*>.*?'si",
+ "''si",
+ "''si",
+ "''si",
+ "''si",
+ "''si",
+ "'\\2\\3\\4', $body); // |code|
+
+ }
+ $body = nl2br($body);
+ if (function_exists('wordwrap'))
+ $body = wordwrap($body, 80, "\n");
+ }
+ return ($body);
+}
+
+/* ----------------------------------------------------- */
+
+function link_att(&$mail, $attach_tab, &$display_part_no)
+{
+ sort($attach_tab);
+ $link = '';
+ while ($tmp = array_shift($attach_tab))
+ if (!empty($tmp['name']))
+ {
+ $mime = str_replace('/', '-', $tmp['mime']);
+ if ($display_part_no == true)
+ $link .= $tmp['number'] . ' ';
+ unset($att_name);
+ $att_name_array = imap_mime_header_decode($tmp['name']);
+ for ($i=0; $i".$ev->getMessage."
"; + } + $text = $pop->fetchbody($mail, $part_no, $ev); + if(NoccException::isException($ev)) { + return "".$ev->getMessage."
"; + } + if ($transfer == 'BASE64') + $str = nl2br(nocc_imap::base64($text)); + elseif($transfer == 'QUOTED-PRINTABLE') + $str = nl2br(quoted_printable_decode($text)); + else + $str = nl2br($text); + //if (eregi('koi', $transfer) || eregi('windows-1251', $transfer)) + // $str = @convert_cyr_string($str, $msg_charset, $charset); + return ($str); +} + +/* ----------------------------------------------------- */ + +function encode_mime(&$string, &$charset) +{ + /*$text = '=?' . $charset . '?Q?'; + for($i = 0; $i < strlen($string); $i++ ) + { + $val = ord($string[$i]); + $val = dechex($val); + $text .= '=' . $val; + } + $text .= '?='; + return ($text); + */ + $string = rawurlencode($string); + $string = str_replace('%', '=', $string); + $string = '=?' . $charset . '?Q?' . $string . '?='; + return ($string); +} + +/* ----------------------------------------------------- */ + +// This function removes temporary attachment files and +// removes any attachment information from the session +function clear_attachments() +{ + global $conf; + if (isset($_SESSION['nocc_attach_array']) && is_array($_SESSION['nocc_attach_array'])) + while ($tmpvar = array_shift($_SESSION['nocc_attach_array'])) + @unlink($conf->tmpdir.'/'.$tmpvar->tmp_file); + unset($_SESSION['nocc_attach_array']); +} + +/* ----------------------------------------------------- */ + +// This function chops the