]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/wernis_functions.php
More misc fixes and rewrites (sorry, lame description)
[mailer.git] / inc / libs / wernis_functions.php
index 121dc2871b14db00f4eb30b48e88827273ba7bc5..7c89782e871897aa927df8c0a76b2e2b19457299 100644 (file)
@@ -43,9 +43,9 @@ if (!defined('__SECURITY')) {
 }
 
 // Sets a status message and code
-function WERNIS_STATUS_MESSAGE ($msg, $status) {
-       $GLOBALS['wernis_data']['message'] = $msg;
-       $GLOBALS['wernis_data']['status'] = $status;
+function WERNIS_STATUS_MESSAGE ($message, $status) {
+       $GLOBALS['wernis_data']['message'] = $message;
+       $GLOBALS['wernis_data']['status']  = $status;
 }
 
 // Get the status message
@@ -113,7 +113,13 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        } // END - if
 
        // All (maybe) fine so remove the response header from server
-       $response = $response[(count($response) - 1)];
+       for ($idx = (count($response) - 1); $idx > 1; $idx--) {
+               $line = trim($response[$idx]);
+               if (!empty($line)) {
+                       $response = $line;
+                       break;
+               }
+       }
 
        // Prepare the returning result for higher functions
        if (substr($response, 0, 1) == '&') {
@@ -327,7 +333,7 @@ function WERNIS_TRANSFER_STATUS ($status) {
 function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') {
        // Register this wernis movement
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_wernis` (`userid`,`wernis_account`,`wernis_amount`,`wernis_timestamp`,`wernis_type`,`wernis_api_message`,`wernis_api_status`) VALUES (%d, %d, %d, UNIX_TIMESTAMP(), '%s', '%s', '%s')",
-       array(getUserId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
+               array(getUserId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
 }
 
 // Take fees and factor
@@ -383,7 +389,7 @@ function WERNIS_ADD_FEES_TO_ARRAY (&$array) {
        // Is the array an array? ;-)
        if (!is_array($array)) {
                // Log error and return
-               DEBUG_LOG(__FUNCTION__, __LINE__, ' Type '.gettype($array).'!=array.');
+               DEBUG_LOG(__FUNCTION__, __LINE__, 'Type ' . gettype($array) . ' != array.');
                return;
        } // END - if