From 0c647e0acbb5fa8d23cc5f1612da3649d0fdaab6 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 25 Apr 2022 08:36:11 +0200 Subject: [PATCH] fix wrong visible-callback for ssl-editor in domain-listing; fix adding new certificate via form; don't show logs-icon when domain is email_only Signed-off-by: Michael Kaufmann --- install/lib/class.FroxlorInstall.php | 7 +++++-- lib/Froxlor/UI/Callbacks/Domain.php | 10 ++++++---- lib/formfields/formfield.domain_ssleditor.php | 5 +++++ lib/tablelisting/admin/tablelisting.domains.php | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index 7b0b5b31..11d3e2a1 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -17,6 +17,9 @@ * */ +use Froxlor\Froxlor; +use Froxlor\FileDir; +use Froxlor\Config\ConfigParser; use Froxlor\UI\Panel\UI; /** @@ -595,10 +598,10 @@ class FroxlorInstall $this->_updateSetting($upd_stmt, 'error', 'system', 'errorlog_level'); } - $distros = glob(\Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/') . '*.xml'); + $distros = glob(FileDir::makeCorrectDir(Froxlor::getInstallDir() . '/lib/configfiles/') . '*.xml'); foreach ($distros as $_distribution) { if ($this->_data['distribution'] == str_replace(".xml", "", strtolower(basename($_distribution)))) { - $dist = new \Froxlor\Config\ConfigParser($_distribution); + $dist = new ConfigParser($_distribution); $defaults = $dist->getDefaults(); if (!empty($defaults)) { foreach ($defaults as $property) { diff --git a/lib/Froxlor/UI/Callbacks/Domain.php b/lib/Froxlor/UI/Callbacks/Domain.php index 713b255b..942d42b0 100644 --- a/lib/Froxlor/UI/Callbacks/Domain.php +++ b/lib/Froxlor/UI/Callbacks/Domain.php @@ -88,10 +88,12 @@ class Domain public static function canViewLogs(array $attributes): bool { - if ((int) UI::getCurrentUser()['adminsession'] == 0 && (bool)UI::getCurrentUser()['logviewenabled']) { - return true; - } elseif ((int) UI::getCurrentUser()['adminsession'] == 1 && (int)$attributes['fields']['email_only'] == 0) { - return true; + if ((int)$attributes['fields']['email_only'] == 0) { + if ((int) UI::getCurrentUser()['adminsession'] == 0 && (bool)UI::getCurrentUser()['logviewenabled']) { + return true; + } elseif ((int) UI::getCurrentUser()['adminsession'] == 1) { + return true; + } } return false; } diff --git a/lib/formfields/formfield.domain_ssleditor.php b/lib/formfields/formfield.domain_ssleditor.php index 44c3856c..dbed484d 100644 --- a/lib/formfields/formfield.domain_ssleditor.php +++ b/lib/formfields/formfield.domain_ssleditor.php @@ -59,6 +59,11 @@ return array( 'cols' => 100, 'rows' => 15, 'value' => $result['ssl_ca_file'] + ), + 'do_insert' => array( + 'type' => 'hidden', + 'value' => '1', + 'visible' => empty($result['ssl_cert_file']) ) ) ) diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php index 84aee867..076877fd 100644 --- a/lib/tablelisting/admin/tablelisting.domains.php +++ b/lib/tablelisting/admin/tablelisting.domains.php @@ -173,7 +173,7 @@ return [ 'action' => 'view', 'id' => ':id' ], - 'visible' => [Domain::class, 'adminCanEditDNS'] + 'visible' => [Domain::class, 'canEditSSL'] ], 'letsencrypt' => [ 'icon' => 'fa fa-shield',