Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
7f4ba241
Commit
7f4ba241
authored
Jun 28, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: use a standard file for ISO 3166 mapping
parent
8380dd06
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
309 additions
and
1053 deletions
+309
-1053
iso_3166-1_list_en.xml
...rib/mobile-broadband-provider-info/iso_3166-1_list_en.xml
+0
-987
system.inc
src/etc/inc/system.inc
+17
-0
iso3166.tab
src/opnsense/contrib/tzdata/iso3166.tab
+274
-0
getserviceproviders.php
src/www/getserviceproviders.php
+8
-33
system_camanager.php
src/www/system_camanager.php
+5
-17
system_certmanager.php
src/www/system_certmanager.php
+5
-16
No files found.
contrib/mobile-broadband-provider-info/iso_3166-1_list_en.xml
deleted
100755 → 0
View file @
8380dd06
This diff is collapsed.
Click to expand it.
src/etc/inc/system.inc
View file @
7f4ba241
...
...
@@ -170,6 +170,23 @@ function system_resolvconf_generate($dynupdate = false)
return
0
;
}
function
get_country_codes
()
{
$dn_cc
=
array
();
$iso3166_tab
=
'/usr/local/opnsense/contrib/tzdata/iso3166.tab'
;
if
(
file_exists
(
$iso3166_tab
))
{
$dn_cc_file
=
file
(
$iso3166_tab
);
foreach
(
$dn_cc_file
as
$line
)
{
if
(
preg_match
(
'/^([A-Z][A-Z])\t(.*)$/'
,
$line
,
$matches
))
{
$dn_cc
[
$matches
[
1
]]
=
trim
(
$matches
[
2
]);
}
}
}
return
$dn_cc
;
}
function
get_searchdomains
()
{
global
$config
;
...
...
src/opnsense/contrib/tzdata/iso3166.tab
0 → 100644
View file @
7f4ba241
# ISO 3166 alpha-2 country codes
#
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
# From Paul Eggert (2015-05-02):
# This file contains a table of two-letter country codes. Columns are
# separated by a single tab. Lines beginning with '#' are comments.
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
#
# The table is sorted by country code.
#
# This table is intended as an aid for users, to help them select time
# zone data appropriate for their practical needs. It is not intended
# to take or endorse any position on legal or territorial claims.
#
#country-
#code name of country, territory, area, or subdivision
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua & Barbuda
AI Anguilla
AL Albania
AM Armenia
AO Angola
AQ Antarctica
AR Argentina
AS Samoa (American)
AT Austria
AU Australia
AW Aruba
AX Åland Islands
AZ Azerbaijan
BA Bosnia & Herzegovina
BB Barbados
BD Bangladesh
BE Belgium
BF Burkina Faso
BG Bulgaria
BH Bahrain
BI Burundi
BJ Benin
BL St Barthelemy
BM Bermuda
BN Brunei
BO Bolivia
BQ Caribbean Netherlands
BR Brazil
BS Bahamas
BT Bhutan
BV Bouvet Island
BW Botswana
BY Belarus
BZ Belize
CA Canada
CC Cocos (Keeling) Islands
CD Congo (Dem. Rep.)
CF Central African Rep.
CG Congo (Rep.)
CH Switzerland
CI Côte d'Ivoire
CK Cook Islands
CL Chile
CM Cameroon
CN China
CO Colombia
CR Costa Rica
CU Cuba
CV Cape Verde
CW Curacao
CX Christmas Island
CY Cyprus
CZ Czech Republic
DE Germany
DJ Djibouti
DK Denmark
DM Dominica
DO Dominican Republic
DZ Algeria
EC Ecuador
EE Estonia
EG Egypt
EH Western Sahara
ER Eritrea
ES Spain
ET Ethiopia
FI Finland
FJ Fiji
FK Falkland Islands
FM Micronesia
FO Faroe Islands
FR France
GA Gabon
GB Britain (UK)
GD Grenada
GE Georgia
GF French Guiana
GG Guernsey
GH Ghana
GI Gibraltar
GL Greenland
GM Gambia
GN Guinea
GP Guadeloupe
GQ Equatorial Guinea
GR Greece
GS South Georgia & the South Sandwich Islands
GT Guatemala
GU Guam
GW Guinea-Bissau
GY Guyana
HK Hong Kong
HM Heard Island & McDonald Islands
HN Honduras
HR Croatia
HT Haiti
HU Hungary
ID Indonesia
IE Ireland
IL Israel
IM Isle of Man
IN India
IO British Indian Ocean Territory
IQ Iraq
IR Iran
IS Iceland
IT Italy
JE Jersey
JM Jamaica
JO Jordan
JP Japan
KE Kenya
KG Kyrgyzstan
KH Cambodia
KI Kiribati
KM Comoros
KN St Kitts & Nevis
KP Korea (North)
KR Korea (South)
KW Kuwait
KY Cayman Islands
KZ Kazakhstan
LA Laos
LB Lebanon
LC St Lucia
LI Liechtenstein
LK Sri Lanka
LR Liberia
LS Lesotho
LT Lithuania
LU Luxembourg
LV Latvia
LY Libya
MA Morocco
MC Monaco
MD Moldova
ME Montenegro
MF St Martin (French part)
MG Madagascar
MH Marshall Islands
MK Macedonia
ML Mali
MM Myanmar (Burma)
MN Mongolia
MO Macau
MP Northern Mariana Islands
MQ Martinique
MR Mauritania
MS Montserrat
MT Malta
MU Mauritius
MV Maldives
MW Malawi
MX Mexico
MY Malaysia
MZ Mozambique
NA Namibia
NC New Caledonia
NE Niger
NF Norfolk Island
NG Nigeria
NI Nicaragua
NL Netherlands
NO Norway
NP Nepal
NR Nauru
NU Niue
NZ New Zealand
OM Oman
PA Panama
PE Peru
PF French Polynesia
PG Papua New Guinea
PH Philippines
PK Pakistan
PL Poland
PM St Pierre & Miquelon
PN Pitcairn
PR Puerto Rico
PS Palestine
PT Portugal
PW Palau
PY Paraguay
QA Qatar
RE Réunion
RO Romania
RS Serbia
RU Russia
RW Rwanda
SA Saudi Arabia
SB Solomon Islands
SC Seychelles
SD Sudan
SE Sweden
SG Singapore
SH St Helena
SI Slovenia
SJ Svalbard & Jan Mayen
SK Slovakia
SL Sierra Leone
SM San Marino
SN Senegal
SO Somalia
SR Suriname
SS South Sudan
ST Sao Tome & Principe
SV El Salvador
SX St Maarten (Dutch part)
SY Syria
SZ Swaziland
TC Turks & Caicos Is
TD Chad
TF French Southern & Antarctic Lands
TG Togo
TH Thailand
TJ Tajikistan
TK Tokelau
TL East Timor
TM Turkmenistan
TN Tunisia
TO Tonga
TR Turkey
TT Trinidad & Tobago
TV Tuvalu
TW Taiwan
TZ Tanzania
UA Ukraine
UG Uganda
UM US minor outlying islands
US United States
UY Uruguay
UZ Uzbekistan
VA Vatican City
VC St Vincent
VE Venezuela
VG Virgin Islands (UK)
VI Virgin Islands (US)
VN Vietnam
VU Vanuatu
WF Wallis & Futuna
WS Samoa (western)
YE Yemen
YT Mayotte
ZA South Africa
ZM Zambia
ZW Zimbabwe
src/www/getserviceproviders.php
View file @
7f4ba241
...
...
@@ -36,34 +36,8 @@ $serviceproviders_attr = xml2array($serviceproviders_contents,1,"attr");
$serviceproviders
=
&
$serviceproviders_attr
[
'serviceproviders'
][
'country'
];
function
get_country_name
(
$country_code
)
{
if
(
$country_code
!=
"ALL"
&&
strlen
(
$country_code
)
!=
2
)
return
""
;
$country_names_xml
=
"/usr/local/share/mobile-broadband-provider-info/iso_3166-1_list_en.xml"
;
$country_names_contents
=
file_get_contents
(
$country_names_xml
);
$country_names
=
xml2array
(
$country_names_contents
);
if
(
$country_code
==
"ALL"
)
{
$country_list
=
array
();
foreach
(
$country_names
[
'ISO_3166-1_List_en'
][
'ISO_3166-1_Entry'
]
as
$country
)
{
$country_list
[]
=
array
(
"code"
=>
$country
[
'ISO_3166-1_Alpha-2_Code_element'
],
"name"
=>
ucwords
(
strtolower
(
$country
[
'ISO_3166-1_Country_name'
]))
);
}
return
$country_list
;
}
foreach
(
$country_names
[
'ISO_3166-1_List_en'
][
'ISO_3166-1_Entry'
]
as
$country
)
{
if
(
$country
[
'ISO_3166-1_Alpha-2_Code_element'
]
==
strtoupper
(
$country_code
))
{
return
ucwords
(
strtolower
(
$country
[
'ISO_3166-1_Country_name'
]));
}
}
return
""
;
}
function
get_country_providers
(
$country
)
{
function
get_country_providers
(
$country
)
{
global
$serviceproviders
;
foreach
(
$serviceproviders
as
$sp
)
{
if
(
$sp
[
'attr'
][
'code'
]
==
strtolower
(
$country
))
{
...
...
@@ -73,13 +47,14 @@ function get_country_providers($country) {
return
$provider_list
;
}
function
country_list
()
{
function
country_list
()
{
global
$serviceproviders
;
$country_list
=
get_country_
name
(
"ALL"
);
$country_list
=
get_country_
codes
(
);
foreach
(
$serviceproviders
as
$sp
)
{
foreach
(
$country_list
as
$country
)
{
if
(
strtoupper
(
$sp
[
'attr'
][
'code'
])
==
$country
[
'code'
]
)
{
echo
$country
[
'name'
]
.
":"
.
$country
[
'code'
]
.
"
\n
"
;
foreach
(
$country_list
as
$co
de
=>
$co
untry
)
{
if
(
strtoupper
(
$sp
[
'attr'
][
'code'
])
==
$code
)
{
echo
$country
.
":"
.
$code
.
"
\n
"
;
}
}
}
...
...
src/www/system_camanager.php
View file @
7f4ba241
...
...
@@ -373,19 +373,6 @@ function method_change() {
<div
class=
"content-box tab-content table-responsive"
style=
"overflow: auto;"
>
<?php
// Load valid country codes
$dn_cc
=
array
();
if
(
file_exists
(
"/usr/local/etc/ca_countries"
))
{
$dn_cc_file
=
file
(
"/usr/local/etc/ca_countries"
);
foreach
(
$dn_cc_file
as
$line
)
{
if
(
preg_match
(
'/^(\S*)\s(.*)$/'
,
$line
,
$matches
))
{
array_push
(
$dn_cc
,
$matches
[
1
]);
}
}
}
?>
<?php
if
(
$act
==
"new"
||
$act
==
"edit"
||
$act
==
gettext
(
"Save"
)
||
$input_errors
)
:
?>
...
...
@@ -561,12 +548,13 @@ endif; ?>
<td
align=
"left"
>
<select
name=
'dn_country'
class=
"selectpicker"
>
<?php
foreach
(
$dn_cc
as
$cc
)
{
$selected
=
""
;
$dn_cc
=
get_country_codes
();
foreach
(
$dn_cc
as
$cc
=>
$cn
)
{
$selected
=
''
;
if
(
$pconfig
[
'dn_country'
]
==
$cc
)
{
$selected
=
" selected=
\"
selected
\"
"
;
$selected
=
' selected="selected"'
;
}
print
"<option value=
\"
$cc
\"
$selected
>
$cc
</option>"
;
print
"<option value=
\"
$cc
\"
$selected
>
$cc
(
$cn
)
</option>"
;
}
?>
</select>
...
...
src/www/system_certmanager.php
View file @
7f4ba241
...
...
@@ -594,18 +594,6 @@ endif; ?>
rowsize
[
1
]
=
"
30
"
;
//]]>
</script>
<?php
// Load valid country codes
$dn_cc
=
array
();
if
(
file_exists
(
"/usr/local/etc/ca_countries"
))
{
$dn_cc_file
=
file
(
"/usr/local/etc/ca_countries"
);
foreach
(
$dn_cc_file
as
$line
)
{
if
(
preg_match
(
'/^(\S*)\s(.*)$/'
,
$line
,
$matches
))
{
array_push
(
$dn_cc
,
$matches
[
1
]);
}
}
}
?>
<!-- row -->
<section
class=
"page-content-main"
>
...
...
@@ -959,12 +947,13 @@ endif; ?>
<td
align=
"left"
>
<select
name=
'csr_dn_country'
class=
"formselect"
>
<?php
foreach
(
$dn_cc
as
$cc
)
{
$selected
=
""
;
$dn_cc
=
get_country_codes
();
foreach
(
$dn_cc
as
$cc
=>
$cn
)
{
$selected
=
''
;
if
(
$pconfig
[
'csr_dn_country'
]
==
$cc
)
{
$selected
=
" selected=
\"
selected
\"
"
;
$selected
=
' selected="selected"'
;
}
print
"<option value=
\"
$cc
\"
$selected
>
$cc
</option>"
;
print
"<option value=
\"
$cc
\"
$selected
>
$cc
(
$cn
)
</option>"
;
}
?>
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment