More fixes, missing js.php added
authorRoland Häder <roland@mxchange.org>
Sun, 19 Oct 2008 19:55:05 +0000 (19:55 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Oct 2008 19:55:05 +0000 (19:55 +0000)
.gitattributes
img.php
inc/databases.php
inc/doubler_send.php
inc/img/.htaccess [new file with mode: 0644]
inc/language/beg_de.php
inc/modules/admin/what-del_email.php
inc/modules/guest/what-mediadata.php
inc/mysql-connect.php
inc/mysql-manager.php
js.php [new file with mode: 0644]

index 3d8078eedf028035bacebedb720564de8fd1260a..a52ab12f9454ed843b438a52bc91af8c7f4ff216 100644 (file)
@@ -152,6 +152,7 @@ inc/gen_mediadata.php -text
 inc/gen_refback.php -text
 inc/gen_sql_patches.php -text
 inc/header.php -text
 inc/gen_refback.php -text
 inc/gen_sql_patches.php -text
 inc/header.php -text
+inc/img/.htaccess -text
 inc/install-inc.php -text
 inc/js/.htaccess -text
 inc/language.php -text
 inc/install-inc.php -text
 inc/js/.htaccess -text
 inc/language.php -text
@@ -600,6 +601,7 @@ inc/weekly/weekly_surfbar.php -text
 install/menu-de.sql -text
 install/menu-en.sql -text
 install/tables.sql -text
 install/menu-de.sql -text
 install/menu-en.sql -text
 install/tables.sql -text
+/js.php -text
 /lead-confirm.php -text
 /login.php -text
 /mailid.php -text
 /lead-confirm.php -text
 /login.php -text
 /mailid.php -text
diff --git a/img.php b/img.php
index df3c72506b67ed34b7494a3a4f5beea5ac3e1bc2..64919e4066fdf9b9650dd4e2dec2913b75b25dcb 100644 (file)
--- a/img.php
+++ b/img.php
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 10/12/2003 *
- * ===============                              Last change: 10/12/2004 *
+ * MXChange v0.2.1                                    Start: 10/16/2008 *
+ * ===============                              Last change: 10/16/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : img.php                                          *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : img.php                                          *
@@ -44,16 +44,26 @@ $GLOBALS['module'] = "img"; $CSS = -1;
 // Load the required file(s)
 require ("inc/config.php");
 
 // Load the required file(s)
 require ("inc/config.php");
 
-if (isBooleanConstantAndTrue('mxchange_installed'))
-{
-       if (!empty($_GET['code']))
-       {
+// Script installed?
+if (isBooleanConstantAndTrue('mxchange_installed')) {
+       // Code set?
+       if (!empty($_GET['code'])) {
                // Generate image
                GENERATE_IMAGE(bigintval($_GET['code']));
                // Generate image
                GENERATE_IMAGE(bigintval($_GET['code']));
+       } elseif (!empty($_GET['tag'])) {
+               // Tag set so create FQFN
+               $fqfn = sprintf("%sinc/img/tag-%s.php",
+                       PATH,
+                       SQL_ESCAPE($_GET['tag'])
+               );
+
+               // Include is readable?
+               if (FILE_READABLE($fqfn)) {
+                       // Include it
+                       require($fqfn);
+               } // END - if
        }
        }
-}
- else
-{
+} else {
        // You have to configure first!
        LOAD_URL("install.php");
 }
        // You have to configure first!
        LOAD_URL("install.php");
 }
index 7a2badd635c1bf3b6fc0faab64da24f320cc8753..651bb4fff40039ae0c47b3b9d3c5fa0cda129aba 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "515");
+define('CURR_SVN_REVISION', "516");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index e7e6210776359d659f40c33f2a6cde2fb05c9aab..8df3d834dc4a8f598b5a4d121cd0c59cbe1f2753 100644 (file)
@@ -71,37 +71,26 @@ WHERE u.status='CONFIRMED' AND d.points <= %s AND d.points >= %s AND d.completed
 ORDER BY d.timemark
 LIMIT %d", array($DOUBLER_POINTS, $min, $_CONFIG['doubler_max_sent']), __FILE__, __LINE__);
 
 ORDER BY d.timemark
 LIMIT %d", array($DOUBLER_POINTS, $min, $_CONFIG['doubler_max_sent']), __FILE__, __LINE__);
 
