X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=7d3046be596c4891d1aa95c5900c0904d5925379;hb=9e1f6d2cff0bbef912d605d4ae1728f0382b83a4;hp=d10e1f844d0a7b2f33fa5b379f7453d90486bc03;hpb=5f5a73c72457ea761906640dc3d29749301102f9;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index d10e1f844d..7d3046be59 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 on directory + return is_writeable(dirname($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 .= "