More fixes for bonus ranking
authorRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 00:13:08 +0000 (00:13 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 00:13:08 +0000 (00:13 +0000)
20 files changed:
beg.php
css.php
inc/classes/cachesystem.class.php
inc/db/lib-mysql3.php
inc/footer.php
inc/header.php
inc/language/bonus_de.php
inc/libs/bonus_functions.php
inc/mysql-connect.php
inc/request-functions.php
index.php
js.php
lead-confirm.php
login.php
mailid.php
mailid_top.php
sponsor_confirm.php
sponsor_ref.php
templates/de/html/admin/admin_config_other.tpl
templates/de/html/show_bonus_msg.tpl

diff --git a/beg.php b/beg.php
index c411b85..139a4e6 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -206,7 +206,7 @@ if (isGetRequestElementSet('userid')) {
                $errorCode = generateErrorCodeFromUserStatus($status);
        } elseif (($userid == '0') || ($status == 'failed')) {
                // Inalid or locked account, so let's find out
-               $result = SQL_QUERY_ESC("SELECT userid FROM `{?_MYSQL_PREFIX?}_user_data` WHERE nickname='%s' LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE nickname='%s' LIMIT 1",
                        array(getRequestElement('userid')), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Locked account
diff --git a/css.php b/css.php
index e271b11..a2307fb 100644 (file)
--- a/css.php
+++ b/css.php
@@ -43,7 +43,7 @@ require('inc/libs/security_functions.php');
 $GLOBALS['footer_sent'] = '-1';
 
 // This is a CSS file loader!
-$GLOBALS['output_mode'] = '1';
+$GLOBALS['output_mode'] = 1;
 $GLOBALS['module'] = 'css';
 
 // Load the required file(s)
index e19c9e8..0a58a1d 100644 (file)
@@ -65,26 +65,14 @@ class CacheSystem {
 
                // Check if path exists
                if (isDirectory(getConfig('CACHE_PATH'))) {
-                       // Make FQFN for dummy file
-                       $FQFN = getConfig('CACHE_PATH') . 'dummy.tmp';
-
-                       // Check if we can create a file inside the path
-                       touch($FQFN, 'w');
-
-                       // Is the file there?
-                       if (isFileReadable($FQFN)) {
-                               // Yes, we can do. So let's remove it
-                               removeFile($FQFN);
-
-                               // Is there a .htaccess file?
-                               if (isFileReadable(getConfig('CACHE_PATH') . '.htaccess')) {
-                                       // All done!
-                                       $this->ret = $this->statusDone;
-                               } else {
-                                       // Stop! Set a .htaccess file first
-                                       $this->ret = 'htaccess';
-                               }
-                       } // END - if
+                       // Is there a .htaccess file?
+                       if (isFileReadable(getConfig('CACHE_PATH') . '.htaccess')) {
+                               // All done!
+                               $this->ret = $this->statusDone;
+                       } else {
+                               // Stop! Set a .htaccess file first
+                               $this->ret = 'htaccess';
+                       }
                } // END - if
        }
 
index 44f5fd4..e709c8a 100644 (file)
@@ -78,7 +78,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
        $querytimeBefore = array_sum(explode(' ', microtime()));
 
        // Run SQL command
-       //* DEBUG: */ outputHtml($sqlString."<br />");
+       //* DEBUG: */ print($sqlString . '<br />');
        $result = mysql_query($sqlString, SQL_GET_LINK())
                or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error() . '<br />
 Query string:<br />
index 9c97434..0e9518d 100644 (file)
@@ -61,7 +61,7 @@ if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != '1') &&
        } // END - if
 
        // Shall we display the parsing time and number of queries?
-       if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestElementSet('frame'))) || (isInstallationPhase())) && ($GLOBALS['header_sent'] == '2')) {
+       if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestElementSet('frame'))) || (isInstallationPhase())) && (getOutputMode() != 0) && ($GLOBALS['header_sent'] == '2')) {
                // Then display it here
                displayParsingTime();
        } // END - if
index 9cff89d..d248ce7 100644 (file)
@@ -46,7 +46,7 @@ if (!defined('__SECURITY')) {
 // Is the header already sent?
 if (($GLOBALS['header_sent'] != '1') && ($GLOBALS['header_sent'] != '2')) {
        // If not in CSS mode generate the header
-       if (getOutputMode() != '1') {
+       if (getOutputMode() != 1) {
                // Config and database connection valid?
                if ((isConfigLocalLoaded()) && (isConfigLoaded()) && (SQL_IS_LINK_UP()) && (isExtensionActive('sql_patches'))) {
                        // Init title
@@ -128,7 +128,7 @@ if (($GLOBALS['header_sent'] != '1') && ($GLOBALS['header_sent'] != '2')) {
 } // END - if
 
 // Add BODY tag or not?
-if ((getOutputMode() != 1) && ($GLOBALS['header_sent'] == 1) && ((getModule() != 'frametester') || (isGetRequestElementSet('frame')))) {
+if ((getOutputMode() != 1) && (getOutputMode() != -1) && ($GLOBALS['header_sent'] == 1) && ((getModule() != 'frametester') || (isGetRequestElementSet('frame')))) {
        loadTemplate('page_body');
        $GLOBALS['header_sent'] = 2;
 } // END - if
index e723c38..349effe 100644 (file)
@@ -69,7 +69,7 @@ addMessages(array(
        'BONUS_SHOW_HEADER_LINE_2' => "f&uuml;r die Mail",
        'BONUS_SHOW_HEADER_LINE_3' => "erhalten hat",
        'BONUS_SHOW_YOU_HAVE_CONFIRMED' => "Sie haben diese Mail am",
-       'BONUS_SHOW_CONFIRMED_BONUS_IS' => "Stelle best&auml;tigt. Ihre Gutschrift f&uuml;r diese eMail",
+       'BONUS_SHOW_CONFIRMED_BONUS_IS' => "Stelle best&auml;tigt. Ihre Zusatz-Gutschrift f&uuml;r diese Mail",
        'BONUS_TOTAL' => "Gesamtbonus",
        'BONUS_RALLYE_NO_ONE_JOINED' => "Niemand nimmt an unserer Aktiv-Rallye dran teil. :-(",
        'BONUS_RALLYE_NOTE' => "Bitte beachten Sie, dass Ihr Login-Bonus hier nicht mit angezeigt wird. Bei der monatlichen Auswertung wird er Ihnen jedoch gutgeschrieben.",
index 9cbf52d..5b73589 100644 (file)
@@ -73,7 +73,7 @@ function addTurboBonus ($mid, $userid, $type) {
        } // END - if
 
        // Check for entry
-       $rank = countSumTotalData($userid, 'bonus_turbo', 'id', 'userid', true, sprintf(" AND `%s`=%s", $column, $mid)) + 1;
+       $rank = countSumTotalData($mid, 'bonus_turbo', 'id', $column, true) + 1;
 
        // Which rank?
        if ($rank == 1) {
@@ -135,7 +135,7 @@ function addBonusRanks ($data, $type, $userid) {
                $GLOBALS['ranking_content']['yr_tmark']  = generateDateTime($GLOBALS['ranking_content']['timemark'], '1');
 
                // Load template
-               $GLOBALS['ranking_content']['rankings'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
+               $GLOBALS['ranking_content']['own'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
        } // END - if
 
        // Load rankings
@@ -151,31 +151,41 @@ function addBonusRanks ($data, $type, $userid) {
                // Output all ranks (levels)
                for ($rank = 1; $rank <= $max; $rank++) {
                        // Load data
-                       $result_users = SQL_QUERY_ESC("SELECT `userid`, `points`, `timemark` FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `%s`=%s AND level=%s LIMIT 1",
+                       $result_users = SQL_QUERY_ESC("SELECT
+       `userid`, `points`
+FROM
+       `{?_MYSQL_PREFIX?}_bonus_turbo`
+WHERE
+       `%s`=%s AND
+       `level`=%s
+LIMIT 1",
                                array($type, $data, $rank), __FUNCTION__, __LINE__);
 
                        // Nothing found by default
-                       $GLOBALS['ranking_content']['userid'] = '---';
-                       $GLOBALS['ranking_content']['points'] = '---';
+                       $rows['userid'] = '---';
+                       $rows['points'] = '---';
 
                        // Are you one of them?
                        if (SQL_NUMROWS($result_users) == 1) {
                                // Load data
-                               $GLOBALS['ranking_content'] = merge_array($GLOBALS['ranking_content'], SQL_FETCHARRAY($result_users));
+                               $rows = merge_array($rows, SQL_FETCHARRAY($result_users));
 
                                // Translate comma
-                               $GLOBALS['ranking_content']['points'] = translateComma($GLOBALS['ranking_content']['points']);
+                               $rows['points'] = translateComma($rows['points']);
                        } // END - if
 
+                       // Free result
+                       SQL_FREERESULT($result_users);
+
                        // Add more
-                       $GLOBALS['ranking_content']['rank'] = $rank;
-                       $GLOBALS['ranking_content']['sw']   = $SW;
+                       $rows['rank'] = $rank;
+                       $rows['sw']   = $SW;
 
                        // Output row
                        $OUT .= "<tr>
-  <td class=\"bonus_rank_".$GLOBALS['ranking_content']['rank']." bottom2 switch_sw".$GLOBALS['ranking_content']['sw']."\">&nbsp;".$GLOBALS['ranking_content']['rank'].".</td>
-  <td class=\"bonus_rank_".$GLOBALS['ranking_content']['rank']." bottom2 switch_sw".$GLOBALS['ranking_content']['sw']."\" align=\"center\">".$GLOBALS['ranking_content']['userid']."</td>
-  <td class=\"bonus_rank_".$GLOBALS['ranking_content']['rank']." bottom2 switch_sw".$GLOBALS['ranking_content']['sw']."\" align=\"center\">".$GLOBALS['ranking_content']['points']."</td>
+  <td class=\"bonus_rank_".$rows['rank']." bottom2 switch_sw".$rows['sw']."\">&nbsp;".$rows['rank'].".</td>
+  <td class=\"bonus_rank_".$rows['rank']." bottom2 switch_sw".$rows['sw']."\" align=\"center\">".$rows['userid']."</td>
+  <td class=\"bonus_rank_".$rows['rank']." bottom2 switch_sw".$rows['sw']."\" align=\"center\">".$rows['points']."</td>
 </tr>\n";
 
                        // Switch color
index eaa939d..d799ded 100644 (file)
@@ -77,7 +77,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
        loadIncludeOnce('inc/db/lib.php');
 
        // Set missing module
-       if (!isModuleSet()) setModule(getRequestElement('module'));
+       if ((!isModuleSet()) && (isGetRequestElementSet('module'))) setModule(getRequestElement('module'));
        if (!isModuleSet()) setModule('index');
 
        // Load configuration file(s) here
index 1320843..5afd40c 100644 (file)
@@ -150,7 +150,7 @@ function postRequestElement ($element, $subElement=null) {
 // Checks if an element in $_POST exists
 function isPostRequestElementSet ($element, $subElement=null) {
        if (is_null($subElement)) {
-               return ((isset($GLOBALS['raw_request']['post'][$element])) && (!empty($GLOBALS['raw_request']['post'][$element])));
+               return ((isset($GLOBALS['raw_request']['post'][$element])) && (isset($GLOBALS['raw_request']['post'][$element])));
        } else {
                return ((isset($GLOBALS['raw_request']['post'][$element][$subElement])) && (isset($GLOBALS['raw_request']['post'][$element][$subElement])));
        }
index e9a77ff..4eb6036 100644 (file)
--- a/index.php
+++ b/index.php
@@ -47,7 +47,7 @@ $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['module'] = 'index';
 
 // Set 'CSS-Mode'
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['output_mode'] = 0;
 
 // Load config.php
 require('inc/config-global.php');
diff --git a/js.php b/js.php
index 88ae66e..c4e57f9 100644 (file)
--- a/js.php
+++ b/js.php
@@ -46,7 +46,7 @@ require('inc/libs/security_functions.php');
 // pattern is given...
 //
 // But mxchange 0.3.0 will show that in better way! :D :D :D
-$GLOBALS['output_mode'] = '1';
+$GLOBALS['output_mode'] = 1;
 $GLOBALS['module'] = 'js';
 
 // Load the required file(s)
index 6f2b0ef..fdaaf12 100644 (file)
@@ -46,7 +46,7 @@ $GLOBALS['startTime'] = microtime(true);
 $GLOBALS['module'] = 'lead-confirm';
 
 // Set "CSS-Mode"
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['output_mode'] = 0;
 
 // Load config.php
 require('inc/config-global.php');
index 45fc27f..4266bc4 100644 (file)
--- a/login.php
+++ b/login.php
@@ -43,7 +43,7 @@ require('inc/libs/security_functions.php');
 $GLOBALS['module'] = 'login';
 
 // Set 'CSS-Mode'
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['output_mode'] = 0;
 
 // Load the required file(s)
 require('inc/config-global.php');
index f87ef34..78c1948 100644 (file)
@@ -44,7 +44,7 @@ $GLOBALS['startTime'] = microtime(true);
 
 // Tell everyone we are in this module
 $GLOBALS['module'] = 'mailid';
-$GLOBALS['output_mode'] = 1;
+$GLOBALS['output_mode'] = -1;
 $errorCode = '';
 
 // Load the required file(s)
@@ -97,7 +97,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                        case 'NORMAL':
                                // Is the stats ID valid?
                                $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
-                               array($url_mid), __FILE__, __LINE__);
+                                       array($url_mid), __FILE__, __LINE__);
                                break;
 
                        case 'BONUS':
@@ -106,7 +106,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
 
                                // Bonus-Mails
                                $result = SQL_QUERY_ESC("SELECT id, url, subject FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
-                               array($url_bid), __FILE__, __LINE__);
+                                       array($url_bid), __FILE__, __LINE__);
                                break;
 
                        default: // Invalid mail type
@@ -133,8 +133,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                                if ($status == 'CONFIRMED') {
                                        // User has confirmed his account so we can procede...
                                        // @TODO Rewrite this to a filter
-                                       switch ($ltype)
-                                       {
+                                       switch ($ltype) {
                                                case 'NORMAL':
                                                        $result = SQL_QUERY_ESC("SELECT payment_id FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
                                                                array(bigintval($pool)), __FILE__, __LINE__);
@@ -192,7 +191,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                                                $errorCode = getCode('POSSIBLE_INVALID');
                                        }
                                } else {
-                                       $errorCode = getCode('ACCOUNT_LOCKED');
+                                       $errorCode = getCode('ACCOUNT_' . $status);
                                }
                        } else {
                                SQL_FREERESULT($result);
index f1e8313..e60943d 100644 (file)
@@ -131,14 +131,9 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErr
                                SQL_FREERESULT($result);
 
                                if ($status == 'CONFIRMED') {
-                                       // Update last activity
-                                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_online`=UNIX_TIMESTAMP(), `last_module`='mailid_top' WHERE `userid`=%s LIMIT 1",
-                                               array($url_userid), __FILE__, __LINE__);
-
                                        // User has confirmed his account so we can procede...
                                        // @TODO Rewrite this to a filter
-                                       switch ($ltype)
-                                       {
+                                       switch ($ltype) {
                                                case 'NORMAL':
                                                        $result = SQL_QUERY_ESC("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
                                                                array(bigintval($pool)), __FILE__, __LINE__);
index d1335e3..ec0c52d 100644 (file)
@@ -42,7 +42,7 @@ require('inc/libs/security_functions.php');
 $GLOBALS['module'] = 'sponsor_confirm';
 
 // Set 'CSS-Mode'
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['output_mode'] = 0;
 
 // Load the required file(s)
 require('inc/config-global.php');
index 702b6b5..5c8de09 100644 (file)
@@ -42,7 +42,7 @@ require('inc/libs/security_functions.php');
 $GLOBALS['module'] = 'sponsor_ref';
 
 // Set 'CSS-Mode'
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['output_mode'] = 0;
 
 // Load the required file(s)
 require('inc/config-global.php');
index a2f6c72..7debb5a 100644 (file)
@@ -81,7 +81,7 @@
 
        <tr>
                <td width="10" class="seperator">&nbsp;</td>
-               <td align="right">{--ADMIN_OPTION?mt_word?-}:</td>
+               <td align="right">{--ADMIN_OPTION_MT_WORD--}:</td>
                <td width="10" class="seperator">&nbsp;</td>
                <td>
                        <input type="text" name="mt_word" class="admin_normal" size="15" maxlength="255" value="{?mt_word?}" />
@@ -95,7 +95,7 @@
 
        <tr>
                <td width="10" class="seperator">&nbsp;</td>
-               <td align="right">{--ADMIN_OPTION?mt_word?--}:</td>
+               <td align="right">{--ADMIN_OPTION_MT_WORD2--}:</td>
                <td width="10" class="seperator">&nbsp;</td>
                <td>
                        <input type="text" name="mt_word2" class="admin_normal" size="15" maxlength="255" value="{?mt_word2?}" />
 
        <tr>
                <td width="10" class="seperator">&nbsp;</td>
-               <td align="right">{--ADMIN_OPTION?mt_word?--}:</td>
+               <td align="right">{--ADMIN_OPTION_MT_WORD3--}:</td>
                <td width="10" class="seperator">&nbsp;</td>
                <td>
                        <input type="text" name="mt_word3" class="admin_normal" size="15" maxlength="255" value="{?mt_word3?}" />
index 2f8e57e..a051b30 100644 (file)
@@ -12,7 +12,9 @@
        </tr>
        $content[rows]
        <tr>
-               <td colspan="3" class="member_footer" align="center"><div class="tiny member_note">&nbsp;</div></td>
+               <td colspan="3" class="member_footer" align="center">
+                       <div class="tiny">$content[own]</div>
+               </td>
        </tr>
 </table>
 
@@ -20,7 +22,7 @@
        $content[rankings]
 </div>
 
-<div class="member_note">
+<div style="padding-top:5px;padding-bottom:5px" class="member_note">
        Wir w&uuml;nschen allen Gewinnern viel Gl&uuml;ck bei der monatlichen Aktiv-Rallye!<br />
        Es k&ouml;nnen nur die ersten <u>{?bonus_ranks?}</u> die Aktiv-Rallye gewinnen. Der Rechtsweg ist ausgeschlossen.
 </div>