From fd0a0913e4398fc1f85001634f287d889f68a213 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 29 Oct 2009 18:41:24 +0000 Subject: [PATCH] Queries improved, output-bug fixed in points overview --- inc/modules/admin/what-config_points.php | 4 ++-- inc/modules/admin/what-config_rallye_prices.php | 4 ++-- inc/modules/member/what-points.php | 12 ++++++------ templates/de/html/member/member_points.tpl | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index b8a62ba747..724779bef2 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -135,8 +135,8 @@ WHERE `mails_confirmed` < %s", $REF, $REF)); if ((isSqlsValid()) && (isSqlsValid())) { if (strpos($GLOBALS['sqls'][0], 'INSERT') > -1) { - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE level='%s' LIMIT 1", - array(bigintval(postRequestElement('level'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level`='%s' LIMIT 1", + array(bigintval(postRequestElement('level'))), __FILE__, __LINE__); SQL_FREERESULT($result); } // END - if diff --git a/inc/modules/admin/what-config_rallye_prices.php b/inc/modules/admin/what-config_rallye_prices.php index ddb605da49..bce9f0cd18 100644 --- a/inc/modules/admin/what-config_rallye_prices.php +++ b/inc/modules/admin/what-config_rallye_prices.php @@ -49,7 +49,7 @@ if (isGetRequestElementSet(('rallye'))) { if (isPostRequestElementSet('add')) { if ((isPostRequestElementSet(('level'))) && ((isPostRequestElementSet(('points'))) || (isPostRequestElementSet(('info'))))) { // Submitted data is valid, but maybe we already have this price level? - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s AND price_level='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s AND `price_level`='%s' LIMIT 1", array(bigintval(getRequestElement('rallye')), bigintval(postRequestElement('level'))), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 0) { @@ -93,7 +93,7 @@ VALUES ('%s','%s','%s','%s')", $id = bigintval($id); // Update entry - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_prices` SET rallye_id=%s, price_level='%s', points='%s', info='%s' WHERE `id`=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_prices` SET rallye_id=%s, price_`level`='%s', points='%s', info='%s' WHERE `id`=%s LIMIT 1", array( postRequestElement('rallye_id', $id), bigintval($level), diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index 947a9edefc..fea4cd2885 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -71,7 +71,7 @@ while ($data = SQL_FETCHARRAY($result_depths)) { $REFS = 0; // Load referal points - $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__); + $result_points = SQL_QUERY_ESC("SELECT `points`, `locked_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__); if (SQL_NUMROWS($result_points) == 1) { list($points, $locked) = SQL_FETCHROW($result_points); // Also count locked points @@ -84,7 +84,7 @@ while ($data = SQL_FETCHARRAY($result_depths)) { SQL_FREERESULT($result_points); // Load referal counts - $result_refs = SQL_QUERY_ESC("SELECT counter FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `userid`=%s AND level='%s' LIMIT 1", + $result_refs = SQL_QUERY_ESC("SELECT `counter` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `userid`=%s AND `level`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__); if (SQL_NUMROWS($result_refs) == 1) { list($REFS) = SQL_FETCHROW($result_refs); @@ -98,10 +98,10 @@ while ($data = SQL_FETCHARRAY($result_depths)) { // Transfer data to array for template $row = array( - 'level' => $content['level'], + 'level' => $content['level'], 'percents' => translateComma($content['percents']), - 'points' => translateComma($points), - 'refs' => translateComma($REFS), + 'points' => translateComma($points), + 'refs' => translateComma($REFS), ); // Output row @@ -145,7 +145,7 @@ if ($TLOCK == 0) $TLOCK = '0.00000'; // Remember several values in constants $content['used'] = translateComma($usedPoints); -$content['tpts'] = translateComma($totalPoints - $usedPoints); +$content['sum'] = translateComma($totalPoints - $usedPoints); $content['tref'] = $TREF; $content['tlock'] = translateComma($TLOCK); diff --git a/templates/de/html/member/member_points.tpl b/templates/de/html/member/member_points.tpl index 8664012a5f..4580daedaa 100644 --- a/templates/de/html/member/member_points.tpl +++ b/templates/de/html/member/member_points.tpl @@ -29,7 +29,7 @@   {--POINTS_SUM--}   -   $content[used] {?POINTS?} +   $content[sum] {?POINTS?}     $content[tref] -- 2.39.5