]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-user.php
Lock reason now saved in DB, deleted accounts shall be locked for re-registering...
[mailer.git] / inc / extensions / ext-user.php
index 057d1d3a2022616ee17034f4c5dedbd1e68071ba..203bd6e3c2e030ba8b4756454986765cd443e269 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
-{
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
 
 // Version number
-$EXT_VERSION = "0.3.3";
+$EXT_VERSION = "0.3.5";
 
 // 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");
+$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", "0.3.4", "0.3.5");
 
 switch ($EXT_LOAD_MODE)
 {
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
        // SQL commands to run
        $SQLs[] = "";
 
@@ -56,7 +55,8 @@ case "register": // Do stuff when installtion is running (modules.php?module=adm
 
 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";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') LIMIT 3";
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_del`";
        break;
 
 case "activate": // Do stuff when admin activates this extension
@@ -73,14 +73,14 @@ 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'";
+               $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ö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";
+               $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";
@@ -89,7 +89,7 @@ case "update": // Update an extension
                $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'";
+               $SQLs[] = "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!)
                $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.";
@@ -101,7 +101,7 @@ case "update": // Update an extension
                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'";
+               $SQLs[] = "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!)
                $UPDATE_NOTES = "Anzahl empfangener Mails wird angezeigt. <BIG>Diese Anzeige kann fehlerhaft sein, wenn Sie bereits Mitglieder in Ihrem {!MT_WORD!} haben sollen!</BIG>";
@@ -138,15 +138,15 @@ case "update": // Update an extension
                break;
 
        case "0.2.1": // SQL queries for v0.2.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD user_alpha TINYINT(3) 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)";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `user_alpha` TINYINT(3) UNSIGNED 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'";
+               $SQLs[] = "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!)
                $UPDATE_NOTES = "Anrede &quot;Firma&quot; hinzugef&uuml;gt.";
@@ -183,7 +183,7 @@ case "update": // Update an extension
                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)";
+               $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.";
@@ -195,7 +195,7 @@ case "update": // Update an extension
                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='' OR what IS NULL) LIMIT 1";
+               $SQLs[] = "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!)
                $UPDATE_NOTES = "Verwaltung auf Management umgestellt";
@@ -210,20 +210,51 @@ case "update": // Update an extension
                // 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;
+
+       case "0.3.4": // SQL queries for v0.3.4
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10";
+               $SQLs[] = "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!)
+               $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
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD `lock_reason` TINYTEXT";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD `lock_timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `user_delete_purge` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".($_CONFIG['one_day'] * 30)."";
+               $SQLs[] = "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)";
+               $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_del`";
+               $SQLs[] = "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 '',
+`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`)
+) TYPE=MyISAM COMMENT='List of deleted users'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Der Sperrgrund wird nun mit abgespeichert und beim L&ouml;schen des Users mit ausgesendet.";
+               break;
        }
        break;
 
 default: // Do stuff when extension is loaded
-       $dummy = LOAD_CONFIG();
-       $_CONFIG = merge_array($_CONFIG, $dummy);
-       unset($dummy);
        break;
 }
+
 // Language file prefix
 $EXT_LANG_PREFIX = "user";
 
-// Extension is always active?
+// Keep this extension always active!
 $EXT_ALWAYS_ACTIVE = "Y";
 
-//
+// [EOF]
 ?>