X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=dcdfdc6ea03845940ec3fa110573bb0b6d0564b3;hp=da1848b706f021c733159beee1c36cf3c07fb330;hb=4001187f22197f55e5a1f211fc8defcc180f7c32;hpb=b7aada7890a3c7d1c1da4d2b36d8d7683fa61c06 diff --git a/inc/functions.php b/inc/functions.php index da1848b706..dcdfdc6ea0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -38,25 +38,17 @@ if (!defined('__SECURITY')) { } // Check if our config file is writeable or not -function IS_INC_WRITEABLE($inc) { +function IS_INC_WRITEABLE ($inc) { // Generate FQFN - $fqfn = sprintf("%sinc/%s.php", constant('PATH'), $inc); + $FQFN = sprintf("%sinc/%s.php", constant('PATH'), $inc); // Abort by simple test - if ((FILE_READABLE($fqfn)) && (!is_writeable($fqfn))) { + if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN))) { return false; } // END - if - // Test if we can append data - $fp = fopen($fqfn, 'a'); - if ($inc == "dummy") { - // Remove dummy file - fclose($fp); - return unlink($fqfn); - } else { - // Close all other files - return fclose($fp); - } + // Test write-access + return is_writeable($FQFN); } // Output HTML code directly or "render" it. You addionally switch the new-line character off @@ -375,7 +367,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { // Do we have some content to output or return? if (!empty($ret)) { // Not empty so let's put it out! ;) - if ($return) { + if ($return === true) { // Return the HTML code return $ret; } else { @@ -540,7 +532,7 @@ function GEN_PASS ($LEN = 0) { // Start creating password $PASS = ""; for ($i = 0; $i < $LEN; $i++) { - $PASS .= $ABC[mt_rand(0, sizeof($ABC) -1)]; + $PASS .= $ABC[mt_rand(0, count($ABC) -1)]; } // END - for // When the size is below 40 we can also add additional security by scrambling it @@ -954,7 +946,7 @@ function LOAD_URL ($URL, $addUrlData=true) { LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL)); LOAD_INC("inc/footer.php"); } - exit(); + exit; } // Wrapper for LOAD_URL but URL comes from a configuration entry @@ -1108,7 +1100,6 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums = // function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") { - global $MONTH_DESCR; $OUT = ""; if ($type == "yn") { @@ -1133,7 +1124,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") { break; case "month": // Month - foreach ($MONTH_DESCR as $month => $descr) { + foreach ($GLOBALS['month_descr'] as $month => $descr) { $OUT .= "