Skip to content
Snippets Groups Projects
Verified Commit 69fbe254 authored by Florian Azizian's avatar Florian Azizian
Browse files

Merge branch '18.04' into develop

parents 136dd926 10414a50
No related branches found
No related tags found
No related merge requests found
...@@ -166,30 +166,30 @@ class ContactController ...@@ -166,30 +166,30 @@ class ContactController
{ {
$customId = CoreConfigModel::getCustomId(); $customId = CoreConfigModel::getCustomId();
if (is_dir("custom/{$customId}/referential/ban/indexes")) { $referentialDirectory = "referential/ban/indexes";
$customFilesDepartments = scandir("custom/{$customId}/referential/ban/indexes"); if (is_dir("custom/{$customId}/".$referentialDirectory)) {
$customFilesDepartments = scandir("custom/{$customId}/".$referentialDirectory);
} }
if (is_dir("referential/ban/indexes")) { if (is_dir($referentialDirectory)) {
$filesDepartments = scandir("referential/ban/indexes"); $filesDepartments = scandir($referentialDirectory);
} }
$departments = []; $departments = [];
if (!empty($customFilesDepartments)) { if (!empty($customFilesDepartments)) {
foreach ($customFilesDepartments as $value) { foreach ($customFilesDepartments as $value) {
if ($value != '.' && $value != '..') { if ($value != '.' && $value != '..' && is_writable("custom/{$customId}/".$referentialDirectory."/".$value)) {
$departments[] = $value; $departments[] = $value;
} }
} }
} }
if (!empty($filesDepartments)) { if (!empty($filesDepartments)) {
foreach ($filesDepartments as $value) { foreach ($filesDepartments as $value) {
if ($value != '.' && $value != '..' && !in_array($value, $departments)) { if ($value != '.' && $value != '..' && !in_array($value, $departments) && is_writable($referentialDirectory."/".$value)) {
$departments[] = $value; $departments[] = $value;
} }
} }
} }
if (!empty($departments)) { if (!empty($departments)) {
sort($departments, SORT_NUMERIC); sort($departments, SORT_NUMERIC);
return $departments; return $departments;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment