X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=bed3c34916a04f6bd33c80a21738e181de978602;hp=b3c3c1359075475571a31c68efae5c3145b8cdb1;hb=5071030af40e69ca4284642f44758964e18f5be8;hpb=3dc2d90bb1fb18124d214dd0aa06f0d3489393e6 diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index b3c3c13590..bed3c34916 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -278,7 +278,28 @@ function isInstalling () { // Check wether this script is installed function isInstalled () { - return ((getConfig('MXCHANGE_INSTALLED') == 'Y') || (isIncludeReadable('inc/cache/config-local.php'))); + return ( + ( + // New config file found and loaded + getConfig('MXCHANGE_INSTALLED') == 'Y' + ) || ( + // Fall-back! + isIncludeReadable('inc/config.php') + ) || ( + ( + // New config file found, but not yet read + isIncludeReadable('inc/cache/config-local.php') + ) && ( + ( + // Only new config file is found + !isIncludeReadable('inc/config.php') + ) || ( + // Is installation mode + isInstalling() + ) + ) + ) + ); } // Check wether an admin is registered @@ -358,7 +379,7 @@ function sendHeader ($header) { // @TODO Do some more sanity check here function changeMode ($FQFN, $mode) { // Is the file/directory there? - if ((!isFile($FQFN)) && (!isDirectory($FQFN))) { + if ((!isFileReadable($FQFN)) && (!isDirectory($FQFN))) { // Neither, so abort here debug_report_bug('Cannot chmod() on ' . basename($FQFN) . '.'); } // END - if @@ -367,6 +388,19 @@ function changeMode ($FQFN, $mode) { chmod($FQFN, $mode); } +// Wrapper for unlink() +function removeFile ($FQFN) { + // Is the file there? + if (isFileReadable($FQFN)) { + // Yes, so remove it + return unlink($FQFN); + } // END - if + + // All fine if no file was removed. If we change this to 'false' or rewrite + // above if() block it would be to restrictive. + return true; +} + // Wrapper for $_POST['sel'] function countPostSelection () { return countSelection(REQUEST_POST('sel'));