]> git.mxchange.org Git - mailer.git/commitdiff
- Beg link does now (not yet implemented but prepared) log all referal URLs. It
authorRoland Häder <roland@mxchange.org>
Sun, 3 Oct 2010 23:04:22 +0000 (23:04 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 3 Oct 2010 23:04:22 +0000 (23:04 +0000)
  is also planed to not pay beg link calls without a referer (admin can setup
  it).
- The database layer is now aware of queries like
  "ALTER TABLE `foo` CHANGE `bar` `bazz` ...."
- Several minor fixes/improvements
- TODOs.txt updated

32 files changed:
DOCS/TODOs.txt
beg.php
click.php
inc/db/lib-mysql3.php
inc/extensions-functions.php
inc/extensions/ext-beg.php
inc/extensions/ext-booking.php
inc/extensions/ext-refback.php
inc/extensions/ext-sql_patches.php
inc/language/beg_de.php
inc/language/de.php
inc/libs/beg_functions.php
inc/libs/bonus_functions.php
inc/libs/booking_functions.php
inc/libs/mediadata_functions.php
inc/libs/network_functions.php
inc/libs/refback_functions.php
inc/libs/sponsor_functions.php
inc/libs/surfbar_functions.php
inc/libs/user_functions.php
inc/module-functions.php
inc/modules/admin/what-adminedit.php
inc/modules/admin/what-edit_emails.php
inc/modules/admin/what-lock_user.php
inc/modules/admin/what-refbanner.php
inc/modules/admin/what-unlock_sponsor.php
inc/modules/guest/what-sponsor_login.php
inc/modules/member/what-mydata.php
inc/modules/order.php
inc/mysql-manager.php
inc/pool/pool-user.php
templates/de/html/admin/admin_user_details.tpl

index c670c833e14d793ce3a596537a0d62aaac97b29b..44c02fc533add09bf8a64257e0aea2eefbe0f8db 100644 (file)
@@ -1,7 +1,7 @@
 ### WARNING: THIS FILE IS AUTO-GENERATED BY ./DOCS/todo-builder.sh (uid=/user=quix0r) ###
 ### DO NOT EDIT THIS FILE. ###
 ./autoreg.php:58:// @TODO Add processing of request here
 ### WARNING: THIS FILE IS AUTO-GENERATED BY ./DOCS/todo-builder.sh (uid=/user=quix0r) ###
 ### DO NOT EDIT THIS FILE. ###
 ./autoreg.php:58:// @TODO Add processing of request here
-./beg.php:163:                 // @TODO Opps, what is missing here???
+./beg.php:171:                 // @TODO Opps, what is missing here???
 ./birthday_confirm.php:93:             // @TODO Try to rewrite the following unset()
 ./inc/autopurge/purge-inact.php:55:    // @TODO Rewrite these if() blocks to a filter
 ./inc/cache/config-local.php:124:// @TODO Rewrite the following three constants, somehow...
 ./birthday_confirm.php:93:             // @TODO Try to rewrite the following unset()
 ./inc/autopurge/purge-inact.php:55:    // @TODO Rewrite these if() blocks to a filter
 ./inc/cache/config-local.php:124:// @TODO Rewrite the following three constants, somehow...
@@ -60,9 +60,9 @@
 ./inc/language/refback_de.php:44:// @TODO Rewrite these constants to one
 ./inc/language/sponsor_de.php:117:// @TODO Rewrite these four constants to one and use sprintf()
 ./inc/libs/admins_functions.php:430:           // @TODO This can be, somehow, rewritten
 ./inc/language/refback_de.php:44:// @TODO Rewrite these constants to one
 ./inc/language/sponsor_de.php:117:// @TODO Rewrite these four constants to one and use sprintf()
 ./inc/libs/admins_functions.php:430:           // @TODO This can be, somehow, rewritten
-./inc/libs/beg_functions.php:52:               // @TODO Try to rewrite the following unset()
+./inc/libs/beg_functions.php:55:               // @TODO Try to rewrite the following unset()
 ./inc/libs/bonus_functions.php:199:            // @TODO Move this HTML to a template
 ./inc/libs/bonus_functions.php:199:            // @TODO Move this HTML to a template
-./inc/libs/bonus_functions.php:283:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
+./inc/libs/bonus_functions.php:287:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/libs/cache_functions.php:78:             // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
 ./inc/libs/doubler_functions.php:44:// @TODO Lame description
 ./inc/libs/doubler_functions.php:92:                   // @TODO Can't this be moved into EL?
 ./inc/libs/cache_functions.php:78:             // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
 ./inc/libs/doubler_functions.php:44:// @TODO Lame description
 ./inc/libs/doubler_functions.php:92:                   // @TODO Can't this be moved into EL?
@@ -77,7 +77,8 @@
 ./inc/libs/register_functions.php:362: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
 ./inc/libs/sponsor_functions.php:159:                                  // @TODO Rewrite this to API function
 ./inc/libs/sponsor_functions.php:430:                  // @TODO Rewrite this to API function
 ./inc/libs/register_functions.php:362: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
 ./inc/libs/sponsor_functions.php:159:                                  // @TODO Rewrite this to API function
 ./inc/libs/sponsor_functions.php:430:                  // @TODO Rewrite this to API function
-./inc/libs/surfbar_functions.php:1538:         // @TODO This can be somehow rewritten
+./inc/libs/surfbar_functions.php:1026: // @TODO Try to rewrite the following unset()
+./inc/libs/surfbar_functions.php:1541:         // @TODO This can be somehow rewritten
 ./inc/libs/surfbar_functions.php:710:// @TODO Can't we use our new expression language instead of this ugly code?
 ./inc/libs/surfbar_functions.php:951:  // @TODO Invalid salt should be refused
 ./inc/libs/task_functions.php:239:             // @TODO These can be rewritten to filter
 ./inc/libs/surfbar_functions.php:710:// @TODO Can't we use our new expression language instead of this ugly code?
 ./inc/libs/surfbar_functions.php:951:  // @TODO Invalid salt should be refused
 ./inc/libs/task_functions.php:239:             // @TODO These can be rewritten to filter
@@ -86,9 +87,9 @@
 ./inc/libs/user_functions.php:144:     // @TODO These two constants are no longer used, maybe we reactivate this code?
 ./inc/libs/user_functions.php:232:// @TODO Double-check configuration entry here
 ./inc/libs/user_functions.php:325:                     // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
 ./inc/libs/user_functions.php:144:     // @TODO These two constants are no longer used, maybe we reactivate this code?
 ./inc/libs/user_functions.php:232:// @TODO Double-check configuration entry here
 ./inc/libs/user_functions.php:325:                     // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-./inc/libs/user_functions.php:345:                     // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
-./inc/libs/user_functions.php:421:     // @TODO We should try to rewrite this to fetchUserData() somehow
-./inc/libs/user_functions.php:609:                                     // @TODO Try to rewrite the following unset()
+./inc/libs/user_functions.php:347:                     // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
+./inc/libs/user_functions.php:423:     // @TODO We should try to rewrite this to fetchUserData() somehow
+./inc/libs/user_functions.php:611:                                     // @TODO Try to rewrite the following unset()
 ./inc/libs/yoomedia_functions.php:114: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:75:      // @TODO Rewrite them to avoid this else block
 ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
 ./inc/libs/yoomedia_functions.php:114: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:75:      // @TODO Rewrite them to avoid this else block
 ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
 ./inc/modules/member/what-unconfirmed.php:206:                         // @TODO This 'userid' cannot be saved because of encapsulated EL code
 ./inc/modules/order.php:74:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:67:    // @TODO Rewrite this to a filter
 ./inc/modules/member/what-unconfirmed.php:206:                         // @TODO This 'userid' cannot be saved because of encapsulated EL code
 ./inc/modules/order.php:74:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:67:    // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1172:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1427:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1535:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1902:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1946:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1188:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1443:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1551:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1922:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1966:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:368:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:49:// @TODO This should be converted in a daily beg rallye
 ./inc/mysql-manager.php:368:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:49:// @TODO This should be converted in a daily beg rallye
diff --git a/beg.php b/beg.php
index 60afef8e96dafaaa2e761f64b7a22fc294e41dbc..387c9e6accc6915b216beaceaa66e9835433c3ea 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -83,9 +83,11 @@ if (isGetRequestParameterSet('userid')) {
 
        // Check if account was found
        if ((isUserDataValid()) && (getUserData('status') == 'CONFIRMED')) {
 
        // Check if account was found
        if ((isUserDataValid()) && (getUserData('status') == 'CONFIRMED')) {
-               // Multiply configured values with 100000 and divide with 100000 so we can also handle small values
-               // If we need more number behind the decimal dot then we just need to increase all these three
-               // numbers matching to the numbers behind the decimal dot. Simple! ;-)
+               /*
+                * Multiply configured values with 100000 and divide with 100000 so we can also handle small values
+                * If we need more number behind the decimal dot then we just need to increase all these three
+                * numbers matching to the numbers behind the decimal dot. Simple! ;-)
+                */
                $points = mt_rand((getConfig('beg_points') * 100000), (getConfig('beg_points_max') * 100000)) / 100000;
 
                // Set nickname / userid for template
                $points = mt_rand((getConfig('beg_points') * 100000), (getConfig('beg_points_max') * 100000)) / 100000;
 
                // Set nickname / userid for template
@@ -109,14 +111,20 @@ if (isGetRequestParameterSet('userid')) {
                if (((SQL_HASZERONUMS($result)) || (isAdmin())) && ($points > 0) && (!isMember()) && (getConfig('beg_pay_mode') == 'NONE')) {
                        // Admin is testing?
                        if (!isAdmin()) {
                if (((SQL_HASZERONUMS($result)) || (isAdmin())) && ($points > 0) && (!isMember()) && (getConfig('beg_pay_mode') == 'NONE')) {
                        // Admin is testing?
                        if (!isAdmin()) {
-                               // Remember remote address, userid and timestamp for next click
-                               // but only when there is no admin begging.
-                               // Admins shall be able to test it!
+                               /*
+                                * Remember remote address, userid and timestamp for next click
+                                * but only when there is no admin begging.
+                                * Admins shall be able to test it!
+                                */
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_beg_ips` (`userid`, `remote_ip`,`sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_beg_ips` (`userid`, `remote_ip`,`sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
-                                       array(getUserData('userid'), detectRemoteAddr(), session_id()), __FILE__, __LINE__);
+                                       array(
+                                               getUserData('userid'),
+                                               detectRemoteAddr(),
+                                               session_id()
+                                       ), __FILE__, __LINE__);
 
                                // Was is successfull?
 
                                // Was is successfull?
-                               $pay (SQL_AFFECTEDROWS() == 1);
+                               $pay (!SQL_HASZEROAFFECTED());
                        } else {
                                // Is admin!
                                $pay = true;
                        } else {
                                // Is admin!
                                $pay = true;
index a43e2cbfe9afcabb7f14abe088cd9542640c96e5..3f303196fff8eca41228074ce3cf1ce663f24e19 100644 (file)
--- a/click.php
+++ b/click.php
@@ -54,7 +54,7 @@ if ((isGetRequestParameterSet('user')) && (isGetRequestParameterSet('banner')))
        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", array(bigintval(getRequestParameter('banner'))), __FILE__, __LINE__);
 
        // A line has been updated?
        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", array(bigintval(getRequestParameter('banner'))), __FILE__, __LINE__);
 
        // A line has been updated?
-       if ((SQL_AFFECTEDROWS() == 1) && (isGetRequestParameterSet('user'))) {
+       if ((!SQL_HASZEROAFFECTED()) && (isGetRequestParameterSet('user'))) {
                // Redirect to the user's referal link
                redirectToUrl('ref.php?refid=' . bigintval(getRequestParameter('user')));
        } // END - if
                // Redirect to the user's referal link
                redirectToUrl('ref.php?refid=' . bigintval(getRequestParameter('user')));
        } // END - if
index d2d13ba4530eb4dc92544699149b3ee06ead3ead..8aeff002e20daf7443f274cbda9f2ac9177bc09e 100644 (file)
@@ -382,7 +382,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
        $tableName = str_replace('`', '', $tableArray[2]);
 
        // Shall we add/drop?
        $tableName = str_replace('`', '', $tableArray[2]);
 
        // Shall we add/drop?
-       if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false)) && ($noIndex === true)) {
+       if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false) || (strpos($sql, 'CHANGE') !== false)) && ($noIndex === true)) {
                // Try two columns, one should fix
                foreach (array(4,5) as $idx) {
                        // And column name as well
                // Try two columns, one should fix
                foreach (array(4,5) as $idx) {
                        // And column name as well
@@ -392,27 +392,31 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
                        $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
                                array($tableName, $columnName), __FUNCTION__, __LINE__);
 
                        $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
                                array($tableName, $columnName), __FUNCTION__, __LINE__);
 
-                       // Do we have no entry on ADD or an entry on DROP?
-                       // 123           4       4     3    3      4           4          32    23           4       4     3    3      4            4          321
-                       if (((SQL_HASZERONUMS($result)) && (strpos($sql, 'ADD') !== false)) || ((SQL_NUMROWS($result) == 1) && (strpos($sql, 'DROP') !== false))) {
+                       // Debug log
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)));
+
+                       // Do we have no entry on ADD or an entry on DROP/CHANGE?
+                       // 123               4       43    3      4           4          32    23           4       4     3    3      4            4          32    23                4       43    3      4              4          3    3         321
+                       if (((SQL_HASZERONUMS($result)) && (strpos($sql, 'ADD') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'CHANGE') !== false) && ($idx == 5))) {
                                // Do the query
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
                                $result = SQL_QUERY($sql, $F, $L, false);
 
                                // Skip further attempt(s)
                                break;
                                // Do the query
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
                                $result = SQL_QUERY($sql, $F, $L, false);
 
                                // Skip further attempt(s)
                                break;
-                       } elseif ((((SQL_NUMROWS($result) == 1) && (strpos($sql, 'ADD') !== false)) || ((SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false))) && ($columnName != 'KEY')) {
+                       //       1234                5       54    4      5           5          43    34                5       54    4      5            5          43    3      4              4          32    2                    21
+                       } elseif ((((!SQL_HASZERONUMS($result)) && (strpos($sql, 'ADD') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false)) || (strpos($sql, 'CHANGE') !== false)) && ($columnName != 'KEY')) {
                                // Abort here because it is alreay there
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: ' . $sql);
                                break;
                        } elseif ($columnName != 'KEY') {
                                // Abort here because it is alreay there
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: ' . $sql);
                                break;
                        } elseif ($columnName != 'KEY') {
-                               // Something didn't fit
-                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql);
+                               // Something didn't fit, we better log it
+                               logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)) . '');
                        }
                } // END - foreach
        } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
                // Skip this query silently
                        }
                } // END - foreach
        } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
                // Skip this query silently
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,file=%s,line=%s", $sql, $F, $L));
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,columnName=%s,idx=%d,hasZeroNums=%d,file=%s,line=%s", $sql, $columnName, $idx, intval(SQL_HASZERONUMS($result)), $F, $L));
        } elseif ($noIndex === false) {
                // And column name as well
                //* DEBUG: */ debugOutput(__LINE__.':tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
        } elseif ($noIndex === false) {
                // And column name as well
                //* DEBUG: */ debugOutput(__LINE__.':tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
@@ -545,6 +549,12 @@ function SQL_HASZERONUMS ($result) {
        return (SQL_NUMROWS($result) === 0);
 }
 
        return (SQL_NUMROWS($result) === 0);
 }
 
