Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip committed Jul 5, 2024
1 parent 6d5a902 commit d1b8bee
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions htdocs/timesheet/core/lib/includeMain.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@
if (! $res && file_exists($currentTimesheetPath."/dev.inc.php")) {
include $currentTimesheetPath.'/dev.inc.php';
}
$maxDepth = 6;
for ($i = 3; $i <= $maxDepth && !$res; $i++) {
$dirPath = $currentTimesheetPath . str_repeat("/..", $i) . "/";
$filePath = $dirPath . "main.inc.php";
if (! $res && file_exists($filePath)) {
$res = @include $filePath;
//$_SERVER["CONTEXT_DOCUMENT_ROOT"] = realpath($dirPath);

$root = dirname($_SERVER["DOCUMENT_ROOT"]);
$filePath = $root . "/html/main.inc.php";
if (! $res && file_exists($filePath)) {
$res = @include $filePath;
} else {
$maxDepth = 6;
for ($i = 3; $i <= $maxDepth && !$res; $i++) {
$dirPath = $currentTimesheetPath . str_repeat("/..", $i) . "/";
$filePath = $dirPath . "main.inc.php";
if (! $res && file_exists($filePath)) {
$res = @include $filePath;
break;
//$_SERVER["CONTEXT_DOCUMENT_ROOT"] = realpath($dirPath);
}
}
}
if (! $res) die("Include of main fails") ;
Expand Down

0 comments on commit d1b8bee

Please sign in to comment.