diff --git a/layouts/v7/modules/Vtiger/ComposeEmailForm.tpl b/layouts/v7/modules/Vtiger/ComposeEmailForm.tpl index eda1cf45d9978bcbc192e8efbc80734ab99ce578..3a0ee6e723a7b0bce8cb979251ed07a06ac68d5c 100644 --- a/layouts/v7/modules/Vtiger/ComposeEmailForm.tpl +++ b/layouts/v7/modules/Vtiger/ComposeEmailForm.tpl @@ -145,7 +145,7 @@ {assign var=FILE_TYPE value="file"} {/if} <div class="MultiFile-label customAttachment" data-file-id="{(isset($ATTACHMENT['fileid'])) ? $ATTACHMENT['fileid'] : ''}" data-file-type="{$FILE_TYPE}" data-file-size="{$ATTACHMENT['size']}" {if $FILE_TYPE eq "document"} data-document-id="{$DOCUMENT_ID}"{/if}> - {if $ATTACHMENT['nondeletable'] neq true} + {if isset($ATTACHMENT['nondeletable']) && $ATTACHMENT['nondeletable'] neq true} <a name="removeAttachment" class="cursorPointer">x </a> {/if} <span>{$ATTACHMENT['attachment']}</span> diff --git a/layouts/v7/modules/Vtiger/SelectEmailFields.tpl b/layouts/v7/modules/Vtiger/SelectEmailFields.tpl index 142b79c13fc9c9f9142f21f7cac8da978cc0cdfb..541414e8a004dea16dc742e8c0361983671d3e2f 100644 --- a/layouts/v7/modules/Vtiger/SelectEmailFields.tpl +++ b/layouts/v7/modules/Vtiger/SelectEmailFields.tpl @@ -27,7 +27,7 @@ {if isset($ALPHABET_VALUE)} <input type="hidden" name="search_value" value="{$ALPHABET_VALUE}" /> {/if} - <input type="hidden" name="tag_params" value={ZEND_JSON::encode($TAG_PARAMS)}> + <input type="hidden" name="tag_params" value={if isset($TAG_PARAMS)}{ZEND_JSON::encode($TAG_PARAMS)}{else}''{/if}> {if isset($SEARCH_PARAMS)} <input type="hidden" name="search_params" value='{Vtiger_Util_Helper::toSafeHTML(ZEND_JSON::encode($SEARCH_PARAMS))}' /> {/if} diff --git a/modules/Emails/Emails.php b/modules/Emails/Emails.php index 71f051b31ba9212bc8c8234f8ac56118af3e3eb1..e0e5c065a1a4373ef4daec5542d244d99a35da85 100644 --- a/modules/Emails/Emails.php +++ b/modules/Emails/Emails.php @@ -86,7 +86,7 @@ class Emails extends CRMEntity { //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 (isset($_REQUEST['module']) && $_REQUEST['module'] == "Emails" && $_REQUEST['module'] != 'webmails' && (!$this->plugin_save)) { - if ($_REQUEST['currentid'] != '') { + if (isset($_REQUEST['currentid']) && $_REQUEST['currentid'] != '') { $actid = $_REQUEST['currentid']; } else { $actid = $_REQUEST['record']; diff --git a/modules/Settings/MailConverter/handlers/MailRecord.php b/modules/Settings/MailConverter/handlers/MailRecord.php index 06d810da94bba20c6b06a92ca1a65057b6cb0029..09f92068c0196dcba809dfad176456e1c5cad391 100644 --- a/modules/Settings/MailConverter/handlers/MailRecord.php +++ b/modules/Settings/MailConverter/handlers/MailRecord.php @@ -41,6 +41,8 @@ class Vtiger_MailRecord { var $_htmlmessage = false; // ATTACHMENTS list of the email var $_attachments = false; + // INLINE ATTACHMENTS list of the email + var $_inline_attachments = false; // UNIQUEID associated with the email var $_uniqueid = false; @@ -161,7 +163,7 @@ class Vtiger_MailRecord { static function __mime_decode($input, &$words=null, $targetEncoding='UTF-8') { if(is_null($words)) $words = array(); $returnvalue = $input; - + if(is_null($input)) $input = ''; preg_match_all('/=\?([^\?]+)\?([^\?]+)\?([^\?]+)\?=/', $input, $matches); if($matches) array_filter($matches); if(php7_count($matches[0])>0){ @@ -218,9 +220,9 @@ class Vtiger_MailRecord { $this->_uniqueid = $mailheader->message_id; $this->_from = $this->__getEmailIdList($mailheader->from); - $this->_fromname = self::__mime_decode($mailheader->from[0]->personal); + $this->_fromname = property_exists($mailheader->from[0], 'personal') ? self::__mime_decode($mailheader->from[0]->personal) : ''; - if(!property_exists($mailheader,'to') && !property_exists($mailheader,'cc') && !property_exists($mailheader,'bcc')){ + if(property_exists($mailheader,'to') && property_exists($mailheader,'cc') && property_exists($mailheader,'bcc')){ $this->_to = $this->__getEmailIdList($mailheader->to); $this->_cc = $this->__getEmailIdList($mailheader->cc); $this->_bcc = $this->__getEmailIdList($mailheader->bcc); @@ -228,7 +230,7 @@ class Vtiger_MailRecord { $this->_date = $mailheader->udate; - $this->_subject = self::__mime_decode($mailheader->subject); + $this->_subject = property_exists($mailheader, 'subject') ? self::__mime_decode($mailheader->subject) : ''; if(!$this->_subject) $this->_subject = 'Untitled'; } // Modified: http://in2.php.net/manual/en/function.imap-fetchstructure.php#85685 @@ -240,7 +242,7 @@ class Vtiger_MailRecord { $this->_body = ''; $this->_isbodyhtml = false; - if($structure->parts) { /* multipart */ + if(property_exists($structure, 'parts') && is_array($structure->parts)) { /* multipart */ foreach($structure->parts as $partno0=>$p) { $this->__getpart($imap, $messageid, $p, $partno0+1); } diff --git a/modules/Vtiger/views/ComposeEmail.php b/modules/Vtiger/views/ComposeEmail.php index d66dec4501e104eab25612c2b3d31d0789c484f6..efe9cb4cff19dfd18c95638c76a53b66baa5c7dd 100644 --- a/modules/Vtiger/views/ComposeEmail.php +++ b/modules/Vtiger/views/ComposeEmail.php @@ -237,7 +237,7 @@ class Vtiger_ComposeEmail_View extends Vtiger_Footer_View { $viewer = $this->getViewer($request); $attachment = array(); - if(!$this->record) { + if(!property_exists($this, 'record') || !$this->record) { $this->record = Vtiger_DetailView_Model::getInstance($moduleName, $recordId); } $recordModel = $this->record->getRecord(); @@ -417,7 +417,7 @@ class Vtiger_ComposeEmail_View extends Vtiger_Footer_View { function emailEdit($request){ $viewer = $this->getViewer($request); $this->emailActionsData($request); - + $parentRecordModel = null; $recordId = $request->get('record'); $moduleName = $request->getModule(); $viewer = $this->getViewer($request); diff --git a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/FolderList.tpl b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/FolderList.tpl index c91d4edfb81b978c3280ee67eda6d8f1e197a75c..17821686a26022151f2d36b15befe31c876ac71e 100644 --- a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/FolderList.tpl +++ b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/FolderList.tpl @@ -57,7 +57,9 @@ {/foreach} <br> <span class="padding15px"><b>{vtranslate('LBL_Folders', $MODULE)}</b></span> - + {if !isset($TRASH_FOLDER)} + {assign var=TRASH_FOLDER value=''} + {/if} {assign var=IGNORE_FOLDERS value=array($INBOX_FOLDER, $SENT_FOLDER, $TRASH_FOLDER)} {foreach item=FOLDER from=$FOLDERS} {if !in_array($FOLDER->name(), $IGNORE_FOLDERS)} diff --git a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/MailOpen.tpl b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/MailOpen.tpl index 6d143908417f887b8bc49c8333665fcfc3b31ab9..7cd7311e644a75f89bf91d3b61bba4363b0cb4c0 100644 --- a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/MailOpen.tpl +++ b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/MailOpen.tpl @@ -14,7 +14,7 @@ <input type="hidden" id="mmMsgUid" value="{$MAIL->uniqueid()}"> <input type="hidden" id="mmFolder" value="{$FOLDER->name()}"> <input type="hidden" id="mmTo" value='{implode(',', $MAIL->to())}'> - <input type="hidden" id="mmCc" value='{implode(',', $MAIL->cc())}'> + <input type="hidden" id="mmCc" value="{if is_array($MAIL->cc())}{implode(',', $MAIL->cc())}{else}{$MAIL->cc()|escape:'html'}{/if}"> <input type="hidden" id="mmDate" value="{$MAIL->date()}"> <input type="hidden" id="mmUserName" value="{$USERNAME}"> {assign var=ATTACHMENT_COUNT value=(php7_count($ATTACHMENTS) - php7_count($INLINE_ATT))} @@ -49,7 +49,11 @@ {assign var=FIRST_CHAR value=strtoupper(substr($NAME[0], 0, 1))} {if $FOLDER->isSentFolder()} {assign var=NAME value=$MAIL->to()} - {assign var=FIRST_CHAR value=strtoupper(substr($NAME[0], 0, 1))} + {if $NAME|@count > 0} + {assign var=FIRST_CHAR value=strtoupper(substr($NAME[0], 0, 1))} + {else} + {assign var=FIRST_CHAR value=''} + {/if} {/if} <strong>{$FIRST_CHAR}</strong> </center> diff --git a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/Relationship.tpl b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/Relationship.tpl index ecc492fde468ae9f2354d7de286af304a63c7273..60919e283e750332fc169e1448d2aeb1ea1230a7 100644 --- a/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/Relationship.tpl +++ b/pkg/vtiger/modules/MailManager/layouts/v7/modules/MailManager/Relationship.tpl @@ -7,7 +7,7 @@ * All Rights Reserved. ************************************************************************************} {strip} - {if $LINKEDTO} + {if isset($LINKEDTO) && $LINKEDTO} <div class='col-lg-12 padding0px'> <div class="col-lg-7 padding0px recordScroll" > <span class="col-lg-12 padding0px"> @@ -99,7 +99,7 @@ </div> </div> {else} - {if $LINKEDTO eq ""} + {if isset($LINKEDTO) && $LINKEDTO eq ""} <div class="col-lg-12 padding0px"> <div class="col-lg-7 padding0px recordScroll" > </div> <div class="pull-left col-lg-5"> diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/models/Message.php b/pkg/vtiger/modules/MailManager/modules/MailManager/models/Message.php index d0103058fa02ff565e96a01ed3e0ba11ae8974c2..d71e845ce2ea155b781d7b53f96211792d8b7f76 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/models/Message.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/models/Message.php @@ -82,7 +82,7 @@ class MailManager_Message_Model extends Vtiger_MailRecord { if($partno) { $maxDownLoadLimit = MailManager_Config_Model::get('MAXDOWNLOADLIMIT'); - if($p->bytes < $maxDownLoadLimit) { + if(property_exists($p, 'bytes') && $p->bytes < $maxDownLoadLimit) { $data = imap_fetchbody($imap,$messageid,$partno, FT_PEEK); // multipart } } else { @@ -99,14 +99,14 @@ class MailManager_Message_Model extends Vtiger_MailRecord { if ($p->parameters) { foreach ($p->parameters as $x) $params[ strtolower( $x->attribute ) ] = $x->value; } - if ($p->dparameters) { + if (property_exists($p, 'dparameters') && $p->dparameters) { foreach ($p->dparameters as $x) $params[ strtolower( $x->attribute ) ] = $x->value; } // ATTACHMENT // Any part with a filename is an attachment, // so an attached text file (type 0) is not mistaken as the message. - if (($params['filename'] || $params['name']) && strtolower($p->disposition) == "attachment") { + if ((isset($params['filename']) || isset($params['name'])) && strtolower($p->disposition) == "attachment") { // filename may be given as 'Filename' or 'Name' or both $filename = ($params['filename'])? $params['filename'] : $params['name']; // filename may be encoded, so see imap_mime_header_decode() @@ -121,13 +121,13 @@ class MailManager_Message_Model extends Vtiger_MailRecord { $filename = $id; } $this->_inline_attachments[] = array('cid'=>$id, 'filename'=>@self::__mime_decode($filename), 'data' => $data); - } elseif(($params['filename'] || $params['name']) && $p->bytes > 0) { + } elseif((isset($params['filename']) || isset($params['name'])) && $p->bytes > 0) { $filename = ($params['filename'])? $params['filename'] : $params['name']; $this->_attachments[] = array('filename' => @self::__mime_decode($filename), 'data' => $data); } // TEXT elseif ($p->type==0 && $data) { - $this->_charset = $params['charset']; // assume all parts are same charset + $this->_charset = isset($params['charset']) ? $params['charset'] : ''; // assume all parts are same charset $data = self::__convert_encoding($data, 'UTF-8', $this->_charset); // Messages may be split in different parts because of inline attachments, @@ -146,7 +146,7 @@ class MailManager_Message_Model extends Vtiger_MailRecord { } // SUBPART RECURSION - if ($p->parts) { + if (property_exists($p, 'parts') && $p->parts) { foreach ($p->parts as $partno0=>$p2) $this->__getpart($imap,$messageid,$p2,$partno.'.'.($partno0+1)); // 1.2, 1.2.1, etc. } @@ -352,7 +352,7 @@ class MailManager_Message_Model extends Vtiger_MailRecord { $db->pquery("INSERT INTO vtiger_mailmanager_mailattachments (userid, muid, attachid, aname, path, lastsavedtime, cid) VALUES (?, ?, ?, ?, ?, ?, ?)", array($currentUserModel->getId(), $uid, $attachInfo['attachid'], @self::__mime_decode($attachInfo['name']), $attachInfo['path'], $savedtime, $info['cid'])); - + if ($this->_attachments === false) $this->_attachments = array(); $this->_attachments[] = array('filename' => @self::__mime_decode($info['filename']), 'data' => $info['data']); // so the file name has to renamed. } unset($aValue['data']); @@ -425,7 +425,7 @@ class MailManager_Message_Model extends Vtiger_MailRecord { * @return String */ public function subject($safehtml=true) { - $mailSubject = str_replace("_", " ", $this->_subject); + $mailSubject = str_replace("_", " ", isset($this->_subject) ? $this->_subject : ''); if ($safehtml==true) { return MailManager_Utils_Helper::safe_html_string($mailSubject); } @@ -616,12 +616,16 @@ class MailManager_Message_Model extends Vtiger_MailRecord { } else { $instance = new self(); } - $instance->setSubject($result->subject); + if (property_exists($result, 'subject')) { + $instance->setSubject($result->subject); + } $instance->setFrom($result->from); $instance->setDate($result->date); $instance->setRead($result->seen); $instance->setMsgNo($result->msgno); - $instance->setTo($result->to); + if (property_exists($result, 'to')) { + $instance->setTo($result->to); + } return $instance; } diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/HTML.Safe.php b/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/HTML.Safe.php index 8855f7a04e8027ae7c17a4aafab3d9fa8d898bfe..ee93e30e78100e68d439166cfa46d17a67e14603 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/HTML.Safe.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/HTML.Safe.php @@ -351,9 +351,9 @@ class HTML_Safe } } - $tempval = preg_replace('/&#(\d+);?/me', "chr('\\1')", $value); //"' + $tempval = preg_replace('/&#(\d+);?/', "chr('\\1')", $value); //"' $tempval = preg_replace( - '/&#x([0-9a-f]+);?/mei', + '/&#x([0-9a-f]+);?/i', "chr(hexdec('\\1'))", $tempval ); diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/XML/HTMLSax3/States.php b/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/XML/HTMLSax3/States.php index c9ef28e97053f63966e2dcb18fbbcad806346abc..fa27cad4091c7caf71910bf829a6254d03549c20 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/XML/HTMLSax3/States.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/third-party/XML/HTMLSax3/States.php @@ -122,6 +122,7 @@ class XML_HTMLSax3_ClosingTagState { * @access protected */ class XML_HTMLSax3_OpeningTagState { + var $attrs = array(); /** * Handles attributes * @param string attribute name diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/views/Mail.php b/pkg/vtiger/modules/MailManager/modules/MailManager/views/Mail.php index a59376f13394f163647ae2f85f865a481c68a9f2..92425e280ff82e7694bd88cfe719f7f69df6bab4 100755 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/views/Mail.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/views/Mail.php @@ -37,6 +37,7 @@ class MailManager_Mail_View extends MailManager_Abstract_View { $viewer->assign('ATTACHMENTS', $mail->attachments(false)); $body = $mail->body(); $inlineAttachments = $mail->inlineAttachments(); + $inline_cid = array(); if(is_array($inlineAttachments)) { foreach($inlineAttachments as $index => $att) { $cid = $att['cid']; diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/views/MassActionAjax.php b/pkg/vtiger/modules/MailManager/modules/MailManager/views/MassActionAjax.php index 380628cf66d4281bd1831d486af16344b4b41953..01d361049d246ae53b5aafe333bf0b8a2640ec8b 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/views/MassActionAjax.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/views/MassActionAjax.php @@ -16,6 +16,9 @@ class MailManager_MassActionAjax_View extends Vtiger_MassActionAjax_View { protected function getEmailFieldsInfo(Vtiger_Request $request) { $sourceModules = Array(); + $emailFieldsInfo = array(); + $recipientPrefModel = null; + $emailFields = ''; $linkToModule = $request->get('linktomodule'); if (!empty($linkToModule)) { $selectedIds = $request->get('selected_ids'); @@ -31,13 +34,13 @@ class MailManager_MassActionAjax_View extends Vtiger_MassActionAjax_View { $totalRecordCount = 0; foreach ($sourceModules as $sourceModule) { - $emailFieldsInfo = array(); $moduleModel = Vtiger_Module_Model::getInstance($sourceModule); $recipientPrefModel = Vtiger_RecipientPreference_Model::getInstance($sourceModule); + $recipientPrefs = array(); if ($recipientPrefModel) $recipientPrefs = $recipientPrefModel->getPreferences(); - $moduleEmailPrefs = $recipientPrefs[$moduleModel->getId()]; + $moduleEmailPrefs = isset($recipientPrefs[$moduleModel->getId()]) ? $recipientPrefs[$moduleModel->getId()] : ''; $emailFields = $moduleModel->getFieldsByType('email'); $accesibleEmailFields = array(); @@ -52,6 +55,7 @@ class MailManager_MassActionAjax_View extends Vtiger_MassActionAjax_View { } $emailFields = $accesibleEmailFields; + $recordIds = ''; if (php7_count($emailFields) > 0) { $recordIds = $this->getRecordsListFromRequest($request); global $current_user;