X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Ffunctions.php;h=becc231d6bb8ac81e4d037009b5e5625b95248f6;hb=54064b2236537ac1d673c36686c0c4fda1cf4a3a;hp=a452aab3571b95665f8c62be10e3d3dc062dd30d;hpb=503bf784a5f774e075bd5284eb7b65596701b9a8;p=mailer.git
diff --git a/inc/functions.php b/inc/functions.php
index a452aab357..becc231d6b 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -17,7 +17,7 @@
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -92,7 +92,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
} // END - if
// Set from header
- if ((!isInStringIgnoreCase('@', str_replace('{AT}', '@', $toEmail))) && ($toEmail > 0)) {
+ if ((!isInString('@', $toEmail)) && ($toEmail > 0)) {
// Does the user exist?
if ((isExtensionActive('user')) && (fetchUserData($toEmail))) {
// Get the email
@@ -211,9 +211,9 @@ function sendRawEmail ($toEmail, $subject, $message, $headers) {
$mail->AddAddress($toEmail, '');
$mail->AddReplyTo(getWebmaster(), getMainTitle());
- $mail->AddCustomHeader('Errors-To:' . getWebmaster());
- $mail->AddCustomHeader('X-Loop:' . getWebmaster());
- $mail->AddCustomHeader('Bounces-To:' . getWebmaster());
+ $mail->AddCustomHeader('Errors-To: ' . getWebmaster());
+ $mail->AddCustomHeader('X-Loop: ' . getWebmaster());
+ $mail->AddCustomHeader('Bounces-To: ' . getWebmaster());
$mail->Send();
// Has an error occured?
@@ -1185,11 +1185,11 @@ function getMessageFromErrorCode ($code) {
case getCode('COOKIES_DISABLED') : $message = '{--LOGIN_COOKIES_DISABLED--}'; break;
case getCode('BEG_SAME_AS_OWN') : $message = '{--BEG_SAME_USERID_AS_OWN--}'; break;
case getCode('LOGIN_FAILED') : $message = '{--GUEST_LOGIN_FAILED_GENERAL--}'; break;
- case getCode('MODULE_MEMBER_ONLY') : $message = '{%message,MODULE_MEMBER_ONLY=' . getRequestParameter('mod') . '%}'; break;
+ case getCode('MODULE_MEMBER_ONLY') : $message = '{%message,MODULE_MEMBER_ONLY=' . getRequestElement('mod') . '%}'; break;
case getCode('OVERLENGTH') : $message = '{--MEMBER_TEXT_OVERLENGTH--}'; break;
case getCode('URL_FOUND') : $message = '{--MEMBER_TEXT_CONTAINS_URL--}'; break;
case getCode('SUBJECT_URL') : $message = '{--MEMBER_SUBJECT_CONTAINS_URL--}'; break;
- case getCode('BLIST_URL') : $message = '{--MEMBER_URL_BLACK_LISTED--}
{--MEMBER_BLIST_TIME--}: ' . generateDateTime(getRequestParameter('blist'), 0); break;
+ case getCode('BLIST_URL') : $message = '{--MEMBER_URL_BLACK_LISTED--}
{--MEMBER_BLIST_TIME--}: ' . generateDateTime(getRequestElement('blist'), 0); break;
case getCode('NO_RECS_LEFT') : $message = '{--MEMBER_SELECTED_MORE_RECS--}'; break;
case getCode('INVALID_TAGS') : $message = '{--MEMBER_HTML_INVALID_TAGS--}'; break;
case getCode('MORE_POINTS') : $message = '{--MEMBER_MORE_POINTS_NEEDED--}'; break;
@@ -1211,8 +1211,8 @@ function getMessageFromErrorCode ($code) {
break;
case getCode('EXTENSION_PROBLEM'):
- if (isGetRequestParameterSet('ext')) {
- $message = '{%pipe,generateExtensionInactiveNotInstalledMessage=' . getRequestParameter('ext') . '%}';
+ if (isGetRequestElementSet('ext')) {
+ $message = '{%pipe,generateExtensionInactiveNotInstalledMessage=' . getRequestElement('ext') . '%}';
} else {
$message = '{--EXTENSION_PROBLEM_UNSET_EXT--}';
}
@@ -1221,7 +1221,7 @@ function getMessageFromErrorCode ($code) {
case getCode('URL_TIME_LOCK'):
// @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
$result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
- array(bigintval(getRequestParameter('id'))), __FUNCTION__, __LINE__);
+ array(bigintval(getRequestElement('id'))), __FUNCTION__, __LINE__);
// Load timestamp from last order
$content = SQL_FETCHARRAY($result);
@@ -1358,7 +1358,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0
// Read from source file
$line = fgets ($fp, 1024);
- if (strpos($line, $search) > -1) {
+ if (isInString($search, $line)) {
$next = '0';
$found = true;
} // END - if
@@ -1553,7 +1553,7 @@ function handleLoginFailures ($accessLevel) {
// Rebuild cache
function rebuildCache ($cache, $inc = '', $force = false) {
// Debug message
- /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("cache=%s, inc=%s, force=%s", $cache, $inc, intval($force)));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("cache=%s, inc=%s, force=%s", $cache, $inc, intval($force)));
// Shall I remove the cache file?
if (isCacheInstanceValid()) {
@@ -1655,22 +1655,22 @@ function determineReferalId () {
if (isReferalIdValid()) {
// This is fine...
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GLOBALS (' . getReferalId() . ')');
- } elseif (isPostRequestParameterSet('refid')) {
+ } elseif (isPostRequestElementSet('refid')) {
// Get referal id from POST element refid
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from POST data (' . postRequestParameter('refid') . ')');
- setReferalId(secureString(postRequestParameter('refid')));
- } elseif (isGetRequestParameterSet('refid')) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from POST data (' . postRequestElement('refid') . ')');
+ setReferalId(secureString(postRequestElement('refid')));
+ } elseif (isGetRequestElementSet('refid')) {
// Get referal id from GET parameter refid
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GET data (' . getRequestParameter('refid') . ')');
- setReferalId(secureString(getRequestParameter('refid')));
- } elseif (isGetRequestParameterSet('ref')) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from GET data (' . getRequestElement('refid') . ')');
+ setReferalId(secureString(getRequestElement('refid')));
+ } elseif (isGetRequestElementSet('ref')) {
// Set refid=ref (the referal link uses such variable)
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestParameter('refid') . ')');
- setReferalId(secureString(getRequestParameter('ref')));
- } elseif ((isGetRequestParameterSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using ref from GET data (' . getRequestElement('refid') . ')');
+ setReferalId(secureString(getRequestElement('ref')));
+ } elseif ((isGetRequestElementSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
// The variable user comes from click.php
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using user from GET data (' . getRequestParameter('user') . ')');
- setReferalId(bigintval(getRequestParameter('user')));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using user from GET data (' . getRequestElement('user') . ')');
+ setReferalId(bigintval(getRequestElement('user')));
} elseif ((isSessionVariableSet('refid')) && (isValidUserId(getSession('refid')))) {
// Set session refid as global
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using refid from SESSION data (' . getSession('refid') . ')');
@@ -2062,7 +2062,7 @@ function getModuleFromFileName ($file, $accessLevel) {
// Encodes an URL for adding session id, etc.
function encodeUrl ($url, $outputMode = '0') {
// Do we have already have a PHPSESSID inside or view.php is called? Then abort here
- if ((strpos($url, session_name()) !== false) || (isRawOutputMode())) {
+ if ((isInStringIgnoreCase(session_name(), $url)) || (isRawOutputMode())) {
// Raw output mode detected or session_name() found in URL
return $url;
} // END - if
@@ -2072,7 +2072,7 @@ function encodeUrl ($url, $outputMode = '0') {
// Invalid session
// Determine right seperator
$seperator = '&';
- if (strpos($url, '?') === false) {
+ if (!isInString('?', $url)) {
// No question mark
$seperator = '?';
} elseif ((!isHtmlOutputMode()) || ($outputMode != '0')) {
@@ -2099,7 +2099,7 @@ function encodeUrl ($url, $outputMode = '0') {
// Simple check for spider
function isSpider () {
// Get the UA and trim it down
- $userAgent = trim(strtolower(detectUserAgent(true)));
+ $userAgent = trim(detectUserAgent(true));
// It should not be empty, if so it is better a spider/bot
if (empty($userAgent)) {
@@ -2108,7 +2108,7 @@ function isSpider () {
} // END - if
// Is it a spider?
- return ((strpos($userAgent, 'spider') !== false) || (strpos($userAgent, 'slurp') !== false) || (strpos($userAgent, 'bot') !== false) || (strpos($userAgent, 'archiver') !== false));
+ return ((isInStringIgnoreCase('spider', $userAgent)) || (isInStringIgnoreCase('slurp', $userAgent)) || (isInStringIgnoreCase('bot', $userAgent)) || (isInStringIgnoreCase('archiver', $userAgent)));
}
// Function to search for the last modified file
@@ -2173,7 +2173,7 @@ function handleFieldWithBraces ($field) {
// Converts a zero or NULL to word 'NULL'
function makeZeroToNull ($number) {
// Is it a valid username?
- if ((!is_null($number)) && ($number > 0)) {
+ if ((!is_null($number)) && (!empty($number)) && ($number > 0)) {
// Always secure it
$number = bigintval($number);
} else {
@@ -2185,13 +2185,16 @@ function makeZeroToNull ($number) {
return $number;
}
-// Converts NULL into number zero
+// Converts a NULL to zero
function makeNullToZero ($number) {
- // Is this a NULL?
- if ((is_null($number)) || (empty($number))) {
- // Simply set it
+ // Is it a valid username?
+ if ((!is_null($number)) && (!empty($number)) && ($number > 0)) {
+ // Always secure it
+ $number = bigintval($number);
+ } else {
+ // Is not valid or zero
$number = '0';
- } // END - if
+ }
// Return it
return $number;