Marked some unfinished extensions as 'work-in-progress'
[mailer.git] / inc / extensions / ext-theme.php
index 95ef2185752ec60a56102b6e0c3ca8cca99fa03d..fbdd16955c0cf15375520b67ee4db87813f94500 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 03/22/2004 *
- * ================                             Last change: 06/28/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 03/22/2004 *
+ * ===================                          Last change: 06/28/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-theme.php                                    *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Theme-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.7";
-
-// Auto-set extension version
-if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
-
-// 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", "0.0.5", "0.0.6", "0.0.7");
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('theme','theme_check','Pr&uuml;fen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)";
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='theme_check' LIMIT 1";
-       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 = "HTML-Code f&uuml;r ein Zeilen-Template ausgelagert.";
-               break;
+setThisExtensionVersion('0.1.1');
 
-       case "0.0.2": // SQL queries for v0.0.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
-               break;
+// 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', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1'));
 
-       case "0.0.3": // SQL queries for v0.0.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Im Men&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.";
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
+               // SQL commands to run
                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 'remove': // Do stuff when removing extension
+               // Drop theme table
+               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
+
+               // Delete admin menu
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='theme'");
+
+               // Delete guest menu entries
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='themes'");
+
+               // Delete member menu entries
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='themes' OR `what`='themes'");
+
+               // Unregister filters
+               unregisterFilter('init', 'HANDLE_THEME_CHANGE', true, getExtensionDryRun());
+               unregisterFilter('member_login_check', 'SET_USERS_THEME', true, getExtensionDryRun());
                break;
 
-       case "0.0.5": // SQL queries for v0.0.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "<STRONG>set_session()</STRONG> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.";
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.0.6": // SQL queries for v0.0.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Variablen-Handling skriptglobal ge&auml;ndert.";
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.0.7": // SQL queries for v0.0.7
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD theme_name VARCHAR(255) NOT NULL DEFAULT ''";
+       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("HTML-Code f&uuml;r ein Zeilen-Template ausgelagert.");
+                               break;
+
+                       case '0.0.2': // SQL queries for v0.0.2
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
+
+                       case '0.0.3': // SQL queries for v0.0.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Im Men&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.");
+                               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;
+
+                       case '0.0.5': // SQL queries for v0.0.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("<strong>setSession()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
+                               break;
+
+                       case '0.0.6': // SQL queries for v0.0.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Variablen-Handling scripteweit ge&auml;ndert.");
+                               break;
+
+                       case '0.0.7': // SQL queries for v0.0.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
+                               break;
+
+                       case '0.0.8': // SQL queries for v0.0.8
+                               // Theme table
+                               addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_themes`");
+                               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_themes` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`theme_path` VARCHAR(255) NOT NULL DEFAULT '',
+`theme_name` VARCHAR(255) NOT NULL DEFAULT '',
+`theme_active` ENUM('Y','N') NOT NULL DEFAULT 'N',
+`theme_ver` VARCHAR(255) NOT NULL DEFAULT '0.0',
+PRIMARY KEY (`id`),
+UNIQUE KEY (`theme_path`),
+INDEX (`theme_active`)
+) TYPE={?_TABLE_TYPE?} COMMENT='Themes'");
+
+                               // Admin menu
+                               addAdminMenuSql('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres {?mt_word2?}.', 8);
+                               addAdminMenuSql('theme','theme_import','Importieren','Es wird das Verzeichnis &quot;theme&quot; nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1);
+                               addAdminMenuSql('theme','theme_edit','Modifizieren','&Auml;ndern Sie Titel, Freigaben usw. an den Themes. Sie k&ouml;nnen bis auf das Standart-Theme &quot;default&quot; auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server l&ouml;schen, damit es niht erneut importiert werden kann.', 2);
+                               addAdminMenuSql('theme','theme_check','Pr&uuml;fen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3);
+
+                               // Guest menu
+                               addGuestMenuSql('themes',NULL,'Design-Auswahl','Y','N',4);
+
+                               // Memember menu
+                               addMemberMenuSql('themes',NULL,'Design-Auswahl','N','Y',3);
+                               addMemberMenuSql('main','themes','Designs','N','Y',6);
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=8 WHERE `action`='themes' LIMIT 1");
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `action`='account', `sort`=1, `title`='Designs' WHERE `what`='themes' LIMIT 1");
+
+                               // User data
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `curr_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Update von <u>sql_patches</u> &uuml;bertragen. (Kann Fehlermeldungen verursacht haben!)");
+                               break;
+
+                       case '0.0.9': // SQL queries for v0.0.9
+                               // Config SQL
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `default_theme` VARCHAR(255) NOT NULL DEFAULT 'default'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehlende Konfiguration hinzugef&uuml;gt.");
+                               break;
+
+                       case '0.1.0': // SQL queries for v0.1.0
+                               // Register filter
+                               registerFilter('init', 'HANDLE_THEME_CHANGE', false, true, getExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("&Auml;ndern des Designs nun im Filter (internes TODO).");
+                               break;
+
+                       case '0.1.1': // SQL queries for v0.1.1
+                               // Register filter
+                               registerFilter('member_login_check', 'SET_USERS_THEME', false, true, getExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Setzen des Mitgliedes&#39; eigener Design-Auswahl per Filter (internes TODO).");
+                               break;
+               } // END - switch
+               break;
 
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Designname (von Menschen lesbar) hinzugef&uuml;gt.";
+       case 'modify': // When the extension got modified
                break;
-       }
-       break;
 
-default: // Do stuff when extension is loaded
-       break;
-}
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+               break;
 
-// Language file prefix
-$EXT_LANG_PREFIX = "theme";
+       case 'init': // Do stuff when extension is initialized
+               break;
 
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "N";
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
+               break;
+} // END - switch
 
-//
+// [EOF]
 ?>