Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit 1ac3c53

Browse files
mariuszkrzaczkowskiareksolekrskrzypczak
authored
6.1.0 (#13858)
* Test * tests/setup/ * Changed translation in profile settings (#13820) * Added reload the table in MailRbl (#13819) * Update install translations * Added minor improvements * Added minor improvements * Updating icons (#13821) * Improved integration with DAV * Added minor improvements * Added minor improvements * Update sample LAMP configuration * Improved panel to manage RBL * Fixed #13830 [bug] Language: Undefined labels in English language * Added minor improvements * Icons have been added to blocks * Added to configure 'specifies the lifetime of the cookie' * Improved support for white and black list * Improved exception handling and error messages * Fixed #13823 * Added extended option of document widget * Changed icons for documents * Fixed #13832 * Improved RBL verifier * Update lib_roundcube * Improved RBL verifier * Improved RBL verifier * Update dependencies * Added ability to quickly edit attachment * Added minor improvements * Added minor improvements * Optimization RBL verifier * Added minor improvements * Optimization RBL verifier * Added new operator for date fields * Updated *.min and *.map files * Update dependencies * Fix condition builder template name * Added minor improvements * Fix condition builder template name * composer v2 * Improved widget template * Improved import ics * Improved import ics * Update composer_dev.lock * Improved meetings modal window * Added minor improvements * 6.1.0 * Corrected error messages (#13849) * Corrected error messages (#13848) * Corrected error messages * Corrected commit * Changed set the category in rbl module (#13850) * Updated *.min and *.map files Co-authored-by: Arek Solek <arkadiusz_s9887@wp.pl> Co-authored-by: Radosław Skrzypczak <r.skrzypczak@yetiforce.com>
1 parent f431dbe commit 1ac3c53

File tree

149 files changed

+2224
-627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+2224
-627
lines changed

app/Condition.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Condition
5454
'next60days' => ['label' => 'LBL_NEXT_60_DAYS'],
5555
'next90days' => ['label' => 'LBL_NEXT_90_DAYS'],
5656
'next120days' => ['label' => 'LBL_NEXT_120_DAYS'],
57+
'moreThanDaysAgo' => ['label' => 'LBL_DATE_CONDITION_MORE_THAN_DAYS_AGO'],
5758
];
5859
/**
5960
* Supported advanced filter operations.

app/Conditions/QueryFields/DateField.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,14 @@ public function operatorSmallerthannow()
169169
{
170170
return ['<', $this->getColumnName(), date('Y-m-d')];
171171
}
172+
173+
/**
174+
* MoreThanDaysAgo operator.
175+
*
176+
* @return bool
177+
*/
178+
public function operatorMoreThanDaysAgo()
179+
{
180+
return ['<=', $this->getColumnName(), date('Y-m-d', strtotime('-' . $this->getValue() . ' days'))];
181+
}
172182
}

app/Conditions/RecordFields/BaseField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public function check()
8787
}
8888

8989
/**
90-
* Get value.
90+
* Get value from record.
9191
*
9292
* @return mixed
9393
*/
9494
public function getValue()
9595
{
96-
return $this->recordModel->get($this->fieldModel->getFieldName());
96+
return $this->recordModel->get($this->fieldModel->getName());
9797
}
9898

9999
/**

app/Conditions/RecordFields/DateField.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,14 @@ public function operatorNext120days()
365365
$dateValue = date('Y-m-d', strtotime($this->getValue()));
366366
return ($dateValue >= $today) && ($dateValue <= date('Y-m-d', strtotime($today . '+119 day')));
367367
}
368+
369+
/**
370+
* MoreThanDaysAgo operator.
371+
*
372+
* @return bool
373+
*/
374+
public function operatorMoreThanDaysAgo()
375+
{
376+
return $this->getValue() <= date('Y-m-d', strtotime('-' . $this->value . ' days'));
377+
}
368378
}

