<?php
/************************************************************************
- * MXChange v0.2.1 Start: 04/30/2005 *
- * ================ Last change: 04/30/2005 *
+ * Mailer v0.2.1-FINAL Start: 04/30/2005 *
+ * =================== Last change: 04/30/2005 *
* *
* -------------------------------------------------------------------- *
* File : ext-country.php *
* $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
* $Author:: $ *
- * Needs to be in all Files and every File needs "svn propset *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
- require($INC);
-}
+ die();
+} // END - if
// Version number
-EXT_SET_VERSION('0.0.4');
+setThisExtensionVersion('0.0.5');
-// Version history array (add more with , '0.1.0' and so on)
-EXT_SET_VER_HISTORY(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4'));
+// Version history array (add more with , '0.0.1' and so on)
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5'));
-switch ($EXT_LOAD_MODE)
-{
- case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
+
+switch (getExtensionMode()) {
+ case 'register': // Do stuff when installation is running
// SQL commands to run
- ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_countries`");
- ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_countries` (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-code CHAR(2) NOT NULL DEFAULT 'DE',
-descr VARCHAR(255) NOT NULL DEFAULT 'Deutschland',
-is_active ENUM('Y','N') NOT NULL DEFAULT 'N',
-KEY(code),
-PRIMARY KEY(id)
-) TYPE={!_TABLE_TYPE!}");
- ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_countries` (code, descr, is_active) VALUES ('DE','Deutschland','Y')");
+ addDropTableSql('countries');
+ addCreateTableSql('countries', "
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`code` CHAR(2) NOT NULL DEFAULT 'DE',
+`descr` VARCHAR(255) NOT NULL DEFAULT 'Deutschland',
+`is_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
+PRIMARY KEY (`id`),
+UNIQUE INDEX (`code`)",
+ 'Country codes and their full-length descriptions');
+
+ // Insert first (Germany) country
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (code, descr, is_active) VALUES ('DE','Deutschland','Y')");
// Admin menu
- ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('country', NULL, 'Ländercodes verwalten','Stellen Sie hier Ländercodes ein, damit auch internationale Mitglieder sich zu Ihrem {?MT_WORD?} anmelden können.', 8)");
- ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('country','list_country','Verwalten','Hinzufügen, Ändern und Löschen von Ländercodes.', 1)");
+ addAdminMenuSql('country', NULL, 'Ländercodes verwalten','Stellen Sie hier Ländercodes ein, damit auch internationale Mitglieder sich zu Ihrem {OPEN_CONFIG}mt_word{CLOSE_CONFIG} anmelden können.', 8);
+ addAdminMenuSql('country','list_country','Verwalten','Hinzufügen, Ändern und Löschen von Ländercodes.', 1);
+
+ // This extension depends on ext-user
+ addExtensionDependency('user');
// Add entry to user table
- ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD country_code BIGINT(20) UNSIGNED NOT NULL DEFAULT 1");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `country_code` BIGINT(20) UNSIGNED NOT NULL DEFAULT 1");
break;
case 'remove': // Do stuff when removing extension
// SQL commands to run
- ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_countries`");
- ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='country'");
+ addDropTableSql('countries');
+ addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='country'");
+
+ // Unregister filter
+ unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'COUNTRY_USER_REGISTRATION_ADD_SQL_COLUMNS', TRUE, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
// SQL commands to run
- ADD_EXT_SQL('');
+ addExtensionSql('');
break;
case 'deactivate': // Do stuff when admin deactivates this extension
// SQL commands to run
- ADD_EXT_SQL('');
+ addExtensionSql('');
break;
case 'update': // Update an extension
- switch ($EXT_VER)
- {
+ switch (getCurrentExtensionVersion()) {
case '0.0.1': // SQL queries for v0.0.1
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("SQL-Dateien hinzugefügt, die Sie mit z.B. phpMyAdmin einspielen können. (DOCS/country/README.de lesen!)");
+ setExtensionUpdateNotes("SQL-Dateien hinzugefügt, die Sie mit z.B. phpMyAdmin einspielen können. (DOCS/country/README.de lesen!)");
break;
case '0.0.2': // SQL queries for v0.0.2
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Sicherheitsupdate: SQL-Anweisungen geschützt.");
+ setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen geschützt.");
break;
case '0.0.3': // SQL queries for v0.0.3
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Abspeichern von Einstellungen repariert.");
+ setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
break;
case '0.0.4': // SQL queries for v0.0.4
// Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Sicherheitsupdate für die Include-Befehle.");
+ setExtensionUpdateNotes("Sicherheitsupdate für die Include-Befehle.");
break;
- }
- break;
- case 'modify': // When the extension got modified
- break;
+ case '0.0.5': // SQL queries for v0.0.5
+ // Register a filter
+ registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'COUNTRY_USER_REGISTRATION_ADD_SQL_COLUMNS', FALSE, TRUE, isExtensionDryRun());
- case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
- break;
+ // This depends on ext-register
+ addExtensionDependency('register');
- default: // Do stuff when extension is loaded
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Filter zum Mitgliederanmeldeformular hinzugefügt.");
break;
-}
+ } // END - switch
+ break;
-// Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE('Y');
+ case 'modify': // When the extension got modified
+ break;
+
+ case 'test': // For testing purposes
+ break;
+
+ case 'init': // Do stuff when extension is initialized
+ break;
+
+ default: // Unknown extension mode
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+ break;
+} // END - switch
-//
+// [EOF]
?>