suspend dns record page

This commit is contained in:
Serghey Rodin 2012-06-14 17:25:38 +03:00
commit b306202a80
19 changed files with 583 additions and 28 deletions

69
web/suspend/dns/index.php Normal file
View file

@ -0,0 +1,69 @@
<?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') {
// Cancel
if (!empty($_POST['back'])) {
header("Location: /list/dns/");
}
// DNS domain
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v_suspend_dns_domain ".$v_username." ".$v_domain, $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 {
$_SESSION['ok_msg'] = "OK: dns domain <b>".$_GET['domain']."</b> has been suspended.";
unset($v_lname);
}
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_dns.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_dns.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
}
// DNS record
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v_suspend_dns_domain_record ".$v_username." ".$v_domain." ".$v_record_id, $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 {
$_SESSION['ok_msg'] = "OK: dns record has been suspended.";
unset($v_lname);
}
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_dns_rec.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_dns_rec.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
}
}
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -5,12 +5,51 @@ foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
$spnd_action = 'ususpend' ;
$spnd_action = 'unsuspend' ;
} else {
$status = 'active';
$spnd_action = 'suspend' ;
}
?>
<script type="text/javascript">
$(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/<?php echo $spnd_action ?>/dns/?domain=<?php echo "$key" ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#<?php echo $spnd_action ?>_link_<?php echo "$i" ?>').click(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/delete/dns/?domain=<?php echo "$key" ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#delete_link_<?php echo "$i" ?>').click(function(){
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
});
</script>
<tr class="data-row">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
@ -27,7 +66,13 @@ foreach ($data as $key => $value) {
<td class="data-controls" width="96px"><img src="/images/more.png" width="8px" height="8px"><a href="/list/dns/?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="/add/dns/?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/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="80px">
<img src="/images/suspend.png" width="7px" height="8px">
<a href="#" id="<?php echo $spnd_action ?>_link_<?php echo "$i" ?>"> <?php echo $spnd_action ?></a>
<div id="<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>" title="Confirmation">
<p class="counter-value">Are you sure you want to <?php echo $spnd_action ?> <span style="color: #34536A;"><b><?php echo "$key" ?></b></span> domain?</p>
</div>
</td>
<td class="data-controls" width="70px"><img src="/images/delete.png" width="7px" height="7px"><a href="#"> delete</a></td>
</tr></table>

View file

@ -5,12 +5,51 @@ foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
$spnd_action = 'ususpend' ;
$spnd_action = 'unsuspend' ;
} else {
$status = 'active';
$spnd_action = 'suspend' ;
}
?>
<script type="text/javascript">
$(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/<?php echo $spnd_action ?>/dns/?domain=<?php echo $_GET['domain'] ?>&record_id=<?php echo $data[$key]['ID'] ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#<?php echo $spnd_action ?>_link_<?php echo "$i" ?>').click(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/delete/dns/?domain=<?php echo $_GET['domain'] ?>&record_id=<?php echo $data[$key]['ID'] ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#delete_link_<?php echo "$i" ?>').click(function(){
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
});
</script>
<tr class="data-row">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
@ -24,7 +63,14 @@ foreach ($data as $key => $value) {
<table width="830px"><tr>
<td></td>
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="/edit/dns/?domain=<?php echo $_GET['domain'] ?>&record_id=<?php echo $data[$key]['ID'] ?>"> edit</a></td>
<td class="data-controls" width="80px"><img src="/images/suspend.png" width="7px" height="8px"><a href="/<?php echo $spnd_action ?>/dns/?domain=<?php echo $_GET['domain'] ?>&record_id=<?php echo $data[$key]['ID'] ?>"> <?php echo $spnd_action ?></a></td>
<td class="data-controls" width="80px">
<img src="/images/suspend.png" width="7px" height="8px">
<a href="#" id="<?php echo $spnd_action ?>_link_<?php echo "$i" ?>"> <?php echo $spnd_action ?></a>
<div id="<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>" title="Confirmation">
<p class="counter-value">Are you sure you want to <?php echo $spnd_action ?> <span style="color: #34536A;"><b><?php echo $data[$key]['RECORD'] ?></b></span> record?</p>
</div>
</td>
<td class="data-controls" width="70px"><img src="/images/delete.png" width="7px" height="7px"><a href="/delete/dns/?domain=<?php echo $_GET['domain'] ?>&record_id=<?php echo $data[$key]['ID'] ?>"> delete</a></td>
</tr></table>

View file

@ -0,0 +1,15 @@
<table class="sub-menu">
<tr>
<td style="padding: 50px 2px 38px 153px;" >
<?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>

View file

@ -0,0 +1,15 @@
<table class="sub-menu">
<tr>
<td style="padding: 50px 2px 38px 153px;" >
<?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>

View file

@ -0,0 +1,15 @@
<table class="sub-menu">
<tr>
<td style="padding: 50px 2px 38px 153px;" >
<?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>

View file

@ -0,0 +1,15 @@
<table class="sub-menu">
<tr>
<td style="padding: 50px 2px 38px 153px;" >
<?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>

View file

@ -0,0 +1,30 @@
<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: 18 0 4 18;"></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
</tr></table>
<table class="data-col2" width="830px">
<tr>
<td style="padding: 24px 0 0 0;" width="100px">
<form method="get">
<input type="button" class="add-button" value="List domains" onClick="location.href='/list/dns/'">
</form>
</td>
<td style="padding: 24px 0 0 0;">
<form action="/unsuspend/dns/" method="get">
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
<input type="submit" class="add-button" name="unsuspend" value="Unsuspend <?php echo $_GET['domain']?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>

View file

@ -0,0 +1,31 @@
<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: 18 0 4 18;"></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
</tr></table>
<table class="data-col2" width="830px">
<tr>
<td style="padding: 24px 0 0 0;" width="100px">
<form method="get">
<input type="button" class="add-button" value="List records" onClick="location.href='/list/dns/?domain=<?php echo $_GET['domain']?>'">
</form>
</td>
<td style="padding: 24px 0 0 0;">
<form action="/unsuspend/dns/" method="get">
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
<input type="hidden" name="record_id" value="<?php echo $_GET['record_id']?>">
<input type="submit" class="add-button" name="unsuspend" value="Unsuspend record">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>

View file

@ -0,0 +1,30 @@
<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: 18 0 4 18;"></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
</tr></table>
<table class="data-col2" width="830px">
<tr>
<td style="padding: 24px 0 0 0;" width="100px">
<form method="get">
<input type="button" class="add-button" value="List domains" onClick="location.href='/list/dns/'">
</form>
</td>
<td style="padding: 24px 0 0 0;">
<form action="/suspend/dns/" method="get">
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
<input type="submit" class="add-button" name="suspend" value="Suspend <?php echo $_GET['domain']?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>

View file

@ -0,0 +1,31 @@
<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: 18 0 4 18;"></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
</tr></table>
<table class="data-col2" width="830px">
<tr>
<td style="padding: 24px 0 0 0;" width="100px">
<form method="get">
<input type="button" class="add-button" value="List records" onClick="location.href='/list/dns/?domain=<?php echo $_GET['domain']?>'">
</form>
</td>
<td style="padding: 24px 0 0 0;">
<form action="/suspend/dns/" method="get">
<input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
<input type="hidden" name="record_id" value="<?php echo $_GET['record_id']?>">
<input type="submit" class="add-button" name="suspend" value="Suspend record">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>

View file

@ -0,0 +1,67 @@
<?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') {
// Cancel
if (!empty($_POST['back'])) {
header("Location: /list/dns/");
}
// DNS domain
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v_unsuspend_dns_domain ".$v_username." ".$v_domain, $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 {
$_SESSION['ok_msg'] = "OK: dns domain <b>".$_GET['domain']."</b> has been unsuspended.";
}
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_dns.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_dns.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
}
// DNS record
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v_unsuspend_dns_domain_record ".$v_username." ".$v_domain." ".$v_record_id, $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 {
$_SESSION['ok_msg'] = "OK: dns record has been unsuspended.";
}
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_dns_rec.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_dns_rec.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
}
}
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');