<?php

//////////////////////////////////////////////////////////////
//===========================================================
// editips_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 editips_theme(){
	

global $theme, $globals, $l, $cluster, $servers, $user, $error, $ippools, $ip, $ipid, $done;

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

if(!empty($done)){
	show_alert(__('The IP(s) have been saved. Return to <a href="index.php?act=ips">IP Overview</a>'));
}

echo page_header(__('Edit IP'), 'fas fa-users', '', 0, 0, '');

$breadcrumbs = array('dashboard', 'lm_ips', 'lms_editip');


echo get_breadcrumb($breadcrumbs);

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

		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-4">
				<label class="control-label">'.__('Enter IP').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('If the IP Address is assigned, it cannot be edited.').'"><i class="fas text-primary fa-info-circle"></i></a></label>
			</div>
			<div class="col-sm-4">
				<input type="text" class="form-control" name="ip"  size="30" '.(empty($ip['vpsid']) ? ' value="'.POSTval('ip' , $ip['ip']).'"' : 'value="'.$ip['ip'].'" disabled="disabled" ').'/>
			</div>
		</div>

		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-4">
				<label class="control-label">'.__('Enter MAC').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('If left blank, the MAC address is auto-generated.').'"><i class="fas text-primary fa-info-circle"></i></a></label>
			</div>
			<div class="col-sm-4">
				<input type="text" class="form-control" name="mac_addr" value="'.POSTval('mac_addr', $ip['mac_addr']).'" size="30" />
			</div>
		</div>

		<div class="row mx-auto w-100 my-3">
			<div class="col-4">
				<label class="control-label">'.__('Lock').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Lock this IP').'"><i class="fas text-primary fa-info-circle"></i></a></label>
			</div>
			<div class="col-4">
				'.get_checkbox('locked', '', '', array('chk_it' => 1, 'val' => $ip['locked'])).'
			</div>
		</div>

		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-4">
				<label class="control-label">'.__('Note').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('You can define the note here, for eg. Why IP is locked or reserved?').'"><i class="fas text-primary fa-info-circle"></i></a></label>
			</div>
			<div class="col-sm-4">
				<textarea class="form-control" name="note" rows="4">'.POSTval('note', $ip['note']).'</textarea>
			</div>
		</div>

		<br>

		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-4">
				<label class="control-label">'.__('IP Pool').'</label>
			</div>
			<div class="col-sm-4">
				'.(empty($ippools[$ip['ippid']]['ippool_name']) ? __('None') : $ippools[$ip['ippid']]['ippool_name']).'
			</div>
		</div>

		<div id="ip_serid" class="row mx-auto w-100 my-3">
			<div class="col-sm-4">
				<label class="control-label">'.__('Server').'</label>
			</div>
			<div class="col-sm-4">';
			if(!empty($ip['ip_serid'])){
				foreach($ip['ip_serid'] as $key => $value){
					echo ($value == -1 ? __('All Servers') : $servers[$value]['server_name']."<br>");
				}
			}
			echo '</div>
		</div>

		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-12">
			<span class="help-block"></span>
				<center><input type="submit" name="editip" class="go_btn mt-5" value="'.__('Submit').'"/></center>
			</div>
		</div>

	</form>
</div>';

softfooter();

}

