X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=1133a3b1cbd646cb346d202173a33292edb26f40;hp=fd8b2c5a9074c4fd388e3bb1999e6ed4f35ade1c;hb=2e68ea39a430a7217e58747b877acaa3e92ea997;hpb=81048fd007675d6201fbae06577d3a13f83d943e diff --git a/inc/functions.php b/inc/functions.php index fd8b2c5a90..1133a3b1cb 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -347,7 +347,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) { // Now does the final template exists? if (FILE_READABLE($file)) { // The local file does exists so we load it. :) - $tmpl_file = implode("", file($file)); + $tmpl_file = READ_FILE($file); // Replace ' to our own chars to preventing them being quoted while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); } @@ -881,7 +881,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { $newContent = ""; if (FILE_READABLE($file)) { // The local file does exists so we load it. :) - $tmpl_file = implode("", file($file)); + $tmpl_file = READ_FILE($file); $tmpl_file = addslashes($tmpl_file); // Run code @@ -2990,6 +2990,28 @@ function incrementConfigEntry ($configEntry, $value=1) { } } +// Read a given file +function READ_FILE ($FQFN, $sqlPrepare = false) { + // Load the file + if (function_exists('file_get_contents')) { + // Use new function + $content = file_get_contents($FQFN); + } else { + // Fall-back to implode-file chain + $content = implode("", file($FQFN)); + } + + // Prepare SQL queries? + if ($sqlPreppare === true) { + // Remove some unwanted chars + $content = str_replace("\r", "", $content); + $content = str_replace("\n\n", "\n", $content); + } // END - if + + // Return the content + return $content; +} + ////////////////////////////////////////////////// // // // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //