2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 04/30/2005 *
4 * =================== Last change: 04/30/2005 *
6 * -------------------------------------------------------------------- *
7 * File : ext-country.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Country code management *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Laendercode-Management *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
45 setThisExtensionVersion('0.0.4');
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4'));
50 // Keep this extension always active!
51 setExtensionAlwaysActive('Y');
53 switch (getExtensionMode()) {
54 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
55 // SQL commands to run
56 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`");
57 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_countries` (
58 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
59 code CHAR(2) NOT NULL DEFAULT 'DE',
60 descr VARCHAR(255) NOT NULL DEFAULT 'Deutschland',
61 is_active ENUM('Y','N') NOT NULL DEFAULT 'N',
64 ) TYPE={?_TABLE_TYPE?}");
65 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (code, descr, is_active) VALUES ('DE','Deutschland','Y')");
68 addAdminMenuSql('country', NULL, 'Ländercodes verwalten','Stellen Sie hier Ländercodes ein, damit auch internationale Mitglieder sich zu Ihrem {?mt_word?} anmelden können.', 8);
69 addAdminMenuSql('country','list_country','Verwalten','Hinzufügen, Ändern und Löschen von Ländercodes.', 1);
71 // Add entry to user table
72 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD country_code BIGINT(20) UNSIGNED NOT NULL DEFAULT 1");
75 case 'remove': // Do stuff when removing extension
76 // SQL commands to run
77 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`");
78 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='country'");
81 case 'activate': // Do stuff when admin activates this extension
82 // SQL commands to run
86 case 'deactivate': // Do stuff when admin deactivates this extension
87 // SQL commands to run
91 case 'update': // Update an extension
92 switch (getCurrentExtensionVersion())
94 case '0.0.1': // SQL queries for v0.0.1
95 // Update notes (these will be set as task text!)
96 setExtensionUpdateNotes("SQL-Dateien hinzugefügt, die Sie mit z.B. phpMyAdmin einspielen können. (DOCS/country/README.de lesen!)");
99 case '0.0.2': // SQL queries for v0.0.2
100 // Update notes (these will be set as task text!)
101 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen geschützt.");
104 case '0.0.3': // SQL queries for v0.0.3
105 // Update notes (these will be set as task text!)
106 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
109 case '0.0.4': // SQL queries for v0.0.4
110 // Update notes (these will be set as task text!)
111 setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
116 case 'modify': // When the extension got modified
119 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
122 case 'init': // Do stuff when extension is initialized
125 default: // Unknown extension mode
126 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));