mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
ref
This commit is contained in:
@@ -70,7 +70,7 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
|
||||
$userIdList = $entity->getLinkMultipleIdList('users');
|
||||
|
||||
if (is_array($userIdList) && in_array($user->getId(), $userIdList)) {
|
||||
if (in_array($user->getId(), $userIdList)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ class CurrencyType extends FloatType
|
||||
|
||||
$pad = str_pad('', $precision, '9');
|
||||
|
||||
assert(is_numeric($pad));
|
||||
|
||||
$limit = Currency::create($pad, 'USD');
|
||||
|
||||
if ($currency->compare($limit) === 1) {
|
||||
|
||||
@@ -32,30 +32,26 @@ namespace Espo\Classes\TemplateHelpers;
|
||||
use Espo\Core\Htmlizer\Helper;
|
||||
use Espo\Core\Htmlizer\Helper\Data;
|
||||
use Espo\Core\Htmlizer\Helper\Result;
|
||||
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Log;
|
||||
use const CURLOPT_FOLLOWLOCATION;
|
||||
use const CURLOPT_HEADER;
|
||||
use const CURLOPT_HTTPHEADER;
|
||||
use const CURLOPT_RETURNTRANSFER;
|
||||
use const CURLOPT_TIMEOUT;
|
||||
use const CURLOPT_URL;
|
||||
use const CURLOPT_USERAGENT;
|
||||
|
||||
class GoogleMaps implements Helper
|
||||
{
|
||||
private const DEFAULT_SIZE = '400x400';
|
||||
|
||||
private $metadata;
|
||||
|
||||
private $config;
|
||||
|
||||
private $log;
|
||||
|
||||
public function __construct(
|
||||
Metadata $metadata,
|
||||
Config $config,
|
||||
Log $log
|
||||
) {
|
||||
$this->metadata = $metadata;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
}
|
||||
private Metadata $metadata,
|
||||
private Config $config,
|
||||
private Log $log,
|
||||
) {}
|
||||
|
||||
public function render(Data $data): Result
|
||||
{
|
||||
@@ -194,6 +190,7 @@ class GoogleMaps implements Helper
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $url
|
||||
* @return string|bool
|
||||
*/
|
||||
private function getImage(string $url)
|
||||
@@ -207,13 +204,13 @@ class GoogleMaps implements Helper
|
||||
|
||||
$c = curl_init();
|
||||
|
||||
curl_setopt($c, \CURLOPT_URL, $url);
|
||||
curl_setopt($c, \CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($c, \CURLOPT_HEADER, 0);
|
||||
curl_setopt($c, \CURLOPT_USERAGENT, $agent);
|
||||
curl_setopt($c, \CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($c, \CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($c, \CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($c, CURLOPT_HEADER, false);
|
||||
curl_setopt($c, CURLOPT_USERAGENT, $agent);
|
||||
curl_setopt($c, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
||||
|
||||
$raw = curl_exec($c);
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ use Espo\Entities\User;
|
||||
use Espo\Core\Acl\FieldData;
|
||||
use Espo\Core\Acl\ScopeData;
|
||||
use Espo\Core\Acl\Table;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DataCache;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use stdClass;
|
||||
@@ -219,7 +218,7 @@ class DefaultTable implements Table
|
||||
$this->applyAdminMandatory($aclTable, $fieldTable);
|
||||
}
|
||||
|
||||
foreach ($aclTable as $scope => $data) {
|
||||
foreach (get_object_vars($aclTable) as $scope => $data) {
|
||||
if (is_string($data) && isset($aclTable->$data)) {
|
||||
$aclTable->$scope = $aclTable->$data;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,7 @@ class AclManager
|
||||
|
||||
$checker = $this->getAccessChecker($scope);
|
||||
|
||||
/** @var non-falsy-string $methodName */
|
||||
$methodName = 'checkEntity' . ucfirst($action);
|
||||
|
||||
$interface = $this->entityActionInterfaceMap[$action] ?? null;
|
||||
@@ -322,7 +323,7 @@ class AclManager
|
||||
/**
|
||||
* Check 'read' access to a specific entity.
|
||||
*
|
||||
* @throws NotImplemented.
|
||||
* @throws NotImplemented
|
||||
*/
|
||||
public function checkEntityRead(User $user, Entity $entity): bool
|
||||
{
|
||||
|
||||
@@ -73,6 +73,7 @@ class EspoBindingLoader implements BindingLoader
|
||||
|
||||
private function loadCustom(Binder $binder): void
|
||||
{
|
||||
/** @var class-string<BindingProcessor>|string $className */
|
||||
$className = 'Espo\\Custom\\Binding';
|
||||
|
||||
if (!class_exists($className)) {
|
||||
|
||||
@@ -248,11 +248,10 @@ class Extension implements Command
|
||||
private function printList(IO $io): void
|
||||
{
|
||||
$collection = $this->entityManager
|
||||
->getRDBRepository(ExtensionEntity::ENTITY_TYPE)
|
||||
->getRDBRepositoryByClass(ExtensionEntity::class)
|
||||
->find();
|
||||
|
||||
/** @noinspection PhpParamsInspection */
|
||||
$count = is_countable($collection) ? count($collection) : iterator_count($collection);
|
||||
$count = count($collection);
|
||||
|
||||
/** @noinspection PhpIfWithCommonPartsInspection */
|
||||
if ($count === 0) {
|
||||
@@ -268,9 +267,9 @@ class Extension implements Command
|
||||
$io->writeLine("");
|
||||
|
||||
foreach ($collection as $extension) {
|
||||
$isInstalled = $extension->get('isInstalled');
|
||||
$isInstalled = $extension->isInstalled();
|
||||
|
||||
$io->writeLine(' Name: ' . $extension->get(Field::NAME));
|
||||
$io->writeLine(' Name: ' . $extension->getName());
|
||||
$io->writeLine(' ID: ' . $extension->getId());
|
||||
$io->writeLine(' Version: ' . $extension->getVersion());
|
||||
$io->writeLine(' Installed: ' . ($isInstalled ? 'yes' : 'no'));
|
||||
|
||||
@@ -495,13 +495,19 @@ class Upgrade implements Command
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
return realpath($localFilePath);
|
||||
$path = realpath($localFilePath);
|
||||
|
||||
assert($path !== false);
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
private function isShellEnabled(): bool
|
||||
{
|
||||
if (!function_exists('exec') || !is_callable('shell_exec')) {
|
||||
if (
|
||||
!function_exists('exec') ||
|
||||
!is_callable('shell_exec') /** @phpstan-ignore-line */
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,12 +168,14 @@ class ContainerBuilder
|
||||
)
|
||||
);
|
||||
|
||||
/** @var FileManager $fileManager */
|
||||
$fileManager = $this->services['fileManager'] ?? (
|
||||
new $this->fileManagerClassName(
|
||||
$config->get('defaultPermissions')
|
||||
)
|
||||
);
|
||||
|
||||
/** @var DataCache $dataCache */
|
||||
$dataCache = $this->services['dataCache'] ?? (
|
||||
new $this->dataCacheClassName($fileManager)
|
||||
);
|
||||
|
||||
@@ -39,8 +39,8 @@ class ContainerConfiguration implements Configuration
|
||||
{
|
||||
/**
|
||||
* Log must be loaded before anything.
|
||||
* @phpstan-ignore-next-line
|
||||
* @noinspection PhpPropertyOnlyWrittenInspection
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private Log $log;
|
||||
|
||||
|
||||
@@ -63,12 +63,12 @@ abstract class Base
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @var User;
|
||||
* @var User
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var Acl;
|
||||
* @var Acl
|
||||
*/
|
||||
protected $acl;
|
||||
|
||||
@@ -161,12 +161,11 @@ abstract class Base
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void;
|
||||
* @return void
|
||||
* @deprecated
|
||||
*/
|
||||
protected function checkControllerAccess()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user