Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
6.1.0 (#13858)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Radosław Skrzypczak <[email protected]>
  • Loading branch information
3 people authored Dec 1, 2020
1 parent f431dbe commit 1ac3c53
Show file tree
Hide file tree
Showing 149 changed files with 2,224 additions and 627 deletions.
1 change: 1 addition & 0 deletions app/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Condition
'next60days' => ['label' => 'LBL_NEXT_60_DAYS'],
'next90days' => ['label' => 'LBL_NEXT_90_DAYS'],
'next120days' => ['label' => 'LBL_NEXT_120_DAYS'],
'moreThanDaysAgo' => ['label' => 'LBL_DATE_CONDITION_MORE_THAN_DAYS_AGO'],
];
/**
* Supported advanced filter operations.
Expand Down
10 changes: 10 additions & 0 deletions app/Conditions/QueryFields/DateField.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,14 @@ public function operatorSmallerthannow()
{
return ['<', $this->getColumnName(), date('Y-m-d')];
}

/**
* MoreThanDaysAgo operator.
*
* @return bool
*/
public function operatorMoreThanDaysAgo()
{
return ['<=', $this->getColumnName(), date('Y-m-d', strtotime('-' . $this->getValue() . ' days'))];
}
}
4 changes: 2 additions & 2 deletions app/Conditions/RecordFields/BaseField.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public function check()
}

/**
* Get value.
* Get value from record.
*
* @return mixed
*/
public function getValue()
{
return $this->recordModel->get($this->fieldModel->getFieldName());
return $this->recordModel->get($this->fieldModel->getName());
}

/**
Expand Down
10 changes: 10 additions & 0 deletions app/Conditions/RecordFields/DateField.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,14 @@ public function operatorNext120days()
$dateValue = date('Y-m-d', strtotime($this->getValue()));
return ($dateValue >= $today) && ($dateValue <= date('Y-m-d', strtotime($today . '+119 day')));
}

/**
* MoreThanDaysAgo operator.
*
* @return bool
*/
public function operatorMoreThanDaysAgo()
{
return $this->getValue() <= date('Y-m-d', strtotime('-' . $this->value . ' days'));
}
}
4 changes: 4 additions & 0 deletions app/Controller/Components/View/MailMessageAnalysisModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function checkPermission(\App\Request $request)
if (!\Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission('OSSMail')) {
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
}
} elseif ($request->has('header') && $request->has('body') && $request->has('sourceModule') && $request->has('sourceRecord')) {
if (!\App\Privilege::isPermitted($request->getByType('sourceModule', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
}
} else {
throw new \App\Exceptions\AppException('ERR_NO_CONTENT', 406);
}
Expand Down
25 changes: 24 additions & 1 deletion app/Integrations/Dav/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class Calendar
* @var bool
*/
private $createdTimeZone = false;
/**
* Custom values.
*
* @var string[]
*/
protected static $customValues = [
'X-MICROSOFT-SKYPETEAMSMEETINGURL' => 'meeting_url'
];

/**
* Delete calendar event by crm id.
Expand Down Expand Up @@ -248,6 +256,7 @@ private function parseComponent()
$this->parseState();
$this->parseType();
$this->parseDateTime();
$this->parseCustomValues();
}

/**
Expand Down Expand Up @@ -281,7 +290,7 @@ private function parseStatus()
$values = [
'TENTATIVE' => 'PLL_PLANNED',
'CANCELLED' => 'PLL_CANCELLED',
'CONFIRMED' => 'PLL_COMPLETED',
'CONFIRMED' => 'PLL_PLANNED',
];
} else {
$values = [
Expand Down Expand Up @@ -426,6 +435,20 @@ private function parseDateTime()
$this->record->set('time_end', $timeEnd);
}

/**
* Parse parse custom values.
*
* @return void
*/
private function parseCustomValues(): void
{
foreach (self::$customValues as $key => $fieldName) {
if (isset($this->vcomponent->{$key})) {
$this->record->set($fieldName, (string) $this->vcomponent->{$key});
}
}
}

/**
* Create calendar entry component.
*
Expand Down
6 changes: 5 additions & 1 deletion app/Integrations/Dav/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ public static function getAddressBook(int $id)
public function setValuesForRecord(\Vtiger_Record_Model $record)
{
$this->record = $record;
$head = $this->vcard->N->getParts();
if (isset($this->vcard->N)) {
$head = $this->vcard->N->getParts();
} elseif (isset($this->vcard->FN)) {
$head = $this->vcard->FN->getParts();
}
$moduleName = $record->getModuleName();
if ('Contacts' === $moduleName) {
if (isset($head[1]) && ($fieldModel = $record->getField('firstname'))) {
Expand Down
2 changes: 1 addition & 1 deletion app/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Log extends Logger
'icon' => 'fas fa-swatchbook',
'columns' => [
'date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
'method' => ['type' => 'Text', 'label' => 'LBL_METHOD'],
'method' => ['type' => 'Text', 'label' => 'LBL_BATCH_NAME'],
'message' => ['type' => 'Text', 'label' => 'LBL_ERROR_MASAGE'],
'userid' => ['type' => 'Owner', 'label' => 'LBL_OWNER'],
'params' => ['type' => 'Text', 'label' => 'LBL_PARAMS'],
Expand Down
97 changes: 78 additions & 19 deletions app/Mail/Rbl.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,37 @@ class Rbl extends \App\Base
* @var array
*/
public const LIST_TYPES = [
0 => ['label' => 'LBL_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'color' => '#eaeaea'],
1 => ['label' => 'LBL_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'color' => '#E1FFE3'],
2 => ['label' => 'LBL_PUBLIC_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'color' => '#eaeaea'],
3 => ['label' => 'LBL_PUBLIC_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'color' => '#E1FFE3'],
0 => ['label' => 'LBL_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'alertColor' => '#ff555233', 'listColor' => '#ff555233'],
1 => ['label' => 'LBL_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'alertColor' => '#E1FFE3', 'listColor' => '#fff'],
2 => ['label' => 'LBL_PUBLIC_BLACK_LIST', 'icon' => 'fas fa-ban text-danger', 'alertColor' => '#eaeaea', 'listColor' => '#ff555233'],
3 => ['label' => 'LBL_PUBLIC_WHITE_LIST', 'icon' => 'far fa-check-circle text-success', 'alertColor' => '#E1FFE3', 'listColor' => '#fff'],
];
/**
* List categories.
*
* @var array
*/
public const LIST_CATEGORIES = [
'Black' => [
'[SPAM] Single unwanted message' => 'LBL_SPAM_SINGLE_UNWANTED_MESSAGE',
'[SPAM] Mass unwanted message' => 'LBL_SPAM_MASS_UNWANTED_MESSAGE',
'[SPAM] Sending an unsolicited message repeatedly' => 'LBL_SPAM_SENDING_UNSOLICITED_MESSAGE_REPEATEDLY',
'[Fraud] Money scam' => 'LBL_FRAUD_MONEY_SCAM',
'[Fraud] Phishing' => 'LBL_FRAUD_PHISHING',
'[Fraud] An attempt to persuade people to buy a product or service' => 'LBL_FRAUD_ATTEMPT_TO_PERSUADE_PEOPLE_TO_BUY',
'[Security] An attempt to impersonate another person' => 'LBL_SECURITY_ATTEMPT_TO_IMPERSONATE_ANOTHER_PERSON',
'[Security] An attempt to persuade the recipient to open a resource from outside the organization' => 'LBL_SECURITY_ATTEMPT_TO_PERSUADE_FROM_ORGANIZATION',
'[Security] An attempt to persuade the recipient to open a resource inside the organization' => 'LBL_SECURITY_ATTEMPT_TO_PERSUADE_INSIDE_ORGANIZATION',
'[Security] Infrastructure and application scanning' => 'LBL_SECURITY_INFRASTRUCTURE_AND_APPLICATION_SCANNING',
'[Security] Attack on infrastructure or application' => 'LBL_SECURITY_ATTACK_INFRASTRUCTURE_OR_APPLICATION',
'[Security] Overloading infrastructure or application' => 'LBL_SECURITY_OVERLOADING_INFRASTRUCTURE_OR_APPLICATION',
'[Other] The message contains inappropriate words' => 'LBL_OTHER_MESSAGE_CONTAINS_INAPPROPRIATE_WORDS',
'[Other] The message contains inappropriate materials' => 'LBL_OTHER_MESSAGE_CONTAINS_INAPPROPRIATE_MATERIALS',
'[Other] Malicious message' => 'LBL_OTHER_MALICIOUS_MESSAGE'
],
'White' => [
'[Whitelist] Trusted sender' => 'LBL_TRUSTED_SENDER'
]
];
/**
* RLB black list type.
Expand Down Expand Up @@ -281,12 +308,15 @@ public function getSender(): array
$fromDomain = $this->getDomain($received->getFromName());
$byDomain = $this->getDomain($received->getByName());
if (!($fromIp = $received->getFromAddress())) {
$fromIp = $this->getIp($received->getFromName());
if (!($fromIp = $this->findIpByName($received->getValueFor('from')))) {
$fromIp = $this->getIpByName($received->getFromName(), $received->getFromHostname());
}
}
if (!($byIp = $received->getByAddress())) {
$byIp = $this->getIp($received->getByName());
if (!($byIp = $this->findIpByName($received->getValueFor('by')))) {
$byIp = $this->getIpByName($received->getByName(), $received->getByHostname());
}
}

if ($fromIp !== $byIp && ((!$fromDomain && !$byDomain) || $fromDomain !== $byDomain)) {
$row['ip'] = $fromIp;
$row['key'] = $key;
Expand Down Expand Up @@ -339,21 +369,49 @@ public function getDomain(string $url): string
}

/**
* Get mail ip address.
* Find mail ip address.
*
* @param string $url
* @param string $value
*
* @return string
*/
public function getIp(string $url): string
public function findIpByName(string $value): string
{
if (']' === substr($url, -1) || '[' === substr($url, 0, 1)) {
$url = rtrim(ltrim($url, '['), ']');
$pattern = '~\[(IPv[64])?([a-f\d\.\:]+)\]~i';
if (preg_match($pattern, $value, $matches)) {
if (!empty($matches[2])) {
return $matches[2];
}
}
if (filter_var($url, FILTER_VALIDATE_IP)) {
return $url;
return '';
}

/**
* Get mail ip address by hostname or ehloName.
*
* @param string $fromName
* @param ?string $hostName
*
* @return string
*/
public function getIpByName(string $fromName, ?string $hostName = null): string
{
if (']' === substr($fromName, -1) || '[' === substr($fromName, 0, 1)) {
$fromName = rtrim(ltrim($fromName, '['), ']');
}
if (filter_var($fromName, FILTER_VALIDATE_IP)) {
return $fromName;
}
if (0 === stripos($hostName, 'helo=')) {
$hostName = substr($hostName, 5);
if ($ip = \App\RequestUtil::getIpByName($hostName)) {
return $ip;
}
}
if ($ip = \App\RequestUtil::getIpByName($fromName)) {
return $ip;
}
return filter_var(gethostbyname($url), FILTER_VALIDATE_IP);
return '';
}

/**
Expand Down Expand Up @@ -392,9 +450,10 @@ public function verifySender(): array
if (0 === stripos($returnPath, 'SRS')) {
$separator = substr($returnPath, 4, 1);
$parts = explode($separator, $returnPath);
if (isset($parts[4])) {
$mail = explode('@', $parts[4]);
$returnPathSrs = "{$mail[0]}@{$parts[3]}";
$mail = explode('@', array_pop($parts));
if (isset($mail[1])) {
$last = array_pop($parts);
$returnPathSrs = "{$mail[0]}@{$last}";
}
$status = $from === $returnPathSrs;
} else {
Expand Down Expand Up @@ -667,7 +726,7 @@ public static function getColorByList(string $ip, array $rows): string
$color = '';
foreach ($rows as $row) {
if (1 !== (int) $row['status']) {
$color = self::LIST_TYPES[$row['type']]['color'];
$color = self::LIST_TYPES[$row['type']]['listColor'];
break;
}
}
Expand Down
22 changes: 22 additions & 0 deletions app/RequestUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,26 @@ public static function isHttps(): bool
}
return self::$httpsCache;
}

/**
* Get the IP address corresponding to a given Internet host name.
*
* @param string $name
*
* @return string
*/
public static function getIpByName(string $name): string
{
if (!self::isNetConnection()) {
return false;
}
if (\App\Cache::has(__METHOD__, $name)) {
return \App\Cache::get(__METHOD__, $name);
}
$ip = gethostbyname($name);
if ($ip === $name) {
$ip = '';
}
return \App\Cache::save(__METHOD__, $name, $ip);
}
}
2 changes: 1 addition & 1 deletion app/Session/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(string $name = 'YTSID')
return;
}
$cookie = session_get_cookie_params();
$cookie['lifetime'] = \Config\Security::$maxLifetimeSession;
$cookie['lifetime'] = \Config\Security::$maxLifetimeSessionCookie ?? 0;
$cookie['secure'] = \App\RequestUtil::isHttps();
$cookie['domain'] = $_SERVER['HTTP_HOST'] ?? '';
if (isset(\Config\Security::$cookieForceHttpOnly)) {
Expand Down
4 changes: 2 additions & 2 deletions app/Session/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public static function clean()
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
if ($item->isFile() && !\in_array($item->getBasename(), $exclusion)) {
$sessionData = static::unserialize(file_get_contents($item->getPathname()));
if (!empty($sessionData['last_activity']) && $time - $sessionData['last_activity'] < $lifeTime) {
if (!empty($sessionData['last_activity']) && ($time - $sessionData['last_activity']) < $lifeTime) {
continue;
}
unlink($item->getPathname());
if (!empty($sessionData['authenticated_user_id'])) {
if (!empty($sessionData['baseUserId']) || !empty($sessionData['authenticated_user_id'])) {
$userId = empty($sessionData['baseUserId']) ? $sessionData['authenticated_user_id'] : $sessionData['baseUserId'];
$userName = \App\User::getUserModel($userId)->getDetail('user_name');
if (!empty($userName)) {
Expand Down
3 changes: 0 additions & 3 deletions app/Utils/ConfReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,6 @@ public static function getCronVariables(string $type)
private static function getRequest()
{
$requestUrl = static::$crmUrl;
if (!IS_PUBLIC_DIR) {
$requestUrl .= 'public_html/';
}
$request = [];
try {
foreach (static::$urlsToCheck as $type => $url) {
Expand Down
19 changes: 16 additions & 3 deletions app/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,30 @@ class Version
*
* @return string
*/
public static function get($type = 'appVersion')
public static function get($type = 'appVersion'): string
{
static::init();

return static::$versions[$type];
}

/**
* Get current short version of system.
*
* @param string $type
*
* @return string
*/
public static function getShort($type = 'appVersion'): string
{
$fullVer = \explode('.', self::get($type));
array_pop($fullVer);
return \implode('.', $fullVer);
}

/**
* Function to load versions.
*/
private static function init()
private static function init(): void
{
if (false === static::$versions) {
static::$versions = require 'config/version.php';
Expand Down
Loading

0 comments on commit 1ac3c53

Please sign in to comment.