Skip to content

Commit

Permalink
actually create notice file for 'unconfigured/unmanaged domain' and r…
Browse files Browse the repository at this point in the history
…edirect it for potential dynamic contents (e.g. file extension php) to work properly

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Nov 26, 2023
1 parent 2e87633 commit 6a1e7cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/Froxlor/FileDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public static function safe_exec(string $exec_string, &$return_value = false, $a
* @param string $servername
*
* @return string
* @throws Exception
*/
public static function getUnknownDomainTemplate(string $servername = "")
{
Expand All @@ -276,15 +277,19 @@ public static function getUnknownDomainTemplate(string $servername = "")
'SERVERNAME' => $servername,
];
$tpl_content = PhpHelper::replaceVariables($template['value'], $replace_arr);
$tpl_ext = $template['file_extension'];
} else {
$tpl_ext = 'html';
$unconfiguredPath = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/templates/misc/unconfigured/index.html');
if (file_exists($unconfiguredPath)) {
$tpl_content = file_get_contents($unconfiguredPath);
} else {
$tpl_content = lng('admin.templates.unconfigured_content_fallback');
}
}
return $tpl_content;
$redirect_file = FileDir::makeCorrectFile(Froxlor::getInstallDir().'/notice.'.$tpl_ext);
file_put_contents($redirect_file, $tpl_content);
return basename($redirect_file);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
(!empty(Settings::Get('system.froxloraliases')) && !in_array($_SERVER['SERVER_NAME'], array_map('trim', explode(',', Settings::Get('system.froxloraliases')))))
)) {
// not the froxlor system-hostname, show info page for domains not configured in froxlor
$output = FileDir::getUnknownDomainTemplate($_SERVER['SERVER_NAME']);
echo $output;
$redirect_file = FileDir::getUnknownDomainTemplate($_SERVER['SERVER_NAME']);
header('Location: '.$redirect_file);
die();
}

Expand Down

0 comments on commit 6a1e7cc

Please sign in to comment.