From 32bdc4009be914ec2dfca0022d339400cd0bd0bd Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 16 Nov 2010 06:55:32 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=89=88=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@599 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/modules/Emails/CallRelatedList.php | 66 - oss/vtiger/trunk/modules/Emails/Choose.php | 82 - .../trunk/modules/Emails/ChooseEmail.php | 106 -- .../trunk/modules/Emails/CustomView.php | 14 - oss/vtiger/trunk/modules/Emails/Delete.php | 36 - .../trunk/modules/Emails/DetailView.php | 159 -- oss/vtiger/trunk/modules/Emails/EditView.php | 356 ---- oss/vtiger/trunk/modules/Emails/Emails.js | 196 --- oss/vtiger/trunk/modules/Emails/Emails.php | 688 -------- .../trunk/modules/Emails/EmailsAjax.php | 55 - .../trunk/modules/Emails/GmailBookmarklet.js | 581 ------- .../modules/Emails/GmailBookmarkletTrigger.js | 99 -- oss/vtiger/trunk/modules/Emails/ListView.php | 202 --- .../trunk/modules/Emails/ListViewPagging.php | 11 - .../modules/Emails/PHPMailer_LICENSE.txt | 504 ------ .../trunk/modules/Emails/PrintEmail.php | 89 - oss/vtiger/trunk/modules/Emails/Save.php | 254 --- .../trunk/modules/Emails/SaveBookmarklet.php | 81 - .../trunk/modules/Emails/TrackAccess.php | 40 - .../trunk/modules/Emails/UnifiedSearch.php | 11 - .../trunk/modules/Emails/class.phpmailer.php | 1510 ----------------- .../trunk/modules/Emails/class.smtp.php | 1050 ------------ .../trunk/modules/Emails/gotodownload.php | 82 - oss/vtiger/trunk/modules/Emails/index.php | 31 - .../modules/Emails/language/en_us.lang.php | 183 -- .../Emails/language/phpmailer.lang-en_us.php | 31 - .../Emails/language/phpmailer.lang-zh_cn.php | 31 - .../modules/Emails/language/zh_cn.lang.php | 184 -- oss/vtiger/trunk/modules/Emails/mail.php | 535 ------ .../trunk/modules/Emails/mailSelect.php | 109 -- oss/vtiger/trunk/modules/Emails/mailsend.php | 239 --- .../templates/testemailtemplateusage.php | 0 .../trunk/modules/Emails/templates/todel.txt | 0 .../trunk/modules/Emails/updateRelations.php | 40 - .../trunk/modules/Emails/webmailsend.php | 61 - 35 files changed, 7716 deletions(-) delete mode 100644 oss/vtiger/trunk/modules/Emails/CallRelatedList.php delete mode 100644 oss/vtiger/trunk/modules/Emails/Choose.php delete mode 100644 oss/vtiger/trunk/modules/Emails/ChooseEmail.php delete mode 100644 oss/vtiger/trunk/modules/Emails/CustomView.php delete mode 100644 oss/vtiger/trunk/modules/Emails/Delete.php delete mode 100644 oss/vtiger/trunk/modules/Emails/DetailView.php delete mode 100644 oss/vtiger/trunk/modules/Emails/EditView.php delete mode 100644 oss/vtiger/trunk/modules/Emails/Emails.js delete mode 100644 oss/vtiger/trunk/modules/Emails/Emails.php delete mode 100644 oss/vtiger/trunk/modules/Emails/EmailsAjax.php delete mode 100644 oss/vtiger/trunk/modules/Emails/GmailBookmarklet.js delete mode 100644 oss/vtiger/trunk/modules/Emails/GmailBookmarkletTrigger.js delete mode 100644 oss/vtiger/trunk/modules/Emails/ListView.php delete mode 100644 oss/vtiger/trunk/modules/Emails/ListViewPagging.php delete mode 100644 oss/vtiger/trunk/modules/Emails/PHPMailer_LICENSE.txt delete mode 100644 oss/vtiger/trunk/modules/Emails/PrintEmail.php delete mode 100644 oss/vtiger/trunk/modules/Emails/Save.php delete mode 100644 oss/vtiger/trunk/modules/Emails/SaveBookmarklet.php delete mode 100644 oss/vtiger/trunk/modules/Emails/TrackAccess.php delete mode 100644 oss/vtiger/trunk/modules/Emails/UnifiedSearch.php delete mode 100644 oss/vtiger/trunk/modules/Emails/class.phpmailer.php delete mode 100644 oss/vtiger/trunk/modules/Emails/class.smtp.php delete mode 100644 oss/vtiger/trunk/modules/Emails/gotodownload.php delete mode 100644 oss/vtiger/trunk/modules/Emails/index.php delete mode 100644 oss/vtiger/trunk/modules/Emails/language/en_us.lang.php delete mode 100644 oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-en_us.php delete mode 100644 oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-zh_cn.php delete mode 100644 oss/vtiger/trunk/modules/Emails/language/zh_cn.lang.php delete mode 100644 oss/vtiger/trunk/modules/Emails/mail.php delete mode 100644 oss/vtiger/trunk/modules/Emails/mailSelect.php delete mode 100644 oss/vtiger/trunk/modules/Emails/mailsend.php delete mode 100644 oss/vtiger/trunk/modules/Emails/templates/testemailtemplateusage.php delete mode 100644 oss/vtiger/trunk/modules/Emails/templates/todel.txt delete mode 100644 oss/vtiger/trunk/modules/Emails/updateRelations.php delete mode 100644 oss/vtiger/trunk/modules/Emails/webmailsend.php diff --git a/oss/vtiger/trunk/modules/Emails/CallRelatedList.php b/oss/vtiger/trunk/modules/Emails/CallRelatedList.php deleted file mode 100644 index 5b04fa97..00000000 --- a/oss/vtiger/trunk/modules/Emails/CallRelatedList.php +++ /dev/null @@ -1,66 +0,0 @@ -retrieve_entity_info($RECORD,$currentmodule); - $focus->id = $RECORD; - $focus->name=$focus->column_fields['subject']; - $log->debug("id is ".$focus->id); - $log->debug("name is ".$focus->name); -} - -global $mod_strings; -global $app_strings; -global $currentModule; -global $theme; -$theme_path="themes/".$theme."/"; -$image_path=$theme_path."images/"; - -$smarty = new vtigerCRM_Smarty; - -if (isset($focus->name)) $smarty->assign("NAME", $focus->name); -$related_array=getRelatedLists($currentModule,$focus); -$category = getParentTab(); -$smarty->assign("CATEGORY",$category); -if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') { - $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode'])); -} -$smarty->assign("id",$focus->id); -$smarty->assign("RELATEDLISTS", $related_array); - -require_once('include/ListView/RelatedListViewSession.php'); -if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) { - $relationId = vtlib_purify($_REQUEST['relation_id']); - RelatedListViewSession::addRelatedModuleToSession($relationId, - vtlib_purify($_REQUEST['selected_header'])); - } -$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession(); -$smarty->assign("SELECTEDHEADERS", $open_related_modules); - -$smarty->assign("ID",$RECORD ); -$smarty->assign("MODULE",$currentmodule); -$smarty->assign("SINGLE_MOD",$app_strings['Email']); -$smarty->assign("UPDATEINFO",updateInfo($focus->id)); -$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/Emails/Choose.php b/oss/vtiger/trunk/modules/Emails/Choose.php deleted file mode 100644 index 98605f85..00000000 --- a/oss/vtiger/trunk/modules/Emails/Choose.php +++ /dev/null @@ -1,82 +0,0 @@ -pquery($querystr, array()); -$numrows = $adb->num_rows($result); - -?> -
- -

The following emails are available for the selected record. Please choose the ones you would like to use.

-
- - query_result($result,$i,'columnname'); - $temp1=br2nl($myfocus->column_fields[$temp]); - echo ''; - } - ?> - - - -
'.$adb->query_result($result,$i,'fieldlabel').'    '.$temp1.'
- -
-
diff --git a/oss/vtiger/trunk/modules/Emails/ChooseEmail.php b/oss/vtiger/trunk/modules/Emails/ChooseEmail.php deleted file mode 100644 index 5ef825c2..00000000 --- a/oss/vtiger/trunk/modules/Emails/ChooseEmail.php +++ /dev/null @@ -1,106 +0,0 @@ -pquery($querystr, array()); -$numrows = $adb->num_rows($result); - -if ($pmodule=='Accounts') -{ - require_once('modules/Accounts/Accounts.php'); - $myfocus = new Accounts(); - $myfocus->retrieve_entity_info($entityid,"Accounts"); -} -elseif ($pmodule=='Contacts') -{ - require_once('modules/Contacts/Contacts.php'); - $myfocus = new Contacts(); - $myfocus->retrieve_entity_info($entityid,"Contacts"); -} -elseif ($pmodule=='Leads') -{ - require_once('modules/Leads/Leads.php'); - $myfocus = new Leads(); - $myfocus->retrieve_entity_info($entityid,"Leads"); -} -?> - - -
-

The following emails are available for the selected record. Please choose the ones you would like to use.

