<?php

//////////////////////////////////////////////////////////////
//===========================================================
// rdns_theme.php
//===========================================================
// SOFTACULOUS VIRTUALIZOR
// Version : 1.0
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       8th Mar 2010
// Time:       23:00 hrs
// Site:       https://www.virtualizor.com/ (SOFTACULOUS VIRTUALIZOR)
// ----------------------------------------------------------
// Please Read the Terms of use at https://www.virtualizor.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('VIRTUALIZOR')){

	die('Hacking Attempt');

}

function rdns_theme(){

global $theme, $globals, $kernel, $user, $l, $cluster, $error, $servers, $done, $ips, $pdns, $pdnsid;

softheader($l['<title>']);

$GLOBALS['breadcrumbs'] = ['dashboard', 'lm_pdns', 'lms_rdns'];
										
echo page_header(__('Add DNS/Reverse DNS Zone'), 'fas fa-passport', $globals['docs'].'configure-reverse-dns/', 0, 0, '');

error_handle($error);

if(!empty($done)){
	show_alert(__('The reverse DNS zone has been successfully added'));
}

echo '
<div class="card p-2 mx-3">
<div id="form-container">
<form accept-charset="'.$globals['charset'].'" name="rdns" method="post" action="" class="form-horizontal">

<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Zone Name').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('The Zone Name.<br />For example, <br />IPv4 IP : 1.2.3.xxx, Zone Name : <b>3.2.1.in-addr.arpa</b><br />IPv6 IP : 2001:41d0:0008:53ff:0000:0000:xxxx:xxxx, Zone Name : <b>0.0.0.0.0.0.0.0.f.f.3.5.8.0.0.0.0.d.1.4.1.0.0.2.ip6.arpa</b><br /><br />
<b>Sub Delegated RDNS zone</b>:<br />If prefix of an IPv4 IP range is not /8, /16 or /24, then for that IP range, RDNS zone name can be in any one of following format:<br /><br />
1. FIRST-LAST.REST_OCTETS.in-addr.arpa<br />
2. FIRST/PREFIX.REST_OCTETS.in-addr.arpa<br /><br />
Where FIRST and LAST are first and last possible value of the last octet which satisfies the prefix, and REST_OCTETS is remaining octet in reverse order.<br />
Eg. If IP range is 192.168.15.16/28, then<br />
FIRST = 16<br />
LAST = 31<br />
REST_OCTETS = 15.168.192<br />
So rdns zone name in:
Format 1:  16-31.15.168.192.in-addr.arpa<br />
Format 2: 16/28.15.168.192.in-addr.arpa<br /><br />
For more information, refer to Virtualizor documentation on Reverse DNS.<br /><br />
<b>Note</b>: Consult with IP provider to confirm which one of above sub-delegation RDNS format they support.').'" id="zone_tooltip"><i class="fas text-primary fa-info-circle"></i></a></label><br>
	</div>
	<div class="col-sm-4">
	
		<input type="text" class="form-control" name="zone_name" value="'.POSTval('zone_name', '').'" size="30">
	</div>
</div>
<br>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Nameserver').' 1</label><br />
	</div>
	<div class="col-sm-4">
		<input type="text" class="form-control" name="ns1" value="'.POSTval('ns1', '').'" size="30">
	</div>
</div>
<br/>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Nameserver').' 2</label><br />
	</div>
	<div class="col-sm-4">
		<input type="text" class="form-control" name="ns2" value="'.POSTval('ns2', '').'" size="30">
	</div>
</div>
<br/>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Nameserver').' 3</label><br />
	</div>
	<div class="col-sm-4">
		<input type="text" class="form-control" name="ns3" value="'.POSTval('ns3', '').'" size="30">
	</div>
</div>
<br/>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Nameserver').' 4</label><br />
	</div>
	<div class="col-sm-4">
		<input type="text" class="form-control" name="ns4" value="'.POSTval('ns4', '').'" size="30">
	</div>
</div>
<br/>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Hostmaster Email').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Hostmaster Email').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
	</div>
	<div class="col-sm-4">
	
		<input type="text" class="form-control" name="hostmasteremail" value="'.POSTval('hostmasteremail', '').'" size="30">
	</div>
</div>
<br>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Custom TTL (optional)').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('This TTL value will be used for automatic records that are generated. If not set then 86400 will be used.').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
	</div>
	<div class="col-sm-4">
	
		<input type="text" class="form-control" name="custom_ttl" value="'.POSTval('custom_ttl', '').'" size="30">
	</div>
</div>
<br>
<div class="row mx-auto w-100">
	<div class="col-sm-4"><label class="control-label">'.__('Select server').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('The DNS server to add the record to').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
	</div>
	<div class="col-sm-4 server-select-lg">
	
		<select class="custom-control virt-select" name="pdnsid">';
	foreach($pdns as $k => $v){
		echo '<option value="'.$v['id'].'" '.ex_POSTselect('pdnsid', $pdnsid).' >'.$v['name'].'</option>';
	}
echo '</select>
	</div>
</div>

</div>

<div class="w-100 my-3 text-center"><input type="submit" value="'.__('Submit').'" class="go_btn" name="rdns"/></div>

</form>
</div>
</div>
';

softfooter();

}

?>