]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/sponsor_functions.php
Double question mark fixed
[mailer.git] / inc / libs / sponsor_functions.php
index 6c5dc2fd3e2497da648b1856fc5b3bcb234a60fb..b84281d7871f1098a924c8ba9108b03238e8b2f5 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -79,7 +79,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(),
                                                        if (SQL_NUMROWS($result) == 1) {
                                                                // Yes, he is!
                                                                if ((getWhat() == 'add_sponsor') || ($update)) {
-                                                                       // Already found!
+                                                                       // Already found
                                                                        $ALREADY = true;
                                                                } else {
                                                                        // Update his data
@@ -157,7 +157,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(),
                                        // Generate hash code
                                        $DATA['keys'][] = 'hash';
                                        // @TODO Rewrite this to API function
-                                       $DATA['values'][] = md5(session_id().':'.$postData['email'].':'.detectRemoteAddr().':'.detectUserAgent().':'.time());
+                                       $DATA['values'][] = md5(session_id() . getEncryptSeperator() . $postData['email'] . getEncryptSeperator() . detectRemoteAddr() . getEncryptSeperator() . detectUserAgent() . getEncryptSeperator() . time());
                                        $DATA['keys'][] = 'remote_addr';
                                        $DATA['values'][] = detectRemoteAddr();
                                }
@@ -207,16 +207,16 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(),
                                $result = SQL_QUERY_ESC($sql, $DATA['values'], __FUNCTION__, __LINE__);
                        } // END - if
                } else {
-                       // Error found!
+                       // Error detected
                        $message = getMessageFromIndexedArray('{--SPONSOR_DATA_NOT_SAVED--}', 'failed', $messageArray);
-                       loadTemplate('admin_settings_saved', false, $message);
+                       displayMessage($message);
                }
 
        // Always return the status
        return $ret;
 }
 
-//
+// Translate the account status
 function sponsorTranslateUserStatus ($status) {
        // Construct constant name
        $constantName = sprintf("ACCOUNT_STATUS_%s", $status);
@@ -226,10 +226,10 @@ function sponsorTranslateUserStatus ($status) {
                // Then use it
                $ret = getMessage($constantName);
        } else {
-               // Not found!
+               // 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
@@ -311,7 +311,7 @@ ORDER BY
                                $OUT .= loadTemplate('sponsor_action', true, $content);
                        } else {
                                // No sub menus active
-                               $OUT .= loadTemplate('admin_settings_saved', true, '{--SPONSOR_NO_SUB_MENUS_ACTIVE--}');
+                               $OUT .= displayMessage('{--SPONSOR_NO_SUB_MENUS_ACTIVE--}', true);
                        }
 
                        // Free memory
@@ -319,7 +319,7 @@ ORDER BY
                } // END - while
        } else {
                // No main menus active
-               $OUT .= loadTemplate('admin_settings_saved', true, '{--SPONSOR_NO_MAIN_MENUS_ACTIVE--}');
+               $OUT .= displayMessage('{--SPONSOR_NO_MAIN_MENUS_ACTIVE--}', true);
        }
 
        // Free memory
@@ -340,8 +340,8 @@ function addSponsorContent ($what) {
                // Every sponsor action will output nothing directly. It will be written into $GLOBALS['sponsor_output']!
                loadIncludeOnce($INC);
        } else {
-               // File not found!
-               $GLOBALS['sponsor_output'] .= loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_CONTENT_404', $what));
+               // File not found
+               $GLOBALS['sponsor_output'] .= displayMessage(getMaskedMessage('SPONSOR_CONTENT_404', $what), true);
        }
 
        // Return content
@@ -370,7 +370,7 @@ LIMIT 1",
                        ), __FUNCTION__, __LINE__);
 
                // This update went fine?
-               $login = (SQL_AFFECTEDROWS() == 1);
+               $login = (!SQL_HASZEROAFFECTED());
        } // END - if
 
        // Return status
@@ -428,7 +428,7 @@ function saveSponsorData ($postData, $content) {
 
                        // Generate hash code
                        // @TODO Rewrite this to API function
-                       $HASH = md5(session_id() . ':' . $postData['email'] . ':' . detectRemoteAddr() . ':' . detectUserAgent() . ':' . time());
+                       $HASH = md5(session_id() . getEncryptSeperator() . $postData['email'] . getEncryptSeperator() . detectRemoteAddr() . getEncryptSeperator() . detectUserAgent() . getEncryptSeperator() . time());
                        $DATA[] = $HASH;
                } // END - if
        } // END - if
@@ -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']);