Added default domain

This commit is contained in:
Alexey Berezhok
2025-10-18 23:42:21 +03:00
parent cc59572a59
commit 46fb25bcc0
6 changed files with 954 additions and 791 deletions

View File

@@ -130,6 +130,16 @@ if (!in_array($v_redirect, ["www." . $v_domain, $v_domain])) {
$v_redirect_custom = $v_redirect;
}
//Is default domain
$v_is_default = false;
exec(HESTIA_CMD . "v-default-domain " . $user . " " . quoteshellarg($v_domain). " check", $output, $return_var);
if ($return_var == 0) {
if (strpos(implode("", $output), 'true') !== false) {
$v_is_default = true;
}
}
unset($output);
$v_ftp_user = $data[$v_domain]["FTP_USER"];
$v_ftp_path = $data[$v_domain]["FTP_PATH"];
if (!empty($v_ftp_user)) {
@@ -1593,6 +1603,40 @@ if (!empty($_POST["save"])) {
unset($v_custom_doc_root);
}
if (!empty($_POST["v-default-domain"])) {
if ($v_is_default == false) {
exec(
HESTIA_CMD .
"v-default-domain " .
$user .
" " .
quoteshellarg($v_domain) .
" set",
$output,
$return_var,
);
check_return_code($return_var, $output);
unset($output);
$v_is_default = true;
}
} else {
if ($v_is_default == true) {
exec(
HESTIA_CMD .
"v-default-domain " .
$user .
" " .
quoteshellarg($v_domain) .
" delete",
$output,
$return_var,
);
check_return_code($return_var, $output);
unset($output);
$v_is_default = false;
}
}
if (!empty($v_redirect) && empty($_POST["v-redirect-checkbox"])) {
exec(
HESTIA_CMD . "v-delete-web-domain-redirect " . $user . " " . quoteshellarg($v_domain),

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -127,6 +127,12 @@ if ($passenger_state == "enabled") {
</div>
</div>
</div>
<div class="form-check u-mb10">
<input class="form-check-input" type="checkbox" name="v-default-domain" id="v-default-domain" <?php if ($v_is_default == true) echo 'checked'; ?>>
<label for="v-default-domain">
<?= _("Set this domain as default for server") ?>
</label>
</div>
<div class="form-check u-mb10">
<input x-model="redirectEnabled" class="form-check-input" type="checkbox" name="v-redirect-checkbox" id="v-redirect-checkbox">
<label for="v-redirect-checkbox">