]> git.mxchange.org Git - mailer.git/commitdiff
Total eval() commands slightly reduced, still there are some left
authorquix0r <quix0r@mxchange.org>
Tue, 27 Jul 2010 22:44:26 +0000 (22:44 +0000)
committerquix0r <quix0r@mxchange.org>
Tue, 27 Jul 2010 22:44:26 +0000 (22:44 +0000)
inc/config-functions.php
inc/functions.php
inc/libs/primera_functions.php
inc/libs/wernis_functions.php
inc/modules/admin/what-usage.php
inc/wrapper-functions.php

index d2cd10c46f62f1cdeedf0f50848c29957bd5ac2a..e86c97ac6eb3c7ca6c98a2bcbc8f830681a4f0d6 100644 (file)
@@ -154,7 +154,7 @@ function updateOldConfigFile () {
                '_TABLE_TYPE'        => '_TABLE_TYPE',
                '_DB_TYPE'           => '_DB_TYPE',
                'SMTP_HOSTNAME'      => 'SMTP_HOSTNAME',
-               'SMTP_USER'           => 'SMTP_USER',
+               'SMTP_USER'          => 'SMTP_USER',
                'SMTP_PASSWORD'      => 'SMTP_PASSWORD',
                'ENABLE_BACKLINK'    => 'ENABLE_BACKLINK',
                'MAIN_TITLE'         => 'MAIN_TITLE',
@@ -243,7 +243,7 @@ function updateOldConfigFile () {
                $line = trim($line);
 
                // Is the $MySQL found?
-               if (substr($line, 0, 6) == "\$MySQL") {
+               if (substr($line, 0, 6) == '$MySQL') {
                        // Okay found!
                        $found = true;
                } elseif ($found === true) {
index bccca8bca0c4d10721abab9fc45fae73727d7bdd..eef935d62ec923e44ad7b5cd93e7afa83fef44e2 100644 (file)
@@ -106,9 +106,6 @@ function getTotalFatalErrors () {
 function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '') {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'toEmail=' . $toEmail . ',subject=' . $subject . ',isHtml=' . $isHtml);
 
-       // Compile subject line (for POINTS constant etc.)
-       eval('$subject = decodeEntities("' . compileRawCode(escapeQuotes($subject)) . '");');
-
        // Set from header
        if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) {
                // Value detected, is the message extension installed?
@@ -182,12 +179,17 @@ function checkPhpMailerUsage() {
 }
 
 // Send out a raw email with PHPMailer class or legacy mail() command
-function sendRawEmail ($toEmail, $subject, $message, $from) {
-       // Just compile all again, to put out all configs, etc.
-       eval('$toEmail = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($toEmail)), false) . '");');
-       eval('$subject = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($subject)), false) . '");');
-       eval('$message = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($message)), false) . '");');
-       eval('$from    = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($from))   , false) . '");');
+function sendRawEmail ($toEmail, $subject, $message, $headers) {
+       // Just compile all to put out all configs, etc.
+       $eval  = '$toEmail = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($toEmail)), false) . '"); ';
+       $eval .= '$subject = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($subject)), false) . '"); ';
+       $eval .= '$headers = decodeEntities("' . doFinalCompilation(compileRawCode(escapeQuotes($headers)), false) . '"); ';
+
+       // Do not decode entities in the message because we also send HTML mails through this function
+       $eval .= '$message = "' . doFinalCompilation(compileRawCode(escapeQuotes($message)), false) . '";';
+
+       // Run the final eval() command
+       eval($eval);
 
        // Shall we use PHPMailer class or legacy mode?
        if (checkPhpMailerUsage()) {
@@ -210,10 +212,10 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                $mail->Port       = 25;
                $mail->Username   = getConfig('SMTP_USER');
                $mail->Password   = getConfig('SMTP_PASSWORD');
-               if (empty($from)) {
+               if (empty($headers)) {
                        $mail->From = getConfig('WEBMASTER');
                } else {
-                       $mail->From = $from;
+                       $mail->From = $headers;
                }
                $mail->FromName   = getMainTitle();
                $mail->Subject    = $subject;
@@ -225,10 +227,12 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                } else {
                        $mail->Body       = decodeEntities($message);
                }
+
                $mail->AddAddress($toEmail, '');
                $mail->AddReplyTo(getConfig('WEBMASTER'), getMainTitle());
                $mail->AddCustomHeader('Errors-To:' . getConfig('WEBMASTER'));
                $mail->AddCustomHeader('X-Loop:' . getConfig('WEBMASTER'));
+               $mail->AddCustomHeader('Bounces-To:' . getConfig('WEBMASTER'));
                $mail->Send();
 
                // Has an error occured?
@@ -244,7 +248,7 @@ function sendRawEmail ($toEmail, $subject, $message, $from) {
                }
        } else {
                // Use legacy mail() command
-               return mail($toEmail, $subject, decodeEntities($message), $from);
+               return mail($toEmail, $subject, decodeEntities($message), $headers);
        }
 }
 
@@ -554,7 +558,7 @@ function redirectToUrl ($URL, $allowSpider = true) {
        } // END - if
 
        // Three different ways to debug...
-       //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL));
+       //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'URL=' . $URL);
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $URL);
        //* DEBUG: */ die($URL);
 
@@ -763,7 +767,7 @@ function createFancyTime ($stamp) {
        foreach($data as $k => $v) {
                if ($v > 0) {
                        // Value is greater than 0 "eval" data to return string
-                       eval('$ret .= ", ".$v." {--_' . strtoupper($k) . '--}";');
+                       $ret .= ', ' . $v . ' {--_' . strtoupper($k) . '--}';
                        break;
                } // END - if
        } // END - foreach
index baf88c8796b5bf106a82eef3da02119d7e957a9e..9653804725c7f3974fe841c996fb734a50fad79d 100644 (file)
@@ -258,7 +258,7 @@ function executePrimeraWithdraw ($primusNick, $userMd5, $amount) {
        $api = new PrimeraApi($primusNick, $userMd5);
 
        // Prepare purpose
-       eval('$purpose = "' . preCompileCode(getMaskedMessage('PRIMERA_API_PURPOSE_WITHDRAW', getSession('sponsorid'))) . '";');
+       eval('$purpose = "' . doFinalCompilation(getMaskedMessage('PRIMERA_API_PURPOSE_WITHDRAW', getSession('sponsorid')), true) . '";');
 
        // Pay the Primera
        return $api->payPrimera($primusNick, $amount, $purpose);
@@ -270,7 +270,7 @@ function executePrimeraPayout ($primusNick, $userMd5, $amount) {
        $api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5'));
 
        // Prepare purpose
-       eval('$purpose = "' . preCompileCode(getMaskedMessage('PRIMERA_API_PURPOSE_PAYOUT', getMemberId())) . '";');
+       eval('$purpose = "' . doFinalCompilation(getMaskedMessage('PRIMERA_API_PURPOSE_PAYOUT', getMemberId()), true) . '";');
 
        // Pay the Primera
        return $api->payPrimera($primusNick, $amount, $purpose);
index ffc792f40f0e7ff315c2951ebb73152ecdbb5af9..df3a61d2e1332d79cc6db03b22193adcc3f89305 100644 (file)
@@ -97,6 +97,15 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        $requestData['api_id']  = getConfig('wernis_api_id');
        $requestData['api_key'] = getConfig('wernis_api_md5');
 
+       // Is a purpose there?
+       if (isset($requestData['purpose'])) {
+               // Eval the purpose
+               eval('$purpose = "' . doFinalCompilation($requestData['purpose'], false) . '";');
+
+               // Prepare the purpose, it needs encoding
+               $requestData['purpose'] = encodeString($purpose);
+       } // END - if
+
        // Construct the request string
        $requestString = getConfig('wernis_api_url') . $scriptName;
 
@@ -210,6 +219,7 @@ function WERNIS_TEST_API () {
        // Return the result from the lower functions
        $return = WERNIS_SEND_REQUEST('balance.php');
 
+       // Did it went smoothly?
        if ($return['status'] == 'OK') {
                // All fine!
                $result = true;
@@ -238,9 +248,6 @@ function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) {
        // Default is failed attempt
        $result = false;
 
-       // Prepare the purpose
-       eval('$purpose = "' . preCompileCode(getMaskedMessage('WERNIS_API_PURPOSE_WITHDRAW', getMemberId())) . '";');
-
        // Prepare the request data
        $requestData = array(
                'sub_request' => 'receive',
@@ -248,7 +255,7 @@ function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) {
                't_md5'       => $userMd5,
                'r_uid'       => getConfig('wernis_refid'),
                'amount'      => bigintval($amount),
-               'purpose'     => encodeString($purpose, false)
+               'purpose'     => getMaskedMessage('WERNIS_API_PURPOSE_WITHDRAW', getMemberId())
        );
 
        // Return the result from the lower functions
@@ -278,9 +285,6 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) {
        // Default is failed attempt
        $result = false;
 
-       // Prepare the purpose
-       eval('$purpose = "' . preCompileCode(getMaskedMessage('WERNIS_API_PURPOSE_PAYOUT', getMemberId())) . '";');
-
        // Prepare the request data
        $requestData = array(
                'sub_request' => 'send',
@@ -288,7 +292,7 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) {
                't_md5'       => getConfig('wernis_pass_md5'),
                'r_uid'       => bigintval($wdsId),
                'amount'      => bigintval($amount),
-               'purpose'     => encodeString($purpose, false)
+               'purpose'     => getMaskedMessage('WERNIS_API_PURPOSE_PAYOUT', getMemberId())
        );
 
        // Return the result from the lower functions
index 1ff86f45f9fc1816818da5a8987539ad87cfb4ef..a4ed0b2622bb92ea1eb7d26d8f2e7e136878a6cb 100644 (file)
@@ -40,7 +40,7 @@
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
@@ -48,6 +48,12 @@ addMenuDescription('admin', __FILE__);
 // Base directory (should be moved to database)
 $usage = getConfig('usage_base') . '/';
 
+// Init FQFN
+$FQFN = sprintf("%s%s/index.html",
+       getPath(),
+       getConfig('usage_base')
+);
+
 if (isGetRequestParameterSet('image')) {
        if (getRequestParameter('type') == 'usage') {
                $FQFN = sprintf("%s%s/usage.png",
@@ -71,12 +77,7 @@ if (isGetRequestParameterSet('image')) {
                imagedestroy($image);
        }
        shutdown();
-} elseif (!isGetRequestParameterSet('usage')) {
-       $FQFN = sprintf("%s%s/index.html",
-               getPath(),
-               getConfig('usage_base')
-       );
-} else {
+} elseif (isGetRequestParameterSet('usage')) {
        $FQFN = sprintf("%s%s/usage_%s.html",
                getPath(),
                getConfig('usage_base'),
@@ -94,7 +95,7 @@ if ((!empty($FQFN)) && (isFileReadable($FQFN))) {
        $content = str_replace('daily_usage_' , '{?URL?}/modules.php?module=admin&amp;what=' . getWhat() . '&amp;type=daily&amp;image='     , $content);
        $content = str_replace('hourly_usage_', '{?URL?}/modules.php?module=admin&amp;what=' . getWhat() . '&amp;type=hourly&amp;image='    , $content);
        $content = str_replace('ctry_usage_'  , '{?URL?}/modules.php?module=admin&amp;what=' . getWhat() . '&amp;type=ctry&amp;image='      , $content);
-       $content = str_replace('usage_'       , '{?URL?}/modules.php?module=admin&amp;what=' . getWhat() . '&amp;usage='                , str_replace('.html', '', $content));
+       $content = str_replace('usage_'       , '{?URL?}/modules.php?module=admin&amp;what=' . getWhat() . '&amp;usage='                    , str_replace('.html', '', $content));
        $test = strtolower($content);
 
        // Do we need to strip out above and including <body> plus trailing </html> tag?
index a4fc62e3bb82da2899158a4635a54810a73337c0..df15ededa233ea6fb05c2906c97b88d87410eb2d 100644 (file)
@@ -963,7 +963,7 @@ function sendRawRedirect ($url) {
 
        // check if running on IIS < 6 with CGI-PHP
        if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) &&
-               (strpos($_SERVER['GATEWAY_INTERFACE'],'CGI') !== false) &&
+               (strpos($_SERVER['GATEWAY_INTERFACE'], 'CGI') !== false) &&
                (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) &&
                ($matches[1] < 6)) {
                // Send the IIS header