diff --git a/include/utils/CommonUtils.php b/include/utils/CommonUtils.php
index 741ab3a2bf..c559f171fd 100644
--- a/include/utils/CommonUtils.php
+++ b/include/utils/CommonUtils.php
@@ -3306,11 +3306,11 @@ function checkFileAccessForInclusion($filepath) {
echo '
';
debug_print_backtrace();
echo '
';
+ echo 'We are looking for this file path: '.htmlspecialchars($filepath, ENT_QUOTES, $default_charset).'
';
+ echo 'We are looking here:
Real file path: '.htmlspecialchars($realfilepath, ENT_QUOTES, $default_charset).'
';
+ echo 'Root dir path: '.htmlspecialchars($rootdirpath, ENT_QUOTES, $default_charset).'
';
}
- echo 'Sorry! Attempt to access restricted file.
';
- echo 'We are looking for this file path: '.htmlspecialchars($filepath, ENT_QUOTES, $default_charset).'
';
- echo 'We are looking here:
Real file path: '.htmlspecialchars($realfilepath, ENT_QUOTES, $default_charset).'
';
- echo 'Root dir path: '.htmlspecialchars($rootdirpath, ENT_QUOTES, $default_charset).'
';
+ echo 'Attempt to access restricted file.';
die();
}
}
@@ -3341,10 +3341,15 @@ function checkFileAccessForDeletion($filepath) {
if (stripos($realfilepath, $rootdirpath) !== 0 || !in_array($filePathParts[0], $safeDirectories)) {
global $default_charset;
- echo 'Sorry! Attempt to access restricted file.
';
- echo 'We are looking for this file path: '.htmlspecialchars($filepath, ENT_QUOTES, $default_charset).'
';
- echo 'We are looking here:
Real file path: '.htmlspecialchars($realfilepath, ENT_QUOTES, $default_charset).'
';
- echo 'Root dir path: '.htmlspecialchars($rootdirpath, ENT_QUOTES, $default_charset).'
';
+ if (GlobalVariable::getVariable('Debug_Access_Restricted_File', 0)) {
+ echo '';
+ debug_print_backtrace();
+ echo '
';
+ echo 'We are looking for this file path: '.htmlspecialchars($filepath, ENT_QUOTES, $default_charset).'
';
+ echo 'We are looking here:
Real file path: '.htmlspecialchars($realfilepath, ENT_QUOTES, $default_charset).'
';
+ echo 'Root dir path: '.htmlspecialchars($rootdirpath, ENT_QUOTES, $default_charset).'
';
+ }
+ echo 'Attempt to access restricted file.';
die();
}
}
@@ -3352,9 +3357,7 @@ function checkFileAccessForDeletion($filepath) {
/** Function to check the file access is made within web root directory. */
function checkFileAccess($filepath) {
if (!isInsideApplication($filepath)) {
- global $default_charset;
- echo 'Sorry! Attempt to access restricted file.
';
- echo 'We are looking for this file path: '.htmlspecialchars($filepath, ENT_QUOTES, $default_charset).'
';
+ echo 'Attempt to access restricted file.
';
die();
}
}