app/Controller/Components/View/MailMessageAnalysisModal.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function checkPermission(\App\Request $request)
5252
if (!\Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission('OSSMail')) {
5353
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
5454
}
55+
} elseif ($request->has('header') && $request->has('body') && $request->has('sourceModule') && $request->has('sourceRecord')) {
56+
if (!\App\Privilege::isPermitted($request->getByType('sourceModule', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {
57+
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
58+
}
5559
} else {
5660
throw new \App\Exceptions\AppException('ERR_NO_CONTENT', 406);
5761
}

app/Integrations/Dav/Calendar.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ class Calendar
4646
* @var bool
4747
*/
4848
private $createdTimeZone = false;
49+
/**
50+
* Custom values.
51+
*
52+
* @var string[]
53+
*/
54+
protected static $customValues = [
55+
'X-MICROSOFT-SKYPETEAMSMEETINGURL' => 'meeting_url'
56+
];
4957

5058
/**
5159
* Delete calendar event by crm id.
@@ -248,6 +256,7 @@ private function parseComponent()
248256
$this->parseState();
249257
$this->parseType();
250258
$this->parseDateTime();
259+
$this->parseCustomValues();
251260
}
252261

253262
/**
@@ -281,7 +290,7 @@ private function parseStatus()
281290
$values = [
282291
'TENTATIVE' => 'PLL_PLANNED',
283292
'CANCELLED' => 'PLL_CANCELLED',
284-
'CONFIRMED' => 'PLL_COMPLETED',
293+
'CONFIRMED' => 'PLL_PLANNED',
285294
];
286295
} else {
287296
$values = [
@@ -426,6 +435,20 @@ private function parseDateTime()
426435
$this->record->set('time_end', $timeEnd);
427436
}
428437

438+
/**
439+
* Parse parse custom values.
440+
*
441+
* @return void
442+
*/
443+
private function parseCustomValues(): void
444+
{
445+
foreach (self::$customValues as $key => $fieldName) {
446+
if (isset($this->vcomponent->{$key})) {
447+
$this->record->set($fieldName, (string) $this->vcomponent->{$key});
448+
}
449+
}
450+
}
451+
429452
/**
430453
* Create calendar entry component.
431454
*

app/Integrations/Dav/Card.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ public static function getAddressBook(int $id)
187187
public function setValuesForRecord(\Vtiger_Record_Model $record)
188188
{
189189
$this->record = $record;
190-
$head = $this->vcard->N->getParts();
190+
if (isset($this->vcard->N)) {
191+
$head = $this->vcard->N->getParts();
192+
} elseif (isset($this->vcard->FN)) {
193+
$head = $this->vcard->FN->getParts();
194+
}
191195
$moduleName = $record->getModuleName();
192196
if ('Contacts' === $moduleName) {
193197
if (isset($head[1]) && ($fieldModel = $record->getField('firstname'))) {

app/Log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Log extends Logger
8686
'icon' => 'fas fa-swatchbook',
8787
'columns' => [
8888
'date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
89-
'method' => ['type' => 'Text', 'label' => 'LBL_METHOD'],
89+
'method' => ['type' => 'Text', 'label' => 'LBL_BATCH_NAME'],
9090
'message' => ['type' => 'Text', 'label' => 'LBL_ERROR_MASAGE'],
9191
'userid' => ['type' => 'Owner', 'label' => 'LBL_OWNER'],
9292
'params' => ['type' => 'Text', 'label' => 'LBL_PARAMS'],

app/Mail/Rbl.php

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,37 @@ class Rbl extends \App\Base
4343
* @var array
4444
*/
4545
public const LIST_TYPES = [
46-
0 => ['label' => 'LBL_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'color' => '#eaeaea'],
47-
1 => ['label' => 'LBL_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'color' => '#E1FFE3'],
48-
2 => ['label' => 'LBL_PUBLIC_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'color' => '#eaeaea'],
49-
3 => ['label' => 'LBL_PUBLIC_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'color' => '#E1FFE3'],
46+
0 => ['label' => 'LBL_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'alertColor' => '#ff555233', 'listColor' => '#ff555233'],
47+
1 => ['label' => 'LBL_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'alertColor' => '#E1FFE3', 'listColor' => '#fff'],
48+
2 => ['label' => 'LBL_PUBLIC_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'alertColor' => '#eaeaea', 'listColor' => '#ff555233'],
49+
3 => ['label' => 'LBL_PUBLIC_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'alertColor' => '#E1FFE3', 'listColor' => '#fff'],
50+
];
51+
/**
52+
* List categories.
53+
*
54+
* @var array
55+
*/
56+
public const LIST_CATEGORIES = [
57+
'Black' => [
58+
'[SPAM] Single unwanted message' => 'LBL_SPAM_SINGLE_UNWANTED_MESSAGE',
59+
'[SPAM] Mass unwanted message' => 'LBL_SPAM_MASS_UNWANTED_MESSAGE',
60+
'[SPAM] Sending an unsolicited message repeatedly' => 'LBL_SPAM_SENDING_UNSOLICITED_MESSAGE_REPEATEDLY',
61+
'[Fraud] Money scam' => 'LBL_FRAUD_MONEY_SCAM',
62+
'[Fraud] Phishing' => 'LBL_FRAUD_PHISHING',
63+
'[Fraud] An attempt to persuade people to buy a product or service' => 'LBL_FRAUD_ATTEMPT_TO_PERSUADE_PEOPLE_TO_BUY',
64+
'[Security] An attempt to impersonate another person' => 'LBL_SECURITY_ATTEMPT_TO_IMPERSONATE_ANOTHER_PERSON',
65+
'[Security] An attempt to persuade the recipient to open a resource from outside the organization' => 'LBL_SECURITY_ATTEMPT_TO_PERSUADE_FROM_ORGANIZATION',
66+
'[Security] An attempt to persuade the recipient to open a resource inside the organization' => 'LBL_SECURITY_ATTEMPT_TO_PERSUADE_INSIDE_ORGANIZATION',
67+
'[Security] Infrastructure and application scanning' => 'LBL_SECURITY_INFRASTRUCTURE_AND_APPLICATION_SCANNING',
68+
'[Security] Attack on infrastructure or application' => 'LBL_SECURITY_ATTACK_INFRASTRUCTURE_OR_APPLICATION',
69+
'[Security] Overloading infrastructure or application' => 'LBL_SECURITY_OVERLOADING_INFRASTRUCTURE_OR_APPLICATION',
70+
'[Other] The message contains inappropriate words' => 'LBL_OTHER_MESSAGE_CONTAINS_INAPPROPRIATE_WORDS',
71+
'[Other] The message contains inappropriate materials' => 'LBL_OTHER_MESSAGE_CONTAINS_INAPPROPRIATE_MATERIALS',
72+
'[Other] Malicious message' => 'LBL_OTHER_MALICIOUS_MESSAGE'
73+
],
74+
'White' => [
75+
'[Whitelist] Trusted sender' => 'LBL_TRUSTED_SENDER'
76+
]
5077
];
5178
/**
5279
* RLB black list type.
@@ -281,12 +308,15 @@ public function getSender(): array
281308
$fromDomain = $this->getDomain($received->getFromName());
282309
$byDomain = $this->getDomain($received->getByName());
283310
if (!($fromIp = $received->getFromAddress())) {
284-
$fromIp = $this->getIp($received->getFromName());
311+
if (!($fromIp = $this->findIpByName($received->getValueFor('from')))) {
312+
$fromIp = $this->getIpByName($received->getFromName(), $received->getFromHostname());
313+
}
285314
}
286315
if (!($byIp = $received->getByAddress())) {
287-
$byIp = $this->getIp($received->getByName());
316+
if (!($byIp = $this->findIpByName($received->getValueFor('by')))) {
317+
$byIp = $this->getIpByName($received->getByName(), $received->getByHostname());
318+
}
288319
}
289-
290320
if ($fromIp !== $byIp && ((!$fromDomain && !$byDomain) || $fromDomain !== $byDomain)) {
291321
$row['ip'] = $fromIp;
292322
$row['key'] = $key;
@@ -339,21 +369,49 @@ public function getDomain(string $url): string
339369
}
340370

341371
/**
342-
* Get mail ip address.
372+
* Find mail ip address.
343373
*
344-
* @param string $url
374+
* @param string $value
345375
*
346376
* @return string
347377
*/
348-
public function getIp(string $url): string
378+
public function findIpByName(string $value): string
349379
{
350-
if (']' === substr($url, -1) || '[' === substr($url, 0, 1)) {
351-
$url = rtrim(ltrim($url, '['), ']');
380+
$pattern = '~\[(IPv[64])?([a-f\d\.\:]+)\]~i';
381+
if (preg_match($pattern, $value, $matches)) {
382+
if (!empty($matches[2])) {
383+
return $matches[2];
384+
}
352385
}
353-
if (filter_var($url, FILTER_VALIDATE_IP)) {
354-
return $url;
386+
return '';
387+
}
388+
389+
/**
390+
* Get mail ip address by hostname or ehloName.
391+
*
392+
* @param string $fromName
393+
* @param ?string $hostName
394+
*
395+
* @return string
396+
*/
397+
public function getIpByName(string $fromName, ?string $hostName = null): string
398+
{
399+
if (']' === substr($fromName, -1) || '[' === substr($fromName, 0, 1)) {
400+
$fromName = rtrim(ltrim($fromName, '['), ']');
401+
}
402+
if (filter_var($fromName, FILTER_VALIDATE_IP)) {
403+
return $fromName;
404+
}
405+
if (0 === stripos($hostName, 'helo=')) {
406+
$hostName = substr($hostName, 5);
407+
if ($ip = \App\RequestUtil::getIpByName($hostName)) {
408+
return $ip;
409+
}
410+
}
411+
if ($ip = \App\RequestUtil::getIpByName($fromName)) {
412+
return $ip;
355413
}
356-
return filter_var(gethostbyname($url), FILTER_VALIDATE_IP);
414+
return '';
357415
}
358416

359417
/**
@@ -392,9 +450,10 @@ public function verifySender(): array
392450
if (0 === stripos($returnPath, 'SRS')) {
393451
$separator = substr($returnPath, 4, 1);
394452
$parts = explode($separator, $returnPath);
395-
if (isset($parts[4])) {
396-
$mail = explode('@', $parts[4]);
397-
$returnPathSrs = "{$mail[0]}@{$parts[3]}";
453+
$mail = explode('@', array_pop($parts));
454+
if (isset($mail[1])) {
455+
$last = array_pop($parts);
456+
$returnPathSrs = "{$mail[0]}@{$last}";
398457
}
399458
$status = $from === $returnPathSrs;
400459
} else {
@@ -667,7 +726,7 @@ public static function getColorByList(string $ip, array $rows): string
667726
$color = '';
668727
foreach ($rows as $row) {
669728
if (1 !== (int) $row['status']) {
670-
$color = self::LIST_TYPES[$row['type']]['color'];
729+
$color = self::LIST_TYPES[$row['type']]['listColor'];
671730
break;
672731
}
673732
}

app/RequestUtil.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,26 @@ public static function isHttps(): bool
167167
}
168168
return self::$httpsCache;
169169
}
170+
171+
/**
172+
* Get the IP address corresponding to a given Internet host name.
173+
*
174+
* @param string $name
175+
*
176+
* @return string
177+
*/
178+
public static function getIpByName(string $name): string
179+
{
180+
if (!self::isNetConnection()) {
181+
return false;
182+
}
183+
if (\App\Cache::has(__METHOD__, $name)) {
184+
return \App\Cache::get(__METHOD__, $name);
185+
}
186+
$ip = gethostbyname($name);
187+
if ($ip === $name) {
188+
$ip = '';
189+
}
190+
return \App\Cache::save(__METHOD__, $name, $ip);
191+
}
170192
}

0 commit comments

Comments
 (0)