+// Wrapper function to make code more readable
+function SQL_HASZEROAFFECTED () {
+       // Just pass it through
+       return (SQL_AFFECTEDROWS() === 0);
+}
+
 // Private function to prepare the SQL query string
 function SQL_PREPARE_SQL_STRING ($sqlString, $enableCodes = true) {
        // Is it already cached?
 // Private function to prepare the SQL query string
 function SQL_PREPARE_SQL_STRING ($sqlString, $enableCodes = true) {
        // Is it already cached?
index 95fbd32cfdd3b34e03d2a2e7e93c6472523795c4..8fab51c468ce87a10d168a3e8fe0ca9e7e2b9eed 100644 (file)
@@ -475,7 +475,7 @@ function doExtensionSqls ($ext_id, $load_mode) {
        runFilterChain('extension_' . $load_mode);
 
        // Remove cache file(s) if extension is active
        runFilterChain('extension_' . $load_mode);
 
        // Remove cache file(s) if extension is active
-       if (((isExtensionActive('cache')) && ((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($load_mode == 'activate') || ($load_mode == 'deactivate'))) {
+       if (((isExtensionActive('cache')) && ((!SQL_HASZEROAFFECTED())) || ($sqlRan === true) || ($load_mode == 'activate') || ($load_mode == 'deactivate'))) {
                // Run filters
                runFilterChain('post_extension_run_sql', getCurrentExtensionName());
        } // END - if
                // Run filters
                runFilterChain('post_extension_run_sql', getCurrentExtensionName());
        } // END - if
@@ -1804,7 +1804,7 @@ function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
                addExtensionSql($sql);
        } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
                addExtensionSql($sql);
        } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
-               logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double guest menu action=%s,what=%s,title=%s,active=%s detected.", $action, $what, $title, $active));
+               logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double guest menu action=%s,what=%s,title=%s,locked=%s,visible=%s detected.", $action, $what, $title, $locked, $visible));
        }
 }
 
        }
 }
 
