0bcac1b6b73a53666a3d578699df06e74de59175
[mailer.git] / inc / extensions / ext-user.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/29/2004 *
4  * ===================                          Last change: 10/29/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-user.php                                     *
8  * -------------------------------------------------------------------- *
9  * Short description : Swapped out user management                      *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ausgelagertes Mitglieder-Management              *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version number
44 setThisExtensionVersion('0.3.9');
45
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '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'));
48
49 // Keep this extension always active!
50 setExtensionAlwaysActive('Y');
51
52 switch (getExtensionMode()) {
53         case 'register': // Do stuff when installation is running
54                 addDropTableSql('user_cats');
55                 addCreateTableSql('user_cats', "(
56 `id` BIGINT(22) NOT NULL AUTO_INCREMENT,
57 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
58 `cat_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
59 PRIMARY KEY (`id`),
60 INDEX (`userid`),
61 INDEX (`cat_id`)
62 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'User->category connection data'");
63
64                 addDropTableSql('user_data');
65                 addCreateTableSql('user_data', "(
66 `userid` BIGINT(22) NOT NULL AUTO_INCREMENT,
67 `surname` VARCHAR(255) NOT NULL DEFAULT '',
68 `family` VARCHAR(255) NOT NULL DEFAULT '',
69 `street_nr` VARCHAR(255) NOT NULL DEFAULT '',
70 `country` VARCHAR(4) NOT NULL DEFAULT '',
71 `zip` VARCHAR(6) NOT NULL DEFAULT '',
72 `city` VARCHAR(255) NOT NULL DEFAULT '',
73 `email` VARCHAR(255) NOT NULL DEFAULT '',
74 `birth_day` CHAR(2) NOT NULL DEFAULT '01',
75 `birth_month` CHAR(2) NOT NULL DEFAULT '01',
76 `birth_year` VARCHAR(4) NOT NULL DEFAULT '1970',
77 `password` VARCHAR(255) NOT NULL DEFAULT '',
78 `max_mails` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
79 `receive_mails` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
80 `refid` BIGINT(22) NOT NULL DEFAULT 0,
81 `status` ENUM('UNCONFIRMED','CONFIRMED','LOCKED') NOT NULL DEFAULT 'UNCONFIRMED',
82 `user_hash` VARCHAR(255) NULL DEFAULT NULL,
83 `REMOTE_ADDR` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
84 `last_online` VARCHAR(10) NOT NULL DEFAULT 0,
85 `last_module` VARCHAR(255) NOT NULL DEFAULT '',
86 `ref_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
87 `total_logins` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
88 `gender` ENUM('M','F') NOT NULL DEFAULT 'M',
89 `used_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
90 `emails_sent` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
91 `joined` VARCHAR(10) NOT NULL DEFAULT 0,
92 `last_update` VARCHAR(10) NOT NULL DEFAULT 0,
93 `last_profile_sent` VARCHAR(10) NOT NULL DEFAULT 0,
94 `notified` ENUM('Y','N') NOT NULL DEFAULT 'N',
95 `ref_payout` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
96 `last_login` VARCHAR(10) NOT NULL DEFAULT 0,
97 `login_failures` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
98 `last_failure` TIMESTAMP NULL DEFAULT NULL,
99 PRIMARY KEY (`userid`),
100 UNIQUE (`user_hash`),
101 INDEX (`refid`),
102 INDEX `status_mails` (`status`,`max_mails`)
103 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Main user data'");
104
105                 addDropTableSql('user_points');
106                 addCreateTableSql('user_points', "(
107 `id` BIGINT(22) NOT NULL AUTO_INCREMENT,
108 `userid` BIGINT(22) NOT NULL DEFAULT 0,
109 `ref_depth` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
110 `points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
111 `locked_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
112 PRIMARY KEY (`id`),
113 INDEX (`userid`)
114 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'User points (no used points)'");
115
116                 addDropTableSql('user_links');
117                 addCreateTableSql('user_links', "(
118 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
119 `stats_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
120 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
121 `link_type` ENUM('NORMAL') NOT NULL DEFAULT 'NORMAL',
122 PRIMARY KEY (`id`),
123 INDEX (`userid`),
124 INDEX (`stats_id`)
125 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Unconfirmed mails per user'");
126
127                 addDropTableSql('user_stats');
128                 addCreateTableSql('user_stats', "(
129 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
130 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
131 `cat_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
132 `payment_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
133 `subject` VARCHAR(200) NOT NULL DEFAULT '',
134 `url` TINYTEXT NOT NULL,
135 `max_rec` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
136 `clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
137 `timestamp_ordered` VARCHAR(10) NOT NULL DEFAULT '',
138 `pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
139 `timestamp_sstart` VARCHAR(10) NOT NULL DEFAULT '',
140 `timestamp_send` VARCHAR(10) NOT NULL DEFAULT '',
141 `is_stats` ENUM('Y','N') NOT NULL DEFAULT 'N',
142 PRIMARY KEY (`id`),
143 INDEX (`userid`),
144 INDEX (`cat_id`),
145 INDEX (`payment_id`),
146 INDEX (`pool_id`)
147 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Mail statistics per user order'");
148
149                 addDropTableSql('user_stats_data');
150                 addCreateTableSql('user_stats_data', "(
151 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
152 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
153 `stats_type` VARCHAR(255) NOT NULL DEFAULT 'unknown',
154 `stats_data` VARCHAR(255) NOT NULL DEFAULT '',
155 `inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
156 PRIMARY KEY (`id`),
157 INDEX (`userid`),
158 INDEX (`stats_type`)
159 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Member statistics data'");
160
161                 // Admin menu
162                 addAdminMenuSql('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {OPEN_CONFIG}POINTS{CLOSE_CONFIG} gutschreiben und abziehen und und und...',3);
163                 addAdminMenuSql('user','del_user','Mitglied l&ouml;schen','L&ouml;schen Sie hier Mitglied, die gegen die AGBs mehrmals verstossen haben. Bitte seien Sie nett zu Ihren Mitgliedern und l&ouml;schen Sie nicht gleich.',1);
164                 addAdminMenuSql('user','chk_regs','Anmeldungen pr&uuml;fen','Pr&uuml;fen Sie hier neue Anmeldungen zu Ihrem System. Hier k&ouml;nnen Sie im Falle einer Fehler-Mail den Mitglied gleich wieder l&ouml;schen!',2);
165                 addAdminMenuSql('user','lock_user','Mitglied sperren / entsperren','Sperren Sie Mitglied, die zu viele unbest&auml;tigte Mails haben oder gegen Ihre AGBs verstossen haben &uuml;ber diesen Men&uuml;punkt.',3);
166                 addAdminMenuSql('user','list_user','Mitglied auflisten','Listen Sie alle Mitglied oder eingeschr&auml;nkt nach Suchkritieren Ihre Userdatenbank auf. Sie k&ouml;nen per Klick auf die Usernummer sich Details zum Mitglied ansehen.',4);
167                 addAdminMenuSql('user','add_points','{OPEN_CONFIG}POINTS{CLOSE_CONFIG} gutschreiben','Buchen Sie einem Mitglied direkt {OPEN_CONFIG}POINTS{CLOSE_CONFIG} auf. Sie k&ouml;nnen dazu auch einen Kommentar mitsenden.',5);
168                 addAdminMenuSql('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes &auml;ndern.',6);
169                 addAdminMenuSql('user','list_refs','Referals anzeigen','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die generierten Referals eines Mitgliedes auflisten.',7);
170                 addAdminMenuSql('user','list_links','Unbest&auml;tigte Mails','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die vom Mitglied nicht best&auml;tigten Mails anzeigen.',8);
171                 addAdminMenuSql('user','list_cats','Kategorien anzeigen','Listet die ausgew&auml;hlten Kategorien eines Mitgliedes auf.',9);
172                 break;
173
174         case 'remove': // Do stuff when removing extension
175                 // SQL commands to run
176                 addDropTableSql('user_del');
177                 addDropTableSql('user_cats');
178                 addDropTableSql('user_data');
179                 addDropTableSql('user_points');
180                 addDropTableSql('user_links');
181                 addDropTableSql('user_stats');
182                 addDropTableSql('user_stats_data');
183                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'");
184
185                 // Register new filters for gathering points
186                 unregisterFilter(__FUNCTION__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun());
187                 unregisterFilter(__FUNCTION__, __LINE__, 'get_own_points', 'USER_POINTS', true, isExtensionDryRun());
188                 break;
189
190         case 'activate': // Do stuff when admin activates this extension
191                 // SQL commands to run
192                 addExtensionSql('');
193                 break;
194
195         case 'deactivate': // Do stuff when admin deactivates this extension
196                 // SQL commands to run
197                 addExtensionSql('');
198                 break;
199
200         case 'update': // Update an extension
201                 switch (getCurrentExtensionVersion()) {
202                         case '0.1.0': // SQL queries for v0.1
203                                 addConfigAddSql('user_limit', 'INT(7) UNSIGNED NOT NULL DEFAULT 20');
204
205                                 // Update notes (these will be set as task text!)
206                                 setExtensionUpdateNotes("Seitenweises Anzeigen der User-Liste ist nun m&ouml;glich.");
207                                 break;
208
209                         case '0.1.1': // SQL queries for v0.1.1
210                                 // This update depends on sql_patches update!
211                                 addExtensionDependency('sql_patches');
212
213                                 // Update notes (these will be set as task text!)
214                                 setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
215                                 break;
216
217                         case '0.1.2': // SQL queries for v0.1.2
218                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mails_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
219
220                                 // Update notes (these will be set as task text!)
221                                 setExtensionUpdateNotes("Dem Mitglied wird nun angezeigt, wie viele Mails er best&auml;tigt hat. Alle vor dieser Version best. Mails werden leider nicht mehr ber&uuml;cksichtigt! Bitte teilen Sie dies Ihren Mitgliedern mit.");
222                                 break;
223
224                         case '0.1.3': // SQL queries for v0.1.3
225                                 // Update notes (these will be set as task text!)
226                                 setExtensionUpdateNotes("Den Pfad <em>Sie sind hier</em> im Men&uuml;punkt <u>Online-Liste</u> erweitert.");
227                                 break;
228
229                         case '0.1.4': // SQL queries for v0.1.4
230                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `emails_received` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
231
232                                 // Update notes (these will be set as task text!)
233                                 setExtensionUpdateNotes("Anzahl empfangener Mails wird angezeigt. <big>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {?mt_word?} haben sollen!</big>");
234                                 break;
235
236                         case '0.1.5': // SQL queries for v0.1.5
237                                 // Update notes (these will be set as task text!)
238                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
239                                 break;
240
241                         case '0.1.6': // SQL queries for v0.1.6
242                                 // Update notes (these will be set as task text!)
243                                 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
244                                 break;
245
246                         case '0.1.7': // SQL queries for v0.1.7
247                                 // Update notes (these will be set as task text!)
248                                 setExtensionUpdateNotes("Erweiterung bleibt wegen integrierten Schalters immer aktiv.");
249                                 break;
250
251                         case '0.1.8': // SQL queries for v0.1.8
252                                 // Update notes (these will be set as task text!)
253                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
254                                 break;
255
256                         case '0.1.9': // SQL queries for v0.1.9
257                                 // Update notes (these will be set as task text!)
258                                 setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
259                                 break;
260
261                         case '0.2.0': // SQL queries for v0.2.0
262                                 // Update notes (these will be set as task text!)
263                                 setExtensionUpdateNotes("User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.");
264                                 break;
265
266                         case '0.2.1': // SQL queries for v0.2.1
267                                 addConfigAddSql('user_alpha', 'TINYINT(3) UNSIGNED NOT NULL DEFAULT 10');
268                                 addAdminMenuSql('setup','config_user','Mitgliederliste','Anzahl Mitglieder pro Seite, Anzahl Buchstaben pro Zeile usw.', 8);
269
270                                 // Update notes (these will be set as task text!)
271                                 setExtensionUpdateNotes("User-Liste ist konfigurierbar: Anzahl Mitglieder pro Seite und Anzahl Buchstaben pro Zeile; Template-Fehler beseitigt.");
272                                 break;
273
274                         case '0.2.2': // SQL queries for v0.2.2
275                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `gender` `gender` ENUM('M','F','C') NOT NULL DEFAULT 'M'");
276
277                                 // Update notes (these will be set as task text!)
278                                 setExtensionUpdateNotes("Anrede &quot;Firma&quot; hinzugef&uuml;gt.");
279                                 break;
280
281                         case '0.2.3': // SQL queries for v0.2.3
282                                 // Update notes (these will be set as task text!)
283                                 setExtensionUpdateNotes("Datumsformat festgelegt auf ausf&uuml;hrlich.");
284                                 break;
285
286                         case '0.2.4': // SQL queries for v0.2.4
287                                 // Update notes (these will be set as task text!)
288                                 setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
289                                 break;
290
291                         case '0.2.5': // SQL queries for v0.2.5
292                                 // Update notes (these will be set as task text!)
293                                 setExtensionUpdateNotes("SQL-Anweisungen abgesichert.");
294                                 break;
295
296                         case '0.2.6': // SQL queries for v0.2.6
297                                 // Update notes (these will be set as task text!)
298                                 setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
299                                 break;
300
301                         case '0.2.7': // SQL queries for v0.2.7
302                                 // Update notes (these will be set as task text!)
303                                 setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
304                                 break;
305
306                         case '0.2.8': // SQL queries for v0.2.8
307                                 // Update notes (these will be set as task text!)
308                                 setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
309                                 break;
310
311                         case '0.2.9': // SQL queries for v0.2.9
312                                 addAdminMenuSql('user','user_contct','Mitglied kontaktieren','Kontaktieren Sie hier Ihre Mitglieder ganz direkt &uuml;ber ein Webformular. Sie brauchen somit kein EMail-Programm mehr starten!', 8);
313
314                                 // Update notes (these will be set as task text!)
315                                 setExtensionUpdateNotes("Admin-Kontaktformular hinzugef&uuml;gt.");
316                                 break;
317
318                         case '0.3.0': // SQL queries for v0.3.0
319                                 // Update notes (these will be set as task text!)
320                                 setExtensionUpdateNotes("Hash-Erstellung von <strong>md5()</strong> auf bessere Funktion <strong>generateHash()</strong> umgestellt.<br />Diverse Fixes f&uuml;r <em>0.2.1-Beta1</em> Release.");
321                                 break;
322
323                         case '0.3.1': // SQL queries for v0.3.1
324                                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title` = 'Mitglieder-Management' WHERE `action`='user' AND (`what`='' OR `what` IS NULL) LIMIT 1");
325
326                                 // Update notes (these will be set as task text!)
327                                 setExtensionUpdateNotes("Verwaltung auf Management umgestellt");
328                                 break;
329
330                         case '0.3.2': // SQL queries for v0.3.2
331                                 // Update notes (these will be set as task text!)
332                                 setExtensionUpdateNotes("PHP-Hinweis in Userauflistung gefixt (trat bei fehlender Erweiterung <span class=\"data\">ext-nickname</span> auf) und Darstellungsfehler von <strong>0.00000</strong> unbest&auml;tigten Mails gefixt.");
333                                 break;
334
335                         case '0.3.3': // SQL queries for v0.3.3
336                                 // Update notes (these will be set as task text!)
337                                 setExtensionUpdateNotes("Mitglieder sind nun per Formular kontaktierbar (es wird eine EMail versendet), gesperrte und best&auml;tigte Mitglieder-Accounts sind seperat oder gemeinsam auflistbar (seperat nur mit der Erweiterung <em>task</em>!)");
338                                 break;
339
340                         case '0.3.4': // SQL queries for v0.3.4
341                                 addConfigAddSql('select_user_zero_refid', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
342                                 addConfigAddSql('user_min_confirmed', 'SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10');
343                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
344
345                                 // Update notes (these will be set as task text!)
346                                 setExtensionUpdateNotes("Mitglieder werden per Zufall als Referal-Id ausgew&auml;hlt, die eine Mindestanzahl an best&auml;tigten Mails haben, wenn die Ref-Id 0 ist.");
347                                 break;
348
349                         case '0.3.5': // SQL queries for v0.3.5
350                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `lock_reason` TINYTEXT");
351                                 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
352                                 addConfigAddSql('user_delete_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 30));
353                                 addAdminMenuSql('user', 'list_user_del', 'L&ouml;schungen auflisten', 'Listet die L&ouml;schungen von Usern auf.', 9);
354                                 addDropTableSql('user_del');
355                                 addCreateTableSql('user_del', "(
356 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
357 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
358 `email` VARCHAR(255) NOT NULL DEFAULT '',
359 `surname` VARCHAR(255) NOT NULL DEFAULT '',
360 `family` VARCHAR(255) NOT NULL DEFAULT '',
361 `joined` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
362 `last_online` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
363 `del_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
364 `del_reason` TINYTEXT,
365 INDEX (`userid`),
366 PRIMARY KEY (`id`)
367 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'List of deleted users'");
368
369                                 // Update notes (these will be set as task text!)
370                                 setExtensionUpdateNotes("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
371                                 break;
372
373                         case '0.3.6': // SQL queries for v0.3.6
374                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` DROP INDEX `userid`');
375                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` ADD UNIQUE `userid_catid` ( `userid` , `cat_id` )');
376
377                                 // Update notes (these will be set as task text!)
378                                 setExtensionUpdateNotes("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
379                                 break;
380
381                         case '0.3.7': // SQL queries for v0.3.7
382                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `id` `id` BIGINT( 22 ) UNSIGNED NOT NULL AUTO_INCREMENT');
383                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
384                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `cat_id` `cat_id` TINYINT( 3 ) UNSIGNED NULL DEFAULT NULL');
385                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT');
386                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_del` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
387                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `stats_id` `stats_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
388                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
389                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `userid` `userid` BIGINT( 22 ) UNSIGNED NULL DEFAULT NULL');
390                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `ref_depth` `ref_depth` TINYINT( 3 ) UNSIGNED NULL DEFAULT NULL');
391                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
392                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `level` `level` SMALLINT( 6 ) UNSIGNED NULL DEFAULT NULL');
393                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `refid` `refid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
394                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
395                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `cat_id` `cat_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
396                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `payment_id` `payment_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
397                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `pool_id` `pool_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
398                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats_data` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
399
400                                 // Cleanup SQLs
401                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid` IS NULL OR `cat_id` IS NULL');
402                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_del` WHERE `userid` IS NULL');
403                                 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `stats_id`=NULL WHERE `stats_id`=0');
404                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid` IS NULL');
405                                 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `ref_depth`=NULL WHERE `ref_depth`=0');
406                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid` IS NULL');
407                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid` IS NULL OR `refid` IS NULL OR `level` IS NULL');
408                                 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `cat_id`=NULL WHERE `cat_id`=0');
409                                 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `payment_id`=NULL WHERE `payment_id`=0');
410                                 addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `pool_id`=NULL WHERE `pool_id`=0');
411                                 addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `userid` IS NULL');
412
413                                 // This update depends on ext-bonus
414                                 addExtensionDependency('bonus');
415
416                                 // Update notes (these will be set as task text!)
417                                 setExtensionUpdateNotes("NULL ist wichtiger als 0 und UNSIGNED auch.");
418                                 break;
419
420                         case '0.3.7': // SQL queries for v0.3.7
421                                 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `last_failure` `last_failure` TIMESTAMP NULL DEFAULT NULL');
422
423                                 // Update notes (these will be set as task text!)
424                                 setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern einfach NULL.");
425                                 break;
426
427                         case '0.3.8': // SQL queries for v0.3.8
428                                 // Update notes (these will be set as task text!)
429                                 setExtensionUpdateNotes("Update verschoben nach ext-order (da es Werbeguthaben ist und nichts mit dem Mitglied selbst zu tun hat).");
430                                 break;
431
432                         case '0.3.9': // SQL queries for v0.3.9
433                                 // Register new filters for gathering points
434                                 registerFilter(__FUNCTION__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun());
435                                 registerFilter(__FUNCTION__, __LINE__, 'get_own_points', 'USER_POINTS', true, isExtensionDryRun());
436
437                                 // Update notes (these will be set as task text!)
438                                 setExtensionUpdateNotes("Filter registriert, die das eigene {?POINTS?}-Guthaben des Mitgliedes zur&uuml;ckliefern.");
439                                 break;
440                 } // END - switch
441                 break;
442
443         case 'modify': // When the extension got modified
444                 break;
445
446         case 'test': // For testing purposes
447                 break;
448
449         case 'init': // Do stuff when extension is initialized
450                 break;
451
452         default: // Unknown extension mode
453                 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
454                 break;
455 } // END - switch
456
457 // [EOF]
458 ?>