X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions%2Fext-user.php;h=fc973a3dcf51be19765c3824e7927224080bf605;hp=b2f1be148d8cf44c05508b0e3a06837963a02d3a;hb=6560179e7c8dc565485503f374d4e31f333ffd0e;hpb=63f159414369b5ea19a8ca75d8cd8033c45d8341 diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index b2f1be148d..fc973a3dcf 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.5.2'); +setThisExtensionVersion('0.5.5'); // 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.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', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2')); +setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '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', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5')); // Keep this extension always active! setExtensionAlwaysActive('Y'); @@ -53,7 +53,7 @@ switch (getExtensionMode()) { case 'register': // Do stuff when installation is running addDropTableSql('user_cats'); addCreateTableSql('user_cats', " -`id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `cat_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id`), @@ -97,15 +97,15 @@ INDEX (`cat_id`)", `login_failures` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `last_failure` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`userid`), -UNIQUE (`user_hash`), +UNIQUE INDEX (`user_hash`), INDEX (`refid`), INDEX `status_mails` (`status`,`max_mails`)", 'Main user data'); addDropTableSql('user_points'); addCreateTableSql('user_points', " -`id` BIGINT(20) NOT NULL AUTO_INCREMENT, -`userid` BIGINT(20) NOT NULL DEFAULT 0, +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`userid` BIGINT(20) UNSIGNED 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, @@ -180,7 +180,10 @@ INDEX (`stats_type`)", addDropTableSql('user_refs'); addDropTableSql('user_stats'); addDropTableSql('user_stats_data'); + addDropTableSql('user_subids'); + addDropTableSql('subid_log'); addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_user','user_contct','list_user_del') OR `action`='user'"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('subids')"); // Register new filters for gathering points unregisterFilter(__FILE__, __LINE__, 'get_total_points', 'USER_POINTS', true, isExtensionDryRun()); @@ -191,6 +194,11 @@ INDEX (`stats_type`)", unregisterFilter(__FILE__, __LINE__, 'user_inclusion_sql', 'TESTER_USER_INCLUSION_SQL', true, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'convert_user_data_columns', 'ADD_USER_DATA_CONVERT_SQL_COLUMNS', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_refid_validation', 'HANDLE_USER_SUBID', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USER_REFERRAL', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', true, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension @@ -367,7 +375,7 @@ INDEX (`stats_type`)", `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, +`del_reason` TINYTEXT NOT NULL, PRIMARY KEY (`id`), INDEX (`userid`)", 'List of deleted users'); @@ -378,7 +386,7 @@ INDEX (`userid`)", 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 INDEX `userid_catid` (`userid`,`cat_id`)'); + 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öschen des Users mit ausgesendet."); @@ -469,7 +477,7 @@ INDEX (`userid`)", `level` smallINT(6) UNSIGNED NOT NULL DEFAULT 0, `refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id`), -UNIQUE INDEX `user_refid` (`userid`,`level`,`refid`), +UNIQUE `user_refid` (`userid`,`level`,`refid`), INDEX (`level`), INDEX (`refid`)", 'User referrals'); @@ -559,9 +567,6 @@ INDEX (`refid`)", // Register a filter registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS', false, true, isExtensionDryRun()); - // This depends on ext-register - addExtensionDependency('register'); - // Update notes (these will be set as task text!) setExtensionUpdateNotes("Filter zum Hinzufügen von SQL-Spalten für die Mitgliederanmeldung hinzugefügt."); break; @@ -573,6 +578,74 @@ INDEX (`refid`)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Filter zum Hinzufügen von SQL-Spalten für die Mitgliederanmeldung hinzugefügt."); break; + + case '0.5.3': // SQL queries for v0.5.3 + // Register filter + registerFilter(__FILE__, __LINE__, 'post_refid_validation', 'HANDLE_USER_SUBID', false, true, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS', false, true, isExtensionDryRun()); + + // Admin menu + addAdminMenuSql('user', 'list_user_subid', 'Sub-Ids', 'Listet alle pro vom Mitglied eingegebenen Sub-Ids und ermittelten Referral-URLs auf.', 7); + + // Member menu + addMemberMenuSql('extras', 'subids', 'Sub-Id Tracking', 4); + + // Add table for subids + addDropTableSql('user_subids'); + addCreateTableSql('user_subids', " +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`subid` VARCHAR(255) NOT NULL DEFAULT '', +`subid_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`id`), +UNIQUE `user_subid` (`userid`, `subid`), +INDEX (`subid`)", + 'User sub ids'); + + // Add table for subid logging + addDropTableSql('subid_log'); + addCreateTableSql('subid_log', " +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`subid` VARCHAR(255) NOT NULL DEFAULT '', +`referral_url` TINYTEXT NOT NULL, +`remote_address` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', +`entry_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`id`), +INDEX (`refid`), +INDEX (`subid`)", + 'Sub id logging'); + + // For saving used subid in user_data table + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `subid` VARCHAR(255) NULL DEFAULT NULL'); + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD INDEX (`subid`)'); + + // Configuration entry for purging old subid logs (7 days default) + addConfigAddSql('user_subid_purge', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 7)); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Filter, Datenbanktabelle und Menüpunkte für SubId-Tracking hinzugefügt."); + break; + + case '0.5.4': // SQL queries for v0.5.4 + // Register filter + registerFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USER_REFERRAL', false, true, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', false, true, isExtensionDryRun()); + + // Add user agent + addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_subid_log` ADD `user_agent` TINYTEXT NOT NULL AFTER `remote_address`'); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Weitere Filter für Referral-Counter und Sub-Id hinzugefügt."); + break; + + case '0.5.5': // SQL queries for v0.5.5 + // Register filter + registerFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', false, true, isExtensionDryRun()); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Weiteren Filter für Mitglieder-Aktionen im Adminbereich hinzugefügt."); + break; } // END - switch break;