X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fsponsor_functions.php;h=b84281d7871f1098a924c8ba9108b03238e8b2f5;hb=b6c301dece2d7a3375321d4f3c0498ceaeb5a2a6;hp=ea4a23b0396445742a888cdf416938ff935b412e;hpb=c9b17a86f4d62b50b8b1fbe6f9d88e6092430526;p=mailer.git diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index ea4a23b039..b84281d787 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -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 @@ -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 @@ -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']);