X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Ffunctions.php;h=7857554a5ce86d1bb13e3072cc9062fc5f410941;hb=f4ef7580792a9e424e5456369f40c75a29dbfead;hp=de2c08a4a07deeb568e4db45614a6c7dfda0a9a3;hpb=80e2def8ef2125fd4d7d1312ee3993ab613f0846;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index de2c08a4a0..7857554a5c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -597,7 +597,7 @@ function FRAMETESTER($URL) { } // function SELECTION_COUNT($array) { - $ret = "0"; + $ret = 0; if (is_array($array)) { foreach ($array as $key => $sel) { if (!empty($sel)) $ret++; @@ -860,6 +860,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") { } // END - if // Now does the final template exists? + $newContent = ""; if (FILE_READABLE($file)) { // The local file does exists so we load it. :) $tmpl_file = @implode("", @file($file)); @@ -887,6 +888,12 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") { $newContent = NO_TEMPLATE_SUPPLIED; } + // Is there some content? + if (empty($newContent)) { + // Compiling failed + $newContent = "Compiler error for template {$template}!"; + } // END - if + // Return compiled content return COMPILE_CODE($newContent); } @@ -989,7 +996,7 @@ function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) { } // END - if // Take all string elements - if (("".bigintval($matches[4][$key])."" != $matches[4][$key]) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) { + if ((is_string($matches[4][$key])) && (!isset($matchesFound[$key."_".$matches[4][$key]]))) { // Replace it in the code $newMatch = str_replace("[".$matches[4][$key]."]", "['".$matches[4][$key]."']", $match); $code = str_replace($match, $newMatch, $code); @@ -1021,41 +1028,34 @@ function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) { function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums = false) { $dummy = $array; - while ($primary_key < count($a_sort)) - { - foreach ($dummy[$a_sort[$primary_key]] as $key => $value) - { - foreach ($dummy[$a_sort[$primary_key]] as $key2 => $value2) - { + while ($primary_key < count($a_sort)) { + foreach ($dummy[$a_sort[$primary_key]] as $key => $value) { + foreach ($dummy[$a_sort[$primary_key]] as $key2 => $value2) { $match = false; - if (!$nums) - { + if (!$nums) { // Sort byte-by-byte (also numbers will be interpreted as chars! E.g.: "9" > "10") if (($key != $key2) && (strcmp(strtolower($dummy[$a_sort[$primary_key]][$key]), strtolower($dummy[$a_sort[$primary_key]][$key2])) == $order)) $match = true; - } - elseif ($key != $key2) - { + } elseif ($key != $key2) { // Sort numbers (E.g.: 9 < 10) if (($dummy[$a_sort[$primary_key]][$key] < $dummy[$a_sort[$primary_key]][$key2]) && ($order == -1)) $match = true; if (($dummy[$a_sort[$primary_key]][$key] > $dummy[$a_sort[$primary_key]][$key2]) && ($order == 1)) $match = true; } - if ($match) - { + + if ($match) { // We have found two different values, so let's sort whole array - foreach ($dummy as $sort_key => $sort_val) - { + foreach ($dummy as $sort_key => $sort_val) { $t = $dummy[$sort_key][$key]; $dummy[$sort_key][$key] = $dummy[$sort_key][$key2]; $dummy[$sort_key][$key2] = $t; unset($t); - } - } - } - } + } // END - foreach + } // END - if + } // END - foreach + } // END - foreach // Count one up $primary_key++; - } + } // END - while // Write back sorted array $array = $dummy; @@ -1083,7 +1083,7 @@ function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") case "day": // Day for ($idx = 1; $idx < 32; $idx++) { - $OUT .= " \n"; + $OUT .= "\n"; } } else { // Get current year and subtract 16 (for erotic content) - $OUT .= " \n"; + $OUT .= "\n"; $YEAR = date('Y', time()) - 16; for ($idx = 1930; $idx <= $YEAR; $idx++) { - $OUT .= "