Deprecated variables for templates removed, mor EL-rewrites, getMessage() rewritten:
[mailer.git] / doubler.php
index 7e3f9a27e7bf235f2e41ab97aee50c530cf2731a..f53908359aed0d12042f3c2785818fd2c7d0e691 100644 (file)
@@ -80,7 +80,7 @@ if (isFormSent()) {
                // Is the data valid?
                if (!isUserDataValid()) {
                        // Output message that the userid is not okay
-                       loadTemplate('admin_settings_saved', false, getMessage('DOUBLER_USERID_INVALID'));
+                       loadTemplate('admin_settings_saved', false, '{--DOUBLER_USERID_INVALID--}');
                } // END - if
 
                // Remove any dots and unwanted chars from the points
@@ -98,7 +98,7 @@ if (isFormSent()) {
                        $points = countSumTotalData(getUserData('userid'), 'user_points', 'points') - countSumTotalData(getUserData('userid'), 'user_data', 'used_points');
 
                        // So let's continue with probing his points amount
-                       if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge')) >= 0) {
+                       if (($points - getConfig('doubler_left') - postRequestParameter('points') * getConfig('doubler_charge') / 100) >= 0) {
                                // Enough points are left so let's continue with the doubling process
                                // Create doubling "account" width *DOUBLED* points
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')",
@@ -108,7 +108,7 @@ if (isFormSent()) {
                                subtractPoints('doubler', getUserData('userid'), postRequestParameter('points'));
 
                                // Add points to "total payed" including charge
-                               $points = postRequestParameter('points') - postRequestParameter('points') * getConfig('doubler_charge');
+                               $points = postRequestParameter('points') - postRequestParameter('points') * getConfig('doubler_charge') / 100;
                                updateConfiguration('doubler_points', $points, '+');
                                incrementConfigEntry('doubler_points', $points);
 
@@ -118,7 +118,7 @@ if (isFormSent()) {
                                        SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_doubler` (`userid`, `refid`, `points`, `remote_ip`, `timemark`, `completed`, `is_ref`) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')",
                                                array(
                                                        determineReferalId(),
-                                                       bigintval(postRequestParameter('points') * 2 * getConfig('doubler_ref'))
+                                                       bigintval(postRequestParameter('points') * 2 * getConfig('doubler_ref') / 100)
                                                ), __FILE__, __LINE__);
 
                                        // And that's why we don't want to you more than one referal level of doubler-points. ^^^
@@ -188,13 +188,6 @@ if (isUserDataValid()) {
        $content['refid'] = determineReferalId();
 }
 
-// Percent values etc.
-$content['charge'] = translateComma(getConfig('doubler_charge') * 100);
-$content['ref']    = translateComma(getConfig('doubler_ref') * 100);
-$content['total']  = translateComma(getConfig('doubler_points'));
-$content['min']    = translateComma(getConfig('doubler_min'));
-$content['max']    = translateComma(getConfig('doubler_max'));
-
 // Text "Enter login"
 if (isExtensionActive('nickname')) {
        // Choose login/nickname
@@ -210,12 +203,6 @@ $content['payout_time'] = getMessage('DOUBLER_PAYOUT_TIME_' . getConfig('doubler
 // Generate table with already payed out doubles
 $content['payout_history'] = generateDoublerTable(0, 'Y', 'N', 'DESC');
 
-// Generate timemark
-$content['timeout_mark'] = createFancyTime(getConfig('doubler_timeout'));
-
-// Points left to doubler
-$content['left'] = translateComma(DOUBLER_GET_TOTAL_POINTS_LEFT());
-
 // Output neccessary form for this
 loadTemplate('doubler_index', false, $content);