index 1b29e1c7a291f35173d4c03dbf988e9f1d6d5593..d591d04bc894cde6bf5000bc8acacd7a2a631bb2 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.2.8');
+setThisExtensionVersion('0.2.9');
 
 // Version history array (add more with , '0.1.0' and so on)
 
 // Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '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', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8'));
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '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', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9'));
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
@@ -62,6 +62,7 @@ switch (getExtensionMode()) {
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
 `timeout` VARCHAR(10) NOT NULL DEFAULT '',
 `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
 `timeout` VARCHAR(10) NOT NULL DEFAULT '',
+`sid` VARCHAR(255) NOT NULL DEFAULT '',
 KEY (`userid`),
 PRIMARY KEY (`id`)
 ) TYPE={?_TABLE_TYPE?}");
 KEY (`userid`),
 PRIMARY KEY (`id`)
 ) TYPE={?_TABLE_TYPE?}");
@@ -70,9 +71,10 @@ PRIMARY KEY (`id`)
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_ips`');
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
                addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_ips`');
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_beg' OR `what`='list_beg'");
+               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_referals`');
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_beg','list_beg','list_beg_referal_urls')");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='beg'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `what`='beg'");
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='beg' OR `what`='beg2'");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what` IN ('beg','beg2')");
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                break;
 
        case 'activate': // Do stuff when admin activates this extension
@@ -249,7 +251,7 @@ PRIMARY KEY (`id`)
                                setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
                                break;
 
                                setExtensionUpdateNotes("Fehlerhinweis bei deaktivierter Erweiterung verbessert.");
                                break;
 
-                       case '0.2.6': // SQL queries for v0.2.6
+                       case '0.2.6': // SQL queries for v0.2.6
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_beg_ips` ADD `sid` VARCHAR(255) NOT NULL DEFAULT ''");
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_pay_mode` ENUM('IMG','JS','BOTH','NONE') DEFAULT 'NONE' NOT NULL ;");
 
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_beg_ips` ADD `sid` VARCHAR(255) NOT NULL DEFAULT ''");
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `beg_pay_mode` ENUM('IMG','JS','BOTH','NONE') DEFAULT 'NONE' NOT NULL ;");
 
@@ -277,6 +279,24 @@ PRIMARY KEY (`id`)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Umbenannt nach neuer Namenskonvention");
                                break;
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Umbenannt nach neuer Namenskonvention");
                                break;
+
+                       case '0.2.9': // SQL queries for v0.2.9
+                               addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_beg_referals`');
+                               addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_beg_referals` (
+`id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+`userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+`remote_ip` VARCHAR( 15 ) NOT NULL DEFAULT '0.0.0.0',
+`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
+`referal_url` TINYTEXT NOT NULL ,
+INDEX ( `userid` )
+) ENGINE = {?_TABLE_TYPE?} COMMENT = 'Recorded Referal URLs'");
+
+                               // Add admin menu
+                               addAdminMenuSql('user','list_beg_referal_urls','Bettel-Referals auflisten','Listet alle Bettellink-Aufrufe inklusive Referal-URL auf.','13');
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Loggen der Referal-URLs hinzugef&uuml;gt.");
+                               break;
                } // END - switch
                break;
 
                } // END - switch
                break;
 
@@ -290,7 +310,7 @@ PRIMARY KEY (`id`)
                // Remove old entries
                $OLD = getConfig('beg_timeout');
                if (getConfig('beg_userid_timeout') > $OLD) $OLD = getConfig('beg_userid_timeout');
                // Remove old entries
                $OLD = getConfig('beg_timeout');
                if (getConfig('beg_userid_timeout') > $OLD) $OLD = getConfig('beg_userid_timeout');
-               $result_ext = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ' . ($OLD + 60*60) . ')', __FILE__, __LINE__);
+               SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ' . ($OLD + 60*60) . ')', __FILE__, __LINE__);
 
                // Check for beg rallye is active and send mails out
                if ((isBegRallyeEnabled()) && (isBegNewMemberNotifyEnabled())) {
 
                // Check for beg rallye is active and send mails out
                if ((isBegRallyeEnabled()) && (isBegNewMemberNotifyEnabled())) {
index 7900d6d41aea2f2c4e7c9350658cb816045dff8c..ea0d1b45b606b1392ff7ca8ea133395f42207425 100644 (file)
@@ -109,7 +109,7 @@ PRIMARY KEY (`id`)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes('');
                                break;
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes('');
                                break;
-               }
+               } // END - switch
 
        case 'modify': // When the extension got modified
                break;
 
        case 'modify': // When the extension got modified
                break;
@@ -123,7 +123,7 @@ PRIMARY KEY (`id`)
        default: // Unknown extension mode
                logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
        default: // Unknown extension mode
                logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
                break;
-}
+} // END - switch
 
 // [EOF]
 ?>
 
 // [EOF]
 ?>
index d7e07134f4e9109005565dc9b2548940a174f732..940a2cff798d758b089242ed869633502b6e1990 100644 (file)
@@ -61,7 +61,7 @@ PRIMARY KEY (`id`),
 UNIQUE `user_refid` (`userid`,`level`,`refid`),
 KEY (`level`),
 KEY (`refid`)
 UNIQUE `user_refid` (`userid`,`level`,`refid`),
 KEY (`level`),
 KEY (`refid`)
-) ENGINE={?_TABLE_TYPE?} COMMENT='User Referals With Refback'");
+) ENGINE = {?_TABLE_TYPE?} COMMENT='User Referals With Refback'");
                addMemberMenuSql('main','refback','Ref-Back einstellen','N','Y',4);
 
                // Execute this special file on registration
                addMemberMenuSql('main','refback','Ref-Back einstellen','N','Y',4);
 
                // Execute this special file on registration
index fc66df9d3fc2fc17b07ed75e85f4b0a2ea8e89aa..9ae78ef3660d2ffac48381cf1dd12fd5916e0553 100644 (file)
@@ -720,7 +720,7 @@ CHANGE `what` `what` VARCHAR(50) NULL DEFAULT NULL');
 `added` DATETIME NOT NULL,
 PRIMARY KEY (`hostname`),
 INDEX (`ip`)
 `added` DATETIME NOT NULL,
 PRIMARY KEY (`hostname`),
 INDEX (`ip`)
