* -------------------------------------------------------------------- *
* Kurzbeschreibung : Theme-Management *
* -------------------------------------------------------------------- *
- * $Revision:: 856 $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. March 2009) $ *
+ * $Revision:: $ *
+ * $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
- * $Author:: stelzi $ *
+ * $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 *
* 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_SET_VERSION("0.0.8");
-
-// Version history array (add more with , "0.1" and so on)
-EXT_SET_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", "0.0.8"));
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
- // SQL commands to run
- break;
-
-case "remove": // Do stuff when removing extension
- // Drop theme table
- ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_themes`");
-
- // Delete admin menu
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='theme' LIMIT 4");
-
- // Delete guest menu entries
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE `action`='themes' LIMIT 1");
-
- // Delete member menu entries
- ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='themes' OR `what`='themes' LIMIT 2");
- break;
-
-case "activate": // Do stuff when admin activates this extension
- // SQL commands to run
- ADD_SQL("");
- break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
- // SQL commands to run
- ADD_SQL("");
- 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!)
- EXT_SET_UPDATE_NOTES("HTML-Code für ein Zeilen-Template ausgelagert.");
- break;
+setThisExtensionVersion('0.0.9');
- case "0.0.2": // SQL queries for v0.0.2
- // Update notes (these will be set as task text!)
- EXT_SET_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'));
- case "0.0.3": // SQL queries for v0.0.3
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Im Menüpunkt "Prüfen" 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!)
- EXT_SET_UPDATE_NOTES("Sicherheitsupdate für die Include-Befehle.");
- break;
+ 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'");
- case "0.0.5": // SQL queries for v0.0.5
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("<strong>set_session()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.");
+ // 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'");
break;
- case "0.0.6": // SQL queries for v0.0.6
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Variablen-Handling skriptglobal geändert.");
+ case 'activate': // Do stuff when admin activates this extension
+ // SQL commands to run
+ addExtensionSql('');
break;
- case "0.0.7": // SQL queries for v0.0.7
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Ungültiges Update.");
+ case 'deactivate': // Do stuff when admin deactivates this extension
+ // SQL commands to run
+ addExtensionSql('');
break;
- case "0.0.8": // SQL queries for v0.0.8
- // Theme table
- ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_themes`");
- ADD_SQL("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',
+ 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ü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üpunkt "Prüfen" 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ü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ändert.");
+ break;
+
+ case '0.0.7': // SQL queries for v0.0.7
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Ungü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
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2)");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)");
-
- // Guest menu
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')");
-
- // Memember menu
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')");
- ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `sort`='8' WHERE `action`='themes' LIMIT 1");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='account', `sort`='1', `title`='Designs' WHERE `what`='themes' LIMIT 1");
-
- // User data
- ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'");
+) TYPE={?_TABLE_TYPE?} COMMENT='Themes'");
+
+ // Admin menu
+ addAdminMenuSql('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8);
+ addAdminMenuSql('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1);
+ addAdminMenuSql('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2);
+ addAdminMenuSql('theme','theme_check','Prü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> ü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ügt.");
+ break;
+ }
+ break;
- // Update notes (these will be set as task text!)
- EXT_SET_UPDATE_NOTES("Update von <u>sql_patches</u> übertragen. (Kann Fehlermeldungen verursacht haben!)");
+ case 'modify': // When the extension got modified
break;
- }
- break;
-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 "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: // Do stuff when extension is loaded
- break;
-}
+ default: // Unknown extension mode
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ break;
+} // END - swich
//
?>