添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@110 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
global $current_user;
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('modules/Leads/Leads.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('data/Tracker.php');
|
||||
require_once('include/upload_file.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
require_once('modules/Webmails/MailParse.php');
|
||||
|
||||
global $log;
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
|
||||
if($_REQUEST["record"]) {$mailid=vtlib_purify($_REQUEST["record"]);} else {$mailid=vtlib_purify($_REQUEST["mailid"]);}
|
||||
|
||||
$mailInfo = getMailServerInfo($current_user);
|
||||
$temprow = $adb->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");
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once("modules/Webmails/Webmails.php");
|
||||
require_once("modules/Webmails/MailBox.php");
|
||||
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") { $mailbox=vtlib_purify($_REQUEST["mailbox"]);} else { $mailbox = "INBOX";}
|
||||
if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") { $mailid=vtlib_purify($_REQUEST["mailid"]);} else { echo "ERROR";flush();exit();}
|
||||
|
||||
global $MailBox;
|
||||
$MailBox = new MailBox($mailbox);
|
||||
|
||||
$webmail = new Webmails($MailBox->mbox,$mailid);
|
||||
$elist = $MailBox->mailList["overview"][($mailid-1)];
|
||||
|
||||
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0" class="previewWindow"><tr>';
|
||||
|
||||
echo '<td>';
|
||||
|
||||
echo '</td></tr>';
|
||||
$array_tab = Array();
|
||||
$webmail->loadMail($array_tab);
|
||||
|
||||
echo '<tr><td align="center"><iframe src="index.php?module=Webmails&action=body&fullview=true&mailid='.$mailid.'&mailbox='.$mailbox.'" width="100%" height="600" frameborder="0" style="border:1px solid gray">'.$mod_strings['LBL_NO_IFRAMES_SUPPORTED'].'</iframe></td></tr>';
|
||||
|
||||
echo '</table>';
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
function get_validate_record_js() {
|
||||
|
||||
}
|
||||
function get_new_record_form () {
|
||||
$the_form = '<table width="100%" class="leftFormTable" cellpadding="0" cellspacing="0" border="0" align="center"><tbody><tr>';
|
||||
$the_form .= '<td class="leftFormHeader" align="left" height="20" nowrap="nowrap" valign="middle">Folders</td></tbody></tr></table>';
|
||||
$the_form .= '<table width="100%" cellpadding="2" cellspacing="0" border="0" align="center" class="leftFormBorder1"><tr> <form><td nowrap>';
|
||||
$the_boxes=array();
|
||||
if (is_array($list)) {
|
||||
foreach ($list as $key => $val) {
|
||||
$the_boxes[] = $val->name;
|
||||
}
|
||||
}
|
||||
sort($the_boxes);
|
||||
for($i=0;$i<count($the_boxes);$i++) {
|
||||
$the_form .= "<a href='index.php?module=Webmails&action=index&mailbox=".preg_replace(array("/\{.*?\}/i"),array(""),$the_boxes[$i])."' id='".$the_boxes[$i]."'>".preg_replace(array("/\{.*?\}/i"),array(""),$the_boxes[$i])."</a><br>";
|
||||
}
|
||||
|
||||
$the_form .= get_left_form_footer();
|
||||
$the_form .= get_validate_record_js();
|
||||
|
||||
return $the_form;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {
|
||||
$mailbox=$_REQUEST["mailbox"];
|
||||
} else {
|
||||
$mailbox="INBOX";
|
||||
}
|
||||
|
||||
if($_REQUEST["start"] && $_REQUEST["start"] != "") {
|
||||
$start=vtlib_purify($_REQUEST["start"]);
|
||||
} else {
|
||||
$start="1";
|
||||
}
|
||||
$show_hidden=vtlib_purify($_REQUEST["show_hidden"]);
|
||||
|
||||
global $current_user;
|
||||
|
||||
require_once('Smarty_setup.php');
|
||||
require_once("data/Tracker.php");
|
||||
require_once('include/logging.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once("modules/Webmails/MailBox.php");
|
||||
require_once("modules/Webmails/Webmails.php");
|
||||
require_once("modules/Webmails/MailParse.php");
|
||||
|
||||
$MailBox = new MailBox($mailbox);
|
||||
|
||||
// Check for a valid mailbox and also make sure the needed php_imap module is installed
|
||||
$mods = parsePHPModules();
|
||||
|
||||
if(!$MailBox->mbox || !isset($mods["imap"]) || $mods["imap"] == "") {
|
||||
echo "<center><font color='red'><h3>".$mod_strings['LBL_CONFIGURE_MAIL_SETTINGS']."</h3></font></center>";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Set the system into degraded service mode where needed
|
||||
$degraded_service='false';
|
||||
if($MailBox->mail_protocol == "imap" || $MailBox->mail_protocol == "pop3")
|
||||
$degraded_service='true';
|
||||
|
||||
$save_path=$root_directory.'modules/Webmails/tmp';
|
||||
$user_dir=$save_path."/".$_SESSION["authenticated_user_id"];
|
||||
|
||||
// Get the list of mails for this mailbox
|
||||
$elist = $MailBox->mailList;
|
||||
$numEmails = $elist["count"];
|
||||
$headers = $elist["headers"];
|
||||
$mails_per_page = $MailBox->mails_per_page;
|
||||
|
||||
// Calculate paging information ahead before retrieving overviews
|
||||
if($start == 1 || $start == "") {
|
||||
$start_message=$numEmails;
|
||||
if($numEmails > $mails_per_page) $end_message = $start_message - $mails_per_page;
|
||||
else $end_message = $start_message - $numEmails;
|
||||
} else {
|
||||
$start_message=($numEmails-(($start-1)*$mails_per_page));
|
||||
$end_message = ($numEmails-(($start)*$mails_per_page));
|
||||
if($end_message < 0) $end_message = 0;
|
||||
}
|
||||
|
||||
// If in search mode, load overview of all the available emails
|
||||
if(isset($_REQUEST["search"])) {
|
||||
// TODO: Navigating when search is used needs to be added
|
||||
$MailBox->loadOverviewList(1, $numEmails);
|
||||
} else {
|
||||
// For normal listview, fetch only required mail overview
|
||||
$MailBox->loadOverviewList($start_message, $end_message);
|
||||
}
|
||||
|
||||
// Fetch meta-info again after overview is loaded, for further process
|
||||
$elist = $MailBox->mailList;
|
||||
$headers = $elist["headers"];
|
||||
// END
|
||||
|
||||
$c=$numEmails;
|
||||
|
||||
if(!isset($_REQUEST["search"])) {
|
||||
$numPages = ceil($numEmails/$MailBox->mails_per_page);
|
||||
if($numPages > 1) {
|
||||
if($start != 1){
|
||||
$navigationOutput = "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',1);\" ><img src='modules/Webmails/images/start.gif' border='0'></a> ";
|
||||
$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start-1).");\" ><img src='modules/Webmails/images/previous.gif' border='0'></a> ";
|
||||
}
|
||||
if($start <= ($numPages-1)){
|
||||
$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start+1).");\" ><img src='modules/Webmails/images/next.gif' border='0'></a> ";
|
||||
$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".$numPages.");\"><img src='modules/Webmails/images/end.gif' border='0'></a> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
$js_array = "";
|
||||
$overview=$elist["overview"];
|
||||
$mails = array();
|
||||
if (is_array($overview))
|
||||
{
|
||||
foreach ($overview as $val)
|
||||
{
|
||||
$mails[$val->msgno] = $val;
|
||||
$hdr = @imap_headerinfo($MailBox->mbox, $val->msgno);
|
||||
$val->from = utf8_decode(utf8_encode(imap_utf8(addslashes($val->from))));
|
||||
$val->to = utf8_decode(utf8_encode(imap_utf8(addslashes($val->to))));
|
||||
$val->subject = utf8_decode(utf8_encode(imap_utf8($val->subject)));
|
||||
$to = str_replace("<",":",$val->to);
|
||||
$to_list = str_replace(">","",$to);
|
||||
$from = str_replace("<",":",$val->from);
|
||||
$from_list = str_replace(">","",$from);
|
||||
$cc = str_replace("<",":",$hdr->ccaddress);
|
||||
$cc_list = str_replace(">","",$cc);
|
||||
|
||||
$cc_list = addslashes($cc_list);
|
||||
/*$js_array .= "webmail2[".$val->msgno."] = new Array();";
|
||||
$js_array .= "webmail2[".$val->msgno."]['from'] = '".addslashes($from_list)."';";
|
||||
$js_array .= "webmail2[".$val->msgno."]['to'] = '".addslashes($to_list)."';";
|
||||
$js_array .= "webmail2[".$val->msgno."]['subject'] = '".addslashes($val->subject)."';";
|
||||
$js_array .= "webmail2[".$val->msgno."]['date'] = '".addslashes($val->date)."';";
|
||||
$js_array .= "webmail2[".$val->msgno."]['cc'] = '".$cc_list."';";*/
|
||||
}
|
||||
}
|
||||
$search_fields = Array("SUBJECT","BODY","TO","CC","BCC","FROM");
|
||||
$listview_header = array("<th class='tableHeadBg' width='10%'>".$mod_strings['LBL_INFO']."</th>","<th class='tableHeadBg' width='45%'>".$mod_strings['LBL_LIST_SUBJECT']."</th>","<th class='tableHeadBg' width='25%'>".$mod_strings['LABEL_DATE']."</th>","<th class='tableHeadBg' width='10%'>".$mod_strings['LABEL_FROM']."</th>","<th class='tableHeadBg' >".$mod_strings['LBL_DEL']."</th>");
|
||||
$listview_entries = array();
|
||||
|
||||
$displayed_msgs=0;
|
||||
$info = imap_mailboxmsginfo($MailBox->mbox);
|
||||
$unread_msgs = $info->Unread;
|
||||
//$new_msgs=0;
|
||||
if(($numEmails) <= 0)
|
||||
$listview_entries[0][] = '<td colspan="6" width="100%" align="center"><b>'.$mod_strings['LBL_NO_EMAILS'].'</b></td>';
|
||||
else {
|
||||
|
||||
if(isset($_REQUEST["search"]) && trim($_REQUEST["search_input"]) != '') {
|
||||
$searchstring = vtlib_purify($_REQUEST["search_type"]).' "'.vtlib_purify($_REQUEST["search_input"]).'"';
|
||||
//echo $searchstring."<br>";
|
||||
$searchlist = Array();
|
||||
$searchlist = imap_search($MailBox->mbox,$searchstring);
|
||||
|
||||
if(is_array($searchlist))
|
||||
{
|
||||
$num_searches = count($searchlist);
|
||||
$c=$numEmails;
|
||||
}
|
||||
|
||||
while ($i<=$c) {
|
||||
if(is_array($searchlist)) {
|
||||
for($l=0;$l<$num_searches;$l++) {
|
||||
if($mails[$start_message]->msgno == $searchlist[$l])
|
||||
$listview_entries[] = show_msg($mails,$start_message);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
$start_message--;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$i=1;
|
||||
while ($i<=$c) {
|
||||
if($start_message > 0)
|
||||
{
|
||||
$listview_entries[] = show_msg($mails,$start_message);
|
||||
if($displayed_msgs == $MailBox->mails_per_page) {break;}
|
||||
}
|
||||
$i++;
|
||||
$start_message--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
flush();
|
||||
// MAIN LOOP
|
||||
// Main loop to create listview entries
|
||||
|
||||
}
|
||||
|
||||
$search_html = '<select name="optionSel" class="importBox" id="search_type">';
|
||||
foreach($search_fields as $searchfield)
|
||||
{
|
||||
if($_REQUEST['search_type'] == $searchfield)
|
||||
$search_html .= '<option selected value="'.$searchfield.'">'.$mod_strings["IN"].' '.$mod_strings[$searchfield].'</option>';
|
||||
else
|
||||
$search_html .= '<option value="'.$searchfield.'">'.$mod_strings["IN"].' '.$mod_strings[$searchfield].'</option>';
|
||||
|
||||
}
|
||||
$search_html .= '</select>';
|
||||
|
||||
// Build folder list and move_to dropdown box
|
||||
$list = imap_getmailboxes($MailBox->mbox, "{".$MailBox->imapServerAddress."}", "*");
|
||||
sort($list);
|
||||
$i=0;
|
||||
if (is_array($list)) {
|
||||
$boxes = '<select name="mailbox" id="mailbox_select" onChange="move_messages();">';
|
||||
$boxes .= '<option value="move_to" SELECTED>'.$mod_strings['LBL_MOVE_TO'].'</option>';
|
||||
foreach ($list as $key => $val) {
|
||||
$tmpval = preg_replace(array("/\{.*?\}/i"),array(""),$val->name);
|
||||
if(preg_match("/trash/i",$tmpval))
|
||||
$img = "webmail_trash.gif";
|
||||
elseif($_REQUEST["mailbox"] == $tmpval)
|
||||
$img = "opened_folder.gif";
|
||||
else
|
||||
$img = "folder.gif";
|
||||
|
||||
$i++;
|
||||
|
||||
if($_REQUEST["mailbox"] == '')
|
||||
$_REQUEST["mailbox"] = 'INBOX';
|
||||
|
||||
if ($_REQUEST["mailbox"] == $tmpval) {
|
||||
/* if($tmpval != "INBOX")
|
||||
$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
|
||||
*/
|
||||
$_SESSION["mailboxes"][$tmpval] = $new_msgs;
|
||||
if($tmpval[0] != ".")
|
||||
{
|
||||
if($numEmails==0) {$num=$numEmails;} else {$num=($numEmails-1);}
|
||||
$folders .= '<li style="padding-left:0px;"><img src="themes/images/'.$img.'"align="absmiddle" /> <a href="javascript:changeMbox(\''.$tmpval.'\');" class="small">'.$tmpval.'</a> <span id="'.$tmpval.'_count" style="font-weight:bold">';
|
||||
if($unread_msgs > 0)
|
||||
$folders .= '(<span id="'.$tmpval.'_unread">'.$unread_msgs.'</span>)</span> <span id="remove_'.$tmpval.'" style="position:relative;display:none">Remove</span></li>';
|
||||
else
|
||||
$folders .='</span></li>';
|
||||
}
|
||||
|
||||
} else {
|
||||
$box = imap_status($MailBox->mbox, "{".$MailBox->imapServerAddress."}".$tmpval, SA_ALL);
|
||||
$_SESSION["mailboxes"][$tmpval] = $box->unseen;
|
||||
if($tmpval[0] != ".")
|
||||
{
|
||||
if($box->messages==0) {$num=$box->messages;} else {$num=($box->messages-1);}
|
||||
$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
|
||||
$folders .= '<li ><img src="themes/images/'.$img.'" align="absmiddle" /> <a href="javascript:changeMbox(\''.$tmpval.'\');" class="small">'.$tmpval.'</a> <span id="'.$tmpval.'_count" style="font-weight:bold">';
|
||||
if($box->unseen > 0)
|
||||
$folders .= '(<span id="'.$tmpval.'_unread">'.$box->unseen.'</span>)</span></li>';
|
||||
else
|
||||
$folders .='</span></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$boxes .= '</select>';
|
||||
}
|
||||
imap_close($MailBox->mbox);
|
||||
//echo '<div id="js_arr" style="display:none">'.$js_array.'</div>';
|
||||
$smarty = new vtigerCRM_Smarty;
|
||||
//$smarty->assign("USERID", $current_user->id);
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("THEME", $theme);
|
||||
$smarty->assign("UNREAD_COUNT",$unread_msgs);
|
||||
$smarty->assign("LISTENTITY", $listview_entries);
|
||||
$smarty->assign("LISTHEADER", $listview_header);
|
||||
$smarty->assign("NAVIGATION", $navigationOutput);
|
||||
$smarty->assign("FOLDER_SELECT", $boxes);
|
||||
$smarty->assign("NUM_EMAILS", $numEmails);
|
||||
$smarty->assign("MAILBOX", $MailBox->mailbox);
|
||||
$smarty->assign("ACCOUNT", $MailBox->display_name);
|
||||
$smarty->assign("BOXLIST",$folders);
|
||||
$smarty->assign("MAIL_INFO",$js_array);
|
||||
$smarty->display("ListViewAjax.tpl");
|
||||
?>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
include_once('config.php');
|
||||
require_once('include/logging.php');
|
||||
require_once('include/utils/utils.php');
|
||||
|
||||
class MailBox {
|
||||
|
||||
var $mbox;
|
||||
var $db;
|
||||
var $boxinfo;
|
||||
var $readonly='false';
|
||||
var $enabled;
|
||||
|
||||
var $login_username;
|
||||
var $secretkey;
|
||||
var $imapServerAddress;
|
||||
var $ssltype;
|
||||
var $sslmeth;
|
||||
var $box_refresh;
|
||||
var $mails_per_page;
|
||||
var $mail_protocol;
|
||||
var $account_name;
|
||||
var $display_name;
|
||||
var $mailbox;
|
||||
var $mailList;
|
||||
|
||||
function MailBox($mailbox = '') {
|
||||
global $current_user;
|
||||
require_once('include/utils/encryption.php');
|
||||
$oencrypt = new Encryption();
|
||||
|
||||
$this->db = PearDatabase::getInstance();
|
||||
$this->db->println("Entering MailBox($mailbox)");
|
||||
|
||||
$this->mailbox = $mailbox;
|
||||
$tmp = getMailServerInfo($current_user);
|
||||
|
||||
if($this->db->num_rows($tmp) < 1)
|
||||
$this->enabled = 'false';
|
||||
else
|
||||
$this->enabled = 'true';
|
||||
|
||||
$this->boxinfo = $this->db->fetch_array($tmp);
|
||||
|
||||
$this->login_username=trim($this->boxinfo["mail_username"]);
|
||||
$this->secretkey=$oencrypt->decrypt(trim($this->boxinfo["mail_password"]));
|
||||
$this->imapServerAddress=gethostbyname(trim($this->boxinfo["mail_servername"]));
|
||||
$this->mail_protocol=$this->boxinfo["mail_protocol"];
|
||||
$this->ssltype=$this->boxinfo["ssltype"];
|
||||
$this->sslmeth=$this->boxinfo["sslmeth"];
|
||||
|
||||
$this->box_refresh=trim($this->boxinfo["box_refresh"]);
|
||||
$this->mails_per_page=trim($this->boxinfo["mails_per_page"]);
|
||||
if($this->mails_per_page < 1)
|
||||
$this->mails_per_page=20;
|
||||
|
||||
$this->account_name=$this->boxinfo["account_name"];
|
||||
$this->display_name=$this->boxinfo["display_name"];
|
||||
//$this->imapServerAddress=$this->boxinfo["mail_servername"];
|
||||
|
||||
$this->db->println("Setting Mailbox Name");
|
||||
if($this->mailbox != "")
|
||||
$this->mailbox=$mailbox;
|
||||
|
||||
$this->db->println("Opening Mailbox");
|
||||
if(!$this->mbox && $this->mailbox != "")
|
||||
$this->getImapMbox();
|
||||
|
||||
$this->db->println("Loading mail list");
|
||||
if($this->mbox)
|
||||
$this->mailList = $this->fullMailList();
|
||||
|
||||
$this->db->println("Exiting MailBox($mailbox)");
|
||||
}
|
||||
|
||||
function loadOverviewList($start, $end) {
|
||||
if($this->mbox) {
|
||||
if($end == 0) $end = 1;
|
||||
|
||||
$mailOverviews = @imap_fetch_overview($this->mbox, "$start:$end", 0);
|
||||
$this->mailList['headers'] = Array();
|
||||
$this->mailList['overview'] = $mailOverviews;
|
||||
}
|
||||
}
|
||||
|
||||
function fullMailList() {
|
||||
/*$mailHeaders = @imap_headers($this->mbox);
|
||||
$numEmails = sizeof($mailHeaders);
|
||||
$mailOverviews = @imap_fetch_overview($this->mbox, "1:$numEmails", 0);
|
||||
$out = array("headers"=>$mailHeaders,"overview"=>$mailOverviews,"count"=>$numEmails);& */
|
||||
|
||||
$numEmails = @imap_num_msg($this->mbox);
|
||||
$out = array("count" => $numEmails);
|
||||
return $out;
|
||||
}
|
||||
|
||||
function isBase64($iVal){
|
||||
$_tmp=preg_replace("/[^A-Z0-9\+\/\=]/i","",$iVal);
|
||||
return (strlen($_tmp) % 4 == 0 ) ? "y" : "n";
|
||||
}
|
||||
|
||||
function getImapMbox() {
|
||||
$this->db->println("Entering getImapMbox()");
|
||||
$mods = parsePHPModules();
|
||||
$this->db->println("Parsing PHP Modules");
|
||||
|
||||
// first we will try a regular old IMAP connection:
|
||||
if($this->ssltype == "") {$this->ssltype = "notls";}
|
||||
if($this->sslmeth == "") {$this->sslmeth = "novalidate-cert";}
|
||||
|
||||
if($this->mail_protocol == "pop3")
|
||||
$port = "110";
|
||||
else
|
||||
{
|
||||
if($mods["imap"]["SSL Support"] == "enabled" && ($this->ssltype == "tls" || $this->ssltype == "ssl"))
|
||||
$port = "993";
|
||||
else
|
||||
$port = "143";
|
||||
}
|
||||
|
||||
$this->db->println("Building connection string");
|
||||
if(preg_match("/@/",$this->login_username))
|
||||
{
|
||||
$mailparts = split("@",$this->login_username);
|
||||
$user="".trim($mailparts[0])."";
|
||||
$domain="".trim($mailparts[1])."";
|
||||
|
||||
// This section added to fix a bug when connecting as [email protected]
|
||||
if($this->readonly == "true")
|
||||
{
|
||||
if($mods["imap"]["SSL Support"] == "enabled")
|
||||
$connectString = "/".$this->ssltype."/".$this->sslmeth."/user={$user}@{$domain}/readonly";
|
||||
else
|
||||
$connectString = "/notls/novalidate-cert/user={$user}@{$domain}/readonly";
|
||||
}
|
||||
else
|
||||
{
|
||||
if($mods["imap"]["SSL Support"] == "enabled")
|
||||
$connectString = "/".$this->ssltype."/".$this->sslmeth."/user={$user}@{$domain}";
|
||||
else
|
||||
$connectString = "/notls/novalidate-cert/user={$user}@{$domain}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->readonly == "true")
|
||||
{
|
||||
if($mods["imap"]["SSL Support"] == "enabled")
|
||||
$connectString = "/".$this->ssltype."/".$this->sslmeth."/readonly";
|
||||
else
|
||||
$connectString = "/notls/novalidate-cert/readonly";
|
||||
}
|
||||
else
|
||||
{
|
||||
if($mods["imap"]["SSL Support"] == "enabled")
|
||||
$connectString = "/".$this->ssltype."/".$this->sslmeth;
|
||||
else
|
||||
$connectString = "/notls/novalidate-cert";
|
||||
}
|
||||
}
|
||||
|
||||
//$connectString = "{".$this->imapServerAddress."/".$this->mail_protocol.":".$port.$connectString."}".$this->mailbox;
|
||||
$connectString = "{".$this->imapServerAddress.":".$port."/".$this->mail_protocol.$connectString."}".$this->mailbox;
|
||||
//Reference - http://forums.vtiger.com/viewtopic.php?p=33478#33478 - which has no tls or validate-cert
|
||||
$connectString1 = "{".$this->imapServerAddress."/".$this->mail_protocol.":".$port."}".$this->mailbox;
|
||||
|
||||
$this->db->println("Done Building Connection String.. $connectString Connecting to box");
|
||||
//checking the imap support in php
|
||||
if(!function_exists('imap_open'))
|
||||
{
|
||||
echo "<strong>".$mod_strings['LBL_ENABLE_IMAP_SUPPORT']."</strong>";
|
||||
exit();
|
||||
}
|
||||
|
||||
if(!$this->mbox = @imap_open($connectString, $this->login_username, $this->secretkey))
|
||||
{
|
||||
//try second string which has no tls or validate-cert
|
||||
if(!$this->mbox = @imap_open($connectString1, $this->login_username, $this->secretkey))
|
||||
{
|
||||
global $current_user,$mod_strings;
|
||||
$this->db->println("CONNECTION ERROR - Could not be connected to the server using imap_open function through the connection strings $connectString and $connectString1");
|
||||
echo "<br> <b>".$mod_strings['LBL_MAIL_CONNECT_ERROR']."<a href='index.php?module=Users&action=AddMailAccount&return_module=Webmails&return_action=index&record=".$current_user->id."'> ".$mod_strings['LBL_HERE']."</a>. ".$mod_strings['LBL_PLEASE']." <a href='index.php?module=Emails&action=index&parenttab=".vtlib_purify($_REQUEST['parenttab'])."'>".$mod_strings['LBL_CLICK_HERE']."</a>".$mod_strings['LBL_GOTO_EMAILS_MODULE']." </b>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->println("Done connecting to box");
|
||||
}
|
||||
} // END CLASS
|
||||
|
||||
|
||||
function parsePHPModules() {
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$s = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$s = strip_tags($s,'<h2><th><td>');
|
||||
$s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
|
||||
$s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
|
||||
$vTmp = preg_split('/(<h2>[^<]+<\/h2>)/',$s,-1,PREG_SPLIT_DELIM_CAPTURE);
|
||||
$vModules = array();
|
||||
for ($i=1;$i<count($vTmp);$i++) {
|
||||
if (preg_match('/<h2>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
|
||||
$vName = trim($vMat[1]);
|
||||
$vTmp2 = explode("\n",$vTmp[$i+1]);
|
||||
foreach ($vTmp2 AS $vOne) {
|
||||
$vPat = '<info>([^<]+)<\/info>';
|
||||
$vPat3 = "/$vPat\s*$vPat\s*$vPat/";
|
||||
$vPat2 = "/$vPat\s*$vPat/";
|
||||
if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
|
||||
$vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3]));
|
||||
} elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
|
||||
$vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $vModules;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
// draw a row for the listview entry
|
||||
function show_msg($mails,$start_message)
|
||||
{
|
||||
global $MailBox,$displayed_msgs,$show_hidden,$new_msgs,$theme;
|
||||
|
||||
$num = $mails[$start_message]->msgno;
|
||||
$msg_ob = new Webmails($MailBox->mbox,$mails[$start_message]->msgno);
|
||||
// TODO: scan the current db vtiger_tables to find a
|
||||
// matching email address that will make a good
|
||||
// candidate for record_id
|
||||
// this module will also need to be able to associate to any entity type
|
||||
$record_id='';
|
||||
|
||||
if($mails[$start_message]->subject=="")
|
||||
$mails[$start_message]->subject="(No Subject)";
|
||||
|
||||
// Let's pre-build our URL parameters since it's too much of a pain not to
|
||||
$detailParams = 'record='.$num.'&mailbox='.$mailbox.'&mailid='.$num.'&parenttab=My Home Page';
|
||||
|
||||
$displayed_msgs++;
|
||||
if ($mails[$start_message]->deleted && !$show_hidden)
|
||||
{
|
||||
$flags = "<tr id='row_".$num."' class='mailSelected' style='display:none' class=\"lvtColData\" bgcolor='#ffffff'><td width='2px'><input type='checkbox' class='msg_check'></td><td colspan='1'>";
|
||||
$displayed_msgs--;
|
||||
}
|
||||
elseif ($mails[$start_message]->deleted && $show_hidden)
|
||||
{
|
||||
$flags = "<tr id='row_".$num."' class='mailSelected' class=\"lvtColData\" bgcolor='#ffffff'><td width='2px'><input type='checkbox' class='msg_check'></td><td colspan='1'>";
|
||||
}
|
||||
elseif (!$mails[$start_message]->seen || $mails[$start_message]->recent)
|
||||
{
|
||||
$flags = "<tr id='row_".$num."' class='mailSelected' class=\"lvtColData\" bgcolor='#ffffff'><td width='2px'><input type='checkbox' name='selected_id' onclick='toggleSelectAll(this.name,\"select_all\")' value='$num' class='msg_check'></td><td colspan='1'>";
|
||||
$new_msgs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$flags = "<tr id='row_".$num."' class=\"lvtColData\" bgcolor='#ffffff'><td width='2px'><input type='checkbox' name='selected_id' value='$num' onclick='toggleSelectAll(this.name,\"select_all\")' class='msg_check'></td><td colspan='1'>";
|
||||
|
||||
}
|
||||
|
||||
//enable-diable download attachment button
|
||||
if($msg_ob->has_attachments){
|
||||
$enableDownlaodAttachment = 'yes';
|
||||
}else
|
||||
$enableDownlaodAttachment = 'no';
|
||||
|
||||
// Attachment Icons
|
||||
if($msg_ob->has_attachments)
|
||||
$flags.='<a href="javascript:;" onclick="displayAttachments('.$num.');"><img src="themes/images/attachment.gif" border="0" width="8px" height="13" title="Attachment"></a> ';
|
||||
else
|
||||
$flags.='<img src="themes/images/blank.gif" border="0" width="8px" height="14" alt=""> ';
|
||||
|
||||
|
||||
|
||||
// read/unread/forwarded/replied
|
||||
if(!$mails[$start_message]->seen || $mails[$start_message]->recent)
|
||||
{
|
||||
$flags.='<span id="unread_img_'.$num.'"><a href="javascript:;" onclick="OpenCompose(\''.$num.'\',\'reply\');"><img src="themes/images/newmail.gif" border="0" width="12" height="10" title="Unread"></a></span> ';
|
||||
}
|
||||
elseif ($mails[$start_message]->in_reply_to || $mails[$start_message]->references || preg_match("/^re:/i",$mails[$start_message]->subject))
|
||||
{
|
||||
$flags.='<a href="javascript:;" onclick="OpenComposer(\''.$num.'\',\'reply\');"><img src="themes/images/stock_mail-replied.png" border="0" width="14" height="16" title="Replied" ></a> ';
|
||||
}
|
||||
elseif (preg_match("/^fw:/i",$mails[$start_message]->subject))
|
||||
{
|
||||
$flags.='<a href="javascript:;" onclick="OpenComposer(\''.$num.'\',\'reply\');"><img src="themes/images/stock_mail-forward.png" border="0" width="10" height="13" title="Forward" ></a> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$flags.='<a href="javascript:;" onclick="OpenComposer(\''.$num.'\',\'reply\');"><img src="themes/images/openmail.gif" border="0" width="12" height="12" title="Read" ></a> ';
|
||||
}
|
||||
|
||||
// Set IMAP flag
|
||||
if($mails[$start_message]->flagged)
|
||||
{
|
||||
$flags.='<span id="clear_td_'.$num.'"><a href="javascript:runEmailCommand(\'clear_flag\','.$num.');"><img src="themes/images/important1.gif" border="0" width="11" height="11" id="clear_flag_img_'.$num.'"title="Important"></a></span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$flags.='<span id="set_td_'.$num.'"><a href="javascript:void(0);" onclick="runEmailCommand(\'set_flag\','.$num.');"><img src="themes/images/important2.gif" border="0" width="11" height="11" id="set_flag_img_'.$num.'"title="Important"></a></span>';
|
||||
|
||||
}
|
||||
|
||||
$tmp=imap_mime_header_decode($mails[$start_message]->from);
|
||||
$from = $tmp[0]->text;
|
||||
$listview_entries[$num] = array();
|
||||
|
||||
$listview_entries[$num][] = $flags."</td>";
|
||||
|
||||
if ($mails[$start_message]->deleted)
|
||||
{
|
||||
$listview_entries[$num][] = '<td nowrap align="left" style="cursor:pointer;" id="deleted_subject_'.$num.'" onclick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\'); "><s><a href="javascript:;" >'.substr($mails[$start_message]->subject,0,40).'</a></s></td>';
|
||||
$listview_entries[$num][] = '<td nowrap align="left" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" nowrap id="deleted_date_'.$num.'"><s>'.substr($mails[$start_message]->date,0,25).'</s></td>';
|
||||
$listview_entries[$num][] = '<td nowrap align="left" id="deleted_from_'.$num.'" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');"><s>'.substr($from,0,20).'</s></td>';
|
||||
}
|
||||
elseif(!$mails[$start_message]->seen || $mails[$start_message]->recent)
|
||||
{
|
||||
$listview_entries[$num][] = '<td nowrap align="left" onclick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" style="cursor:pointer;" ><a href="javascript:;" id="ndeleted_subject_'.$num.'"><font id="fnt_subject_'.$num.'" color="green">'.substr($mails[$start_message]->subject,0,40).'</font></a></td>';
|
||||
$listview_entries[$num][] = '<td nowrap align="left" nowrap id="ndeleted_date_'.$num.'" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" ><font id="fnt_date_'.$num.'" color="green">'.substr($mails[$start_message]->date,0,25).' </font></td>';
|
||||
$listview_entries[$num][] = '<td nowrap align="left" id="ndeleted_from_'.$num.'"><font id="fnt_from_'.$num.'" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" >'.substr($from,0,20).'</font></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//IMPORTANT - This UTF-8 conversion has been done in ListView.php so no need to do again here
|
||||
//Added to shown the original UTF-8 characters - Mickie - 30-11-06 - Starts
|
||||
//we can use the option 1 or option 2
|
||||
//Option 1 - Starts
|
||||
/*
|
||||
$translated_subject = imap_mime_header_decode($mails[$start_message]->subject);
|
||||
for($i=0;$i<count($translated_subject);$i++)
|
||||
{
|
||||
if($translated_subject[$i]->charset != 'default')
|
||||
{
|
||||
$tmp .= $translated_subject[$i]->text;
|
||||
$mails[$start_message]->subject = utf8_decode($tmp);//$tmp;
|
||||
}
|
||||
}
|
||||
//Option 1 - Ends
|
||||
*/
|
||||
//Option 2 - Starts
|
||||
//$mails[$start_message]->subject = utf8_decode(imap_utf8($mails[$start_message]->subject));//imap_utf8($mails[$start_message]->subject);
|
||||
//Option 2 - Ends
|
||||
//Added to shown the original UTF-8 characters - Mickie - 30-11-06 - Ends
|
||||
|
||||
$listview_entries[$num][] = '<td nowrap align="left" onclick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" style="cursor:pointer;" ><a href="javascript:;" id="ndeleted_subject_'.$num.'">'.substr($mails[$start_message]->subject,0,40).'</a></td>';
|
||||
$listview_entries[$num][] = '<td npwrap align="left" nowrap id="ndeleted_date_'.$num.'" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" >'.substr($mails[$start_message]->date,0,25).'</td>';
|
||||
$listview_entries[$num][] = '<td nowrap align="left" id="ndeleted_from_'.$num.'" style="cursor:pointer;" onClick="load_webmail(\''.$num.'\', \''.$enableDownlaodAttachment.'\');" >'.substr($from,0,20).'</td>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($mails[$start_message]->deleted)
|
||||
$listview_entries[$num][] = '<td nowrap align="center" id="deleted_td_'.$num.'"><span id="del_link_'.$num.'"><a href="javascript:void(0);" onclick="runEmailCommand(\'undelete_msg\','.$num.');"><img src="themes/images/gnome-fs-trash-empty.png" border="0" width="14" height="14" alt="del" title="Delete"></a></span></td></tr>';
|
||||
else
|
||||
$listview_entries[$num][] = '<td nowrap align="center" id="ndeleted_td_'.$num.'"><span id="del_link_'.$num.'"><a href="javascript:void(0);" onclick="runEmailCommand(\'delete_msg\','.$num.');"><img src="themes/images/no.gif" border="0" width="14" height="14" alt="del" title="Delete"></a></span></td></tr>';
|
||||
|
||||
|
||||
return $listview_entries[$num];
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Emails/Emails.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
require_once('include/logging.php');
|
||||
require_once('include/database/PearDatabase.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/CommonUtils.php');
|
||||
require_once('modules/Webmails/MailParse.php');
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
require_once('modules/Documents/Documents.php');
|
||||
require_once('modules/Settings/MailScanner/core/MailAttachmentMIME.php');
|
||||
global $current_user;
|
||||
|
||||
$local_log =& LoggerManager::getLogger('index');
|
||||
$focus = new Emails();
|
||||
|
||||
$to_address = explode(";",$_REQUEST['to_list']);
|
||||
$cc_address = explode(";",$_REQUEST['cc_list']);
|
||||
$bcc_address = explode(";",$_REQUEST['bcc_list']);
|
||||
|
||||
$start_message=vtlib_purify($_REQUEST["start_message"]);
|
||||
if($_REQUEST["mailbox"] && $_REQUEST["mailbox"] != "") {$mailbox=vtlib_purify($_REQUEST["mailbox"]);} else {$mailbox="INBOX";}
|
||||
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
$email = new Webmails($MailBox->mbox, $_REQUEST["mailid"]);
|
||||
$subject = imap_utf8($email->subject);
|
||||
$date = $email->date;
|
||||
$array_tab = Array();
|
||||
$email->loadMail($array_tab);
|
||||
$msgData = str_replace('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',"",$email->body);
|
||||
$content['attachtab'] = $email->attachtab;
|
||||
while ($tmp = array_pop($content['attachtab'])){
|
||||
if ((!eregi('ATTACHMENT', $tmp['disposition'])) && $conf->display_text_attach && (eregi('text/plain', $tmp['mime'])))
|
||||
$msgData .= '<hr />'.view_part_detail($mail, $mailid, $tmp['number'], $tmp['transfer'], $tmp['charset'], $charset);
|
||||
}
|
||||
$focus->column_fields['subject']=$subject;
|
||||
$focus->column_fields["activitytype"]="Emails";
|
||||
|
||||
$ddate = date("Y-m-d",strtotime($date));
|
||||
$dtime = date("h:m");
|
||||
$focus->column_fields["assigned_user_id"] = $current_user->id;
|
||||
$focus->column_fields["date_start"] = $ddate;
|
||||
$focus->column_fields["time_start"] = $dtime;
|
||||
//Set the flag as 'Webmails' to show up the sent date
|
||||
$focus->column_fields["email_flag"] = "WEBMAIL";
|
||||
|
||||
//Save the To field information in vtiger_emaildetails
|
||||
$all_to_ids = $email->to;
|
||||
$focus->column_fields["saved_toid"] = implode(',',$all_to_ids);
|
||||
|
||||
//store the sent date in 'yyyy-mm-dd' format
|
||||
$user_old_date_format = $current_user->date_format;
|
||||
$current_user->date_format = 'yyyy-mm-dd';
|
||||
|
||||
$focus->column_fields["description"]=$msgData;
|
||||
|
||||
//to save the email details in vtiger_emaildetails vtiger_tables
|
||||
$fieldid = $adb->query_result($adb->pquery('select fieldid from vtiger_field where tablename="vtiger_contactdetails" and fieldname="email" and columnname="email" and vtiger_field.presence in (0,2)', array()),0,'fieldid');
|
||||
|
||||
if(count($email->relationship) != 0) {
|
||||
$focus->column_fields['parent_id']=$email->relationship["id"].'@'.$fieldid.'|';
|
||||
|
||||
$focus->save("Emails");
|
||||
if($email->relationship["type"] == "Contacts")
|
||||
add_attachment_to_contact($email->relationship["id"],$email,$focus->id);
|
||||
}else {
|
||||
//if relationship is not available create a contact and relate the email to the contact
|
||||
require_once('modules/Contacts/Contacts.php');
|
||||
$contact_focus = new Contacts();
|
||||
//Populate the lastname as emailid if email doesn't have from name
|
||||
if($email->fromname){
|
||||
$contact_focus->column_fields['lastname'] =$email->fromname;
|
||||
}else{
|
||||
$contact_focus->column_fields['lastname'] =$email->from;
|
||||
}
|
||||
|
||||
$contact_focus->column_fields['email'] = $email->from;
|
||||
$contact_focus->column_fields["assigned_user_id"]=$current_user->id;
|
||||
$contact_focus->save("Contacts");
|
||||
$focus->column_fields['parent_id']=$contact_focus->id.'@'.$fieldid.'|';
|
||||
|
||||
$focus->save("Emails");
|
||||
add_attachment_to_contact($contact_focus->id,$email,$focus->id);
|
||||
}
|
||||
|
||||
function add_attachment_to_contact($cid,$email,$emailid) {
|
||||
// add vtiger_attachments to contact
|
||||
global $adb,$current_user,$default_charset;
|
||||
for($j=0;$j<2;$j++) {
|
||||
if($j==0)
|
||||
$attachments=$email->downloadAttachments();
|
||||
else
|
||||
$attachments=$email->downloadInlineAttachments();
|
||||
|
||||
$upload_filepath = decideFilePath();
|
||||
for($i=0,$num_files=count($attachments);$i<$num_files;$i++)
|
||||
{
|
||||
$current_id = $adb->getUniqueID("vtiger_crmentity");
|
||||
$date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
|
||||
|
||||
$filename = ereg_replace("[ ()-]+", "_",$attachments[$i]["filename"]);
|
||||
preg_match_all('/=\?([^\?]+)\?([^\?]+)\?([^\?]+)\?=/', $filename, $matches);
|
||||
$totalmatches = count($matches[0]);
|
||||
|
||||
for($index = 0; $index < $totalmatches; ++$index) {
|
||||
$charset = $matches[1][$index];
|
||||
$encoding= strtoupper($matches[2][$index]);
|
||||
$data = $matches[3][$index];
|
||||
|
||||
if($encoding == 'B') {
|
||||
$filename = base64_decode($data);
|
||||
} else if($encoding == 'Q') {
|
||||
$filename = quoted_printable_decode($data);
|
||||
}
|
||||
$filename = iconv(str_replace('_','-',$charset),$default_charset,$filename);
|
||||
}
|
||||
|
||||
$saveasfile = $upload_filepath.'/'.$current_id.'_'.$filename;
|
||||
$filetype = MailAttachmentMIME::detect($saveasfile);
|
||||
$filesize = $attachments[$i]["filesize"];
|
||||
|
||||
$query = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)";
|
||||
$qparams = array($current_id, $current_user->id, $current_user->id, 'Contacts Attachment', 'Uploaded from webmail during qualification', $date_var, $date_var);
|
||||
$result = $adb->pquery($query, $qparams);
|
||||
|
||||
$sql = "insert into vtiger_attachments (attachmentsid,name,description,type,path) values(?,?,?,?,?)";
|
||||
$params = array($current_id, $filename, 'Uploaded '.$filename.' from webmail', $filetype, $upload_filepath);
|
||||
$result = $adb->pquery($sql, $params);
|
||||
|
||||
if(!empty($result)){
|
||||
|
||||
// Create document record
|
||||
$document = new Documents();
|
||||
$document->column_fields['notes_title'] = $filename;
|
||||
$document->column_fields['filename'] = $filename;
|
||||
$document->column_fields['filesize'] = $filesize;
|
||||
$document->column_fields['filetype'] = $filetype;
|
||||
$document->column_fields['filestatus'] = 1;
|
||||
$document->column_fields['filelocationtype'] = 'I';
|
||||
$document->column_fields['folderid'] = 1; // Default Folder
|
||||
$document->column_fields['assigned_user_id'] = $current_user->id;
|
||||
$document->save('Documents');
|
||||
|
||||
$sql1 = "insert into vtiger_senotesrel values(?,?)";
|
||||
$params1 = array($cid, $document->id);
|
||||
$result = $adb->pquery($sql1, $params1);
|
||||
|
||||
$sql1 = "insert into vtiger_seattachmentsrel values(?,?)";
|
||||
$params1 = array($document->id, $current_id);
|
||||
$result = $adb->pquery($sql1, $params1);
|
||||
|
||||
$sql1 = "insert into vtiger_seattachmentsrel values(?,?)";
|
||||
$params1 = array($emailid, $current_id);
|
||||
$result = $adb->pquery($sql1, $params1);
|
||||
}
|
||||
|
||||
//we have to add attachmentsid_ as prefix for the filename
|
||||
$move_filename = $upload_filepath.'/'.$current_id.'_'.$filename;
|
||||
|
||||
$fp = fopen($move_filename, "w") or die("Can't open file");
|
||||
fputs($fp, base64_decode($attachments[$i]["filedata"]));
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Display the sent date in logged in user date format
|
||||
$current_user->date_format = $user_old_date_format;
|
||||
|
||||
function view_part_detail($mail,$mailid,$part_no, &$transfer, &$msg_charset, &$charset)
|
||||
{
|
||||
$text = imap_fetchbody($mail,$mailid,$part_no);
|
||||
if ($transfer == 'BASE64')
|
||||
$str = nl2br(imap_base64($text));
|
||||
elseif($transfer == 'QUOTED-PRINTABLE')
|
||||
$str = nl2br(quoted_printable_decode($text));
|
||||
else
|
||||
$str = nl2br($text);
|
||||
return ($str);
|
||||
}
|
||||
|
||||
$_REQUEST['parent_id'] = $focus->column_fields['parent_id'];
|
||||
|
||||
$return_id = vtlib_purify($_REQUEST["mailid"]);
|
||||
$return_module='Webmails';
|
||||
$return_action='ListView';
|
||||
|
||||
if($_POST["ajax"] != "true")
|
||||
header("Location: index.php?action=$return_action&module=$return_module&record=$return_id");
|
||||
|
||||
return;
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
webmail todos:
|
||||
--------------
|
||||
1) Add attachment uploading code for emails added to vtiger -- Done 05-25-06 -- mmbrich
|
||||
2) Create "Add to Vtiger" link to "Quick View" -- Done 01-30-06 -- mmbrich
|
||||
3) BCC current_user on all outgoing emails -- Done 01-30-06 -- mmbrich
|
||||
4) Automatically import threads on mbox refresh
|
||||
5) Multiple email accounts
|
||||
6) Fix entity relationships so entites will show up in "Emails" module under "More Information" -- Done 05-24-06 -- vtiger
|
||||
7) Store the msg-id of the imported emails (for checking the thread and importing) -- not needed
|
||||
8) Add all needed tab relationships to the DB
|
||||
9) Generate a related list of some kind for webmails -- Done 01-30-06 -- mmbrich
|
||||
10) Enable the following relationships with an Emails entity:
|
||||
a) HelpDesk
|
||||
b) Vendor
|
||||
c) Product
|
||||
d) {Multiple} Other Emails (for thread relationships)
|
||||
e) ??
|
||||
11) Enable radio boxes and massdelete funtion
|
||||
12) Figure out a way to AJAX'ify checks for new messages and automatically insert them in the table? -- Done 05-25-06 -- mmbrich
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
require_once('include/logging.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
|
||||
global $adb,$current_user;
|
||||
|
||||
if($_POST['config_chk'] == 'true')
|
||||
{
|
||||
$MailBox = new MailBox();
|
||||
if($MailBox->enabled == 'false') {
|
||||
echo 'FAILED';
|
||||
exit();
|
||||
} else {
|
||||
echo 'SUCCESS';
|
||||
exit();
|
||||
}
|
||||
exit();
|
||||
}
|
||||
if(isset($_REQUEST['file']) && $_REQUEST['file']!='' && !isset($_REQUEST['ajax'])){
|
||||
checkFileAccess("modules/".$_REQUEST['module']."/".$_REQUEST['file'].".php");
|
||||
require_once("modules/".$_REQUEST['module']."/".$_REQUEST['file'].".php");
|
||||
exit();
|
||||
}
|
||||
$mailid = vtlib_purify($_REQUEST["mailid"]);
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {$mailbox=vtlib_purify($_REQUEST["mailbox"]);} else {$mailbox="INBOX";}
|
||||
|
||||
$adb->println("Inside WebmailsAjax.php");
|
||||
|
||||
if(isset($_POST["file"]) && $_POST["ajax"] == "true") {
|
||||
checkFileAccess("modules/".$_REQUEST["module"]."/".$_POST["file"].".php");
|
||||
require_once("modules/".$_REQUEST["module"]."/".$_POST["file"].".php");
|
||||
}
|
||||
|
||||
if(isset($_REQUEST["command"]) && $_REQUEST["command"] != "") {
|
||||
$command = $_REQUEST["command"];
|
||||
if($command == "expunge") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
imap_expunge($MailBox->mbox);
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$elist = $MailBox->mailList;
|
||||
$num_mails = $elist['count'];
|
||||
$start_page = cal_start($num_mails,$MailBox->mails_per_page);
|
||||
imap_close($MailBox->mbox);
|
||||
echo $start_page;
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
if($command == "delete_msg") {
|
||||
$adb->println("DELETE SINGLE WEBMAIL MESSAGE $mailid");
|
||||
$MailBox = new MailBox($mailbox);
|
||||
imap_delete($MailBox->mbox,$mailid);
|
||||
imap_expunge($MailBox->mbox);
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$elist = $MailBox->mailList;
|
||||
$num_mails = $elist['count'];
|
||||
$start_page = cal_start($num_mails,$MailBox->mails_per_page);
|
||||
imap_close($MailBox->mbox);
|
||||
echo "start=".$start_page.";";
|
||||
echo "id=".$mailid.";";
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
if($command == "delete_multi_msg") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$tlist = explode(":",$mailid);
|
||||
foreach($tlist as $id) {
|
||||
imap_delete($MailBox->mbox,$id);
|
||||
$adb->println("DELETE MULTI MESSAGE $id");
|
||||
$email = new Webmails($MailBox->mbox,$id);
|
||||
$email->delete();
|
||||
}
|
||||
imap_expunge($MailBox->mbox);
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$elist = $MailBox->mailList;
|
||||
$num_mails = $elist['count'];
|
||||
$start_page = cal_start($num_mails,$MailBox->mails_per_page);
|
||||
imap_close($MailBox->mbox);
|
||||
echo "start=".$start_page.";";
|
||||
echo "ids='".$mailid."';";
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
if($_POST["command"] == "move_msg" && $_POST["ajax"] == "true") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != '') {
|
||||
$mailids = explode(':',$_REQUEST["mailid"]);
|
||||
}
|
||||
foreach($mailids as $mailid) {
|
||||
imap_mail_move($MailBox->mbox,$mailid,$_REQUEST["mvbox"]);
|
||||
}
|
||||
imap_expunge($MailBox->mbox);
|
||||
imap_close($MailBox->mbox);
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$elist = $MailBox->mailList;
|
||||
$num_mails = $elist['count'];
|
||||
$start_page = cal_start($num_mails,$MailBox->mails_per_page);
|
||||
imap_close($MailBox->mbox);
|
||||
echo $start_page;
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
|
||||
if($command == "undelete_msg") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$email->unDeleteMsg();
|
||||
imap_close($MailBox->mbox);
|
||||
echo $mailid;
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
if($command == "set_flag") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$email->setFlag();
|
||||
imap_close($MailBox->mbox);
|
||||
echo $mailid;
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
if($command == "clear_flag") {
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$email->delFlag();
|
||||
imap_close($MailBox->mbox);
|
||||
echo $mailid;
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
imap_close($MailBox->mbox);
|
||||
flush();
|
||||
exit();
|
||||
}
|
||||
function cal_start($num_mails,$mail_per_page) {
|
||||
if(isset($_REQUEST['start']) && $_REQUEST['start']!=0) {
|
||||
$pre_start = $_REQUEST['start'];
|
||||
$cal = (($pre_start-1) * $mail_per_page);
|
||||
if($num_mails > $cal)
|
||||
$res = $pre_start;
|
||||
else
|
||||
$res = $pre_start - 1;
|
||||
} else
|
||||
$res = 0;
|
||||
return $res;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
global $current_user;
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
global $mod_strings;
|
||||
|
||||
if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] != $current_user->id) {echo "ajax failed";flush();exit();}
|
||||
$mailid=vtlib_purify($_REQUEST["mailid"]);
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "")
|
||||
{
|
||||
$mailbox=vtlib_purify($_REQUEST["mailbox"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailbox="INBOX";
|
||||
}
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$status=imap_setflag_full($MailBox->mbox,$mailid,"\\Seen");
|
||||
$attach_tab=array();
|
||||
$email->loadMail($attach_tab);
|
||||
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$email->charsets."\">\n";
|
||||
$subject = utf8_decode(utf8_encode(imap_utf8($email->subject)));
|
||||
$from = decode_header($email->from);
|
||||
$to = decode_header($email->to_header);
|
||||
$cc = decode_header($email->cc_header);
|
||||
$date = decode_header($email->date);
|
||||
for($i=0;$i<count($email->attname);$i++){
|
||||
$attachment_links .= $email->anchor_arr[$i].decode_header($email->attname[$i])."</a></br> ";
|
||||
}
|
||||
$content['body'] = $email->body;
|
||||
$content['attachtab'] = $email->attachtab;
|
||||
if(!$_REQUEST['fullview'])
|
||||
$class_str = 'class="tableHeadBg"';
|
||||
else
|
||||
$class_str = 'style="font-size:15px"';
|
||||
|
||||
?>
|
||||
<script src="modules/Webmails/Webmails.js" type="text/javascript"></script>
|
||||
<script src="include/js/general.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="themes/<?php echo vtlib_purify($_REQUEST['theme']);?>/webmail.css">
|
||||
<!-- Table to display the Header details (From, To, Subject and date) - Starts -->
|
||||
|
||||
<table <?php echo $class_str;?> width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr align="left"><td width="100%" align="left"> <b><?php echo $mod_strings['LBL_FROM'];?></b><?php echo $from;?></td></tr>
|
||||
<tr><td width="100%" align="left"> <b><?php echo $mod_strings['LBL_TO'];?></b><?php echo $to;?></td></tr>
|
||||
<tr><td width="100%" align="left"> <b><?php echo $mod_strings['LBL_CC'];?></b><?php echo $cc;?></td></tr>
|
||||
|
||||
<tr><td align="left" width="100%"> <b><?php echo $mod_strings['LBL_SUBJECT'];?></b><?php echo $subject;?></td></tr>
|
||||
<tr><td align="left" width="100%"> <b><?php echo $mod_strings['LBL_DATE'];?></b><?php echo substr($date,0,25);?>
|
||||
<?php if(!$_REQUEST['fullview']) {?>
|
||||
<span style="float:right" colspan="2"><a href="javascript:;" onclick="OpenComposer('<?php echo $mailid;?>','full_view')"><?php echo $mod_strings['LBL_FULL_EMAIL_VIEW'] ?></a></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if(isset($_REQUEST['fullview']) && $attachment_links != '') {?>
|
||||
<tr>
|
||||
<td align="left"> <b><?php echo $mod_strings['LBL_ATTACHMENT'];?>:</b><?php echo $attachment_links;?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr><td align="left" style="border-bottom:1px solid #666666;" colspan="3"> </td></tr>
|
||||
</table>
|
||||
<!-- Table to display the Header details (From, To, Subject and date) - Ends -->
|
||||
|
||||
<script type="text/javascript">
|
||||
mailbox = "<?php echo $mailbox;?>";
|
||||
function show_inline(num) {
|
||||
var el = document.getElementById("block_"+num);
|
||||
if(el.style.display == 'block')
|
||||
el.style.display='none';
|
||||
else
|
||||
el.style.display='block';
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
function view_part_detail($mail,$mailid,$part_no, &$transfer, &$msg_charset, &$charset)
|
||||
{
|
||||
$text = imap_fetchbody($mail,$mailid,$part_no);
|
||||
if ($transfer == 'BASE64')
|
||||
$str = nl2br(imap_base64($text));
|
||||
elseif($transfer == 'QUOTED-PRINTABLE')
|
||||
$str = nl2br(quoted_printable_decode($text));
|
||||
else
|
||||
$str = nl2br($text);
|
||||
return ($str);
|
||||
}
|
||||
//Need to put this along with the subject block*/
|
||||
echo $email->att;
|
||||
if(!$_REQUEST['fullview'])
|
||||
echo '<div style="overflow:auto;height:386px;width:737px;padding:5;">';
|
||||
else
|
||||
echo '<div style="padding:5;">';
|
||||
echo $content['body'];
|
||||
|
||||
//test added by Richie
|
||||
if (!isset($_REQUEST['display_images']) || $_REQUEST['display_images'] != 1)
|
||||
{
|
||||
$content['body'] = eregi_replace('src="[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]"', 'src="none"', $content['body']);
|
||||
$content['body'] = eregi_replace('src=[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]', 'src="none"', $content['body']);
|
||||
}
|
||||
|
||||
//Display embedded HTML images
|
||||
$tmp_attach_tab=$content['attachtab'];
|
||||
$i = 0;
|
||||
$conf->display_img_attach = true;
|
||||
$conf->display_text_attach = true;
|
||||
|
||||
while ($tmp = array_pop($tmp_attach_tab))
|
||||
{
|
||||
if ($conf->display_img_attach && (eregi('image', $tmp['mime']) && ($tmp['number'] != '')))
|
||||
{
|
||||
$exploded = explode('/', $tmp['mime']);
|
||||
$img_type = array_pop($exploded);
|
||||
if (eregi('JPEG', $img_type) || eregi('JPG', $img_type) || eregi('GIF', $img_type) || eregi ('PNG', $img_type))
|
||||
{
|
||||
$new_img_src = 'src="get_img.php?mail=' . $mailid.'&num=' . $tmp['number'] . '&mime=' . $img_type . '&transfer=' . $tmp['transfer'] . '"';
|
||||
$img_id = str_replace('<', '', $tmp['id']);
|
||||
$img_id = str_replace('>', '', $img_id);
|
||||
$content['body'] = str_replace('src="cid:'.$img_id.'"', $new_img_src, $content['body']);
|
||||
$content['body'] = str_replace('src=cid:'.$img_id, $new_img_src, $content['body']);
|
||||
}
|
||||
}
|
||||
}
|
||||
while ($tmp = array_pop($content['attachtab']))
|
||||
{
|
||||
if ((!eregi('ATTACHMENT', $tmp['disposition'])) && $conf->display_text_attach && (eregi('text/plain', $tmp['mime'])))
|
||||
echo '<hr />'.view_part_detail($mail, $mailid, $tmp['number'], $tmp['transfer'], $tmp['charset'], $charset);
|
||||
if ($conf->display_img_attach && (eregi('image', $tmp['mime']) && ($tmp['number'] != '')))
|
||||
{
|
||||
$exploded = explode('/', $tmp['mime']);
|
||||
$img_type = array_pop($exploded);
|
||||
if (eregi('JPEG', $img_type) || eregi('JPG', $img_type) || eregi('GIF', $img_type) || eregi ('PNG', $img_type))
|
||||
{
|
||||
echo '<hr />';
|
||||
echo '<center>';
|
||||
echo '<img src="index.php?module=Webmails&action=get_img&mail=' . $mailid.'&mailbox='.$mailbox.'&num=' . $tmp['number'] . '&mime=' . $img_type . '&transfer=' . $tmp['transfer'] . '" />';
|
||||
echo '</center>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
//test ended by Richie
|
||||
|
||||
imap_close($MailBox->mbox);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/*
|
||||
* $Header: /cvsroot/nocc/nocc/webmail/conf.php.dist,v 1.150 2006/11/29 19:58:51 goddess_skuld Exp $
|
||||
*
|
||||
* Copyright 2001 Nicolas Chalanset <[email protected]>
|
||||
* Copyright 2001 Olivier Cahagne <[email protected]>
|
||||
* Copyright 2002 Mike Rylander <[email protected]>
|
||||
*
|
||||
* See the enclosed file COPYING for license information (GPL). If you
|
||||
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
|
||||
*/
|
||||
|
||||
// ################### This is the main configuration for NOCC ########## //
|
||||
|
||||
// ==> Required parameters
|
||||
|
||||
// Will be checked by html/*.php file. If it's not available, these files won't
|
||||
// be loaded.
|
||||
$conf->loaded = true;
|
||||
|
||||
// Default smtp server and smtp_port (default is 25)
|
||||
// If a domain has no smtp server, this one will be used
|
||||
// If no smtp server is provided, Nocc will default to the mail() function,
|
||||
// and try to use Sendmail or any other MTA (Postfix)
|
||||
$conf->default_smtp_server = 'smtp';
|
||||
$conf->default_smtp_port = 25;
|
||||
|
||||
// List of domains people can log in
|
||||
// You can have as many domains as you need
|
||||
|
||||
// $conf->domains[$i]->domain = 'sourceforge.net';
|
||||
// domain name e.g 'sourceforge.net'. This field is used when sending message
|
||||
//
|
||||
// $conf->domains[$i]->in = 'mail.sourceforge.net:110/pop3';
|
||||
// imap or pop3 server name + port + protocol (only if not imap)
|
||||
// [server_name]:[port number]/[protocol]/[options]
|
||||
// ex for an imap server : mail.sourceforge.net:143
|
||||
// ex for an imap server with explicit TLS/SSL negociation desactivated : mail.sourceforge.net:143/notls (may be useful for some courier-imap installation).
|
||||
//(may be useful for some courier-imap installation).
|
||||
// ex for an ssl imap server : mail.sourceforge.net:993/ssl
|
||||
// ex for an ssl imap server with a self-signed certificate : mail.sourceforge.net:993/ssl/novalidate-cert
|
||||
// ex for a pop3 server : mail.sourceforge.net:110/pop3
|
||||
// ex for a pop3 server with explicit TLS/SSL negociation desactivated : mail.sourceforge.net:110/pop3/notls (may be useful for some courier-imap installation).
|
||||
// ex for an ssl pop3 server : mail.sourceforge.net:995/pop3/ssl
|
||||
// ex for an ssl pop3 server with a self-signed certificate : mail.sourceforge.net:995/pop3/ssl/novalidate-cert
|
||||
// protocol can only be pop3
|
||||
//
|
||||
// $conf->domains[$i]->smtp = 'smtp.isp.com';
|
||||
// Optional: smtp server name or IP address
|
||||
// Leave empty to send mail via sendmail
|
||||
//
|
||||
// $conf->domains[$i]->smtp_port = 25;
|
||||
// Port number to connect to smtp server (usually 25)
|
||||
|
||||
$i = 0;
|
||||
|
||||
$conf->domains[$i]->domain = '';
|
||||
$conf->domains[$i]->in ='' ;
|
||||
//$conf->domains[$i]->in = '';
|
||||
$conf->domains[$i]->smtp = 'smtp';
|
||||
$conf->domains[$i]->smtp_port = 25;
|
||||
// Uncomment for 'user<char>domain.com' style logins
|
||||
//$conf->domains[$i]->login_with_domain = 1;
|
||||
// Uncomment and select character to use for login_with_domain option
|
||||
//$conf->domains[$i]->login_with_domain_character = '@';
|
||||
// Fill in if you require login suffixes for your mail server
|
||||
$conf->domains[$i]->login_suffix = '';
|
||||
// Uncomment for login aliases and use the following syntax:
|
||||
// login_aliases = array('alias1' => 'real_login_1','alias2' => 'real_login_2');
|
||||
// If you want to use an external file, use the following syntax:
|
||||
// login_aliases = '@/path/to/file/';
|
||||
// See login_alias.sample file for example.
|
||||
//$conf->domains[$i]->login_aliases = array();
|
||||
// Uncomment for allowed logins and use the following syntax:
|
||||
// login_allowed = array('login_1' => '', 'login_2' => '');
|
||||
// If you want to use an external file, use the following syntax:
|
||||
// login_allowed = '@/path/to/file/';
|
||||
// See login_allowed.sample file for example.
|
||||
//$conf->domains[$i]->login_allowed = array();
|
||||
// Select SMTP AUTH method.
|
||||
// Supported AUTH methods are :
|
||||
// '' : no authentification method
|
||||
// 'PLAIN' : AUTH PLAIN method
|
||||
// 'LOGIN' : AUTH LOGIN method
|
||||
$conf->domains[$i]->smtp_auth_method = '';
|
||||
// Select IMAP Namespace
|
||||
$conf->domains[$i]->imap_namespace = "INBOX.";
|
||||
|
||||
// If you want to add more domains, uncomment the following
|
||||
// lines and fill them in
|
||||
|
||||
//$i++;
|
||||
//$conf->domains[$i]->domain = '';
|
||||
//$conf->domains[$i]->in = '';
|
||||
//$conf->domains[$i]->smtp = '';
|
||||
//$conf->domains[$i]->smtp_port = 25;
|
||||
//$conf->domains[$i]->login_with_domain = 1;
|
||||
//$conf->domains[$i]->login_suffix = '';
|
||||
//$conf->domains[$i]->login_aliases = array();
|
||||
//$conf->domains[$i]->login_allowed = array();
|
||||
//$conf->domains[$i]->smtp_auth_method = '';
|
||||
//$conf->domains[$i]->imap_namespace = "INBOX.";
|
||||
|
||||
//$i++;
|
||||
//$conf->domains[$i]->domain = '';
|
||||
//$conf->domains[$i]->in = '';
|
||||
//$conf->domains[$i]->smtp = '';
|
||||
//$conf->domains[$i]->smtp_port = 25;
|
||||
//$conf->domains[$i]->login_with_domain = 1;
|
||||
//$conf->domains[$i]->login_suffix = '';
|
||||
//$conf->domains[$i]->login_aliases = array();
|
||||
//$conf->domains[$i]->login_allowed = array();
|
||||
//$conf->domains[$i]->smtp_auth_method = '';
|
||||
//$conf->domains[$i]->imap_namespace = "INBOX.";
|
||||
|
||||
// If you use many mail domains, the one used will be we one of the HTTP host,
|
||||
// and the user won't be asked for the domain to connect.
|
||||
// Set to true to enable.
|
||||
$conf->vhost_domain_login = false;
|
||||
|
||||
// Is the user allowed to change his "From:" address? (true/false)
|
||||
$conf->allow_address_change = true;
|
||||
|
||||
// Default tmp directory (where to store temporary uploaded files)
|
||||
// This should be something like '/tmp' on Unix System
|
||||
// And 'c:\\temp' on Win32 (note that we must escape "\")
|
||||
$conf->tmpdir = '/tmp';
|
||||
|
||||
// Preferences and contacts data directory
|
||||
// IMPORTANT: This directory must exist and be writable by the user
|
||||
// the webserver is running as (e.g. 'apache', or 'nobody'). For
|
||||
// Apache, see the User directive in the httpd.conf file.
|
||||
// See README for more about this.
|
||||
// This should be something like 'profiles/' on Unix System
|
||||
// or 'prefs\\' on Win32 (note that we must escape "\").
|
||||
// You should not use a subfolder within your Nocc installation, as it will
|
||||
// be readable by everybody, and will contain sensible information as email
|
||||
// addresses and names.
|
||||
// If left empty, preferences, contacts and session saving will be disabled.
|
||||
$conf->prefs_dir = '.';
|
||||
|
||||
// Master key for session password encryption. Longer is better.
|
||||
// It must not be left empty.
|
||||
$conf->master_key = 'abc';
|
||||
|
||||
// Default folder to go first
|
||||
$conf->default_folder = 'INBOX';
|
||||
|
||||
// ===> End of required parameters
|
||||
|
||||
// The following parameters can be changed but it's not necessary to
|
||||
// get a working version of nocc
|
||||
|
||||
// if browser has no preferred language, we use the default language
|
||||
// This is only needed for browsers that don't send any preferred
|
||||
// language such as W3 Amaya
|
||||
$conf->default_lang = 'en';
|
||||
|
||||
// force default language to be set, rather than browser prefered language
|
||||
$conf->force_default_lang = false;
|
||||
|
||||
// How many messages to display in the inbox (devel only)
|
||||
$conf->max_msg_num = 1;
|
||||
|
||||
// let user see the header of a message
|
||||
$conf->use_verbose = true;
|
||||
|
||||
// the user can logout or not (if nocc is used within your website
|
||||
// enter 'false' here else leave 'true')
|
||||
$conf->enable_logout = true;
|
||||
|
||||
// the user can change their 'reply leadin' string
|
||||
$conf->enable_reply_leadin = false;
|
||||
|
||||
// Whether or not to display attachment part number
|
||||
$conf->display_part_no = true;
|
||||
|
||||
// Whether or not to display the Message/RFC822 into the attachments
|
||||
// (the attachments of that part are still available even if false is set
|
||||
$conf->display_rfc822 = true;
|
||||
|
||||
// If you don't want to display images (GIF, JPEG and PNG) sent as attachements
|
||||
// set it to 'false'
|
||||
$conf->display_img_attach = true;
|
||||
|
||||
// If you don't want to display text/plain attachments set it to 'false'
|
||||
$conf->display_text_attach = true;
|
||||
|
||||
// By default the messages are sorted by date
|
||||
$conf->default_sort = '1';
|
||||
|
||||
// By default the most recent is in top ('1' --> sorting top to bottom,
|
||||
// '0' --> bottom to top)
|
||||
$conf->default_sortdir = '1';
|
||||
|
||||
// For old UCB POP server, change this setting to 1 to enable
|
||||
// new mail detection. Recommended: leave it to 0 for any other POP or
|
||||
// IMAP server.
|
||||
// See FAQ for more details.
|
||||
$conf->have_ucb_pop_server = false;
|
||||
|
||||
// If you wanna make your own theme and force people to use that one,
|
||||
// set $conf->use_theme to false and fill in the $conf->default_theme to
|
||||
// the theme name you want to use
|
||||
// Theme handling: allows users to choose a theme on the login page
|
||||
$conf->use_theme = true;
|
||||
|
||||
// Default theme
|
||||
$conf->default_theme = 'standard';
|
||||
|
||||
// Error reporting
|
||||
// Display all errors (including IMAP connection errors, such as
|
||||
// 'host not found' or 'invalid login')
|
||||
$conf->debug_level = E_ALL & ~E_NOTICE;
|
||||
|
||||
// Base URL where NOCC is hosted (only needed for Xitami servers, see #463390)
|
||||
// (NOTE: should end in a slash). Leave blank to detect it automagically.
|
||||
//$conf->base_url = 'http://www.yoursite.com/webmail/';
|
||||
$conf->base_url = '';
|
||||
|
||||
// Another tip for Xitami users, whose $_SERVER['PHP_SELF'] is broken
|
||||
// (see http://sourceforge.net/tracker/index.php?func=detail&aid=505194&group_id=12177&atid=112177)
|
||||
//$_SERVER['PHP_SELF'] = 'action.php';
|
||||
|
||||
// Use old-style forwarding (quote original message, and attach original attachments).
|
||||
// This is discouraged, because it mangles the original message, removing important headers etc.
|
||||
$conf->broken_forwarding = false;
|
||||
|
||||
// This sets the number of messages per page to display from a imap folder or pop mailbox
|
||||
$conf->msg_per_page = '25';
|
||||
|
||||
// Set this to '1' to enable the status line for folders at the bottom of the inbox page.
|
||||
// If you get slow page loads, set it to '0' to disable this (rather slow) function.
|
||||
$conf->status_line = '1';
|
||||
|
||||
//Uncomment this to allow secure typed domain logins
|
||||
//$conf->typed_domain_login = '1';
|
||||
|
||||
// ################### Messages Signature ################### //
|
||||
|
||||
// This message is added to every message, the user cannot delete it
|
||||
// Be careful if you modify this, do not forget to write '\r\n' to switch
|
||||
// to the next line !
|
||||
$conf->ad = "___________________________________\r\nNOCC, http://nocc.sourceforge.net";
|
||||
|
||||
// PHP error reporting for this application
|
||||
error_reporting($conf->debug_level);
|
||||
|
||||
// Prevent mangling of uploaded attachments
|
||||
set_magic_quotes_runtime(0);
|
||||
|
||||
// Delay between 2 mail send (in second)
|
||||
$conf->send_delay = 30;
|
||||
|
||||
// Number of contacts per user, 0 to disable contacts list
|
||||
$conf->contact_number_max = 10;
|
||||
|
||||
// Allow more memory than default setting in order to handle correctly
|
||||
// large mails attachments. Try to find correct setting (about 2.5x total
|
||||
// attachment size)
|
||||
$conf->memory_limit="20M";
|
||||
|
||||
// Allow only specified characters for login. The format of this configuration
|
||||
// variable is any valid regular expression.
|
||||
// Example: '^[a-zA-Z0-9_]+$' : login only with letters (upper and lower case),
|
||||
// numbers and '_' character
|
||||
// Set to '' to disable
|
||||
$conf->allowed_char='';
|
||||
|
||||
// Select the CRLF to use.
|
||||
// According to rfc-822 CRLF is "\r\n"
|
||||
// OS independent, this is a MTA problem
|
||||
// not ours.
|
||||
$conf->crlf = "\r\n";
|
||||
|
||||
// Enable quota checks.
|
||||
// Works only with c-client2000 or more recent, and IMAP inbox
|
||||
$conf->quota_enable=false;
|
||||
|
||||
// Quota types.
|
||||
// Possible values are STORAGE or MESSAGE
|
||||
$conf->quota_type="STORAGE";
|
||||
|
||||
// Default encoding charset to use to display email which does not include one.
|
||||
$conf->default_charset = 'UTF-8';
|
||||
/*
|
||||
################### End of Configuration ####################
|
||||
*/
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*+********************************************************************************
|
||||
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Initial Developer of the Original Code is FOSS Labs.
|
||||
* Portions created by FOSS Labs are Copyright (C) FOSS Labs.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
include('config.php');
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/utils.php');
|
||||
require_once('modules/Webmails/Webmails.php');
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
|
||||
global $MailBox, $mod_strings,$theme;
|
||||
$theme_path="themes/".$theme."/style.css";
|
||||
|
||||
$MailBox = new MailBox($_REQUEST["mailbox"]);
|
||||
|
||||
$mailid=vtlib_purify($_REQUEST["mailid"]);
|
||||
$num=vtlib_purify($_REQUEST["num"]);
|
||||
|
||||
$email = new Webmails($MailBox->mbox,$mailid);
|
||||
$attach_tab = Array();
|
||||
$email->loadMail($attach_tab);
|
||||
echo "<html><head><title>".$mod_strings['LBL_ATTACHMENTS']."</title>";
|
||||
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$email->charsets."\">\n";
|
||||
echo "<script src='modules/Webmails/Webmails.js' type='text/javascript'></script>";
|
||||
echo "<link REL='SHORTCUT ICON' HREF='include/images/vtigercrm_icon.ico'>";
|
||||
echo "<style type='text/css'>@import url('$theme_path');</style>";
|
||||
echo "</head><body>";
|
||||
|
||||
echo "<table class='small' width='100%' cellspacing='1' cellpadding='0' border='0' style='font-size:18px'>";
|
||||
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0 width=100% class='mailClientWriteEmailHeader'><tr><td >".$mod_strings['LBL_ATTACHMENTS']."</td></tr></table></td></tr>";
|
||||
|
||||
if(count($email->attname) <= 0)
|
||||
echo "<tr align='center'><td nowrap>".$mod_strings['LBL_NO_ATTACHMENTS']."</td></tr>";
|
||||
else{
|
||||
for($i=0;$i<count($email->attname);$i++){
|
||||
$attachment_links .= " ".$email->anchor_arr[$i].$email->attname[$i]."</a></br>";
|
||||
}
|
||||
echo "<tr><td><table class='small' width='100%' cellspacing='1' cellpadding='0' border='0' style='font-size:13px'><tr><td width='90%'>".$mod_strings['LBL_THERE_ARE']." ".count($email->attname)." ".$mod_strings['LBL_ATTACHMENTS_TO_CHOOSE'].":</td></tr><br>";
|
||||
echo "<tr><td width='100%'>".$attachment_links."</div></td></tr>";
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/*
|
||||
* $Header: /cvsroot/nocc/nocc/webmail/download.php,v 1.38 2005/12/15 20:10:47 goddess_skuld Exp $
|
||||
*
|
||||
* Copyright 2001 Nicolas Chalanset <[email protected]>
|
||||
* Copyright 2001 Olivier Cahagne <[email protected]>
|
||||
*
|
||||
* See the enclosed file COPYING for license information (GPL). If you
|
||||
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
|
||||
*
|
||||
* File for downloading the attachments
|
||||
*/
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "")
|
||||
{
|
||||
$mailbox=$_REQUEST["mailbox"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailbox="INBOX";
|
||||
}
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
|
||||
if(!isset($HTTP_USER_AGENT))
|
||||
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
|
||||
$mailid = $_REQUEST['mailid'];
|
||||
$mime = $_REQUEST['mime'];
|
||||
$filename = $_REQUEST['filename'];
|
||||
$transfer = $_REQUEST['transfer'];
|
||||
$part = $_REQUEST['part'];
|
||||
$filename = base64_decode($filename);
|
||||
$filename = ereg_replace('[\\/:\*\?"<>\|;]', '_', str_replace(' ', ' ', $filename));
|
||||
$isIE = $isIE6 = 0;
|
||||
// Set correct http headers.
|
||||
// Thanks to Squirrelmail folks :-)
|
||||
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE ') !== false &&
|
||||
strstr($HTTP_USER_AGENT, 'Opera') === false) {
|
||||
$isIE = 1;
|
||||
}
|
||||
|
||||
if (strstr($HTTP_USER_AGENT, 'compatible; MSIE 6') !== false &&
|
||||
strstr($HTTP_USER_AGENT, 'Opera') === false) {
|
||||
$isIE6 = 1;
|
||||
}
|
||||
|
||||
if ($isIE) {
|
||||
$filename=rawurlencode($filename);
|
||||
header ("Pragma: public");
|
||||
header ("Cache-Control: no-store, max-age=0, no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header ("Cache-Control: private");
|
||||
|
||||
//set the inline header for IE, we'll add the attachment header later if we need it
|
||||
header ("Content-Disposition: inline; filename=$filename");
|
||||
}
|
||||
|
||||
header ("Content-Type: application/octet-stream; name=\"$filename\"");
|
||||
header ("Content-Disposition: attachment; filename=\"$filename\"");
|
||||
|
||||
if ($isIE && !$isIE6) {
|
||||
header ("Content-Type: application/download; name=\"$filename\"");
|
||||
} else {
|
||||
header ("Content-Type: application/octet-stream; name=\"$filename\"");
|
||||
}
|
||||
|
||||
$file = imap_fetchbody($mail,$mailid,$part);
|
||||
|
||||
if ($transfer == 'BASE64')
|
||||
$file = imap_base64($file);
|
||||
elseif($transfer == 'QUOTED-PRINTABLE')
|
||||
$file = imap_qprint($file);
|
||||
|
||||
imap_close($mail);
|
||||
|
||||
header('Content-Length: ' . strlen($file));
|
||||
echo ($file);
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* $Header: /cvsroot/nocc/nocc/webmail/get_img.php,v 1.27 2005/05/09 13:32:51 goddess_skuld Exp $
|
||||
*
|
||||
* Copyright 2001 Nicolas Chalanset <[email protected]>
|
||||
* Copyright 2001 Olivier Cahagne <[email protected]>
|
||||
*
|
||||
* See the enclosed file COPYING for license information (GPL). If you
|
||||
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
|
||||
*/
|
||||
require_once('modules/Webmails/MailBox.php');
|
||||
|
||||
if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "")
|
||||
{
|
||||
$mailbox=$_REQUEST["mailbox"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailbox="INBOX";
|
||||
}
|
||||
$MailBox = new MailBox($mailbox);
|
||||
$mail = $MailBox->mbox;
|
||||
$mailid = $_REQUEST['mail'];
|
||||
$num = $_REQUEST['num'];
|
||||
$transfer = $_REQUEST['transfer'];
|
||||
$mime = $_REQUEST['mime'];
|
||||
$img = imap_fetchbody($mail,$mailid,$num);
|
||||
if ($transfer == 'BASE64')
|
||||
$img = imap_base64($img);
|
||||
elseif ($transfer == 'QUOTED-PRINTABLE')
|
||||
$img = imap_qprint($img);
|
||||
imap_close($mail);
|
||||
header('Content-type: image/'.$mime);
|
||||
echo $img;
|
||||
?>
|
||||
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 272 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 163 B |
|
After Width: | Height: | Size: 745 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 776 B |
|
After Width: | Height: | Size: 248 B |
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
||||
* ("License"); You may not use this file except in compliance with the License
|
||||
* The Original Code is: vtiger CRM Open Source
|
||||
* The Initial Developer of the Original Code is vtiger.
|
||||
* Portions created by vtiger are Copyright (C) vtiger.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
********************************************************************************/
|
||||
/**
|
||||
** index.php
|
||||
**
|
||||
** This file simply takes any attempt to view source vtiger_files
|
||||
** and sends those people to the login screen. At this
|
||||
** point no attempt is made to see if the person is logged
|
||||
** or not.
|
||||
**/
|
||||
|
||||
header("Location:../index.php");
|
||||
|
||||
/** pretty impressive huh? **/
|
||||
?>
|
||||
|
After Width: | Height: | Size: 889 B |
|
After Width: | Height: | Size: 291 B |