Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/hotfix-7.8.x' into 7.8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Dillon-Brown committed Feb 20, 2019
2 parents a0b2602 + 575a51c commit f32df0b
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 115 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ before_script:
- composer install --no-interaction
- \[ -f "config_si.php" \] || cp tests/travis_config_si.php config_si.php
- php tests/testinstall.php
# Lint PHP
- for file in $(git diff --name-status HEAD~1 HEAD | egrep "^[ACMR].*\.php$" | cut -c 3-); do php -l $file; done

script:
- cd tests
- ../vendor/bin/phpunit
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## SuiteCRM 7.8.26 LTS
## SuiteCRM 7.8.27 LTS

[![Build Status](https://travis-ci.org/salesagility/SuiteCRM.svg?branch=hotfix-7.8.x)](https://travis-ci.org/salesagility/SuiteCRM)

Expand Down
4 changes: 2 additions & 2 deletions modules/AOBH_BusinessHours/AOBH_BusinessHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AOBH_BusinessHours extends Basic
public $opening_hours;
public $closing_hours;
public $day;
public $open;
public $open_status;

private $cached = array();
private $businessHoursSet = null;
Expand Down Expand Up @@ -130,7 +130,7 @@ public function getOrCreate($day)
*/
private function insideThisBusinessHour(DateTime $datetime)
{
if (!$this->open) {
if (!$this->open_status) {
return false;
}
$hour = $datetime->format('G');
Expand Down
4 changes: 2 additions & 2 deletions modules/AOBH_BusinessHours/vardefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
'studio' => 'visible',
'dependency' => false,
),
'open' => array(
'open_status' => array(
'required' => false,
'name' => 'open',
'name' => 'open_status',
'vname' => 'LBL_OPEN',
'type' => 'bool',
),
Expand Down
2 changes: 1 addition & 1 deletion modules/AOS_PDF_Templates/templateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function parse_template_bean($string, $key, &$focus)
$sep = get_number_seperators();
$value = rtrim(rtrim(format_number($value), '0'), $sep[1]) . $app_strings['LBL_PERCENTAGE_SYMBOL'];
}
if ($focus->field_defs[$name][dbType] == 'datetime' &&
if ($focus->field_defs[$name]['dbType'] == 'datetime' &&
(strpos($name, 'date') > 0 || strpos($name, 'expiration') > 0) ) {
if ($value != '') {
$dt = explode(' ', $value);
Expand Down
6 changes: 3 additions & 3 deletions modules/Administration/BusinessHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
foreach($days as $day){
$bh = $businessHours->getOrCreate($day);
$bh->day = $day;
$bh->open = array_key_exists("open_".$day,$_REQUEST) ? $_REQUEST["open_".$day] : false;
$bh->open_status = array_key_exists("open_status_".$day,$_REQUEST) ? $_REQUEST["open_status_".$day] : false;
$bh->opening_hours = $_REQUEST["opening_time_".$day];
$bh->closing_hours = $_REQUEST["closing_time_".$day];
$bh->save();
Expand All @@ -43,9 +43,9 @@
$bh = $businessHours->getBusinessHoursForDay($day);
if($bh){
$bh = $bh[0];
$drops['open'] = $bh->open;
$drops['open_status'] = $bh->open_status;
}else{
$drops['open'] = $day != $mod_strings['LBL_SATURDAY'] && $day != $mod_strings['LBL_SUNDAY'];
$drops['open_status'] = $day != $mod_strings['LBL_SATURDAY'] && $day != $mod_strings['LBL_SUNDAY'];
}
$hours = get_select_options_with_id($app_list_strings['business_hours_list'], ($bh ? $bh->opening_hours : 9));
$drops['opening'] = $hours;
Expand Down
2 changes: 1 addition & 1 deletion modules/Administration/BusinessHours.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<tr>

<td width="10%">{$day}</td>
<td width="5%"><label for="open_{$day}">{$MOD.LBL_BUSINESS_HOURS_OPEN}</label><input data-day="{$day}" type="checkbox" id="open_{$day}" name="open_{$day}" class="open_check" {if $hours.open}checked="checked"{/if}></td>
<td width="5%"><label for="open_status_{$day}">{$MOD.LBL_BUSINESS_HOURS_OPEN}</label><input data-day="{$day}" type="checkbox" id="open_status_{$day}" name="open_status_{$day}" class="open_check" {if $hours.open_status}checked="checked"{/if}></td>
<td>
<div id="{$day}_times">{$MOD.LBL_BUSINESS_HOURS_FROM} <select name="opening_time_{$day}" tabindex="0" id="opening_time_{$day}">{$hours.opening}</select> {$MOD.LBL_BUSINESS_HOURS_TO} <select name="closing_time_{$day}" tabindex="0" id="closing_time_{$day}">{$hours.closing}</select></div>
</td>
Expand Down
117 changes: 50 additions & 67 deletions modules/InboundEmail/InboundEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -3777,78 +3777,61 @@ function retrieveAttachmentNameFromStructure($part)
return $result;

}
/**
* saves the actual binary file of a given attachment
* @param object attach Note object that is attached to the binary file
* @param string msgNo Message Number on IMAP/POP3 server
* @param string thisBc Breadcrumb to navigate email structure to find the content
* @param object part IMAP standard object that contains the "parts" of this section of email
* @param bool $forDisplay
*/
function saveAttachmentBinaries($attach, $msgNo, $thisBc, $part, $forDisplay) {
// decide where to place the file temporarily

if(isset($attach->id) && strpos($attach->id, "..") !== false && isset($this->id) && strpos($this->id, "..") !== false){
die("Directory navigation attack denied.");
}

$uploadDir = ($forDisplay) ? "{$this->EmailCachePath}/{$this->id}/attachments/" : "upload://";
/**
* @param $attach object Note object that is attached to the binary file
* @param $msgNo string Message Number on IMAP/POP3 server
* @param $thisBc string Breadcrumb to navigate email structure to find the content
* @param $part object IMAP standard object that contains the "parts" of this section of email
* @param $forDisplay
* @return bool|void
*/
public function saveAttachmentBinaries($attach, $msgNo, $thisBc, $part, $forDisplay)
{
if (isset($attach->id) &&
strpos($attach->id, '..') !== false &&
isset($this->id) &&
strpos($this->id, '..') !== false
) {
die('Directory navigation attack denied.');
}
$uploadDir = $forDisplay ? "{$this->EmailCachePath}/{$this->id}/attachments/" : "upload://";
$fileName = htmlspecialchars($attach->id);
if (!file_exists($uploadDir . $fileName)) {
if (!is_resource($this->conn)) {
LoggerManager::getLogger()->fatal('Inbound Email Connection is not valid resource for saving attachment binaries.');

// decide what name to save file as
$fileName = htmlspecialchars($attach->id);
return false;
}

// download the attachment if we didn't do it yet
if(!file_exists($uploadDir.$fileName)) {

if (null === $this->conn) {
LoggerManager::getLogger()->warn('InboundEmail::saveAttachmentBinaries: connection is null');
$msgPartRaw = null;
} else {
$msgPartRaw = imap_fetchbody($this->conn, $msgNo, $thisBc);
}

// deal with attachment encoding and decode the text string

$partEncoding = null;
if (isset($part->encoding)) {
$partEncoding = $part->encoding;
} else {
LoggerManager::getLogger()->warn('InboundEmail::saveAttachmentBinaries: part encoding is not set');
}

$msgPart = $this->handleTranserEncoding($msgPartRaw, $partEncoding);
if (null === $this->conn) {
LoggerManager::getLogger()->warn('InboundEmail::saveAttachmentBinaries: connection is null');
$msgPartRaw = null;
} else {
$msgPartRaw = imap_fetchbody($this->conn, $msgNo, $thisBc);
}
// deal with attachment encoding and decode the text string
$msgPart = $this->handleTranserEncoding($msgPartRaw, $part->encoding);
if (file_put_contents($uploadDir . $fileName, $msgPart)) {
$GLOBALS['log']->debug('InboundEmail saved attachment file: ' . $attach->filename);
} else {
$GLOBALS['log']->debug('InboundEmail could not create attachment file: ' . $attach->filename . " - temp file target: [ {$uploadDir}{$fileName} ]");

$file = $uploadDir.$fileName;
if (!file_exists($file)) {
LoggerManager::getLogger()->warn('InboundEmail::saveAttachmentBinaries: file not found: ' . $file);
} elseif(file_put_contents($file, $msgPart)) {
$GLOBALS['log']->debug('InboundEmail saved attachment file: '.$attach->filename);
} else {
$GLOBALS['log']->debug('InboundEmail could not create attachment file: '.$attach->filename ." - temp file target: [ {$uploadDir}{$fileName} ]");
return;
}
}

$this->tempAttachment[$fileName] = urldecode($attach->filename);
// if all was successful, feel for inline and cache Note ID for display:

$partType = null;
if (!isset($part->type)) {
LoggerManager::getLogger()->warn('InboundEmail::saveAttachmentBinaries: part type is not set');
} else {
$partType = $part->type;
}

if((strtolower($part->disposition) == 'inline' && in_array($part->subtype, $this->imageTypes))
|| ($partType == 5)) {
if(copy($uploadDir.$fileName, sugar_cached("images/{$fileName}.").strtolower($part->subtype))) {
$id = substr($part->id, 1, -1); //strip <> around
$this->inlineImages[$id] = $attach->id.".".strtolower($part->subtype);
} else {
$GLOBALS['log']->debug('InboundEmail could not copy '.$uploadDir.$fileName.' to cache');
}
}
}
}
}
$this->tempAttachment[$fileName] = urldecode($attach->filename);
if ((strtolower($part->disposition) === 'inline' && in_array($part->subtype, $this->imageTypes, false))
|| ($part->type == 5)
) {
if (copy($uploadDir . $fileName, sugar_cached("images/{$fileName}.") . strtolower($part->subtype))) {
$id = substr($part->id, 1, -1); //strip <> around
$this->inlineImages[$id] = $attach->id . "." . strtolower($part->subtype);
} else {
$GLOBALS['log']->debug('InboundEmail could not copy ' . $uploadDir . $fileName . ' to cache');
}
}
}

/**
* decodes a string based on its associated encoding
Expand Down
8 changes: 8 additions & 0 deletions modules/ModuleBuilder/parsers/parser.label.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ public static function addLabels($language, $labels, $moduleName, $basepath = nu
}
}

foreach ($labels as $key => $value) {
$mod_strings[$key] = $value;
}

foreach ($mod_strings as $key => $val) {
$out .= override_value_to_string_recursive2('mod_strings', $key, $val);
}
Expand Down Expand Up @@ -312,6 +316,10 @@ public static function addLabels($language, $labels, $moduleName, $basepath = nu
}
}

foreach ($labels as $key => $value) {
$mod_strings[$key] = $value;
}

foreach ($mod_strings as $key => $val) {
$out .= override_value_to_string_recursive2('mod_strings', $key, $val);
}
Expand Down
4 changes: 2 additions & 2 deletions suitecrm_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
die('Not A Valid Entry Point');
}

$suitecrm_version = '7.8.26';
$suitecrm_timestamp = '2019-01-31 17:00:00';
$suitecrm_version = '7.8.27';
$suitecrm_timestamp = '2019-02-20 17:00:00';
Loading

0 comments on commit f32df0b

Please sign in to comment.