-if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) || ((SQL_NUMROWS($result_main) == $_CONFIG['doubler_group_sent']) && ($_CONFIG['doubler_sent_all'] == "N")))
-{
+if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) || ((SQL_NUMROWS($result_main) == $_CONFIG['doubler_group_sent']) && ($_CONFIG['doubler_sent_all'] == "N"))) {
        // Switch to matching SQL resource
        $result_load = $result_main;
        if ((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) $result_load = $result_total;
 
        // At least one account was found
        // Switch to matching SQL resource
        $result_load = $result_main;
        if ((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) $result_load = $result_total;
 
        // At least one account was found
-       while(list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load))
-       {
+       while(list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load)) {
                // Only double when points are enougth!
                // Only double when points are enougth!
-               if ($DOUBLER_POINTS >= $points)
-               {
+               if ($DOUBLER_POINTS >= $points) {
                        // Check for his ref points
                        // Check for his ref points
-                       $result_ref = SQL_QUERY_ESC("SELECT SUM(points) FROM "._MYSQL_PREFIX."_doubler WHERE refid=%s AND completed='N' AND is_ref='Y'",
-                        array(bigintval($uid)), __FILE__, __LINE__);
-                       list($ref) = SQL_FETCHROW($result_ref);
-
-                       // Free memory
-                       SQL_FREERESULT($result_ref);
+                       $ref = GET_TOTAL_DATA($uid, "doubler", "points", "refid", false, " AND completed='N' AND is_ref='Y'");
 
                        // Zero refid when empty (might be helpful!)
                        if (empty($ref)) $ref = 0;
 
                        // Zero refid when empty (might be helpful!)
                        if (empty($ref)) $ref = 0;
-                       if (($ref > 0) && ($DOUBLER_UID == $uid) && (!empty($ref)))
-                       {
+                       if (($ref > 0) && ($DOUBLER_UID == $uid) && (!empty($ref))) {
                                // Referal points found so add them and set line(s) to completed='Y'
                                $points += $ref;
                                $result_ref = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_doubler SET completed='Y' WHERE refid=%s AND completed='N' AND is_ref='Y'",
                                 array(bigintval($uid)), __FILE__, __LINE__);
                                // Referal points found so add them and set line(s) to completed='Y'
                                $points += $ref;
                                $result_ref = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_doubler SET completed='Y' WHERE refid=%s AND completed='N' AND is_ref='Y'",
                                 array(bigintval($uid)), __FILE__, __LINE__);
-                       }
-                        else
-                       {
+                       } else {
                                // No referal points found
                                $ref = 0;
                        }
                                // No referal points found
                                $ref = 0;
                        }
@@ -118,25 +107,23 @@ if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y"))
 
                        $OK = false;
                        // Check for jackpot inclusion in doubling process
 
                        $OK = false;
                        // Check for jackpot inclusion in doubling process
-                       if (($jackpot > 0) && ($jackpot >= $points) && ($_CONFIG['doubler_jackpot'] == "Y"))
-                       {
+                       if (($jackpot > 0) && ($jackpot >= $points) && ($_CONFIG['doubler_jackpot'] == "Y")) {
                                // Subtract points from jackpot
                                SUB_JACKPOT($points);
                                $jackpot -= $points;
 
                                // Okay, done!
                                $OK = true;
                                // Subtract points from jackpot
                                SUB_JACKPOT($points);
                                $jackpot -= $points;
 
                                // Okay, done!
                                $OK = true;
-                       }
+                       } // END - if
 
                        // Exclude also webmaster's ID in taking points from webmaster's account
 
                        // Exclude also webmaster's ID in taking points from webmaster's account
-                       if (($user > 0) && ($user >= $points) && (!$OK) && ($_CONFIG['doubler_uid'] > 0) && ($uid != $_CONFIG['doubler_uid']))
-                       {
+                       if (($user > 0) && ($user >= $points) && (!$OK) && ($_CONFIG['doubler_uid'] > 0) && ($uid != $_CONFIG['doubler_uid'])) {
                                // Add points to used points
                                SUB_POINTS($_CONFIG['doubler_uid'], $points);
 
                                // Okay, done!
                                $OK = true;
                                // Add points to used points
                                SUB_POINTS($_CONFIG['doubler_uid'], $points);
 
                                // Okay, done!
                                $OK = true;
-                       }
+                       } // END - if
 
                        // Update doubler's account only when others are not updated
                        if (!$OK) {
 
                        // Update doubler's account only when others are not updated
                        if (!$OK) {
diff --git a/inc/img/.htaccess b/inc/img/.htaccess
new file mode 100644 (file)
index 0000000..14249c5
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
\ No newline at end of file
index 0ba7e75813210672fef8f1466683bf9da26af80f..8a9876ed9b690f3ca259a40d0091f73124258231 100644 (file)
@@ -90,6 +90,12 @@ define('ADMIN_BEG_PAY_MODE_JS', "Abgesichert durch ein Fake-JavaScript");
 define('ADMIN_BEG_PAY_MODE_BOTH', "Durch beides obriges absichern");
 define('ADMIN_BEG_PAY_MODE_NONE', "Keine Absicherung (unsicher)");
 
 define('ADMIN_BEG_PAY_MODE_BOTH', "Durch beides obriges absichern");
 define('ADMIN_BEG_PAY_MODE_NONE', "Keine Absicherung (unsicher)");
 
+// More strings for beg link
+define('BEG_LINK_PAY_BOTH_1', "Das Mitglied <strong>");
+define('BEG_LINK_PAY_BOTH_2', "</strong> hat bei Ihnen gerade <strong>");
+define('BEG_LINK_PAY_BOTH_3', " {!POINTS!}</strong> erbettelt. Dies war der <strong>");
+define('BEG_LINK_PAY_BOTH_4', ".</strong> Klick auf seinen Bettellink. Vielen Dank f&uuml;r Ihre Spende!");
+
 // Begging rallye
 define('BEG_RANK', "Bettel-Rank");
 define('BEG_TOTAL', "Gesamt erbettelt");
 // Begging rallye
 define('BEG_RANK', "Bettel-Rank");
 define('BEG_TOTAL', "Gesamt erbettelt");
index da714d623e8863213720bb1ac92d7ea91686a3a2..7ea60fcd4042793f0f224bb76bf38f0c049d7e1c 100644 (file)
@@ -74,32 +74,21 @@ if (!empty($_GET['mid'])) {
                $msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
                SEND_EMAIL($sender, MEMBER_ORDER_DELETED, $msg_user);
 
                $msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
                SEND_EMAIL($sender, MEMBER_ORDER_DELETED, $msg_user);
 
-               // Delete mail from queue
-               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1",
-                array(bigintval($_GET['mid'])), __FILE__, __LINE__);
-
                // Fetch right stats_id from pool
                // Fetch right stats_id from pool
-               $result = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s
+               $result_pool = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s
 LEFT JOIN "._MYSQL_PREFIX."_pool AS p
 ON s.pool_id=p.id
 WHERE s.pool_id=%s LIMIT 1",
  array(bigintval($_GET['mid'])), __FILE__, __LINE__);
 LEFT JOIN "._MYSQL_PREFIX."_pool AS p
 ON s.pool_id=p.id
 WHERE s.pool_id=%s LIMIT 1",
  array(bigintval($_GET['mid'])), __FILE__, __LINE__);
-               if (SQL_NUMROWS($result) == 1) {
+               if (SQL_NUMROWS($result_pool) == 1) {
                        // Fetch stats id
                        // Fetch stats id
-                       list($stats_id) = SQL_FETCHROW($result);
-
-                       // Free the result
-                       SQL_FREERESULT($result);
+                       list($stats_id) = SQL_FETCHROW($result_pool);
 
                        // Get all user links
 
                        // Get all user links
-                       $result = SQL_QUERY_ESC("SELECT COUNT(id) AS 'cnt' FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
-                               array(bigintval($stats_id)), __FILE__, __LINE__);
-
-                       // Get unconfirmed links for calculation of total points
-                       list($links) = SQL_FETCHROW($result);
+                       $links = GET_TOTAL_DATA($stats_id, "user_links", "userid", "stats_id", true);
 
 
-                       // Free result
-                       SQL_FREERESULT($result);
+                       // Reset sent mails for recipient(s)
+                       REDUCT_RECIPIENT_RECEIVED_MAILS("stats_id", $_GET['mid'], $links);
 
                        // Calc total points and pay them back
                        $totalPoints = $links * $price;
 
                        // Calc total points and pay them back
                        $totalPoints = $links * $price;
@@ -112,7 +101,7 @@ WHERE s.pool_id=%s LIMIT 1",
                                        if ($_CONFIG['repay_deleted_mails'] == "JACKPOT") {
                                                // Set jackpot
                                                $sender = 0;
                                        if ($_CONFIG['repay_deleted_mails'] == "JACKPOT") {
                                                // Set jackpot
                                                $sender = 0;
-                                       }
+                                       } // END - if
 
                                        // Pay back points
                                        //* DEBUG: */ echo "PAYBACK:".$sender."<br />\n";
 
                                        // Pay back points
                                        //* DEBUG: */ echo "PAYBACK:".$sender."<br />\n";
@@ -122,12 +111,12 @@ WHERE s.pool_id=%s LIMIT 1",
                                        if ($_CONFIG['repay_deleted_mails'] == 'REPAY') {
                                                // Repayed
                                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_REPAYED,
                                        if ($_CONFIG['repay_deleted_mails'] == 'REPAY') {
                                                // Repayed
                                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_REPAYED,
-                                                       number_format($totalPoints, 0, ",", ".")
+                                                       TRANSLATE_COMMA($totalPoints)
                                                ));
                                        } else {
                                                // To jackpot
                                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_TO_JACKPOT,
                                                ));
                                        } else {
                                                // To jackpot
                                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_TO_JACKPOT,
-                                                       number_format($totalPoints, 0, ",", ".")
+                                                       TRANSLATE_COMMA($totalPoints)
                                                ));
                                        }
                                } else {
                                                ));
                                        }
                                } else {
@@ -139,13 +128,20 @@ WHERE s.pool_id=%s LIMIT 1",
                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_SHREDDED, $totalPoints));
                        }
 
                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_SHREDDED, $totalPoints));
                        }
 
