diff --git a/lib/Froxlor/UI/Callbacks/Domain.php b/lib/Froxlor/UI/Callbacks/Domain.php index c4d989aa..334c8e16 100644 --- a/lib/Froxlor/UI/Callbacks/Domain.php +++ b/lib/Froxlor/UI/Callbacks/Domain.php @@ -25,6 +25,7 @@ namespace Froxlor\UI\Callbacks; +use Froxlor\CurrentUser; use Froxlor\Database\Database; use Froxlor\Domain\Domain as DDomain; use Froxlor\FileDir; @@ -113,7 +114,7 @@ class Domain public static function canViewLogs(array $attributes): bool { - if ((int)$attributes['fields']['email_only'] == 0 && !$attributes['fields']['deactivated']) { + if ((!CurrentUser::isAdmin() || (CurrentUser::isAdmin() && (int)$attributes['fields']['email_only'] == 0)) && !$attributes['fields']['deactivated']) { if ((int)UI::getCurrentUser()['adminsession'] == 0 && (bool)UI::getCurrentUser()['logviewenabled']) { return true; } elseif ((int)UI::getCurrentUser()['adminsession'] == 1) { @@ -155,7 +156,7 @@ class Domain public static function hasLetsEncryptActivated(array $attributes): bool { - return ((bool)$attributes['fields']['letsencrypt'] && (int)$attributes['fields']['email_only'] == 0); + return ((bool)$attributes['fields']['letsencrypt'] && (!CurrentUser::isAdmin() || (CurrentUser::isAdmin() && (int)$attributes['fields']['email_only'] == 0))); } public static function canEditSSL(array $attributes): bool @@ -165,7 +166,7 @@ class Domain && DDomain::domainHasSslIpPort($attributes['fields']['id']) && (int)$attributes['fields']['caneditdomain'] == 1 && (int)$attributes['fields']['letsencrypt'] == 0 - && (int)$attributes['fields']['email_only'] == 0 + && (!CurrentUser::isAdmin() || (CurrentUser::isAdmin() && (int)$attributes['fields']['email_only'] == 0)) && !$attributes['fields']['deactivated'] ) { return true; diff --git a/lib/Froxlor/UI/Callbacks/Style.php b/lib/Froxlor/UI/Callbacks/Style.php index 511a118b..e6d6c5f5 100644 --- a/lib/Froxlor/UI/Callbacks/Style.php +++ b/lib/Froxlor/UI/Callbacks/Style.php @@ -25,6 +25,7 @@ namespace Froxlor\UI\Callbacks; +use Froxlor\CurrentUser; use Froxlor\Settings; class Style @@ -68,7 +69,7 @@ class Style $termination_css = 'table-danger'; } } - $deactivated = $attributes['fields']['deactivated'] || $attributes['fields']['customer_deactivated']; + $deactivated = $attributes['fields']['deactivated'] || (CurrentUser::isAdmin() && $attributes['fields']['customer_deactivated']); return $deactivated ? 'table-info' : $termination_css; } diff --git a/lib/Froxlor/UI/Callbacks/Text.php b/lib/Froxlor/UI/Callbacks/Text.php index 9e63e3c3..91df6fdf 100644 --- a/lib/Froxlor/UI/Callbacks/Text.php +++ b/lib/Froxlor/UI/Callbacks/Text.php @@ -90,9 +90,10 @@ class Text public static function customerNoteDetailModal(array $attributes): array { $note = $attributes['fields']['custom_notes'] ?? ''; + $key = $attributes['fields']['customerid'] ?? $attributes['fields']['adminid']; return [ - 'entry' => $attributes['fields']['id'], - 'id' => 'cnModal' . $attributes['fields']['id'], + 'entry' => $key, + 'id' => 'cnModal' . $key, 'title' => lng('usersettings.custom_notes.title') . ': ' . ($attributes['fields']['loginname'] ?? $attributes['fields']['adminname']), 'body' => nl2br(Markdown::cleanCustomNotes($note)) ]; diff --git a/lib/Froxlor/UI/Form.php b/lib/Froxlor/UI/Form.php index d17c911e..a824bd8a 100644 --- a/lib/Froxlor/UI/Form.php +++ b/lib/Froxlor/UI/Form.php @@ -217,7 +217,8 @@ class Form { $returnvalue = []; if (is_array($fielddata) && isset($fielddata['type']) && $fielddata['type'] == 'select') { - if ((!is_array($fielddata['select_var']) || empty($fielddata['select_var'])) && (isset($fielddata['option_options_method']))) { + if ((empty($fielddata['select_var']) || !is_array($fielddata['select_var'])) && (isset($fielddata['option_options_method'])) + ) { $returnvalue['select_var'] = call_user_func($fielddata['option_options_method']); } }