-) ENGINE={?_TABLE_TYPE?}");
+) ENGINE = {?_TABLE_TYPE?}");
 
                                // Configuration
                                addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `dns_cache_timeout` BIGINT(20) NOT NULL DEFAULT ' . (60*60*24));
 
                                // Configuration
                                addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `dns_cache_timeout` BIGINT(20) NOT NULL DEFAULT ' . (60*60*24));
index ecbe31500b9472f357d9c7036857c7143e454276..7d2896f008247fd703ff81fd61e057a857db5f48 100644 (file)
@@ -55,7 +55,7 @@ addMessages(array(
        'BEG_CLICKS' => "Dies war insgesamt der <strong>%s.</strong> Klick auf sein Bettel-Link.",
        'BEG_THANKS_FOR_CLICK' => "Danke f&uuml;r Ihre Spende.",
        'BEG_CONTINUE_REGISTER' => "Und weiter geht es zur Anmeldung bei {?MAIN_TITLE?} ...",
        'BEG_CLICKS' => "Dies war insgesamt der <strong>%s.</strong> Klick auf sein Bettel-Link.",
        'BEG_THANKS_FOR_CLICK' => "Danke f&uuml;r Ihre Spende.",
        'BEG_CONTINUE_REGISTER' => "Und weiter geht es zur Anmeldung bei {?MAIN_TITLE?} ...",
-       'BEG_SORRY_ANOTHER_WAS_HERE_1' => "Oh schade! Es war vor kurzem schon einer hier! Das Mitglied ",
+       'BEG_SORRY_ANOTHER_WAS_HERE_1' => "Oh, schade! Es war vor kurzem schon einer hier! Das Mitglied ",
        'BEG_SORRY_ANOTHER_WAS_HERE_2' => " hat von Ihnen auch keine ",
        'BEG_SORRY_ANOTHER_WAS_HERE_3' => " {?POINTS?} erhalten.",
        'BEG_THANKS_FOR_CLICK_AGAIN' => "Danke dennoch f&uuml;r den erneuten Klick.",
        'BEG_SORRY_ANOTHER_WAS_HERE_2' => " hat von Ihnen auch keine ",
        'BEG_SORRY_ANOTHER_WAS_HERE_3' => " {?POINTS?} erhalten.",
        'BEG_THANKS_FOR_CLICK_AGAIN' => "Danke dennoch f&uuml;r den erneuten Klick.",
@@ -77,7 +77,7 @@ addMessages(array(
        'ADMIN_SELECT_BEG_MODE' => "Verg&uuml;tungsmodus der erbettelten {?POINTS?}",
        'BEG_MODE_DIRECT' => "Nur direktem Mitglied gutschreiben.",
        'BEG_MODE_REF' => "Auch dem Werber des Mitgliedes gutschreiben.",
        'ADMIN_SELECT_BEG_MODE' => "Verg&uuml;tungsmodus der erbettelten {?POINTS?}",
        'BEG_MODE_DIRECT' => "Nur direktem Mitglied gutschreiben.",
        'BEG_MODE_REF' => "Auch dem Werber des Mitgliedes gutschreiben.",
-       'BEG_SORRY_YOURE_LOGGED_IN_1' => "Oh schade! Sie haben vermutlich auf Ihren eigenen Bettel-Link mit der Mitglieder-Id ",
+       'BEG_SORRY_YOURE_LOGGED_IN_1' => "Oh, schade! Sie haben vermutlich auf Ihren eigenen Bettel-Link mit der Mitglieder-Id ",
        'BEG_SORRY_YOURE_LOGGED_IN_2' => " geklickt. Sie haben somit auch keine ",
        'BEG_SORRY_YOURE_LOGGED_IN_3' => " {?POINTS?} erhalten.",
        'BEG_SAME_UID_AS_OWN' => "Mitglieder-Id des Webmasters benutzt.",
        'BEG_SORRY_YOURE_LOGGED_IN_2' => " geklickt. Sie haben somit auch keine ",
        'BEG_SORRY_YOURE_LOGGED_IN_3' => " {?POINTS?} erhalten.",
        'BEG_SAME_UID_AS_OWN' => "Mitglieder-Id des Webmasters benutzt.",
index be7d4074ad14f1ed98077dc96f76aab534e9abc6..4abf6b23b878e25165b3d57a0411b7d5d38f4e29 100644 (file)
@@ -119,7 +119,7 @@ addMessages(array(
        'UNDO_SELECTIONS' => "Auswahl zur&uuml;cknehmen",
        'ADMIN_EDIT_MENUS' => "Men&uuml;s bearbeiten",
        'ADMIN_DELETE_MENUS' => "Men&uuml;s l&ouml;schen",
        'UNDO_SELECTIONS' => "Auswahl zur&uuml;cknehmen",
        'ADMIN_EDIT_MENUS' => "Men&uuml;s bearbeiten",
        'ADMIN_DELETE_MENUS' => "Men&uuml;s l&ouml;schen",
-       'ADMIN_EDIT_ADMIN_MENU' => "Admin-Men&uuml;eintr&auml;ge &auml;ndern",
+       'ADMIN_EDIT_ADMIN_MENU_TITLE' => "Admin-Men&uuml;eintr&auml;ge &auml;ndern",
        'ADMIN_EDIT_MENU' => "Es soll/sollen <span class=\"data\">%s</span> Men&uuml;eintrag/-eintr&auml;ge ge&auml;ndert werden:",
        'ADMIN_ENTRY_MODIFY' => "Eintrag",
        'SUBMIT_CHANGES' => "&Auml;nderungen durchf&uuml;hren",
        'ADMIN_EDIT_MENU' => "Es soll/sollen <span class=\"data\">%s</span> Men&uuml;eintrag/-eintr&auml;ge ge&auml;ndert werden:",
        'ADMIN_ENTRY_MODIFY' => "Eintrag",
        'SUBMIT_CHANGES' => "&Auml;nderungen durchf&uuml;hren",
index 6536b44c3d6b47e1047132c74b0bb92e173e62e1..90e61bdc45bf6a84aee9ea7fe8e0dc912f055618 100644 (file)
@@ -42,6 +42,9 @@ if (!defined('__SECURITY')) {
 
 // Add points to user or begging rallye account
 function addPointsBeg ($userid, $points) {
 
 // Add points to user or begging rallye account
 function addPointsBeg ($userid, $points) {
+       // Default is not added
+       $added = false;
+
        // Is begging rallye active?
        if (isBegRallyeEnabled()) {
                // Add points to rallye account
        // Is begging rallye active?
        if (isBegRallyeEnabled()) {
                // Add points to rallye account
@@ -51,7 +54,7 @@ function addPointsBeg ($userid, $points) {
                // Add points to account
                // @TODO Try to rewrite the following unset()
                unset($GLOBALS['ref_level']);
                // Add points to account
                // @TODO Try to rewrite the following unset()
                unset($GLOBALS['ref_level']);
-               addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getConfig('beg_mode')));
+               $added = addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getConfig('beg_mode')));
        }
 
        // Subtract begged points from member account if the admin has selected one
        }
 
        // Subtract begged points from member account if the admin has selected one
@@ -59,6 +62,9 @@ function addPointsBeg ($userid, $points) {
                // Subtract from this account
                subtractPoints('beg_payout', getConfig('beg_userid'), $points);
        } // END - if
                // Subtract from this account
                subtractPoints('beg_payout', getConfig('beg_userid'), $points);
        } // END - if
+
+       // Return result
+       return $added;
 }
 
 // Checks wether beg_rallye is enabled
 }
 
 // Checks wether beg_rallye is enabled
index 286a79e3ee117ec9ed933d41dad273967c8d1545..2b75d7b96af98ebc4b87f4cb787eff85f68db5c9 100644 (file)
@@ -107,7 +107,7 @@ function addTurboBonus ($mid, $userid, $type) {
                        $points
                ), __FUNCTION__, __LINE__);
 
                        $points
                ), __FUNCTION__, __LINE__);
 
-       if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getConfig('bonus_mode') != 'ADD') && ($points > 0)) handleBonusPoints($points);
+       if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) handleBonusPoints($points);
 }
 
 //
 }
 
 //
