actually create notice file for 'unconfigured/unmanaged domain' and redirect it for potential dynamic contents (e.g. file extension php) to work properly
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -263,6 +263,7 @@ class FileDir
|
|||||||
* @param string $servername
|
* @param string $servername
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getUnknownDomainTemplate(string $servername = "")
|
public static function getUnknownDomainTemplate(string $servername = "")
|
||||||
{
|
{
|
||||||
@@ -276,7 +277,9 @@ class FileDir
|
|||||||
'SERVERNAME' => $servername,
|
'SERVERNAME' => $servername,
|
||||||
];
|
];
|
||||||
$tpl_content = PhpHelper::replaceVariables($template['value'], $replace_arr);
|
$tpl_content = PhpHelper::replaceVariables($template['value'], $replace_arr);
|
||||||
|
$tpl_ext = $template['file_extension'];
|
||||||
} else {
|
} else {
|
||||||
|
$tpl_ext = 'html';
|
||||||
$unconfiguredPath = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/templates/misc/unconfigured/index.html');
|
$unconfiguredPath = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/templates/misc/unconfigured/index.html');
|
||||||
if (file_exists($unconfiguredPath)) {
|
if (file_exists($unconfiguredPath)) {
|
||||||
$tpl_content = file_get_contents($unconfiguredPath);
|
$tpl_content = file_get_contents($unconfiguredPath);
|
||||||
@@ -284,7 +287,9 @@ class FileDir
|
|||||||
$tpl_content = lng('admin.templates.unconfigured_content_fallback');
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,8 +121,8 @@ if ($_SERVER['SERVER_NAME'] != Settings::Get('system.hostname') &&
|
|||||||
(!empty(Settings::Get('system.froxloraliases')) && !in_array($_SERVER['SERVER_NAME'], array_map('trim', explode(',', Settings::Get('system.froxloraliases')))))
|
(!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
|
// not the froxlor system-hostname, show info page for domains not configured in froxlor
|
||||||
$output = FileDir::getUnknownDomainTemplate($_SERVER['SERVER_NAME']);
|
$redirect_file = FileDir::getUnknownDomainTemplate($_SERVER['SERVER_NAME']);
|
||||||
echo $output;
|
header('Location: '.$redirect_file);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user