]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/sponsor_functions.php
Some code cleanups/fixes:
[mailer.git] / inc / libs / sponsor_functions.php
index 6c5dc2fd3e2497da648b1856fc5b3bcb234a60fb..c225215424b2f79ef863463b1064ab67a70d5311 100644 (file)
@@ -216,7 +216,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(),
        return $ret;
 }
 
-//
+// Translate the account status
 function sponsorTranslateUserStatus ($status) {
        // Construct constant name
        $constantName = sprintf("ACCOUNT_STATUS_%s", $status);
@@ -229,7 +229,7 @@ function sponsorTranslateUserStatus ($status) {
                // Not found!
                //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
-               $ret = getMaskedMessage('ACCOUNT_STATUS_UNKNOWN_STATUS', $status);
+               $ret = getMaskedMessage('ACCOUNT_STATUS_UNKNOWN', $status);
        }
 
        // Return status
@@ -370,7 +370,7 @@ LIMIT 1",
                        ), __FUNCTION__, __LINE__);
 
                // This update went fine?
-               $login = (SQL_AFFECTEDROWS() == 1);
+               $login = (!SQL_HASZEROAFFECTED());
        } // END - if
 
        // Return status
@@ -473,7 +473,7 @@ function saveSponsorData ($postData, $content) {
        } // END - switch
 
        // Has an entry updated?
-       if (SQL_AFFECTEDROWS() == 1) {
+       if (!SQL_HASZEROAFFECTED()) {
                // Template and subject are set?
                if (!empty($templ) && !empty($subj)) {
                        // Run SQL command and check for success
@@ -696,10 +696,10 @@ function fetchSponsorData ($sponsor_id, $column = 'id') {
                if (isset($GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure'])) {
                        // Backup the raw one and zero it
                        $GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure_raw'] = $GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure'];
-                       $GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure'] = '0';
+                       $GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure'] = null;
 
                        // Is it not zero?
-                       if ($GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure_raw'] != '0000-00-00 00:00:00') {
+                       if (!is_null($GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure_raw'])) {
                                // Seperate data/time
                                $array = explode(' ', $GLOBALS['sponsor_data'][getCurrentSponsorId()]['last_failure_raw']);