-
- - query_result($result,$i,'columnname'); - $temp1=br2nl($myfocus->column_fields[$temp]); - echo ''; - } - ?> -
'.$adb->query_result($result,$i,'fieldlabel').'    '.$temp1.'
- - -
-
diff --git a/oss/vtiger/trunk/modules/Emails/CustomView.php b/oss/vtiger/trunk/modules/Emails/CustomView.php deleted file mode 100644 index 93231ed6..00000000 --- a/oss/vtiger/trunk/modules/Emails/CustomView.php +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/oss/vtiger/trunk/modules/Emails/Delete.php b/oss/vtiger/trunk/modules/Emails/Delete.php deleted file mode 100644 index b8e17de0..00000000 --- a/oss/vtiger/trunk/modules/Emails/Delete.php +++ /dev/null @@ -1,36 +0,0 @@ - \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/DetailView.php b/oss/vtiger/trunk/modules/Emails/DetailView.php deleted file mode 100644 index f159ffd5..00000000 --- a/oss/vtiger/trunk/modules/Emails/DetailView.php +++ /dev/null @@ -1,159 +0,0 @@ -retrieve_entity_info($_REQUEST['record'],"Emails"); - $log->info("Entity info successfully retrieved for DetailView."); - $focus->id = $_REQUEST['record']; - $query = 'select email_flag,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid = ?'; - $result = $adb->pquery($query, array($focus->id)); - $smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email')); - $to_email = $json->decode($adb->query_result($result,0,'to_email')); - $cc_email = $json->decode($adb->query_result($result,0,'cc_email')); - $smarty->assign('TO_MAIL',vt_suppressHTMLTags(@implode(',',$to_email))); - $smarty->assign('CC_MAIL',vt_suppressHTMLTags(@implode(',',$cc_email))); - $bcc_email = $json->decode($adb->query_result($result,0,'bcc_email')); - $smarty->assign('BCC_MAIL',vt_suppressHTMLTags(@implode(',',$bcc_email))); - $smarty->assign('EMAIL_FLAG',$adb->query_result($result,0,'email_flag')); - if($focus->column_fields['name'] != '') - $focus->name = $focus->column_fields['name']; - else - $focus->name = $focus->column_fields['subject']; -} -if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') -{ - $focus->id = ""; -} - -//needed when creating a new email with default values passed in -if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) -{ - $focus->contact_name = $_REQUEST['contact_name']; -} -if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) -{ - $focus->contact_id = $_REQUEST['contact_id']; -} -if (isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name)) -{ - $focus->parent_name = $_REQUEST['opportunity_name']; -} -if (isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id)) -{ - $focus->parent_id = $_REQUEST['opportunity_id']; -} -if (isset($_REQUEST['account_name']) && is_null($focus->parent_name)) -{ - $focus->parent_name = $_REQUEST['account_name']; -} -if (isset($_REQUEST['account_id']) && is_null($focus->parent_id)) -{ - $focus->parent_id = $_REQUEST['account_id']; -} -if (isset($_REQUEST['parent_name'])) -{ - $focus->parent_name = $_REQUEST['parent_name']; -} -if (isset($_REQUEST['parent_id'])) -{ - $focus->parent_id = $_REQUEST['parent_id']; -} -if (isset($_REQUEST['parent_type'])) -{ - $focus->parent_type = $_REQUEST['parent_type']; -} -if (isset($_REQUEST['filename']) && is_null($focus->filename)) -{ - $focus->filename = $_REQUEST['filename']; -} -elseif (is_null($focus->parent_type)) -{ - $focus->parent_type = $app_list_strings['record_type_default_key']; -} - -global $theme; -$theme_path="themes/".$theme."/"; -$image_path=$theme_path."images/"; - -$log->info("Email detail view"); - -$submenu = array('LBL_EMAILS_TITLE'=>'index.php?module=Emails&action=index','LBL_WEBMAILS_TITLE'=>'index.php?module=squirrelmail-1.4.4&action=redirect'); -$sec_arr = array('index.php?module=Emails&action=index'=>'Emails','index.php?module=squirrelmail-1.4.4&action=redirect'=>'Emails'); - -$smarty->assign("MOD", $mod_strings); -$smarty->assign("APP", $app_strings); - -$smarty->assign("UPDATEINFO",updateInfo($focus->id)); -if (isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); -if (isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); -if (isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id'])); -$smarty->assign("THEME", $theme); -$smarty->assign("IMAGE_PATH", $image_path); -$category = getParentTab(); -$smarty->assign("CATEGORY",$category); - -if (isset($focus->name)) $smarty->assign("NAME", $focus->name); - else $smarty->assign("NAME", ""); - -$entries = getBlocks($currentModule,"detail_view",'',$focus->column_fields); -$entries[$mod_strings['LBL_EMAIL_INFORMATION']]['5'][$mod_strings['Description']]['value'] = from_html($entries[$mod_strings['LBL_EMAIL_INFORMATION']]['5'][$mod_strings['Description']]['value']); -//changed this to view description in all langauge - bharath -$smarty->assign("BLOCKS",$entries[$mod_strings['LBL_EMAIL_INFORMATION']]); -$smarty->assign("SINGLE_MOD", 'Email'); - -$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); - -if(isPermitted("Emails","EditView",$_REQUEST['record']) == 'yes') - $smarty->assign("EDIT_DUPLICATE","permitted"); - -if(isPermitted("Emails","Delete",$_REQUEST['record']) == 'yes') - $smarty->assign("DELETE","permitted"); -$smarty->assign("ID",$focus->id); - -$check_button = Button_Check($module); -$smarty->assign("CHECK", $check_button); - -//Constructing the Related Lists from here -$smarty->assign("MODULE",$currentModule); -$smarty->assign("SENDER",$email_id); -if($_REQUEST['mode'] != 'ajax') - $smarty->display("EmailDetailView.tpl"); -else - $smarty->display("EmailDetails.tpl") -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/EditView.php b/oss/vtiger/trunk/modules/Emails/EditView.php deleted file mode 100644 index ccaae33f..00000000 --- a/oss/vtiger/trunk/modules/Emails/EditView.php +++ /dev/null @@ -1,356 +0,0 @@ - The selected file has no data or a invalid file.
'; -} - -//Email Error handling -if($_REQUEST['mail_error'] != '') -{ - require_once("modules/Emails/mail.php"); - echo parseEmailErrorString($_REQUEST['mail_error']); -} -//added to select the module in combobox of compose-popup -if(isset($_REQUEST['par_module']) && $_REQUEST['par_module']!=''){ - $smarty->assign('select_module',vtlib_purify($_REQUEST['par_module'])); -} -elseif(isset($_REQUEST['pmodule']) && $_REQUEST['pmodule']!='') { - $smarty->assign('select_module',vtlib_purify($_REQUEST['pmodule'])); -} - -if(isset($_REQUEST['record']) && $_REQUEST['record'] !='') -{ - $focus->id = $_REQUEST['record']; - $focus->mode = 'edit'; - $focus->retrieve_entity_info($_REQUEST['record'],"Emails"); - $query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid =?'; - $result = $adb->pquery($query, array($focus->id)); - $from_email = $adb->query_result($result,0,'from_email'); - $smarty->assign('FROM_MAIL',$from_email); - $to_email = implode(',',$json->decode($adb->query_result($result,0,'to_email'))); - $smarty->assign('TO_MAIL',$to_email); - $cc_add = implode(',',$json->decode($adb->query_result($result,0,'cc_email'))); - $smarty->assign('CC_MAIL',$cc_add); - $bcc_add = implode(',',$json->decode($adb->query_result($result,0,'bcc_email'))); - $smarty->assign('BCC_MAIL',$bcc_add); - $idlist = $adb->query_result($result,0,'idlists'); - $smarty->assign('IDLISTS',$idlist); - $log->info("Entity info successfully retrieved for EditView."); - $focus->name=$focus->column_fields['name']; -} -elseif(isset($_REQUEST['sendmail']) && $_REQUEST['sendmail'] !='') -{ - - $mailids = get_to_emailids($_REQUEST['pmodule']); - if($mailids['mailds'] != '') - $to_add = trim($mailids['mailds'],",").","; - $smarty->assign('TO_MAIL',$to_add); - $smarty->assign('IDLISTS',$mailids['idlists']); - $focus->mode = ''; -} - -// INTERNAL MAILER -if($_REQUEST["internal_mailer"] == "true") { - $smarty->assign('INT_MAILER',"true"); - $rec_type = $_REQUEST["type"]; - $rec_id = $_REQUEST["rec_id"]; - $fieldname = $_REQUEST["fieldname"]; - - //added for getting list-ids to compose email popup from list view(Accounts,Contacts,Leads) - if(isset($_REQUEST['field_id']) && strlen($_REQUEST['field_id']) != 0) { - if($_REQUEST['par_module'] == "Users") - $id_list = $_REQUEST['rec_id'].'@'.'-1|'; - else - $id_list = $_REQUEST['rec_id'].'@'.$_REQUEST['field_id'].'|'; - $smarty->assign("IDLISTS", $id_list); - } - if($rec_type == "record_id") { - $type = $_REQUEST['par_module']; - //check added for email link in user detail view - $normal_tabs = Array('Users'=>'vtiger_users', 'Leads'=>'vtiger_leaddetails', 'Contacts'=>'vtiger_contactdetails', 'Accounts'=>'vtiger_account', 'Vendors'=>'vtiger_vendor'); - $cf_tabs = Array('Accounts'=>'vtiger_accountscf', 'Campaigns'=>'vtiger_campaignscf', 'Contacts'=>'vtiger_contactscf', 'Invoice'=>'vtiger_invoicecf', 'Leads'=>'vtiger_leadscf', 'Potentials'=>'vtiger_potentialscf', 'Products'=>'vtiger_productcf', 'PurchaseOrder'=>'vtiger_purchaseordercf', 'Quotes'=>'vtiger_quotescf', 'SalesOrder'=>'vtiger_salesordercf', 'HelpDesk'=>'vtiger_ticketcf', 'Vendors'=>'vtiger_vendorcf'); - if(substr($fieldname,0,2)=="cf") - $tablename = $cf_tabs[$type]; - else - $tablename = $normal_tabs[$type]; - if($type == "Users") - $q = "select $fieldname from $tablename where id=?"; - elseif($type == "Leads") - $q = "select $fieldname from $tablename where leadid=?"; - elseif ($type == "Contacts") - $q = "select $fieldname from $tablename where contactid=?"; - elseif ($type == "Accounts") - $q = "select $fieldname from $tablename where accountid=?"; - elseif ($type == "Vendors") - $q = "select $fieldname from $tablename where vendorid=?"; - else { - // vtlib customization: Support for email-type custom field for other modules. - $module_focus = CRMEntity::getInstance($type); - vtlib_setup_modulevars($type, $module_focus); - if(!empty($module_focus->customFieldTable)) { - $q = "select $fieldname from " . $module_focus->customFieldTable[0] . " where " . $module_focus->customFieldTable[1]. "= ?"; - } - // END - } - $email1 = $adb->query_result($adb->pquery($q, array($rec_id)),0,$fieldname); - } elseif ($rec_type == "email_addy") { - $email1 = $_REQUEST["email_addy"]; - } - - $smarty->assign('TO_MAIL',trim($email1,",").","); -} - -//handled for replying emails -if($_REQUEST['reply'] == "true") -{ - $fromadd = $_REQUEST['record']; - $query = "select from_email,idlists,cc_email,bcc_email from vtiger_emaildetails where emailid =?"; - $result = $adb->pquery($query, array($fromadd)); - $from_mail = $adb->query_result($result,0,'from_email'); - $smarty->assign('TO_MAIL',trim($from_mail,",").','); - $cc_add = implode(',',$json->decode($adb->query_result($result,0,'cc_email'))); - $smarty->assign('CC_MAIL',$cc_add); - $bcc_add = implode(',',$json->decode($adb->query_result($result,0,'bcc_email'))); - $smarty->assign('BCC_MAIL',$bcc_add); - $smarty->assign('IDLISTS',preg_replace('/###/',',',$adb->query_result($result,0,'idlists'))); -} - -// Webmails -if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") { - $mailid = $_REQUEST["mailid"]; - $mailbox = $_REQUEST["mailbox"]; - require_once('include/utils/UserInfoUtil.php'); - require_once("modules/Webmails/Webmails.php"); - require_once("modules/Webmails/MailParse.php"); - require_once('modules/Webmails/MailBox.php'); - - $mailInfo = getMailServerInfo($current_user); - $temprow = $adb->fetch_array($mailInfo); - - $MailBox = new MailBox($mailbox); - $mbox = $MailBox->mbox; - - $webmail = new Webmails($mbox,$mailid); - $array_tab = Array(); - $webmail->loadMail($array_tab); - $hdr = @imap_headerinfo($mbox, $mailid); - $smarty->assign('WEBMAIL',"true"); - $smarty->assign('mailid',$mailid); - $smarty->assign('mailbox',$mailbox); - $temp_id = $MailBox->boxinfo['mail_id']; - $smarty->assign('from_add',$temp_id); - $webmail->subject = utf8_decode(utf8_encode(imap_utf8($webmail->subject))); - if($_REQUEST["reply"] == "all") { - $smarty->assign('TO_MAIL',$webmail->from.","); - //added to remove the emailid of webmail client from cc list....to fix the issue #3818 - $cc_address = ''; - - $use_to_header = htmlentities($webmail->to_header, ENT_QUOTES, $default_charset); - $use_cc_address= htmlentities($hdr->ccaddress, ENT_QUOTES, $default_charset); - - $cc_array = explode(',',$use_to_header.','.$use_cc_address); - for($i=0;$iassign('CC_MAIL',$cc_address); - // fix #3818 ends - /*if(is_array($webmail->cc_list)) - { - $smarty->assign('CC_MAIL',implode(",",$webmail->cc_list).",".implode(",",$webmail->to)); - } - else - { - //Commenting this to fix #3231 - // $smarty->assign('CC_MAIL',implode(",",$webmail->to)); - }*/ - if(preg_match("/RE:/i", $webmail->subject)) - $smarty->assign('SUBJECT',$webmail->subject); - else - $smarty->assign('SUBJECT',"RE: ".$webmail->subject); - - } elseif($_REQUEST["reply"] == "single"){ - $smarty->assign('TO_MAIL',$webmail->reply_to[0].","); - //$smarty->assign('BCC_MAIL',$webmail->to[0]); - if(preg_match("/RE:/i", $webmail->subject)) - $smarty->assign('SUBJECT',$webmail->subject); - else - $smarty->assign('SUBJECT',"RE: ".$webmail->subject); - - } elseif($_REQUEST["forward"] == "true" ) { - //added for attachment handling - $attachment_links = Array(); - for($i=0;$iattname);$i++){ - $attachment_links[$i] = $webmail->anchor_arr[$i].decode_header($webmail->attname[$i])."
"; - } - $smarty->assign('webmail_attachments',$attachment_links); - if(preg_match("/FW:/i", $webmail->subject)) - $smarty->assign('SUBJECT',$webmail->subject); - else - $smarty->assign('SUBJECT',"FW: ".$webmail->subject); - } - $smarty->assign('DESCRIPTION',$webmail->replyBody()); - $focus->mode=''; -} - -global $theme; -$theme_path="themes/".$theme."/"; -$image_path=$theme_path."images/"; - -$disp_view = getView($focus->mode); -$details = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields); -//changed this below line to view description in all language - bharath -$smarty->assign("BLOCKS",$details[$mod_strings['LBL_EMAIL_INFORMATION']]); -$smarty->assign("MODULE",$currentModule); -$smarty->assign("SINGLE_MOD",$app_strings['Email']); -//id list of attachments while forwarding -$smarty->assign("ATT_ID_LIST",$att_id_list); - -//needed when creating a new email with default values passed in -if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) -{ - $focus->contact_name = $_REQUEST['contact_name']; -} -if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) -{ - $focus->contact_id = $_REQUEST['contact_id']; -} -if (isset($_REQUEST['parent_name']) && is_null($focus->parent_name)) -{ - $focus->parent_name = $_REQUEST['parent_name']; -} -if (isset($_REQUEST['parent_id']) && is_null($focus->parent_id)) -{ - $focus->parent_id = $_REQUEST['parent_id']; -} -if (isset($_REQUEST['parent_type'])) -{ - $focus->parent_type = $_REQUEST['parent_type']; -} -if (isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true') -{ - $focus->filename = $_REQUEST['filename']; -} -elseif (is_null($focus->parent_type)) -{ - $focus->parent_type = $app_list_strings['record_type_default_key']; -} - -$log->info("Email detail view"); - -$smarty->assign("MOD", $mod_strings); -$smarty->assign("APP", $app_strings); -if (isset($focus->name)) $smarty->assign("NAME", $focus->name); -else $smarty->assign("NAME", ""); - - -if($focus->mode == 'edit') -{ - $smarty->assign("UPDATEINFO",updateInfo($focus->id)); - $smarty->assign("MODE", $focus->mode); -} - -// Unimplemented until jscalendar language vtiger_files are fixed - -$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); -$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); - -if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); -else $smarty->assign("RETURN_MODULE",'Emails'); -if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); -else $smarty->assign("RETURN_ACTION",'index'); -if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id'])); -if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname'])); - -$smarty->assign("THEME", $theme); -$smarty->assign("IMAGE_PATH", $image_path); -$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); -$smarty->assign("ID", $focus->id); -$smarty->assign("ENTITY_ID", vtlib_purify($_REQUEST["record"])); -$smarty->assign("ENTITY_TYPE",vtlib_purify($_REQUEST["email_directing_module"])); -$smarty->assign("OLD_ID", $old_id ); -//Display the RTE or not? -- configure $USE_RTE in config.php -$USE_RTE = vt_hasRTE(); -$smarty->assign("USE_RTE",$USE_RTE); - -if(empty($focus->filename)) -{ - $smarty->assign("FILENAME_TEXT", ""); - $smarty->assign("FILENAME", ""); -} -else -{ - $smarty->assign("FILENAME_TEXT", "(".$focus->filename.")"); - $smarty->assign("FILENAME", $focus->filename); -} -if($ret_error == 1) { - require_once('modules/Webmails/MailBox.php'); - $smarty->assign("RET_ERROR",$ret_error); - if($ret_parentid != ''){ - $smarty->assign("IDLISTS",$ret_parentid); - } - if($ret_toadd != '') - $smarty->assign("TO_MAIL",$ret_toadd); - $ret_toadd = ''; - if($ret_subject != '') - $smarty->assign("SUBJECT",$ret_subject); - if($ret_ccaddress != '') - $smarty->assign("CC_MAIL",$ret_ccaddress); - if($ret_bccaddress != '') - $smarty->assign("BCC_MAIL",$ret_bccaddress); - if($ret_description != '') - $smarty->assign("DESCRIPTION", $ret_description); - $temp_obj = new MailBox($mailbox); - $temp_id = $temp_obj->boxinfo['mail_id']; - if($temp_id != '') - $smarty->assign('from_add',$temp_id); -} -$check_button = Button_Check($module); -$smarty->assign("CHECK", $check_button); - -$smarty->display("ComposeEmail.tpl"); - -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/Emails.js b/oss/vtiger/trunk/modules/Emails/Emails.js deleted file mode 100644 index 3401a48e..00000000 --- a/oss/vtiger/trunk/modules/Emails/Emails.js +++ /dev/null @@ -1,196 +0,0 @@ -/********************************************************************************* - -** 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. - ********************************************************************************/ - -var gFolderid = 1; -var gselectedrowid = 0; -function gotoWebmail() -{ - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module=Webmails&action=WebmailsAjax&config_chk=true", - onComplete: function(response) { - if(response.responseText.indexOf('SUCCESS') > -1) - window.location.href = "index.php?module=Webmails&action=index&parenttab=My Home Page"; - else - $('mailconfchk').style.display = 'block'; - - } - } - ); - -} - -function getEmailContents(id) -{ - $("status").style.display="inline"; - var rowid = 'row_'+id; - getObj(rowid).className = 'emailSelected'; - if(gselectedrowid != 0 && gselectedrowid != id) - { - var prev_selected_rowid = 'row_'+gselectedrowid; - getObj(prev_selected_rowid).className = 'prvPrfHoverOff'; - } - gselectedrowid = id; - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: 'module=Emails&action=EmailsAjax&file=DetailView&mode=ajax&record='+id, - onComplete: function(response) { - $("status").style.display="none"; - $("EmailDetails").innerHTML = response.responseText; - } - } - ); -} - -function getListViewEntries_js(module,url) -{ - $("status").style.display="inline"; - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&"+url, - onComplete: function(response) { - $("status").style.display="none"; - $("email_con").innerHTML=response.responseText; - execJS(document.getElementById('email_con')); - } - } - ); - -} - -function massDelete() -{ - var delete_selected_row = false; - //added to fix the issue 4295 - var select_options = document.getElementsByName('selected_id'); - var x = select_options.length; - - idstring = ""; - xx = 0; - for(i = 0; i < x ; i++) - { - if(select_options[i].checked) - { - idstring = select_options[i].value +";"+idstring - if(select_options[i].value == gselectedrowid) - { - gselectedrowid = 0; - delete_selected_row = true; - } - xx++ - } - } - if (xx > 0) - { - document.massdelete.idlist.value=idstring; - } - else - { - alert(alert_arr.SELECT); - return false; - } - if(confirm(alert_arr.DELETE + xx + alert_arr.RECORDS)) - { - getObj('search_text').value = ''; - show("status"); - if(!delete_selected_row) - { - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module=Users&action=massdelete&folderid="+gFolderid+"&return_module=Emails&idlist="+idstring, - onComplete: function(response) { - $("status").style.display="none"; - $("email_con").innerHTML=response.responseText; - execJS(document.getElementById('email_con')); - } - } - ); - } - else - { - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module=Users&action=massdelete&folderid="+gFolderid+"&return_module=Emails&idlist="+idstring, - onComplete: function(response) { - $("status").style.display="none"; - $("email_con").innerHTML=response.responseText; - execJS($('email_con')); - $('EmailDetails').innerHTML = '
 
'; - $("subjectsetter").innerHTML=''; - } - } - ); - } - } - else - { - return false; - } -} - -function DeleteEmail(id) -{ - if(confirm(alert_arr.SURE_TO_DELETE)) - { - getObj('search_text').value = ''; - gselectedrowid = 0; - $("status").style.display="inline"; - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module=Users&action=massdelete&return_module=Emails&folderid="+gFolderid+"&idlist="+id, - onComplete: function(response) { - $("status").style.display="none"; - $("email_con").innerHTML=response.responseText; - execJS($('email_con')); - $('EmailDetails').innerHTML = '
 
'; - $("subjectsetter").innerHTML=''; - } - } - ); - } - else - { - return false; - } -} -function Searchfn() -{ - gselectedrowid = 0; - var osearch_field = document.getElementById('search_field'); - var search_field = osearch_field.options[osearch_field.options.selectedIndex].value; - var search_text = document.getElementById('search_text').value; - new Ajax.Request( - 'index.php', - {queue: {position: 'end', scope: 'command'}, - method: 'post', - postBody: "module=Emails&action=EmailsAjax&ajax=true&file=ListView&folderid="+gFolderid+"&search=true&search_field="+search_field+"&search_text="+search_text, - onComplete: function(response) { - $("email_con").innerHTML=response.responseText; - $("status").style.display="none"; - $('EmailDetails').innerHTML = '
 
'; - $("subjectsetter").innerHTML=''; - execJS($('email_con')); - } - } - ); -} - diff --git a/oss/vtiger/trunk/modules/Emails/Emails.php b/oss/vtiger/trunk/modules/Emails/Emails.php deleted file mode 100644 index 8896f9cc..00000000 --- a/oss/vtiger/trunk/modules/Emails/Emails.php +++ /dev/null @@ -1,688 +0,0 @@ -'crmid','vtiger_activity'=>'activityid', - 'vtiger_seactivityrel'=>'activityid','vtiger_cntactivityrel'=>'activityid','vtiger_email_track'=>'mailid','vtiger_emaildetails'=>'emailid'); - - // This is the list of vtiger_fields that are in the lists. - var $list_fields = Array( - 'Subject'=>Array('activity'=>'subject'), - 'Related to'=>Array('seactivityrel'=>'parent_id'), - 'Date Sent'=>Array('activity'=>'date_start'), - 'Assigned To'=>Array('crmentity','smownerid'), - 'Access Count'=>Array('email_track','access_count') - ); - - var $list_fields_name = Array( - 'Subject'=>'subject', - 'Related to'=>'parent_id', - 'Date Sent'=>'date_start', - 'Assigned To'=>'assigned_user_id', - 'Access Count'=>'access_count' - ); - - var $list_link_field= 'subject'; - - var $column_fields = Array(); - - var $sortby_fields = Array('subject','date_start','saved_toid'); - - //Added these variables which are used as default order by and sortorder in ListView - var $default_order_by = 'date_start'; - var $default_sort_order = 'ASC'; - - // Used when enabling/disabling the mandatory fields for the module. - // Refers to vtiger_field.fieldname values. - var $mandatory_fields = Array('subject','assigned_user_id'); - - /** This function will set the columnfields for Email module - */ - - function Emails() { - $this->log = LoggerManager::getLogger('email'); - $this->log->debug("Entering Emails() method ..."); - $this->log = LoggerManager::getLogger('email'); - $this->db = PearDatabase::getInstance(); - $this->column_fields = getColumnFields('Emails'); - $this->log->debug("Exiting Email method ..."); - } - - - function save_module($module) - { - global $adb; - //Inserting into seactivityrel - - //modified by Richie as raju's implementation broke the feature for addition of webmail to vtiger_crmentity.need to be more careful in future while integrating code - if($_REQUEST['module']=="Emails" && $_REQUEST['smodule']!='webmails' && (!$this->plugin_save)) - { - if($_REQUEST['currentid']!='') - { - $actid=$_REQUEST['currentid']; - } - else - { - $actid=$_REQUEST['record']; - } - $parentid=$_REQUEST['parent_id']; - if($_REQUEST['module'] != 'Emails' && $_REQUEST['module'] != 'Webmails') - { - if(!$parentid) { - $parentid = $adb->getUniqueID('vtiger_seactivityrel'); - } - $mysql='insert into vtiger_seactivityrel values(?,?)'; - $adb->pquery($mysql, array($parentid, $actid)); - } - else - { - $myids=explode("|",$parentid); //2@71| - for ($i=0;$i<(count($myids)-1);$i++) - { - $realid=explode("@",$myids[$i]); - $mycrmid=$realid[0]; - //added to handle the relationship of emails with vtiger_users - if($realid[1] == -1) - { - $del_q = 'delete from vtiger_salesmanactivityrel where smid=? and activityid=?'; - $adb->pquery($del_q,array($mycrmid, $actid)); - $mysql='insert into vtiger_salesmanactivityrel values(?,?)'; - } - else - { - $del_q = 'delete from vtiger_seactivityrel where crmid=? and activityid=?'; - $adb->pquery($del_q,array($mycrmid, $actid)); - $mysql='insert into vtiger_seactivityrel values(?,?)'; - } - $params = array($mycrmid, $actid); - $adb->pquery($mysql, $params); - } - } - } - else - { - if(isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '') - { - //$this->insertIntoEntityTable('vtiger_seactivityrel', $module); - $sql = 'insert into vtiger_seactivityrel values(?,?)'; - $params = array($this->column_fields['parent_id'],$_REQUEST['currentid']); - $adb->pquery($sql,$params); - } - elseif($this->column_fields['parent_id']=='' && $insertion_mode=="edit") - { - $this->deleteRelation('vtiger_seactivityrel'); - } - } - - - //Insert into cntactivity rel - - if(isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '') - { - $this->insertIntoEntityTable('vtiger_cntactivityrel', $module); - } - elseif($this->column_fields['contact_id'] =='' && $insertion_mode=="edit") - { - $this->deleteRelation('vtiger_cntactivityrel'); - } - - //Inserting into attachment - - $this->insertIntoAttachment($this->id,$module); - - } - - - function insertIntoAttachment($id,$module) - { - global $log, $adb; - $log->debug("Entering into insertIntoAttachment($id,$module) method."); - - $file_saved = false; - - //Added to send generated Invoice PDF with mail - $pdfAttached = $_REQUEST['pdf_attachment']; - //created Invoice pdf is attached with the mail - if(isset($_REQUEST['pdf_attachment']) && $_REQUEST['pdf_attachment'] !='') - { - $file_saved = pdfAttach($this,$module,$pdfAttached,$id); - } - - //This is to added to store the existing attachment id of the contact where we should delete this when we give new image - foreach($_FILES as $fileindex => $files) - { - if($files['name'] != '' && $files['size'] > 0) - { - $files['original_name'] = vtlib_purify($_REQUEST[$fileindex.'_hidden']); - $file_saved = $this->uploadAndSaveFile($id,$module,$files); - } - } - if($module == 'Emails' && isset($_REQUEST['att_id_list']) && $_REQUEST['att_id_list'] != '') - { - $att_lists = explode(";",$_REQUEST['att_id_list'],-1); - $id_cnt = count($att_lists); - if($id_cnt != 0) - { - for($i=0;$i<$id_cnt;$i++) - { - $sql_rel='insert into vtiger_seattachmentsrel values(?,?)'; - $adb->pquery($sql_rel, array($id, $att_lists[$i])); - } - } - } - if($_REQUEST['att_module'] == 'Webmails') - { - require_once("modules/Webmails/Webmails.php"); - require_once("modules/Webmails/MailParse.php"); - require_once('modules/Webmails/MailBox.php'); - //$mailInfo = getMailServerInfo($current_user); - //$temprow = $adb->fetch_array($mailInfo); - - $MailBox = new MailBox($_REQUEST["mailbox"]); - $mbox = $MailBox->mbox; - $webmail = new Webmails($mbox,$_REQUEST['mailid']); - $array_tab = Array(); - $webmail->loadMail($array_tab); - if(isset($webmail->att_details)){ - foreach($webmail->att_details as $fileindex => $files) - { - if($files['name'] != '' && $files['size'] > 0) - { - //print_r($files); - $file_saved = $this->saveForwardAttachments($id,$module,$files); - } - } - } - } - $log->debug("Exiting from insertIntoAttachment($id,$module) method."); - } - - function saveForwardAttachments($id,$module,$file_details) - { - global $log; - $log->debug("Entering into saveForwardAttachments($id,$module,$file_details) method."); - global $adb, $current_user; - global $upload_badext; - require_once('modules/Webmails/MailBox.php'); - $mailbox=$_REQUEST["mailbox"]; - $MailBox = new MailBox($mailbox); - $mail = $MailBox->mbox; - $binFile = sanitizeUploadFileName($file_details['name'], $upload_badext); - $filename = ltrim(basename(" ".$binFile)); //allowed filename like UTF-8 characters - $filetype= $file_details['type']; - $filesize = $file_details['size']; - $filepart = $file_details['part']; - $transfer = $file_details['transfer']; - $file = imap_fetchbody($mail,$_REQUEST['mailid'],$filepart); - if ($transfer == 'BASE64') - $file = imap_base64($file); - elseif($transfer == 'QUOTED-PRINTABLE') - $file = imap_qprint($file); - $current_id = $adb->getUniqueID("vtiger_crmentity"); - $date_var = date('Y-m-d H:i:s'); - //to get the owner id - $ownerid = $this->column_fields['assigned_user_id']; - if(!isset($ownerid) || $ownerid=='') - $ownerid = $current_user->id; - $upload_file_path = decideFilePath(); - file_put_contents ($upload_file_path.$current_id."_".$filename,$file); - - $sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)"; - $params1 = array($current_id, $current_user->id, $ownerid, $module." Attachment", $this->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true)); - $adb->pquery($sql1, $params1); - - $sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)"; - $params2 = array($current_id, $filename, $this->column_fields['description'], $filetype, $upload_file_path); - $result=$adb->pquery($sql2, $params2); - - if($_REQUEST['mode'] == 'edit') - { - if($id != '' && $_REQUEST['fileid'] != '') - { - $delquery = 'delete from vtiger_seattachmentsrel where crmid = ? and attachmentsid = ?'; - $adb->pquery($delquery, array($id, $_REQUEST['fileid'])); - } - } - $sql3='insert into vtiger_seattachmentsrel values(?,?)'; - $adb->pquery($sql3, array($id, $current_id)); - return true; - $log->debug("exiting from saveforwardattachment function."); - } - /** Returns a list of the associated contacts - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. - * All Rights Reserved.. - * Contributor(s): ______________________________________.. - */ - function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions=false) { - global $log, $singlepane_view,$currentModule,$current_user; - $log->debug("Entering get_contacts(".$id.") method ..."); - $this_module = $currentModule; - - $related_module = vtlib_getModuleNameById($rel_tab_id); - require_once("modules/$related_module/$related_module.php"); - $other = new $related_module(); - vtlib_setup_modulevars($related_module, $other); - $singular_modname = vtlib_toSingular($related_module); - - $parenttab = getParentTab(); - - $returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id; - - $button = ''; - - if($actions) { - if(is_string($actions)) $actions = explode(',', strtoupper($actions)); - if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') { - $button .= " "; - } - if(in_array('BULKMAIL', $actions) && isPermitted($related_module,1, '') == 'yes') { - $button .= ""; - } - } - - $query = 'select vtiger_contactdetails.accountid, vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_contactdetails.emailoptout, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid where vtiger_cntactivityrel.activityid='.$adb->quote($id).' and vtiger_crmentity.deleted=0'; - - $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); - - if($return_value == null) $return_value = Array(); - $return_value['CUSTOM_BUTTON'] = $button; - - $log->debug("Exiting get_contacts method ..."); - return $return_value; - } - - /** Returns the column name that needs to be sorted - * Portions created by vtigerCRM are Copyright (C) vtigerCRM. - * All Rights Reserved.. - * Contributor(s): Mike Crowe - */ - - function getSortOrder() - { - global $log; - $log->debug("Entering getSortOrder() method ..."); - if(isset($_REQUEST['sorder'])) - $sorder = $this->db->sql_escape_string($_REQUEST['sorder']); - else - $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($this->default_sort_order)); - - $log->debug("Exiting getSortOrder method ..."); - return $sorder; - } - - /** Returns the order in which the records need to be sorted - * Portions created by vtigerCRM are Copyright (C) vtigerCRM. - * All Rights Reserved.. - * Contributor(s): Mike Crowe - */ - - function getOrderBy() - { - global $log; - $log->debug("Entering getOrderBy() method ..."); - - $use_default_order_by = ''; - if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) { - $use_default_order_by = $this->default_order_by; - } - - if (isset($_REQUEST['order_by'])) - $order_by = $this->db->sql_escape_string($_REQUEST['order_by']); - else - $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($use_default_order_by)); - - $log->debug("Exiting getOrderBy method ..."); - return $order_by; - } - // Mike Crowe Mod -------------------------------------------------------- - - /** Returns a list of the associated vtiger_users - * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. - * All Rights Reserved.. - * Contributor(s): ______________________________________.. - */ - function get_users($id) - { - global $log; - $log->debug("Entering get_users(".$id.") method ..."); - global $adb; - global $mod_strings; - global $app_strings; - - $id = $_REQUEST['record']; - - $button = '  - '; - - $query = 'SELECT vtiger_users.id, vtiger_users.first_name,vtiger_users.last_name, vtiger_users.user_name, vtiger_users.email1, vtiger_users.email2, vtiger_users.yahoo_id, vtiger_users.phone_home, vtiger_users.phone_work, vtiger_users.phone_mobile, vtiger_users.phone_other, vtiger_users.phone_fax from vtiger_users inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.smid=vtiger_users.id and vtiger_salesmanactivityrel.activityid=?'; - $result=$adb->pquery($query, array($id)); - - $noofrows = $adb->num_rows($result); - $header [] = $app_strings['LBL_LIST_NAME']; - - $header []= $app_strings['LBL_LIST_USER_NAME']; - - $header []= $app_strings['LBL_EMAIL']; - - $header []= $app_strings['LBL_PHONE']; - while($row = $adb->fetch_array($result)) - { - - global $current_user; - - $entries = Array(); - - if(is_admin($current_user)) - { - $entries[] = $row['last_name'].' '.$row['first_name']; - } - else - { - $entries[] = $row['last_name'].' '.$row['first_name']; - } - - $entries[] = $row['user_name']; - $entries[] = $row['email1']; - if($email == '') $email = $row['email2']; - if($email == '') $email = $row['yahoo_id']; - - $entries[] = $row['phone_home']; - if($phone == '') $phone = $row['phone_work']; - if($phone == '') $phone = $row['phone_mobile']; - if($phone == '') $phone = $row['phone_other']; - if($phone == '') $phone = $row['phone_fax']; - - //Adding Security Check for User - - $entries_list[] = $entries; - } - - if($entries_list != '') - $return_data = array("header"=>$header, "entries"=>$entries); - - if($return_data == null) $return_data = Array(); - $return_data['CUSTOM_BUTTON'] = $button; - - $log->debug("Exiting get_users method ..."); - return $return_data; - } - - - /** - * Returns a list of the Emails to be exported - */ - function create_export_query(&$order_by, &$where) - { - global $log; - global $current_user; - $log->debug("Entering create_export_query(".$order_by.",".$where.") method ..."); - - include("include/utils/ExportUtils.php"); - - //To get the Permitted fields query and the permitted fields list - $sql = getPermittedFieldsQuery("Emails", "detail_view"); - $fields_list = getFieldsListFromQuery($sql); - - $query = "SELECT $fields_list FROM vtiger_activity - INNER JOIN vtiger_crmentity - ON vtiger_crmentity.crmid=vtiger_activity.activityid - LEFT JOIN vtiger_users - ON vtiger_users.id = vtiger_crmentity.smownerid - LEFT JOIN vtiger_seactivityrel - ON vtiger_seactivityrel.activityid = vtiger_activity.activityid - LEFT JOIN vtiger_contactdetails - ON vtiger_contactdetails.contactid = vtiger_seactivityrel.crmid - LEFT JOIN vtiger_cntactivityrel - ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid - AND vtiger_cntactivityrel.contactid = vtiger_cntactivityrel.contactid - LEFT JOIN vtiger_groups - ON vtiger_groups.groupid = vtiger_crmentity.smownerid - LEFT JOIN vtiger_salesmanactivityrel - ON vtiger_salesmanactivityrel.activityid = vtiger_activity.activityid - LEFT JOIN vtiger_emaildetails - ON vtiger_emaildetails.emailid = vtiger_activity.activityid - LEFT JOIN vtiger_seattachmentsrel - ON vtiger_activity.activityid=vtiger_seattachmentsrel.crmid - LEFT JOIN vtiger_attachments - ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid"; - $query .= getNonAdminAccessControlQuery('Emails',$current_user); - $query .= "WHERE vtiger_activity.activitytype='Emails' AND vtiger_crmentity.deleted=0 "; - - $log->debug("Exiting create_export_query method ..."); - return $query; - } - - /** - * Used to releate email and contacts -- Outlook Plugin - */ - function set_emails_contact_invitee_relationship($email_id, $contact_id) - { - global $log; - $log->debug("Entering set_emails_contact_invitee_relationship(".$email_id.",". $contact_id.") method ..."); - $query = "insert into $this->rel_contacts_table (contactid,activityid) values(?,?)"; - $this->db->pquery($query, array($contact_id, $email_id), true,"Error setting email to contact relationship: "."
$query"); - $log->debug("Exiting set_emails_contact_invitee_relationship method ..."); - } - - /** - * Used to releate email and salesentity -- Outlook Plugin - */ - function set_emails_se_invitee_relationship($email_id, $contact_id) - { - global $log; - $log->debug("Entering set_emails_se_invitee_relationship(".$email_id.",". $contact_id.") method ..."); - $query = "insert into $this->rel_serel_table (crmid,activityid) values(?,?)"; - $this->db->pquery($query, array($contact_id, $email_id), true,"Error setting email to contact relationship: "."
$query"); - $log->debug("Exiting set_emails_se_invitee_relationship method ..."); - } - - /** - * Used to releate email and Users -- Outlook Plugin - */ - function set_emails_user_invitee_relationship($email_id, $user_id) - { - global $log; - $log->debug("Entering set_emails_user_invitee_relationship(".$email_id.",". $user_id.") method ..."); - $query = "insert into $this->rel_users_table (smid,activityid) values (?,?)"; - $this->db->pquery($query, array($user_id, $email_id), true,"Error setting email to user relationship: "."
$query"); - $log->debug("Exiting set_emails_user_invitee_relationship method ..."); - } - - // Function to unlink an entity with given Id from another entity - function unlinkRelationship($id, $return_module, $return_id) { - global $log; - - $sql='DELETE FROM vtiger_seactivityrel WHERE activityid=?'; - $this->db->pquery($sql, array($id)); - - $sql = 'DELETE FROM vtiger_crmentityrel WHERE (crmid=? AND relmodule=? AND relcrmid=?) OR (relcrmid=? AND module=? AND crmid=?)'; - $params = array($id, $return_module, $return_id, $id, $return_module, $return_id); - $this->db->pquery($sql, $params); - } - - public function getNonAdminAccessControlQuery($module, $user,$scope='') { - return " and vtiger_crmentity$scope.smownerid=$user->id "; - } -} -/** Function to get the emailids for the given ids form the request parameters - * It returns an array which contains the mailids and the parentidlists -*/ - -function get_to_emailids($module) -{ - global $adb; - if(isset($_REQUEST["field_lists"]) && $_REQUEST["field_lists"] != "") - { - $field_lists = $_REQUEST["field_lists"]; - if (is_string($field_lists)) $field_lists = explode(":", $field_lists); - $query = 'select columnname,fieldid from vtiger_field where fieldid in ('. generateQuestionMarks($field_lists) .') and vtiger_field.presence in (0,2)'; - $result = $adb->pquery($query, array($field_lists)); - $columns = Array(); - $idlists = ''; - $mailids = ''; - while($row = $adb->fetch_array($result)) - { - $columns[]=$row['columnname']; - $fieldid[]=$row['fieldid']; - } - $columnlists = implode(',',$columns); - $idstring = $_REQUEST["idlist"]; - $single_record = false; - if(!strpos($idstring,':')) - { - $single_record = true; - } - $crmids = preg_replace('/:/',',',$idstring); - $crmids = explode(",", $crmids); - switch($module) - { - case 'Leads': - $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_crmentity.deleted=0 and ((ltrim(vtiger_leaddetails.email) != \'\') or (ltrim(vtiger_leaddetails.yahooid) != \'\')) and vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')'; - break; - case 'Contacts': - //email opt out funtionality works only when we do mass mailing. - if(!$single_record) - $concat_qry = '(((ltrim(vtiger_contactdetails.email) != \'\') or (ltrim(vtiger_contactdetails.yahooid) != \'\')) and (vtiger_contactdetails.emailoptout != 1)) and '; - else - $concat_qry = '((ltrim(vtiger_contactdetails.email) != \'\') or (ltrim(vtiger_contactdetails.yahooid) != \'\')) and '; - $query = 'select crmid,concat(lastname," ",firstname) as entityname,'.$columnlists.' from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and '.$concat_qry.' vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')'; - break; - case 'Accounts': - //added to work out email opt out functionality. - if(!$single_record) - $concat_qry = '(((ltrim(vtiger_account.email1) != \'\') or (ltrim(vtiger_account.email2) != \'\')) and (vtiger_account.emailoptout != 1)) and '; - else - $concat_qry = '((ltrim(vtiger_account.email1) != \'\') or (ltrim(vtiger_account.email2) != \'\')) and '; - - $query = 'select crmid,accountname as entityname,'.$columnlists.' from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_crmentity.deleted=0 and '.$concat_qry.' vtiger_crmentity.crmid in ('. generateQuestionMarks($crmids) .')'; - break; - } - $result = $adb->pquery($query, array($crmids)); - while($row = $adb->fetch_array($result)) - { - $name = $row['entityname']; - for($i=0;$i,'; - } - } - } - - $return_data = Array('idlists'=>$idlists,'mailds'=>$mailids); - }else - { - $return_data = Array('idlists'=>"",'mailds'=>""); - } - return $return_data; - -} - -//added for attach the generated pdf with email -function pdfAttach($obj,$module,$file_name,$id) -{ - global $log; - $log->debug("Entering into pdfAttach() method."); - - global $adb, $current_user; - global $upload_badext; - $date_var = date('Y-m-d H:i:s'); - - $ownerid = $obj->column_fields['assigned_user_id']; - if(!isset($ownerid) || $ownerid=='') - $ownerid = $current_user->id; - - $current_id = $adb->getUniqueID("vtiger_crmentity"); - - $upload_file_path = decideFilePath(); - - //Copy the file from temporary directory into storage directory for upload - $source_file_path = "storage/".$file_name; - $status = copy($source_file_path, $upload_file_path.$current_id."_".$file_name); - //Check wheather the copy process is completed successfully or not. if failed no need to put entry in attachment table - if($status) - { - $query1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?,?,?,?,?,?,?)"; - $params1 = array($current_id, $current_user->id, $ownerid, $module." Attachment", $obj->column_fields['description'], $adb->formatDate($date_var, true), $adb->formatDate($date_var, true)); - $adb->pquery($query1, $params1); - - $query2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?,?,?,?,?)"; - $params2 = array($current_id, $file_name, $obj->column_fields['description'], 'pdf', $upload_file_path); - $result=$adb->pquery($query2, $params2); - - $query3='insert into vtiger_seattachmentsrel values(?,?)'; - $adb->pquery($query3, array($id, $current_id)); - - // Delete the file that was copied - unlink($source_file_path); - - return true; - } - else - { - $log->debug("pdf not attached"); - return false; - } -} -//this function check email fields profile permission as well as field access permission -function emails_checkFieldVisiblityPermission($fieldname) { - global $current_user; - $ret = getFieldVisibilityPermission('Emails',$current_user->id,$fieldname); - return $ret; -} - -?> diff --git a/oss/vtiger/trunk/modules/Emails/EmailsAjax.php b/oss/vtiger/trunk/modules/Emails/EmailsAjax.php deleted file mode 100644 index 2a1c900e..00000000 --- a/oss/vtiger/trunk/modules/Emails/EmailsAjax.php +++ /dev/null @@ -1,55 +0,0 @@ -retrieve_entity_info($crmid,"Emails"); - $modObj->column_fields[$fieldname] = $fieldvalue; - $modObj->id = $crmid; - $modObj->mode = "edit"; - $modObj->save("Emails"); - if($modObj->id != "") - { - echo ":#:SUCCESS"; - }else - { - echo ":#:FAILURE"; - } - }else - { - echo ":#:FAILURE"; - } -} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE") { - require_once 'include/ListView/RelatedListViewContents.php'; -} -elseif($_REQUEST['ajaxmode'] == 'qcreate') -{ - require_once('quickcreate.php'); -} -else -{ - require_once('include/Ajax/CommonAjax.php'); -} -?> diff --git a/oss/vtiger/trunk/modules/Emails/GmailBookmarklet.js b/oss/vtiger/trunk/modules/Emails/GmailBookmarklet.js deleted file mode 100644 index 42ffc58d..00000000 --- a/oss/vtiger/trunk/modules/Emails/GmailBookmarklet.js +++ /dev/null @@ -1,581 +0,0 @@ -function init(){ - function XHR(type,url,params){ - this.xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); - this.url = url; - this.params = params; - this.type = type; - }; - XHR.prototype.load=function(async,callback){ - this.onload=callback; - this.async=async; - - if(this.type.toLowerCase()=="get"){ - this.url = this.url+"?"+this.params; - } - - this.xhr.open(this.type,this.url,this.async); - try{ - if(async){ - var request = this; - this.xhr.onreadystatechange=function(){ - request.readyStateChange(); - } - } - if(this.type.toLowerCase()=="post"){ - this.xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); - this.xhr.setRequestHeader("Content-length", this.params.length); - } - this.xhr.send(this.params); - }catch(e){ - alert("error: "+e); - } - }; - XHR.prototype.readyStateChange=function(){ - var ready=this.xhr.readyState; - if(ready==4){ - var httpStatus=null; - httpStatus=this.xhr.status; - if(httpStatus==200 || httpStatus==0){ - if(this.async){ - this.onload.call(this,this.xhr); - } - } - } - }; - - function VtigerWebservice(vtigerurl,username,accesskey){ - var vtigerURL=vtigerurl; - var username=username; - var accessKey=accesskey; - var userId=null; - var sessionId=null; - - function getResult(response){ - return response.result; - } - - function getError(response){ - return response.error; - } - - function extendsession(){ - var req = new XHR("post",vtigerURL,"operation=extendsession"); - req.load(false); - var res = JSON.parse(req.xhr.responseText); - if(res.success){ - var result = getResult(res); - this.userId=result.userId; - this.sessionId=result.sessionName; - } - } - - function create(object, objectType, callback){ - var objectJson = JSON.stringify(object); - var req = new XHR("post",document.vtigerURL,("operation=create&elementType="+objectType+"&sessionName="+this.sessionId+ - "&element="+encodeURIComponent(objectJson))); - req.load(true,callback); - } - - function query(query, callback){ - var req = new XHR("get",document.vtigerURL,"operation=query&query="+encodeURIComponent(query)+"&sessionName="+this.sessionId); - req.load(true,callback); - } - return {extendSession:extendsession,query:query,getResult:getResult,userId:userId,create:create,getError:getError}; - }; - if (!this.JSON) { - JSON = function () { - function f(n) { - return n < 10 ? "0" + n : n; - } - Date.prototype.toJSON = function () { - return this.getUTCFullYear() + "-" + - f(this.getUTCMonth() + 1) + "-" + - f(this.getUTCDate()) + "T" + - f(this.getUTCHours()) + ":" + - f(this.getUTCMinutes()) + ":" + - f(this.getUTCSeconds()) + "Z"; - }; - var m = { - "\b": "\\b", - "\t": "\\t", - "\n": "\\n", - "\f": "\\f", - "\r": "\\r", - "\"" : "\\\"", - "\\": "\\\\" - }; - function stringify(value, whitelist) { - var a, // The array holding the partial texts. - i, // The loop counter. - k, // The member key. - l, // Length. - r = /["\\\x00-\x1f\x7f-\x9f]/g, - v; // The member value. - switch (typeof value) { - case "string": - return r.test(value) ? - "\"" + value.replace(r, function (a) { - var c = m[a]; - if (c) { - return c; - } - c = a.charCodeAt(); - return "\\u00" + Math.floor(c / 16).toString(16) + - (c % 16).toString(16); - }) + "\"" : - "\"" + value + "\""; - case "number": - return isFinite(value) ? String(value) : "null"; - case "boolean": - case "null": - return String(value); - case "object": - if (!value) { - return "null"; - } - if (typeof value.toJSON === "function") { - return stringify(value.toJSON()); - } - a = []; - if (typeof value.length === "number" && - !(value.propertyIsEnumerable("length"))) { - l = value.length; - for (i = 0; i < l; i += 1) { - a.push(stringify(value[i], whitelist) || "null"); - } - return "[" + a.join(",") + "]"; - } - if (whitelist) { - l = whitelist.length; - for (i = 0; i < l; i += 1) { - k = whitelist[i]; - if (typeof k === "string") { - v = stringify(value[k], whitelist); - if (v) { - a.push(stringify(k) + ":" + v); - } - } - } - } else { - for (k in value) { - if (typeof k === "string") { - v = stringify(value[k], whitelist); - if (v) { - a.push(stringify(k) + ":" + v); - } - } - } - } - return "{" + a.join(",") + "}"; - } - return undefined; - } - return { - stringify: stringify, - parse: function (text, filter) { - var j; - function walk(k, v) { - var i, n; - if (v && typeof v === "object") { - for (i in v) { - if (Object.prototype.hasOwnProperty.apply(v, [i])) { - n = walk(i, v[i]); - if (n !== undefined) { - v[i] = n; - } - } - } - } - return filter(k, v); - } - if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, "@"). - replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, "]"). - replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) { - j = eval("(" + text + ")"); - return typeof filter === "function" ? walk("", j) : j; - } - throw new SyntaxError("parseJSON"); - } - }; - }(); - } - - function trim(str) { - var s = str.replace(/\s+$/, ""); - s = s.replace(/^\s+/, ""); - return s; - } - - function getGmailSubject() { - var subject = top.document.title; - var firstIndexOf = subject.indexOf("-"); - var lastIndexOf = subject.lastIndexOf("-"); - subject = subject.substring(firstIndexOf+1, lastIndexOf-1); - return trim(subject); - } - - function getVtigerBaseURL(){ - var url = document.location.href.substring(0,document.location.href.lastIndexOf('/')+1); - if(url.length > 0){ - if(url.charAt(url.length-1) !="/"){ - url += "/"; - } - return url; - } - return null; - } - - function getVtigerURL(){ - if(document.vtigerBaseURL.length > 0){ - var url =document.vtigerBaseURL; - url +="webservice.php"; - return url; - } - return null; - } - - function getGmailURL() { - var locationhref = location.href; - if(locationhref.indexOf("?")) { - var lsplits = locationhref.split("?"); - locationhref = lsplits[0]; - } else if(locationhref.indexOf("#")) { - var lsplits = locationhref.split("#"); - locationhref = lsplits[0]; - } - return locationhref; - } - - var elementId = "__vtigerBookMarkletDiv__"; - var busyElementId = "__vtigerBookMarkletDivBusy__" - function showBookMarkletUI(){ - var bookMarkletDiv = document.getElementById(elementId); - if(bookMarkletDiv == null){ - bookMarkletDiv.style.display="block"; - } - } - - function hideBookMarkletUI(){ - var bookMarkletDiv = document.getElementById(elementId); - if(bookMarkletDiv != null){ - bookMarkletDiv.style.display="none"; - } - } - - function destroyBookMarkletUI(){ - var closeElementId = '__vtigetGmailCloseElement'; - var parentLocation = location.href.split("location="); - if(parentLocation.length>1){ - var closeElement = document.getElementById(closeElementId); - if(closeElement==null){ - closeElement = document.createElement("iframe"); - closeElement.style.width="0px"; - closeElement.frameBorder="0px"; - closeElement.style.height="0px"; - closeElement.style.display="none"; - closeElement.id = closeElementId; - closeElement.src = decodeURIComponent(parentLocation[1])+"#"; - document.body.appendChild(closeElement); - } - closeElement.onload=function(){ - eval('window.parent.parent.removeMe()'); - } - } - } - - function showBusy(){ - var bookMarkletDiv = document.getElementById(elementId); - var busyElem = document.getElementById(busyElementId); - if(busyElem==null){ - busyElem = document.createElement('div'); - busyElem.id = busyElementId; - busyElem.innerHTML="Working..."; - busyElem.style.position="absolute"; - busyElem.style.top="5px"; - busyElem.style.right="5px"; - busyElem.style.color="white"; - busyElem.style.backgroundColor="#D75235"; - busyElem.style.padding="2px"; - bookMarkletDiv.appendChild(busyElem); - }else{ - busyElem.style.display="block"; - } - - } - - function hideBusy(){ - var busyElem = document.getElementById(busyElementId); - if(busyElem!=null){ - busyElem.style.display="none"; - } - } - - if(typeof document.vtigerURL =="undefined" || document.vtigerURL == null || document.vtigerURL == ""){ - document.vtigerBaseURL = getVtigerBaseURL(); - if(document.vtigerBaseURL ==null){ - alert("Please Provide a Valid URL"); - return; - } - document.vtigerURL = getVtigerURL(); - } - var client = new VtigerWebservice(document.vtigerURL,null,null); - - showBusy(); - client.extendSession(); - hideBusy(); - showBookMarkletUI(); - - function onReady(id,callback){ - var interval = window.setInterval(function(){ - var elem = document.getElementById(id); - if(elem != null && typeof elem != "undefined"){ - callback(); - window.clearInterval(interval); - } - },10); - } - - function createBookMarkletUI(){ - - onReady("__saveVtigerEmail__",function(){ - document.getElementById("__saveVtigerEmail__").onclick=function(){ - createEmail(); - } - }); - onReady("parentType",function(){ - document.getElementById("parentName").innerHTML = "No "+document.getElementById("parentType").value+" Selected."; - document.getElementById("parentType").onchange=function(){ - document.getElementById("parentName").innerHTML = "No "+this.value+" Selected."; - } - }); - - function getQuery(searchValue){ - - var moduleName = document.getElementById("parentType").value; - var moduleDetails = JSON.parse(moduleNameFields); - var entityNameFields = moduleDetails[moduleName]; - var selectFields = ''; - var whereFields = ''; - each(entityNameFields,function(k,v){ - if(selectFields.length > 0){ - selectFields +=','; - } - selectFields += v; - if(whereFields.length > 0){ - whereFields +=" or "; - } - whereFields += v+" like '%"+searchValue+"%'"; - }); - - var moduleEmailDetails = JSON.parse(moduleEmailFields); - var entityEmailFields = moduleEmailDetails[moduleName]; - each(entityEmailFields, function(k,v){ - if(selectFields.length > 0) { - selectFields +=','; - } - selectFields += v; - }); - return "select "+selectFields+" from "+moduleName+" where "+whereFields+";"; - } - - onReady("__searchVtigerAccount__",function(){ - document.getElementById("__searchVtigerAccount__").onclick=function(e){ - var elem = document.getElementById("__vtigerAccountSearchList___"); - elem.style.display=""; - - var accountName = document.getElementById("__searchaccount__").value; - if(accountName.length < 1){ - alert("Please enter the search critiria"); - return; - } - showBusy(); - var q = getQuery(accountName); - var moduleName = document.getElementById("parentType").value; - var responseElem = document.getElementById("__vtigerAccountSearchResponse___"); - if(responseElem != null){ - responseElem.innerHTML = ''; - } - client.query(q,function(response){ - var responseElem = document.getElementById("__vtigerAccountSearchResponse___"); - if(responseElem == null){ - var sibling = document.createElement("tr"); - var td = document.createElement("td"); - td.colSpan = "3"; - str = "
"; - td.innerHTML = str; - sibling.appendChild(td); - elem.parentNode.appendChild(sibling); - } - onReady("__vtigerAccountSearchResponse___",function(){ - displaySearchResult(moduleName,response,accountName); - }); - }); - } - }); - } - - function getSiblingByTagName(elem,tagName){ - var sibling = elem.nextSibling; - while(sibling.nodeName.toLowerCase()!=tagName.toLowerCase()){ - sibling = sibling.nextSibling; - } - return sibling; - } - - function each(object,callback){ - var name, i = 0, length = object.length; - if ( length == undefined ) { - for ( name in object ) - if ( callback.call( object[ name ], name, object[ name ] ) === false ) - break; - } else - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} - return object; - } - - function findObject(array,needle){ - var name, i = 0, length = array.length; - var prospect = null; - for (; i < length; ++i ){ - var object = array[i]; - for ( name in object ){ - if(object[name] === needle){ - prospect=object; - break; - } - } - } - return prospect; - } - - function getEntityName(moduleName,row){ - var moduleDetails = JSON.parse(moduleNameFields); - var entityNameFields = moduleDetails[moduleName]; - var entityName = ''; - each(entityNameFields,function(k,v){ - if(entityName.length>0){ - entityName += " "; - } - entityName +=row[v]; - }); - return entityName; - } - - function getEntityEmail(moduleName,row){ - var moduleDetails = JSON.parse(moduleEmailFields); - var entityEmailFields = moduleDetails[moduleName]; - var entityEmail = ''; - each(entityEmailFields,function(k,v){ - if(entityEmail.length > 0){ - return; - } - entityEmail +=row[v]; - }); - return entityEmail; - } - - function displaySearchResult(moduleName,response,accountName){ - hideBusy(); - var queryResponse = JSON.parse(response.responseText); - if(queryResponse.success == true){ - var queryResult = client.getResult(queryResponse); - var str ="
    "; - if(queryResult.length > 0){ - each(queryResult, function(i, row){ - var entityName = getEntityName(moduleName,row); - str+="
  • "+ - entityName+"
  • "; - }); - }else{ - str +="
  • No Record Match \""+accountName+"\"
  • "; - } - str += "
"; - var elem = document.getElementById("__vtigerAccountSearchResponse___"); - elem.style.height="120px"; - elem.innerHTML = str; - each(elem.getElementsByTagName("a"),function(i,v){ - v.onclick=function(){ - var elem = findObject(queryResult,this.id); - var entityName = getEntityName(moduleName,elem); - var entityEmail = getEntityEmail(moduleName, elem); - if(entityEmail.length <=0) { - alert("'"+entityName+"' has no email, please select another "+moduleName); - } - setDetails(elem.id,entityName, entityEmail); - var wrap = document.getElementById("__vtigerAccountSearchList___"); - wrap.style.display="none"; - document.getElementById('__searchaccount__').value=''; - } - }); - }else{ - var error = client.getError(queryResponse); - alert("Vtiger returned Error: \nerrorCode: "+error.code+"\nerror Message: "+error.message); - } - } - - function waitForObject(obj,callback){ - var interval = window.setInterval(function(){ - if(typeof obj != "undefined"){ - callback(); - window.clearInterval(interval); - } - },10); - } - - function setDetails(id, entityName, entityEmail){ - var elem = document.getElementById("parent_id"); - var elemName = document.getElementById("parentName"); - var elemEmail = document.getElementById("parentEmail"); - elem.value = id; - elemName.innerHTML = entityName; - elemEmail.value = entityEmail; - } - - function closeOnSuccess(response){ - var createResponse = JSON.parse(response.responseText); - if(createResponse.success == true){ - alert("Email added to vtigerCRM."); - }else{ - document.getElementById("__saveVtigerEmail__").disabled=false; - var error = client.getError(createResponse); - alert("Error while creating: \nerrorCode: "+error.code+"\nerror Message: "+error.message); - } - } - - function getTodayDate(format){ - var date = new Date(); - return date.getDay()+"-"+date.getMonth()+"-"+date.getFullYear(); - } - - function createEmail(){ - var parent_id = document.getElementById("parent_id").value; - var type = document.getElementById("parentType").value; - var userEmail = document.getElementById("userEmail").value; - var entityEmail = document.getElementById("parentEmail").value; - - if(parent_id.length < 1){ - alert("No "+type+" selected."); - return ; - } - var subject = document.getElementById("subject").value; - if(subject.length < 1){ - alert("Please provide a value for Subject"); - return; - } - - var description = document.getElementById("description").value; - if(description.length < 1){ - alert("Please provide a value for Body of the email."); - return; - } - document.getElementById("__saveVtigerEmail__").disabled=true; - var email ={"description":description,"subject":subject, - "assigned_user_id":client.userId,"date_start":getTodayDate(),"activitytype":"Emails", - "parent_id": parent_id,'from_email': userEmail,'saved_toid':entityEmail, - 'email_flag':'SAVED'}; - client.create(email,"Emails",closeOnSuccess) - } - createBookMarkletUI(); -} diff --git a/oss/vtiger/trunk/modules/Emails/GmailBookmarkletTrigger.js b/oss/vtiger/trunk/modules/Emails/GmailBookmarkletTrigger.js deleted file mode 100644 index 9ec19ad4..00000000 --- a/oss/vtiger/trunk/modules/Emails/GmailBookmarkletTrigger.js +++ /dev/null @@ -1,99 +0,0 @@ -javascript:(function(){var doc = top.document; -var elementId="__vtigerBookMarkletDivWrap__"; -if(navigator.userAgent.toLowerCase().indexOf("msie") == -1){ - var bookMarkletDiv = doc.getElementById(elementId); - if(bookMarkletDiv == null){ - bookMarkletDiv = doc.createElement("div"); - bookMarkletDiv.style.border = "2px solid #73ABFA"; - bookMarkletDiv.style.backgroundColor = "white"; - bookMarkletDiv.innerHTML = ""; - bookMarkletDiv.id = elementId; - bookMarkletDiv.style.position="absolute"; - bookMarkletDiv.style.top="5px"; - bookMarkletDiv.style.right="35px"; - bookMarkletDiv.style.width="562px"; - bookMarkletDiv.style.height="450px"; - bookMarkletDiv.style.zIndex="100000"; - bookMarkletDiv.innerHTML=" "; - bookMarkletDiv.style.overflow = 'hidden'; - bookMarkletDiv.style.fontSize = '11px'; - bookMarkletDiv.style.fontFamily = 'Arial, sans-serif'; - - var closeMe = doc.createElement("span"); - closeMe.style.position="absolute"; - closeMe.style.top="5px"; - closeMe.style.right="5px"; - closeMe.style.color="#0070BA"; - closeMe.style.textDecoration="underline"; - closeMe.style.width="100%"; - closeMe.style.textAlign="right"; - closeMe.style.cursor="pointer"; - closeMe.innerHTML = ""; - closeMe.onclick = function(){ - window.removeMe(); - } - bookMarkletDiv.appendChild(closeMe); - - var popUp = doc.createElement("iframe"); - popUp.id="__vtigerBookmarkletFrame__"; - popUp.name="__vtigerBookmarkletFrame__"; - popUp.style.border="0px"; - popUp.frameBorder="0px"; - popUp.marginHeight="0px"; - popUp.marginWidth="0px"; - popUp.style.width="100%"; - popUp.style.height="100%"; - popUp.src = getTargetURL(); - bookMarkletDiv.appendChild(popUp); - doc.body.appendChild(bookMarkletDiv); - }else{ - bookMarkletDiv.style.display="block"; - } -}else{ - var vtigerGmailBookmarkletWindow = window.open(getTargetURL(),elementId, - "scrollbars=1,top=40,left=40,resizable=1,height=450,width=562"); -} - -function getTargetURL(){ - var threadid = top.location.hash.split("/"); - var mailId = threadid[threadid.length-1]; - var description = encodeURIComponent(getGmailURL()+"?fs=1&tf=1&source=atom&view=cv&search=all&shva=1&th="+mailId); - return doc.vtigerURL+"index.php?module=Emails&action=SaveBookmarklet&subject="+ - encodeURIComponent(getGmailSubject())+"&description="+description+ - "&location="+encodeURIComponent(getGmailURL()); -} - -function trim(str) { - var s = str.replace(/\s+$/, ""); - s = s.replace(/^\s+/, ""); - return s; -} - -function getGmailSubject() { - var subject = top.document.title; - var firstIndexOf = subject.indexOf("-"); - var lastIndexOf = subject.lastIndexOf("-"); - subject = subject.substring(firstIndexOf+1, lastIndexOf-1); - return trim(subject); -} - -function getGmailURL() { - var locationhref = location.href; - if(locationhref.indexOf("?")!==-1) { - var lsplits = locationhref.split("?"); - locationhref = lsplits[0]; - } else if(locationhref.indexOf("#")!==-1) { - var lsplits = locationhref.split("#"); - locationhref = lsplits[0]; - } - return locationhref; -} -window.top.removeMe = function(){ - if(navigator.userAgent.toLowerCase().indexOf("msie") == -1){ - doc.body.removeChild(bookMarkletDiv); - }else{ - vtigerGmailBookmarkletWindow.close(); - } -} -})(); \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/ListView.php b/oss/vtiger/trunk/modules/Emails/ListView.php deleted file mode 100644 index f72af282..00000000 --- a/oss/vtiger/trunk/modules/Emails/ListView.php +++ /dev/null @@ -1,202 +0,0 @@ -initSortbyField('Emails'); -// END -$smarty = new vtigerCRM_Smarty; -$other_text = Array(); - -//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> -if($_REQUEST['order_by'] != '') - $order_by = $adb->sql_escape_string($_REQUEST['order_by']); -else - $order_by = (($_SESSION['EMAILS_ORDER_BY'] != '')?($_SESSION['EMAILS_ORDER_BY']):($focus->default_order_by)); - -if($_REQUEST['sorder'] != '') - $sorder = $adb->sql_escape_string($_REQUEST['sorder']); -else - $sorder = (($_SESSION['EMAILS_SORT_ORDER'] != '')?($_SESSION['EMAILS_SORT_ORDER']):($focus->default_sort_order)); - -$_SESSION['EMAILS_ORDER_BY'] = $order_by; -$_SESSION['EMAILS_SORT_ORDER'] = $sorder; -//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> - - -// focus_list is the means of passing data to a ListView. -global $focus_list; - -//<<<>>>>>> -$oCustomView = new CustomView("Emails"); -$viewid = $oCustomView->getViewId($currentModule); -$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid); -$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid); - -//<<<<>>>> - -// Buttons and View options -if(isPermitted('Emails','Delete','') == 'yes') -{ - $other_text['del'] = $app_strings[LBL_MASS_DELETE]; -} - -if($viewnamedesc['viewname'] == 'All') -{ - $smarty->assign("ALL", 'All'); -} - -global $email_title; -$display_title = $mod_strings['LBL_LIST_FORM_TITLE']; -if($email_title)$display_title = $email_title; - -//to get the search vtiger_field if exists -if(isset($_REQUEST['search']) && $_REQUEST['search'] != '' && $_REQUEST['search_text'] != '') -{ - $url_string .= "&search=".vtlib_purify($_REQUEST['search'])."&search_field=".vtlib_purify($_REQUEST['search_field'])."&search_text=".vtlib_purify($_REQUEST['search_text']); - if($_REQUEST['search_field'] != 'join') - $where = $adb->sql_escape_string($_REQUEST['search_field'])." like '". formatForSqlLike($_REQUEST['search_text']) ."'"; - else - $where = "(subject like '". formatForSqlLike($_REQUEST['search_text']) ."' OR vtiger_users.user_name like '". formatForSqlLike($_REQUEST['search_text']) ."')"; -} - - -//Retreive the list from Database -//<<<<<<<<>>>>>>>> -if($viewid != "0") -{ - $listquery = getListQuery("Emails"); - $list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Emails"); -} -else -{ - $list_query = getListQuery("Emails"); -} -//<<<<<<<>>>>>>>> - -if(isset($where) && $where != '') -{ - $list_query .= " AND " .$where; -} -if($_REQUEST['folderid'] =='2') -{ - $list_query .= " AND vtiger_seactivityrel.crmid in (select contactid from vtiger_contactdetails) AND vtiger_emaildetails.email_flag !='WEBMAIL'"; -} -if($_REQUEST['folderid'] =='3') -{ - $list_query .= " AND vtiger_seactivityrel.crmid in (select accountid from vtiger_account)"; -} -if($_REQUEST['folderid'] =='4') -{ - $list_query .= " AND vtiger_seactivityrel.crmid in (select leadid from vtiger_leaddetails)"; -} -if($_REQUEST['folderid'] =='5') -{ - $list_query .= " AND vtiger_salesmanactivityrel.smid in (select id from vtiger_users)"; -} -if($_REQUEST['folderid'] =='6') -{ - $list_query .= " AND vtiger_emaildetails.email_flag ='WEBMAIL'"; -} -if(isset($order_by) && $order_by != '') -{ - $tablename = getTableNameForField('Emails',$order_by); - $tablename = (($tablename != '')?($tablename."."):''); - $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder; -} - -$list_result = $adb->query($list_query); - -//Constructing the list view -$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); -$smarty->assign("VIEWID", $viewid); -$smarty->assign("MOD", $mod_strings); -$smarty->assign("APP", $app_strings); -$smarty->assign("THEME", $theme); -$smarty->assign("IMAGE_PATH",$image_path); -$smarty->assign("MODULE",$currentModule); -$smarty->assign("SINGLE_MOD",'Email'); -$smarty->assign("BUTTONS",$other_text); -$category = getParentTab(); -$smarty->assign("CATEGORY",$category); - -//Retreiving the no of rows -$noofrows = $adb->num_rows($list_result); - -//Retreive the Navigation array -$_REQUEST['allflag'] = 'All'; -$navigation_array = getNavigationValues(1, $noofrows, $noofrows); - -//Retreive the List View Table Header -if($viewid !='') - $url_string .="&viewname=".$viewid; -if(isset($_REQUEST['folderid']) && $_REQUEST['folderid'] != '') - $url_string .= "&folderid=".vtlib_purify($_REQUEST['folderid']); -$listview_header = getListViewHeader($focus,"Emails",$url_string,$sorder,$order_by,"",$oCustomView); -$smarty->assign("LISTHEADER", $listview_header); - -$listview_entries = getListViewEntries($focus,"Emails",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView); -//--------------------------added to fix the ticket(4386)------------------------START -foreach($listview_entries as $key=>$value) -{ - $sql="select email_flag from vtiger_emaildetails where emailid=?"; - $result=$adb->pquery($sql, array($key)); - $email_flag=$adb->query_result($result,0,"email_flag"); - $emailid[$key] = $email_flag; -} -$smarty->assign("EMAILFALG",$emailid); -//--------------------------added to fix the ticket(4386)------------------------END - -$smarty->assign("LISTENTITY", $listview_entries); -$smarty->assign("SELECT_SCRIPT", $view_script); - -$smarty->assign("USERID", $current_user->id); - -$check_button = Button_Check($module); -$smarty->assign("CHECK", $check_button); -$smarty->assign("theme", $theme); -if($_REQUEST['ajax'] != '') - $smarty->display("EmailContents.tpl"); -else - $smarty->display("Emails.tpl"); -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/ListViewPagging.php b/oss/vtiger/trunk/modules/Emails/ListViewPagging.php deleted file mode 100644 index 333f1768..00000000 --- a/oss/vtiger/trunk/modules/Emails/ListViewPagging.php +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/PHPMailer_LICENSE.txt b/oss/vtiger/trunk/modules/Emails/PHPMailer_LICENSE.txt deleted file mode 100644 index f3f1b3b6..00000000 --- a/oss/vtiger/trunk/modules/Emails/PHPMailer_LICENSE.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/oss/vtiger/trunk/modules/Emails/PrintEmail.php b/oss/vtiger/trunk/modules/Emails/PrintEmail.php deleted file mode 100644 index dfc3b106..00000000 --- a/oss/vtiger/trunk/modules/Emails/PrintEmail.php +++ /dev/null @@ -1,89 +0,0 @@ -assign('MOD',$mod_strings); -$smarty->assign('THEME',$theme); - -if(isset($_REQUEST['record']) && $_REQUEST['record'] !='' && $_REQUEST['mailbox'] == '') -{ - $focus->id = $_REQUEST['record']; - $focus->mode = 'edit'; - $focus->retrieve_entity_info($_REQUEST['record'],"Emails"); - - $focus->name=$focus->column_fields['name']; - if(isset($_REQUEST['print']) && $_REQUEST['print'] !='') - { - $query = 'select idlists,from_email,to_email,cc_email,bcc_email from vtiger_emaildetails where emailid =?'; - $result = $adb->pquery($query, array($focus->id)); - $smarty->assign('FROM_MAIL',$adb->query_result($result,0,'from_email')); - $to_email = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'to_email')))); - $smarty->assign('TO_MAIL',$to_email); - $cc_add = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'cc_email')))); - $smarty->assign('CC_MAIL',$cc_add); - $bcc_add = vt_suppressHTMLTags(implode(',',$json->decode($adb->query_result($result,0,'bcc_email')))); - $smarty->assign('BCC_MAIL',$bcc_add); - $smarty->assign('SUBJECT',$focus->column_fields['subject']); - $smarty->assign('DESCRIPTION',$focus->column_fields['description']); - } - $smarty->display('PrintEmail.tpl'); -} - -if(isset($_REQUEST['record']) && isset($_REQUEST['mailbox']) && $_REQUEST['print']) -{ - if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") -{ - $mailbox=$_REQUEST["mailbox"]; -} -else -{ - $mailbox="INBOX"; -} -$mailid = $_REQUEST['record']; -$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 "\n"; -$subject = utf8_decode(utf8_encode(imap_utf8($email->subject))); -$from = decode_header($email->from); -$to = decode_header($email->to[0]); -$cc = decode_header($email->cc_header); -$date = decode_header($email->date); -for($i=0;$iattname);$i++){ - $attachment_links .= $email->anchor_arr[$i].decode_header($email->attname[$i])."
                     "; -} -$content['body'] = $email->body; -$content['attachtab'] = $email->attachtab; - -$smarty->assign('FROM_MAIL',$from); -$smarty->assign('TO_MAIL',trim($to,",").","); -$smarty->assign('SUBJECT',$subject); -$smarty->assign('DESCRIPTION',$content['body']); -$smarty->display('PrintEmail.tpl'); -} - -?> diff --git a/oss/vtiger/trunk/modules/Emails/Save.php b/oss/vtiger/trunk/modules/Emails/Save.php deleted file mode 100644 index 7fda806b..00000000 --- a/oss/vtiger/trunk/modules/Emails/Save.php +++ /dev/null @@ -1,254 +0,0 @@ -num_rows($adb->pquery($sql, array('email')),0,"id"); - if($records != '') - echo 'SUCCESS'; - else - echo 'FAILURE'; - die; -} - -//Added on 09-11-2005 to avoid loading the webmail vtiger_files in Email process -if($_REQUEST['smodule'] != '') -{ - define('SM_PATH','modules/squirrelmail-1.4.4/'); - /* SquirrelMail required vtiger_files. */ - require_once(SM_PATH . 'functions/strings.php'); - require_once(SM_PATH . 'functions/imap_general.php'); - require_once(SM_PATH . 'functions/imap_messages.php'); - require_once(SM_PATH . 'functions/i18n.php'); - require_once(SM_PATH . 'functions/mime.php'); - require_once(SM_PATH .'include/load_prefs.php'); - //require_once(SM_PATH . 'class/mime/Message.class.php'); - require_once(SM_PATH . 'class/mime.class.php'); - sqgetGlobalVar('key', $key, SQ_COOKIE); - sqgetGlobalVar('username', $username, SQ_SESSION); - sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); - $mailbox = 'INBOX'; -} - -require_once('modules/Emails/Emails.php'); -require_once('include/logging.php'); -require_once('include/database/PearDatabase.php'); - -$local_log =& LoggerManager::getLogger('index'); - -$focus = new Emails(); - -global $current_user,$mod_strings,$app_strings; -if(isset($_REQUEST['description']) && $_REQUEST['description'] !='') - $_REQUEST['description'] = fck_from_html($_REQUEST['description']); - -$all_to_ids = $_REQUEST["hidden_toid"]; -$all_to_ids .= $_REQUEST["saved_toid"]; -$_REQUEST["saved_toid"] = $all_to_ids; -//we always save the email with "save" status and when it is sent it is marked as SENT -$_REQUEST['email_flag'] = 'SAVED'; -setObjectValuesFromRequest($focus); -//Check if the file is exist or not. -//$file_name = ''; -if(isset($_REQUEST['filename_hidden'])) { - $file_name = $_REQUEST['filename_hidden']; -} else { - $file_name = $_FILES['filename']['name']; -} -$errorCode = $_FILES['filename']['error']; -$errormessage = ""; -if($file_name != '' && $_FILES['filename']['size'] == 0) -{ - if($errorCode == 4 || $errorCode == 0) - { - if($_FILES['filename']['size'] == 0) - $errormessage = "".$mod_strings['LBL_PLEASE_ATTACH']."
"; - } - else if($errorCode == 2) - { - $errormessage = "".$mod_strings['LBL_EXCEED_MAX'].$upload_maxsize.$mod_strings['LBL_BYTES']."
"; - } - else if($errorCode == 6) - { - $errormessage = "".$mod_strings['LBL_KINDLY_UPLOAD']."
" ; - } - else if($errorCode == 3 ) - { - if($_FILES['filename']['size'] == 0) - $errormessage = "".$mod_strings['LBL_PLEASE_ATTACH']."
"; - } - else{} - if($errormessage != ""){ - $ret_error = 1; - $ret_parentid = $_REQUEST['parent_id']; - $ret_toadd = $_REQUEST['parent_name']; - $ret_subject = $_REQUEST['subject']; - $ret_ccaddress = $_REQUEST['ccmail']; - $ret_bccaddress = $_REQUEST['bccmail']; - $ret_description = $_REQUEST['description']; - echo $errormessage; - include("EditView.php"); - exit(); - } -} - - -if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '') -{ - $file_upload_error = true; - $_FILES = ''; -} - -if((isset($_REQUEST['deletebox']) && $_REQUEST['deletebox'] != null) && $_REQUEST['addbox'] == null) -{ - imap_delete($mbox,$_REQUEST['deletebox']); - imap_expunge($mbox); - header("Location: index.php?module=Emails&action=index"); - exit(); -} - -function checkIfContactExists($mailid) -{ - global $log; - $log->debug("Entering checkIfContactExists(".$mailid.") method ..."); - global $adb; - $sql = "select contactid from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid where vtiger_crmentity.deleted=0 and email= ?"; - $result = $adb->pquery($sql, array($mailid)); - $numRows = $adb->num_rows($result); - if($numRows > 0) - { - $log->debug("Exiting checkIfContactExists method ..."); - return $adb->query_result($result,0,"contactid"); - } - else - { - $log->debug("Exiting checkIfContactExists method ..."); - return -1; - } -} -//assign the focus values -$focus->filename = $_REQUEST['file_name']; -$focus->parent_id = $_REQUEST['parent_id']; -$focus->parent_type = $_REQUEST['parent_type']; -$focus->column_fields["assigned_user_id"]=$current_user->id; -$focus->column_fields["activitytype"]="Emails"; -$focus->column_fields["date_start"]= date(getNewDisplayDate());//This will be converted to db date format in save -$focus->save("Emails"); -$return_id = $focus->id; - -require_once("modules/Emails/mail.php"); -if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] != '') -{ - $user_mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST['ccmail'],$_REQUEST['bccmail'],'all',$focus->id); - - //if block added to fix the issue #3759 - if($user_mail_status != 1){ - $query = "select crmid,attachmentsid from vtiger_seattachmentsrel where crmid=?"; - $result = $adb->pquery($query, array($email_id)); - $numOfRows = $adb->num_rows($result); - for($i=0; $i<$numOfRows; $i++) - { - $attachmentsid = $adb->query_result($result,0,"attachmentsid"); - if($attachmentsid > 0) - { - $query1="delete from vtiger_crmentity where crmid=?"; - $adb->pquery($query1, array($attachmentsid)); - } - - $crmid=$adb->query_result($result,0,"crmid"); - $query2="delete from vtiger_crmentity where crmid=?"; - $adb->pquery($query2, array($crmid)); - } - - $query = "delete from vtiger_emaildetails where emailid=?"; - $adb->pquery($query, array($focus->id)); - - $error_msg = "".$mod_strings['LBL_CHECK_USER_MAILID'].""; - $ret_error = 1; - $ret_parentid = $_REQUEST['parent_id']; - $ret_toadd = $_REQUEST['parent_name']; - $ret_subject = $_REQUEST['subject']; - $ret_ccaddress = $_REQUEST['ccmail']; - $ret_bccaddress = $_REQUEST['bccmail']; - $ret_description = $_REQUEST['description']; - echo $error_msg; - include("EditView.php"); - exit(); - } - -} - -$focus->retrieve_entity_info($return_id,"Emails"); - -//this is to receive the data from the Select Users button -if($_REQUEST['source_module'] == null) -{ - $module = 'users'; -} -//this will be the case if the Select Contact button is chosen -else -{ - $module = $_REQUEST['source_module']; -} - -if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") - $return_module = vtlib_purify($_REQUEST['return_module']); -else - $return_module = "Emails"; - -if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") - $return_action = vtlib_purify($_REQUEST['return_action']); -else - $return_action = "DetailView"; - -if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") - $return_id = vtlib_purify($_REQUEST['return_id']); - -if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "") - $filename = vtlib_purify($_REQUEST['filename']); - -$local_log->debug("Saved record with id of ".$return_id); - -if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] == ''){ - if($_REQUEST["parent_name"] != '' && isset($_REQUEST["parent_name"])) { - include("modules/Emails/webmailsend.php"); - } - -} elseif( isset($_REQUEST['send_mail']) && $_REQUEST['send_mail']) - include("modules/Emails/mailsend.php"); - - - -if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'mailbox') - header("Location: index.php?module=$return_module&action=index"); -else { - if($_REQUEST['return_viewname'] == '') $return_viewname='0'; - if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']); - //Added for 4600 - $inputs=""; - echo $inputs; -} -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/SaveBookmarklet.php b/oss/vtiger/trunk/modules/Emails/SaveBookmarklet.php deleted file mode 100644 index be407e03..00000000 --- a/oss/vtiger/trunk/modules/Emails/SaveBookmarklet.php +++ /dev/null @@ -1,81 +0,0 @@ -assign("subject",$_REQUEST['subject']); -$smarty->assign("description",$_REQUEST['description']); - -Zend_Json::$useBuiltinEncoderDecoder = true; -$json = new Zend_Json(); - -$elementType = $_REQUEST['module']; - -global $log,$adb; -$webserviceObject = VtigerWebserviceObject::fromName($adb,$elementType); -$handlerPath = $webserviceObject->getHandlerPath(); -$handlerClass = $webserviceObject->getHandlerClass(); - -require_once $handlerPath; - -$handler = new $handlerClass($webserviceObject,$current_user,$adb,$log); -$meta = $handler->getMeta(); -$meta->retrieveMeta(); - -$types = vtws_listtypes($current_user); -if(!in_array($elementType,$types['types'])){ - throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to perform the operation is denied"); -} - -$wsFieldDetails = $handler->getField('parent_id'); - -$moduleEntityNameDetails = array(); -$moduleEmailFieldDetails = array(); -foreach ($wsFieldDetails['type']['refersTo'] as $type) { - $referenceModuleHandler = vtws_getModuleHandlerFromName($type, $current_user); - $referenceModuleMeta = $referenceModuleHandler->getMeta(); - $nameFields = explode(',',$referenceModuleMeta->getNameFields()); - $moduleFields = $referenceModuleMeta->getModuleFields(); - $accessibleFields = array_keys($moduleFields); - $accessibleNameFields = array_intersect($nameFields, $accessibleFields); - $moduleEntityNameDetails[$type] = $accessibleNameFields; - $moduleEmailFieldDetails[$type] = $referenceModuleMeta->getEmailFields(); -} - -$smarty->assign("types",$wsFieldDetails['type']['refersTo']); -$smarty->assign("entityNameFields",$json->encode($moduleEntityNameDetails)); -$smarty->assign("emailFields",$json->encode($moduleEmailFieldDetails)); -$smarty->assign("userEmail",$current_user->column_fields['email1']); - -$smarty->display("modules/Bookmarklet/Bookmarklet.tpl"); -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/TrackAccess.php b/oss/vtiger/trunk/modules/Emails/TrackAccess.php deleted file mode 100644 index 95de9f48..00000000 --- a/oss/vtiger/trunk/modules/Emails/TrackAccess.php +++ /dev/null @@ -1,40 +0,0 @@ -pquery("INSERT INTO vtiger_email_access(crmid, mailid, accessdate, accesstime) VALUES(?,?,?,?)", array($crmid, $mailid, date('Y-m-d'), date('H:i:s'))); - -$result = $adb->pquery("select count(*) as count from vtiger_email_access where crmid=? and mailid=?",array($crmid, $mailid)); -$count = $adb->query_result($result,0,'count'); - -$result = $adb->pquery("select * from vtiger_email_track where crmid=? and mailid=?", array($crmid, $mailid)); -if($adb->num_rows($result)>0){ - $adb->pquery("update vtiger_email_track set access_count=? where crmid=? and mailid=?", array($count, $crmid, $mailid)); -} else { - $adb->pquery("insert into vtiger_email_track(crmid,mailid,access_count) values(?,?,?)", array($crmid, $mailid, 1)); -} - -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/UnifiedSearch.php b/oss/vtiger/trunk/modules/Emails/UnifiedSearch.php deleted file mode 100644 index 9a37320c..00000000 --- a/oss/vtiger/trunk/modules/Emails/UnifiedSearch.php +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/class.phpmailer.php b/oss/vtiger/trunk/modules/Emails/class.phpmailer.php deleted file mode 100644 index 4381935f..00000000 --- a/oss/vtiger/trunk/modules/Emails/class.phpmailer.php +++ /dev/null @@ -1,1510 +0,0 @@ -ContentType = "text/html"; - else - $this->ContentType = "text/plain"; - } - - /** - * Sets Mailer to send message using SMTP. - * @return void - */ - function IsSMTP() { - $this->Mailer = "smtp"; - } - - /** - * Sets Mailer to send message using PHP mail() function. - * @return void - */ - function IsMail() { - $this->Mailer = "mail"; - } - - /** - * Sets Mailer to send message using the $Sendmail program. - * @return void - */ - function IsSendmail() { - $this->Mailer = "sendmail"; - } - - /** - * Sets Mailer to send message using the qmail MTA. - * @return void - */ - function IsQmail() { - $this->Sendmail = "/var/qmail/bin/sendmail"; - $this->Mailer = "sendmail"; - } - - - ///////////////////////////////////////////////// - // RECIPIENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds a "To" address. - * @param string $address - * @param string $name - * @return void - */ - function AddAddress($address, $name = "") { - $cur = count($this->to); - $this->to[$cur][0] = trim($address); - $this->to[$cur][1] = $name; - } - - /** - * Adds a "Cc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddCC($address, $name = "") { - $cur = count($this->cc); - $this->cc[$cur][0] = trim($address); - $this->cc[$cur][1] = $name; - } - - /** - * Adds a "Bcc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddBCC($address, $name = "") { - $cur = count($this->bcc); - $this->bcc[$cur][0] = trim($address); - $this->bcc[$cur][1] = $name; - } - - /** - * Adds a "Reply-to" address. - * @param string $address - * @param string $name - * @return void - */ - function AddReplyTo($address, $name = "") { - $cur = count($this->ReplyTo); - $this->ReplyTo[$cur][0] = trim($address); - $this->ReplyTo[$cur][1] = $name; - } - - - ///////////////////////////////////////////////// - // MAIL SENDING METHODS - ///////////////////////////////////////////////// - - /** - * Creates message and assigns Mailer. If the message is - * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. - * @return bool - */ - function Send() { - $header = ""; - $body = ""; - $result = true; - - if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) - { - $this->SetError($this->Lang("provide_address")); - return false; - } - - // Set whether the message is multipart/alternative - if(!empty($this->AltBody)) - $this->ContentType = "multipart/alternative"; - - $this->error_count = 0; // reset errors - $this->SetMessageType(); - $header .= $this->CreateHeader(); - $body = $this->CreateBody(); - - if($body == "") { return false; } - - // Choose the mailer - switch($this->Mailer) - { - case "sendmail": - $result = $this->SendmailSend($header, html_entity_decode($body,ENT_COMPAT,$this->CharSet)); - break; - case "mail": - $result = $this->MailSend($header, html_entity_decode($body,ENT_COMPAT,$this->CharSet)); - break; - case "smtp": - $result = $this->SmtpSend($header, html_entity_decode($body,ENT_COMPAT,$this->CharSet)); - break; - default: - $this->SetError($this->Mailer . $this->Lang("mailer_not_supported")); - $result = false; - break; - } - - return $result; - } - - /** - * Sends mail using the $Sendmail program. - * @access private - * @return bool - */ - function SendmailSend($header, $body) { - if ($this->Sender != "") - $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); - else - $sendmail = sprintf("%s -oi -t", $this->Sendmail); - - if(!@$mail = popen($sendmail, "w")) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; - } - - fputs($mail, $header); - fputs($mail, $body); - - $result = pclose($mail) >> 8 & 0xFF; - if($result != 0) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; - } - - return true; - } - - /** - * Sends mail using the PHP mail() function. - * @access private - * @return bool - */ - function MailSend($header, $body) { - $to = ""; - for($i = 0; $i < count($this->to); $i++) - { - if($i != 0) { $to .= ", "; } - $to .= $this->to[$i][0]; - } - - if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1) - { - $old_from = ini_get("sendmail_from"); - ini_set("sendmail_from", $this->Sender); - $params = sprintf("-oi -f %s", $this->Sender); - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, - $header, $params); - } - else - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); - - if (isset($old_from)) - ini_set("sendmail_from", $old_from); - - if(!$rt) - { - $this->SetError($this->Lang("instantiate")); - return false; - } - - return true; - } - - /** - * Sends mail via SMTP using PhpSMTP (Author: - * Chris Ryan). Returns bool. Returns false if there is a - * bad MAIL FROM, RCPT, or DATA input. - * @access private - * @return bool - */ - function SmtpSend($header, $body) { - include_once($this->PluginDir . "class.smtp.php"); - $error = ""; - $bad_rcpt = array(); - - if(!$this->SmtpConnect()) - return false; - - $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; - if(!$this->smtp->Mail($smtp_from)) - { - $error = $this->Lang("from_failed") . $smtp_from; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } - - // Attempt to send attach all recipients - for($i = 0; $i < count($this->to); $i++) - { - if(!$this->smtp->Recipient($this->to[$i][0])) - $bad_rcpt[] = $this->to[$i][0]; - } - for($i = 0; $i < count($this->cc); $i++) - { - if(!$this->smtp->Recipient($this->cc[$i][0])) - $bad_rcpt[] = $this->cc[$i][0]; - } - for($i = 0; $i < count($this->bcc); $i++) - { - if(!$this->smtp->Recipient($this->bcc[$i][0])) - $bad_rcpt[] = $this->bcc[$i][0]; - } - - if(count($bad_rcpt) > 0) // Create error message - { - for($i = 0; $i < count($bad_rcpt); $i++) - { - if($i != 0) { $error .= ", "; } - $error .= $bad_rcpt[$i]; - } - $error = $this->Lang("recipients_failed") . $error; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } - - if(!$this->smtp->Data($header . $body)) - { - $this->SetError($this->Lang("data_not_accepted")); - $this->smtp->Reset(); - return false; - } - if($this->SMTPKeepAlive == true) - $this->smtp->Reset(); - else - $this->SmtpClose(); - - return true; - } - - /** - * Initiates a connection to an SMTP server. Returns false if the - * operation failed. - * @access private - * @return bool - */ - function SmtpConnect() { - if($this->smtp == NULL) { $this->smtp = new SMTP(); } - - $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(";", $this->Host); - $index = 0; - $connection = ($this->smtp->Connected()); - - // Retry while there is no connection - while($index < count($hosts) && $connection == false) - { - if(strstr($hosts[$index], ":")) - { - #list($host, $port) = explode(":", $hosts[$index]); - $hostA = explode(':', $hosts[$index]); - if (is_numeric(end($hostA))) - $port = array_pop($hostA); - else - $port = $this->Port; - $host = implode(':', $hostA); - } - else - { - $host = $hosts[$index]; - $port = $this->Port; - } - - if($this->smtp->Connect($host, $port, $this->Timeout)) - { - if ($this->Helo != '') - $this->smtp->Hello($this->Helo); - else - $this->smtp->Hello($this->ServerHostname()); - - if($this->SMTPAuth) - { - if(!$this->smtp->Authenticate($this->Username, - $this->Password)) - { - $this->SetError($this->Lang("authenticate")); - $this->smtp->Reset(); - $connection = false; - } - } - $connection = true; - } - $index++; - } - if(!$connection) - $this->SetError($this->Lang("connect_host")); - - return $connection; - } - - /** - * Closes the active SMTP session if one exists. - * @return void - */ - function SmtpClose() { - if($this->smtp != NULL) - { - if($this->smtp->Connected()) - { - $this->smtp->Quit(); - $this->smtp->Close(); - } - } - } - - /** - * Sets the language for all class error messages. Returns false - * if it cannot load the language file. The default language type - * is English. - * @param string $lang_type Type of language (e.g. Portuguese: "br") - * @param string $lang_path Path to the language file directory - * @access public - * @return bool - */ - function SetLanguage($lang_type, $lang_path = "language/") { - global $root_directory; - if(file_exists($root_directory.'/modules/Emails/'.$lang_path.'phpmailer.lang-'.$lang_type.'.php')) - include($root_directory.'/modules/Emails/'.$lang_path.'phpmailer.lang-'.$lang_type.'.php'); - else if(file_exists($root_directory.'/modules/Emails/'.$lang_path.'phpmailer.lang-en.php')) - include($root_directory.'/modules/Emails/'.$lang_path.'phpmailer.lang-en.php'); - else - { - $this->SetError("Could not load language file"); - return false; - } - $this->language = $PHPMAILER_LANG; - - return true; - } - - ///////////////////////////////////////////////// - // MESSAGE CREATION METHODS - ///////////////////////////////////////////////// - - /** - * Creates recipient vtiger_headers. - * @access private - * @return string - */ - function AddrAppend($type, $addr) { - $addr_str = $type . ": "; - $addr_str .= $this->AddrFormat($addr[0]); - if(count($addr) > 1) - { - for($i = 1; $i < count($addr); $i++) - $addr_str .= ", " . $this->AddrFormat($addr[$i]); - } - $addr_str .= $this->LE; - - return $addr_str; - } - - /** - * Formats an address correctly. - * @access private - * @return string - */ - function AddrFormat($addr) { - if(empty($addr[1])) - $formatted = $addr[0]; - else - { - $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . - $addr[0] . ">"; - } - - return $formatted; - } - - /** - * Wraps message for use with mailers that do not - * automatically perform wrapping and for quoted-printable. - * Original written by philippe. - * @access private - * @return string - */ - function WrapText($message, $length, $qp_mode = false) { - $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; - - $message = $this->FixEOL($message); - if (substr($message, -1) == $this->LE) - $message = substr($message, 0, -1); - - $line = explode($this->LE, $message); - $message = ""; - for ($i=0 ;$i < count($line); $i++) - { - $line_part = explode(" ", $line[$i]); - $buf = ""; - for ($e = 0; $e $length)) - { - $space_left = $length - strlen($buf) - 1; - if ($e != 0) - { - if ($space_left > 20) - { - $len = $space_left; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= " " . $part; - $message .= $buf . sprintf("=%s", $this->LE); - } - else - { - $message .= $buf . $soft_break; - } - $buf = ""; - } - while (strlen($word) > 0) - { - $len = $length; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) - $message .= $part . sprintf("=%s", $this->LE); - else - $buf = $part; - } - } - else - { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (" " . $word); - - if (strlen($buf) > $length and $buf_o != "") - { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . $this->LE; - } - - return $message; - } - - /** - * Set the body wrapping. - * @access private - * @return void - */ - function SetWordWrap() { - if($this->WordWrap < 1) - return; - - switch($this->message_type) - { - case "alt": - // fall through - case "alt_attachments": - $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->WrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assembles message header. - * @access private - * @return string - */ - function CreateHeader() { - $result = ""; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = "b1_" . $uniq_id; - $this->boundary[2] = "b2_" . $uniq_id; - - $result .= $this->HeaderLine("Date", $this->RFCDate()); - if($this->Sender == "") - $result .= $this->HeaderLine("Return-Path", trim($this->From)); - else - $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); - - // To be created automatically by mail() - if($this->Mailer != "mail") - { - if(count($this->to) > 0) - $result .= $this->AddrAppend("To", $this->to); - else if (count($this->cc) == 0) - $result .= $this->HeaderLine("To", "undisclosed-recipients:;"); - if(count($this->cc) > 0) - $result .= $this->AddrAppend("Cc", $this->cc); - } - - $from = array(); - $from[0][0] = trim($this->From); - $from[0][1] = $this->FromName; - $result .= $this->AddrAppend("From", $from); - - // sendmail and mail() extract Bcc from the header before sending - if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) - $result .= $this->AddrAppend("Bcc", $this->bcc); - - if(count($this->ReplyTo) > 0) - $result .= $this->AddrAppend("Reply-to", $this->ReplyTo); - - // mail() sets the subject itself - if($this->Mailer != "mail") - $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); - - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); - $result .= $this->HeaderLine("X-Priority", $this->Priority); - $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]"); - - if($this->ConfirmReadingTo != "") - { - $result .= $this->HeaderLine("Disposition-Notification-To", - "<" . trim($this->ConfirmReadingTo) . ">"); - } - - // Add custom vtiger_headers - for($index = 0; $index < count($this->CustomHeader); $index++) - { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), - $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); - } - $result .= $this->HeaderLine("MIME-Version", "1.0"); - - switch($this->message_type) - { - case "plain": - $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding); - $result .= sprintf("Content-Type: %s; charset=\"%s\"", - $this->ContentType, $this->CharSet); - break; - case "attachments": - // fall through - case "alt_attachments": - if($this->InlineImageExists()) - { - $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", - "multipart/related", $this->LE, $this->LE, - $this->boundary[1], $this->LE); - } - else - { - $result .= $this->HeaderLine("Content-Type", "multipart/mixed;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - } - break; - case "alt": - $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - } - - if($this->Mailer != "mail") - $result .= $this->LE.$this->LE; - - return $result; - } - - /** - * Assembles the message body. Returns an empty string on failure. - * @access private - * @return string - */ - function CreateBody() { - $result = ""; - - $this->SetWordWrap(); - - switch($this->message_type) - { - case "alt": - $result .= $this->GetBoundary($this->boundary[1], "", - "text/plain", ""); - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - $result .= $this->GetBoundary($this->boundary[1], "", - "text/html", ""); - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[1]); - break; - case "plain": - $result .= $this->EncodeString($this->Body, $this->Encoding); - break; - case "attachments": - $result .= $this->GetBoundary($this->boundary[1], "", "", ""); - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE; - - $result .= $this->AttachAll(); - break; - case "alt_attachments": - $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); - $result .= sprintf("Content-Type: %s;%s" . - "\tboundary=\"%s\"%s", - "multipart/alternative", $this->LE, - $this->boundary[2], $this->LE.$this->LE); - - // Create text body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/plain", "") . $this->LE; - - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - - // Create the HTML body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/html", "") . $this->LE; - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[2]); - - $result .= $this->AttachAll(); - break; - } - if($this->IsError()) - $result = ""; - - return $result; - } - - /** - * Returns the start of a message boundary. - * @access private - */ - function GetBoundary($boundary, $charSet, $contentType, $encoding) { - $result = ""; - if($charSet == "") { $charSet = $this->CharSet; } - if($contentType == "") { $contentType = $this->ContentType; } - if($encoding == "") { $encoding = $this->Encoding; } - - $result .= $this->TextLine("--" . $boundary); - $result .= sprintf("Content-Type: %s; charset = \"%s\"", - $contentType, $charSet); - $result .= $this->LE; - $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); - $result .= $this->LE; - - return $result; - } - - /** - * Returns the end of a message boundary. - * @access private - */ - function EndBoundary($boundary) { - return $this->LE . "--" . $boundary . "--" . $this->LE; - } - - /** - * Sets the message type. - * @access private - * @return void - */ - function SetMessageType() { - if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) - $this->message_type = "plain"; - else - { - if(count($this->attachment) > 0) - $this->message_type = "attachments"; - if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) - $this->message_type = "alt"; - if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) - $this->message_type = "alt_attachments"; - } - } - - /** - * Returns a formatted header line. - * @access private - * @return string - */ - function HeaderLine($name, $value) { - return $name . ": " . $value . $this->LE; - } - - /** - * Returns a formatted mail line. - * @access private - * @return string - */ - function TextLine($value) { - return $value . $this->LE; - } - - ///////////////////////////////////////////////// - // ATTACHMENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds an attachment from a path on the vtiger_filesystem. - * Returns false if the file could not be found - * or accessed. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return bool - */ - function AddAttachment($path, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } - - $filename = basename($path); - if($name == "") - $name = $filename; - - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; - - return true; - } - - /** - * Attaches all fs, string, and binary vtiger_attachments to the message. - * Returns an empty string on failure. - * @access private - * @return string - */ - function AttachAll() { - // Return text of body - $mime = array(); - - // Add all vtiger_attachments - for($i = 0; $i < count($this->attachment); $i++) - { - // Check for string attachment - $bString = $this->attachment[$i][5]; - if ($bString) - $string = $this->attachment[$i][0]; - else - $path = $this->attachment[$i][0]; - - $filename = $this->attachment[$i][1]; - $name = $this->attachment[$i][2]; - $encoding = $this->attachment[$i][3]; - $type = $this->attachment[$i][4]; - $disposition = $this->attachment[$i][6]; - $cid = $this->attachment[$i][7]; - - $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); - $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); - - if($disposition == "inline") - $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", - $disposition, $name, $this->LE.$this->LE); - - // Encode as string attachment - if($bString) - { - $mime[] = $this->EncodeString($string, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } - else - { - $mime[] = $this->EncodeFile($path, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } - } - - $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); - - return join("", $mime); - } - - /** - * Encodes attachment in requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeFile ($path, $encoding = "base64") { - if(!@$fd = fopen($path, "rb")) - { - $this->SetError($this->Lang("file_open") . $path); - return ""; - } - $magic_quotes = get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); - $file_buffer = fread($fd, filesize($path)); - $file_buffer = $this->EncodeString($file_buffer, $encoding); - fclose($fd); - set_magic_quotes_runtime($magic_quotes); - - return $file_buffer; - } - - /** - * Encodes string to requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeString ($str, $encoding = "base64") { - $encoded = ""; - switch(strtolower($encoding)) { - case "base64": - // chunk_split is found in PHP >= 3.0.6 - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case "7bit": - case "8bit": - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - break; - case "binary": - $encoded = $str; - break; - case "quoted-printable": - $encoded = $this->EncodeQP($str); - break; - default: - $this->SetError($this->Lang("encoding") . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string to best of Q, B, quoted or none. - * @access private - * @return string - */ - function EncodeHeader ($str, $position = 'text') { - $x = 0; - - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know what value has magic_quotes_sybase. - $encoded = addcslashes($str, "\0..\37\177\\\""); - - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) - return ($encoded); - else - return ("\"$encoded\""); - } - $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - case 'comment': - $x = preg_match_all('/[()"]/', $str, $matches); - // Fall-through - case 'text': - default: - $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($x == 0) - return ($str); - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { - $encoding = 'B'; - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } else { - $encoding = 'Q'; - $encoded = $this->EncodeQ($str, $position); - $encoded = $this->WrapText($encoded, $maxlen, true); - $encoded = str_replace("=".$this->LE, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Encode string to quoted-printable. - * @access private - * @return string - */ - function EncodeQP ($str) { - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - - // Replace every high ascii, control and = characters - $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - // Replace every spaces and vtiger_tabs when it's the last character on a line - $encoded = preg_replace("/([\011\040])".$this->LE."/e", - "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); - - // Maximum line length of 76 characters before CRLF (74 + space + '=') - $encoded = $this->WrapText($encoded, 74, true); - - return $encoded; - } - - /** - * Encode string to q encoding. - * @access private - * @return string - */ - function EncodeQ ($str, $position = "text") { - // There should not be any EOL in the string - $encoded = preg_replace("[\r\n]", "", $str); - - switch (strtolower($position)) { - case "phrase": - $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - case "comment": - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - case "text": - default: - // Replace every high ascii, control =, ? and _ characters - $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - } - - // Replace every spaces to _ (more readable than =20) - $encoded = str_replace(" ", "_", $encoded); - - return $encoded; - } - - /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return void - */ - function AddStringAttachment($string, $filename, $encoding = "base64", - $type = "application/octet-stream") { - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $string; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $filename; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = true; // isString - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; - } - - /** - * Adds an embedded attachment. This can include images, sounds, and - * just about any other document. Make sure to set the $type to an - * image type. For JPEG images use "image/jpeg" and for GIF images - * use "image/gif". - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment. Use this to identify - * the Id for accessing the image in an HTML form. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return bool - */ - function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } - - $filename = basename($path); - if($name == "") - $name = $filename; - - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "inline"; - $this->attachment[$cur][7] = $cid; - - return true; - } - - /** - * Returns true if an inline attachment is present. - * @access private - * @return bool - */ - function InlineImageExists() { - $result = false; - for($i = 0; $i < count($this->attachment); $i++) - { - if($this->attachment[$i][6] == "inline") - { - $result = true; - break; - } - } - - return $result; - } - - ///////////////////////////////////////////////// - // MESSAGE RESET METHODS - ///////////////////////////////////////////////// - - /** - * Clears all recipients assigned in the TO array. Returns void. - * @return void - */ - function ClearAddresses() { - $this->to = array(); - } - - /** - * Clears all recipients assigned in the CC array. Returns void. - * @return void - */ - function ClearCCs() { - $this->cc = array(); - } - - /** - * Clears all recipients assigned in the BCC array. Returns void. - * @return void - */ - function ClearBCCs() { - $this->bcc = array(); - } - - /** - * Clears all recipients assigned in the ReplyTo array. Returns void. - * @return void - */ - function ClearReplyTos() { - $this->ReplyTo = array(); - } - - /** - * Clears all recipients assigned in the TO, CC and BCC - * array. Returns void. - * @return void - */ - function ClearAllRecipients() { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - } - - /** - * Clears all previously set vtiger_filesystem, string, and binary - * vtiger_attachments. Returns void. - * @return void - */ - function ClearAttachments() { - $this->attachment = array(); - } - - /** - * Clears all custom vtiger_headers. Returns void. - * @return void - */ - function ClearCustomHeaders() { - $this->CustomHeader = array(); - } - - - ///////////////////////////////////////////////// - // MISCELLANEOUS METHODS - ///////////////////////////////////////////////// - - /** - * Adds the error message to the error container. - * Returns void. - * @access private - * @return void - */ - function SetError($msg) { - $this->error_count++; - $this->ErrorInfo = $msg; - } - - /** - * Returns the proper RFC 822 formatted date. - * @access private - * @return string - */ - function RFCDate() { - $tz = date("Z"); - $tzs = ($tz < 0) ? "-" : "+"; - $tz = abs($tz); - $tz = ($tz/3600)*100 + ($tz%3600)/60; - $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); - - return $result; - } - - /** - * Returns the appropriate server variable. Should work with both - * PHP 4.1.0+ as well as older versions. Returns an empty string - * if nothing is found. - * @access private - * @return mixed - */ - function ServerVar($varName) { - global $HTTP_SERVER_VARS; - global $HTTP_ENV_VARS; - - if(!isset($_SERVER)) - { - $_SERVER = $HTTP_SERVER_VARS; - if(!isset($_SERVER["REMOTE_ADDR"])) - $_SERVER = $HTTP_ENV_VARS; // must be Apache - } - - if(isset($_SERVER[$varName])) - return $_SERVER[$varName]; - else - return ""; - } - - /** - * Returns the server hostname or 'localhost.localdomain' if unknown. - * @access private - * @return string - */ - function ServerHostname() { - if ($this->Hostname != "") - $result = $this->Hostname; - elseif ($this->ServerVar('SERVER_NAME') != "") - $result = $this->ServerVar('SERVER_NAME'); - else - $result = "localhost.localdomain"; - - return $result; - } - - /** - * Returns a message in the appropriate language. - * @access private - * @return string - */ - function Lang($key) { - require_once('config.inc.php'); - global $default_language; - if(count($this->language) < 1) - $this->SetLanguage($default_language); - - if(isset($this->language[$key])) - return $this->language[$key]; - else - return "Language string failed to load: " . $key; - } - - /** - * Returns true if an error occurred. - * @return bool - */ - function IsError() { - return ($this->error_count > 0); - } - - /** - * Changes every end of line from CR or LF to CRLF. - * @access private - * @return string - */ - function FixEOL($str) { - $str = str_replace("\r\n", "\n", $str); - $str = str_replace("\r", "\n", $str); - $str = str_replace("\n", $this->LE, $str); - return $str; - } - - /** - * Adds a custom header. - * @return void - */ - function AddCustomHeader($custom_header) { - $this->CustomHeader[] = explode(":", $custom_header, 2); - } -} - -?> diff --git a/oss/vtiger/trunk/modules/Emails/class.smtp.php b/oss/vtiger/trunk/modules/Emails/class.smtp.php deleted file mode 100644 index abba3404..00000000 --- a/oss/vtiger/trunk/modules/Emails/class.smtp.php +++ /dev/null @@ -1,1050 +0,0 @@ -smtp_conn = 0; - $this->error = null; - $this->helo_rply = null; - - $this->do_debug = 0; - } - - /************************************************************* - * CONNECTION FUNCTIONS * - ***********************************************************/ - - /** - * Connect to the server specified on the port specified. - * If the port is not specified use the default SMTP_PORT. - * If tval is specified then a connection will try and be - * established with the server for that number of seconds. - * If tval is not specified the default is 30 seconds to - * try on the connection. - * - * SMTP CODE SUCCESS: 220 - * SMTP CODE FAILURE: 421 - * @access public - * @return bool - */ - function Connect($host,$port=0,$tval=30) { - # set the error val to null so there is no confusion - $this->error = null; - - # make sure we are __not__ connected - if($this->connected()) { - # ok we are connected! what should we do? - # for now we will just give an error saying we - # are already connected - $this->error = - array("error" => "Already connected to a server"); - return false; - } - - if(empty($port)) { - $port = $this->SMTP_PORT; - } - - #connect to the smtp server - if(!@$this->smtp_conn = fsockopen($host, # the host of the server - $port, # the port to use - $errno, # error number if any - $errstr, # error message if any - $tval)) # give up after ? secs - { - //echo '
Could Not connect to Mail Server

'; - return false; - } - - # verify we connected properly - if(empty($this->smtp_conn)) { - $this->error = array("error" => "Failed to connect to server", - "errno" => $errno, - "errstr" => $errstr); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": $errstr ($errno)" . $this->CRLF; - } - return false; - } - - # sometimes the SMTP server takes a little longer to respond - # so we will give it a longer timeout for the first read - // Windows still does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != "WIN") - socket_set_timeout($this->smtp_conn, $tval, 0); - - # get any vtiger_announcement stuff - $announce = $this->get_lines(); - - # set the timeout of any socket functions at 1/10 of a second - //if(function_exists("socket_set_timeout")) - // socket_set_timeout($this->smtp_conn, 0, 100000); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; - } - - return true; - } - - /** - * Performs SMTP authentication. Must be run after running the - * Hello() method. Returns true if successfully authenticated. - * @access public - * @return bool - */ - function Authenticate($username, $password) { - // Start authentication - fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "AUTH not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - // Send encoded username - fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "Username not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - // Send encoded password - fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 235) { - $this->error = - array("error" => "Password not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return true; - } - - /** - * Returns true if connected to a server otherwise false - * @access private - * @return bool - */ - function Connected() { - if(!empty($this->smtp_conn)) { - $sock_status = socket_get_status($this->smtp_conn); - if($sock_status["eof"]) { - # hmm this is an odd situation... the socket is - # valid but we aren't connected anymore - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE:" . $this->CRLF . - "EOF caught while checking if connected"; - } - $this->Close(); - return false; - } - return true; # everything looks good - } - return false; - } - - /** - * Closes the socket and cleans up the state of the class. - * It is not considered good to use this function without - * first trying to use QUIT. - * @access public - * @return void - */ - function Close() { - $this->error = null; # so there is no confusion - $this->helo_rply = null; - if(!empty($this->smtp_conn)) { - # close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = 0; - } - } - - - /*************************************************************** - * SMTP COMMANDS * - *************************************************************/ - - /** - * Issues a data command and sends the msg_data to the server - * finializing the mail transaction. $msg_data is the message - * that is to be send with the vtiger_headers. Each header needs to be - * on a single line followed by a with the message vtiger_headers - * and the message body being seperated by and additional . - * - * Implements rfc 821: DATA - * - * SMTP CODE INTERMEDIATE: 354 - * [data] - * . - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 552,554,451,452 - * SMTP CODE FAILURE: 451,554 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Data($msg_data) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Data() without being connected"); - return false; - } - - fputs($this->smtp_conn,"DATA" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 354) { - $this->error = - array("error" => "DATA command not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - # the server is ready to accept data! - # according to rfc 821 we should not send more than 1000 - # including the CRLF - # characters on a single line so we will break the data up - # into lines by \r and/or \n then if needed we will break - # each of those into smaller lines to fit within the limit. - # in addition we will be looking for lines that start with - # a period '.' and append and additional period '.' to that - # line. NOTE: this does not count towards are limit. - - # normalize the line breaks so we know the explode works - $msg_data = str_replace("\r\n","\n",$msg_data); - $msg_data = str_replace("\r","\n",$msg_data); - $lines = explode("\n",$msg_data); - - # we need to find a good way to determine is vtiger_headers are - # in the msg_data or if it is a straight msg body - # currently I'm assuming rfc 822 definitions of msg vtiger_headers - # and if the first vtiger_field of the first line (':' sperated) - # does not contain a space then it _should_ be a header - # and we can process all lines before a blank "" line as - # vtiger_headers. - $field = substr($lines[0],0,strpos($lines[0],":")); - $in_headers = false; - if(!empty($field) && !strstr($field," ")) { - $in_headers = true; - } - - $max_line_length = 998; # used below; set here for ease in change - - while(list(,$line) = @each($lines)) { - $lines_out = null; - if($line == "" && $in_headers) { - $in_headers = false; - } - # ok we need to break this line up into several - # smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line,0,$max_line_length)," "); - - # Patch to fix DOS attack - if(!$pos) { - $pos = $max_line_length - 1; - } - - $lines_out[] = substr($line,0,$pos); - $line = substr($line,$pos + 1); - # if we are processing vtiger_headers we need to - # add a LWSP-char to the front of the new line - # rfc 822 on long msg vtiger_headers - if($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - # now send the lines to the server - while(list(,$line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) - { - if(substr($line_out, 0, 1) == ".") { - $line_out = "." . $line_out; - } - } - fputs($this->smtp_conn,$line_out . $this->CRLF); - } - } - - # ok all the message data has been sent so lets get this - # over with aleady - fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "DATA not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Expand takes the name and asks the server to list all the - * people who are members of the _list_. Expand will return - * back and array of the result or false if an error occurs. - * Each value in the array returned has the format of: - * [ ] - * The definition of is defined in rfc 821 - * - * Implements rfc 821: EXPN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 550 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string array - */ - function Expand($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Expand() without being connected"); - return false; - } - - fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "EXPN not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - # parse the reply and place in our array to return to user - $entries = explode($this->CRLF,$rply); - while(list(,$l) = @each($entries)) { - $list[] = substr($l,4); - } - - return $list; - } - - /** - * Sends the HELO command to the smtp server. - * This makes sure that we and the server are in - * the same known state. - * - * Implements from rfc 821: HELO - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @return bool - */ - function Hello($host="") { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Hello() without being connected"); - return false; - } - - # if a hostname for the HELO wasn't specified determine - # a suitable one to send - if(empty($host)) { - # we need to determine some sort of appopiate default - # to send to the server - $host = "localhost"; - } - - // Send extended hello first (RFC 2821) - if(!$this->SendHello("EHLO", $host)) - { - if(!$this->SendHello("HELO", $host)) - return false; - } - - return true; - } - - /** - * Sends a HELO/EHLO command. - * @access private - * @return bool - */ - function SendHello($hello, $host) { - fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => $hello . " not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - $this->helo_rply = $rply; - - return true; - } - - /** - * Gets help information on the keyword specified. If the keyword - * is not specified then returns generic help, ussually contianing - * A list of keywords that help is available on. This function - * returns the results back to the user. It is up to the user to - * handle the returned data. If an error occurs then false is - * returned with $this->error set appropiately. - * - * Implements rfc 821: HELP [ ] - * - * SMTP CODE SUCCESS: 211,214 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string - */ - function Help($keyword="") { - $this->error = null; # to avoid confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Help() without being connected"); - return false; - } - - $extra = ""; - if(!empty($keyword)) { - $extra = " " . $keyword; - } - - fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 211 && $code != 214) { - $this->error = - array("error" => "HELP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return $rply; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. - * - * Implements rfc 821: MAIL FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,421 - * @access public - * @return bool - */ - function Mail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Mail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "MAIL not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the command NOOP to the SMTP server. - * - * Implements from rfc 821: NOOP - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 421 - * @access public - * @return bool - */ - function Noop() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Noop() without being connected"); - return false; - } - - fputs($this->smtp_conn,"NOOP" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "NOOP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the quit command to the server and then closes the socket - * if there is no error or the $close_on_error argument is true. - * - * Implements from rfc 821: QUIT - * - * SMTP CODE SUCCESS: 221 - * SMTP CODE ERROR : 500 - * @access public - * @return bool - */ - function Quit($close_on_error=true) { - $this->error = null; # so there is no confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Quit() without being connected"); - return false; - } - - # send the quit command to the server - fputs($this->smtp_conn,"quit" . $this->CRLF); - - # get any good-bye messages - $byemsg = $this->get_lines(); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; - } - - $rval = true; - $e = null; - - $code = substr($byemsg,0,3); - if($code != 221) { - # use e as a tmp var cause Close will overwrite $this->error - $e = array("error" => "SMTP server rejected quit command", - "smtp_code" => $code, - "smtp_rply" => substr($byemsg,4)); - $rval = false; - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $e["error"] . ": " . - $byemsg . $this->CRLF; - } - } - - if(empty($e) || $close_on_error) { - $this->Close(); - } - - return $rval; - } - - /** - * Sends the command RCPT to the SMTP server with the TO: argument of $to. - * Returns true if the recipient was accepted false if it was rejected. - * - * Implements from rfc 821: RCPT TO: - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,552,553,450,451,452 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Recipient($to) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Recipient() without being connected"); - return false; - } - - fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250 && $code != 251) { - $this->error = - array("error" => "RCPT not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the RSET command to abort and transaction that is - * currently in progress. Returns true if successful false - * otherwise. - * - * Implements rfc 821: RSET - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500,501,504,421 - * @access public - * @return bool - */ - function Reset() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Reset() without being connected"); - return false; - } - - fputs($this->smtp_conn,"RSET" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "RSET failed", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the vtiger_users terminal if they are logged - * in. - * - * Implements rfc 821: SEND FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function Send($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Send() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SEND not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the vtiger_users terminal if they are logged - * in and send them an email. - * - * Implements rfc 821: SAML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendAndMail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendAndMail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SAML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the vtiger_users terminal if they are logged - * in or mail it to them if they are not. - * - * Implements rfc 821: SOML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendOrMail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendOrMail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SOML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * This is an optional command for SMTP that this class does not - * support. This method is here to make the RFC821 Definition - * complete for this class and __may__ be implimented in the future - * - * Implements from rfc 821: TURN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 502 - * SMTP CODE ERROR : 500, 503 - * @access public - * @return bool - */ - function Turn() { - $this->error = array("error" => "This method, TURN, of the SMTP ". - "is not implemented"); - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; - } - return false; - } - - /** - * Verifies that the name is recognized by the server. - * Returns false if the name could not be verified otherwise - * the response from the server is returned. - * - * Implements rfc 821: VRFY - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,553 - * SMTP CODE ERROR : 500,501,502,421 - * @access public - * @return int - */ - function Verify($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Verify() without being connected"); - return false; - } - - fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250 && $code != 251) { - $this->error = - array("error" => "VRFY failed on name '$name'", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return $rply; - } - - /******************************************************************* - * INTERNAL FUNCTIONS * - ******************************************************************/ - - /** - * Read in as many lines as possible - * either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access private - * @return string - */ - function get_lines() { - $data = ""; - while($str = fgets($this->smtp_conn,515)) { - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data was \"$data\"" . - $this->CRLF; - echo "SMTP -> get_lines(): \$str is \"$str\"" . - $this->CRLF; - } - $data .= $str; - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; - } - # if the 4th character is a space then we are done reading - # so just break the loop - if(substr($str,3,1) == " ") { break; } - } - return $data; - } - -} - - - ?> diff --git a/oss/vtiger/trunk/modules/Emails/gotodownload.php b/oss/vtiger/trunk/modules/Emails/gotodownload.php deleted file mode 100644 index e6340089..00000000 --- a/oss/vtiger/trunk/modules/Emails/gotodownload.php +++ /dev/null @@ -1,82 +0,0 @@ -parameters[0]->value; - $strFileType = strrev(substr(strrev($strFileName),0,4)); - $fileContent = imap_fetchbody($mbox,$msgno,$file+2); -} - -/** Function to download the File - * @param string $strFileType - File Type - * @param string $strFileName - File Name - * @param string $fileContents- File contents -**/ -function downloadFile($strFileType,$strFileName,$fileContent) -{ - $ContentType = "application/octet-stream"; - - if ($strFileType == ".asf") - $ContentType = "video/x-ms-asf"; - if ($strFileType == ".avi") - $ContentType = "video/avi"; - if ($strFileType == ".doc") - $ContentType = "application/msword"; - if ($strFileType == ".zip") - $ContentType = "application/zip"; - if ($strFileType == ".xls") - $ContentType = "application/vnd.ms-excel"; - if ($strFileType == ".gif") - $ContentType = "image/gif"; - if ($strFileType == ".jpg" || $strFileType == "jpeg") - $ContentType = "image/jpeg"; - if ($strFileType == ".wav") - $ContentType = "audio/wav"; - if ($strFileType == ".mp3") - $ContentType = "audio/mpeg3"; - if ($strFileType == ".mpg" || $strFileType == "mpeg") - $ContentType = "video/mpeg"; - if ($strFileType == ".rtf") - $ContentType = "application/rtf"; - if ($strFileType == ".htm" || $strFileType == "html") - $ContentType = "text/html"; - if ($strFileType == ".xml") - $ContentType = "text/xml"; - if ($strFileType == ".xsl") - $ContentType = "text/xsl"; - if ($strFileType == ".css") - $ContentType = "text/css"; - if ($strFileType == ".php") - $ContentType = "text/php"; - if ($strFileType == ".asp") - $ContentType = "text/asp"; - if ($strFileType == ".pdf") - $ContentType = "application/pdf"; - - header ("Content-Type: $ContentType"); - header("Cache-Control: private"); - header("Content-Description: PHP Generated Data"); - header ("Content-Disposition: attachment; filename=$strFileName"); - echo imap_base64($fileContent); - #echo base64_decode($fileContent); -} -?> diff --git a/oss/vtiger/trunk/modules/Emails/index.php b/oss/vtiger/trunk/modules/Emails/index.php deleted file mode 100644 index 0c3a5ef8..00000000 --- a/oss/vtiger/trunk/modules/Emails/index.php +++ /dev/null @@ -1,31 +0,0 @@ -'.$mod_strings['LBL_MAIL_CONNECT_ERROR_INFO'].'

'; -} - -include ('modules/Emails/ListView.php'); - -?> diff --git a/oss/vtiger/trunk/modules/Emails/language/en_us.lang.php b/oss/vtiger/trunk/modules/Emails/language/en_us.lang.php deleted file mode 100644 index 4b84eafb..00000000 --- a/oss/vtiger/trunk/modules/Emails/language/en_us.lang.php +++ /dev/null @@ -1,183 +0,0 @@ -'General Information', - -'LBL_MODULE_NAME'=>'Email', -'LBL_MODULE_TITLE'=>'Email: Home', -'LBL_SEARCH_FORM_TITLE'=>'Email Search', -'LBL_LIST_FORM_TITLE'=>'Email List', -'LBL_NEW_FORM_TITLE'=>'Track Email', - -'LBL_LIST_SUBJECT'=>'Subject', -'LBL_LIST_CONTACT'=>'Contact', -'LBL_LIST_RELATED_TO'=>'Related to', -'LBL_LIST_DATE'=>'Date Sent', -'LBL_LIST_TIME'=>'Time Sent', - -'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.", -'LBL_DATE_SENT'=>'Date Sent:', -'LBL_DATE_AND_TIME'=>'Date & Time Sent:', -'LBL_DATE'=>'Date Sent:', -'LBL_TIME'=>'Time Sent:', -'LBL_SUBJECT'=>'Subject:', -'LBL_BODY'=>'Body:', -'LBL_CONTACT_NAME'=>' Contact Name: ', -'LBL_EMAIL'=>'Email:', -'LBL_DETAILVIEW_EMAIL'=>'E-Mail', -'LBL_COLON'=>':', -'LBL_CHK_MAIL'=>'Check Mail', -'LBL_COMPOSE'=>'Compose', -//Single change for 5.0.3 -'LBL_SETTINGS'=>'Incoming Mail Server Settings', -'LBL_EMAIL_FOLDERS'=>'Email Folders', -'LBL_INBOX'=>'Inbox', -'LBL_SENT_MAILS'=>'Sent Mails', -'LBL_TRASH'=>'Trash', -'LBL_JUNK_MAILS'=>'Junk Mails', -'LBL_TO_LEADS'=>'To Leads', -'LBL_TO_CONTACTS'=>'To Contacts', -'LBL_TO_ACCOUNTS'=>'To Accounts', -'LBL_MY_MAILS'=>'My Mails', -'LBL_QUAL_CONTACT'=>'Qualified Mails (As Contacts)', -'LBL_MAILS'=>'Mails', -'LBL_QUALIFY_BUTTON'=>'Qualify', -'LBL_REPLY_BUTTON'=>'Reply', -'LBL_FORWARD_BUTTON'=>'Forward', -'LBL_DOWNLOAD_ATTCH_BUTTON'=>'Download Attachments', -'LBL_FROM'=>'From :', -'LBL_CC'=>'Cc :', -'LBL_BCC'=>'Bcc :', - -'NTC_REMOVE_INVITEE'=>'Are you sure you want to remove this recipient from the email?', -'LBL_INVITEE'=>'Recipients', - -// Added Fields -// Contacts-SubPanelViewContactsAndUsers.php -'LBL_BULK_MAILS'=>'Bulk Mails', -'LBL_ATTACHMENT'=>'Attachment', -'LBL_UPLOAD'=>'Upload', -'LBL_FILE_NAME'=>'File Name', -'LBL_SEND'=>'Send', - -'LBL_EMAIL_TEMPLATES'=>'Email Templates', -'LBL_TEMPLATE_NAME'=>'Template Name', -'LBL_DESCRIPTION'=>'Description', -'LBL_EMAIL_TEMPLATES_LIST'=>'Email Templates List', -'LBL_EMAIL_INFORMATION'=>'Email Information', - - - - -//for v4 release added -'LBL_NEW_LEAD'=>'New Lead', -'LBL_LEAD_TITLE'=>'Leads', - -'LBL_NEW_PRODUCT'=>'New Product', -'LBL_PRODUCT_TITLE'=>'Products', -'LBL_NEW_CONTACT'=>'New Contact', -'LBL_CONTACT_TITLE'=>'Contacts', -'LBL_NEW_ACCOUNT'=>'New Account', -'LBL_ACCOUNT_TITLE'=>'Accounts', - -// Added vtiger_fields after vtiger4 - Beta -'LBL_USER_TITLE'=>'Users', -'LBL_NEW_USER'=>'New User', - -// Added for 4 GA -'LBL_TOOL_FORM_TITLE'=>'Email Tools', -//Added for 4GA -'Date & Time Sent'=>'Date & Time Sent', -'Sales Enity Module'=>'Sales Enity Module', -'Related To'=>'Related To', -'Assigned To'=>'Assigned To', -'Subject'=>'Subject', -'Attachment'=>'Attachment', -'Description'=>'Description', -'Time Start'=>'Time Start', -'Created Time'=>'Created Time', -'Modified Time'=>'Modified Time', - -'MESSAGE_CHECK_MAIL_SERVER_NAME'=>'Please Check the Mail Server Name...', -'MESSAGE_CHECK_MAIL_ID'=>'Please Check the Email Id of "Assigned To" User...', -'MESSAGE_MAIL_HAS_SENT_TO_USERS'=>'Mail has been sent to the following User(s) :', -'MESSAGE_MAIL_HAS_SENT_TO_CONTACTS'=>'Mail has been sent to the following Contact(s) :', -'MESSAGE_MAIL_ID_IS_INCORRECT'=>'Mail Id is incorrect. Please Check this Mail Id...', -'MESSAGE_ADD_USER_OR_CONTACT'=>'Please Add any User(s) or Contact(s)...', -'MESSAGE_MAIL_SENT_SUCCESSFULLY'=>' Mail(s) sent successfully!', - -// Added for web mail post 4.0.1 release -'LBL_FETCH_WEBMAIL'=>'Fetch Web Mail', -//Added for 4.2 Release -- CustomView -'LBL_ALL'=>'All', -'MESSAGE_CONTACT_NOT_WANT_MAIL'=>'This Contact does not want to receive mails.', -'LBL_WEBMAILS_TITLE'=>'WebMails', -'LBL_EMAILS_TITLE'=>'Email', -'LBL_MAIL_CONNECT_ERROR_INFO'=>'Error connecting mail server!
Check in My Accounts->List Mail Server -> List Mail Account', -'LBL_ALLMAILS'=>'All Mails', -'LBL_TO_USERS'=>'To Users', -'LBL_TO'=>'To:', -'LBL_IN_SUBJECT'=>'in Subject', -'LBL_IN_SENDER'=>'in Sender', -'LBL_IN_SUBJECT_OR_SENDER'=>'in Subject or Sender', -'SELECT_EMAIL'=>'Select Email IDs', -'Sender'=>'Sender', -'LBL_CONFIGURE_MAIL_SETTINGS'=>'Your Incoming Mail Server is not configured', -'LBL_MAILSELECT_INFO1'=>'The following Email ID types are associated to the selected', -'LBL_MAILSELECT_INFO2'=>'Select the Email ID types to which,the email should be sent', -'LBL_MULTIPLE'=>'Multiple', -'LBL_COMPOSE_EMAIL'=>'Compose E-Mail', -'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail Client', - -//Added for 5.0.3 -'TITLE_VTIGERCRM_MAIL'=>'vtigerCRM Mail', -'TITLE_COMPOSE_MAIL'=>'Compose Mail', - -'MESSAGE_MAIL_COULD_NOT_BE_SEND'=>'Mail could not be sent to the assigned to user.', -'MESSAGE_PLEASE_CHECK_ASSIGNED_USER_EMAILID'=>'Please check the assigned to user email id...', -'MESSAGE_PLEASE_CHECK_THE_FROM_MAILID'=>'Please check the from email id', -'MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID'=>'Mail could not be sent to this email id', -'PLEASE_CHECK_THIS_EMAILID'=>'Please check this mail id...', -'LBL_CC_EMAIL_ERROR'=>'Your cc mailid is not proper', -'LBL_BCC_EMAIL_ERROR'=>'Your bcc mailid is not proper', -'LBL_NO_RCPTS_EMAIL_ERROR'=>'No recepients specified', -'LBL_CONF_MAILSERVER_ERROR'=>'Please configure your outgoing mailserver under Settings ---> Outgoing Server link', -'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail Client', -'LBL_MAILSELECT_INFO3'=>'You don\'t have permission to view email id(s) of the selected Record(s).', -//Added for script alerts -'FEATURE_AVAILABLE_INFO' => 'This feature is currently only available for Microsoft Internet Explorer 5.5+ users\n\nWait f -or an update!', -'DOWNLOAD_CONFIRAMATION' => 'Do you want to download the file ?', -'LBL_PLEASE_ATTACH' => 'Please give a valid file to attach and try again!', -'LBL_KINDLY_UPLOAD' => 'Please configure upload_tmp_dir variable in php.ini file.', -'LBL_EXCEED_MAX' => 'Sorry, the uploaded file exceeds the maximum filesize limit. Please try a file smaller than ', -'LBL_BYTES' => ' bytes', -'LBL_CHECK_USER_MAILID' => 'Please check the current user mailid.It should be a valid mailid to send Emails', - -// Added/Updated for vtiger CRM 5.0.4 -'Activity Type'=>'Activity Type', -'LBL_MAILSELECT_INFO'=>'has the following Email IDs associated.Please Select the Email IDs to which,the mail should be sent', -'LBL_NO_RECORDS' => 'No Records Found', -'LBL_PRINT_EMAIL'=> 'Print', - -); - -?> diff --git a/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-en_us.php b/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-en_us.php deleted file mode 100644 index 7b09c424..00000000 --- a/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-en_us.php +++ /dev/null @@ -1,31 +0,0 @@ -.'; -$PHPMAILER_LANG["file_access"] = 'Could not access file: '; -$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; -$PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; -?> diff --git a/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-zh_cn.php b/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-zh_cn.php deleted file mode 100644 index 7b09c424..00000000 --- a/oss/vtiger/trunk/modules/Emails/language/phpmailer.lang-zh_cn.php +++ /dev/null @@ -1,31 +0,0 @@ -.'; -$PHPMAILER_LANG["file_access"] = 'Could not access file: '; -$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; -$PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; -?> diff --git a/oss/vtiger/trunk/modules/Emails/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Emails/language/zh_cn.lang.php deleted file mode 100644 index 6fa50c4b..00000000 --- a/oss/vtiger/trunk/modules/Emails/language/zh_cn.lang.php +++ /dev/null @@ -1,184 +0,0 @@ - '一般信息', - - 'LBL_MODULE_NAME' => '邮件', - 'LBL_MODULE_TITLE' => '邮件: 首页', - 'LBL_SEARCH_FORM_TITLE' => '搜寻邮件', - 'LBL_LIST_FORM_TITLE' => '邮件列表', - 'LBL_NEW_FORM_TITLE' => '追踪邮件', - - 'LBL_LIST_SUBJECT' => '标题', - 'LBL_LIST_CONTACT' => '联系人', - 'LBL_LIST_RELATED_TO' => '相关人事', - 'LBL_LIST_DATE' => '寄出日期', - 'LBL_LIST_TIME' => '寄出时间', - - 'ERR_DELETE_RECORD' => '必须有记录编号才能删除该笔账号.', - 'LBL_DATE_SENT' => '寄出日期:', - 'LBL_DATE_AND_TIME' => '寄出日期 & 时间:', - 'LBL_DATE' => '寄出日期:', - 'LBL_TIME' => '寄出时间:', - 'LBL_SUBJECT' => '标题:', - 'LBL_BODY' => '邮件内容:', - 'LBL_CONTACT_NAME' => '联系人名称: ', -'LBL_EMAIL' => '邮件:', -'LBL_DETAILVIEW_EMAIL'=>'邮件', -'LBL_COLON'=>':', -'LBL_CHK_MAIL'=>'检查邮件', -'LBL_COMPOSE'=>'新邮件', -//Single change for 5.0.3 -'LBL_SETTINGS'=>'邮件服务器设置', -'LBL_EMAIL_FOLDERS'=>'邮件数据夹', -'LBL_INBOX' => '收件夹', -'LBL_SENT_MAILS'=>'邮件备份', -'LBL_TRASH' => '垃圾桶', - 'LBL_JUNK_MAILS' => '广告邮件', - 'LBL_TO_LEADS' => '转为准客户', - 'LBL_TO_CONTACTS' => '转为联系人', - 'LBL_TO_ACCOUNTS' => '转为客户', - 'LBL_MY_MAILS' => '我的邮件', - 'LBL_QUAL_CONTACT' => '已转换邮件(转为联系人)', - 'LBL_MAILS' => '邮件', - 'LBL_QUALIFY_BUTTON' => '转换', - 'LBL_REPLY_BUTTON' => '回应', - 'LBL_FORWARD_BUTTON' => '转寄', - 'LBL_DOWNLOAD_ATTCH_BUTTON' => '下载附加档案', - 'LBL_FROM' => '寄件人:', - 'LBL_CC' => '副本:', - 'LBL_BCC' => '密件副本:', - - 'NTC_REMOVE_INVITEE' => '您确定要移除这封来信?', -'LBL_INVITEE'=>'接收者', - -// Added Fields -// Contacts-SubPanelViewContactsAndUsers.php - 'LBL_BULK_MAILS' => '大量寄信', - 'LBL_ATTACHMENT' => '附件', -'LBL_UPLOAD' => '上传', - 'LBL_FILE_NAME' => '文件名称', - 'LBL_SEND' => '寄出', - -'LBL_EMAIL_TEMPLATES' => '邮件样版', - 'LBL_TEMPLATE_NAME' => '样版名称', - 'LBL_DESCRIPTION' => '描述', - 'LBL_EMAIL_TEMPLATES_LIST' => '邮件样版列表', - 'LBL_EMAIL_INFORMATION' => '邮件信息', - - - - -//for v4 release added - 'LBL_NEW_LEAD' => '新增潜在客户', - 'LBL_LEAD_TITLE' => '潜在客户', - - 'LBL_NEW_PRODUCT' => '新增商品', - 'LBL_PRODUCT_TITLE' => '商品', - 'LBL_NEW_CONTACT' => '新增联系人', - 'LBL_CONTACT_TITLE' => '联系人', - 'LBL_NEW_ACCOUNT' => '新增公司', - 'LBL_ACCOUNT_TITLE' => '公司', - -// Added vtiger_fields after vtiger4 - Beta -'LBL_USER_TITLE' => '使用者', - 'LBL_NEW_USER' => '新增使用者', - -// Added for 4 GA - 'LBL_TOOL_FORM_TITLE' => '邮件编辑器', -//Added for 4GA -'Date & Time Sent' => '寄出日期 & 时间', - 'Sales Enity Module' => '客服模块', - - 'Related To' => '相关人事', - 'Assigned To' => '负责人', - 'Subject' => '标题', - 'Attachment' => '附件', - 'Description' => '描述', - 'Time Start' => '开始时间', - 'Created Time' => '建立时间', - 'Modified Time' => '修改时间', - - 'MESSAGE_CHECK_MAIL_SERVER_NAME' => '请检查电子邮件服务器名称...', - 'MESSAGE_CHECK_MAIL_ID' => '请检查负责人的信箱编号...', - 'MESSAGE_MAIL_HAS_SENT_TO_USERS' => '邮件将会寄出给指定的使用者:', - 'MESSAGE_MAIL_HAS_SENT_TO_CONTACTS' => '邮件将会寄出给指定的联系人:', - 'MESSAGE_MAIL_ID_IS_INCORRECT' => '邮件格式不正确. 请检查这封邮件的Id...', - 'MESSAGE_ADD_USER_OR_CONTACT' => '请新增其它位使用者或联系人...', - 'MESSAGE_MAIL_SENT_SUCCESSFULLY' => ' 邮件已顺利寄出!', - -// Added for web mail post 4.0.1 release - 'LBL_FETCH_WEBMAIL' => '取得网页邮件', -//Added for 4.2 Release -- CustomView - 'LBL_ALL' => '全部', - 'MESSAGE_CONTACT_NOT_WANT_MAIL' => '这个联系人不想要收到电子邮件', - 'LBL_WEBMAILS_TITLE' => '网页邮件', - 'LBL_EMAILS_TITLE' => '电子邮件', - 'LBL_MAIL_CONNECT_ERROR_INFO' => '联机到邮件服务器时发生错误,检查我的账号=>邮件服务器列表=>邮件账号', - 'LBL_ALLMAILS' => '所有邮件', - 'LBL_TO_USERS' => '给使用者', - 'LBL_TO' => '收件人:', -'LBL_IN_SUBJECT' => '主旨', - 'LBL_IN_SENDER' => '寄件人', - 'LBL_IN_SUBJECT_OR_SENDER' => '主旨或寄件人', - 'SELECT_EMAIL' => '选择邮件编号', - 'Sender' => '寄件人', - 'LBL_CONFIGURE_MAIL_SETTINGS' => '您的收件邮件服务器还没设定', - 'LBL_MAILSELECT_INFO' => '有下面相关邮件编号,请选择要寄送的邮件编号', - 'LBL_MAILSELECT_INFO1' => '下面的邮件编号与选择的项目有关', - 'LBL_MAILSELECT_INFO2' => '选择要寄送的邮件编号类型', - 'LBL_MULTIPLE' => '多选', - 'LBL_COMPOSE_EMAIL' => '发送邮件', - 'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户', - -//Added for 5.0.3 -'TITLE_VTIGERCRM_MAIL'=>'vtigerCRM 邮件', -'TITLE_COMPOSE_MAIL'=>'组成邮件', - -'MESSAGE_MAIL_COULD_NOT_BE_SEND'=>'邮件不能寄发到被分配的用户.', -'MESSAGE_PLEASE_CHECK_ASSIGNED_USER_EMAILID'=>'请检查被分配的用户电子邮件id...', -'MESSAGE_PLEASE_CHECK_THE_FROM_MAILID'=>'请检查电子邮件id', -'MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID'=>'邮件不能寄发到这电子邮件id', -'PLEASE_CHECK_THIS_EMAILID'=>'请检查这邮件id...', -'LBL_CC_EMAIL_ERROR'=>'您的CC邮件ID不是适当的', -'LBL_BCC_EMAIL_ERROR'=>'您的BCC邮件ID不是适当的', -'LBL_NO_RCPTS_EMAIL_ERROR'=>'没有指定移植对象', -'LBL_CONF_MAILSERVER_ERROR'=>'请设置您外部的邮件服务器 ---> 外出的服务器链接', -'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户', -'LBL_MAILSELECT_INFO3'=>'您不能查看选择记录的邮件ID.', -'LBL_NO_RECORDS' => '这个文件夹没有记录', -//Added for script alerts -'FEATURE_AVAILABLE_INFO' => '这个特点只支持Microsoft Internet Explorer 5.5+或更高!', -'DOWNLOAD_CONFIRAMATION' => '您想要下载文件 ?', -'LBL_PLEASE_ATTACH' => '请再尝试附上一个合法的文件', -'LBL_KINDLY_UPLOAD' => '请配置 upload_tmp_dir variable in php.ini file.', -'LBL_EXCEED_MAX' => '抱歉, 上传的文件超出最大值极限。请尝试一个小文件 ', -'LBL_BYTES' => ' 字节', -'LBL_CHECK_USER_MAILID' => '请检查当前用户的电邮ID是否正确', - -// Added/Updated for vtiger CRM 5.0.4 -'Activity Type'=>'任务类型', -'LBL_MAILSELECT_INFO'=>'has the following Email IDs associated.Please Select the Email IDs to which,the mail should be sent', -'LBL_NO_RECORDS' => 'No Records Found', -'LBL_PRINT_EMAIL'=> 'Print', -); - -?> diff --git a/oss/vtiger/trunk/modules/Emails/mail.php b/oss/vtiger/trunk/modules/Emails/mail.php deleted file mode 100644 index 9e028af4..00000000 --- a/oss/vtiger/trunk/modules/Emails/mail.php +++ /dev/null @@ -1,535 +0,0 @@ -println("To id => '".$to_email."'\nSubject ==>'".$subject."'\nContents ==> '".$contents."'"); - - //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table) - //$to_email = getUserEmailId('id',$assigned_user_id); - - //if module is HelpDesk then from_email will come based on support email id - if($from_email == '') { - //if from email is not defined, then use the useremailid as the from address - $from_email = getUserEmailId('user_name',$from_name); - } - - //if the newly defined from email field is set, then use this email address as the from address - //and use the username as the reply-to address - $query = "select * from vtiger_systems where server_type=?"; - $params = array('email'); - $result = $adb->pquery($query,$params); - $from_email_field = $adb->query_result($result,0,'from_email_field'); - $replyToEmail = $from_email; - if(isset($from_email_field) && $from_email_field!=''){ - //setting from _email to the defined email address in the outgoing server configuration - $from_email = $from_email_field; - } - - if($module != "Calendar") - $contents = addSignature($contents,$from_name); - - $mail = new PHPMailer(); - - setMailerProperties($mail,$subject,$contents,$from_email,$from_name,trim($to_email,","),$attachment,$emailid,$module,$logo); - setCCAddress($mail,'cc',$cc); - setCCAddress($mail,'bcc',$bcc); - $mail->AddReplyTo($replyToEmail); - - // vtmailscanner customization: If Support Reply to is defined use it. - global $HELPDESK_SUPPORT_EMAIL_REPLY_ID; - if($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) { - $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID); - } - // END - - // Fix: Return immediately if Outgoing server not configured - if(empty($mail->Host)) { - return 0; - } - // END - - $mail_status = MailSend($mail); - - if($mail_status != 1) - { - $mail_error = getMailError($mail,$mail_status,$mailto); - } - else - { - $mail_error = $mail_status; - } - - return $mail_error; -} - -/** Function to get the user Email id based on column name and column value - * $name -- column name of the vtiger_users vtiger_table - * $val -- column value - */ -function getUserEmailId($name,$val) -{ - global $adb; - $adb->println("Inside the function getUserEmailId. --- ".$name." = '".$val."'"); - if($val != '') - { - //$sql = "select email1, email2, yahoo_id from vtiger_users where ".$name." = '".$val."'"; - //done to resolve the PHP5 specific behaviour - $sql = "SELECT email1, email2, yahoo_id from vtiger_users WHERE status='Active' AND ". $adb->sql_escape_string($name)." = ?"; - $res = $adb->pquery($sql, array($val)); - $email = $adb->query_result($res,0,'email1'); - if($email == '') - { - $email = $adb->query_result($res,0,'email2'); - if($email == '') - { - $email = $adb->query_result($res,0,'yahoo_id'); - } - } - $adb->println("Email id is selected => '".$email."'"); - return $email; - } - else - { - $adb->println("User id is empty. so return value is ''"); - return ''; - } -} - -/** Funtion to add the user's signature with the content passed - * $contents -- where we want to add the signature - * $fromname -- which user's signature will be added to the contents - */ -function addSignature($contents, $fromname) -{ - global $adb; - $adb->println("Inside the function addSignature"); - - $sign = nl2br($adb->query_result($adb->pquery("select signature from vtiger_users where user_name=?", array($fromname)),0,"signature")); - if($sign != '') - { - $contents .= '

'.$sign; - $adb->println("Signature is added with the body => '.".$sign."'"); - } - else - { - $adb->println("Signature is empty for the user => '".$fromname."'"); - } - return $contents; -} - -/** Function to set all the Mailer properties - * $mail -- reference of the mail object - * $subject -- subject of the email you want to send - * $contents -- body of the email you want to send - * $from_email -- from email id which will be displayed in the mail - * $from_name -- from name which will be displayed in the mail - * $to_email -- to email address -- This can be an email in a single string, a comma separated - * list of emails or an array of email addresses - * $attachment -- whether we want to attach the currently selected file or all vtiger_files. - [values = current,all] - optional - * $emailid -- id of the email object which will be used to get the vtiger_attachments - optional - */ -function setMailerProperties($mail,$subject,$contents,$from_email,$from_name,$to_email,$attachment='',$emailid='',$module='',$logo='') -{ - global $adb; - $adb->println("Inside the function setMailerProperties"); - if($module == "Support" || $logo ==1) - $mail->AddEmbeddedImage('themes/images/logo_mail.jpg', 'logo', 'logo.jpg',"base64","image/jpg"); - - $mail->Subject = $subject; - $mail->Body = $contents; - //$mail->Body = html_entity_decode(nl2br($contents)); //if we get html tags in mail then we will use this line - $mail->AltBody = strip_tags(preg_replace(array("/

/i","/
/i","/
/i"),array("\n","\n","\n"),$contents)); - - $mail->IsSMTP(); //set mailer to use SMTP - //$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server - - setMailServerProperties($mail); - - //Handle the from name and email for HelpDesk - $mail->From = $from_email; - $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name)); - if($adb->num_rows($rs) > 0) - $from_name = $adb->query_result($rs,0,"first_name")." ".$adb->query_result($rs,0,"last_name"); - - $mail->FromName = decode_html($from_name); - - if($to_email != '') - { - if(is_array($to_email)) { - for($j=0,$num=count($to_email);$j<$num;$j++) { - $mail->addAddress($to_email[$j]); - } - } else { - $_tmp = explode(",",$to_email); - for($j=0,$num=count($_tmp);$j<$num;$j++) { - $mail->addAddress($_tmp[$j]); - } - } - } - - $mail->AddReplyTo($from_email); - $mail->WordWrap = 50; - - //If we want to add the currently selected file only then we will use the following function - if($attachment == 'current' && $emailid != '') - { - if (isset($_REQUEST['filename_hidden'])) { - $file_name = $_REQUEST['filename_hidden']; - } else { - $file_name = $_FILES['filename']['name']; - } - addAttachment($mail,$file_name,$emailid); - } - - //This will add all the vtiger_files which are related to this record or email - if($attachment == 'all' && $emailid != '') - { - addAllAttachments($mail,$emailid); - } - - $mail->IsHTML(true); // set email format to HTML - - return; -} - -/** Function to set the Mail Server Properties in the object passed - * $mail -- reference of the mailobject - */ -function setMailServerProperties($mail) -{ - global $adb; - $adb->println("Inside the function setMailServerProperties"); - - $res = $adb->pquery("select * from vtiger_systems where server_type=?", array('email')); - if(isset($_REQUEST['server'])) - $server = $_REQUEST['server']; - else - $server = $adb->query_result($res,0,'server'); - if(isset($_REQUEST['server_username'])) - $username = $_REQUEST['server_username']; - else - $username = $adb->query_result($res,0,'server_username'); - if(isset($_REQUEST['server_password'])) - $password = $_REQUEST['server_password']; - else - $password = $adb->query_result($res,0,'server_password'); - // Prasad: First time read smtp_auth from the request - if(isset($_REQUEST['smtp_auth'])) - { - $smtp_auth = $_REQUEST['smtp_auth']; - if($smtp_auth == 'on') - $smtp_auth = 'true'; - } - else if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Settings' && (!isset($_REQUEST['smtp_auth']))) - { - //added to avoid issue while editing the values in the outgoing mail server. - $smtp_auth = 'false'; - } - else - $smtp_auth = $adb->query_result($res,0,'smtp_auth'); - - $adb->println("Mail server name,username & password => '".$server."','".$username."','".$password."'"); - if($smtp_auth == "true"){ - $mail->SMTPAuth = true; // turn on SMTP authentication - } - $mail->Host = $server; // specify main and backup server - $mail->Username = $username ; // SMTP username - $mail->Password = $password ; // SMTP password - - return; -} - -/** Function to add the file as attachment with the mail object - * $mail -- reference of the mail object - * $filename -- filename which is going to added with the mail - * $record -- id of the record - optional - */ -function addAttachment($mail,$filename,$record) -{ - global $adb, $root_directory; - $adb->println("Inside the function addAttachment"); - $adb->println("The file name is => '".$filename."'"); - - //This is the file which has been selected in Email EditView - if(is_file($filename) && $filename != '') - { - $mail->AddAttachment($root_directory."test/upload/".$filename); - } -} - -/** Function to add all the vtiger_files as attachment with the mail object - * $mail -- reference of the mail object - * $record -- email id ie., record id which is used to get the all vtiger_attachments from database - */ -function addAllAttachments($mail,$record) -{ - global $adb,$log, $root_directory; - $adb->println("Inside the function addAllAttachments"); - - //Retrieve the vtiger_files from database where avoid the file which has been currently selected - $sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid = vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid where vtiger_crmentity.deleted=0 and vtiger_seattachmentsrel.crmid=?"; - $res = $adb->pquery($sql, array($record)); - $count = $adb->num_rows($res); - - for($i=0;$i<$count;$i++) - { - $fileid = $adb->query_result($res,$i,'attachmentsid'); - $filename = decode_html($adb->query_result($res,$i,'name')); - $filepath = $adb->query_result($res,$i,'path'); - $filewithpath = $root_directory.$filepath.$fileid."_".$filename; - - //if the file is exist in test/upload directory then we will add directly - //else get the contents of the file and write it as a file and then attach (this will occur when we unlink the file) - if(is_file($filewithpath)) - { - $mail->AddAttachment($filewithpath,$filename); - } - } -} - -/** Function to set the CC or BCC addresses in the mail - * $mail -- reference of the mail object - * $cc_mod -- mode to set the address ie., cc or bcc - * $cc_val -- addresss with comma seperated to set as CC or BCC in the mail - */ -function setCCAddress($mail,$cc_mod,$cc_val) -{ - global $adb; - $adb->println("Inside the functin setCCAddress"); - - if($cc_mod == 'cc') - $method = 'AddCC'; - if($cc_mod == 'bcc') - $method = 'AddBCC'; - if($cc_val != '') - { - $ccmail = explode(",",trim($cc_val,",")); - for($i=0;$i"); - } - if($ccmail[$i] != '') - $mail->$method($addr,$cc_name); - } - } -} - -/** Function to send the mail which will be called after set all the mail object values - * $mail -- reference of the mail object - */ -function MailSend($mail) -{ - global $log; - $log->info("Inside of Send Mail function."); - if(!$mail->Send()) - { - $log->debug("Error in Mail Sending : Error log = '".$mail->ErrorInfo."'"); - return $mail->ErrorInfo; - } - else - { - $log->info("Mail has been sent from the vtigerCRM system : Status : '".$mail->ErrorInfo."'"); - return 1; - } -} - -/** Function to get the Parent email id from HelpDesk to send the details about the ticket via email - * $returnmodule -- Parent module value. Contact or Account for send email about the ticket details - * $parentid -- id of the parent ie., contact or vtiger_account - */ -function getParentMailId($parentmodule,$parentid) -{ - global $adb; - $adb->println("Inside the function getParentMailId. \n parent module and id => ".$parentmodule."&".$parentid); - - if($parentmodule == 'Contacts') - { - $tablename = 'vtiger_contactdetails'; - $idname = 'contactid'; - $first_email = 'email'; - $second_email = 'yahooid'; - } - if($parentmodule == 'Accounts') - { - $tablename = 'vtiger_account'; - $idname = 'accountid'; - $first_email = 'email1'; - $second_email = 'email2'; - } - if($parentid != '') - { - //$query = 'select * from '.$tablename.' where '.$idname.' = '.$parentid; - $query = 'select * from '.$tablename.' where '. $idname.' = ?'; - $res = $adb->pquery($query, array($parentid)); - $mailid = $adb->query_result($res,0,$first_email); - $mailid2 = $adb->query_result($res,0,$second_email); - } - if($mailid == '' && $mailid2 != '') - $mailid = $mailid2; - - return $mailid; -} - -/** Function to parse and get the mail error - * $mail -- reference of the mail object - * $mail_status -- status of the mail which is sent or not - * $to -- the email address to whom we sent the mail and failes - * return -- Mail error occured during the mail sending process - */ -function getMailError($mail,$mail_status,$to) -{ - //Error types in class.phpmailer.php - /* - provide_address, mailer_not_supported, execute, instantiate, file_access, file_open, encoding, data_not_accepted, authenticate, - connect_host, recipients_failed, from_failed - */ - - global $adb; - $adb->println("Inside the function getMailError"); - - $msg = array_search($mail_status,$mail->language); - $adb->println("Error message ==> ".$msg); - - if($msg == 'connect_host') - { - $error_msg = $msg; - } - elseif(strstr($msg,'from_failed')) - { - $error_msg = $msg; - } - elseif(strstr($msg,'recipients_failed')) - { - $error_msg = $msg; - } - else - { - $adb->println("Mail error is not as connect_host or from_failed or recipients_failed"); - //$error_msg = $msg; - } - - $adb->println("return error => ".$error_msg); - return $error_msg; -} - -/** Function to get the mail status string (string of sent mail status) - * $mail_status_str -- concatenated string with all the error messages with &&& seperation - * return - the error status as a encoded string - */ -function getMailErrorString($mail_status_str) -{ - global $adb; - $adb->println("Inside getMailErrorString function.\nMail status string ==> ".$mail_status_str); - - $mail_status_str = trim($mail_status_str,"&&&"); - $mail_status_array = explode("&&&",$mail_status_str); - $adb->println("All Mail status ==>\n".$mail_status_str."\n"); - - foreach($mail_status_array as $key => $val) - { - $list = explode("=",$val); - $adb->println("Mail id & status ==> ".$list[0]." = ".$list[1]); - if($list[1] == 0) - { - $mail_error_str .= $list[0]."=".$list[1]."&&&"; - } - } - $adb->println("Mail error string => '".$mail_error_str."'"); - if($mail_error_str != '') - { - $mail_error_str = 'mail_error='.base64_encode($mail_error_str); - } - return $mail_error_str; -} - -/** Function to parse the error string - * $mail_error_str -- base64 encoded string which contains the mail sending errors as concatenated with &&& - * return - Error message to display - */ -function parseEmailErrorString($mail_error_str) -{ - //TODO -- we can modify this function for better email error handling in future - global $adb, $mod_strings; - $adb->println("Inside the parseEmailErrorString function.\n encoded mail error string ==> ".$mail_error_str); - - $mail_error = base64_decode($mail_error_str); - $adb->println("Original error string => ".$mail_error); - $mail_status = explode("&&&",trim($mail_error,"&&&")); - foreach($mail_status as $key => $val) - { - $status_str = explode("=",$val); - $adb->println('Mail id => "'.$status_str[0].'".........status => "'.$status_str[1].'"'); - if($status_str[1] != 1 && $status_str[1] != '') - { - $adb->println("Error in mail sending"); - if($status_str[1] == 'connect_host') - { - $adb->println("if part - Mail sever is not configured"); - $errorstr .= '
'.$mod_strings['MESSAGE_CHECK_MAIL_SERVER_NAME'].''; - break; - } - elseif($status_str[1] == '0') - { - $adb->println("first elseif part - status will be 0 which is the case of assigned to vtiger_users's email is empty."); - $errorstr .= '
'.$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND'].' '.$mod_strings['MESSAGE_PLEASE_CHECK_FROM_THE_MAILID'].''; - //Added to display the message about the CC && BCC mail sending status - if($status_str[0] == 'cc_success') - { - $cc_msg = 'But the mail has been sent to CC & BCC addresses.'; - $errorstr .= '
'.$cc_msg.''; - } - } - elseif(strstr($status_str[1],'from_failed')) - { - $adb->println("second elseif part - from email id is failed."); - $from = explode('from_failed',$status_str[1]); - $errorstr .= "
".$mod_strings['MESSAGE_PLEASE_CHECK_THE_FROM_MAILID']." '".$from[1]."'"; - } - else - { - $adb->println("else part - mail send process failed due to the following reason."); - $errorstr .= "
".$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID']." '".$status_str[0]."'. ".$mod_strings['PLEASE_CHECK_THIS_EMAILID'].""; - } - } - } - $adb->println("Return Error string => ".$errorstr); - return $errorstr; -} -?> diff --git a/oss/vtiger/trunk/modules/Emails/mailSelect.php b/oss/vtiger/trunk/modules/Emails/mailSelect.php deleted file mode 100644 index 5bb49f3a..00000000 --- a/oss/vtiger/trunk/modules/Emails/mailSelect.php +++ /dev/null @@ -1,109 +0,0 @@ -id; - -$querystr = "select fieldid, fieldname, fieldlabel, columnname from vtiger_field where tabid=? and uitype=13 and vtiger_field.presence in (0,2)"; -$res=$adb->pquery($querystr, array(getTabid($pmodule))); -$numrows = $adb->num_rows($res); -$returnvalue = Array(); -for($i = 0; $i < $numrows; $i++) -{ - $value = Array(); - $fieldname = $adb->query_result($res,$i,"fieldname"); - $permit = getFieldVisibilityPermission($pmodule, $userid, $fieldname); - if($permit == '0') - { - $temp=$adb->query_result($res,$i,'columnname'); - $columnlists [] = $temp; - $fieldid=$adb->query_result($res,$i,'fieldid'); - $fieldlabel =$adb->query_result($res,$i,'fieldlabel'); - $value[] = getTranslatedString($fieldlabel); - $returnvalue [$fieldid]= $value; - } -} - -if($single_record && count($columnlists) > 0) -{ - $count = 0; - $val_cnt = 0; - switch($pmodule) - { - case 'Accounts': - $query = 'select accountname,'.implode(",",$columnlists).' from vtiger_account left join vtiger_accountscf on vtiger_accountscf.accountid = vtiger_account.accountid where vtiger_account.accountid = ?'; - $result=$adb->pquery($query, array($idlist)); - foreach($columnlists as $columnname) - { - $acc_eval = $adb->query_result($result,0,$columnname); - $field_value[$count++] = $acc_eval; - if($acc_eval != "") $val_cnt++; - - } - $entity_name = $adb->query_result($result,0,'accountname'); - break; - case 'Leads': - $query = 'select concat(firstname," ",lastname) as leadname,'.implode(",",$columnlists).' from vtiger_leaddetails left join vtiger_leadscf on vtiger_leadscf.leadid = vtiger_leaddetails.leadid where vtiger_leaddetails.leadid = ?'; - $result=$adb->pquery($query, array($idlist)); - foreach($columnlists as $columnname) - { - $lead_eval = $adb->query_result($result,0,$columnname); - $field_value[$count++] = $lead_eval; - if($lead_eval != "") $val_cnt++; - } - $entity_name = $adb->query_result($result,0,'leadname'); - break; - case 'Contacts': - $query = 'select concat(firstname," ",lastname) as contactname,'.implode(",",$columnlists).' from vtiger_contactdetails left join vtiger_contactscf on vtiger_contactscf.contactid = vtiger_contactdetails.contactid where vtiger_contactdetails.contactid = ?'; - $result=$adb->pquery($query, array($idlist)); - foreach($columnlists as $columnname) - { - $con_eval = $adb->query_result($result,0,$columnname); - $field_value[$count++] = $con_eval; - if($con_eval != "") $val_cnt++; - } - $entity_name = $adb->query_result($result,0,'contactname'); - break; - } -} -$smarty->assign('PERMIT',$permit); -$smarty->assign('ENTITY_NAME',$entity_name); -$smarty->assign('ONE_RECORD',$single_record); -$smarty->assign('MAILDATA',$field_value); -$smarty->assign('MAILINFO',$returnvalue); -$smarty->assign("MOD", $mod_strings); -$smarty->assign("IDLIST", $idlist); -$smarty->assign("APP", $app_strings); -$smarty->assign("FROM_MODULE", $pmodule); -$smarty->assign("THEME", $theme); -$smarty->assign("IMAGE_PATH",$image_path); -if($single_record && count($columnlists) > 0 && $val_cnt > 0) - $smarty->display("SelectEmail.tpl"); -else if(!$single_record && count($columnlists) > 0) - $smarty->display("SelectEmail.tpl"); -else if($single_record && $val_cnt == 0) - echo "No Mail Ids"; -else - echo "Mail Ids not permitted"; -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/mailsend.php b/oss/vtiger/trunk/modules/Emails/mailsend.php deleted file mode 100644 index bcc14e7f..00000000 --- a/oss/vtiger/trunk/modules/Emails/mailsend.php +++ /dev/null @@ -1,239 +0,0 @@ -id;//$_REQUEST['record']; -} - - -$adb->println("\n\nMail Sending Process has been started."); -//This function call is used to send mail to the assigned to user. In this mail CC and BCC addresses will be added. -if($_REQUEST['assigntype' == 'T'] && $_REQUEST['assigned_group_id']!='') -{ - $grp_obj = new GetGroupUsers(); - $grp_obj->getAllUsersInGroup($_REQUEST['assigned_group_id']); - $users_list = constructList($grp_obj->group_users,'INTEGER'); - if (count($users_list) > 0) { - $sql = "select first_name, last_name, email1, email2, yahoo_id from vtiger_users where id in (". generateQuestionMarks($users_list) .")"; - $params = array($users_list); - } else { - $sql = "select first_name, last_name, email1, email2, yahoo_id from vtiger_users"; - $params = array(); - } - $res = $adb->pquery($sql, $params); - $user_email = ''; - while ($user_info = $adb->fetch_array($res)) - { - $email = $user_info['email1']; - if($email == '' || $email == 'NULL') - { - $email = $user_info['email2']; - if($email == '' || $email == 'NULL') - { - $email = $user_info['yahoo_id']; - } - } - if($user_email=='') - $user_email .= $user_info['first_name']." ".$user_info['last_name']."<".$email.">"; - else - $user_email .= ",".$user_info['first_name']." ".$user_info['last_name']."<".$email.">"; - $email=''; - } - $to_email = $user_email; -} -else -{ - $to_email = getUserEmailId('id',$focus->column_fields["assigned_user_id"]); -} -$cc = $_REQUEST['ccmail']; -$bcc = $_REQUEST['bccmail']; -if($to_email == '' && $cc == '' && $bcc == '') -{ - $adb->println("Mail Error : send_mail function not called because To email id of assigned to user, CC and BCC are empty"); - $mail_status_str = "'".$to_email."'=0&&&"; - $errorheader1 = 1; -} -else -{ - $query1 = "select email1 from vtiger_users where id =?"; - $res1 = $adb->pquery($query1, array($current_user->id)); - $val = $adb->query_result($res1,0,"email1"); -// $mail_status = send_mail('Emails',$to_email,$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$cc,$bcc,'all',$focus->id); - - $query = 'update vtiger_emaildetails set email_flag ="SENT",from_email =? where emailid=?'; - $adb->pquery($query, array($val, $focus->id)); - //set the errorheader1 to 1 if the mail has not been sent to the assigned to user - if($mail_status != 1)//when mail send fails - { - $errorheader1 = 1; - $mail_status_str = $to_email."=".$mail_status."&&&"; - } - elseif($mail_status == 1 && $to_email == '')//Mail send success only for CC and BCC but the 'to' email is empty - { - $adb->pquery($query, array($val, $focus->id)); - $errorheader1 = 1; - $mail_status_str = "cc_success=0&&&"; - } - else - { - $mail_status_str = $to_email."=".$mail_status."&&&"; - } -} - - -//Added code from mysendmail.php which is contributed by Raju(rdhital) -$parentid= $_REQUEST['parent_id']; -$myids=explode("|",$parentid); -$all_to_emailids = Array(); -$from_name = $current_user->user_name; -$from_address = $current_user->column_fields['email1']; - -for ($i=0;$i<(count($myids)-1);$i++) -{ - $realid=explode("@",$myids[$i]); - $nemail=count($realid); - $mycrmid=$realid[0]; - if($realid[1] == -1) - { - //handle the mail send to vtiger_users - $emailadd = $adb->query_result($adb->pquery("select email1 from vtiger_users where id=?", array($mycrmid)),0,'email1'); - $pmodule = 'Users'; - $description = getMergedDescription($_REQUEST['description'],$mycrmid,$pmodule); - $mail_status = send_mail('Emails',$emailadd,$from_name,$from_address,$_REQUEST['subject'],$description,'','','all',$focus->id); - $all_to_emailids []= $emailadd; - $mail_status_str .= $emailadd."=".$mail_status."&&&"; - } - else - { - //Send mail to vtiger_account or lead or contact based on their ids - $pmodule=getSalesEntityType($mycrmid); - for ($j=1;$j<$nemail;$j++) - { - $temp=$realid[$j]; - $myquery='Select columnname from vtiger_field where fieldid = ? and vtiger_field.presence in (0,2)'; - $fresult=$adb->pquery($myquery, array($temp)); - if ($pmodule=='Contacts') - { - require_once('modules/Contacts/Contacts.php'); - $myfocus = new Contacts(); - $myfocus->retrieve_entity_info($mycrmid,"Contacts"); - } - elseif ($pmodule=='Accounts') - { - require_once('modules/Accounts/Accounts.php'); - $myfocus = new Accounts(); - $myfocus->retrieve_entity_info($mycrmid,"Accounts"); - } - elseif ($pmodule=='Leads') - { - require_once('modules/Leads/Leads.php'); - $myfocus = new Leads(); - $myfocus->retrieve_entity_info($mycrmid,"Leads"); - } - elseif ($pmodule=='Vendors') - { - require_once('modules/Vendors/Vendors.php'); - $myfocus = new Vendors(); - $myfocus->retrieve_entity_info($mycrmid,"Vendors"); - } - else { - // vtlib customization: Enabling mail send from other modules - $myfocus = CRMEntity::getInstance($pmodule); - $myfocus->retrieve_entity_info($mycrmid, $pmodule); - // END - } - $fldname=$adb->query_result($fresult,0,"columnname"); - $emailadd=br2nl($myfocus->column_fields[$fldname]); - -//This is to convert the html encoded string to original html entities so that in mail description contents will be displayed correctly - //$focus->column_fields['description'] = from_html($focus->column_fields['description']); - - if($emailadd != '') - { - $description = getMergedDescription($_REQUEST['description'],$mycrmid,$pmodule); - //Email Open Tracking - global $site_URL, $application_unique_key; - $emailid = $focus->id; - $track_URL = "$site_URL/modules/Emails/TrackAccess.php?record=$mycrmid&mailid=$emailid&app_key=$application_unique_key"; - $description = "$description"; - // END - - $pos = strpos($description, '$logo$'); - if ($pos !== false) - { - - $description =str_replace('$logo$','',$description); - $logo=1; - } - if(isPermitted($pmodule,'DetailView',$mycrmid) == 'yes') - { - $mail_status = send_mail('Emails',$emailadd,$from_name,$from_address,$_REQUEST['subject'],$description,'','','all',$focus->id,$logo); - } - - $all_to_emailids []= $emailadd; - $mail_status_str .= $emailadd."=".$mail_status."&&&"; - //added to get remain the EditView page if an error occurs in mail sending - if($mail_status != 1) - { - $errorheader2 = 1; - } - } - } - } - -} -//Added to redirect the page to Emails/EditView if there is an error in mail sending -if($errorheader1 == 1 || $errorheader2 == 1) -{ - $returnset = 'return_module='.$returnmodule.'&return_action='.$returnaction.'&return_id='.vtlib_purify($_REQUEST['return_id']); - $returnmodule = 'Emails'; - $returnaction = 'EditView'; - //This condition is added to set the record(email) id when we click on send mail button after returning mail error - if($_REQUEST['mode'] == 'edit') - { - $returnid = $_REQUEST['record']; - } - else - { - $returnid = $_REQUEST['currentid']; - } -} -else -{ - global $adb; - $date_var = date('Ymd'); - $query = 'update vtiger_activity set date_start =? where activityid = ?'; - $adb->pquery($query, array($date_var, $returnid)); -} -//The following function call is used to parse and form a encoded error message and then pass to result page -$mail_error_str = getMailErrorString($mail_status_str); -$adb->println("Mail Sending Process has been finished.\n\n"); -if(isset($_REQUEST['popupaction']) && $_REQUEST['popupaction'] != '') -{ - /*this will fix #1211*/ - $inputs=""; - //$inputs=""; - echo $inputs; -} -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/templates/testemailtemplateusage.php b/oss/vtiger/trunk/modules/Emails/templates/testemailtemplateusage.php deleted file mode 100644 index e69de29b..00000000 diff --git a/oss/vtiger/trunk/modules/Emails/templates/todel.txt b/oss/vtiger/trunk/modules/Emails/templates/todel.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/oss/vtiger/trunk/modules/Emails/updateRelations.php b/oss/vtiger/trunk/modules/Emails/updateRelations.php deleted file mode 100644 index 14be6cbe..00000000 --- a/oss/vtiger/trunk/modules/Emails/updateRelations.php +++ /dev/null @@ -1,40 +0,0 @@ -pquery($sql, array($id, $record)); - } -} -if(isset($_REQUEST['user_id']) && $_REQUEST['user_id'] != '') -{ - $record = $_REQUEST['record']; - $sql = "insert into vtiger_salesmanactivityrel values (?,?)"; - $adb->pquery($sql, array($_REQUEST["user_id"], $record)); -} - -header("Location: index.php?action=CallRelatedList&module=Emails&record=".vtlib_purify($record)); - -?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Emails/webmailsend.php b/oss/vtiger/trunk/modules/Emails/webmailsend.php deleted file mode 100644 index 1c54392d..00000000 --- a/oss/vtiger/trunk/modules/Emails/webmailsend.php +++ /dev/null @@ -1,61 +0,0 @@ -user_name; - $from_add = $current_user->column_fields['email1']; - } - else{ - $from_arr = explode('@',$_REQUEST['from_add']); - $from_name = $from_arr[0]; - $from_add = $_REQUEST['from_add']; - } -$mail_status = send_mail('Emails',$_REQUEST["parent_name"],$from_name,$from_add,$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST["ccmail"],$_REQUEST["bccmail"],'all',$focus->id); - -$query = "update vtiger_emaildetails set email_flag ='SENT' where emailid=?"; -$adb->pquery($query, array($focus->id)); - -//set the errorheader1 to 1 if the mail has not been sent to the assigned to user -if($mail_status != 1) { //when mail send fails - $errorheader1 = 1; - $mail_status_str = $to_email."=".$mail_status."&&&"; - -} elseif($mail_status == 1 && $to_email == '') { //Mail send success only for CC and BCC but the 'to' email is empty - $adb->pquery($query, array($focus->id)); - $errorheader1 = 1; - $mail_status_str = "cc_success=0&&&"; -} else - $mail_status_str = $to_email."=".$mail_status."&&&"; - - - -//Added to redirect the page to Emails/EditView if there is an error in mail sending -if($errorheader1 == 1 || $errorheader2 == 1) -{ - $returnset = 'return_module='.$returnmodule.'&return_action='.$returnaction.'&return_id='.vtlib_purify($_REQUEST['return_id']); - $returnmodule = 'Emails'; - $returnaction = 'EditView'; - if($_REQUEST['mode'] == 'edit') - $returnid = $_REQUEST['record']; - else - $returnid = $_REQUEST['currentid']; -} - -//The following function call is used to parse and form a encoded error message and then pass to result page -$mail_error_str = getMailErrorString($mail_status_str); -$adb->println("Mail Sending Process has been finished.\n\n"); - -if(isset($_REQUEST['popupaction']) && $_REQUEST['popupaction'] != '') -{ - $inputs=""; - echo $inputs; -} -?>