From c5a4b89497cf1430b387b43e0c7808ef6dac0acd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 5 Dec 2008 15:39:50 +0000 Subject: [PATCH] More fixes, menus are no longer set visible if extension is deactivated, thanks to profi-concept --- inc/autopurge.php | 6 -- inc/databases.php | 2 +- inc/extensions/ext-beg.php | 4 +- inc/extensions/ext-bonus.php | 12 ++-- inc/extensions/ext-booking.php | 2 +- inc/extensions/ext-doubler.php | 4 +- inc/extensions/ext-holiday.php | 8 +-- inc/extensions/ext-html_mail.php | 12 +++- inc/extensions/ext-nickname.php | 2 +- inc/extensions/ext-online.php | 2 +- inc/extensions/ext-order.php | 2 +- inc/extensions/ext-payout.php | 2 +- inc/extensions/ext-primera.php | 2 +- inc/extensions/ext-rallye.php | 4 +- inc/extensions/ext-refback.php | 2 +- inc/extensions/ext-surfbar.php | 4 +- inc/extensions/ext-top10.php | 2 +- inc/extensions/ext-transfer.php | 8 +-- inc/extensions/ext-wernis.php | 4 +- inc/gen_mediadata.php | 21 +++--- inc/install-inc.php | 69 ++++++++----------- inc/libs/bonus_functions.php | 112 ++++++++++++++++--------------- inc/libs/user_functions.php | 2 +- inc/reset/reset_bonus.php | 3 + mailid_top.php | 103 +++++++++++++--------------- show_bonus.php | 53 ++++++++------- 26 files changed, 221 insertions(+), 226 deletions(-) diff --git a/inc/autopurge.php b/inc/autopurge.php index b312634738..ee4ec0224a 100644 --- a/inc/autopurge.php +++ b/inc/autopurge.php @@ -55,11 +55,5 @@ if (EXT_IS_ACTIVE("rallye")) { RALLYE_DELETE_EXPIRED_RALLYES(); } -if (EXT_IS_ACTIVE("bonus")) { - // Check for expired turbo bonus lines - require_once(PATH."inc/libs/bonus_functions.php"); - BONUS_PURGE_EXPIRED_TURBO_BONUS(); -} - // ?> diff --git a/inc/databases.php b/inc/databases.php index ee0c53f73a..d31263f640 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "596"); +define('CURR_SVN_REVISION', "597"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 55eba3395b..fd553900a1 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -88,8 +88,8 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='Y', locked='Y' WHERE what='beg' LIMIT 1"; - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='Y' WHERE what='beg' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='N', locked='Y' WHERE what='beg' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what IN('beg','beg2') LIMIT 2"; $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_mod_reg` SET locked='Y' WHERE module='beg' LIMIT 1"; break; diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index d55405c4c9..771d6939bf 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -50,8 +50,8 @@ switch ($EXT_LOAD_MODE) { case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) // SQL commands to run - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu VALUES (NULL,'email','send_bonus','Bonusmail senden',5,'Versenden Sie hier Bonus-Mails an alle Mitglieder oder nur an alle aus einer Kategorie. Es spielt keine Rolle, wie viele Mails bereits versendet worden, Sie können hier immer senden.')"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu VALUES (NULL,'main','bonus','Bonuspunkte',7,'Y','Y','', 0)"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`sort`,`descr`) VALUES ('email','send_bonus','Bonusmail senden',5,'Versenden Sie hier Bonus-Mails an alle Mitglieder oder nur an alle aus einer Kategorie. Es spielt keine Rolle, wie viele Mails bereits versendet worden, Sie können hier immer senden.')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`, `what`, `title`, `sort`, `visible`, `locked`, `counter`) VALUES ('main','bonus','Bonuspunkte',7,'Y','Y', 0)"; $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_bonus"; $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_bonus ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, @@ -100,8 +100,8 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='bonus' LIMIT 1"; - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE action='bonus' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='bonus' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE action='bonus' LIMIT 1"; $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='show_bonus' LIMIT 1"; break; @@ -122,7 +122,7 @@ case "update": // Update an extension case "0.2.1": // SQL queries for v0.2.1 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_bonus' LIMIT 1"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu VALUES (NULL,'setup','config_bonus','Bonus-{!POINTS!}',8,'Richten Sie Bonus-{!POINTS!} ein, die beim x'ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zusätzlich bekommen, als der 10. Klick.')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`sort`,`descr`) VALUES VALUES ('setup','config_bonus','Bonus-{!POINTS!}',8,'Richten Sie Bonus-{!POINTS!} ein, die beim x'ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zusätzlich bekommen, als der 10. Klick.')"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD login_bonus FLOAT(20,3) NOT NULL DEFAULT 10.000"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD turbo_bonus FLOAT(20,3) NOT NULL DEFAULT 100.000"; $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD login_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT ".$_CONFIG['one_day'].""; @@ -160,7 +160,7 @@ KEY userid (userid) case "0.2.3": // SQL queries for v0.2.3 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='bonus' LIMIT 1"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu VALUES (NULL,'main','bonus','Aktiv-Rallye',7,'Y','Y','', 0)"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`, `what`, `title`, `sort`, `visible`, `locked`, `counter`) VALUES ('main','bonus','Aktiv-Rallye',7,'Y','Y', 0)"; // Update notes (these will be set as task text!) $UPDATE_NOTES = "Aktiv-Rallye mit Klick-Vergütung hinzugefügt."; diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 8cf0659221..d940e27ae7 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -86,7 +86,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET locked='Y' WHERE what='booking' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='booking' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 20c4beef30..45dd01e0b0 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -132,8 +132,8 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='doubler' LIMIT 1"; - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='doubler' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='doubler' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='doubler' LIMIT 1"; $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='doubler' LIMIT 1"; break; diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 4d28464e97..309b4ccabc 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -93,7 +93,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='holiday' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='holiday' LIMIT 1"; break; case "update": // Update an extension @@ -190,9 +190,9 @@ case "update": // Update an extension break; case "0.1.8": // SQL queries for v0.1.8 - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'list_holiday')"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'del_holiday')"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', NULL, 'config_holiday')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')"; // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin $EXT_UPDATE_DEPENDS = "sql_patches"; diff --git a/inc/extensions/ext-html_mail.php b/inc/extensions/ext-html_mail.php index be5255955c..51c36eae10 100644 --- a/inc/extensions/ext-html_mail.php +++ b/inc/extensions/ext-html_mail.php @@ -38,13 +38,13 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.1.5"; +$EXT_VERSION = "0.1.6"; // Auto-set extension version if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) -$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.51", "0.0.52", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5"); +$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.51", "0.0.52", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6"); switch ($EXT_LOAD_MODE) { @@ -71,7 +71,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='html_mail' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='html_mail' LIMIT 1"; break; case "update": // Update an extension @@ -121,6 +121,12 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert."; break; + + case "0.1.6": + // Dependency is needed for ext-registration!! (want to alter a non existent Table) + $EXT_UPDATE_DEPENDS = "bonus"; + $UPDATE_NOTES = "Abhänigkeit von der Erweiterung bonus hinzugefügt."; + break; } break; diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index 67236a2d26..c87f4bedf7 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -72,7 +72,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='nickname' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='nickname' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-online.php b/inc/extensions/ext-online.php index 47a1a96383..92dd93dc54 100644 --- a/inc/extensions/ext-online.php +++ b/inc/extensions/ext-online.php @@ -83,7 +83,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE action='online' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE action='online' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index eeb4f31388..5011922d7c 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -67,7 +67,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1"; - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET visible='N', locked='Y' WHERE module='order' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-payout.php b/inc/extensions/ext-payout.php index 4f8e1a314d..c79b935663 100644 --- a/inc/extensions/ext-payout.php +++ b/inc/extensions/ext-payout.php @@ -92,7 +92,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='payout' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='payout' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-primera.php b/inc/extensions/ext-primera.php index 0d3a664c2d..fe13ce90a9 100644 --- a/inc/extensions/ext-primera.php +++ b/inc/extensions/ext-primera.php @@ -96,7 +96,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='primera' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='primera' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index e11bad5d8b..7b41fedcec 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -115,8 +115,8 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='rallyes' LIMIT 1"; - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='rallyes' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='rallyes' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='rallyes' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index c97e551729..df196c9024 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -81,7 +81,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET locked='Y' WHERE what='refback' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='refback' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index a4345b4f66..8c091b9b19 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -67,7 +67,7 @@ case "register": // Do stuff when installation is running (modules.php?module=ad `fixed_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(`id`), UNIQUE KEY `userid_url` (`userid`,`url`), -INDEX `status_userid` (`status`,`userid`), +INDEX `status_userid` (`status`,`userid`) ) TYPE=MyISAM COMMENT='Surfbar URLs'"; // Reload locks @@ -212,7 +212,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5"; $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_mod_reg` SET locked='Y' WHERE module='surfbar' LIMIT 1"; break; diff --git a/inc/extensions/ext-top10.php b/inc/extensions/ext-top10.php index 909be12a81..e1981f4b7e 100644 --- a/inc/extensions/ext-top10.php +++ b/inc/extensions/ext-top10.php @@ -71,7 +71,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='top10' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='top10' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index daf80dc657..467cd713db 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -117,7 +117,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='transfer' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='transfer' LIMIT 1"; break; case "update": // Update an extension @@ -231,9 +231,9 @@ case "update": // Update an extension break; case "0.2.3": // SQL queries for v0.2.3 - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'list_transfer')"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'del_transfer')"; - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', NULL, 'config_transfer')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_transfer')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_transfer')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_transfer')"; // Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin $EXT_UPDATE_DEPENDS = "sql_patches"; diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 5cc56aa28f..81c15ab2c7 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -97,12 +97,14 @@ case "remove": // Do stuff when removing extension case "activate": // Do stuff when admin activates this extension // SQL commands to run + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1"; $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1"; break; case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='wernis' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='wernis' LIMIT 1"; + $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='wernis' LIMIT 1"; break; case "update": // Update an extension diff --git a/inc/gen_mediadata.php b/inc/gen_mediadata.php index 66d5a4d8f0..b2451b7479 100644 --- a/inc/gen_mediadata.php +++ b/inc/gen_mediadata.php @@ -37,6 +37,9 @@ if (!defined('__SECURITY')) { require($INC); } +// Init variables +$bsent = 0; $bclicks = 0; $bcount = 0; + // Check for normal mails $result_media = SQL_QUERY("SELECT SUM(max_rec) AS max_rec, SUM(clicks) AS clicks FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__); @@ -51,25 +54,21 @@ SQL_FREERESULT($result_media); $result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__); list($ncount) = SQL_FETCHROW($result_media); SQL_FREERESULT($result_media); -$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__); -list($bcount) = SQL_FETCHROW($result_media); -SQL_FREERESULT($result_media); // Check for bonus extension -if (EXT_IS_ACTIVE("bonus")) -{ +if (EXT_IS_ACTIVE("bonus")) { + // Count bonus mails + $result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__); + list($bcount) = SQL_FETCHROW($result_media); + SQL_FREERESULT($result_media); + // Check for bonus mails $result_media = SQL_QUERY("SELECT SUM(mails_sent) AS bonus_sent, SUM(clicks) AS bonus_clicks FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__); list($bsent, $bclicks) = SQL_FETCHROW($result_media); if (empty($bsent)) $bsent = 0; if (empty($bclicks)) $bclicks = 0; -} - else -{ - // Not found! - $bsent = 0; $bclicks = 0; -} +} // END - if // Load (maybe) missing file require_once(PATH."inc/libs/mediadata_functions.php"); diff --git a/inc/install-inc.php b/inc/install-inc.php index f9ce4811d8..7c3860c9e3 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -71,15 +71,15 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) } else { $next++; } - } + } // END - if //* DEBUG: */ echo "WRITE: ".htmlentities($line)."
\n"; fputs($fp_tmp, $line); - } + } // END - while fclose($fp_tmp); // Finished writing tmp file $done = true; - } + } // END - if // Close source directory fclose($fp); @@ -91,7 +91,7 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) } else { OUTPUT_HTML("TMP: UNDONE!"); } - } + } // END - if } else { OUTPUT_HTML("404: ".$file."
"); } @@ -117,23 +117,23 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) { // Hostname not set OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) { // Password is empty OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) { // Password repeat is empty OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."
"); $_GET['page'] = 3; - } + } // END - if if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) { // Passwords are not matching OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."
"); $_GET['page'] = 3; - } -} + } // END - if +} // END - if // Is MXChange installed or no admin registered so far? if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) @@ -357,15 +357,15 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT // And split it up against ;\n ... $SQLs = array_merge($SQLs, explode(";\n", $sql)); - } - } + } // END - if + } // END - foreach // Are some SQLs found? if (count($SQLs) == 0) { // Abort here ADD_FATAL(INSTALL_SQL_IMPORT_FAILED); return; - } + } // END - if // Now run all queries through and try to keep out empty or comment queries foreach ($SQLs as $sql) { @@ -376,8 +376,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) { // Then run it! SQL_QUERY($sql, __FILE__, __LINE__); - } - } + } // END - if + } // END - foreach // Ok, all done. So we can write the config data to the php files if ($_POST['spath'] != PATH) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0); @@ -401,27 +401,23 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT // Close the link SQL_CLOSE($link, __FILE__, __LINE__); - } - else - { + } else { // Installation area not found! ADD_FATAL(INSTALL_MISSING_DUMPS); } - } - } - if ((sizeof($FATAL) > 0) || ((isset($FATAL[0])) && ($FATAL[0] != ''))) - { + } // END - if + } // END - if + + if ((sizeof($FATAL) > 0) || ((isset($FATAL[0])) && ($FATAL[0] != ''))) { $OUT = ""; - foreach ($FATAL as $value) - { + foreach ($FATAL as $value) { $OUT .= "
  • ".$value."
  • \n"; - } + } // END foreach define('__FATAL_ERROR_LI', $OUT); $OUT = ""; - foreach ($mysql as $key => $value) - { + foreach ($mysql as $key => $value) { $OUT .= " \n"; - } + } // END foreach define('__MYSQL_DATA' , $OUT); define('__SPATH_VALUE' , $_POST['spath']); define('__BURL_VALUE' , $_POST['burl']); @@ -457,21 +453,14 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT "); - } - else - { + } else { // Installation is done! - $URL = $burl."/install.php?page=finalize"; - LOAD_URL($URL); + LOAD_URL($burl."/install.php?page=finalize"); } - } - elseif (isBooleanConstantAndTrue('mxchange_installed')) - { + } elseif (isBooleanConstantAndTrue('mxchange_installed')) { // Redirection after writing data... :-) LOAD_TEMPLATE("install_finished"); - } - else - { + } else { // Something goes wrong during installation! :-( ADD_FATAL(INSTALL_FINALIZER_FAILED); include ("inc/fatal_errors.php"); @@ -483,9 +472,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT OUTPUT_HTML(" ".WRONG_PAGE.""); break; } -} - else -{ +} else { ADD_FATAL(ALREADY_INSTALLED); } // diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index bbb2a32388..86d7f83f9a 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -38,50 +38,63 @@ if (!defined('__SECURITY')) { } // This function must be run *BEFORE* a link is removed from table 'mxchange_user_links' ! -function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) -{ +function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) { global $_CONFIG; // Shall we add bonus points? - if ($_CONFIG['bonus_active'] == "N") return; + if ($_CONFIG['bonus_active'] == "N") return false; + + // Init variables + $SQL = ""; $bonys = 0; $mail = 0; $column = ""; // Select SQL command - $SQL = ""; switch ($type) { case "bonusid": - $result = SQL_QUERY_ESC("SELECT clicks FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array($mid), __FILE__, __LINE__); - $bonus = $mid; $mail = 0; + $column = "bonus_id"; + $bonus = $mid; break; case "mailid" : - $result = SQL_QUERY_ESC("SELECT clicks FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1", - array($mid), __FILE__, __LINE__); - $bonus = 0; $mail = $mid; + $column = "mail_id"; + $mail = $mid; + break; + + default: + DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid type %s detected.", $type)); break; } + // Is a column name set? + if (empty($column)) { + // No, then abort here + return false; + } // END - if + + // Check for entry + $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_bonus_turbo WHERE userid=%s AND %s=%s LIMIT 1", + array($uid, $column, $mid), __FILE__, __LINE__); + // Load clicks from table as current rank list($rank) = SQL_FETCHROW($result); - if ($rank == 1) - { + // Add one line + $rank++; + + // Free result + SQL_FREERESULT($result); + + // Which rank? + if ($rank == 1) { // First rank! - $rank = 1; $points = $_CONFIG['turbo_bonus']; - } - else - { + } else { // Anything else so let's explode all entered rank points $test = explode(";", $_CONFIG['turbo_rates']); - if (!empty($test[$rank - 2])) - { + if (!empty($test[$rank - 2])) { // Level found $points = $test[$rank - 2]; - } - else - { + } else { // Level not found! $points = "0.00000"; } @@ -89,17 +102,16 @@ function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) // Add points to his account directly $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET turbo_bonus=turbo_bonus+".$points." WHERE userid=%s LIMIT 1", - array(bigintval($uid)), __FILE__, __LINE__); + array(bigintval($uid)), __FILE__, __LINE__); // Rember this whole data for displaying ranking list - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus_turbo (userid, mail_id, bonus_id, level, points, timemark) VALUES ('%s', '%s', '%s', '".$rank."', '".$points."', UNIX_TIMESTAMP())", - array(bigintval($uid), bigintval($mail), bigintval($bonus)), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus_turbo (userid, mail_id, bonus_id, level, points, timemark) VALUES ('%s', '%s', '%s', '%s', '%s', UNIX_TIMESTAMP())", + array(bigintval($uid), bigintval($mail), bigintval($bonus), $rank, $points), __FILE__, __LINE__); if ((GET_EXT_VERSION("bonus") >= "0.3.5") && ($_CONFIG['bonus_mode'] != "ADD") && ($points > 0)) BONUS_POINTS_HANDLER($points); } // -function BONUS_MAKE_RANK_ROWS($data, $type, $uid) -{ +function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) { global $_CONFIG; $self = false; $OUT = ""; @@ -108,9 +120,8 @@ function BONUS_MAKE_RANK_ROWS($data, $type, $uid) // Load current user's data $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND userid=%s LIMIT 1", - array($type, $data, $uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array($type, $data, $uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { // Load data list($rank, $points, $mark) = SQL_FETCHROW($result); @@ -124,35 +135,32 @@ function BONUS_MAKE_RANK_ROWS($data, $type, $uid) // Load template define('__YOUR_RANKING_LINE', LOAD_TEMPLATE("show_bonus_yr", true)); - } + } // END - if // Load rankings $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s ORDER BY level LIMIT %s", - array($type, $data, $_CONFIG['bonus_lines']), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { + array($type, $data, $_CONFIG['bonus_lines']), __FILE__, __LINE__); + if (SQL_NUMROWS($result) > 0) { // Start generating the ranking list $max = SQL_NUMROWS($result); $SW = 2; - for ($rank = 1; $rank <= $max; $rank++) - { + for ($rank = 1; $rank <= $max; $rank++) { // Load data - $result_users = SQL_QUERY_ESC("SELECT userid, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND level='%s' LIMIT 1", - array($type, $data, $rank), __FILE__, __LINE__); - list($userid, $points, $mark) = SQL_FETCHROW($result_users); + $result_users = SQL_QUERY_ESC("SELECT userid, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND level=%s LIMIT 1", + array($type, $data, $rank), __FILE__, __LINE__); + + // Nothing found by default + $userid = "---"; $points = "---"; // Are you one of them? - if (empty($userid)) - { - // Nothing found - $userid = "---"; $points = "---"; - } - else - { + if (SQL_NUMROWS($result_users) == 1) { + // Load data + list($userid, $points, $mark) = SQL_FETCHROW($result_users); + // Translate comma $points = TRANSLATE_COMMA($points); - } + } // END - if // Output row $OUT .= " @@ -161,15 +169,13 @@ function BONUS_MAKE_RANK_ROWS($data, $type, $uid) ".$points." \n"; $SW = 3 - $SW; - } - if (!$self) - { + } // END - for + + if (!$self) { // If current user was not found set constant define('__YOUR_RANKING_LINE', BONUS_RANK_YOU_ARE_NOT_FOUND); - } - } - else - { + } // END - if + } else { // No entries found! $OUT = " diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index f00c096841..3ec514966f 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -257,7 +257,7 @@ function SELECT_RANDOM_REFID () { list($refid) = SQL_FETCHROW($result); // Reset this user's counter - SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_iser_data` SET `rand_confirmed`=0 WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `rand_confirmed`=0 WHERE userid=%s LIMIT 1", array($refid), __FILE__, __LINE__); } // END - if diff --git a/inc/reset/reset_bonus.php b/inc/reset/reset_bonus.php index cefffd4f3f..1ef325653b 100644 --- a/inc/reset/reset_bonus.php +++ b/inc/reset/reset_bonus.php @@ -43,6 +43,9 @@ if (!defined('__SECURITY')) { if (($CSS == 1) || (!defined('__DAILY_RESET'))) return; //* DEBUG: */ echo basename(__FILE__)."
    \n"; +// Purge expired entries in _bonus_turbo +BONUS_PURGE_EXPIRED_TURBO_BONUS(); + // Reset accounts $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0", __FILE__, __LINE__); diff --git a/mailid_top.php b/mailid_top.php index cee39dbc3a..05b86518e6 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -44,13 +44,12 @@ $GLOBALS['module'] = "mailid"; $CSS = 0; // Load the required file(s) require("inc/config.php"); -if (isBooleanConstantAndTrue('mxchange_installed')) -{ +if (isBooleanConstantAndTrue('mxchange_installed')) { // Is the extension active if (!EXT_IS_ACTIVE("mailid", true)) { // Is not activated/installed yet! - ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register")); - } + ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid")); + } // END - if // Secure all data $url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = ""; @@ -61,25 +60,22 @@ if (isBooleanConstantAndTrue('mxchange_installed')) if (!empty($_GET['mode'])) $mode = $_GET['mode']; // 01 1 12 2 2 21 1 2 2 10 - if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) - { + if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) { + // No image? Then output header if ($mode != "img") require_once(PATH."inc/header.php"); // Maybe he wants to confirm an email? - if ($url_mid > 0) - { + if ($url_mid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s AND userid=%s LIMIT 1", array($url_mid, $url_uid), __FILE__, __LINE__); $type = "mailid"; $DATA = $url_mid; - } - elseif ($url_bid > 0) - { + } elseif ($url_bid > 0) { $result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s AND userid=%s LIMIT 1", array($url_bid, $url_uid), __FILE__, __LINE__); $type = "bonusid"; $DATA = $url_bid; } - if (SQL_NUMROWS($result) == 1) - { + + if (SQL_NUMROWS($result) == 1) { // Is the stats ID valid? list($lid, $ltype) = SQL_FETCHROW($result); SQL_FREERESULT($result); @@ -87,16 +83,18 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); break; case "BONUS": $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); break; } - if (SQL_NUMROWS($result_mailid) == 1) - { + + // Entry found? + if (SQL_NUMROWS($result_mailid) == 1) { + // Load data list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); // Correct notification switch in non-bonus mails @@ -110,32 +108,33 @@ if (isBooleanConstantAndTrue('mxchange_installed')) // Is the user's ID unlocked? $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array($url_uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { // Load data list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result); + + // Free some memory SQL_FREERESULT($result); - if ($status == "CONFIRMED") - { + if ($status == "CONFIRMED") { // Update last activity $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); + array($url_uid), __FILE__, __LINE__); // User has confirmed his account so we can procede... switch ($ltype) { case "NORMAL": $result = SQL_QUERY_ESC("SELECT payment_id FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($pay) = SQL_FETCHROW($result); $time = GET_PAY_POINTS($pay, "time"); $payment = GET_PAY_POINTS($pay, "payment"); $VALID = true; - } + } // END - if // Free memory... SQL_FREERESULT($result); @@ -143,9 +142,10 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("SELECT time, points FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) - { + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { list($time, $payment) = SQL_FETCHROW($result); $VALID = true; } @@ -154,19 +154,17 @@ if (isBooleanConstantAndTrue('mxchange_installed')) SQL_FREERESULT($result); break; } - if ($VALID) - { + + // Is this entry valid? + if ($VALID) { if (($time == "0") && ($payment > 0)) $time = "1"; - if (($time > 0) && ($payment > 0)) - { - if (!empty($code)) - { + if (($time > 0) && ($payment > 0)) { + if (!empty($code)) { // Generate code $img_code = GEN_RANDOM_CODE($_CONFIG['code_length'], $code, $url_uid, $DATA); - } + } // END - if - switch ($mode) - { + switch ($mode) { case "add": // Init stats data $stats_data = 0; @@ -176,7 +174,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { case "NORMAL": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); + array($url_mid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -188,7 +186,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) case "BONUS": $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); + array($url_bid), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -334,33 +332,26 @@ if (isBooleanConstantAndTrue('mxchange_installed')) else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (5)"); } else OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (4)"); - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (3)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (2)"); } - } - else - { + } else { SQL_FREERESULT($result); OUTPUT_HTML("".MAIL_ALREADY_CONFIRMED." (1)"); } - if ($mode != "img") - { + + // Insert footer if no image + if ($mode != "img") { // Write footer require_once(PATH."inc/footer.php"); - } + } // END - if } -} - elseif ($mode != "img") -{ +} elseif ($mode != "img") { // You have to configure first! LOAD_URL("install.php"); } diff --git a/show_bonus.php b/show_bonus.php index 0953786b2c..613fa13577 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -37,7 +37,8 @@ require_once("inc/libs/security_functions.php"); // Init "action" and "what" global $what, $action, $startTime; $GLOBALS['startTime'] = microtime(true); -$GLOBALS['what'] = ""; $GLOBALS['action'] = ""; +$GLOBALS['what'] = ""; +$GLOBALS['action'] = ""; // Set this because we have no module in URI $GLOBALS['module'] = "show_bonus"; $CSS = 0; @@ -59,16 +60,19 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t']))) { // Set row name $t = ""; - switch ($_GET['t']) - { - case "bonusid": - $t = "bonus_id"; - break; - - case "mailid": - $t = "mail_id"; - break; - } + switch ($_GET['t']) { + case "bonusid": // Bonus mail + $t = "bonus_id"; + break; + + case "mailid": // Regular member mail + $t = "mail_id"; + break; + + default: // Invalid type + DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", $_GET['t'])); + break; + } // END - switch // Valid type? if (!empty($t)) { @@ -77,19 +81,22 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { FROM "._MYSQL_PREFIX."_user_data AS d RIGHT JOIN "._MYSQL_PREFIX."_bonus_turbo AS b ON d.userid=b.userid -WHERE d.status='CONFIRMED' AND d.userid=%s AND b.".$t."='%s' LIMIT 1", - array(bigintval($_GET['uid']), bigintval($_GET['d'])), __FILE__, __LINE__); +WHERE d.status='CONFIRMED' AND d.userid=%s AND b.%s=%s +LIMIT 1", + array(bigintval($_GET['uid']), $t, bigintval($_GET['d'])), __FILE__, __LINE__); + + // Entry found? if (SQL_NUMROWS($result) == 1) { // Load data - list($gender, $sname, $fname, $level, $points) = SQL_FETCHROW($result); + $content = SQL_FETCHARRAY($result); // Prepare constants for the pre-template - define('__GENDER' , TRANSLATE_GENDER($gender)); - define('__SNAME' , $sname); - define('__FNAME' , $fname); - define('__RANK' , $level); - define('__POINTS' , $points); - define('__MAILID' , $_GET['d']); + define('__GENDER' , TRANSLATE_GENDER($content['gender'])); + define('__SNAME' , $content['surname']); + define('__FNAME' , $content['family']); + define('__RANK' , BIGINTVAL($content['level'])); + define('__POINTS' , TRANSLATE_COMMA($content['points'])); + define('__MAILID' , bigintval($_GET['d'])); define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval($_GET['d']), $t, bigintval($_GET['uid']))); // Constant created within previous function which contains informations for current user's ranking position: @@ -99,18 +106,18 @@ WHERE d.status='CONFIRMED' AND d.userid=%s AND b.".$t."='%s' LIMIT 1", define('__BONUS_MSG', LOAD_TEMPLATE("show_bonus_msg", true)); } else { // No data found - define('__BONUS_MSG', "".BONUS_SHOW_NO_DATA.""); + define('__BONUS_MSG', "".BONUS_SHOW_NO_DATA.""); } // Free memory SQL_FREERESULT($result); } else { // Wrong type entered - define('__BONUS_MSG', "".BONUS_SHOW_WRONG_TYPE.""); + define('__BONUS_MSG', "".BONUS_SHOW_WRONG_TYPE.""); } } else { // Wrong call! - define('__BONUS_MSG', "".BONUS_SHOW_WRONG_CALL.""); + define('__BONUS_MSG', "".BONUS_SHOW_WRONG_CALL.""); } // Load send_bonus header template (for your banners, e.g.?) -- 2.39.5