Marked some unfinished extensions as 'work-in-progress'
[mailer.git] / inc / extensions / ext-country.php
index 17bda731fe6301ef6692a55b673d700083e48f46..ef88cfb3b20a301403d596bdb551c6236c850747 100644 (file)
@@ -1,7 +1,7 @@
 <?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                                  *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Laendercode-Management                           *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $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                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 
 // 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_VERSION = "0.0.4";
+setThisExtensionVersion('0.0.4');
 
-// Auto-set extension version
-if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
+// Version history array (add more with , '0.1.0' and so on)
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4'));
 
-// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4");
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
 
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_countries";
-       $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_countries (
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+               // SQL commands to run
+               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`");
+               addExtensionSql("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=MyISAM";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_countries (code, descr, is_active) VALUES ('DE','Deutschland','Y')";
-
-       // Admin menu
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('country', NULL, 'L&auml;ndercodes verwalten','Stellen Sie hier L&auml;ndercodes ein, damit auch internationale Mitglieder sich zu Ihrem ".MT_WORD." anmelden k&ouml;nnen.', 8)";
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`descr`,`sort`) VALUES ('country','list_country','Verwalten','Hinzuf&uuml;gen, &Auml;ndern und L&ouml;schen von L&auml;ndercodes.', 1)";
-
-       // Add entry to user table
-       $SQLs[] = "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
-       $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_countries";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='country' LIMIT 2";
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.0.1": // SQL queries for v0.0.1
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "SQL-Dateien hinzugef&uuml;gt, die Sie mit z.B. phpMyAdmin einspielen k&ouml;nnen. (DOCS/country/README.de lesen!)";
+KEY (code),
+PRIMARY KEY (id)
+) TYPE={?_TABLE_TYPE?}");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (code, descr, is_active) VALUES ('DE','Deutschland','Y')");
+
+               // Admin menu
+               addAdminMenuSql('country', NULL, 'L&auml;ndercodes verwalten','Stellen Sie hier L&auml;ndercodes ein, damit auch internationale Mitglieder sich zu Ihrem {?mt_word?} anmelden k&ouml;nnen.', 8);
+               addAdminMenuSql('country','list_country','Verwalten','Hinzuf&uuml;gen, &Auml;ndern und L&ouml;schen von L&auml;ndercodes.', 1);
+
+               // Add entry to user table
+               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD country_code BIGINT(20) UNSIGNED NOT NULL DEFAULT 1");
                break;
 
-       case "0.0.2": // SQL queries for v0.0.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.";
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_countries`");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='country'");
                break;
 
-       case "0.0.3": // SQL queries for v0.0.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.0.4": // SQL queries for v0.0.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sicherheitsupdate f&uuml;r die Include-Befehle.";
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
-       }
-       break;
 
-default: // Do stuff when extension is loaded
-       break;
-}
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion())
+               {
+                       case '0.0.1': // SQL queries for v0.0.1
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("SQL-Dateien hinzugef&uuml;gt, die Sie mit z.B. phpMyAdmin einspielen k&ouml;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!)
+                               setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.");
+                               break;
+
+                       case '0.0.3': // SQL queries for v0.0.3
+                               // Update notes (these will be set as task text!)
+                               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!)
+                               setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
+                               break;
+               }
+               break;
 
-// Keep this extension always active!
-$EXT_ALWAYS_ACTIVE = "Y";
+       case 'modify': // When the extension got modified
+               break;
+
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+               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;
+}
 
 //
 ?>