]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-user.php
Old config.php is now automatically updated to new config-local.php format, several...
[mailer.git] / inc / extensions / ext-user.php
index 6ec3f8c50347311b7990c9d23356c3f59dfdf869..7fdd09ae579348c463f4cc3d71351c557a0e3b50 100644 (file)
@@ -10,7 +10,7 @@
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Ausgelagertes Mitglieder-Management              *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
+ * $Revision::                                                        $ *
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 }
 
 // Version number
-EXT_SET_VERSION("0.3.5");
+EXT_SET_VERSION('0.3.5');
 
-// Version history array (add more with , "0.1" and so on)
-EXT_SET_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", "0.3.4", "0.3.5"));
+// Version history array (add more with , '0.1.0' and so on)
+EXT_SET_VER_HISTORY(array('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'));
 
 switch ($EXT_LOAD_MODE)
 {
-case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
-       // SQL commands to run
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {!POINTS!} gutschreiben und abziehen und und und...',3)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','del_user','Mitglied löschen','Löschen Sie hier Mitglied, die gegen die AGBs mehrmals verstossen haben. Bitte seien Sie nett zu Ihren Mitgliedern und löschen Sie nicht gleich.',1)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','chk_regs','Anmeldungen prüfen','Prüfen Sie hier neue Anmeldungen zu Ihrem System. Hier können Sie im Falle einer Fehler-Mail den Mitglied gleich wieder löschen!',2)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','lock_user','Mitglied sperren / entsperren','Sperren Sie Mitglied, die zu viele unbestätigte Mails haben oder gegen Ihre AGBs verstossen haben über diesen Menüpunkt.',3)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user','Mitglied auflisten','Listen Sie alle Mitglied oder eingeschränkt nach Suchkritieren Ihre Userdatenbank auf. Sie könen per Klick auf die Usernummer sich Details zum Mitglied ansehen.',4)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','add_points','{!POINTS!} gutschreiben','Buchen Sie einem Mitglied direkt {!POINTS!} auf. Sie können dazu auch einen Kommentar mitsenden.',5)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes ändern.',6)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_refs','Referals anzeigen','Mit diesem Menüpunkt können Sie die generierten Referals eines Mitgliedes auflisten.',7)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_links','Unbestätigte Mails','Mit diesem Menüpunkt können Sie die vom Mitglied nicht bestätigten Mails anzeigen.',8)");
-       ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_cats','Kategorien anzeigen','Listet die ausgewählten Kategorien eines Mitgliedes auf.',9)");
-       break;
-
-case "remove": // Do stuff when removing extension
-       // SQL commands to run
-       ADD_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') LIMIT 3");
-       ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
-       break;
-
-case "activate": // Do stuff when admin activates this extension
-       // SQL commands to run
-       ADD_SQL("");
-       break;
-
-case "deactivate": // Do stuff when admin deactivates this extension
-       // SQL commands to run
-       ADD_SQL("");
-       break;
-
-case "update": // Update an extension
-       switch ($EXT_VER)
-       {
-       case "0.1": // SQL queries for v0.1
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_limit` INT(7) UNSIGNED NOT NULL DEFAULT 20");
-
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Seitenweises Anzeigen der User-Liste ist nun möglich.");
-               break;
-
-       case "0.1.1": // SQL queries for v0.1.1
-               ADD_SQL("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_SET_UPDATE_DEPENDS("sql_patches");
-
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("CSS-Datei kann per Admin-Bereich ein- und ausgeschaltet werden.");
-
-       case "0.1.2": // SQL queries for v0.1.2
-               ADD_SQL("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!)
-               EXT_SET_UPDATE_NOTES("Dem Mitglied wird nun angezeigt, wie viele Mails er bestätigt hat. Alle vor dieser Version best. Mails werden leider nicht mehr berü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!)
-               EXT_SET_UPDATE_NOTES("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
-               ADD_SQL("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!)
-               EXT_SET_UPDATE_NOTES("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!)
-               EXT_SET_UPDATE_NOTES("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!)
-               EXT_SET_UPDATE_NOTES("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!)
-               EXT_SET_UPDATE_NOTES("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!)
-               EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &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!)
-               EXT_SET_UPDATE_NOTES("Link zum Mitgliedsprofil in Funktion <u>ADMIN_USER_PROFILE_LINK()</u> ausgelagert.");
-               break;
-
-       case "0.2.0": // SQL queries for v0.2.0
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.");
-               break;
-
-       case "0.2.1": // SQL queries for v0.2.1
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_alpha` TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
-               ADD_SQL("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!)
-               EXT_SET_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
-               ADD_SQL("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!)
-               EXT_SET_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!)
-               EXT_SET_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!)
-               EXT_SET_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!)
-               EXT_SET_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!)
-               EXT_SET_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!)
-               EXT_SET_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!)
-               EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
-               break;
-
-       case "0.2.9": // SQL queries for v0.2.9
-               ADD_SQL("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!)
-               EXT_SET_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!)
-               EXT_SET_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
-               ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `title` = 'Mitglieder-Management' WHERE `action`='user' AND (`what`='' OR `what` IS NULL) LIMIT 1");
+       case 'register': // Do stuff when installation is running (modules.php?module=admin&action=login is called)
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_cats`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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`)
+) TYPE={!_TABLE_TYPE!}");
+
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_data`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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 NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY  (`userid`),
+UNIQUE (`user_hash`),
+INDEX (`refid`),
+INDEX `status_mails` (`status`,`max_mails`)
+) TYPE={!_TABLE_TYPE!}");
+
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_points`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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`)
+) TYPE={!_TABLE_TYPE!}");
+
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_links`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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`)
+) TYPE={!_TABLE_TYPE!}");
+
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_stats`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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,
+  `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`)
+) TYPE={!_TABLE_TYPE!}");
 
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Verwaltung auf Management umgestellt");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_stats_data`");
+               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_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`)
+) TYPE={!_TABLE_TYPE!} COMMENT='Member statistics data'");
+
+               // Admin menu
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {!POINTS!} gutschreiben und abziehen und und und...',3)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','add_points','{!POINTS!} gutschreiben','Buchen Sie einem Mitglied direkt {!POINTS!} auf. Sie k&ouml;nnen dazu auch einen Kommentar mitsenden.',5)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes &auml;ndern.',6)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_refs','Referals anzeigen','Mit diesem Men&uuml;punkt k&ouml;nnen Sie die generierten Referals eines Mitgliedes auflisten.',7)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('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)");
+               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_cats','Kategorien anzeigen','Listet die ausgew&auml;hlten Kategorien eines Mitgliedes auf.',9)");
                break;
 
-       case "0.3.2": // SQL queries for v0.3.2
-               // Update notes (these will be set as task text!)
-               EXT_SET_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.");
+       case 'remove': // Do stuff when removing extension
+               // SQL commands to run
+               ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_cats`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_data`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_points`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_links`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_stats`");
+               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_stats_data`");
                break;
 
-       case "0.3.3": // SQL queries for v0.3.3
-               // Update notes (these will be set as task text!)
-               EXT_SET_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>!)");
+       case 'activate': // Do stuff when admin activates this extension
+               // SQL commands to run
+               ADD_EXT_SQL('');
                break;
 
-       case "0.3.4": // SQL queries for v0.3.4
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10");
-               ADD_SQL("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!)
-               EXT_SET_UPDATE_NOTES("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.");
+       case 'deactivate': // Do stuff when admin deactivates this extension
+               // SQL commands to run
+               ADD_EXT_SQL('');
                break;
 
-       case "0.3.5": // SQL queries for v0.3.5
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_reason` TINYTEXT");
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
-               ADD_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day') * 30)."");
-               ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user_del','L&ouml;schungen auflisten','Listet die L&ouml;schungen von Usern auf.', 9)");
-               ADD_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
-               ADD_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_del` (
+       case 'update': // Update an extension
+               switch ($EXT_VER)
+               {
+                       case '0.1.0': // SQL queries for v0.1
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_limit` INT(7) UNSIGNED NOT NULL DEFAULT 20");
+
+                               // Update notes (these will be set as task text!)
+                               EXT_SET_UPDATE_NOTES("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!
+                               EXT_ADD_UPDATE_DEPENDS('sql_patches');
+
+                               // Update notes (these will be set as task text!)
+                               EXT_SET_UPDATE_NOTES("Ung&uuml;ltiges Update.");
+                               break;
+
+                       case '0.1.2': // SQL queries for v0.1.2
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_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.");
+                               break;
+
+                       case '0.1.3': // SQL queries for v0.1.3
+                               // Update notes (these will be set as task text!)
+                               EXT_SET_UPDATE_NOTES("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
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_UPDATE_NOTES("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!)
+                               EXT_SET_UPDATE_NOTES("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!)
+                               EXT_SET_UPDATE_NOTES("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!)
+                               EXT_SET_UPDATE_NOTES("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!)
+                               EXT_SET_UPDATE_NOTES("Seit <a href=\"#\">Patch 340</a> &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!)
+                               EXT_SET_UPDATE_NOTES("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!)
+                               EXT_SET_UPDATE_NOTES("User-Liste ausgelagert in Templates und &uuml;berbreite Zeile in 2er-Zeile umgewandelt.");
+                               break;
+
+                       case '0.2.1': // SQL queries for v0.2.1
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_alpha` TINYINT(3) UNSIGNED NOT NULL DEFAULT 10");
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_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
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_UPDATE_NOTES("if-Anweisungen auf Funktion <strong>empty()</strong> umgestellt.");
+                               break;
+
+                       case '0.2.9': // SQL queries for v0.2.9
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_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!)
+                               EXT_SET_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
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_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!)
+                               EXT_SET_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!)
+                               EXT_SET_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;
+
+                       case '0.3.4': // SQL queries for v0.3.4
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10");
+                               ADD_EXT_SQL("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!)
+                               EXT_SET_UPDATE_NOTES("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
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_reason` TINYTEXT");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'");
+                               ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getConfig('one_day') * 30)."");
+                               ADD_EXT_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user_del','L&ouml;schungen auflisten','Listet die L&ouml;schungen von Usern auf.', 9)");
+                               ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_del`");
+                               ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}_user_del` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `email` VARCHAR(255) NOT NULL DEFAULT '',
@@ -251,24 +362,24 @@ INDEX (`userid`),
 PRIMARY KEY(`id`)
 ) TYPE={!_TABLE_TYPE!} COMMENT='List of deleted users'");
 
-               // Update notes (these will be set as task text!)
-               EXT_SET_UPDATE_NOTES("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
+                               // Update notes (these will be set as task text!)
+                               EXT_SET_UPDATE_NOTES("Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.");
+                               break;
+               }
                break;
-       }
-       break;
 
-case "modify": // When the extension got modified
-       break;
+                       case 'modify': // When the extension got modified
+                               break;
 
-case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
-       break;
+                       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+                               break;
 
-default: // Do stuff when extension is loaded
-       break;
+                       default: // Do stuff when extension is loaded
+                               break;
 }
 
 // Keep this extension always active!
-EXT_SET_ALWAYS_ACTIVE("Y");
+EXT_SET_ALWAYS_ACTIVE('Y');
 
 // [EOF]
 ?>