X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=1c5ee8fd3193186614180b1f5d8c9f0e5378334d;hb=a5aee3c21c5f9abd13286f26e6ee379539b02f69;hp=e65600e13e36994bee1d1796de5e7cea09bad849;hpb=0f3a135204757cc8750262871c8e62c42300acb4;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index e65600e13e..1c5ee8fd31 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -92,7 +92,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' } // END - if // Set from header - if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) { + if ((!isInString('@', $toEmail)) && ($toEmail > 0)) { // Does the user exist? if ((isExtensionActive('user')) && (fetchUserData($toEmail))) { // Get the email @@ -295,7 +295,7 @@ function generateDateTime ($time, $mode = '0') { default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode)); break; - } + } // END - switch break; default: // Default is the US date / time format! @@ -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 @@ -1453,7 +1453,6 @@ function handleExtraValues ($filterFunction, $value, $extraValue) { // Call the multi-parameter call-back $ret = call_user_func_array($filterFunction, $args); - die('filterFunction='.$filterFunction.',args=
'.print_r($args,true).',ret=
'.print_r($ret,true).'
'); } else { // One parameter call $ret = call_user_func($filterFunction, $value); @@ -1466,7 +1465,7 @@ function handleExtraValues ($filterFunction, $value, $extraValue) { } // Converts timestamp selections into a timestamp -function convertSelectionsToEpocheTime (array &$postData, array &$DATA, &$id, &$skip) { +function convertSelectionsToEpocheTime (array &$postData, array &$content, &$id, &$skip) { // Init test variable $skip = false; $test2 = ''; @@ -1481,7 +1480,7 @@ function convertSelectionsToEpocheTime (array &$postData, array &$DATA, &$id, &$ if ((isset($postData[$test.'_ye'])) && (isset($postData[$test.'_mo'])) && (isset($postData[$test.'_we'])) && (isset($postData[$test.'_da'])) && (isset($postData[$test.'_ho'])) && (isset($postData[$test.'_mi'])) && (isset($postData[$test.'_se'])) && ($test != $test2)) { // Generate timestamp $postData[$test] = createEpocheTimeFromSelections($test, $postData); - $DATA[] = sprintf("`%s`='%s'", $test, $postData[$test]); + $content[] = sprintf("`%s`='%s'", $test, $postData[$test]); $GLOBALS['skip_config'][$test] = true; // Remove data from array @@ -1691,7 +1690,7 @@ function determineReferalId () { } // Set cookie when default refid > 0 - if (!isSessionVariableSet('refid') || (!isValidUserId(getReferalId())) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) { + if ((!isSessionVariableSet('refid')) || (!isValidUserId(getReferalId())) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) { // Default is not found $found = false; @@ -1722,11 +1721,12 @@ function determineReferalId () { // Set cookie //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #1'); setSession('refid', getReferalId()); - } elseif (!isReferalIdValid()) { + } elseif ((!isReferalIdValid()) || (!fetchUserData(getReferalId()))) { // Not valid! //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not valid referal id (' . getReferalId() . '), setting NULL in session'); + setReferalId(NULL); setSession('refid', NULL); - } elseif ((!isSessionVariableSet('refid')) && (isValidUserId(getReferalId()))) { + } else { // Set it from GLOBALS array in session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Saving refid to session (' . getReferalId() . ') #2'); setSession('refid', getReferalId()); @@ -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