+                       // Delete mail from queue
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1",
+                               array(bigintval($_GET['mid'])), __FILE__, __LINE__);
+
                        // Remove links from DB
                        // Remove links from DB
-                       $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
-                        array(bigintval($stats_id)), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
+                               array(bigintval($stats_id)), __FILE__, __LINE__);
 
                        // Output link for manually removing stats entry
                        LOAD_TEMPLATE("admin_settings_saved", false, "<A href=\"".URL."/modules.php?module=admin&amp;what=del_email&amp;pid=".bigintval($_GET['mid'])."\">".ADMIN_REMOVE_STATS_ENTRY."</A>");
                }
 
                        // Output link for manually removing stats entry
                        LOAD_TEMPLATE("admin_settings_saved", false, "<A href=\"".URL."/modules.php?module=admin&amp;what=del_email&amp;pid=".bigintval($_GET['mid'])."\">".ADMIN_REMOVE_STATS_ENTRY."</A>");
                }
+
+               // Free the result
+               SQL_FREERESULT($result_pool);
        } else {
                // Mail already deleted!
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NORMAL_MAIL_ALREADY_DELETED);
        } else {
                // Mail already deleted!
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NORMAL_MAIL_ALREADY_DELETED);
@@ -153,24 +149,28 @@ WHERE s.pool_id=%s LIMIT 1",
 } elseif (!empty($_GET['pid'])) {
        // Remove stats entries
        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1",
 } elseif (!empty($_GET['pid'])) {
        // Remove stats entries
        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1",
-        array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+               array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+
+       // Output message
        LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_USER_STATS_REMOVED);
 } elseif ((!empty($_GET['bid'])) && (EXT_IS_ACTIVE("bonus"))) {
        // Load data from bonus mail
        LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_USER_STATS_REMOVED);
 } elseif ((!empty($_GET['bid'])) && (EXT_IS_ACTIVE("bonus"))) {
        // Load data from bonus mail
-       $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
-        array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp, mails_sent FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
+               array(bigintval($_GET['bid'])), __FILE__, __LINE__);
 
        // Delete mail only once
        if (SQL_NUMROWS($result) == 1) {
                // Load data
 
        // Delete mail only once
        if (SQL_NUMROWS($result) == 1) {
                // Load data
-               list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
+               list ($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
+
+               // Reset sent mails for recipient(s)
+               REDUCT_RECIPIENT_RECEIVED_MAILS ("bonus_id", $_GET['bid'], $sent);
 
                // Delete bonus mail entirely from database
 
                // Delete bonus mail entirely from database
-               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
-                array(bigintval($_GET['bid'])), __FILE__, __LINE__);
-               $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s",
-                array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
+                       array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+               SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s",
+                       array(bigintval($_GET['bid'])), __FILE__, __LINE__);
 
                // Prepare data for the template
                define('__ID'     , $id);
 
                // Prepare data for the template
                define('__ID'     , $id);
@@ -184,6 +184,9 @@ WHERE s.pool_id=%s LIMIT 1",
                // Mail already deleted!
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_MAIL_ALREADY_DELETED);
        }
                // Mail already deleted!
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_MAIL_ALREADY_DELETED);
        }
