diff --git a/admin_admins.php b/admin_admins.php index b22b7c21..657469fc 100644 --- a/admin_admins.php +++ b/admin_admins.php @@ -32,22 +32,26 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins"); - $admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.admins.php'; + $admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.admins.php'; - try { + try { // get filtered collection - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Admins::class, $userinfo)) - ->withPagination($admin_list_data['admin_list']['columns']) - ->getList(); + $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Admins::class, $userinfo)) + ->withPagination($admin_list_data['admin_list']['columns']) + ->getList(); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $admin_list_data['admin_list']), - ]); - UI::twigOutputBuffer(); - } elseif ($action == 'su') { + UI::twigBuffer('user/table.html.twig', [ + 'listing' => \Froxlor\UI\Listing::format($list, $admin_list_data['admin_list']), + 'actions_links' => [[ + 'href' => $linker->getLink(['section' => 'admins', 'page' => $page, 'action' => 'add']), + 'label' => $lng['admin']['admin_add'] + ]] + ]); + UI::twigOutputBuffer(); + } elseif ($action == 'su') { try { $json_result = Admins::getLocal($userinfo, array( diff --git a/admin_customers.php b/admin_customers.php index a7b43f19..35208d2a 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -33,19 +33,28 @@ if ($page == 'customers' && $userinfo['customers'] != '0') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers"); try { - $customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.customers.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo)) - ->has('admin', \Froxlor\Api\Commands\Admins::class, 'adminid', 'adminid') - ->withPagination($customer_list_data['customer_list']['columns']) - ->getList(); - } catch (Exception $e) { - \Froxlor\UI\Response::dynamic_error($e->getMessage()); - } + $customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.customers.php'; + $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo)) + ->has('admin', \Froxlor\Api\Commands\Admins::class, 'adminid', 'adminid') + ->withPagination($customer_list_data['customer_list']['columns']) + ->getList(); + } catch (Exception $e) { + \Froxlor\UI\Response::dynamic_error($e->getMessage()); + } - UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $customer_list_data['customer_list']), - ]); - UI::twigOutputBuffer(); + $actions_links = false; + if ($userinfo['customers_used'] < $userinfo['customers'] || $userinfo['customers'] == '-1') { + $actions_links = [[ + 'href' => $linker->getLink(['section' => 'customers', 'page' => $page, 'action' => 'add']), + 'label' => $lng['admin']['customer_add'] + ]]; + } + + UI::twigBuffer('user/table.html.twig', [ + 'listing' => \Froxlor\UI\Listing::format($list, $customer_list_data['customer_list']), + 'actions_links' => $actions_links + ]); + UI::twigOutputBuffer(); } elseif ($action == 'su' && $id != 0) { try { $json_result = Customers::getLocal($userinfo, array( diff --git a/admin_domains.php b/admin_domains.php index e8d32190..ceb30463 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -33,20 +33,39 @@ if ($page == 'domains' || $page == 'overview') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains"); - try { - $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo)) - ->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid') - ->withPagination($domain_list_data['domain_list']['columns']) - ->getList(); - } catch (Exception $e) { - \Froxlor\UI\Response::dynamic_error($e->getMessage()); - } + try { + $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php'; + $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo)) + ->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid') + ->withPagination($domain_list_data['domain_list']['columns']) + ->getList(); + } catch (Exception $e) { + \Froxlor\UI\Response::dynamic_error($e->getMessage()); + } - UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']), - ]); - UI::twigOutputBuffer(); + $json_result = Customers::getLocal($userinfo)->listingCount(); + $countcustomers = json_decode($json_result, true)['data']; + + $actions_links = false; + if (($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') && $countcustomers != 0) { + $actions_links = []; + $actions_links[] = [ + 'href' => $linker->getLink(['section' => 'domains', 'page' => $page, 'action' => 'add']), + 'label' => $lng['admin']['domain_add'] + ]; + $actions_links[] = [ + 'href' => $linker->getLink(['section' => 'domains', 'page' => $page, 'action' => 'import']), + 'label' => $lng['domains']['domain_import'], + 'icon' => 'fa-solid fa-file-import', + 'class' => 'btn-secondary' + ]; + } + + UI::twigBuffer('user/table.html.twig', [ + 'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']), + 'actions_links' => $actions_links + ]); + UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { try { @@ -325,7 +344,7 @@ if ($page == 'domains' || $page == 'overview') { if (in_array($domain_emails_row['email_full'], $domain_emails_row['destination'])) { $email_forwarders -= 1; - $email_accounts ++; + $email_accounts++; } } } @@ -541,14 +560,14 @@ if ($page == 'domains' || $page == 'overview') { LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid "); $c_allowed_configs = \Froxlor\Customer\Customer::getCustomerDetail($result['customerid'], 'allowed_phpconfigs'); - if (! empty($c_allowed_configs)) { + if (!empty($c_allowed_configs)) { $c_allowed_configs = json_decode($c_allowed_configs, true); } else { $c_allowed_configs = array(); } while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) { - $disabled = ! empty($c_allowed_configs) && ! in_array($phpconfigs_row['id'], $c_allowed_configs); + $disabled = !empty($c_allowed_configs) && !in_array($phpconfigs_row['id'], $c_allowed_configs); if ((int) Settings::Get('phpfpm.enabled') == 1) { $phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled); } else { @@ -558,8 +577,10 @@ if ($page == 'domains' || $page == 'overview') { $result = \Froxlor\PhpHelper::htmlentitiesArray($result); if (Settings::Get('panel.allow_domain_change_customer') != '1') { - $result['customername'] .= ' (' . $customer['loginname'] . ')'; + $result['customername'] .= ' (' . $customer['loginname'] . ')'; } $domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php'; @@ -577,7 +598,7 @@ if ($page == 'domains' || $page == 'overview') { $customerid = intval($_POST['customerid']); $allowed_phpconfigs = \Froxlor\Customer\Customer::getCustomerDetail($customerid, 'allowed_phpconfigs'); - echo ! empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode(array()); + echo !empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode(array()); exit(); } elseif ($action == 'import') { @@ -597,7 +618,7 @@ if ($page == 'domains' || $page == 'overview') { \Froxlor\UI\Response::standard_error('domain_import_error', $e->getMessage()); } - if (! empty($bulk->getErrors())) { + if (!empty($bulk->getErrors())) { \Froxlor\UI\Response::dynamic_error(implode("
", $bulk->getErrors())); } @@ -606,7 +627,7 @@ if ($page == 'domains' || $page == 'overview') { \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); - $result_str = $result['imported'] . ' / ' . $result['all'] . (! empty($result['note']) ? ' (' . $result['note'] . ')' : ''); + $result_str = $result['imported'] . ' / ' . $result['all'] . (!empty($result['note']) ? ' (' . $result['note'] . ')' : ''); \Froxlor\UI\Response::standard_success('domain_import_successfully', $result_str, array( 'filename' => $filename, 'action' => '', @@ -647,7 +668,7 @@ function formatDomainEntry(&$row, &$idna_convert) $row['ipandport'] .= $rowip['ip'] . ':' . $rowip['port'] . "\n"; } } - $row['ipandport'] = substr($row['ipandport'], 0, - 1); + $row['ipandport'] = substr($row['ipandport'], 0, -1); $row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']); $row['termination_css'] = ""; diff --git a/admin_ipsandports.php b/admin_ipsandports.php index 172806c6..9c258609 100644 --- a/admin_ipsandports.php +++ b/admin_ipsandports.php @@ -32,18 +32,22 @@ if ($page == 'ipsandports' || $page == 'overview') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); try { - $ipsandports_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.ipsandports.php'; + $ipsandports_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.ipsandports.php'; $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\IpsAndPorts::class, $userinfo)) - ->withPagination($ipsandports_list_data['ipsandports_list']['columns']) - ->getList(); - } catch (Exception $e) { + ->withPagination($ipsandports_list_data['ipsandports_list']['columns']) + ->getList(); + } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $ipsandports_list_data['ipsandports_list']), - ]); - UI::twigOutputBuffer(); + UI::twigBuffer('user/table.html.twig', [ + 'listing' => \Froxlor\UI\Listing::format($list, $ipsandports_list_data['ipsandports_list']), + 'actions_links' => [[ + 'href' => $linker->getLink(['section' => 'ipsandports', 'page' => $page, 'action' => 'add']), + 'label' => $lng['admin']['ipsandports']['add'] + ]] + ]); + UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { try { $json_result = IpsAndPorts::getLocal($userinfo, array( diff --git a/admin_plans.php b/admin_plans.php index c856766e..ac035a21 100644 --- a/admin_plans.php +++ b/admin_plans.php @@ -33,18 +33,22 @@ if ($page == '' || $page == 'overview') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_plans"); try { - $plan_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.plans.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\HostingPlans::class, $userinfo)) - ->withPagination($plan_list_data['plan_list']['columns']) - ->getList(); + $plan_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.plans.php'; + $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\HostingPlans::class, $userinfo)) + ->withPagination($plan_list_data['plan_list']['columns']) + ->getList(); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $plan_list_data['plan_list']), - ]); - UI::twigOutputBuffer(); + UI::twigBuffer('user/table.html.twig', [ + 'listing' => \Froxlor\UI\Listing::format($list, $plan_list_data['plan_list']), + 'actions_links' => [[ + 'href' => $linker->getLink(['section' => 'plans', 'page' => $page, 'action' => 'add']), + 'label' => $lng['admin']['plans']['add'] + ]] + ]); + UI::twigOutputBuffer(); } elseif ($action == 'delete' && $id != 0) { try { diff --git a/customer_domains.php b/customer_domains.php index 14e19b7b..2091f961 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -53,17 +53,17 @@ if ($page == 'overview' || $page == 'domains') { $result = json_decode($json_result, true)['data']; $parentdomains_count = $result['count']; - $add_link = false; + $actions_links = false; if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) { - $add_link = [ + $actions_links = [[ 'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']), 'label' => $lng['domains']['subdomain_add'] - ]; + ]]; } UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']), - 'add_link' => $add_link, + 'actions_links' => $actions_links, 'entity_info' => $lng['domains']['description'] ]); UI::twigOutputBuffer(); diff --git a/customer_email.php b/customer_email.php index 81f2b621..2f1d590d 100644 --- a/customer_email.php +++ b/customer_email.php @@ -57,17 +57,17 @@ if ($page == 'overview' || $page == 'emails') { )); $emaildomains_count = $result2['emaildomains']; - $add_link = false; + $actions_links = false; if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count !=0) { - $add_link = [ + $actions_links = [[ '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, + 'actions_links' => $actions_links, 'entity_info' => $lng['emails']['description'] ]); UI::twigOutputBuffer(); diff --git a/customer_extras.php b/customer_extras.php index c55daa2a..5ea69bd5 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -57,10 +57,10 @@ if ($page == 'overview' || $page == 'htpasswds') { UI::twigBuffer('user/table.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']), - 'add_link' => [ + 'actions_links' => [[ 'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']), 'label' => $lng['extras']['directoryprotection_add'] - ], + ]], 'entity_info' => $lng['extras']['description'] ]); UI::twigOutputBuffer(); diff --git a/customer_ftp.php b/customer_ftp.php index ebf982f3..ce3bde10 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -44,17 +44,17 @@ if ($page == 'overview' || $page == 'accounts') { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - $add_link = false; + $actions_links = false; if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { - $add_link = [ + $actions_links = [[ '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, + 'actions_links' => $actions_links, 'entity_info' => $lng['ftp']['description'] ]); UI::twigOutputBuffer(); diff --git a/customer_mysql.php b/customer_mysql.php index 6e126c46..4985e0f3 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -59,17 +59,17 @@ if ($page == 'overview' || $page == 'mysqls') { $sql = Database::getSqlData(); $lng['mysql']['description'] = str_replace('', $sql['host'], $lng['mysql']['description']); - $add_link = false; + $actions_links = false; if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') { - $add_link = [ + $actions_links = [[ '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, + 'actions_links' => $actions_links, 'entity_info' => $lng['mysql']['description'] ]); UI::twigOutputBuffer(); diff --git a/lib/tablelisting/admin/tablelisting.plans.php b/lib/tablelisting/admin/tablelisting.plans.php index 88d5a7c4..d365bd67 100644 --- a/lib/tablelisting/admin/tablelisting.plans.php +++ b/lib/tablelisting/admin/tablelisting.plans.php @@ -21,7 +21,7 @@ use Froxlor\UI\Listing; return [ 'plan_list' => [ - 'title' => $lng['domains']['ssl_certificates'], + 'title' => $lng['admin']['plans']['plans'], 'icon' => 'fa-solid fa-user', 'columns' => [ 'p.name' => [ diff --git a/templates/Froxlor/user/table.html.twig b/templates/Froxlor/user/table.html.twig index 9f3dcb65..40abea6e 100644 --- a/templates/Froxlor/user/table.html.twig +++ b/templates/Froxlor/user/table.html.twig @@ -2,19 +2,21 @@ {% block content %}
-