@@ -214,7 +214,7 @@ function handleBonusPoints ($mode) {
        if (!isBonusRallyeActive()) return;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
        if (!isBonusRallyeActive()) return;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
-       if ((getConfig('bonus_mode') == 'UID') && (getBonusUserId() == '0') && (isExtensionActive('jackpot'))) {
+       if ((getBonusMode() == 'UID') && (getBonusUserId() == '0') && (isExtensionActive('jackpot'))) {
                // Update database & config
                updateConfiguration('bonus_mode', 'JACKPOT');
        } // END - if
                // Update database & config
                updateConfiguration('bonus_mode', 'JACKPOT');
        } // END - if
@@ -231,7 +231,7 @@ function handleBonusPoints ($mode) {
        $total = getTotalPoints(getBonusUserId());
 
        // Subtract points from...
        $total = getTotalPoints(getBonusUserId());
 
        // Subtract points from...
-       switch (getConfig('bonus_mode')) {
+       switch (getBonusMode()) {
                case 'JACKPOT': // ... jackpot
                        if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getBonusUserId()))) {
                                if ($total >= $points) {
                case 'JACKPOT': // ... jackpot
                        if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) == -1) && (isValidUserId(getBonusUserId()))) {
                                if ($total >= $points) {
@@ -250,6 +250,10 @@ function handleBonusPoints ($mode) {
                                $dummy = subtractPointsFromJackpot($points);
                        }
                        break;
                                $dummy = subtractPointsFromJackpot($points);
                        }
                        break;
+
+               default: // This should not happen
+                       debug_report_bug(__FUNCTION__, __LINE__, 'Invalid config entry ' . getBonusMode() . ' detected.');
+                       break;
        } // END - switch
 }
 
        } // END - switch
 }
 
@@ -258,7 +262,7 @@ function purgeExpiredTurboBonus() {
        // Remove entries
        $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})', __FUNCTION__, __LINE__);
 
        // Remove entries
        $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})', __FUNCTION__, __LINE__);
 
-       if (SQL_AFFECTEDROWS() > 0) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Send out email to admin
                sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_autopurge_turbo', SQL_AFFECTEDROWS());
        } // END - if
                // Send out email to admin
                sendAdminNotification('{--ADMIN_AUTOPURGE_TURBO_SUBJECT--}', 'admin_autopurge_turbo', SQL_AFFECTEDROWS());
        } // END - if
@@ -295,7 +299,7 @@ LIMIT 1',
                );
 
                // Updated entry?
                );
 
                // Updated entry?
-               $bonus = (SQL_AFFECTEDROWS() == 1);
+               $bonus = (!SQL_HASZEROAFFECTED());
        } // END - if
 
        if (($bonus === true) && (getRequestParameter('mode') == 'bonus')) {
        } // END - if
 
        if (($bonus === true) && (getRequestParameter('mode') == 'bonus')) {
@@ -347,5 +351,17 @@ function getBonusTimeout () {
        return $GLOBALS[__FUNCTION__];
 }
 
        return $GLOBALS[__FUNCTION__];
 }
 
+// Getter for bonus_mode
+function getBonusMode () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('bonus_mode');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>
 // [EOF]
 ?>
index 603f70a97c455a77eb6c15c813a4d68fc48fbd47..7373071ba62e2b069a431970aae8b4c8a3b4d855 100644 (file)
@@ -57,6 +57,9 @@ function addBookingRecord ($subject, $userid, $points, $mode) {
 function FILTER_ADD_BOOKING_RECORD ($data) {
        // Add a record
        addBookingRecord($data['subject'], $data['userid'], $data['points'], $data['mode']);
 function FILTER_ADD_BOOKING_RECORD ($data) {
        // Add a record
        addBookingRecord($data['subject'], $data['userid'], $data['points'], $data['mode']);
+
+       // Return data
+       return $data;
 }
 
 // [EOF]
 }
 
 // [EOF]
index 164a70f131d45e9db7b92ccf44fcbb9f7bd4158e..65ad9e015899ae15a28e616dc483852829e0c262 100644 (file)
@@ -42,35 +42,64 @@ if (!defined('__SECURITY')) {
 
 // Update an entry
 function updateMediadataEntry ($keys_array, $mode, $value) {
 
 // Update an entry
 function updateMediadataEntry ($keys_array, $mode, $value) {
+       // Default is nothing added/updated
+       $added = null;
+
+       // Do we have entries?
        if (is_array($keys_array) && ($value > 0)) {
                // Is an array so we can run it through
                foreach ($keys_array as $key) {
                        // First check if it does exist
        if (is_array($keys_array) && ($value > 0)) {
                // Is an array so we can run it through
                foreach ($keys_array as $key) {
                        // First check if it does exist
-                       $result_media = SQL_QUERY_ESC("SELECT media_key FROM `{?_MYSQL_PREFIX?}_mediadata`
-WHERE media_key = '%s' LIMIT 1", array($key), __FUNCTION__, __LINE__);
+                       $result_media = SQL_QUERY_ESC("SELECT
+       `media_key`
+FROM
+       `{?_MYSQL_PREFIX?}_mediadata`
+WHERE
+       `media_key` = '%s'
+LIMIT 1", array($key), __FUNCTION__, __LINE__);
                        if (SQL_NUMROWS($result_media) == 0) {
                                // Not found so we create it (mode will be ignored here!)
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')",
                        if (SQL_NUMROWS($result_media) == 0) {
                                // Not found so we create it (mode will be ignored here!)
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')",
-                               array($key, $value), __FUNCTION__, __LINE__);
+                                       array($key, $value), __FUNCTION__, __LINE__);
                        } else {
                                // Update entry
                                switch ($mode) {
                                        case 'add': $mode = '+'; break;
                                        case 'sub': $mode = '-'; break;
                        } else {
                                // Update entry
                                switch ($mode) {
                                        case 'add': $mode = '+'; break;
                                        case 'sub': $mode = '-'; break;
-                               }
+                               } // END - switch
 
                                if ($mode == 'init') {
                                        // Initialize entry
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=%s WHERE `media_key`='%s' LIMIT 1",
 
                                if ($mode == 'init') {
                                        // Initialize entry
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=%s WHERE `media_key`='%s' LIMIT 1",
-                                       array($value, $key), __FUNCTION__, __LINE__);
+                                               array($value, $key), __FUNCTION__, __LINE__);
                                } else {
                                        // Update entry
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=`media_value`".$mode."%s WHERE `media_key`='%s' LIMIT 1",
                                } else {
                                        // Update entry
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET `media_value`=`media_value`".$mode."%s WHERE `media_key`='%s' LIMIT 1",
-                                       array($value, $key), __FUNCTION__, __LINE__);
+                                               array($value, $key), __FUNCTION__, __LINE__);
                                }
                        }
                                }
                        }
-               }
-       }
+
+                       // Check affected rows
+                       if (is_null($added)) {
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
+                               $added = (!SQL_HASZEROAFFECTED());
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
+                       } else {
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
+                               $added = ($added && (!SQL_HASZEROAFFECTED()));
+                               //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
+                       }
+               } // END - foreach
+       } // END - if
+
+       // Zero entries are always added
+       if ($value == 0) {
+               // Is zero value, so we need to set $added here to avoid wrong false result
+               $added = true;
+       } // END - if
+
+       // Return result
+       return $added;
 }
 
 // Getter for entry
 }
 
 // Getter for entry
@@ -93,7 +122,10 @@ function getMediadataEntry ($key) {
 // Filter for updating media data
 function FILTER_UPDATE_MEDIADATA_ENTRY ($data) {
        // Execute the filter function
 // Filter for updating media data
 function FILTER_UPDATE_MEDIADATA_ENTRY ($data) {
        // Execute the filter function
-       updateMediadataEntry(array('total_points'), $data['mode'], $data['points']);
+       $data['added'] = ($data['added'] && updateMediadataEntry(array('total_points'), $data['mode'], $data['points']));
+
+       // Return data
+       return $data;
 }
 
 //
 }
 
 //
index cec04a7b8220a5b8814648de8d34d4da8d75f17d..b3800e9a69310d549ea39c5e1fca4d6c7ee27e1f 100644 (file)
@@ -772,7 +772,7 @@ function doAdminNetworkProcessAddNetwork () {
        setPostRequestParameter('network_id', SQL_INSERTID());
 
        // Output message
        setPostRequestParameter('network_id', SQL_INSERTID());
 
        // Output message
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Successfully added
                loadTemplate('admin_network_added', false, postRequestArray());
        } else {
                // Successfully added
                loadTemplate('admin_network_added', false, postRequestArray());
        } else {
@@ -1045,7 +1045,7 @@ function doAdminNetworkProcessAddNetworkType () {
 )", __FUNCTION__, __LINE__);
 
        // Output message
 )", __FUNCTION__, __LINE__);
 
        // Output message
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Successfully added
                loadTemplate('admin_network_type_added', false, postRequestArray());
        } else {
                // Successfully added
                loadTemplate('admin_network_type_added', false, postRequestArray());
        } else {
@@ -1243,7 +1243,7 @@ function doAdminNetworkProcessAddNetworkParam () {
 )", __FUNCTION__, __LINE__);
 
        // Output message
 )", __FUNCTION__, __LINE__);
 
        // Output message
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Successfully added
                loadTemplate('admin_network_request_param_added', false, postRequestArray());
        } else {
                // Successfully added
                loadTemplate('admin_network_request_param_added', false, postRequestArray());
        } else {
@@ -1289,7 +1289,7 @@ function doAdminNetworkProcessAddNetworkApiTranslation () {
 )", __FUNCTION__, __LINE__);
 
        // Output message
 )", __FUNCTION__, __LINE__);
 
        // Output message
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Successfully added
                loadTemplate('admin_network_api_translation_added', false, postRequestArray());
        } else {
                // Successfully added
                loadTemplate('admin_network_api_translation_added', false, postRequestArray());
        } else {
index ec73f87dbb0c9531a7b045a342839c5dc4de1ca9..575a918c2856a9bde7d0dd829fdde96c501bed06 100644 (file)
@@ -389,7 +389,7 @@ function updateMemberRefbackPercents ($id, $percents) {
                array($percents, $id, getMemberId()), __FUNCTION__, __LINE__);
 
        // Entry updated?
                array($percents, $id, getMemberId()), __FUNCTION__, __LINE__);
 
        // Entry updated?
-       if (SQL_AFFECTEDROWS() < 1) {
+       if (SQL_HASZEROAFFECTED()) {
                // Entry not updated!
                $status['message'] = '{--MEMBER_REFBACK_ERROR_NOT_UPDATED--}';
                return $status;
                // Entry not updated!
                $status['message'] = '{--MEMBER_REFBACK_ERROR_NOT_UPDATED--}';
                return $status;
index 6c5dc2fd3e2497da648b1856fc5b3bcb234a60fb..ea4a23b0396445742a888cdf416938ff935b412e 100644 (file)
@@ -370,7 +370,7 @@ LIMIT 1",
                        ), __FUNCTION__, __LINE__);
 
                // This update went fine?
                        ), __FUNCTION__, __LINE__);
 
                // This update went fine?
-               $login = (SQL_AFFECTEDROWS() == 1);
+               $login = (!SQL_HASZEROAFFECTED());
        } // END - if
 
        // Return status
        } // END - if
 
        // Return status
@@ -473,7 +473,7 @@ function saveSponsorData ($postData, $content) {
        } // END - switch
 
        // Has an entry updated?
        } // END - switch
 
        // Has an entry updated?
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Template and subject are set?
                if (!empty($templ) && !empty($subj)) {
                        // Run SQL command and check for success
                // Template and subject are set?
                if (!empty($templ) && !empty($subj)) {
                        // Run SQL command and check for success
index 5f14531f9f078c7025ff882c6e57137c8f68ca64..340347e418f3b86ff91a1348ba6af06e82501bbe 100644 (file)
@@ -1022,9 +1022,12 @@ function SURFBAR_PAY_POINTS () {
                subtractPoints(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
        } // END - if
 
                subtractPoints(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
        } // END - if
 
-       // Book it to the user
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.getMemberId().',reward='.SURFBAR_GET_REWARD().'', false);
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.getMemberId().',reward='.SURFBAR_GET_REWARD().'', false);
-       addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getMemberId(), SURFBAR_GET_DATA('reward'));
+       // @TODO Try to rewrite the following unset()
+       unset($GLOBALS['ref_level']);
+
+       // Book it to the user
+       addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getMemberId(), SURFBAR_GET_REWARD());
 }
 
 // Updates the statistics of current URL/userid
 }
 
 // Updates the statistics of current URL/userid
@@ -1053,7 +1056,7 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
                ), __FUNCTION__, __LINE__);
 
        // Was that update okay?
                ), __FUNCTION__, __LINE__);
 
        // Was that update okay?
-       if (SQL_AFFECTEDROWS() < 1) {
+       if (SQL_HASZEROAFFECTED()) {
                // No, then insert entry
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)",
                        array(
                // No, then insert entry
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)",
                        array(
@@ -1092,7 +1095,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt='.SURFBAR_GET_SALT().',id='.SURFBAR_GET_ID().',userid='.getMemberId().'', false);
 
        // Was that okay?
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt='.SURFBAR_GET_SALT().',id='.SURFBAR_GET_ID().',userid='.getMemberId().'', false);
 
        // Was that okay?
-       if (SQL_AFFECTEDROWS() < 1) {
+       if (SQL_HASZEROAFFECTED()) {
                // Insert missing entry!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`salts_url_id`, `salts_userid`, `salts_last_salt`) VALUES (%s, %s, '%s')",
                        array(SURFBAR_GET_ID(), getMemberId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
                // Insert missing entry!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`salts_url_id`, `salts_userid`, `salts_last_salt`) VALUES (%s, %s, '%s')",
                        array(SURFBAR_GET_ID(), getMemberId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
@@ -1102,7 +1105,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows='.SQL_AFFECTEDROWS().'', false);
 
        // Return if the update was okay
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'affectedRows='.SQL_AFFECTEDROWS().'', false);
 
        // Return if the update was okay
-       return (SQL_AFFECTEDROWS() == 1);
+       return (!SQL_HASZEROAFFECTED());
 }
 
 // Check if the reload lock is active for given id
 }
 
 // Check if the reload lock is active for given id
index 1c7ae8a45b002dbb45527b87db8993a219b716c0..1e5bfa4d529be10ee504c66e164bd3ad8894e741 100644 (file)
@@ -339,7 +339,9 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                $GLOBALS['bonus_payed'] = true;
 
                                // Subtract login bonus from userid's account or jackpot
                                $GLOBALS['bonus_payed'] = true;
 
                                // Subtract login bonus from userid's account or jackpot
-                               if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getConfig('bonus_mode') != 'ADD')) handleBonusPoints('login_bonus');
+                               if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) {
+                                       handleBonusPoints('login_bonus');
+                               } // END - if
                        } // END - if
 
                        // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
                        } // END - if
 
                        // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
@@ -353,7 +355,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                // Update database records
                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1",
                                        array($userid), __FUNCTION__, __LINE__);
                                // Update database records
                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1",
                                        array($userid), __FUNCTION__, __LINE__);
