// 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
// @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
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'));