Verified Commit 1bc65825 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: (Mangement) - adds some files to php 8.2

Adds file to php8.2
No related merge requests found
Showing with 18 additions and 21 deletions
+18 -21
......@@ -40,20 +40,17 @@ class ListingEntry implements ArrayAccess
* \brief Object type
*/
public $type;
private $attrs;
protected $listing;
/* Cache where columns may store stuff */
public $cache = [];
public function __construct (managementListing $listing, string $type, string $dn, array $attrs, int $row = NULL)
public function __construct (managementListing $listing, string $type, string $dn, private array $attrs, int $row = NULL)
{
$this->listing = $listing;
$this->type = $type;
$this->dn = $dn;
$this->aclBase = $dn;
$this->attrs = $attrs;
$this->row = $row;
}
......@@ -84,12 +81,12 @@ class ListingEntry implements ArrayAccess
public function isTemplate (): bool
{
return preg_match('/^template_/', $this->type);
return preg_match('/^template_/', (string) $this->type);
}
public function getTemplatedType (): string
{
return preg_replace('/^template_/', '', $this->type);
return preg_replace('/^template_/', '', (string) $this->type);
}
public function getTemplatedFields (): array
......@@ -104,7 +101,7 @@ class ListingEntry implements ArrayAccess
$infos = objects::infos($this->getTemplatedType());
$rights = $ui->get_permissions($this->aclBase, $infos['aclCategory'].'/'.($this->isTemplate() ? 'template' : $infos['mainTab']));
foreach (str_split($acls) as $acl) {
if (strpos($rights, $acl) === FALSE) {
if (!str_contains((string) $rights, $acl)) {
return FALSE;
}
}
......
......@@ -128,10 +128,10 @@ class ManagementConfigurationDialog extends ManagementDialog
$this->attributesAccess['resetInLdap']->setVisible(FALSE);
}
if (!$config->hasManagementConfig(get_class($this->parent), TRUE)) {
if (!$config->hasManagementConfig($this->parent::class, TRUE)) {
$this->attributesAccess['resetInLdapUser']->setVisible(FALSE);
}
if (!$config->hasManagementConfig(get_class($this->parent), FALSE)) {
if (!$config->hasManagementConfig($this->parent::class, FALSE)) {
$this->attributesAccess['resetInLdap']->setVisible(FALSE);
}
......@@ -169,7 +169,7 @@ class ManagementConfigurationDialog extends ManagementDialog
return TRUE;
} elseif ((is_object($attr) && in_array($attr->getLdapName(), $configAttrs)) || in_array($attr, $configAttrs)) {
$acl = $ui->get_permissions(CONFIGRDN.$config->current['BASE'], 'configuration/configInLdap', 'fdManagementConfig', $this->readOnly());
return (strpos($acl, 'w') !== FALSE);
return (str_contains((string) $acl, 'w'));
} else {
return parent::attrIsWriteable($attr);
}
......@@ -178,7 +178,7 @@ class ManagementConfigurationDialog extends ManagementDialog
function handle_resetInLdapUser ()
{
global $config;
$errors = $config->updateManagementConfig(get_class($this->parent), NULL, TRUE);
$errors = $config->updateManagementConfig($this->parent::class, NULL, TRUE);
msg_dialog::displayChecks($errors);
if (empty($errors)) {
$this->attributesAccess['resetInLdapUser']->setVisible(FALSE);
......@@ -188,7 +188,7 @@ class ManagementConfigurationDialog extends ManagementDialog
function handle_resetInLdap ()
{
global $config;
$errors = $config->updateManagementConfig(get_class($this->parent), NULL, FALSE);
$errors = $config->updateManagementConfig($this->parent::class, NULL, FALSE);
msg_dialog::displayChecks($errors);
if (empty($errors)) {
$this->attributesAccess['resetInLdap']->setVisible(FALSE);
......@@ -213,7 +213,7 @@ class ManagementConfigurationDialog extends ManagementDialog
foreach ($values as $value) {
$column = [$value[0], []];
if (!empty($value[1])) {
$jsonDecoded = json_decode($value[1], TRUE);
$jsonDecoded = json_decode((string) $value[1], TRUE);
if ($jsonDecoded !== NULL) {
$column[1]['attributes'] = $jsonDecoded;
} else {
......@@ -228,11 +228,11 @@ class ManagementConfigurationDialog extends ManagementDialog
$this->parent->setColumnConfiguration($columnInfos);
if ($this->saveInLdapUser) {
return $config->updateManagementConfig(get_class($this->parent), $columnInfos, TRUE);
return $config->updateManagementConfig($this->parent::class, $columnInfos, TRUE);
}
if ($this->saveInLdap) {
return $config->updateManagementConfig(get_class($this->parent), $columnInfos);
return $config->updateManagementConfig($this->parent::class, $columnInfos);
}
return [];
......
......@@ -120,7 +120,7 @@ class managementFilter
$this->parent->listing->fillSearchedAttributes($type, $attrs);
foreach ($attrs as $attr => $acl) {
$rights = $ui->get_permissions($base, $acl, $attr);
if (strpos($rights, 'r') !== FALSE) {
if (str_contains((string) $rights, 'r')) {
$this->searchAttributes[$type][] = $attr;
}
}
......@@ -143,12 +143,12 @@ class managementFilter
$searchAttrs = [];
foreach ($this->searchAttributes as $type => $attrs) {
foreach ($attrs as $attr) {
$searchAttrs[] = strtolower($type).'/'.$attr;
$searchAttrs[] = strtolower((string) $type).'/'.$attr;
}
}
$smarty->assign('SEARCHDESC', sprintf(_('Searches in %s'), implode(', ', $searchAttrs)));
$parentClass = get_class($this->parent);
$parentClass = $this->parent::class;
if (!$parentClass::$skipTemplates) {
$smarty->assign('TEMPLATES', $this->showTemplates);
}
......@@ -201,7 +201,7 @@ class managementFilter
$elementFilters = [];
if (!empty($this->search)) {
if (preg_match('/^\(.+\)$/', $this->search)) {
if (preg_match('/^\(.+\)$/', (string) $this->search)) {
$elementFilters[] = $this->search;
} else {
$searchAttributesTmp = $this->searchAttributes[$type];
......@@ -224,7 +224,7 @@ class managementFilter
$filter = '(&'.implode('', $typeElementFilters).')';
}
$parentClass = get_class($this->parent);
$parentClass = $this->parent::class;
if (!$parentClass::$skipTemplates && $this->showTemplates) {
try {
$ldapEntries = objects::ls($type, $attrsAsked, (($this->scope == 'one') ? 'ou=templates,'.$searchBase : $searchBase), $filter, TRUE, $this->scope, TRUE);
......@@ -290,7 +290,7 @@ class managementFilter
continue;
}
foreach ($this->parent->whiteList['branches'] as $branch) {
if (preg_match('/'.preg_quote($branch, '/').'$/', $dn)) {
if (preg_match('/'.preg_quote((string) $branch, '/').'$/', $dn)) {
continue 2;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment