diff --git a/customer_domains.php b/customer_domains.php index b9c9deca..14e19b7b 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -33,10 +33,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'domains')) { $id = (int) Request::get('id'); -if ($page == 'overview') { - $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains"); - eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains") . "\";"); -} elseif ($page == 'domains') { +if ($page == 'overview' || $page == 'domains') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains"); @@ -52,11 +49,11 @@ if ($page == 'overview') { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - $add_link = false; $json_result = SubDomains::getLocal($userinfo, ['sql_search' => ['d.parentdomainid' => 0]])->listing(); $result = json_decode($json_result, true)['data']; $parentdomains_count = $result['count']; + $add_link = false; if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) { $add_link = [ 'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']), diff --git a/customer_email.php b/customer_email.php index 9cd97b8c..81f2b621 100644 --- a/customer_email.php +++ b/customer_email.php @@ -34,10 +34,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'email')) { $id = (int) Request::get('id'); -if ($page == 'overview') { - $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email"); - eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/email") . "\";"); -} elseif ($page == 'emails') { +if ($page == 'overview' || $page == 'emails') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails"); @@ -60,8 +57,18 @@ if ($page == 'overview') { )); $emaildomains_count = $result2['emaildomains']; + $add_link = false; + if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count !=0) { + $add_link = [ + 'href' => $linker->getLink(['section' => 'email', 'page' => $page, 'action' => 'add']), + 'label' => $lng['emails']['emails_add'] + ]; + } + UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $email_list_data['email_list']), + 'add_link' => $add_link, + 'entity_info' => $lng['emails']['description'] ]); UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { diff --git a/customer_extras.php b/customer_extras.php index 2fed7fd6..c55daa2a 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -33,10 +33,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'extras')) { $id = (int) Request::get('id'); -if ($page == 'overview') { - $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras"); - eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";"); -} elseif ($page == 'htpasswds') { +if ($page == 'overview' || $page == 'htpasswds') { // redirect if this customer sub-page is hidden via settings if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) { @@ -60,6 +57,11 @@ if ($page == 'overview') { UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']), + 'add_link' => [ + 'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']), + 'label' => $lng['extras']['directoryprotection_add'] + ], + 'entity_info' => $lng['extras']['description'] ]); UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { @@ -177,6 +179,11 @@ if ($page == 'overview') { UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $htaccess_list_data['htaccess_list']), + 'add_link' => [ + 'href' => $linker->getLink(['section' => 'extras', 'page' => 'htaccess', 'action' => 'add']), + 'label' => $lng['extras']['pathoptions_add'] + ], + 'entity_info' => $lng['extras']['description'] ]); UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { diff --git a/customer_ftp.php b/customer_ftp.php index cd9b40bc..ebf982f3 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -32,10 +32,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'ftp')) { $id = (int) Request::get('id', 0); -if ($page == 'overview') { - $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp"); - eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";"); -} elseif ($page == 'accounts') { +if ($page == 'overview' || $page == 'accounts') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); try { @@ -47,8 +44,18 @@ if ($page == 'overview') { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } + $add_link = false; + if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { + $add_link = [ + 'href' => $linker->getLink(['section' => 'ftp', 'page' => 'accounts', 'action' => 'add']), + 'label' => $lng['ftp']['account_add'] + ]; + } + UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $ftp_list_data['ftp_list']), + 'add_link' => $add_link, + 'entity_info' => $lng['ftp']['description'] ]); UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { diff --git a/customer_mysql.php b/customer_mysql.php index 4db4fda9..6e126c46 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -38,13 +38,7 @@ Database::needRoot(false); $id = (int) Request::get('id'); -if ($page == 'overview') { - $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql"); - Database::needSqlData(); - $sql = Database::getSqlData(); - $lng['mysql']['description'] = str_replace('', $sql['host'], $lng['mysql']['description']); - eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";"); -} elseif ($page == 'mysqls') { +if ($page == 'overview' || $page == 'mysqls') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls"); @@ -61,8 +55,22 @@ if ($page == 'overview') { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } + Database::needSqlData(); + $sql = Database::getSqlData(); + $lng['mysql']['description'] = str_replace('', $sql['host'], $lng['mysql']['description']); + + $add_link = false; + if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') { + $add_link = [ + 'href' => $linker->getLink(['section' => 'mysql', 'page' => 'mysqls', 'action' => 'add']), + 'label' => $lng['mysql']['database_create'] + ]; + } + UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $mysql_list_data['mysql_list']), + 'add_link' => $add_link, + 'entity_info' => $lng['mysql']['description'] ]); UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { diff --git a/lib/Froxlor/UI/Callbacks/Text.php b/lib/Froxlor/UI/Callbacks/Text.php index cdf3e301..e26c7f62 100644 --- a/lib/Froxlor/UI/Callbacks/Text.php +++ b/lib/Froxlor/UI/Callbacks/Text.php @@ -2,6 +2,8 @@ namespace Froxlor\UI\Callbacks; +use Froxlor\PhpHelper; + /** * This file is part of the Froxlor project. * Copyright (c) 2010 the Froxlor Team (see authors). @@ -42,4 +44,9 @@ class Text { return \Froxlor\User::getCorrectFullUserDetails($attributes); } + + public static function size(string $data, array $attributes): string + { + return PhpHelper::sizeReadable($data, null, 'bi'); + } } diff --git a/templates/Froxlor/user/table.html.twig b/templates/Froxlor/user/table.html.twig index 452b4fb2..9f3dcb65 100644 --- a/templates/Froxlor/user/table.html.twig +++ b/templates/Froxlor/user/table.html.twig @@ -2,7 +2,7 @@ {% block content %}
-
+