-                               if (SQL_AFFECTEDROWS() == 1) {
+                               if (!SQL_HASZEROAFFECTED()) {
                                        // Is a success URL set?
                                        if (empty($successUrl)) {
                                                // Procedure to checking for login data
                                        // Is a success URL set?
                                        if (empty($successUrl)) {
                                                // Procedure to checking for login data
@@ -581,7 +583,7 @@ LIMIT 1",
                        array($hash), __FILE__, __LINE__);
 
                // Was it updated?
                        array($hash), __FILE__, __LINE__);
 
                // Was it updated?
-               if (SQL_AFFECTEDROWS() == 1) {
+               if (!SQL_HASZEROAFFECTED()) {
                        // Send email if updated
                        $message = loadEmailTemplate('confirm-member', $content, bigintval($userid));
 
                        // Send email if updated
                        $message = loadEmailTemplate('confirm-member', $content, bigintval($userid));
 
index 445c8505d453d7944c22afd555d79fb238806b2f..d0f00c8fa60c1f2602cd434fd4c4741d4f6ae60b 100644 (file)
@@ -298,7 +298,7 @@ VALUES
                        }
 
                        // Everthing is fine?
                        }
 
                        // Everthing is fine?
-                       if (SQL_AFFECTEDROWS() < 1) {
+                       if (SQL_HASZEROAFFECTED()) {
                                // Something bad happend!
                                setModuleStatus($module_chk, 'major');
                                return 'major';
                                // Something bad happend!
                                setModuleStatus($module_chk, 'major');
                                return 'major';
index 95f2180a2db0886fd4318b641fd93d09875571de..023110a00f83f95e4a97d549dbb73d6b3f206353 100644 (file)
@@ -56,7 +56,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        // @TODO Kill all constants in this file
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
        // @TODO Kill all constants in this file
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
-       $cnt = '0';
+       $cnt = '0'; $OUT = '';
        foreach (postRequestParameter('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
        foreach (postRequestParameter('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
index f8e35fea0e7cec580a0d125ddc28b46fb73371b7..fd2032d99cb2ab140fc7025c97bd749d2396fbb8 100644 (file)
@@ -90,7 +90,7 @@ LIMIT 1",
                                bigintval(postRequestParameter('id')),
                        ), __FILE__, __LINE__);
 
                                bigintval(postRequestParameter('id')),
                        ), __FILE__, __LINE__);
 
-               if (SQL_AFFECTEDROWS() == 1) {
+               if (!SQL_HASZEROAFFECTED()) {
                        $content = '{--SETTINGS_SAVED--}';
                } else {
                        $content = '<span class="notice">{--SETTINGS_NOT_SAVED--}</span>';
                        $content = '{--SETTINGS_SAVED--}';
                } else {
                        $content = '<span class="notice">{--SETTINGS_NOT_SAVED--}</span>';
index ffb7175830f28f7f3924a18752c59f1fa93ec320..c56d63ff98c531eeffdc56d8264f9e62b5e7778f 100644 (file)
@@ -64,7 +64,7 @@ if (isGetRequestParameterSet('userid')) {
                        }
 
                        // Entry updated?
                        }
 
                        // Entry updated?
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Send an email to the user! In later version you can optionally switch this feature off
                                $message = loadEmailTemplate('lock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
 
                                // Send an email to the user! In later version you can optionally switch this feature off
                                $message = loadEmailTemplate('lock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
 
@@ -96,7 +96,7 @@ LIMIT 1",
                        }
 
                        // Entry updated?
                        }
 
                        // Entry updated?
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Send an email to the user! In later version you can optionally switch this feature off
                                $message = loadEmailTemplate('unlock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
 
                                // Send an email to the user! In later version you can optionally switch this feature off
                                $message = loadEmailTemplate('unlock-user', array('text' => postRequestParameter('reason')), bigintval(getRequestParameter('userid')));
 
index c2162c3f6913ff4d6abd08159fa1d49a2d438414..4dbd34cb38a300672b706312e5101a57a2d808e4 100644 (file)
@@ -92,7 +92,7 @@ VALUES ('%s','%s','%s')",
        } // END - switch
 
        // Check if we have saved (updated)
        } // END - switch
 
        // Check if we have saved (updated)
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Updated!
                $content = '{--SETTINGS_SAVED--}';
        } else {
                // Updated!
                $content = '{--SETTINGS_SAVED--}';
        } else {
index 86e4cdba73a176554459f1a444ddf475976af393..704072bb8a595110e3ac77d9131b92042edee2e4 100644 (file)
@@ -155,7 +155,7 @@ LIMIT 1",
                                        array(bigintval($content['refid'])), __FILE__, __LINE__);
 
                                // Whas that update fine?
                                        array(bigintval($content['refid'])), __FILE__, __LINE__);
 
                                // Whas that update fine?
-                               if (SQL_AFFECTEDROWS() == 1) {
+                               if (!SQL_HASZEROAFFECTED()) {
                                        // Load referal's data
                                        $result = SQL_QUERY_ESC("SELECT
        `id`, `gender`, `surname`, `family`, `email`,
                                        // Load referal's data
                                        $result = SQL_QUERY_ESC("SELECT
        `id`, `gender`, `surname`, `family`, `email`,
index 6d1255957e8d3c66f6a51e722799186ceba47ecb..73b9f6a8155d76afec80d675e6b315762ca764cf 100644 (file)
@@ -99,7 +99,7 @@ LIMIT 1",
                                ), __FILE__, __LINE__);
 
                        // Check on success
                                ), __FILE__, __LINE__);
 
                        // Check on success
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Prepare mail and send it to the sponsor
                                $message = loadEmailTemplate('sponsor_pending', $data);
                                sendEmail($data['email'], '{--SPONSOR_ACCOUNT_PENDING_SUBJECT--}', $message);
                                // Prepare mail and send it to the sponsor
                                $message = loadEmailTemplate('sponsor_pending', $data);
                                sendEmail($data['email'], '{--SPONSOR_ACCOUNT_PENDING_SUBJECT--}', $message);
@@ -128,7 +128,7 @@ LIMIT 1",
                                array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
 
                        // Check on success
                                array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
 
                        // Check on success
-                       if (SQL_AFFECTEDROWS() == 1) {
+                       if (!SQL_HASZEROAFFECTED()) {
                                // Sponsor account is unlocked again
                                loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
                        } else {
                                // Sponsor account is unlocked again
                                loadTemplate('admin_settings_saved', false, '{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
                        } else {
index a805b179bc13d439212c642f1754fb4adafe426b..6b0a8d7321c0fbfc5d2c250f913ee803263c42f2 100644 (file)
@@ -293,7 +293,7 @@ LIMIT 1",
                                }
 
                                // Did something change?
                                }
 
                                // Did something change?
-                               if (SQL_AFFECTEDROWS() == 1) {
+                               if (!SQL_HASZEROAFFECTED()) {
                                        // Get all modes ...
                                        $modes = explode(';', $mode);
 
                                        // Get all modes ...
                                        $modes = explode(';', $mode);
 
index eb99854749ea40c7db29c19022f960565e0e322c..fda6bbc7d1612270e661fd8949c485dc1879d19a 100644 (file)
@@ -70,7 +70,7 @@ if (empty($url)) {
                array($type, bigintval(getRequestParameter('order')), getMemberId()), __FILE__, __LINE__);
 
        // Finally is the entry valid?
                array($type, bigintval(getRequestParameter('order')), getMemberId()), __FILE__, __LINE__);
 
        // Finally is the entry valid?
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // @TODO Unused: 2,4
                // Load mail again...              0         1          2             3            4         5       6            7
                $result = SQL_QUERY_ESC("SELECT `subject`, `text`, `receivers`, `payment_id`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s LIMIT 1",
                // @TODO Unused: 2,4
                // Load mail again...              0         1          2             3            4         5       6            7
                $result = SQL_QUERY_ESC("SELECT `subject`, `text`, `receivers`, `payment_id`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s LIMIT 1",
index f3401f2891fc3f680567c4f576760b9f7f6b4f64..749a368f42e504db7d443c74214e19c48a530eb2 100644 (file)
@@ -693,10 +693,10 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) {
        // Should we look for affected rows (only update) or found rows?
        if ($updateEntry === true) {
                // Check updated/affected rows
        // Should we look for affected rows (only update) or found rows?
        if ($updateEntry === true) {
                // Check updated/affected rows
-               $ret = (SQL_AFFECTEDROWS() == 1);
+               $ret = (!SQL_HASZEROAFFECTED());
        } else {
                // Check found rows
        } else {
                // Check found rows
-               $ret = (SQL_NUMROWS($result) == 1);
+               $ret = (!SQL_HASZERONUMS($result));
        }
 
        // Free memory
        }
 
        // Free memory
@@ -995,6 +995,9 @@ function getReferalLevelPercents ($level) {
  *               for default value will cause no referal will get points ever!!!)
  */
 function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $add_mode = 'ref') {
  *               for default value will cause no referal will get points ever!!!)
  */
 function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $refid = '0', $add_mode = 'ref') {
+       // By default nothing has been added
+       $added = false;
+
        //* DEBUG: */ debugOutput('----------------------- <font color="#00aa00">' . __FUNCTION__ . ' - ENTRY</font> ------------------------<ul><li>');
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
        //* DEBUG: */ debugOutput('----------------------- <font color="#00aa00">' . __FUNCTION__ . ' - ENTRY</font> ------------------------<ul><li>');
        // Convert mode to lower-case
        $add_mode = strtolower($add_mode);
@@ -1057,13 +1060,17 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                        //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
 
                        // No entry updated?
                        //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - UPDATE! ('.SQL_AFFECTEDROWS().')');
 
                        // No entry updated?
-                       if (SQL_AFFECTEDROWS() < 1) {
+                       if (SQL_HASZEROAFFECTED()) {
                                // First ref in this level! :-)
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,%s,%s)",
                                        array($data, bigintval($userid), bigintval($GLOBALS['ref_level']), $ref_points), __FUNCTION__, __LINE__);
                                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
                        } // END - if
 
                                // First ref in this level! :-)
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,%s,%s)",
                                        array($data, bigintval($userid), bigintval($GLOBALS['ref_level']), $ref_points), __FUNCTION__, __LINE__);
                                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):data='.$data.',ref_points='.$ref_points.',userid='.$userid.',depth='.$GLOBALS['ref_level'].',mode='.$add_mode.' - INSERTED! ('.SQL_AFFECTEDROWS().')');
                        } // END - if
 
