2 /************************************************************************
3 * MXChange v0.2.1 Start: 05/23/2004 *
4 * ================ Last change: 06/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-birthday.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Sends out happy-birthday mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Versendet Geburtstagsmails an die Mitglieder *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42 $EXT_VERSION = "0.3.8";
44 // Auto-set extension version
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
47 // Version history array (add more with , "0.1" and so on)
48 $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");
50 switch ($EXT_LOAD_MODE)
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
53 // SQL commands to run
54 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD birthday_sent varchar(10) NOT NULL default '0'";
57 case "remove": // Do stuff when removing extension
58 // SQL commands to run
59 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data DROP birthday_sent";
60 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP birthday_points";
61 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_birthday";
62 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_birthday' LIMIT 1";
65 case "activate": // Do stuff when admin activates this extension
66 // SQL commands to run
70 case "deactivate": // Do stuff when admin deactivates this extension
71 // SQL commands to run
75 case "update": // Update an extension
78 case "0.1": // SQL queries for v0.1
79 // Update notes (these will be set as task text!)
80 $UPDATE_NOTES = "Wenn täglicher Reset war, wird eine benötigte Include-Datei nicht mehr von daily-reset.php eingebunden, sondern von der Erweiterungsdatei selber.";
83 case "0.2": // SQL queries for v0.2
84 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_points bigint(20) not null default '0'";
85 $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_birthday";
86 $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_user_birthday (
87 id bigint(20) not null auto_increment,
88 userid bigint(20) not null default '0',
89 points bigint(20) not null default '0',
90 chk_value varchar(255) not null default '',
94 $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)";
96 // Update notes (these will be set as task text!)
97 $UPDATE_NOTES = "Es kann nun eine Gutschrift an die Geburtstagmail angehängt werden. Diese wird erst beim Klick auf einen Bestätigungslink gutgeschrieben.";
100 case "0.2.1": // SQL queries for v0.2.1
101 // Update notes (these will be set as task text!)
102 $UPDATE_NOTES = "Abstand zwischen ausgesendeter Geburtstagsmails auf 364 Tage erhöht.";
105 case "0.2.4": // SQL queries for v0.2.4
106 // Update notes (these will be set as task text!)
107 $UPDATE_NOTES = "Laden der birthday_mails.php "intelligenter" per Datenfeld und Lade-Schleife in load_extensions.php realisiert.";
110 case "0.2.5": // SQL queries for v0.2.5
111 // Update notes (these will be set as task text!)
112 $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
115 case "0.2.6": // SQL queries for v0.2.6
116 // Update notes (these will be set as task text!)
117 $UPDATE_NOTES = "Problem mit Speicherung der Einstellungen beseitigt.";
120 case "0.2.7": // SQL queries for v0.2.7
121 // Update notes (these will be set as task text!)
122 $UPDATE_NOTES = "Sicherheitsupdate am Script <U>birtday_confirm.php</U> durchgeführt.";
125 case "0.2.8": // SQL queries for v0.2.8
126 // Update notes (these will be set as task text!)
127 $UPDATE_NOTES = "Vergessenes _OB_CACHING gesetzt.";
130 case "0.2.9": // SQL queries for v0.2.9
131 // Update notes (these will be set as task text!)
132 $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> überflüssige HTML-Tags entfernt.";
135 case "0.3.0": // SQL queries for v0.3.0
136 // Update notes (these will be set as task text!)
137 $UPDATE_NOTES = "Ausgabe des generierten HTML-Codes nach <U>inc/footer.php</U> verlagert.";
140 case "0.3.1": // SQL queries for v0.3.1
141 // Update notes (these will be set as task text!)
142 $UPDATE_NOTES = "Wort <STRONG>Punkte</STRONG> dynamisiert.";
145 case "0.3.2": // SQL queries for v0.3.2
146 // Update notes (these will be set as task text!)
147 $UPDATE_NOTES = "Sicherheitsupdate: SQL-Anweisungen geschützt.";
150 case "0.3.3": // SQL queries for v0.3.3
151 // Update notes (these will be set as task text!)
152 $UPDATE_NOTES = "Bitte verschieben Sie die birthday-Templates (Ordner: ".PATH."/templates/".GET_LANGUAGE()."/html/) in den neuen Order birthday!";
155 case "0.3.4": // SQL queries for v0.3.4
156 // Update notes (these will be set as task text!)
157 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
160 case "0.3.5": // SQL queries for v0.3.5
161 // Update notes (these will be set as task text!)
162 $UPDATE_NOTES = "Vorbereitung auf die neue Mediendaten v0.0.4.";
165 case "0.3.6": // SQL queries for v0.3.6
166 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_mode enum('DIRECT', 'REF') not null default 'DIRECT'";
167 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD birthday_active enum('Y', 'N') not null default 'N'";
169 // Update notes (these will be set as task text!)
170 $UPDATE_NOTES = "Vergütungsmodus des Geburtstagsbonus einstellbar.";
173 case "0.3.7": // SQL queries for v0.3.7
174 // Update notes (these will be set as task text!)
175 $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öhnliche Leerstelle aussah.";
178 case "0.3.8": // SQL queries for v0.3.8
179 // Update notes (these will be set as task text!)
180 $UPDATE_NOTES = "Hash-Erstellung von <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> umgestellt.";
185 default: // Do stuff when extension is loaded
186 $dummy = LOAD_CONFIG();
188 // Copy config to main array
189 $_CONFIG['birthday_points'] = $dummy['birthday_points'];
190 $_CONFIG['birthday_mode'] = $dummy['birthday_mode'];
191 $_CONFIG['birthday_active'] = $dummy['birthday_active'];
196 if ((defined('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0))
198 // Daily reset was run and we shall pay points so we start checking for members who
199 // has a birthday for today
200 $INC_POOL[] = PATH."inc/mails/birthday_mails.php";
205 // Language file prefix
206 $EXT_LANG_PREFIX = "birthday";
208 // Extension is always active?
209 $EXT_ALWAYS_ACTIVE = 'N';