X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=3377256d43afc0d8fc52306dd88656375b61d103;hp=77065f95dc90447e82733d57730b0d116ef105ad;hb=adb34cea9c14bcac14030f8eb1e6ae2c3231c962;hpb=21d51da48eb23fb310827217c6899b2f592afa79 diff --git a/inc/functions.php b/inc/functions.php index 77065f95dc..3377256d43 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -3309,7 +3309,7 @@ function generateExtensionInactiveNotInstalledMessage ($ext_name) { // Reads a directory recursively by default and searches for files not matching // an exclusion pattern. You can now keep the exclusion pattern empty for reading // a whole directory. -function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true) { +function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true, $suffix = '') { // Add default entries we should exclude $excludeArray[] = '.'; $excludeArray[] = '..'; @@ -3361,6 +3361,10 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Skip this file //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix); continue; + } elseif ((!empty($suffix)) && (substr($baseFile, -(strlen($suffix . $extension)), (strlen($suffix . $extension))) != $suffix . $extension)) { + // Skip wrong suffix as well + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid suffix in file " . $baseFile . ", suffix=" . $suffix); + continue; } elseif (!isFileReadable($FQFN)) { // Not readable so skip it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!"); @@ -3403,7 +3407,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad closedir($dirPointer); // Sort array - asort($files); + sort($files); // Return array with include files //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!');