add php-configuration to domain-listing, fixes #1141; move backup-menu to 'System' instead of 'Resources'

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-06-07 15:08:36 +02:00
parent 5afe5a8c46
commit bfc816a51e
3 changed files with 37 additions and 12 deletions

View File

@@ -25,6 +25,7 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\Database\Database;
use Froxlor\Domain\Domain as DDomain; use Froxlor\Domain\Domain as DDomain;
use Froxlor\FileDir; use Froxlor\FileDir;
use Froxlor\Settings; use Froxlor\Settings;
@@ -79,11 +80,11 @@ class Domain
{ {
$result = ''; $result = '';
if ($attributes['fields']['parentdomainid'] != 0) { if ($attributes['fields']['parentdomainid'] != 0) {
$result = '<i class="fa-solid fa-turn-up me-2 fa-rotate-90 opacity-50"></i>'; $result = '<i class="fa-solid fa-turn-up me-2 fa-rotate-90 opacity-50"></i>';
} }
$result .= '<a href="http://' . $attributes['data'] . '" target="_blank">' . $attributes['data'] . '</a>'; $result .= '<a href="http://' . $attributes['data'] . '" target="_blank">' . $attributes['data'] . '</a>';
// check for statistics if parentdomainid==0 to show stats-link for customers // check for statistics if parentdomainid==0 to show stats-link for customers
if ((int)UI::getCurrentUser()['adminsession'] == 0 && $attributes['fields']['parentdomainid'] == 0 && $attributes['fields']['deactivated'] == 0) { if ((int)UI::getCurrentUser()['adminsession'] == 0 && $attributes['fields']['parentdomainid'] == 0 && $attributes['fields']['deactivated'] == 0) {
$statsapp = Settings::Get('system.traffictool'); $statsapp = Settings::Get('system.traffictool');
$result .= ' <a href="http://' . $attributes['data'] . '/' . $statsapp . '" rel="external" target="_blank" title="' . lng('domains.statstics') . '"><i class="fa-solid fa-chart-line text-secondary"></i></a>'; $result .= ' <a href="http://' . $attributes['data'] . '/' . $statsapp . '" rel="external" target="_blank" title="' . lng('domains.statstics') . '"><i class="fa-solid fa-chart-line text-secondary"></i></a>';
} }
@@ -189,13 +190,11 @@ class Domain
// specified certificate for domain // specified certificate for domain
if ($attributes['fields']['domain_hascert'] == 1) { if ($attributes['fields']['domain_hascert'] == 1) {
$result['icon'] .= ' text-success'; $result['icon'] .= ' text-success';
} } // shared certificates (e.g. subdomain if domain where certificate is specified)
// shared certificates (e.g. subdomain if domain where certificate is specified)
elseif ($attributes['fields']['domain_hascert'] == 2) { elseif ($attributes['fields']['domain_hascert'] == 2) {
$result['icon'] .= ' text-warning'; $result['icon'] .= ' text-warning';
$result['title'] .= "\n" . lng('panel.ssleditor_infoshared'); $result['title'] .= "\n" . lng('panel.ssleditor_infoshared');
} } // no certificate specified, using global fallbacks (IPs and Ports or if empty SSL settings)
// no certificate specified, using global fallbacks (IPs and Ports or if empty SSL settings)
elseif ($attributes['fields']['domain_hascert'] == 0) { elseif ($attributes['fields']['domain_hascert'] == 0) {
$result['icon'] .= ' text-danger'; $result['icon'] .= ' text-danger';
$result['title'] .= "\n" . lng('panel.ssleditor_infoglobal'); $result['title'] .= "\n" . lng('panel.ssleditor_infoglobal');
@@ -217,4 +216,22 @@ class Domain
} }
return lng('panel.empty'); return lng('panel.empty');
} }
public static function getPhpConfigName(array $attributes): string
{
$sel_stmt = Database::prepare("SELECT `description` FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id");
$phpconfig = Database::pexecute_first($sel_stmt, ['id' => $attributes['data']]);
if ((int)UI::getCurrentUser()['adminsession'] == 1) {
$linker = UI::getLinker();
$result = '<a href="' . $linker->getLink([
'section' => 'phpsettings',
'page' => 'overview',
'searchfield' => 'c.id',
'searchtext' => $attributes['data'],
]) . '">' . $phpconfig['description'] . '</a>';
} else {
$result = $phpconfig['description'];
}
return $result;
}
} }

View File

@@ -223,12 +223,6 @@ return [
'required_resources' => 'customers', 'required_resources' => 'customers',
'add_shortlink' => 'admin_plans.php?page=overview&action=add' 'add_shortlink' => 'admin_plans.php?page=overview&action=add'
], ],
[
'url' => 'admin_backups.php?page=overview',
'label' => lng('admin.backups.backups'),
'required_resources' => 'change_serversettings',
'add_shortlink' => 'admin_backups.php?page=overview&action=add'
],
[ [
'url' => 'admin_settings.php?page=updatecounters', 'url' => 'admin_settings.php?page=updatecounters',
'label' => lng('admin.updatecounters'), 'label' => lng('admin.updatecounters'),
@@ -268,6 +262,12 @@ return [
'label' => lng('admin.cron.cronsettings'), 'label' => lng('admin.cron.cronsettings'),
'required_resources' => 'change_serversettings' 'required_resources' => 'change_serversettings'
], ],
[
'url' => 'admin_backups.php?page=overview',
'label' => lng('admin.backups.backups'),
'required_resources' => 'change_serversettings',
'add_shortlink' => 'admin_backups.php?page=overview&action=add'
],
[ [
'url' => 'admin_logger.php?page=log', 'url' => 'admin_logger.php?page=log',
'label' => lng('menue.logger.logger'), 'label' => lng('menue.logger.logger'),

View File

@@ -23,6 +23,7 @@
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2 * @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
use Froxlor\Settings;
use Froxlor\UI\Callbacks\Domain; use Froxlor\UI\Callbacks\Domain;
use Froxlor\UI\Callbacks\Impersonate; use Froxlor\UI\Callbacks\Impersonate;
use Froxlor\UI\Callbacks\Style; use Froxlor\UI\Callbacks\Style;
@@ -114,6 +115,13 @@ return [
'field' => 'phpenabled', 'field' => 'phpenabled',
'callback' => [Text::class, 'boolean'], 'callback' => [Text::class, 'boolean'],
], ],
'd.phpsettingid' => [
'label' => lng('admin.phpsettings.title'),
'field' => 'phpsettingid',
'searchable' => false,
'callback' => [Domain::class, 'getPhpConfigName'],
'visible' => (int)Settings::Get('system.mod_fcgid') == 1 || (int)Settings::Get('phpfpm.enabled') == 1
],
'd.openbasedir' => [ 'd.openbasedir' => [
'label' => lng('domains.openbasedirenabled'), 'label' => lng('domains.openbasedirenabled'),
'field' => 'openbasedir', 'field' => 'openbasedir',