X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-points.php;h=f6f5d598404259c617a3f4b489532f8a994e187b;hb=c25f923b9006723f30055e6bd7145d6aaa8cee42;hp=c0e9f07c0906c3e44cbecbdd9df707cb92982903;hpb=0f3a135204757cc8750262871c8e62c42300acb4;p=mailer.git diff --git a/inc/modules/member/what-points.php b/inc/modules/member/what-points.php index c0e9f07c09..f6f5d59840 100644 --- a/inc/modules/member/what-points.php +++ b/inc/modules/member/what-points.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -37,7 +37,7 @@ // Some security stuff... if (!defined('__SECURITY')) { - die(); + exit(); } elseif (!isMember()) { redirectToIndexMemberOnlyModule(); } @@ -45,24 +45,35 @@ if (!defined('__SECURITY')) { // Add description as navigation point addYouAreHereLink('member', __FILE__); -// Query for referal levels and percents -$result_depths = SQL_QUERY('SELECT `level`,`percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC', __FILE__, __LINE__); +// Extension ext-user is highly required +if ((!isExtensionActive('user')) && (!isAdmin())) { + displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}'); + return; +} // END - if + +// Query for referral levels and percents +$result_depths = SQL_QUERY('SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC', __FILE__, __LINE__); // Get total depths $numDepths = SQL_NUMROWS($result_depths); // Add many more rows for the login/turbo/ref/order bonus // @TODO Should we rewrite this to a filter? -if (!isExtensionActive('bonus')) $numDepths += 1; -if (isExtensionInstalledAndNewer('bonus', '0.2.2')) $numDepths += 6; -if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $numDepths += 4; +if (isExtensionActive('bonus')) { + // Extension ext-bonus is there, okay + if (isExtensionInstalledAndNewer('bonus', '0.2.2')) $numDepths += 6; + if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $numDepths += 4; +} else { + // Not installed ext-bonus + $numDepths += 1; +} // Remember row count in constant $content['rowspan'] = ($numDepths * 2 + 15); // Initialize array elements $content['part_points'] = '0.00000'; -$content['part_referals'] = '0'; +$content['part_referrals'] = '0'; $content['part_locked'] = '0.00000'; $content['part_order'] = '0.00000'; $content['part_locked_order'] = '0.00000'; @@ -82,18 +93,15 @@ while ($data = SQL_FETCHARRAY($result_depths)) { // Merge it together $content = merge_array($content, $data); - // Default for referal level > 0 + // Default for referral level > 0 $depth = 'p.`ref_depth`=%s'; if (is_null($content['level'])) { $depth = 'p.`ref_depth` IS NULL'; } // END - if - // Load referal points - $result_points = SQL_QUERY_ESC("SELECT - p.`points`, - p.`order_points`, - p.`locked_points`, - p.`locked_order_points`, + // Load referral points + $result_points = SQL_QUERY_ESC('SELECT + ' . getAllPointColumns('p.', ',') . ' r.`counter` FROM `{?_MYSQL_PREFIX?}_user_points` AS p @@ -104,31 +112,37 @@ ON p.`ref_depth`=r.`level` WHERE p.`userid`=%s AND - ".$depth." -LIMIT 1", + ' . $depth . ' +LIMIT 1', array( getMemberId(), - makeZeroToNull($content['level']) + convertZeroToNull($content['level']) ), __FILE__, __LINE__); - // Do we have an entry? + // Is there an entry? if (SQL_NUMROWS($result_points) == 1) { // Load data $content = merge_array($content, SQL_FETCHARRAY($result_points)); - // Add all entries + // Add locked-/points $content['part_points'] += $content['points']; - $content['part_order'] += $content['order_points']; $content['part_locked'] += $content['locked_points']; - $content['part_locked_order'] += $content['locked_order_points']; - $content['part_referals'] += $content['counter']; + + // For these columns, ext-order must be installed as well + if (isExtensionInstalled('order')) { + $content['part_order'] += $content['order_points']; + $content['part_locked_order'] += $content['locked_order_points']; + } // END - if + + // Add referral counter + $content['part_referrals'] += $content['counter']; } // END - if // Free result SQL_FREERESULT($result_points); // Output row - $OUT .= loadTemplate('member_points_row', true, $content); + $OUT .= loadTemplate('member_points_row', TRUE, $content); } // END - while // Free memory @@ -154,10 +168,10 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu $content['bonus_total_points'] = getUserData('turbo_bonus') + getUserData('login_bonus') + getUserData('bonus_ref') + getUserData('bonus_order') + getUserData('bonus_stats'); // Output rows - $content['special_rows'] = loadTemplate('member_points_bonus_rows', true, $content); + $content['special_rows'] = loadTemplate('member_points_bonus_rows', TRUE, $content); } elseif ((isExtensionActive('bonus')) && (!isBonusRallyeActive())) { // Bonus active rallye deactivated - $content['special_rows'] = loadTemplate('member_points_bonus_disabled', true); + $content['special_rows'] = loadTemplate('member_points_bonus_disabled', TRUE); } elseif ((isAdmin()) && (isExtensionInstalledAndOlder('bonus', '0.2.2')) && (isExtensionActive('bonus'))) { // Please upgrade your bonus extension to v0.2.2 or newer! $content['special_rows'] = loadTemplate('member_points_upgrade'); @@ -166,7 +180,7 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu // Load final template if (isExtensionActive('user')) { // Load template when required extension is there - loadTemplate('member_points', false, $content); + loadTemplate('member_points', FALSE, $content); } elseif (isAdmin()) { // Missing extension displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}'); @@ -175,6 +189,7 @@ if (isExtensionActive('user')) { displayMessage('{--PROBLEM_POINTS_OVERVIEW_UNAVAILABLE--}'); } +// Is ext-payout installed? if (isExtensionActive('payout')) { // Payput extension is installed and active so we can check if the user has enougth points outputPayoutList($content['part_points'] - getUserData('used_points'));