From 7dff46b63e85b361361c897c018bf68b5d19be0b Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 5 Dec 2019 07:52:11 +0100 Subject: [PATCH] set production Lets Encrypt endpoint as default in settings like the installation does; do nat-sorting only on username-related fields, fixes #765 Signed-off-by: Michael Kaufmann --- actions/admin/settings/131.ssl.php | 4 ++-- lib/Froxlor/Api/ApiCommand.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/actions/admin/settings/131.ssl.php b/actions/admin/settings/131.ssl.php index b292dc0a..52d74b5e 100644 --- a/actions/admin/settings/131.ssl.php +++ b/actions/admin/settings/131.ssl.php @@ -150,10 +150,10 @@ return array( 'settinggroup' => 'system', 'varname' => 'letsencryptca', 'type' => 'option', - 'default' => 'testing', + 'default' => 'production', 'option_mode' => 'one', 'option_options' => array( - 'testing' => 'https://acme-staging' . (\Froxlor\Settings::Get('system.leapiversion') == '2' ? '-v02' : '') . '.api.letsencrypt.org (Test)', + 'testing' => 'https://acme-staging-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Test)', 'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)' ), 'save_method' => 'storeSettingField' diff --git a/lib/Froxlor/Api/ApiCommand.php b/lib/Froxlor/Api/ApiCommand.php index 1f67a7a4..9b7dcc6e 100644 --- a/lib/Froxlor/Api/ApiCommand.php +++ b/lib/Froxlor/Api/ApiCommand.php @@ -346,6 +346,15 @@ abstract class ApiCommand extends ApiParameter } else { $order .= " ORDER BY "; } + + $nat_fields = [ + '`c`.`loginname`', + '`a`.`loginname`', + '`adminname`', + '`databasename`', + '`username`' + ]; + foreach ($orderby as $field => $by) { $sortfield = explode('.', $field); foreach ($sortfield as $id => $sfield) { @@ -365,7 +374,7 @@ abstract class ApiCommand extends ApiParameter ])) { $by = 'ASC'; } - if (\Froxlor\Settings::Get('panel.natsorting') == 1) { + if (\Froxlor\Settings::Get('panel.natsorting') == 1 && in_array($field, $nat_fields)) { // Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556 $order .= "CONCAT( IF( ASCII( LEFT( " . $field . ", 5 ) ) > 57, LEFT( " . $field . ", 1 ), 0 ),