Previous fix fixed, a lot constants rewritten (unfinished)
[mailer.git] / inc / extensions / ext-theme.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 03/22/2004 *
4  * ================                             Last change: 06/28/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-theme.php                                    *
8  * -------------------------------------------------------------------- *
9  * Short description : Theme Management                                 *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Theme-Management                                 *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Version number
41 $EXT_VERSION = "0.0.8";
42
43 // Auto-set extension version
44 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
45
46 // Version history array (add more with , "0.1" and so on)
47 $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", "0.0.8");
48
49 switch ($EXT_LOAD_MODE)
50 {
51 case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
52         // SQL commands to run
53         break;
54
55 case "remove": // Do stuff when removing extension
56         // Drop theme table
57         $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_themes`";
58
59         // Delete admin menu
60         $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='theme' LIMIT 4";
61
62         // Delete guest menu entries
63         $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE action='themes' LIMIT 1";
64
65         // Delete member menu entries
66         $SQLs[] = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE action='themes' OR `what`='themes' LIMIT 2";
67         break;
68
69 case "activate": // Do stuff when admin activates this extension
70         // SQL commands to run
71         $SQLs[] = "";
72         break;
73
74 case "deactivate": // Do stuff when admin deactivates this extension
75         // SQL commands to run
76         $SQLs[] = "";
77         break;
78
79 case "update": // Update an extension
80         switch ($EXT_VER)
81         {
82         case "0.0.1": // SQL queries for v0.0.1
83                 // Update notes (these will be set as task text!)
84                 $UPDATE_NOTES = "HTML-Code f&uuml;r ein Zeilen-Template ausgelagert.";
85                 break;
86
87         case "0.0.2": // SQL queries for v0.0.2
88                 // Update notes (these will be set as task text!)
89                 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
90                 break;
91
92         case "0.0.3": // SQL queries for v0.0.3
93                 // Update notes (these will be set as task text!)
94                 $UPDATE_NOTES = "Im Men&uuml;punkt &quot;Pr&uuml;fen&quot; wurden die bereits installierten und auch aktuellen Themes nicht ausgeblendet.";
95                 break;
96
97         case "0.0.4": // SQL queries for v0.0.4
98                 // Update notes (these will be set as task text!)
99                 $UPDATE_NOTES = "Sicherheitsupdate f&uuml;r die Include-Befehle.";
100                 break;
101
102         case "0.0.5": // SQL queries for v0.0.5
103                 // Update notes (these will be set as task text!)
104                 $UPDATE_NOTES = "<strong>set_session()</strong> mit @-Zeichen gegen ungewollte Ausgaben abgesichert.";
105                 break;
106
107         case "0.0.6": // SQL queries for v0.0.6
108                 // Update notes (these will be set as task text!)
109                 $UPDATE_NOTES = "Variablen-Handling skriptglobal ge&auml;ndert.";
110                 break;
111
112         case "0.0.7": // SQL queries for v0.0.7
113                 // Update notes (these will be set as task text!)
114                 $UPDATE_NOTES = "Ung&uuml;ltiges Update.";
115                 break;
116
117         case "0.0.8": // SQL queries for v0.0.8
118                 // Theme table
119                 $SQLs[] = "DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_themes`";
120                 $SQLs[] = "CREATE TABLE `{!_MYSQL_PREFIX!}_themes` (
121 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
122 theme_path VARCHAR(255) NOT NULL DEFAULT '',
123 theme_name VARCHAR(255) NOT NULL DEFAULT '',
124 theme_active ENUM('Y','N') NOT NULL DEFAULT 'N',
125 theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0',
126 PRIMARY KEY (`id`),
127 UNIQUE KEY (`theme_path`),
128 INDEX (`theme_active`)
129 ) TYPE=MyISAM COMMENT='Themes'";
130
131                 // Admin menu
132                 $SQLs[] = "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)";
133                 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis &quot;theme&quot; nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)";
134                 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)";
135                 $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)";
136
137                 // Guest menu
138                 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')";
139
140                 // Memember menu
141                 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')";
142                 $SQLs[] = "INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')";
143                 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort='8' WHERE action='themes' LIMIT 1";
144                 $SQLs[] = "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET action='account', sort='1', title='Designs' WHERE `what`='themes' LIMIT 1";
145
146                 // User data
147                 $SQLs[] = "ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'";
148
149                 // Update notes (these will be set as task text!)
150                 $UPDATE_NOTES = "Update von <u>sql_patches</u> &uuml;bertragen. (Kann Fehlermeldungen verursacht haben!)";
151                 break;
152         }
153         break;
154
155 case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
156         break;
157
158 default: // Do stuff when extension is loaded
159         break;
160 }
161
162 //
163 ?>