Getting total/own points rewritten to filter:
[mailer.git] / inc / extensions / ext-user.php
index 9e311fb25a54cf422bf79dffe9f872f4247070cb..0bcac1b6b73a53666a3d578699df06e74de59175 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 04/29/2004 *
- * ================                             Last change: 10/29/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 04/29/2004 *
+ * ===================                          Last change: 10/29/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : ext-user.php                                     *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Ausgelagertes Mitglieder-Management              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
-{
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-}
+if (!defined('__SECURITY')) {
+       die();
+} // END - if
 
 // Version number
-$EXT_VERSION = "0.3.3";
-
-// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.1", "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");
-
-switch ($EXT_LOAD_MODE)
-{
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       $SQLs[] = "";
-
-       // Load CSS-File?
-       $EXT_CSS = "Y";
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_user' OR what='user_contct' LIMIT 2";
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       $SQLs[] = "";
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.1": // SQL queries for v0.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD user_limit int(7) not null default '20'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Seitenweises Anzeigen der User-Liste ist nun m&ouml;glich.";
-               break;
-
-       case "0.1.1": // SQL queries for v0.1.1
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_extensions SET ext_has_css='Y' WHERE ext_name='user' AND ext_has_css='N' LIMIT 1";
-
-               // This update depends on sql_patches update!
-               $EXT_UPDATE_DEPENDS = "sql_patches";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.";
-
-       case "0.1.2": // SQL queries for v0.1.2
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD mails_confirmed bigint(20) not null default '0'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "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.";
+setThisExtensionVersion('0.3.9');
+
+// Version history array (add more with , '0.0.1' and so on)
+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'));
+
+// Keep this extension always active!
+setExtensionAlwaysActive('Y');
+
+switch (getExtensionMode()) {
+       case 'register': // Do stuff when installation is running
+               addDropTableSql('user_cats');
+               addCreateTableSql('user_cats', "(
+`id` BIGINT(22) NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`cat_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`),
+INDEX (`userid`),
+INDEX (`cat_id`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'User->category connection data'");
+
+               addDropTableSql('user_data');
+               addCreateTableSql('user_data', "(
+`userid` BIGINT(22) NOT NULL AUTO_INCREMENT,
+`surname` VARCHAR(255) NOT NULL DEFAULT '',
+`family` VARCHAR(255) NOT NULL DEFAULT '',
+`street_nr` VARCHAR(255) NOT NULL DEFAULT '',
+`country` VARCHAR(4) NOT NULL DEFAULT '',
+`zip` VARCHAR(6) NOT NULL DEFAULT '',
+`city` VARCHAR(255) NOT NULL DEFAULT '',
+`email` VARCHAR(255) NOT NULL DEFAULT '',
+`birth_day` CHAR(2) NOT NULL DEFAULT '01',
+`birth_month` CHAR(2) NOT NULL DEFAULT '01',
+`birth_year` VARCHAR(4) NOT NULL DEFAULT '1970',
+`password` VARCHAR(255) NOT NULL DEFAULT '',
+`max_mails` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`receive_mails` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`refid` BIGINT(22) NOT NULL DEFAULT 0,
+`status` ENUM('UNCONFIRMED','CONFIRMED','LOCKED') NOT NULL DEFAULT 'UNCONFIRMED',
+`user_hash` VARCHAR(255) NULL DEFAULT NULL,
+`REMOTE_ADDR` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+`last_online` VARCHAR(10) NOT NULL DEFAULT 0,
+`last_module` VARCHAR(255) NOT NULL DEFAULT '',
+`ref_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`total_logins` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`gender` ENUM('M','F') NOT NULL DEFAULT 'M',
+`used_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`emails_sent` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`joined` VARCHAR(10) NOT NULL DEFAULT 0,
+`last_update` VARCHAR(10) NOT NULL DEFAULT 0,
+`last_profile_sent` VARCHAR(10) NOT NULL DEFAULT 0,
+`notified` ENUM('Y','N') NOT NULL DEFAULT 'N',
+`ref_payout` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+`last_login` VARCHAR(10) NOT NULL DEFAULT 0,
+`login_failures` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`last_failure` TIMESTAMP NULL DEFAULT NULL,
+PRIMARY KEY (`userid`),
+UNIQUE (`user_hash`),
+INDEX (`refid`),
+INDEX `status_mails` (`status`,`max_mails`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Main user data'");
+
+               addDropTableSql('user_points');
+               addCreateTableSql('user_points', "(
+`id` BIGINT(22) NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(22) NOT NULL DEFAULT 0,
+`ref_depth` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
+`points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`locked_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+PRIMARY KEY (`id`),
+INDEX (`userid`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'User points (no used points)'");
+
+               addDropTableSql('user_links');
+               addCreateTableSql('user_links', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`stats_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`link_type` ENUM('NORMAL') NOT NULL DEFAULT 'NORMAL',
+PRIMARY KEY (`id`),
+INDEX (`userid`),
+INDEX (`stats_id`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Unconfirmed mails per user'");
+
+               addDropTableSql('user_stats');
+               addCreateTableSql('user_stats', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`cat_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`payment_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`subject` VARCHAR(200) NOT NULL DEFAULT '',
+`url` TINYTEXT NOT NULL,
+`max_rec` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`timestamp_ordered` VARCHAR(10) NOT NULL DEFAULT '',
+`pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`timestamp_sstart` VARCHAR(10) NOT NULL DEFAULT '',
+`timestamp_send` VARCHAR(10) NOT NULL DEFAULT '',
+`is_stats` ENUM('Y','N') NOT NULL DEFAULT 'N',
+PRIMARY KEY (`id`),
+INDEX (`userid`),
+INDEX (`cat_id`),
+INDEX (`payment_id`),
+INDEX (`pool_id`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Mail statistics per user order'");
+
+               addDropTableSql('user_stats_data');
+               addCreateTableSql('user_stats_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`stats_type` VARCHAR(255) NOT NULL DEFAULT 'unknown',
+`stats_data` VARCHAR(255) NOT NULL DEFAULT '',
+`inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`userid`),
+INDEX (`stats_type`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Member statistics data'");
+
+               // Admin menu
+               addAdminMenuSql('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {OPEN_CONFIG}POINTS{CLOSE_CONFIG} gutschreiben und abziehen und und und...',3);
+               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);
+               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);
+               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);
+               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);
+               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);
+               addAdminMenuSql('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes &auml;ndern.',6);
+               addAdminMenuSql('user','list_refs','Referals anzeigen','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die generierten Referals eines Mitgliedes auflisten.',7);
+               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);
+               addAdminMenuSql('user','list_cats','Kategorien anzeigen','Listet die ausgew&auml;hlten Kategorien eines Mitgliedes auf.',9);
                break;
 
-       case "0.1.3": // SQL queries for v0.1.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Den Pfad <I>Sie sind hier</I> im Men&uuml;punkt <U>Online-Liste</U> erweitert.";
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               addDropTableSql('user_del');
+               addDropTableSql('user_cats');
+               addDropTableSql('user_data');
+               addDropTableSql('user_points');
+               addDropTableSql('user_links');
+               addDropTableSql('user_stats');
+               addDropTableSql('user_stats_data');
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'");
+
+               // Register new filters for gathering points
+               unregisterFilter(__FUNCTION__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun());
+               unregisterFilter(__FUNCTION__, __LINE__, 'get_own_points', 'USER_POINTS', true, isExtensionDryRun());
                break;
 
-       case "0.1.4": // SQL queries for v0.1.4
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD emails_received bigint(20) not null default '0'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Anzahl empfangener Mails wird angezeigt. <BIG>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {!MT_WORD!} haben sollen!</BIG>";
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.1.5": // SQL queries for v0.1.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               addExtensionSql('');
                break;
 
-       case "0.1.6": // SQL queries for v0.1.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.";
+       case 'update': // Update an extension
+               switch (getCurrentExtensionVersion()) {
+                       case '0.1.0': // SQL queries for v0.1
+                               addConfigAddSql('user_limit', 'INT(7) UNSIGNED NOT NULL DEFAULT 20');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Seitenweises Anzeigen der User-Liste ist nun m&ouml;glich.");
+                               break;
+
+                       case '0.1.1': // SQL queries for v0.1.1
+                               // This update depends on sql_patches update!
+                               addExtensionDependency('sql_patches');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
+                               break;
+
+                       case '0.1.2': // SQL queries for v0.1.2
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `mails_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+
+                               // Update notes (these will be set as task text!)
+                               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.");
+                               break;
+
+                       case '0.1.3': // SQL queries for v0.1.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Den Pfad <em>Sie sind hier</em> im Men&uuml;punkt <u>Online-Liste</u> erweitert.");
+                               break;
+
+                       case '0.1.4': // SQL queries for v0.1.4
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `emails_received` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Anzahl empfangener Mails wird angezeigt. <big>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {?mt_word?} haben sollen!</big>");
+                               break;
+
+                       case '0.1.5': // SQL queries for v0.1.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.1.6': // SQL queries for v0.1.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
+                               break;
+
+                       case '0.1.7': // SQL queries for v0.1.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Erweiterung bleibt wegen integrierten Schalters immer aktiv.");
+                               break;
+
+                       case '0.1.8': // SQL queries for v0.1.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
+                               break;
+
+                       case '0.1.9': // SQL queries for v0.1.9
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Link zum Mitgliedsprofil in Funktion <u>generateUserProfileLink()</u> ausgelagert.");
+                               break;
+
+                       case '0.2.0': // SQL queries for v0.2.0
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.");
+                               break;
+
+                       case '0.2.1': // SQL queries for v0.2.1
+                               addConfigAddSql('user_alpha', 'TINYINT(3) UNSIGNED NOT NULL DEFAULT 10');
+                               addAdminMenuSql('setup','config_user','Mitgliederliste','Anzahl Mitglieder pro Seite, Anzahl Buchstaben pro Zeile usw.', 8);
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("User-Liste ist konfigurierbar: Anzahl Mitglieder pro Seite und Anzahl Buchstaben pro Zeile; Template-Fehler beseitigt.");
+                               break;
+
+                       case '0.2.2': // SQL queries for v0.2.2
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `gender` `gender` ENUM('M','F','C') NOT NULL DEFAULT 'M'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Anrede &quot;Firma&quot; hinzugef&uuml;gt.");
+                               break;
+
+                       case '0.2.3': // SQL queries for v0.2.3
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Datumsformat festgelegt auf ausf&uuml;hrlich.");
+                               break;
+
+                       case '0.2.4': // SQL queries for v0.2.4
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("W&ouml;rter <strong>{?mt_word?}</strong>, <strong>{?mt_word2?}</strong> und <strong>{?mt_word3?}</strong> sind austauschbar.");
+                               break;
+
+                       case '0.2.5': // SQL queries for v0.2.5
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("SQL-Anweisungen abgesichert.");
+                               break;
+
+                       case '0.2.6': // SQL queries for v0.2.6
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abspeichern von Einstellungen repariert.");
+                               break;
+
+                       case '0.2.7': // SQL queries for v0.2.7
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Sicherheitsupdate f&uuml;r die Include-Befehle.");
+                               break;
+
+                       case '0.2.8': // SQL queries for v0.2.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
+                               break;
+
+                       case '0.2.9': // SQL queries for v0.2.9
+                               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);
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Admin-Kontaktformular hinzugef&uuml;gt.");
+                               break;
+
+                       case '0.3.0': // SQL queries for v0.3.0
+                               // Update notes (these will be set as task text!)
+                               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.");
+                               break;
+
+                       case '0.3.1': // SQL queries for v0.3.1
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `title` = 'Mitglieder-Management' WHERE `action`='user' AND (`what`='' OR `what` IS NULL) LIMIT 1");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Verwaltung auf Management umgestellt");
+                               break;
+
+                       case '0.3.2': // SQL queries for v0.3.2
+                               // Update notes (these will be set as task text!)
+                               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.");
+                               break;
+
+                       case '0.3.3': // SQL queries for v0.3.3
+                               // Update notes (these will be set as task text!)
+                               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>!)");
+                               break;
+
+                       case '0.3.4': // SQL queries for v0.3.4
+                               addConfigAddSql('select_user_zero_refid', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+                               addConfigAddSql('user_min_confirmed', 'SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+
+                               // Update notes (these will be set as task text!)
+                               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.");
+                               break;
+
+                       case '0.3.5': // SQL queries for v0.3.5
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `lock_reason` TINYTEXT");
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
+                               addConfigAddSql('user_delete_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 30));
+                               addAdminMenuSql('user', 'list_user_del', 'L&ouml;schungen auflisten', 'Listet die L&ouml;schungen von Usern auf.', 9);
+                               addDropTableSql('user_del');
+                               addCreateTableSql('user_del', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`email` VARCHAR(255) NOT NULL DEFAULT '',
+`surname` VARCHAR(255) NOT NULL DEFAULT '',
+`family` VARCHAR(255) NOT NULL DEFAULT '',
+`joined` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`last_online` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`del_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`del_reason` TINYTEXT,
+INDEX (`userid`),
+PRIMARY KEY (`id`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'List of deleted users'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
+                               break;
+
+                       case '0.3.6': // SQL queries for v0.3.6
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` DROP INDEX `userid`');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` ADD UNIQUE `userid_catid` ( `userid` , `cat_id` )');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
+                               break;
+
+                       case '0.3.7': // SQL queries for v0.3.7
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `id` `id` BIGINT( 22 ) UNSIGNED NOT NULL AUTO_INCREMENT');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_cats` CHANGE `cat_id` `cat_id` TINYINT( 3 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_del` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `stats_id` `stats_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `userid` `userid` BIGINT( 22 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` CHANGE `ref_depth` `ref_depth` TINYINT( 3 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `level` `level` SMALLINT( 6 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_refs` CHANGE `refid` `refid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `cat_id` `cat_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `payment_id` `payment_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats` CHANGE `pool_id` `pool_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_stats_data` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
+
+                               // Cleanup SQLs
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid` IS NULL OR `cat_id` IS NULL');
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_del` WHERE `userid` IS NULL');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_links` SET `stats_id`=NULL WHERE `stats_id`=0');
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid` IS NULL');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `ref_depth`=NULL WHERE `ref_depth`=0');
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid` IS NULL');
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid` IS NULL OR `refid` IS NULL OR `level` IS NULL');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `cat_id`=NULL WHERE `cat_id`=0');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `payment_id`=NULL WHERE `payment_id`=0');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `pool_id`=NULL WHERE `pool_id`=0');
+                               addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `userid` IS NULL');
+
+                               // This update depends on ext-bonus
+                               addExtensionDependency('bonus');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("NULL ist wichtiger als 0 und UNSIGNED auch.");
+                               break;
+
+                       case '0.3.7': // SQL queries for v0.3.7
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` CHANGE `last_failure` `last_failure` TIMESTAMP NULL DEFAULT NULL');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern einfach NULL.");
+                               break;
+
+                       case '0.3.8': // SQL queries for v0.3.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Update verschoben nach ext-order (da es Werbeguthaben ist und nichts mit dem Mitglied selbst zu tun hat).");
+                               break;
+
+                       case '0.3.9': // SQL queries for v0.3.9
+                               // Register new filters for gathering points
+                               registerFilter(__FUNCTION__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun());
+                               registerFilter(__FUNCTION__, __LINE__, 'get_own_points', 'USER_POINTS', true, isExtensionDryRun());
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Filter registriert, die das eigene {?POINTS?}-Guthaben des Mitgliedes zur&uuml;ckliefern.");
+                               break;
+               } // END - switch
                break;
 
-       case "0.1.7": // SQL queries for v0.1.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Erweiterung bleibt wegen integrierten Schalters immer aktiv.";
+       case 'modify': // When the extension got modified
                break;
 
-       case "0.1.8": // SQL queries for v0.1.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
+       case 'test': // For testing purposes
                break;
 
-       case "0.1.9": // SQL queries for v0.1.9
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Link zum Mitgliedsprofil in Funktion <U>ADMIN_USER_PROFILE_LINK()</U> ausgelagert.";
+       case 'init': // Do stuff when extension is initialized
                break;
 
-       case "0.2.0": // SQL queries for v0.2.0
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.";
+       default: // Unknown extension mode
+               logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
+} // END - switch
 
-       case "0.2.1": // SQL queries for v0.2.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD user_alpha tinyint(4) not null default '10'";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('setup', 'config_user', 'Mitgliederliste', 'Anzahl Mitglieder pro Seite, Anzahl Buchstaben pro Zeile usw.', 8)";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "User-Liste ist konfigurierbar: Anzahl Mitglieder pro Seite und Anzahl Buchstaben pro Zeile; Template-Fehler beseitigt.";
-               break;
-
-       case "0.2.2": // SQL queries for v0.2.2
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data CHANGE sex sex enum('M', 'F', 'C') not null default 'M'";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Anrede &quot;Firma&quot; hinzugef&uuml;gt.";
-               break;
-
-       case "0.2.3": // SQL queries for v0.2.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Datumsformat festgelegt auf ausf&uuml;hrlich.";
-               break;
-
-       case "0.2.4": // SQL queries for v0.2.4
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "W&ouml;rter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
-               break;
-
-       case "0.2.5": // SQL queries for v0.2.5
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "SQL-Anweisungen abgesichert.";
-               break;
-
-       case "0.2.6": // SQL queries for v0.2.6
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
-               break;
-
-       case "0.2.7": // SQL queries for v0.2.7
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Sicherheitsupdate f&uuml;r die Include-Befehle.";
-               break;
-
-       case "0.2.8": // SQL queries for v0.2.8
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "if-Anweisungen auf Funktion <STRONG>empty()</STRONG> umgestellt.";
-               break;
-
-       case "0.2.9": // SQL queries for v0.2.9
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('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)";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Admin-Kontaktformular hinzugef&uuml;gt.";
-               break;
-
-       case "0.3.0": // SQL queries for v0.3.0
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "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.";
-               break;
-
-       case "0.3.1": // SQL queries for v0.3.1
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Mitglieder-Management' WHERE action = 'user' AND what='' LIMIT 1";
-
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Verwaltung auf Management umgestellt";
-               break;
-
-       case "0.3.2": // SQL queries for v0.3.2
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "PHP-Hinweis in Userauflistung gefixt (trat bei fehlender nickname-Erweiterung auf) und Darstellungsfehler von <strong>0.00000</strong> unbest&auml;tigten Mails gefixt.";
-               break;
-
-       case "0.3.3": // SQL queries for v0.3.3
-               // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "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>!)";
-               break;
-       }
-       break;
-
-default: // Do stuff when extension is loaded
-       $DUMMY = LOAD_CONFIG("0");
-       $CONFIG['user_limit'] = $DUMMY['user_limit'];
-       $CONFIG['user_alpha'] = $DUMMY['user_alpha'];
-       unset($DUMMY);
-       break;
-}
-// Language file prefix
-$EXT_LANG_PREFIX = "user";
-
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = "Y";
-
-//
+// [EOF]
 ?>