From 17bf2b3d87d31caef7b3de26d16a4b184a9bf975 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 11 Mar 2009 19:33:29 +0000 Subject: [PATCH] BLOB->TEXT rewritten, all _user tables now handled by ext-user, except user_book which resists in ext-booking --- inc/extensions/ext-bonus.php | 5 +- inc/extensions/ext-holiday.php | 2 +- inc/extensions/ext-payout.php | 4 +- inc/extensions/ext-rallye.php | 4 +- inc/extensions/ext-sponsor.php | 2 +- inc/extensions/ext-sql_patches.php | 60 ++--------------------- inc/extensions/ext-user.php | 78 ++++++++++++++++++------------ inc/libs/admins_functions.php | 69 +++++++++++--------------- inc/loader/load_cache-admin.php | 4 +- inc/modules/admin.php | 2 +- 10 files changed, 91 insertions(+), 139 deletions(-) diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 1c220ff8b5..be9ffd9248 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -59,8 +59,8 @@ case "register": // Do stuff when installation is running (modules.php?module=ad id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, cat_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, subject VARCHAR(255) NOT NULL DEFAULT '', -text LONGBLOB NOT NULL, -receivers LONGBLOB NOT NULL, +text LONGTEXT NOT NULL, +receivers LONGTEXT NOT NULL, points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, time TINYINT(3) UNSIGNED NOT NULL DEFAULT 0, data_type ENUM('NEW','QUEUE','SEND') NOT NULL DEFAULT 'NEW', @@ -293,7 +293,6 @@ KEY userid (userid) ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD bonus_order FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD bonus_ref FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD bonus_stats FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_stats` ADD is_stats ENUM('Y','N') NOT NULL DEFAULT 'N'"); // Update notes (these will be set as task text!) EXT_SET_UPDATE_NOTES("Bonus-{!POINTS!} für: Mailbestellung, Referal-Werbung (bei Best. der EMail-Adresse) und wenn 100% Klickrate jeder Mailbuchung erreicht wurde.
Template admin_config_bonus_pro.tpl ist überflüssig geworden. Bitte löschen Sie dies!
Eingestellte Bonus-{!POINTS!} für Rank 2 war um eins verschoben."); diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index d0872e6d86..919480685f 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -58,7 +58,7 @@ id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, holiday_start VARCHAR(10) NOT NULL DEFAULT 0, holiday_end VARCHAR(10) NOT NULL DEFAULT 0, -comments LONGBLOB NOT NULL, +comments LONGTEXT NOT NULL, KEY (userid), PRIMARY KEY(id) ) TYPE={!_TABLE_TYPE!}"); diff --git a/inc/extensions/ext-payout.php b/inc/extensions/ext-payout.php index a490002984..1d8bccaa40 100644 --- a/inc/extensions/ext-payout.php +++ b/inc/extensions/ext-payout.php @@ -119,8 +119,8 @@ case "update": // Update an extension break; case "0.1.5": // SQL queries for v0.1.5 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD target_url LONGBLOB NOT NULL"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD banner_url LONGBLOB NOT NULL"); + ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD target_url LONGTEXT NOT NULL"); + ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD banner_url LONGTEXT NOT NULL"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_payouts` ADD link_text VARCHAR(30) NOT NULL DEFAULT ''"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payout_types` ADD allow_url ENUM('Y','N') NOT NULL DEFAULT 'N'"); break; diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index 95890d4f40..0a954d354a 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -59,7 +59,7 @@ case "register": // Do stuff when installation is running (modules.php?module=ad id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, admin_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, title VARCHAR(255) NOT NULL DEFAULT '', -descr LONGBLOB NOT NULL, +descr LONGTEXT NOT NULL, template VARCHAR(255) NOT NULL DEFAULT '', start_time VARCHAR(10) NOT NULL DEFAULT 0, end_time VARCHAR(10) NOT NULL DEFAULT 0, @@ -75,7 +75,7 @@ id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, rallye_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, price_level BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, points BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -info LONGBLOB NOT NULL, +info LONGTEXT NOT NULL, KEY (rallye_id), PRIMARY KEY(id) ) TYPE={!_TABLE_TYPE!}"); diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index e19d9dab99..7ff4c6dd33 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -215,7 +215,7 @@ campaign_amount FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, campaign_expired ENUM('Y','N') NOT NULL DEFAULT 'N', campaign_locked ENUM('Y','N') NOT NULL DEFAULT 'Y', campaign_ended VARCHAR(10) NOT NULL DEFAULT 0, -locked_reason TINYBLOB, +locked_reason TINYTEXT, locked_timestamp VARCHAR(10) NOT NULL DEFAULT 0, status ENUM('PENDING','ACTIVE','LOCKED') NOT NULL DEFAULT 'PENDING', KEY(aid), diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index f5f7ef67cd..d01946a152 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -60,8 +60,6 @@ case "remove": // Do stuff when removing extension ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_admin_menu_las`"); ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_admin_menu_las_data`"); ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_admin_menu_stats`"); - ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_stats_data`"); - ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_book`"); ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_filters`"); // Delete admin menu entries @@ -95,7 +93,6 @@ action='account'"); /* @TODO SQL_ALTER_TABLE() should work now properly ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_extensions` DROP UNIQUE KEY `ext_name`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` DROP UNIQUE KEY `login`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP INDEX `status`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refbanner` DROP INDEX `visible`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refdepths` DROP UNIQUE KEY `level`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refsystem` DROP INDEX `level`"); @@ -109,10 +106,6 @@ action='account'"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_task_system` DROP FULLTEXT `subject`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_task_system` DROP INDEX `subject`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_extensions` DROP INDEX `ext_active`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP INDEX `status`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP FULLTEXT `family`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP INDEX `max_mails`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP INDEX `password`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` DROP INDEX `action`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` DROP INDEX `what`"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` DROP INDEX `sort`"); @@ -282,10 +275,6 @@ case "update": // Update an extension ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payments` CHANGE payment payment FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_payments` CHANGE price price FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE used_points used_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_points` CHANGE points points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_points` CHANGE locked_points locked_points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000"); - // Update notes (these will be set as task text!) EXT_SET_UPDATE_NOTES("5 Nachkommastellen implementiert"); break; @@ -324,9 +313,6 @@ case "update": // Update an extension break; case "0.2.5": // SQL queries for v0.2.5 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE receive_mails receive_mails BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE max_mails max_mails BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - // Update notes (these will be set as task text!) EXT_SET_UPDATE_NOTES("Spalten max_mails und receive_mails auf BIGINT(20) gesetzt."); break; @@ -350,10 +336,8 @@ case "update": // Update an extension break; case "0.2.8": // SQL queries for v0.2.8 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD last_login VARCHAR(10) NOT NULL DEFAULT 0"); - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Letzter Login wird gespeichert, Cache wird bei installierter Cache-Erweiterung bei Sprachenänderung aufgefrischt."); + EXT_SET_UPDATE_NOTES("Nicht mehr gültiges Update."); break; case "0.2.9": // SQL queries for v0.2.9 @@ -376,7 +360,6 @@ case "update": // Update an extension case "0.3.1": // SQL queries for v0.3.1 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_extensions` ADD UNIQUE KEY (ext_name)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` ADD UNIQUE KEY (login)"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD INDEX (status)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refbanner` ADD INDEX (visible)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refdepths` ADD UNIQUE KEY (level)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_refsystem` ADD INDEX (level)"); @@ -390,10 +373,6 @@ case "update": // Update an extension ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_task_system` ADD FULLTEXT (subject)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_task_system` ADD INDEX (subject)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_extensions` ADD INDEX (ext_active)"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD INDEX (status)"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD FULLTEXT (family)"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD INDEX (max_mails)"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD INDEX (password)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` ADD INDEX (action)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` ADD INDEX (what)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_guest_menu` ADD INDEX (sort)"); @@ -487,8 +466,6 @@ PRIMARY KEY (id) case "0.3.6": // SQL queries for v0.3.6 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD salt_length TINYINT(3) UNSIGNED NOT NULL DEFAULT '9'"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD pass_scramble VARCHAR(255) NOT NULL DEFAULT ''"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` MODIFY password VARCHAR(255) NOT NULL DEFAULT ''"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` MODIFY user_hash VARCHAR(255) NOT NULL DEFAULT ''"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_admins` MODIFY password VARCHAR(255) NOT NULL DEFAULT ''"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD rand_no BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD file_hash VARCHAR(255) NOT NULL DEFAULT ''"); @@ -531,8 +508,6 @@ PRIMARY KEY (id) break; case "0.4.1": // SQL queries for v0.4.1 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP INDEX `status`"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD INDEX `status_mails` (`status`,`max_mails`)"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `show_timings` ENUM ('Y','N') NOT NULL DEFAULT 'Y'"); // Update notes (these will be set as task text!) @@ -583,12 +558,8 @@ PRIMARY KEY (id) break; case "0.4.6": // SQL queries for v0.4.6 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD gender ENUM ('M','F') NOT NULL DEFAULT 'M'"); - // @DEPRECATED ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET gender=sex WHERE sex != 'M'"); - // @DEPRECATED ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP sex"); - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Offensives Wort "Sex" gegen "Gender" ausgetauscht."); + EXT_SET_UPDATE_NOTES("Nicht mehr gültiges Update."); break; case "0.4.7": // SQL queries for v0.4.7 @@ -604,12 +575,8 @@ PRIMARY KEY (id) break; case "0.4.9": // SQL queries for v0.4.9 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` CHANGE `user_hash` `user_hash` VARCHAR(255) NULL DEFAULT NULL"); - ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET user_hash=NULL WHERE user_hash IS NOT NULL AND `status`='CONFIRMED'"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD UNIQUE (`user_hash`)"); - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("User-Hash zum Bestätigen wird auf NULL gesetzt, wenn Account bestätigt wird."); + EXT_SET_UPDATE_NOTES("Nicht mehr gültiges Update."); break; case "0.5.0": // SQL queries for v0.5.0 @@ -661,20 +628,8 @@ PRIMARY KEY (id) break; case "0.5.6": // SQL queries for v0.5.6 - 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'"); - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Mitglieder könnnen nun z.B. in den Mail-Details zu jeder Mail sehen, wann sie diese bestätigt haben. Die neue Statistik-Tabelle ist aber universell einsetzbar."); + EXT_SET_UPDATE_NOTES("Nicht mehr gültiges Update."); break; case "0.5.7": // SQL queries for v0.5.7 @@ -715,13 +670,8 @@ PRIMARY KEY (`filter_id`) break; case "0.6.1": // SQL queries for v0.6.1 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP login_failtures"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` DROP last_failture"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD login_failures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_user_data` ADD last_failure TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'"); - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Falsche Schreibweise korregiert."); + EXT_SET_UPDATE_NOTES("Nicht mehr gültiges Update."); break; case "0.6.2": // SQL queries for v0.6.2 diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index f4397716d6..4a6a3856d2 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -51,18 +51,18 @@ EXT_SET_VER_HISTORY(array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.2", "0.1.3", "0.1 switch ($EXT_LOAD_MODE) { 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` ( + 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={!type!}"); +) TYPE={!_TABLE_TYPE!}"); - ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}user_data`"); - ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}user_data` ( + 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 '', @@ -74,42 +74,47 @@ INDEX (`cat_id`) `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(32) NOT NULL DEFAULT '', - `max_mails` INT(7) NOT NULL DEFAULT 0, - `receive_mails` INT(7) NOT NULL DEFAULT 0, + `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(32) NOT NULL DEFAULT '', + `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(22,3) NOT NULL DEFAULT '0.000', + `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`), -INDEX (`refid`) -) TYPE={!type!}"); +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` ( + 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(22,3) NOT NULL DEFAULT '0.000', - `locked_points` BIGINT(20) 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={!type!}"); +) TYPE={!_TABLE_TYPE!}"); - ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}user_links`"); - ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}user_links` ( + 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, @@ -117,28 +122,40 @@ INDEX (`userid`) PRIMARY KEY (`id`), INDEX (`userid`), INDEX (`stats_id`) -) TYPE={!type!}"); +) TYPE={!_TABLE_TYPE!}"); - ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}user_stats`"); - ADD_EXT_SQL("CREATE TABLE `{!_MYSQL_PREFIX!}user_stats` ( + 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` TINYBLOB NOT NULL, + `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 '', - BIGINT(20) UNSIGNED NOT NULL, + `is_stats` ENUM('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`id`), INDEX (`userid`), INDEX (`cat_id`), INDEX (`payment_id`), INDEX (`pool_id`) -) TYPE={!type!}"); +) TYPE={!_TABLE_TYPE!}"); + + 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)"); @@ -157,11 +174,12 @@ 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_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 "activate": // Do stuff when admin activates this extension diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index cb34ef32ef..665f2e9bf8 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -70,64 +70,49 @@ function ADMINS_CHECK_ACL($act, $wht) { } // Shall I test for a main or sub menu? (action or what?) - $lines = 0; $acl_mode = "failed"; + $acl_mode = "failed"; if (GET_EXT_VERSION("cache") >= "0.1.2") { - // Load only from array when there are lines! - if ((isset($GLOBALS['cache_array']['admin_acls'])) && (is_array($GLOBALS['cache_array']['admin_acls'])) && (count($GLOBALS['cache_array']['admin_acls']) > 0)) { - // Load ACL from array - foreach ($GLOBALS['cache_array']['admin_acls']['admin_id'] as $id => $aid_acls) { - if ($aid == $aid_acls) { - // Okay, one line was found! - if ((!empty($act)) && ($GLOBALS['cache_array']['admin_acls']['action_menu'][$id] == $act)) { - // Main menu line found - $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$id]; - $lines = 1; - } - elseif ((!empty($wht)) && ($GLOBALS['cache_array']['admin_acls']['what_menu'][$id] == $wht)) { - // Check sub menu - $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$id]; - $lines = 1; - } - if ($lines == 1) { - // Count cache hits - incrementConfigEntry('cache_hits'); - break; - } - } - } - - // No ACL found? - if ($acl_mode == "failed") { - $acl_mode = ""; - $lines = 0; - } - } else { - // No lines here - $lines = 0; + // Lookup in cache + if ((!empty($act)) && (isset($GLOBALS['cache_array']['admin_acls']['action_menu'][$aid])) & ($GLOBALS['cache_array']['admin_acls']['action_menu'][$aid] == $act)) { + // Main menu line found + $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$aid]; + + // Count cache hits + incrementConfigEntry('cache_hits'); + } elseif ((!empty($wht)) && (isset($GLOBALS['cache_array']['admin_acls']['what_menu'][$aid])) && ($GLOBALS['cache_array']['admin_acls']['what_menu'][$aid] == $wht)) { + // Check sub menu + $acl_mode = $GLOBALS['cache_array']['admin_acls']['access_mode'][$aid]; + + // Count cache hits + incrementConfigEntry('cache_hits'); } } else { // Old version, so load it from database - if (!empty($act)) - { + if (!empty($act)) { // Main menu $result = SQL_QUERY_ESC("SELECT access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE admin_id=%s AND action_menu='%s' LIMIT 1", - array(bigintval($aid), $act), __FUNCTION__, __LINE__); + array(bigintval($aid), $act), __FUNCTION__, __LINE__); } elseif (!empty($wht)) { // Sub menu $result = SQL_QUERY_ESC("SELECT access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` WHERE admin_id=%s AND what_menu='%s' LIMIT 1", - array(bigintval($aid), $wht), __FUNCTION__, __LINE__); + array(bigintval($aid), $wht), __FUNCTION__, __LINE__); } - // Get number of lines - $lines = SQL_NUMROWS($result); + // Is an entry found? + if (SQL_NUMROWS($result) == 1) { + // Load ACL + list($acl_mode) = SQL_FETCHROW($result); + } // END - if - // Load ACL - list($acl_mode) = SQL_FETCHROW($result); + // Free memory SQL_FREERESULT($result); } // Check ACL and (maybe) allow - if ((($default == "allow") && ($lines == 0)) || (($default == "deny") && ($lines == "1") && ($acl_mode == "allow")) || (($lines == 0) && ($parent))) $ret = true; + if (($default == "allow") || (($default == "deny") && ($acl_mode == "allow")) || ($parent === true)) { + // Access is granted + $ret = true; + } // END - if // Return value return $ret; diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index cd9356dc17..091d327a5f 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -122,8 +122,8 @@ if (GET_EXT_VERSION("admins") >= "0.3") { $GLOBALS['cache_instance']->init("ADMINS_ACLS"); $GLOBALS['cache_instance']->storeExtensionVersion("admins"); - // Load all modules and their data - $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__); + // Load all modules and their data (column 'id' is no longer required) + $result = SQL_QUERY("SELECT admin_id, action_menu, what_menu, access_mode FROM `{!_MYSQL_PREFIX!}_admins_acls` ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__); // Add all rows while ($data = SQL_FETCHARRAY($result)) { diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 37f234633d..4dd0b55cf7 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -208,7 +208,7 @@ if (!isAdminRegistered()) { // Check if the admin has submitted data or not if ((IS_FORM_SENT()) && ((!REQUEST_ISSET_POST(('login'))) || (!REQUEST_ISSET_POST(('pass'))) || (strlen(REQUEST_POST('pass')) < 4))) { REQUEST_SET_POST('ok', "***"); - } + } // END - if if ((IS_FORM_SENT()) && (REQUEST_POST('ok') != "***")) { // All required data was entered so we check his account -- 2.39.5