X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=25610ef39c4263cbded07e7e7d4ddf3acc22c15c;hp=9cd97a5890e348df795c823a58f6095aad5697a6;hb=64fd41598200f0a77acc0a5a34008fab33996a1a;hpb=3c8df4406f9247182f4dbe4494d62ac229a7bd28 diff --git a/inc/functions.php b/inc/functions.php index 9cd97a5890..25610ef39c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -116,7 +116,7 @@ function outputHtml ($htmlCode, $newLine = true) { sendHeader('Content-language: ' . getLanguage()); // Extension 'rewrite' installed? - if ((isExtensionActive('rewrite')) && (getOutputMode() != '1')) { + if ((isExtensionActive('rewrite')) && (getOutputMode() != 1)) { $GLOBALS['output'] = rewriteLinksInCode($GLOBALS['output']); } // END - if @@ -148,7 +148,7 @@ function outputHtml ($htmlCode, $newLine = true) { outputRawCode($GLOBALS['output']); } elseif ((getConfig('OUTPUT_MODE') == 'render') && (!empty($GLOBALS['output']))) { // Rewrite links when rewrite extension is active - if ((isExtensionActive('rewrite')) && (getOutputMode() != '1')) { + if ((isExtensionActive('rewrite')) && (getOutputMode() != 1)) { $GLOBALS['output'] = rewriteLinksInCode($GLOBALS['output']); } // END - if @@ -241,7 +241,7 @@ function loadTemplate ($template, $return=false, $content=array()) { if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = 0; // Generate date/time string - $date_time = generateDateTime(time(), '1'); + $date_time = generateDateTime(time(), 1); // Is content an array if (is_array($content)) $content['date_time'] = $date_time; @@ -410,7 +410,7 @@ function loadTemplate ($template, $return=false, $content=array()) { } // Loads an email template and compiles it -function loadEmailTemplate ($template, $content = array(), $UID = '0') { +function loadEmailTemplate ($template, $content = array(), $UID = 0) { global $DATA; // Our configuration is kept non-global here @@ -527,10 +527,9 @@ function loadEmailTemplate ($template, $content = array(), $UID = '0') { if (isFileReadable($FQFN)) { // The local file does exists so we load it. :) $GLOBALS['tpl_content'] = readFromFile($FQFN); - $GLOBALS['tpl_content'] = SQL_ESCAPE($GLOBALS['tpl_content']); // Run code - $GLOBALS['tpl_content'] = "\$newContent = decodeEntities(\"".compileCode($GLOBALS['tpl_content'])."\");"; + $GLOBALS['tpl_content'] = "\$newContent = decodeEntities(\"".compileCode(smartAddSlashes($GLOBALS['tpl_content']))."\");"; eval($GLOBALS['tpl_content']); } elseif (!empty($template)) { // Template file not found! @@ -636,12 +635,12 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' if (empty($isHtml)) $isHtml = 'N'; if (isDebugModeEnabled()) { // In debug mode we want to display the mail instead of sending it away so we can debug this part - outputHtml("
-".htmlentities(trim($mailHeader))."
-To      : " . $toEmail."
-Subject : " . $subject."
-Message : " . $message."
-
\n"); + outputHtml('
+Headers : ' . str_replace('<', '<', str_replace('>', '>', htmlentities(trim($mailHeader)))) . '
+To      : ' . $toEmail . '
+Subject : ' . $subject . '
+Message : ' . $message . '
+
'); } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) { // Send mail as HTML away sendHtmlEmail($toEmail, $subject, $message, $mailHeader); @@ -731,7 +730,7 @@ function generatePassword ($length = 0) { } // Generates a human-readable timestamp from the Uni* stamp -function generateDateTime ($time, $mode = '0') { +function generateDateTime ($time, $mode = 0) { // Filter out numbers $time = bigintval($time); @@ -744,10 +743,10 @@ function generateDateTime ($time, $mode = '0') { switch (getLanguage()) { case 'de': // German date / time format switch ($mode) { - case '0': $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break; - case '1': $ret = strtolower(date('d.m.Y - H:i', $time)); break; - case '2': $ret = date('d.m.Y|H:i', $time); break; - case '3': $ret = date('d.m.Y', $time); break; + case 0: $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break; + case 1: $ret = strtolower(date('d.m.Y - H:i', $time)); break; + case 2: $ret = date('d.m.Y|H:i', $time); break; + case 3: $ret = date('d.m.Y', $time); break; default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode)); break; @@ -756,10 +755,10 @@ function generateDateTime ($time, $mode = '0') { default: // Default is the US date / time format! switch ($mode) { - case '0': $ret = date('r', $time); break; - case '1': $ret = date('Y-m-d - g:i A', $time); break; - case '2': $ret = date('y-m-d|H:i', $time); break; - case '3': $ret = date('y-m-d', $time); break; + case 0: $ret = date('r', $time); break; + case 1: $ret = date('Y-m-d - g:i A', $time); break; + case 2: $ret = date('y-m-d|H:i', $time); break; + case 3: $ret = date('y-m-d', $time); break; default: logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode)); break; @@ -808,7 +807,7 @@ function translatePoolType ($type) { // Translates the american decimal dot into a german comma function translateComma ($dotted, $cut = true, $max = 0) { // Default is 3 you can change this in admin area "Misc -> Misc Options" - if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', '3'); + if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', 3); // Use from config is default $maxComma = getConfig('max_comma'); @@ -935,18 +934,25 @@ function countSelection ($array) { // Generate XHTML code for the CAPTCHA function generateCaptchaCode ($code, $type, $DATA, $userid) { - return 'Code'; + return 'Code ' . $code . ''; } // Generates a timestamp (some wrapper for mktime()) -function makeTime ($H, $M, $S, $stamp) { +function makeTime ($hours, $minutes, $seconds, $stamp) { // Extract day, month and year from given timestamp - $day = date('d', $stamp); - $month = date('m', $stamp); - $year = date('Y', $stamp); + $days = date('d', $stamp); + $months = date('m', $stamp); + $years = date('Y', $stamp); // Create timestamp for wished time which depends on extracted date - return mktime($H, $M, $S, $month, $day, $year); + return mktime( + $hours, + $minutes, + $seconds, + $months, + $days, + $years + ); } // Redirects to an URL and if neccessarry extends it with own base URL @@ -1158,7 +1164,7 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums = } // -function addSelectionBox ($type, $default, $prefix = '', $id = '0') { +function addSelectionBox ($type, $default, $prefix = '', $id = 0) { $OUT = ''; if ($type == 'yn') { @@ -1243,7 +1249,7 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0') { case 'sec': case 'min': for ($idx = 0; $idx < 60; $idx+=5) { - if (strlen($idx) == 1) $idx = '0' . $idx; + if (strlen($idx) == 1) $idx = 0 . $idx; $OUT .= "