From a56762ba305f5eb2a44b7538ef139d2e1bbd54ff Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 7 Feb 2019 13:34:12 -0200 Subject: [PATCH] Ticket #9308: Implement get_cert_country_codes() to get the list of country codes to be used by CAs and Certs --- src/etc/inc/pfsense-utils.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index e11ccd1f5a..f7470b4e93 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -2790,6 +2790,25 @@ function get_country_name($country_code = "ALL") { return ""; } +/* Return the list of country codes to be used on CAs and certs */ +function get_cert_country_codes() { + $countries = get_country_name(); + + $country_codes = array(); + foreach ($countries as $country) { + $country_codes[$country['code']] = $country['code']; + } + + /* Preserve historical order: None, US, CA, other countries */ + $first_items[''] = gettext("None"); + $first_items['US'] = $country_codes['US']; + $first_items['CA'] = $country_codes['CA']; + unset($country_codes['US']); + unset($country_codes['CA']); + + return array_merge($first_items, $country_codes); +} + /* sort by interface only, retain the original order of rules that apply to the same interface */ function filter_rules_sort() {