+                       // Check affected rows
+                       $added = SQL_AFFECTEDROWS();
+                       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
+
                        // Prepare data for the filter
                        $filterData = array(
                                'subject'  => $subject,
                        // Prepare data for the filter
                        $filterData = array(
                                'subject'  => $subject,
@@ -1074,10 +1081,15 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                                'locked'   => $locked,
                                'mode'     => 'add',
                                'sub_mode' => $add_mode,
                                'locked'   => $locked,
                                'mode'     => 'add',
                                'sub_mode' => $add_mode,
+                               'added'    => $added
                        );
 
                        // Filter it now
                        );
 
                        // Filter it now
-                       runFilterChain('add_points', $filterData);
+                       $filterData = runFilterChain('add_points', $filterData);
+
+                       // Extract $added
+                       $added = $filterData['added'];
+                       //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):added='.intval($added));
 
                        // Points updated, maybe I shall send him an email?
                        if (($sendNotify === true) && (isValidUserId(getUserData('refid'))) && ($locked === false)) {
 
                        // Points updated, maybe I shall send him an email?
                        if (($sendNotify === true) && (isValidUserId(getUserData('refid'))) && ($locked === false)) {
@@ -1115,12 +1127,13 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
                        if ((isValidUserId(getUserData('refid'))) && ($points > 0) && (getUserData('refid') != $userid) && ($add_mode == 'ref')) {
                                // Then let's credit him here...
                                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',ref='.getUserData('refid').',points='.$points.' - ADVANCE!');
                        if ((isValidUserId(getUserData('refid'))) && ($points > 0) && (getUserData('refid') != $userid) && ($add_mode == 'ref')) {
                                // Then let's credit him here...
                                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid.',ref='.getUserData('refid').',points='.$points.' - ADVANCE!');
-                               addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), getUserData('refid'), $points, $sendNotify, getUserData('refid'));
+                               $added = ($added && addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), getUserData('refid'), $points, $sendNotify, getUserData('refid')));
                        } // END - if
                } // END - if
        } // END - if
 
                        } // END - if
                } // END - if
        } // END - if
 
-       //* DEBUG: */ debugOutput('</li></ul>----------------------- <font color="#aa0000">'.__FUNCTION__.' - EXIT</font> ------------------------<br />');
+       //* DEBUG: */ debugOutput('</li></ul>----------------------- <font color="#aa0000">'.__FUNCTION__.': added=' . intval($added) . ' - EXIT</font> ------------------------<br />');
+       return $added;
 }
 
 // Updates the referal counter
 }
 
 // Updates the referal counter
@@ -1135,10 +1148,13 @@ function updateReferalCounter ($userid) {
 
        // When no entry was updated then we have to create it here
        //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):updated=' . SQL_AFFECTEDROWS());
 
        // When no entry was updated then we have to create it here
        //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):updated=' . SQL_AFFECTEDROWS());
-       if (SQL_AFFECTEDROWS() < 1) {
+       if (SQL_HASZEROAFFECTED()) {
                // First count!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
                // First count!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
-                       array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
+                       array(
+                               bigintval($userid),
+                               $GLOBALS['cache_array']['ref_level'][$userid]
+                       ), __FUNCTION__, __LINE__);
                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid);
        } // END - if
 
                //* DEBUG: */ debugOutput(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>):userid='.$userid);
        } // END - if
 
@@ -1598,11 +1614,15 @@ function subtractPoints ($subject, $userid, $points) {
                'subject' => $subject,
                'userid'  => $userid,
                'points'  => $points,
                'subject' => $subject,
                'userid'  => $userid,
                'points'  => $points,
-               'mode'    => 'sub'
+               'mode'    => 'sub',
+               'added'   => (!SQL_HASZEROAFFECTED())
        );
 
        // Insert booking record
        );
 
        // Insert booking record
-       runFilterChain('sub_points', $filterData);
+       $filterData = runFilterChain('sub_points', $filterData);
+
+       // Return result
+       return $filterData['added'];
 }
 
 // "Getter" for total available receivers
 }
 
 // "Getter" for total available receivers
index 036aa3557b95d4beb7837eeb6d891dcb925b8e87..35797ccffa3fba3ae373b4c33f66f796f91fdfbc 100644 (file)
@@ -73,7 +73,7 @@ if (!SQL_HASZERONUMS($result_main)) {
                if (isset($DATA['html_msg'])) $HTML = $DATA['html_msg'];
 
                // Entry updated?
                if (isset($DATA['html_msg'])) $HTML = $DATA['html_msg'];
 
                // Entry updated?
-               if (SQL_AFFECTEDROWS() == 1) {
+               if (!SQL_HASZEROAFFECTED()) {
                        // "Explode" all receivers into an array
                        if (isInString(';', $DATA['receivers'])) {
                                // There's more than one receiver in the list...
                        // "Explode" all receivers into an array
                        if (isInString(';', $DATA['receivers'])) {
                                // There's more than one receiver in the list...
index 9710237d183a4b668476b7d1a631fe67d5a9c53f..dc85ff32d0f00f4cc13c542e424f7e69f94e7df8 100644 (file)
                        <strong>{%pipe,fixEmptyContentToDashes=$content[lock_reason]%}</strong>
                </td>
        </tr>
                        <strong>{%pipe,fixEmptyContentToDashes=$content[lock_reason]%}</strong>
                </td>
        </tr>
-       <!--
-       <tr>
-               <td align="center" class="top right">
-                       {--_UNUSED--}:<br />
-                       <strong>---</strong>
-               </td>
-               <td align="center" class="top right">
-                       {--_UNUSED--}:<br />
-                       <strong>---</strong>
-               </td>
-               <td align="center" class="top right">
-                       {--_UNUSED--}:<br />
-                       <strong>---</strong>
-               </td>
-               <td align="center" class="top">
-                       {--_UNUSED--}:<br />
-                       <strong>---</strong>
-               </td>
-       </tr>
-       //-->
        <tr>
                <td align="center" class="table_footer top" colspan="4">
                        <div>
        <tr>
                <td align="center" class="table_footer top" colspan="4">
                        <div>