X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=278c570375f636a7c09022d03a7fcadb2c1d0c32;hb=9f7884e487d89c5d311531d1da67f1806b48ec27;hp=14630ab3b4f7b65fbe13eecabe7ced0c572066ee;hpb=6b011418a22c7974a0a4c56351caef20dcfa5020;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index 14630ab3b4..278c570375 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -18,6 +18,7 @@ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -442,25 +443,25 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { } // END - if // Load user's data - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):UID={$userid},template={$template},content[]=".gettype($content).''); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UID={$userid},template={$template},content[]=".gettype($content).''); if (($userid > 0) && (is_array($content))) { // If nickname extension is installed, fetch nickname as well if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) { - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):NICKNAME!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "NICKNAME!"); // Load by nickname fetchUserData($userid, 'nickname'); } else { - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):NO-NICK!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "NO-NICK!"); /// Load by userid fetchUserData($userid); } // Merge data if valid - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):content()=".count($content)." - PRE"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "content()=".count($content)." - PRE"); if (isUserDataValid()) { $content = merge_array($content, getUserDataArray()); } // END - if - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):content()=".count($content)." - AFTER"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "content()=".count($content)." - AFTER"); } // END - if // Translate M to male or F to female if present @@ -469,7 +470,7 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { // Overwrite email from data if present if (isset($content['email'])) $email = $content['email']; - // Store email for some functions in global data array + // Store email for some functions in global $DATA array // @TODO Do only use $content, not $DATA or raw variables $DATA['email'] = $email; @@ -532,13 +533,13 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { // Send mail out to an email address function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '') { - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):TO={$toEmail},SUBJECT={$subject}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail},SUBJECT={$subject}"); // Compile subject line (for POINTS constant etc.) eval("\$subject = decodeEntities(\"".compileRawCode(escapeQuotes($subject))."\");"); // Set from header - if ((!eregi('@', $toEmail)) && ($toEmail > 0)) { + if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) { // Value detected, is the message extension installed? // @TODO Extension 'msg' does not exist if (isExtensionActive('msg')) { @@ -558,7 +559,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' // Is the webmaster! $toEmail = getConfig('WEBMASTER'); } - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):TO={$toEmail}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail}"); // Check for PHPMailer or debug-mode if (!checkPhpMailerUsage()) { @@ -820,10 +821,10 @@ function translateGender ($gender) { case 'F': $ret = getMessage('GENDER_F'); break; case 'C': $ret = getMessage('GENDER_C'); break; default: - // Log unknown gender - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown gender %s detected.", $gender)); + // Please report bugs on unknown genders + debug_report_bug(sprintf("Unknown gender %s detected.", $gender)); break; - } + } // END - switch // Return translated gender return $ret; @@ -845,8 +846,8 @@ function translateUserStatus ($status) { break; default: - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status)); - $ret = getMaskedMessage('UNKNOWN_STATUS', $status); + // Please report all unknown status + debug_report_bug(sprintf("Unknown status %s detected.", $status)); break; } // END - switch @@ -922,7 +923,7 @@ function makeTime ($hours, $minutes, $seconds, $stamp) { } // Redirects to an URL and if neccessarry extends it with own base URL -function redirectToUrl ($URL) { +function redirectToUrl ($URL, $allowSpider = true) { // Compile out codes eval('$URL = "' . compileRawCode(encodeUrl($URL)) . '";'); @@ -941,7 +942,7 @@ function redirectToUrl ($URL) { //* DEBUG: */ die($URL); // Simple probe for bots/spiders from search engines - if (isSpider()) { + if ((isSpider()) && ($allowSpider === true)) { // Secure the URL against bad things such als HTML insertions and so on... $URL = secureString($URL); @@ -1059,10 +1060,10 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true $test = substr($found, 0, strlen($match)); // Does this entry exist? - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):found={$found},match={$match},set={$set}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "found={$found},match={$match},set={$set}"); if ($test == $match) { // Match found! - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):fuzzyFound!"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "fuzzyFound!"); $fuzzyFound = true; break; } // END - if @@ -1074,14 +1075,14 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true // Take all string elements if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key."_" . $matches[4][$key]]))) { // Replace it in the code - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):key={$key},match={$match}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "key={$key},match={$match}"); $newMatch = str_replace('[', "['", str_replace(']', "']", $match)); $code = str_replace($match, '".' . $newMatch . '."', $code); $matchesFound[$key . '_' . $matches[4][$key]] = 1; $matchesFound[$match] = 1; } elseif (!isset($matchesFound[$match])) { // Not yet replaced! - //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):match={$match}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "match={$match}"); $code = str_replace($match, '".' . $match . '."', $code); $matchesFound[$match] = 1; } @@ -1263,7 +1264,7 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're // function generateRandomCode ($length, $code, $userid, $DATA = '') { // Build server string - $server = $_SERVER['PHP_SELF'] . getConfig('ENCRYPT_SEPERATOR') . detectUserAgent() . getConfig('ENCRYPT_SEPERATOR') . getenv('SERVER_SOFTWARE') . getConfig('ENCRYPT_SEPERATOR') . detectRemoteAddr().":'.':".filemtime(getConfig('PATH').'inc/databases.php'); + $server = $_SERVER['PHP_SELF'] . getConfig('ENCRYPT_SEPERATOR') . detectUserAgent() . getConfig('ENCRYPT_SEPERATOR') . getenv('SERVER_SOFTWARE') . getConfig('ENCRYPT_SEPERATOR') . detectRemoteAddr(); // Build key string $keys = getConfig('SITE_KEY') . getConfig('ENCRYPT_SEPERATOR') . getConfig('DATE_KEY'); @@ -1314,7 +1315,7 @@ function generateRandomCode ($length, $code, $userid, $DATA = '') { } // Does only allow numbers -function bigintval ($num, $castValue = true) { +function bigintval ($num, $castValue = true, $abortOnMismatch = true) { // Filter all numbers out $ret = preg_replace('/[^0123456789]/', '', $num); @@ -1322,7 +1323,7 @@ function bigintval ($num, $castValue = true) { if ($castValue === true) $ret = (double)$ret; // Has the whole value changed? - if ('' . $ret . '' != '' . $num . '') { + if (('' . $ret . '' != '' . $num . '') && ($abortOnMismatch === true)) { // Log the values debug_report_bug('Problem with number found. ret=' . $ret . ', num='. $num); } // END - if @@ -1461,38 +1462,38 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = $OUT .= "
'.print_r($request, true).'
'.print_r($response, true).'
mapper='.print_r($mapper, true).'
'.print_r($ins_vers, true).'