delete nas
This commit is contained in:
parent
d002ed2286
commit
3b87630986
@ -1,4 +1,3 @@
|
|||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
|
|
||||||
CREATE TABLE `nas` (
|
CREATE TABLE `nas` (
|
||||||
`id` int(10) NOT NULL,
|
`id` int(10) NOT NULL,
|
||||||
|
@ -19,13 +19,6 @@ if ($admin['user_type'] != 'Admin') {
|
|||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
||||||
case 'nas-list':
|
|
||||||
$ui->assign('_system_menu', 'network');
|
|
||||||
$ui->assign('_title', "Network Access Server");
|
|
||||||
$nas = ORM::for_table('nas', 'radius')->find_many();
|
|
||||||
$ui->assign('nas', $nas);
|
|
||||||
$ui->display('radius-nas.tpl');
|
|
||||||
break;
|
|
||||||
case 'nas-add':
|
case 'nas-add':
|
||||||
$ui->assign('_system_menu', 'network');
|
$ui->assign('_system_menu', 'network');
|
||||||
$ui->assign('_title', "Network Access Server");
|
$ui->assign('_title', "Network Access Server");
|
||||||
@ -82,6 +75,91 @@ switch ($action) {
|
|||||||
r2(U . 'radius/nas-add', 'e', $msg);
|
r2(U . 'radius/nas-add', 'e', $msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case 'nas-edit':
|
||||||
$ui->display('a404.tpl');
|
$ui->assign('_system_menu', 'network');
|
||||||
|
$ui->assign('_title', "Network Access Server");
|
||||||
|
|
||||||
|
$id = $routes['2'];
|
||||||
|
$d = ORM::for_table('nas', 'radius')->find_one($id);
|
||||||
|
if (!$d) {
|
||||||
|
$d = ORM::for_table('nas', 'radius')->where_equal('shortname', _get('name'))->find_one();
|
||||||
|
}
|
||||||
|
if ($d) {
|
||||||
|
$ui->assign('d', $d);
|
||||||
|
$ui->display('radius-nas-edit.tpl');
|
||||||
|
} else {
|
||||||
|
r2(U . 'radius/list', 'e', $_L['Account_Not_Found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'nas-edit-post':
|
||||||
|
$id = $routes['2'];
|
||||||
|
$shortname = _post('shortname');
|
||||||
|
$nasname = _post('nasname');
|
||||||
|
$secret = _post('secret');
|
||||||
|
$ports = _post('ports', null);
|
||||||
|
$type = _post('type', 'other');
|
||||||
|
$server = _post('server', null);
|
||||||
|
$community = _post('community', null);
|
||||||
|
$description = _post('description');
|
||||||
|
$msg = '';
|
||||||
|
|
||||||
|
if (Validator::Length($shortname, 30, 2) == false) {
|
||||||
|
$msg .= 'Name should be between 3 to 30 characters' . '<br>';
|
||||||
|
}
|
||||||
|
if (empty($ports)) {
|
||||||
|
$ports = null;
|
||||||
|
}
|
||||||
|
if (empty($server)) {
|
||||||
|
$server = null;
|
||||||
|
}
|
||||||
|
if (empty($community)) {
|
||||||
|
$community = null;
|
||||||
|
}
|
||||||
|
if (empty($type)) {
|
||||||
|
$type = null;
|
||||||
|
}
|
||||||
|
$d = ORM::for_table('nas', 'radius')->find_one($id);
|
||||||
|
if (!$d) {
|
||||||
|
$msg .= 'NAS NOT Exists<br>';
|
||||||
|
}
|
||||||
|
if ($msg == '') {
|
||||||
|
$d->nasname = $nasname;
|
||||||
|
$d->shortname = $shortname;
|
||||||
|
$d->secret = $secret;
|
||||||
|
$d->ports = $ports;
|
||||||
|
$d->type = $type;
|
||||||
|
$d->server = $server;
|
||||||
|
$d->community = $community;
|
||||||
|
$d->description = $description;
|
||||||
|
$d->save();
|
||||||
|
r2(U . 'radius/nas-edit/' . $id, 's', "NAS Saved");
|
||||||
|
} else {
|
||||||
|
r2(U . 'radius/nas-add', 'e', $msg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'nas-delete':
|
||||||
|
$id = $routes['2'];
|
||||||
|
$d = ORM::for_table('nas', 'radius')->find_one($id);
|
||||||
|
if ($d) {
|
||||||
|
$d->delete();
|
||||||
|
} else {
|
||||||
|
r2(U . 'radius/nas-list', 'e', 'NAS Not found');
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
$ui->assign('_system_menu', 'network');
|
||||||
|
$ui->assign('_title', "Network Access Server");
|
||||||
|
$name = _post('name');
|
||||||
|
if (empty($name)) {
|
||||||
|
$nas = ORM::for_table('nas', 'radius')->find_many();
|
||||||
|
} else {
|
||||||
|
$nas = ORM::for_table('nas', 'radius')
|
||||||
|
->where_like('nasname', $name)
|
||||||
|
->where_like('shortname', $name)
|
||||||
|
->where_like('description', $name)
|
||||||
|
->find_many();
|
||||||
|
}
|
||||||
|
$ui->assign('name', $name);
|
||||||
|
$ui->assign('nas', $nas);
|
||||||
|
$ui->display('radius-nas.tpl');
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||||
**/
|
**/
|
||||||
@ -45,6 +46,9 @@ switch ($action) {
|
|||||||
case 'edit':
|
case 'edit':
|
||||||
$id = $routes['2'];
|
$id = $routes['2'];
|
||||||
$d = ORM::for_table('tbl_routers')->find_one($id);
|
$d = ORM::for_table('tbl_routers')->find_one($id);
|
||||||
|
if (!$d) {
|
||||||
|
$d = ORM::for_table('tbl_routers')->where_equal('name', _get('name'))->find_one();
|
||||||
|
}
|
||||||
if ($d) {
|
if ($d) {
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
run_hook('view_router_edit'); #HOOK
|
run_hook('view_router_edit'); #HOOK
|
||||||
@ -76,7 +80,7 @@ switch ($action) {
|
|||||||
if (Validator::Length($name, 30, 4) == false) {
|
if (Validator::Length($name, 30, 4) == false) {
|
||||||
$msg .= 'Name should be between 5 to 30 characters' . '<br>';
|
$msg .= 'Name should be between 5 to 30 characters' . '<br>';
|
||||||
}
|
}
|
||||||
if ($ip_address == '' OR $username == ''){
|
if ($ip_address == '' or $username == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,14 +122,13 @@ switch ($action) {
|
|||||||
if (Validator::Length($name, 30, 4) == false) {
|
if (Validator::Length($name, 30, 4) == false) {
|
||||||
$msg .= 'Name should be between 5 to 30 characters' . '<br>';
|
$msg .= 'Name should be between 5 to 30 characters' . '<br>';
|
||||||
}
|
}
|
||||||
if ($ip_address == '' OR $username == ''){
|
if ($ip_address == '' or $username == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = _post('id');
|
$id = _post('id');
|
||||||
$d = ORM::for_table('tbl_routers')->find_one($id);
|
$d = ORM::for_table('tbl_routers')->find_one($id);
|
||||||
if ($d) {
|
if ($d) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$msg .= $_L['Data_Not_Found'] . '<br>';
|
$msg .= $_L['Data_Not_Found'] . '<br>';
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,12 @@
|
|||||||
"2023.9.27" : [
|
"2023.9.27" : [
|
||||||
"ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
"ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
||||||
"ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
|
"ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance','Radius') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
|
||||||
|
],
|
||||||
|
"2023.9.28" : [
|
||||||
|
"ALTER TABLE `tbl_plans` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
||||||
|
"ALTER TABLE `tbl_transactions` CHANGE `type` `type` ENUM('Hotspot','PPPOE','Balance') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
|
||||||
|
],
|
||||||
|
"2023.10.1" : [
|
||||||
|
"ALTER TABLE `tbl_plans` ADD `is_radius` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '1 is radius' AFTER `routers`; "
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -57,7 +57,15 @@
|
|||||||
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
|
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
|
||||||
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
|
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
|
||||||
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
||||||
<td>{$ds['routers']}</td>
|
<td>
|
||||||
|
{if $ds['is_radius']==1}
|
||||||
|
<span class="label label-primary">RADIUS</span>
|
||||||
|
{else}
|
||||||
|
{if $ds['routers']!=''}
|
||||||
|
<a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
<td>{$ds['pool_expired']}</td>
|
<td>{$ds['pool_expired']}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{$_url}services/edit/{$ds['id']}"
|
<a href="{$_url}services/edit/{$ds['id']}"
|
||||||
|
74
ui/ui/radius-nas-edit.tpl
Normal file
74
ui/ui/radius-nas-edit.tpl
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{include file="sections/header.tpl"}
|
||||||
|
<!-- routers-add -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 col-md-12">
|
||||||
|
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||||
|
<div class="panel-heading">Radius - Edit NAS</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
<form class="form-horizontal" method="post" role="form" action="{$_url}radius/nas-edit-post/{$d['id']}">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" required class="form-control" id="shortname" name="shortname" value="{$d['shortname']}" maxlength="32">
|
||||||
|
<p class="help-block">{Lang::T('Name of Area that router operated')}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" placeholder="192.168.88.1" value="{$d['nasname']}" required class="form-control" id="nasname"
|
||||||
|
name="nasname" maxlength="128">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">Secret</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="password" class="form-control" id="secret" name="secret" required value="{$d['secret']}"
|
||||||
|
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" maxlength="60">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">Ports</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" id="ports" name="ports" placeholder="null" value="{$d['ports']}">
|
||||||
|
</div>
|
||||||
|
<label class="col-md-2 control-label">Type</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" id="type" name="type" value="other" value="{$d['type']}" required
|
||||||
|
placeholder="other">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">Server</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" id="server" name="server" value="{$d['server']}" placeholder="null">
|
||||||
|
</div>
|
||||||
|
<label class="col-md-2 control-label">Community</label>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" class="form-control" id="community" name="community" value="{$d['community']}" placeholder="null">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{$_L['Description']}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<textarea class="form-control" id="description" name="description"> {htmlentities($d['description'])}</textarea>
|
||||||
|
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
|
<button class="btn btn-primary waves-effect waves-light"
|
||||||
|
type="submit">{$_L['Save']}</button>
|
||||||
|
Or <a href="{$_url}radius/nas-list">{$_L['Cancel']}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{include file="sections/footer.tpl"}
|
@ -14,7 +14,7 @@
|
|||||||
<div class="input-group-addon">
|
<div class="input-group-addon">
|
||||||
<span class="fa fa-search"></span>
|
<span class="fa fa-search"></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" name="name" class="form-control"
|
<input type="text" name="name" class="form-control" value="{$name}"
|
||||||
placeholder="{$_L['Search_by_Name']}...">
|
placeholder="{$_L['Search_by_Name']}...">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
|
<button class="btn btn-success" type="submit">{$_L['Search']}</button>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
<table class="table table-bordered table-striped table-condensed">
|
<table class="table table-bordered table-striped table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>ID</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>IP</th>
|
<th>IP</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
@ -42,10 +42,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{$no = 1}
|
|
||||||
{foreach $nas as $ds}
|
{foreach $nas as $ds}
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">{$no++}</td>
|
<td align="center">{$ds['id']}</td>
|
||||||
<td>{$ds['shortname']}</td>
|
<td>{$ds['shortname']}</td>
|
||||||
<td>{$ds['nasname']}</td>
|
<td>{$ds['nasname']}</td>
|
||||||
<td>{$ds['type']}</td>
|
<td>{$ds['type']}</td>
|
||||||
|
@ -163,10 +163,6 @@
|
|||||||
href="{$_url}services/hotspot">{$_L['Hotspot_Plans']}</a></li>
|
href="{$_url}services/hotspot">{$_L['Hotspot_Plans']}</a></li>
|
||||||
<li {if $_routes[1] eq 'pppoe'}class="active" {/if}><a
|
<li {if $_routes[1] eq 'pppoe'}class="active" {/if}><a
|
||||||
href="{$_url}services/pppoe">{$_L['PPPOE_Plans']}</a></li>
|
href="{$_url}services/pppoe">{$_L['PPPOE_Plans']}</a></li>
|
||||||
{if $_c['radius_enable'] == 'yes'}
|
|
||||||
<li {if $_routes[1] eq 'radius'}class="active" {/if}><a
|
|
||||||
href="{$_url}services/radius">{Lang::T('Radius Plans')}</a></li>
|
|
||||||
{/if}
|
|
||||||
<li {if $_routes[1] eq 'list'}class="active" {/if}><a
|
<li {if $_routes[1] eq 'list'}class="active" {/if}><a
|
||||||
href="{$_url}bandwidth/list">{$_L['Bandwidth_Plans']}</a></li>
|
href="{$_url}bandwidth/list">{$_L['Bandwidth_Plans']}</a></li>
|
||||||
<li {if $_routes[1] eq 'balance'}class="active" {/if}><a
|
<li {if $_routes[1] eq 'balance'}class="active" {/if}><a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user