diff --git a/include/management/class_ListingEntry.inc b/include/management/class_ListingEntry.inc index 0f7cdbb3f6681a8bcf58f2e526da755d2ae54098..9dee22006ed23507861740deb52544d4ee19a67d 100755 --- a/include/management/class_ListingEntry.inc +++ b/include/management/class_ListingEntry.inc @@ -40,36 +40,39 @@ 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, private array $attrs, int $row = NULL) + public function __construct (managementListing $listing, string $type, string $dn, array $attrs, int $row = NULL) { $this->listing = $listing; $this->type = $type; $this->dn = $dn; $this->aclBase = $dn; + $this->attrs = $attrs; $this->row = $row; } - public function offsetSet ($offset, $value) : void + public function offsetSet ($offset, $value) { $this->attrs[$offset] = $value; } - public function offsetExists ($offset) : bool + public function offsetExists ($offset) { return isset($this->attrs[$offset]); } - public function offsetUnset ($offset) : void + public function offsetUnset ($offset) { unset($this->attrs[$offset]); } - public function offsetGet ($offset) : mixed + public function offsetGet ($offset) { return (isset($this->attrs[$offset]) ? $this->attrs[$offset] : NULL); } @@ -81,12 +84,12 @@ class ListingEntry implements ArrayAccess public function isTemplate (): bool { - return preg_match('/^template_/', (string) $this->type); + return preg_match('/^template_/', $this->type); } public function getTemplatedType (): string { - return preg_replace('/^template_/', '', (string) $this->type); + return preg_replace('/^template_/', '', $this->type); } public function getTemplatedFields (): array @@ -101,7 +104,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 (!str_contains((string) $rights, $acl)) { + if (strpos($rights, $acl) === FALSE) { return FALSE; } } @@ -125,3 +128,4 @@ class ListingEntry implements ArrayAccess return $ui->allow_snapshot_restore($this->aclBase, $infos['aclCategory'], FALSE); } } +