+
+       // Free result
+       SQL_FREERESULT($result);
 } elseif ((!empty($_GET['nid'])) && (GET_EXT_VERSION("bonus") >= "0.8.7")) {
        // Load data from bonus mail
        $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
 } elseif ((!empty($_GET['nid'])) && (GET_EXT_VERSION("bonus") >= "0.8.7")) {
        // Load data from bonus mail
        $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
index c6bdf9c4e1f8a24e477fc06dc30132f09496b446..36a08cea700b88bbef4781045b01e321d86c08cd 100644 (file)
@@ -89,16 +89,10 @@ SQL_FREERESULT($result_rec);
 define('user_max_rec', $dummy);
 
 // Max mails per day
 define('user_max_rec', $dummy);
 
 // Max mails per day
-$result_max = SQL_QUERY("SELECT SUM(max_mails) FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__);
-list($dmy) = SQL_FETCHROW($result_max);
-SQL_FREERESULT($result_max);
-define('max', $dmy);
+define('max', GET_TOTAL_DATA("CONFIRMED", "user_data", "max_mails", "status", false, " AND `max_mails` > 0"));
 
 // Max mails for this day
 
 // Max mails for this day
-$result_rec = SQL_QUERY("SELECT SUM(receive_mails) FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND receive_mails > 0", __FILE__, __LINE__);
-list($dummy) = SQL_FETCHROW($result_rec);
-define('rec', $dummy);
-SQL_FREERESULT($result_rec);
+define('rec', GET_TOTAL_DATA("CONFIRMED", "user_data", "receive_mails", "status", false, " AND `receive_mails` > 0"));
 
 // Initial lots of variables
 $bmails = 0; $sent = 0; $max = 0; $rec = 0; $clicks = 0;
 
 // Initial lots of variables
 $bmails = 0; $sent = 0; $max = 0; $rec = 0; $clicks = 0;
@@ -124,7 +118,7 @@ if (EXT_IS_ACTIVE("bonus")) {
        if (empty($dmy))  $dmy  = 0;
        if (empty($dmy2)) $dmy2 = 0;
        $sent += $dmy2; $clicks += $dmy;
        if (empty($dmy))  $dmy  = 0;
        if (empty($dmy2)) $dmy2 = 0;
        $sent += $dmy2; $clicks += $dmy;
-}
+} // END - if
 
 define('user_stats', ($nmails + $bmails));
 define('sent'      , $sent);
 
 define('user_stats', ($nmails + $bmails));
 define('sent'      , $sent);
index 230c4b91d9f65cc39750a8ec4ec892ad4665fd8f..7bbaee5e1ea1b72aef8816547f227a8d55ab3b0b 100644 (file)
@@ -209,15 +209,24 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                        define('RAND_NUMBER', mt_rand(1000000, 9999999));
                                }
                        } else {
                                        define('RAND_NUMBER', mt_rand(1000000, 9999999));
                                }
                        } else {
+                               // Add language system
+                               include (PATH."inc/language.php");
+
                                // Wrong database?
                                ADD_FATAL(WRONG_DB_SELECTED);
                        }
                } else {
                                // Wrong database?
                                ADD_FATAL(WRONG_DB_SELECTED);
                        }
                } else {
+                       // Add language system
+                       include (PATH."inc/language.php");
+
                        // No link to database!
                        ADD_FATAL(NO_DB_LINK);
                        $db = false;
                }
        } else {
                        // No link to database!
                        ADD_FATAL(NO_DB_LINK);
                        $db = false;
                }
        } else {
+               // Add language system
+               include (PATH."inc/language.php");
+
                // Maybe you forgot to enter your MySQL data?
                ADD_FATAL(MYSQL_DATA_MISSING);
        }
                // Maybe you forgot to enter your MySQL data?
                ADD_FATAL(MYSQL_DATA_MISSING);
        }
index be834e68f24b556582d5ffb35979fa11e559cfd4..b47722f6d9c735cc4c978dc6a3ab34744c7d953b 100644 (file)
@@ -1074,16 +1074,17 @@ function REMOVE_RECEIVER(&$ARRAY, $key, $uid, $pool_id, $stats_id="", $bonus=fal
        // Return status for sending routine
        return $ret;
 }
        // Return status for sending routine
        return $ret;
 }
-//
+
+// Calculate sum (default) or count records of given criteria
 function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") {
        $ret = 0;
        if ($onlyRows) {
                // Count rows
 function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") {
        $ret = 0;
        if ($onlyRows) {
                // Count rows
-               $result = SQL_QUERY_ESC("SELECT COUNT(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+               $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
                 array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        } else {
                // Add all rows
                 array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        } else {
                // Add all rows
-               $result = SQL_QUERY_ESC("SELECT SUM(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+               $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
                 array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        }
 
                 array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
        }
 
@@ -1525,7 +1526,7 @@ function GET_ADMIN_DEFAULT_ACL ($aid) {
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
-                       array(bigintval($ret)), __FILE__, __LINE__);
+                       array(bigintval($aid)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result_aid) == 1) {
                        // Fetch data
                        list($ret) = SQL_FETCHROW($result_aid);
                if (SQL_NUMROWS($result_aid) == 1) {
                        // Fetch data
                        list($ret) = SQL_FETCHROW($result_aid);
@@ -2267,5 +2268,28 @@ ORDER BY ur.refid ASC",
        return $refs;
 }
 
        return $refs;
 }
 
-//
+// Recuced the amount of received emails for the receipients for given email
+function REDUCT_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
+       // Search for mail in database
+       $result = SQL_QUERY_ESC("SELECT `userid` FROM `"._MYSQL_PREFIX."_user_links` WHERE `%s`=%s ORDER BY `userid` ASC LIMIT %s",
+               array($column, bigintval($id), $count), __FILE__, __LINE__);
+
+       // Are there entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Now load all userids for one big query!
+               $UIDs = array();
+               while (list($uid) = SQL_FETCHROW($result)) {
+                       $UIDs[$uid] = $uid;
+               } // END - while
+
+               // Now update all user accounts
+               SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `emails_received`=`emails_received`-1 WHERE `userid` IN (%s) LIMIT %s",
+                       array(implode(",", $UIDs), count($UIDs)), __FILE__, __LINE__);
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+}
+
+// [EOF]
 ?>
 ?>
diff --git a/js.php b/js.php
new file mode 100644 (file)
index 0000000..922b876
--- /dev/null
+++ b/js.php
@@ -0,0 +1,81 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 10/15/2008 *
+ * ===============                              Last change: 10/15/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : js.php                                           *
+ * -------------------------------------------------------------------- *
+ * Short description : Image code for multi-purposes                    *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Code-Bild fuer verschiedene Zwecke               *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Deactivate caching system in fake-CSS mode
+define('_OB_CACHING', "old");
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+
+// This is a fake-CSS file loader, more a JavaScript loader...
+// This is in one way good and in one not. The whole reset part will be
+// by-passed even in this "faked" CSS mode. The bad news is that this makes all
+// JS calls on this script to CSS calls. So no real "request" like in MVC
+// pattern is given...
+//
+// But mxchange 0.3.0 will show that in better way! :D :D :D
+$CSS = "1"; $GLOBALS['module'] = "js";
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is this script installed and a JavaScript tag is provied?
+if ((isBooleanConstantAndTrue('mxchange_installed')) && (isset($_GET['tag']))) {
+       // Set header
+       @header("Content-type: text/javascript");
+
+       // Load header
+       require_once(PATH."inc/header.php");
+
+       // Prepare include file for looking
+       $fqfn = sprintf("%sinc/js/tag-%s.php",
+               PATH,
+               SQL_ESCAPE($_GET['tag'])
+       );
+
+       // Is that file readable?
+       if (FILE_READABLE($fqfn)) {
+               // Include it
+               require_once($fqfn);
+       } // END - if 
+
+       // Load footer
+       require_once(PATH."inc/footer.php");
+} // END - if
+
+//
+?>