bb576451e732694580d0d077f50e28c32b104473
[mailer.git] / inc / extensions / ext-birthday.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 05/23/2004 *
4  * ================                             Last change: 06/26/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-birthday.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : Sends out happy-birthday mails                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Versendet Geburtstagsmails an die Mitglieder     *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 }
43
44 // Version number
45 setThisExtensionVersion('0.3.9');
46
47 // Version history array (add more with , '0.1.0' and so on)
48 setExtensionVersionHistory(array('0.0', '0.1.0', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9'));
49
50 switch (getExtensionMode()) {
51         case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
52                 // SQL commands to run
53                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD birthday_sent VARCHAR(10) NOT NULL DEFAULT 0");
54                 break;
55
56         case 'remove': // Do stuff when removing extension
57                 // SQL commands to run
58                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP birthday_sent");
59                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_birthday`");
60                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_birthday'");
61                 break;
62
63         case 'activate': // Do stuff when admin activates this extension
64                 // SQL commands to run
65                 addExtensionSql('');
66                 break;
67
68         case 'deactivate': // Do stuff when admin deactivates this extension
69                 // SQL commands to run
70                 addExtensionSql('');
71                 break;
72
73         case 'update': // Update an extension
74                 switch (getCurrentExtensionVersion()) {
75                         case '0.1.0': // SQL queries for v0.1
76                                 // Update notes (these will be set as task text!)
77                                 setExtensionUpdateNotes("Wenn t&auml;glicher Reset war, wird eine ben&ouml;tigte Include-Datei nicht mehr von daily-reset.php eingebunden, sondern von der Erweiterungsdatei selber.");
78                                 break;
79
80                         case '0.2.0': // SQL queries for v0.2
81                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD birthday_points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
82                                 addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_user_birthday`");
83                                 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_user_birthday` (
84 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
85 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
86 points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
87 chk_value VARCHAR(255) NOT NULL DEFAULT '',
88 KEY (userid),
89 PRIMARY KEY (id)
90 ) Type={?_TABLE_TYPE?}");
91                                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_birthday','Geburtstagsmails','Stellen Sie hier ein, ob die Mitglieder {?POINTS?} (nicht automatisch) gutgeschrieben kommen sollen oder nicht.', 9)");
92
93                                 // Update notes (these will be set as task text!)
94                                 setExtensionUpdateNotes("Es kann nun eine Gutschrift an die Geburtstagmail angeh&auml;ngt werden. Diese wird erst beim Klick auf einen Best&auml;tigungslink gutgeschrieben.");
95                                 break;
96
97                         case '0.2.1': // SQL queries for v0.2.1
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Abstand zwischen ausgesendeter Geburtstagsmails auf 364 Tage erh&ouml;ht.");
100                                 break;
101
102                         case '0.2.4': // SQL queries for v0.2.4
103                                 // Update notes (these will be set as task text!)
104                                 setExtensionUpdateNotes("Laden der birthday_mails.php &quot;intelligenter&quot; per Datenfeld und Lade-Schleife in load_extensions.php realisiert.");
105                                 break;
106
107                         case '0.2.5': // SQL queries for v0.2.5
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
110                                 break;
111
112                         case '0.2.6': // SQL queries for v0.2.6
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Problem mit Speicherung der Einstellungen beseitigt.");
115                                 break;
116
117                         case '0.2.7': // SQL queries for v0.2.7
118                                 // Update notes (these will be set as task text!)
119                                 setExtensionUpdateNotes("Sicherheitsupdate am Script <u>birtday_confirm.php</u> durchgef&uuml;hrt.");
120                                 break;
121
122                         case '0.2.8': // SQL queries for v0.2.8
123                                 // Update notes (these will be set as task text!)
124                                 setExtensionUpdateNotes("Vergessenes <strong>_OB_CACHING</strong> gesetzt.");
125                                 break;
126
127                         case '0.2.9': // SQL queries for v0.2.9
128                                 // Update notes (these will be set as task text!)
129                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
130                                 break;
131
132                         case '0.3.0': // SQL queries for v0.3.0
133                                 // Update notes (these will be set as task text!)
134                                 setExtensionUpdateNotes("Ausgabe des generierten HTML-Codes nach <u>inc/footer.php</u> verlagert.");
135                                 break;
136
137                         case '0.3.1': // SQL queries for v0.3.1
138                                 // Update notes (these will be set as task text!)
139                                 setExtensionUpdateNotes("Wort <strong>Punkte</strong> dynamisiert.");
140                                 break;
141
142                         case '0.3.2': // SQL queries for v0.3.2
143                                 // Update notes (these will be set as task text!)
144                                 setExtensionUpdateNotes("Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.");
145                                 break;
146
147                         case '0.3.3': // SQL queries for v0.3.3
148                                 // Update notes (these will be set as task text!)
149                                 setExtensionUpdateNotes("Bitte verschieben Sie die birthday-Templates (Ordner: {?PATH?}/templates/".getLanguage()."/html/) in den neuen Order birthday!");
150                                 break;
151
152                         case '0.3.4': // SQL queries for v0.3.4
153                                 // Update notes (these will be set as task text!)
154                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
155                                 break;
156
157                         case '0.3.5': // SQL queries for v0.3.5
158                                 // Update notes (these will be set as task text!)
159                                 setExtensionUpdateNotes("Vorbereitung auf die neue Mediendaten v0.0.4.");
160                                 break;
161
162                         case '0.3.6': // SQL queries for v0.3.6
163                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD birthday_mode ENUM('DIRECT','REF') NOT NULL DEFAULT 'DIRECT'");
164                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD birthday_active ENUM('Y','N') NOT NULL DEFAULT 'N'");
165
166                                 // Update notes (these will be set as task text!)
167                                 setExtensionUpdateNotes("Verg&uuml;tungsmodus des Geburtstagsbonus einstellbar.");
168                                 break;
169
170                         case '0.3.7': // SQL queries for v0.3.7
171                                 // Update notes (these will be set as task text!)
172                                 setExtensionUpdateNotes("Im Script <strong>inc/birthday_mails.php</strong> hat sich ein Zeichen mit dem Code 160 eingeschlichen, welches einen <strong>Parser Error</strong> verursachte, aber wie eine gew&ouml;hnliche Leerstelle aussah.");
173                                 break;
174
175                         case '0.3.8': // SQL queries for v0.3.8
176                                 // Update notes (these will be set as task text!)
177                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.");
178                                 break;
179
180                         case '0.3.9': // SQL queries for v0.3.9
181                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `birth_day` `birth_day` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
182 CHANGE `birth_month` `birth_month` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
183 CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 1970");
184
185                                 // Update notes (these will be set as task text!)
186                                 setExtensionUpdateNotes("Datenbankspalten umgestellt auf SMALLINT() UNSIGNED ZEROFILL.");
187                                 break;
188                 }
189                 break;
190
191         case 'modify': // When the extension got modified
192                 break;
193
194         case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
195                 break;
196
197         case 'init': // Do stuff when extension is initialized
198                 break;
199
200         default: // Unknown extension mode
201                 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
202                 break;
203 }
204
205 // [EOF]
206 ?>