From c25e794a61b597f90bff599307ae4d766a2d3479 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 25 Jun 2011 01:24:02 +0000 Subject: [PATCH] Some cleanups/rewrites here and there: - Several small rewrites - TODOs.txt updated --- DOCS/TODOs.txt | 11 +- inc/extensions/ext-bonus.php | 2 +- inc/extensions/ext-user.php | 128 ++++++++++----------- inc/gen_mediadata.php | 3 +- inc/mysql-manager.php | 5 +- templates/de/html/member/member_points.tpl | 8 +- 6 files changed, 83 insertions(+), 74 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 42a64fc814..9a3bc1d708 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -180,11 +180,12 @@ ./inc/modules/member/what-unconfirmed.php:207: // @TODO This 'userid' cannot be saved because of encapsulated EL code ./inc/modules/order.php:74: // @TODO Unused: 2,4 ./inc/monthly/monthly_bonus.php:67: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1201: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1459: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() -./inc/mysql-manager.php:1565: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1939: // @TODO Rewrite this to a filter -./inc/mysql-manager.php:1983:// @TODO Fix inconsistency between last_module and getWhat() +./inc/mysql-manager.php:1208: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1466: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() +./inc/mysql-manager.php:1551: // @TODO Rewrite these lines to a filter +./inc/mysql-manager.php:1575: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1949: // @TODO Rewrite this to a filter +./inc/mysql-manager.php:1993:// @TODO Fix inconsistency between last_module and getWhat() ./inc/mysql-manager.php:368: // @TODO Try to rewrite this to one or more functions ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index a17b47ea88..789987a987 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -70,7 +70,7 @@ switch (getExtensionMode()) { `clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `mails_sent` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, KEY (`cat_id`), -PRIMARY KEY (`id`) +PRIMARY KEY (`id`) ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Bonus mails'"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` MODIFY `link_type` ENUM('NORMAL','BONUS') NOT NULL DEFAULT 'NORMAL'"); addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` ADD `bonus_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 06b6068413..344cb32589 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -53,50 +53,50 @@ switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) addDropTableSql('user_cats'); addExtensionSql("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`), +`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"); addDropTableSql('user_data'); addExtensionSql("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 NULL DEFAULT NULL, -PRIMARY KEY (`userid`), +`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`) @@ -104,42 +104,42 @@ INDEX `status_mails` (`status`,`max_mails`) addDropTableSql('user_points'); addExtensionSql("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`), +`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"); addDropTableSql('user_links'); addExtensionSql("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`), +`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"); addDropTableSql('user_stats'); addExtensionSql("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, - `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`), +`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`), @@ -400,7 +400,7 @@ PRIMARY KEY (`id`) 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("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"); diff --git a/inc/gen_mediadata.php b/inc/gen_mediadata.php index 31e0761d91..9e16179b21 100644 --- a/inc/gen_mediadata.php +++ b/inc/gen_mediadata.php @@ -70,7 +70,8 @@ if (isExtensionActive('bonus')) { SUM(`mails_send`) AS `bonus_send`, SUM(`clicks`) AS `bonus_clicks` FROM - `{?_MYSQL_PREFIX?}_bonus`', __FILE__, __LINE__); + `{?_MYSQL_PREFIX?}_bonus` +LIMIT 1', __FILE__, __LINE__); $content = merge_array($content, SQL_FETCHARRAY($result_media)); // Free memory diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 58ea2ccaf1..531aa79a79 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1548,6 +1548,7 @@ LIMIT 1", $data = SQL_FETCHARRAY($result); // Delete points entries as well + // @TODO Rewrite these lines to a filter SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s", array(bigintval($userid)), __FUNCTION__, __LINE__); @@ -1558,7 +1559,9 @@ LIMIT 1", } // END - if // Now, when we have all his points adds them do the jackpot! - if (isExtensionActive('jackpot')) addPointsToJackpot($data['points']); + if (isExtensionActive('jackpot')) { + addPointsToJackpot($data['points']); + } // END - if } // END - if // Free the result diff --git a/templates/de/html/member/member_points.tpl b/templates/de/html/member/member_points.tpl index 6e927c03cd..0a8b9d8b0a 100644 --- a/templates/de/html/member/member_points.tpl +++ b/templates/de/html/member/member_points.tpl @@ -12,11 +12,15 @@   - {--MEMBER_TOTAL_POINTS--} + + {--MEMBER_TOTAL_POINTS--} + {%pipe,translateComma=$content[total_points]%} {?POINTS?} - {%pipe,translateComma=$content[total_referals]%} + + {%pipe,translateComma=$content[total_referals]%} + {--POINTS_LOCKED--} -- 2.39.5