More fixes, menus are no longer set visible if extension is deactivated, thanks to...
authorRoland Häder <roland@mxchange.org>
Fri, 5 Dec 2008 15:39:50 +0000 (15:39 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 5 Dec 2008 15:39:50 +0000 (15:39 +0000)
26 files changed:
inc/autopurge.php
inc/databases.php
inc/extensions/ext-beg.php
inc/extensions/ext-bonus.php
inc/extensions/ext-booking.php
inc/extensions/ext-doubler.php
inc/extensions/ext-holiday.php
inc/extensions/ext-html_mail.php
inc/extensions/ext-nickname.php
inc/extensions/ext-online.php
inc/extensions/ext-order.php
inc/extensions/ext-payout.php
inc/extensions/ext-primera.php
inc/extensions/ext-rallye.php
inc/extensions/ext-refback.php
inc/extensions/ext-surfbar.php
inc/extensions/ext-top10.php
inc/extensions/ext-transfer.php
inc/extensions/ext-wernis.php
inc/gen_mediadata.php
inc/install-inc.php
inc/libs/bonus_functions.php
inc/libs/user_functions.php
inc/reset/reset_bonus.php
mailid_top.php
show_bonus.php

index b312634..ee4ec02 100644 (file)
@@ -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();
-}
-
 //
 ?>
index ee0c53f..d31263f 100644 (file)
@@ -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);
index 55eba33..fd55390 100644 (file)
@@ -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;
 
index d55405c..771d693 100644 (file)
@@ -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&ouml;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&ouml;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&#39;ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zus&auml;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&#39;ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zus&auml;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&uuml;tung hinzugef&uuml;gt.";
index 8cf0659..d940e27 100644 (file)
@@ -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
index 20c4bee..45dd01e 100644 (file)
@@ -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;
 
index 4d28464..309b4cc 100644 (file)
@@ -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";
index be52559..51c36ea 100644 (file)
@@ -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&auml;nigkeit von der Erweiterung <strong>bonus</strong> hinzugef&uuml;gt.";
+               break;
        }
        break;
 
index 67236a2..c87f4be 100644 (file)
@@ -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
index 47a1a96..92dd93d 100644 (file)
@@ -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
index eeb4f31..5011922 100644 (file)
@@ -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
index 4f8e1a3..c79b935 100644 (file)
@@ -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
index 0d3a664..fe13ce9 100644 (file)
@@ -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
index e11bad5..7b41fed 100644 (file)
@@ -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
index c97e551..df196c9 100644 (file)
@@ -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
index a4345b4..8c091b9 100644 (file)
@@ -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;
 
index 909be12..e1981f4 100644 (file)
@@ -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
index daf80dc..467cd71 100644 (file)
@@ -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";
index 5cc56aa..81c15ab 100644 (file)
@@ -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
index 66d5a4d..b2451b7 100644 (file)
@@ -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");
index f9ce481..7c3860c 100644 (file)
@@ -71,15 +71,15 @@ function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0)
                                                } else {
                                                        $next++;
                                                }
-                                       }
+                                       } // END - if
                                        //* DEBUG: */ echo "WRITE: <font color=\"green\">".htmlentities($line)."</font><br />\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("<STRONG>TMP:</STRONG> UNDONE!");
                        }
-               }
+               } // END - if
        } else {
                OUTPUT_HTML("<STRONG>404:</STRONG> ".$file."<br />");
        }
@@ -117,23 +117,23 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
                // Hostname not set
                OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."<br />");
                $_GET['page'] = 3;
-       }
+       } // END - if
        if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
                // Password is empty
                OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."<br />");
                $_GET['page'] = 3;
-       }
+       } // END - if
        if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
                // Password repeat is empty
                OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."<br />");
                $_GET['page'] = 3;
-       }
+       } // END - if
        if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
                // Passwords are not matching
                OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."<br />");
                $_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 .= "    <LI>".$value."</LI>\n";
-                               }
+                               } // END foreach
                                define('__FATAL_ERROR_LI', $OUT);
                                $OUT = "";
-                               foreach ($mysql as $key => $value)
-                               {
+                               foreach ($mysql as $key => $value) {
                                        $OUT .= "    <INPUT type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\">\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
 </TR>
 </TABLE>
 </FORM>");
-                       }
-                        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("    <STRONG class=\"install_error\">".WRONG_PAGE."</STRONG>");
                break;
        }
-}
- else
-{
+} else {
        ADD_FATAL(ALREADY_INSTALLED);
 }
 //
index bbb2a32..86d7f83 100644 (file)
@@ -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 .= "<TR>
@@ -161,15 +169,13 @@ function BONUS_MAKE_RANK_ROWS($data, $type, $uid)
   <TD class=\"bonus_rank_".$rank." bottom2 switch_sw".$SW."\" align=\"center\">".$points."</TD>
 </TR>\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 = "<TR>
   <TD colspan=\"3\" align=\"center\" height=\"30\" class=\"bottom2\">
index f00c096..3ec5149 100644 (file)
@@ -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
 
index cefffd4..1ef3256 100644 (file)
@@ -43,6 +43,9 @@ if (!defined('__SECURITY')) {
 if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
 //* DEBUG: */ echo basename(__FILE__)."<br />\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__);
index cee39db..05b8651 100644 (file)
@@ -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("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (5)</STRONG>");
                                        }
                                         else OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (4)</STRONG>");
-                               }
-                                else
-                               {
+                               } else {
                                        SQL_FREERESULT($result);
                                        OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (3)</STRONG>");
                                }
-                       }
-                        else
-                       {
+                       } else {
                                SQL_FREERESULT($result);
                                OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (2)</STRONG>");
                        }
-               }
-                else
-               {
+               } else {
                        SQL_FREERESULT($result);
                        OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (1)</STRONG>");
                }
-               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");
 }
index 0953786..613fa13 100644 (file)
@@ -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', "<FONT class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</FONT>");
+                               define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</span>");
                        }
 
                        // Free memory
                        SQL_FREERESULT($result);
                } else {
                        // Wrong type entered
-                       define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</FONT>");
+                       define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</span>");
                }
        } else {
                // Wrong call!
-               define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</FONT>");
+               define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</span>");
        }
 
        // Load send_bonus header template (for your banners, e.g.?)