mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 18:49:17 -07:00
dns edit domain page
This commit is contained in:
parent
361f0ec7f3
commit
276df0515f
6 changed files with 213 additions and 4 deletions
|
@ -40,9 +40,9 @@ json_list_domain() {
|
|||
echo -e "\t\"$value\": {"
|
||||
else
|
||||
if [ "$fileds_count" -eq "$i" ]; then
|
||||
echo -e "\t\t\"${field//$/}\": \"$value\","
|
||||
else
|
||||
echo -e "\t\t\"${field//$/}\": \"$value\""
|
||||
else
|
||||
echo -e "\t\t\"${field//$/}\": \"$value\","
|
||||
fi
|
||||
fi
|
||||
# Updating iterator
|
||||
|
|
145
web/edit/dns/index.php
Normal file
145
web/edit/dns/index.php
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
// Init
|
||||
//error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'DNS';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['domain'])) {
|
||||
header("Location: /list/dns/");
|
||||
}
|
||||
|
||||
if (!empty($_POST['cancel'])) {
|
||||
header("Location: /list/dns/");
|
||||
}
|
||||
|
||||
// Check domain
|
||||
$v_domain = escapeshellarg($_GET['domain']);
|
||||
exec (VESTA_CMD."v_list_dns_domain ".$user." ".$v_domain." json", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
$v_username = $user;
|
||||
$v_domain = $_GET['domain'];
|
||||
$v_ip = $data[$v_domain]['IP'];
|
||||
$v_template = $data[$v_domain]['TPL'];
|
||||
$v_ttl = $data[$v_domain]['TTL'];
|
||||
$v_exp = $data[$v_domain]['EXP'];
|
||||
$v_soa = $data[$v_domain]['SOA'];
|
||||
$v_date = $data[$v_domain]['DATE'];
|
||||
$v_time = $data[$v_domain]['TIME'];
|
||||
|
||||
exec (VESTA_CMD."v_list_dns_templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
|
||||
// IP
|
||||
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
exec (VESTA_CMD."v_change_dns_domain_ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$restart_dns = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Template
|
||||
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
exec (VESTA_CMD."v_change_dns_domain_tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// SOA
|
||||
if (($v_soa != $_POST['v_soa']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_soa = escapeshellarg($_POST['v_soa']);
|
||||
exec (VESTA_CMD."v_change_dns_domain_soa ".$v_username." ".$v_domain." ".$v_soa." 'no'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// EXP
|
||||
if (($v_exp != $_POST['v_exp']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_exp = escapeshellarg($_POST['v_exp']);
|
||||
exec (VESTA_CMD."v_change_dns_domain_exp ".$v_username." ".$v_domain." ".$v_exp." 'no'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// TTL
|
||||
if (($v_ttl != $_POST['v_ttl']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
||||
exec (VESTA_CMD."v_change_dns_domain_ttl ".$v_username." ".$v_domain." ".$v_ttl." 'no'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// Restart dns
|
||||
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v_restart_dns", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = "OK: changes has been saved.";
|
||||
}
|
||||
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_dns.html');
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
49
web/templates/admin/edit_dns.html
Normal file
49
web/templates/admin/edit_dns.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<table class='data'>
|
||||
<tr class="data-add">
|
||||
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
|
||||
<table class="data-col1">
|
||||
<tr><td style="padding: 20px 0 4px 4px;"><a class="data-date" ?><?php echo date("d M Y", strtotime($v_date))?></a></td></tr>
|
||||
<tr><td style="padding: 0 0 6px 4px;"><a class="data-date" ?><?php echo $v_time?></a></td></tr>
|
||||
<tr><td style="padding: 0 0 0 24px;" class="data-<?php echo $v_status ?>"><b><?php echo $v_status ?></b></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="data-dotted" width="830px" style="vertical-align:top;">
|
||||
<table width="830px"><tr>
|
||||
<td></td>
|
||||
</tr></table>
|
||||
<form method="post" name="v_edit_user">
|
||||
<table class="data-col2" width="830px">
|
||||
<tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?> disabled> <input type="hidden" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?>></td></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_ip" <?php if (!empty($v_ip)) echo "value=".$v_ip; ?>></td></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
|
||||
<tr><td><select class="add-list" name="v_template">
|
||||
<?php
|
||||
foreach ($templates as $key => $value) {
|
||||
echo "\t\t\t\t<option value=\"".$key."\"";
|
||||
$skey = "'".$key."'";
|
||||
if ((!empty($v_template)) && ( $key == $v_template ) || ($skey == $v_template)){
|
||||
echo ' selected' ;
|
||||
}
|
||||
echo ">".$key."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select></td></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Domain Expiriation</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_exp" <?php if (!empty($v_exp)) echo "value=".$v_exp; ?>></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">SOA</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_soa" <?php if (!empty($v_soa)) echo "value=".$v_soa; ?>></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">TTL</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_ttl" <?php if (!empty($v_ttl)) echo "value=".$v_ttl; ?>></tr>
|
||||
|
||||
<tr><td style="padding: 24px 0 0 0;">
|
||||
<input type="submit" class="add-button" name="save" value="Save"></form>
|
||||
<input type="button" class="add-button" value="Cancel" onClick="location.href='/list/dns/'">
|
||||
<input type="button" class="add-button" value="Edit Records" onClick="location.href='/list/dns/'">
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -35,7 +35,7 @@
|
|||
<form method="post" name="v_edit_user">
|
||||
<table class="data-col2" width="830px">
|
||||
<tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?> disabled> <input type="hidden" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?>></tr>
|
||||
<tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?> disabled> <input type="hidden" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain; ?>></td></tr>
|
||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
|
||||
<tr><td><select class="add-list" name="v_ip">
|
||||
<?php
|
||||
|
|
|
@ -26,7 +26,7 @@ foreach ($data as $key => $value) {
|
|||
<td></td>
|
||||
<td class="data-controls" width="96px"><img src="/images/more.png" width="8px" height="8px"><a href="?domain=<?php echo $key ?>"> list records</a></td>
|
||||
<td class="data-controls" width="92px"><img src="/images/add.png" width="8px" height="8px"><a href="?domain=<?php echo $key ?>"> add record</a></td>
|
||||
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="#"> edit</a></td>
|
||||
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="/edit/dns/?domain=<?php echo $key ?>"> edit</a></td>
|
||||
<td class="data-controls" width="80px"><img src="/images/suspend.png" width="7px" height="8px"><a href="#"> <?php echo $spnd_action ?></a></td>
|
||||
<td class="data-controls" width="70px"><img src="/images/delete.png" width="7px" height="7px"><a href="#"> delete</a></td>
|
||||
</tr></table>
|
||||
|
|
15
web/templates/admin/menu_edit_dns.html
Normal file
15
web/templates/admin/menu_edit_dns.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<table class="sub-menu">
|
||||
<tr>
|
||||
<td style="padding: 10px 2px 28px 0;" ><a class="add-name"><b>Editing Domain</b></a>
|
||||
<?php
|
||||
if (!empty($_SESSION['error_msg'])) {
|
||||
echo "<a class=\"add-error\"> → ".$_SESSION['error_msg']."</a>";
|
||||
} else {
|
||||
if (!empty($_SESSION['ok_msg'])) {
|
||||
echo "<a class=\"add-ok\"> → ".$_SESSION['ok_msg']."</a>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
Loading…
Add table
Add a link
Reference in a new issue