Heavily rewritten API:
[mailer.git] / inc / extensions / ext-iso3166.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 12/08/2008 *
4  * ================                             Last change: 12/08/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-iso3166.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Country code list ISO3166                        *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Laendercode-Liste ISO3166                        *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2008 by Wolfgang Stelzhammer                           *
16  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
17  * For more information visit: http://www.mxchange.org                  *
18  *                                                                      *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or    *
22  * (at your option) any later version.                                  *
23  *                                                                      *
24  * This program is distributed in the hope that it will be useful,      *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
27  * GNU General Public License for more details.                         *
28  *                                                                      *
29  * You should have received a copy of the GNU General Public License    *
30  * along with this program; if not, write to the Free Software          *
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
32  * MA  02110-1301  USA                                                  *
33  ************************************************************************/
34
35 // Some security stuff...
36 if (!defined('__SECURITY')) {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 // Version number
42 $EXT_VERSION = "0.0.1";
43
44 // Version history array (add more with , "0.1" and so on)
45 $EXT_VER_HISTORY = array("0.0", "0.0.1");
46
47 switch ($EXT_LOAD_MODE)
48 {
49 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
50         // SQL commands to run
51         $SQLs[] = "";
52         break;
53
54 case "remove": // Do stuff when removing extension
55         // SQL commands to run
56         $SQLs[] = "DELETE FROM `"._MYSQL_PREFIX."_countries` WHERE provider = 'ext-iso3166';";
57         $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_countries` DROP `provider`;";
58         break;
59
60 case "activate": // Do stuff when admin activates this extension
61         // SQL commands to run
62         $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_countries` SET is_active = 'Y' WHERE provider = 'ext-iso3166';";
63         break;
64
65 case "deactivate": // Do stuff when admin deactivates this extension
66         // SQL commands to run
67         $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_countries` SET is_active = 'N' WHERE provider = 'ext-iso3166';";
68         break;
69
70 case "update": // Update an extension
71         switch ($EXT_VER)
72         {
73         case "0.0.1": // SQL queries for v0.0.2
74                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_countries` ADD `provider` ENUM( 'user', 'ext-iso3166' ) NOT NULL DEFAULT 'user';";
75                 $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_countries` (`code` , `descr`, `provider`)
76 VALUES ('AD', 'Andorra', 'ext-iso3166'),
77 ('AE', 'Vereinigte Arabische Emirate', 'ext-iso3166'),
78 ('AF', 'Afghanistan', 'ext-iso3166'),
79 ('AG', 'Antigua und Barbuda', 'ext-iso3166'),
80 ('AI', 'Anguilla', 'ext-iso3166'),
81 ('AL', 'Albanien', 'ext-iso3166'),
82 ('AM', 'Armenien', 'ext-iso3166'),
83 ('AN', 'Niederl&auml;ndische Antillen', 'ext-iso3166'),
84 ('AO', 'Angola', 'ext-iso3166'),
85 ('AQ', 'Antarktis', 'ext-iso3166'),
86 ('AR', 'Argentinien', 'ext-iso3166'),
87 ('AS', 'Samoa', 'ext-iso3166'),
88 ('AT', '&Ouml;sterreich', 'ext-iso3166'),
89 ('AU', 'Australien', 'ext-iso3166'),
90 ('AW', 'Aruba', 'ext-iso3166'),
91 ('AZ', 'Aserbaidschan', 'ext-iso3166'),
92 ('BA', 'Bosnien-Herzegowina', 'ext-iso3166'),
93 ('BB', 'Barbados', 'ext-iso3166'),
94 ('BD', 'Bangladesh', 'ext-iso3166'),
95 ('BE', 'Belgien', 'ext-iso3166'),
96 ('BF', 'Burkina Faso', 'ext-iso3166'),
97 ('BG', 'Bulgarien', 'ext-iso3166'),
98 ('BH', 'Bahrain', 'ext-iso3166'),
99 ('BI', 'Burundi', 'ext-iso3166'),
100 ('BJ', 'Benin', 'ext-iso3166'),
101 ('BM', 'Bermudas', 'ext-iso3166'),
102 ('BN', 'Brunei', 'ext-iso3166'),
103 ('BO', 'Bolivien', 'ext-iso3166'),
104 ('BR', 'Brasilien', 'ext-iso3166'),
105 ('BS', 'Bahamas', 'ext-iso3166'),
106 ('BT', 'Bhutan', 'ext-iso3166'),
107 ('BV', 'Bouvet-Inseln', 'ext-iso3166'),
108 ('BW', 'Botswana', 'ext-iso3166'),
109 ('BY', 'Wei&szlig;russland', 'ext-iso3166'),
110 ('BZ', 'Belize', 'ext-iso3166'),
111 ('CA', 'Kanada', 'ext-iso3166'),
112 ('CC', 'Kokosinseln', 'ext-iso3166'),
113 ('CD', 'Demokratische Republik Kongo (ehemals ZR: Zaire)', 'ext-iso3166'),
114 ('CF', 'Zentralafrikanische Republik', 'ext-iso3166'),
115 ('CG', 'Kongo', 'ext-iso3166'),
116 ('CH', 'Schweiz', 'ext-iso3166'),
117 ('CI', 'Elfenbeink&uuml;ste', 'ext-iso3166'),
118 ('CK', 'Cook-Inseln', 'ext-iso3166'),
119 ('CL', 'Chile', 'ext-iso3166'),
120 ('CM', 'Kamerun', 'ext-iso3166'),
121 ('CN', 'China', 'ext-iso3166'),
122 ('CO', 'Kolumbien', 'ext-iso3166'),
123 ('CR', 'Costa Rica', 'ext-iso3166'),
124 ('CS', 'Serbien und Montenegro (fr&uuml;her Tschechoslowakei)', 'ext-iso3166'),
125 ('CU', 'Kuba', 'ext-iso3166'),
126 ('CV', 'Kap Verde', 'ext-iso3166'),
127 ('CX', 'Christmas Island', 'ext-iso3166'),
128 ('CY', 'Zypern', 'ext-iso3166'),
129 ('CZ', 'Tschechische Republik', 'ext-iso3166'),
130 ('DJ', 'Djibuti', 'ext-iso3166'),
131 ('DE', 'Deutschland', 'ext-iso3166'),
132 ('DK', 'D&auml;nemark', 'ext-iso3166'),
133 ('DM', 'Dominika', 'ext-iso3166'),
134 ('DO', 'Dominikanische Republik', 'ext-iso3166'),
135 ('DZ', 'Algerien', 'ext-iso3166'),
136 ('EC', 'Ecuador', 'ext-iso3166'),
137 ('EE', 'Estland', 'ext-iso3166'),
138 ('EG', '&Auml;gypten', 'ext-iso3166'),
139 ('EH', 'Westsahara', 'ext-iso3166'),
140 ('ER', 'Eritrea', 'ext-iso3166'),
141 ('ES', 'Spanien', 'ext-iso3166'),
142 ('ET', '&Auml;thiopien', 'ext-iso3166'),
143 ('FI', 'Finnland', 'ext-iso3166'),
144 ('FJ', 'Fidschi-Inseln', 'ext-iso3166'),
145 ('FK', 'Falkland-Inseln', 'ext-iso3166'),
146 ('FM', 'Mikronesien', 'ext-iso3166'),
147 ('FO', 'F&auml;r&ouml;er Inseln', 'ext-iso3166'),
148 ('FR', 'Frankreich', 'ext-iso3166'),
149 ('FX', 'Frankreich (nur Europa)', 'ext-iso3166'),
150 ('GA', 'Gabun', 'ext-iso3166'),
151 ('GB', 'Gro&szlig;britannien (UK)', 'ext-iso3166'),
152 ('GD', 'Grenada', 'ext-iso3166'),
153 ('GE', 'Georgien', 'ext-iso3166'),
154 ('GF', 'franz&ouml;sisch Guyana', 'ext-iso3166'),
155 ('GH', 'Ghana', 'ext-iso3166'),
156 ('GI', 'Gibraltar', 'ext-iso3166'),
157 ('GL', 'Gr&ouml;nland', 'ext-iso3166'),
158 ('GM', 'Gambia', 'ext-iso3166'),
159 ('GN', 'Guinea', 'ext-iso3166'),
160 ('GP', 'Guadeloupe', 'ext-iso3166'),
161 ('GQ', '&Auml;quatorial Guinea', 'ext-iso3166'),
162 ('GR', 'Griechenland', 'ext-iso3166'),
163 ('GS', 'South Georgia und South Sandwich Islands', 'ext-iso3166'),
164 ('GT', 'Guatemala', 'ext-iso3166'),
165 ('GU', 'Guam', 'ext-iso3166'),
166 ('GW', 'Guinea Bissau', 'ext-iso3166'),
167 ('GY', 'Guyana', 'ext-iso3166'),
168 ('HK', 'Hong Kong', 'ext-iso3166'),
169 ('HM', 'Heard und McDonald Islands', 'ext-iso3166'),
170 ('HN', 'Honduras', 'ext-iso3166'),
171 ('HR', 'Kroatien', 'ext-iso3166'),
172 ('HT', 'Haiti', 'ext-iso3166'),
173 ('HU', 'Ungarn', 'ext-iso3166'),
174 ('ID', 'Indonesien', 'ext-iso3166'),
175 ('IE', 'Irland', 'ext-iso3166'),
176 ('IL', 'Israel', 'ext-iso3166'),
177 ('IN', 'Indien', 'ext-iso3166'),
178 ('IO', 'Britisch-Indischer Ozean', 'ext-iso3166'),
179 ('IQ', 'Irak', 'ext-iso3166'),
180 ('IR', 'Iran', 'ext-iso3166'),
181 ('IS', 'Island', 'ext-iso3166'),
182 ('IT', 'Italien', 'ext-iso3166'),
183 ('JM', 'Jamaika', 'ext-iso3166'),
184 ('JO', 'Jordanien', 'ext-iso3166'),
185 ('JP', 'Japan', 'ext-iso3166'),
186 ('KE', 'Kenia', 'ext-iso3166'),
187 ('KG', 'Kirgisistan', 'ext-iso3166'),
188 ('KH', 'Kambodscha', 'ext-iso3166'),
189 ('KI', 'Kiribati', 'ext-iso3166'),
190 ('KM', 'Komoren', 'ext-iso3166'),
191 ('KN', 'St. Kitts Nevis Anguilla', 'ext-iso3166'),
192 ('KP', 'Nordkorea', 'ext-iso3166'),
193 ('KR', 'S&uuml;dkorea', 'ext-iso3166'),
194 ('KW', 'Kuwait', 'ext-iso3166'),
195 ('KY', 'Kaiman-Inseln', 'ext-iso3166'),
196 ('KZ', 'Kasachstan', 'ext-iso3166'),
197 ('LA', 'Laos', 'ext-iso3166'),
198 ('LB', 'Libanon', 'ext-iso3166'),
199 ('LC', 'Saint Lucia', 'ext-iso3166'),
200 ('LI', 'Liechtenstein', 'ext-iso3166'),
201 ('LK', 'Sri Lanka', 'ext-iso3166'),
202 ('LR', 'Liberia', 'ext-iso3166'),
203 ('LS', 'Lesotho', 'ext-iso3166'),
204 ('LT', 'Litauen', 'ext-iso3166'),
205 ('LU', 'Luxemburg', 'ext-iso3166'),
206 ('LV', 'Lettland', 'ext-iso3166'),
207 ('LY', 'Libyen', 'ext-iso3166'),
208 ('MA', 'Marokko', 'ext-iso3166'),
209 ('MC', 'Monaco', 'ext-iso3166'),
210 ('MD', 'Moldavien', 'ext-iso3166'),
211 ('MG', 'Madagaskar', 'ext-iso3166'),
212 ('MH', 'Marshall-Inseln', 'ext-iso3166'),
213 ('MK', 'Mazedonien', 'ext-iso3166'),
214 ('ML', 'Mali', 'ext-iso3166'),
215 ('MM', 'Myanmar', 'ext-iso3166'),
216 ('MN', 'Mongolei', 'ext-iso3166'),
217 ('MO', 'Macao', 'ext-iso3166'),
218 ('MP', 'Marianen', 'ext-iso3166'),
219 ('MQ', 'Martinique', 'ext-iso3166'),
220 ('MR', 'Mauretanien', 'ext-iso3166'),
221 ('MS', 'Montserrat', 'ext-iso3166'),
222 ('MT', 'Malta', 'ext-iso3166'),
223 ('MU', 'Mauritius', 'ext-iso3166'),
224 ('MV', 'Malediven', 'ext-iso3166'),
225 ('MW', 'Malawi', 'ext-iso3166'),
226 ('MX', 'Mexiko', 'ext-iso3166'),
227 ('MY', 'Malaysia', 'ext-iso3166'),
228 ('MZ', 'Mocambique', 'ext-iso3166'),
229 ('NA', 'Namibia', 'ext-iso3166'),
230 ('NC', 'Neukaledonien', 'ext-iso3166'),
231 ('NE', 'Niger', 'ext-iso3166'),
232 ('NF', 'Norfolk-Inseln', 'ext-iso3166'),
233 ('NG', 'Nigeria', 'ext-iso3166'),
234 ('NI', 'Nicaragua', 'ext-iso3166'),
235 ('NL', 'Niederlande', 'ext-iso3166'),
236 ('NO', 'Norwegen', 'ext-iso3166'),
237 ('NP', 'Nepal', 'ext-iso3166'),
238 ('NR', 'Nauru', 'ext-iso3166'),
239 ('NU', 'Niue', 'ext-iso3166'),
240 ('NZ', 'Neuseeland', 'ext-iso3166'),
241 ('OM', 'Oman', 'ext-iso3166'),
242 ('PA', 'Panama', 'ext-iso3166'),
243 ('PE', 'Peru', 'ext-iso3166'),
244 ('PF', 'Franz&ouml;sisch-Polynesien', 'ext-iso3166'),
245 ('PG', 'Papua Neuguinea', 'ext-iso3166'),
246 ('PH', 'Philippinen', 'ext-iso3166'),
247 ('PK', 'Pakistan', 'ext-iso3166'),
248 ('PL', 'Polen', 'ext-iso3166'),
249 ('PM', 'St. Pierre und Miquelon', 'ext-iso3166'),
250 ('PN', 'Pitcairn', 'ext-iso3166'),
251 ('PR', 'Puerto Rico', 'ext-iso3166'),
252 ('PS', 'Pal&auml;stinensische Selbstverwaltungsgebiete', 'ext-iso3166'),
253 ('PT', 'Portugal', 'ext-iso3166'),
254 ('PW', 'Palau', 'ext-iso3166'),
255 ('PY', 'Paraguay', 'ext-iso3166'),
256 ('QA', 'Qatar', 'ext-iso3166'),
257 ('RE', 'Reunion', 'ext-iso3166'),
258 ('RO', 'Rum&auml;nien', 'ext-iso3166'),
259 ('RU', 'Russland', 'ext-iso3166'),
260 ('RW', 'Ruanda', 'ext-iso3166'),
261 ('SA', 'Saudi-Arabien', 'ext-iso3166'),
262 ('SB', 'Solomon-Inseln', 'ext-iso3166'),
263 ('SC', 'Seychellen', 'ext-iso3166'),
264 ('SD', 'Sudan', 'ext-iso3166'),
265 ('SE', 'Schweden', 'ext-iso3166'),
266 ('SG', 'Singapur', 'ext-iso3166'),
267 ('SH', 'St. Helena', 'ext-iso3166'),
268 ('SI', 'Slowenien', 'ext-iso3166'),
269 ('SJ', 'Svalbard und Jan Mayen Islands', 'ext-iso3166'),
270 ('SK', 'Slowakei (Slowakische Republik)', 'ext-iso3166'),
271 ('SL', 'Sierra Leone', 'ext-iso3166'),
272 ('SM', 'San Marino', 'ext-iso3166'),
273 ('SN', 'Senegal', 'ext-iso3166'),
274 ('SO', 'Somalia', 'ext-iso3166'),
275 ('SR', 'Surinam', 'ext-iso3166'),
276 ('ST', 'Sao Tome', 'ext-iso3166'),
277 ('SU', 'Sowjetunion (obsolet)', 'ext-iso3166'),
278 ('SV', 'El Salvador', 'ext-iso3166'),
279 ('SY', 'Syrien', 'ext-iso3166'),
280 ('SZ', 'Swasiland', 'ext-iso3166'),
281 ('TC', 'Turks- und Kaikos-Inseln', 'ext-iso3166'),
282 ('TD', 'Tschad', 'ext-iso3166'),
283 ('TF', 'Franz&ouml;sisches S&uuml;d-Territorium', 'ext-iso3166'),
284 ('TG', 'Togo', 'ext-iso3166'),
285 ('TH', 'Thailand', 'ext-iso3166'),
286 ('TJ', 'Tadschikistan', 'ext-iso3166'),
287 ('TK', 'Tokelau', 'ext-iso3166'),
288 ('TL', 'Ost-Timor', 'ext-iso3166'),
289 ('TM', 'Turkmenistan', 'ext-iso3166'),
290 ('TN', 'Tunesien', 'ext-iso3166'),
291 ('TO', 'Tonga', 'ext-iso3166'),
292 ('TR', 'T&uuml;rkei', 'ext-iso3166'),
293 ('TT', 'Trinidad Tobago', 'ext-iso3166'),
294 ('TV', 'Tuvalu', 'ext-iso3166'),
295 ('TW', 'Taiwan', 'ext-iso3166'),
296 ('TZ', 'Tansania', 'ext-iso3166'),
297 ('UA', 'Ukraine', 'ext-iso3166'),
298 ('UG', 'Uganda', 'ext-iso3166'),
299 ('UK', 'Gro&szlig;britannien', 'ext-iso3166'),
300 ('UM', 'US- kleinere Inseln au&szlig;erhalb', 'ext-iso3166'),
301 ('US', 'Vereinigte Staaten von Amerika', 'ext-iso3166'),
302 ('UY', 'Uruguay', 'ext-iso3166'),
303 ('UZ', 'Usbekistan', 'ext-iso3166'),
304 ('VA', 'Vatikan', 'ext-iso3166'),
305 ('VC', 'St. Vincent', 'ext-iso3166'),
306 ('VE', 'Venezuela', 'ext-iso3166'),
307 ('VG', 'Virgin Island (Brit.)', 'ext-iso3166'),
308 ('VI', 'Virgin Island (USA)', 'ext-iso3166'),
309 ('VN', 'Vietnam', 'ext-iso3166'),
310 ('VU', 'Vanuatu', 'ext-iso3166'),
311 ('WF', 'Wallis et Futuna', 'ext-iso3166'),
312 ('WS', 'Samoa', 'ext-iso3166'),
313 ('YE', 'Jemen', 'ext-iso3166'),
314 ('YT', 'Mayotte', 'ext-iso3166'),
315 ('YU', 'Jugoslawien (obsolet)', 'ext-iso3166'),
316 ('ZA', 'S&uuml;dafrika', 'ext-iso3166'),
317 ('ZM', 'Sambia', 'ext-iso3166'),
318 ('ZW', 'Zimbabwe', 'ext-iso3166');";
319
320                 // This extension depends on the country extension
321                 $EXT_UPDATE_DEPENDS = "country";
322
323                 // Update notes (these will be set as task text!)
324                 $UPDATE_NOTES = "Erste Liste von 243 L&auml;ndercodes nach ISO 3166. (Quelle: Selfhtml)<br>Alle L&auml;nder sind zuerst deaktiviert. Achtung DE k&ouml;nnte doppelt vorkommen.<br>Ein Aktivieren/Deaktivieren l&auml;sst alle L&auml;nder beim Registrieren anzeigen oder nicht Anzeigen.";
325                 break;
326
327         }
328         break;
329
330 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
331         break;
332
333 default: // Do stuff when extension is loaded
334         break;
335 }
336
337 // [EOF]
338 ?>