293531b5ca7c551219153bd7820a04ac34033e25
[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  *                                                                      *
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.3.9";
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.1", "0.2", "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");
48
49 switch ($EXT_LOAD_MODE)
50 {
51 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
52         // SQL commands to run
53         $SQLs[] = "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         $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data DROP birthday_sent";
59         $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_birthday";
60         $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_birthday' LIMIT 1";
61         break;
62
63 case "activate": // Do stuff when admin activates this extension
64         // SQL commands to run
65         $SQLs[] = "";
66         break;
67
68 case "deactivate": // Do stuff when admin deactivates this extension
69         // SQL commands to run
70         $SQLs[] = "";
71         break;
72
73 case "update": // Update an extension
74         switch ($EXT_VER)
75         {
76         case "0.1": // SQL queries for v0.1
77                 // Update notes (these will be set as task text!)
78                 $UPDATE_NOTES = "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.";
79                 break;
80
81         case "0.2": // SQL queries for v0.2
82                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_points BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'";
83                 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_birthday";
84                 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_birthday (
85 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
86 userid BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
87 points BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
88 chk_value VARCHAR(255) NOT NULL DEFAULT '',
89 KEY(userid),
90 PRIMARY KEY(id)
91 ) Type=MyISAM";
92                 $SQLs[] = "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)";
93
94                 // Update notes (these will be set as task text!)
95                 $UPDATE_NOTES = "Es kann nun eine Gutschrift an die Geburtstagmail angeh&auml;ngt werden. Diese wird erst beim Klick auf einen Best&auml;tigungslink gutgeschrieben.";
96                 break;
97
98         case "0.2.1": // SQL queries for v0.2.1
99                 // Update notes (these will be set as task text!)
100                 $UPDATE_NOTES = "Abstand zwischen ausgesendeter Geburtstagsmails auf 364 Tage erh&ouml;ht.";
101                 break;
102
103         case "0.2.4": // SQL queries for v0.2.4
104                 // Update notes (these will be set as task text!)
105                 $UPDATE_NOTES = "Laden der birthday_mails.php &quot;intelligenter&quot; per Datenfeld und Lade-Schleife in load_extensions.php realisiert.";
106                 break;
107
108         case "0.2.5": // SQL queries for v0.2.5
109                 // Update notes (these will be set as task text!)
110                 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
111                 break;
112
113         case "0.2.6": // SQL queries for v0.2.6
114                 // Update notes (these will be set as task text!)
115                 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
116                 break;
117
118         case "0.2.7": // SQL queries for v0.2.7
119                 // Update notes (these will be set as task text!)
120                 $UPDATE_NOTES = "Sicherheitsupdate am Script <U>birtday_confirm.php</U> durchgef&uuml;hrt.";
121                 break;
122
123         case "0.2.8": // SQL queries for v0.2.8
124                 // Update notes (these will be set as task text!)
125                 $UPDATE_NOTES = "Vergessenes _OB_CACHING gesetzt.";
126                 break;
127
128         case "0.2.9": // SQL queries for v0.2.9
129                 // Update notes (these will be set as task text!)
130                 $UPDATE_NOTES = "Seit <A href=\"#\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
131                 break;
132
133         case "0.3.0": // SQL queries for v0.3.0
134                 // Update notes (these will be set as task text!)
135                 $UPDATE_NOTES = "Ausgabe des generierten HTML-Codes nach <U>inc/footer.php</U> verlagert.";
136                 break;
137
138         case "0.3.1": // SQL queries for v0.3.1
139                 // Update notes (these will be set as task text!)
140                 $UPDATE_NOTES = "Wort <STRONG>Punkte</STRONG> dynamisiert.";
141                 break;
142
143         case "0.3.2": // SQL queries for v0.3.2
144                 // Update notes (these will be set as task text!)
145                 $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen gesch&uuml;tzt.";
146                 break;
147
148         case "0.3.3": // SQL queries for v0.3.3
149                 // Update notes (these will be set as task text!)
150                 $UPDATE_NOTES = "Bitte verschieben Sie die birthday-Templates (Ordner: ".PATH."/templates/".GET_LANGUAGE()."/html/) in den neuen Order birthday!";
151                 break;
152
153         case "0.3.4": // SQL queries for v0.3.4
154                 // Update notes (these will be set as task text!)
155                 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
156                 break;
157
158         case "0.3.5": // SQL queries for v0.3.5
159                 // Update notes (these will be set as task text!)
160                 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
161                 break;
162
163         case "0.3.6": // SQL queries for v0.3.6
164                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_mode ENUM('DIRECT', 'REF') NOT NULL DEFAULT 'DIRECT'";
165                 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_active ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
166
167                 // Update notes (these will be set as task text!)
168                 $UPDATE_NOTES = "Verg&uuml;tungsmodus des Geburtstagsbonus einstellbar.";
169                 break;
170
171         case "0.3.7": // SQL queries for v0.3.7
172                 // Update notes (these will be set as task text!)
173                 $UPDATE_NOTES = "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.";
174                 break;
175
176         case "0.3.8": // SQL queries for v0.3.8
177                 // Update notes (these will be set as task text!)
178                 $UPDATE_NOTES = "Hash-Erstellung von <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> umgestellt.";
179                 break;
180
181         case "0.3.9": // SQL queries for v0.3.8
182                 $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE `birth_day` `birth_day` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
183 CHANGE `birth_month` `birth_month` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01',
184 CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT '1970'";
185
186                 // Update notes (these will be set as task text!)
187                 $UPDATE_NOTES = "Datenbankspalten umgestellt auf SMALLINT() UNSIGNED ZEROFILL.";
188                 break;
189         }
190         break;
191
192 default: // Do stuff when extension is loaded
193         if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) {
194                 // Daily reset was run and we shall pay points so we start checking for members who
195                 // has a birthday for today
196                 $INC_POOL[] = sprintf("%sinc/mails/birthday_mails.php", PATH);
197         }
198         break;
199 }
200
201 // Language file prefix
202 $EXT_LANG_PREFIX = "birthday";
203
204 // Extension is always active?
205 $EXT_ALWAYS_ACTIVE = "N";
206
207 //
208 ?>