Skip to content

Commit e2c443a

Browse files
authored
Add select field to pick the wanted template (hestiacp#1506)
1 parent 5389bba commit e2c443a

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

web/add/dns/index.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@
5454
check_return_code($return_var,$output);
5555
unset($output);
5656
}
57-
57+
58+
// Change domain template
59+
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
60+
$v_template = escapeshellarg($_POST['v_template']);
61+
exec (HESTIA_CMD."v-change-dns-domain-tpl ".$user." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
62+
check_return_code($return_var,$output);
63+
unset($output);
64+
}
5865

5966
// Set expiriation date
6067
if (empty($_SESSION['error_msg'])) {
@@ -157,6 +164,16 @@
157164
$v_ip = (empty($v_ips[$ip]['NAT'])?$ip:$v_ips[$ip]['NAT']);
158165
}
159166

167+
// List dns templates
168+
exec (HESTIA_CMD."v-list-dns-templates json", $output, $return_var);
169+
$templates = json_decode(implode('', $output), true);
170+
unset($output);
171+
172+
exec (HESTIA_CMD."v-list-user ".$user." json", $output, $return_var);
173+
$user_config = json_decode(implode('', $output), true);
174+
unset($output);
175+
$v_template = $user_config[$user]['DNS_TEMPLATE'];
176+
160177
if (empty($_GET['domain'])) {
161178
// Display body for dns domain
162179

web/templates/admin/add_dns.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,27 @@
8888
<tr>
8989
<td class="vst-text">
9090
<table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
91+
<tr>
92+
<td class="vst-text input-label">
93+
<?php print _('Template') . "<span class='optional'>" . strtoupper($_SESSION['DNS_SYSTEM']) . "</span>";?>
94+
</td>
95+
</tr>
96+
<tr>
97+
<td>
98+
<select class="vst-list" name="v_template">
99+
<?php
100+
foreach ($templates as $key => $value) {
101+
echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
102+
$svalue = "'".$value."'";
103+
if ((!empty($v_template)) && ( $value == $v_template ) || ($svalue == $v_template)){
104+
echo ' selected' ;
105+
}
106+
echo ">".htmlentities($value)."</option>\n";
107+
}
108+
?>
109+
</select>
110+
</td>
111+
</tr>
91112
<tr>
92113
<td class="vst-text input-label">
93114
<?php print _('Expiration Date');?> <span class="optional">(<?=_('YYYY-MM-DD');?>)</span>

0 commit comments

Comments
 (0)