hotspot plan radius
This commit is contained in:
parent
9e33a5740b
commit
ce01771800
@ -65,6 +65,7 @@ CREATE TABLE `radgroupreply` (
|
||||
`attribute` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`op` char(2) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '=',
|
||||
`value` varchar(253) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''
|
||||
`plan_id` int(11) UNSIGNED NOT NULL,
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE `radpostauth` (
|
||||
|
@ -98,7 +98,7 @@ class Package
|
||||
|
||||
if ($p['type'] == 'Hotspot') {
|
||||
if ($b) {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -155,7 +155,7 @@ class Package
|
||||
$t->type = "Hotspot";
|
||||
$t->save();
|
||||
} else {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -202,7 +202,7 @@ class Package
|
||||
} else {
|
||||
|
||||
if ($b) {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -260,7 +260,7 @@ class Package
|
||||
$t->type = "PPPOE";
|
||||
$t->save();
|
||||
} else {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -342,7 +342,7 @@ class Package
|
||||
$mikrotik = Mikrotik::info($p['routers']);
|
||||
if ($p['type'] == 'Hotspot') {
|
||||
if ($b) {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -351,7 +351,7 @@ class Package
|
||||
Mikrotik::addHotspotUser($client, $p, $c);
|
||||
}
|
||||
} else {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -362,7 +362,7 @@ class Package
|
||||
}
|
||||
} else {
|
||||
if ($b) {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
@ -371,7 +371,7 @@ class Package
|
||||
Mikrotik::addPpoeUser($client, $p, $c);
|
||||
}
|
||||
} else {
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
|
@ -1,24 +1,42 @@
|
||||
<?php
|
||||
|
||||
class Radius {
|
||||
class Radius
|
||||
{
|
||||
|
||||
public static function getTableNas(){
|
||||
public static function getTableNas()
|
||||
{
|
||||
return ORM::for_table('nas', 'radius');
|
||||
}
|
||||
|
||||
public static function getTableCustomer(){
|
||||
public static function getTableCustomer()
|
||||
{
|
||||
return ORM::for_table('radcheck', 'radius');
|
||||
}
|
||||
|
||||
public static function getTablePackage(){
|
||||
public static function getTablePackage()
|
||||
{
|
||||
return ORM::for_table('radgroupreply', 'radius');
|
||||
}
|
||||
|
||||
public static function getTableUserPackage(){
|
||||
public static function getTableUserPackage()
|
||||
{
|
||||
return ORM::for_table('radusergroup', 'radius');
|
||||
}
|
||||
|
||||
public static function addNas($name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
public static function nasList($search = null){
|
||||
if($search == null){
|
||||
return ORM::for_table('nas', 'radius')->find_many();
|
||||
}else{
|
||||
return ORM::for_table('nas', 'radius')
|
||||
->where_like('nasname', $search)
|
||||
->where_like('shortname', $search)
|
||||
->where_like('description', $search)
|
||||
->find_many();
|
||||
}
|
||||
}
|
||||
|
||||
public static function nasAdd($name, $ip, $ports, $secret, $description = "", $type = 'other', $server = null, $community = null)
|
||||
{
|
||||
$n = Radius::getTableNas()->create();
|
||||
$n->nasname = $ip;
|
||||
$n->shortname = $name;
|
||||
@ -32,9 +50,10 @@ class Radius {
|
||||
return $n->id();
|
||||
}
|
||||
|
||||
public static function updateNas($id, $name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
public static function nasUpdate($id, $name, $ip, $ports, $secret, $description = "", $type = 'other', $server = null, $community = null)
|
||||
{
|
||||
$n = Radius::getTableNas()->find_one($id);
|
||||
if(empty($n)){
|
||||
if (empty($n)) {
|
||||
return false;
|
||||
}
|
||||
$n->nasname = $ip;
|
||||
@ -48,4 +67,64 @@ class Radius {
|
||||
return $n->save();
|
||||
}
|
||||
|
||||
public static function planAdd($plan_id, $plan_name, $rate, $pool = null)
|
||||
{
|
||||
$rates = explode('/', $rate);
|
||||
$r = Radius::getTablePackage()->create();
|
||||
$r->groupname = $plan_name;
|
||||
$r->attribute = 'Ascend-Data-Rate';
|
||||
$r->op = ':=';
|
||||
$r->value = $rates[1];
|
||||
$r->plan_id = $plan_id;
|
||||
if ($r->save()) {
|
||||
$r = Radius::getTablePackage()->create();
|
||||
$r->groupname = $plan_name;
|
||||
$r->attribute = 'Ascend-Xmit-Rate';
|
||||
$r->op = ':=';
|
||||
$r->value = $rates[0];
|
||||
$r->plan_id = $plan_id;
|
||||
if ($r->save()) {
|
||||
if ($pool != null) {
|
||||
$r = Radius::getTablePackage()->create();
|
||||
$r->groupname = $plan_name;
|
||||
$r->attribute = 'Framed-Pool';
|
||||
$r->op = ':=';
|
||||
$r->value = $pool;
|
||||
$r->plan_id = $plan_id;
|
||||
if ($r->save()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function planUpdate($plan_id, $plan_name, $rate, $pool = null)
|
||||
{
|
||||
$rates = explode('/', $rate);
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Data-Rate')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $rates[1];
|
||||
if ($r->save()) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Ascend-Xmit-Rate')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $rates[0];
|
||||
if ($r->save()) {
|
||||
if ($pool != null) {
|
||||
$r = Radius::getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', 'Framed-Pool')->findOne();
|
||||
$r->groupname = $plan_name;
|
||||
$r->value = $pool;
|
||||
if ($r->save()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $npass);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
@ -57,7 +57,7 @@ switch ($action) {
|
||||
|
||||
r2(U . 'login');
|
||||
} else {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if(!empty($d['pppoe_password'])){
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||
|
@ -165,13 +165,13 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $d['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $d['username']);
|
||||
}
|
||||
} else {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client, $d['username']);
|
||||
Mikrotik::removePpoeActive($client, $d['username']);
|
||||
@ -284,7 +284,7 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $password);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
@ -293,7 +293,7 @@ switch ($action) {
|
||||
$d->password = $password;
|
||||
$d->save();
|
||||
} else {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (!empty($d['pppoe_password'])) {
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||
|
@ -60,7 +60,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_pool')->find_one($id);
|
||||
$mikrotik = Mikrotik::info($d['routers']);
|
||||
if ($d) {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePool($client, $d['pool_name']);
|
||||
}
|
||||
@ -100,7 +100,7 @@ switch ($action) {
|
||||
}
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
if ($msg == '') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPool($client, $name, $ip_address);
|
||||
}
|
||||
@ -137,7 +137,7 @@ switch ($action) {
|
||||
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
if ($msg == '') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setPool($client, $d['pool_name'], $ip_address);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ switch ($action) {
|
||||
if ($d) {
|
||||
run_hook('delete_customer_active_plan'); #HOOK
|
||||
if ($d['type'] == 'Hotspot') {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $d['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $d['username']);
|
||||
@ -175,7 +175,7 @@ switch ($action) {
|
||||
|
||||
$d->delete();
|
||||
} else {
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client, $d['username']);
|
||||
Mikrotik::removePpoeActive($client, $d['username']);
|
||||
|
@ -55,9 +55,9 @@ switch ($action) {
|
||||
$msg .= 'NAS IP Exists<br>';
|
||||
}
|
||||
if ($msg == '') {
|
||||
$id = Radius::addNas($shortname, $nasname, $ports, $secret, $description, $type, $server, $community);
|
||||
$id = Radius::nasAdd($shortname, $nasname, $ports, $secret, $description, $type, $server, $community);
|
||||
if ($id > 0) {
|
||||
r2(U . 'radius/nas-edit/' . $id, 's', "NAS Added");
|
||||
r2(U . 'radius/nas-list/', 's', "NAS Added");
|
||||
} else {
|
||||
r2(U . 'radius/nas-add/', 'e', "NAS Added Failed");
|
||||
}
|
||||
@ -110,17 +110,8 @@ switch ($action) {
|
||||
$type = null;
|
||||
}
|
||||
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();
|
||||
if (Radius::updateNas($id, $shortname, $nasname, $ports, $secret, $description, $type, $server, $community)) {
|
||||
r2(U . 'radius/nas-edit/' . $id, 's', "NAS Saved");
|
||||
if (Radius::nasUpdate($id, $shortname, $nasname, $ports, $secret, $description, $type, $server, $community)) {
|
||||
r2(U . 'radius/list/', 's', "NAS Saved");
|
||||
} else {
|
||||
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
|
||||
}
|
||||
@ -141,13 +132,9 @@ switch ($action) {
|
||||
$ui->assign('_title', "Network Access Server");
|
||||
$name = _post('name');
|
||||
if (empty($name)) {
|
||||
$nas = ORM::for_table('nas', 'radius')->find_many();
|
||||
$nas = Radius::nasList();
|
||||
} else {
|
||||
$nas = ORM::for_table('nas', 'radius')
|
||||
->where_like('nasname', $name)
|
||||
->where_like('shortname', $name)
|
||||
->where_like('description', $name)
|
||||
->find_many();
|
||||
$nas = Radius::nasList($name);
|
||||
}
|
||||
$ui->assign('name', $name);
|
||||
$ui->assign('nas', $nas);
|
||||
|
@ -89,9 +89,7 @@ switch ($action) {
|
||||
$msg .= $_L['Router_already_exist'] . '<br>';
|
||||
}
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
}
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
|
||||
if ($msg == '') {
|
||||
run_hook('add_router'); #HOOK
|
||||
@ -149,9 +147,7 @@ switch ($action) {
|
||||
}
|
||||
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
}
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
|
||||
|
||||
if ($msg == '') {
|
||||
|
@ -28,27 +28,31 @@ switch ($action) {
|
||||
$log = '';
|
||||
$router = '';
|
||||
foreach ($plans as $plan) {
|
||||
if ($router != $plan['routers']) {
|
||||
$mikrotik = Mikrotik::info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$router = $plan['routers'];
|
||||
}
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||
Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
|
||||
$log .= "DONE : $plan[name_plan], $plan[shared_users], $rate<br>";
|
||||
if (!empty($plan['pool_expired'])) {
|
||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired']);
|
||||
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
||||
if($plan['is_radius']){
|
||||
|
||||
}else{
|
||||
if ($router != $plan['routers']) {
|
||||
$mikrotik = Mikrotik::info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$router = $plan['routers'];
|
||||
}
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||
Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
|
||||
$log .= "DONE : $plan[name_plan], $plan[shared_users], $rate<br>";
|
||||
if (!empty($plan['pool_expired'])) {
|
||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired']);
|
||||
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
r2(U . 'services/hotspot', 's', $log);
|
||||
@ -132,7 +136,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_plan'); #HOOK
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$mikrotik = Mikrotik::info($d['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
|
||||
@ -146,6 +150,7 @@ switch ($action) {
|
||||
|
||||
case 'add-post':
|
||||
$name = _post('name');
|
||||
$radius = _post('radius');
|
||||
$typebp = _post('typebp');
|
||||
$limit_type = _post('limit_type');
|
||||
$time_limit = _post('time_limit');
|
||||
@ -168,10 +173,14 @@ switch ($action) {
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
|
||||
if(empty($radius)){
|
||||
if ($routers == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
}
|
||||
$d = ORM::for_table('tbl_plans')->where('name_plan', $name)->where('type', 'Hotspot')->find_one();
|
||||
if ($d) {
|
||||
$msg .= $_L['Plan_already_exist'] . '<br>';
|
||||
@ -183,25 +192,20 @@ switch ($action) {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
|
||||
if (!empty($pool_expired)) {
|
||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
|
||||
}
|
||||
}
|
||||
|
||||
$radiusRate = $b['rate_up'].$radup.'/'.$b['rate_down'].$raddown;
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
$d->name_plan = $name;
|
||||
@ -217,10 +221,29 @@ switch ($action) {
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
if(!empty($radius)){
|
||||
$d->is_radius = 1;
|
||||
$d->routers = '';
|
||||
}else{
|
||||
$d->is_radius = 0;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
}
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
$plan_id = $d->id();
|
||||
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planAdd($plan_id, $name, $radiusRate);
|
||||
}else{
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
|
||||
if (!empty($pool_expired)) {
|
||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
r2(U . 'services/hotspot', 's', $_L['Created_Successfully']);
|
||||
} else {
|
||||
@ -243,7 +266,6 @@ switch ($action) {
|
||||
$sharedusers = _post('sharedusers');
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool_expired = _post('pool_expired');
|
||||
$enabled = _post('enabled');
|
||||
|
||||
@ -254,10 +276,9 @@ switch ($action) {
|
||||
if (Validator::UnsignedNumber($price) == false) {
|
||||
$msg .= 'The price must be a number' . '<br>';
|
||||
}
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
|
||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
|
||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->where('id', $id)->find_one();
|
||||
if ($d) {
|
||||
} else {
|
||||
@ -268,17 +289,24 @@ switch ($action) {
|
||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||
if ($b['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
$raddown = '000';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
$raddown = '000000';
|
||||
}
|
||||
if ($b['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
$radup = '000';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
$radup = '000000';
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
$radiusRate = $b['rate_up'].$radup.'/'.$b['rate_down'].$raddown;
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
if ($config['radius_enable']) {
|
||||
Radius::planUpdate($id, $name, $radiusRate);
|
||||
}else{
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
|
||||
@ -299,7 +327,6 @@ switch ($action) {
|
||||
$d->validity = $validity;
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
@ -364,7 +391,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($d) {
|
||||
run_hook('delete_ppoe'); #HOOK
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$mikrotik = Mikrotik::info($d['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoePlan($client, $d['name_plan']);
|
||||
@ -416,7 +443,7 @@ switch ($action) {
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
|
||||
@ -487,7 +514,7 @@ switch ($action) {
|
||||
}
|
||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||
|
||||
if (!$config['radius_mode']) {
|
||||
if (!$config['radius_enable']) {
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
|
||||
|
@ -92,7 +92,7 @@ foreach ($d as $ds) {
|
||||
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||
if(!empty($p['pool_expired'])){
|
||||
Mikrotik::setHotspotUserPackage($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
|
||||
@ -139,7 +139,7 @@ foreach ($d as $ds) {
|
||||
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||
|
||||
if (!$_c['radius_mode']) {
|
||||
if (!$_c['radius_enable']) {
|
||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||
if(!empty($p['pool_expired'])){
|
||||
Mikrotik::setPpoeUserPlan($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
|
||||
|
@ -76,8 +76,8 @@
|
||||
<label class="col-md-2 control-label text-muted">Enable Radius</label>
|
||||
<div class="col-md-6">
|
||||
<select name="radius_enable" id="radius_enable" class="form-control text-muted" onchange="alert('still not worked yet :)\nbut you can see any feature on development')">
|
||||
<option value="no">No</option>
|
||||
<option value="yes" {if $_c['radius_enable']}selected="selected" {/if}>Yes</option>
|
||||
<option value="0">No</option>
|
||||
<option value="1" {if $_c['radius_enable']}selected="selected" {/if}>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="help-block col-md-4 text-red">Radius Not Yet Ready</p>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{if $_c['radius_enable'] == 'yes'}
|
||||
{if $_c['radius_enable']}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">Radius</label>
|
||||
<div class="col-md-10">
|
||||
@ -167,10 +167,19 @@
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek){
|
||||
if(cek.checked){
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
}else{
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
document.getElementById("Unlimited").checked = true;
|
||||
document.getElementById("Limited").checked = false;
|
||||
$('#Type').hide();
|
||||
$('#TimeLimit').hide();
|
||||
$('#DataLimit').hide();
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
}
|
||||
}
|
||||
|
@ -1,142 +1,194 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<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">{$_L['Edit_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-post">
|
||||
<input type="hidden" name="id" value="{$d['id']}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0"> Disable
|
||||
</label>
|
||||
</div>
|
||||
<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">{$_L['Edit_Plan']}</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-post">
|
||||
<input type="hidden" name="id" value="{$d['id']}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-10">
|
||||
<label class="radio-inline warning">
|
||||
<input type="radio" {if $d['enabled'] == 1}checked{/if} name="enabled" value="1"> Enable
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" {if $d['enabled'] == 0}checked{/if} name="enabled" value="0">
|
||||
Disable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{if $_c['radius_enable'] and $d['is_radius']}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">Radius</label>
|
||||
<div class="col-md-10">
|
||||
<label class="label label-primary">RADIUS</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name" name="name" maxlength="40" value="{$d['name_plan']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
||||
<div class="col-md-10">
|
||||
<input type="radio" id="Unlimited" name="typebp" value="Unlimited" {if $d['typebp'] eq 'Unlimited'} checked {/if}> {$_L['Unlimited']}
|
||||
<input type="radio" id="Limited" name="typebp" value="Limited" {if $d['typebp'] eq 'Limited'} checked {/if}> {$_L['Limited']}
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
||||
<div class="col-md-10">
|
||||
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit" {if $d['limit_type'] eq 'Time_Limit'} checked {/if}> {$_L['Time_Limit']}
|
||||
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit" {if $d['limit_type'] eq 'Data_Limit'} checked {/if}> {$_L['Data_Limit']}
|
||||
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit" {if $d['limit_type'] eq 'Both_Limit'} checked {/if}> {$_L['Both_Limit']}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {elseif ($d['time_limit']) eq '0'} style="display:none;" {/if} id="TimeLimit">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Time_Limit']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="time_limit" name="time_limit" value="{$d['time_limit']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="time_unit" name="time_unit" >
|
||||
<option value="Hrs" {if $d['time_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}</option>
|
||||
<option value="Mins" {if $d['time_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {elseif ($d['data_limit']) eq '0'} style="display:none;" {/if} id="DataLimit">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Data_Limit']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="data_limit" name="data_limit" value="{$d['data_limit']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="data_unit" name="data_unit">
|
||||
<option value="MB" {if $d['data_unit'] eq 'MB'} selected {/if}>MBs</option>
|
||||
<option value="GB" {if $d['data_unit'] eq 'GB'} selected {/if}>GBs</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
{foreach $b as $bs}
|
||||
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>{$bs['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Shared_Users']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="sharedusers" name="sharedusers" value="{$d['shared_users']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity" value="{$d['validity']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}</option>
|
||||
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}</option>
|
||||
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}</option>
|
||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="name" name="name" maxlength="40"
|
||||
value="{$d['name_plan']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Type']}</label>
|
||||
<div class="col-md-10">
|
||||
<input type="radio" id="Unlimited" name="typebp" value="Unlimited"
|
||||
{if $d['typebp'] eq 'Unlimited'} checked {/if}> {$_L['Unlimited']}
|
||||
<input type="radio" id="Limited" {if $_c['radius_enable'] and $d['is_radius']}disabled{/if} name="typebp" value="Limited"
|
||||
{if $d['typebp'] eq 'Limited'} checked {/if}> {$_L['Limited']}
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Limit_Type']}</label>
|
||||
<div class="col-md-10">
|
||||
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit"
|
||||
{if $d['limit_type'] eq 'Time_Limit'} checked {/if}> {$_L['Time_Limit']}
|
||||
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit"
|
||||
{if $d['limit_type'] eq 'Data_Limit'} checked {/if}> {$_L['Data_Limit']}
|
||||
<input type="radio" id="Both_Limit" name="limit_type" value="Both_Limit"
|
||||
{if $d['limit_type'] eq 'Both_Limit'} checked {/if}> {$_L['Both_Limit']}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
|
||||
{elseif ($d['time_limit']) eq '0'}
|
||||
style="display:none;" {/if} id="TimeLimit">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Time_Limit']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="time_limit" name="time_limit"
|
||||
value="{$d['time_limit']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="time_unit" name="time_unit">
|
||||
<option value="Hrs" {if $d['time_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}
|
||||
</option>
|
||||
<option value="Mins" {if $d['time_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
|
||||
{elseif ($d['data_limit']) eq '0'}
|
||||
style="display:none;" {/if} id="DataLimit">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Data_Limit']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="data_limit" name="data_limit"
|
||||
value="{$d['data_limit']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="data_unit" name="data_unit">
|
||||
<option value="MB" {if $d['data_unit'] eq 'MB'} selected {/if}>MBs</option>
|
||||
<option value="GB" {if $d['data_unit'] eq 'GB'} selected {/if}>GBs</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}bandwidth/add">{$_L['BW_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="id_bw" name="id_bw" class="form-control select2">
|
||||
{foreach $b as $bs}
|
||||
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>
|
||||
{$bs['name_bw']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Price']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$_c['currency_code']}</span>
|
||||
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Shared_Users']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="sharedusers" name="sharedusers"
|
||||
value="{$d['shared_users']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Plan_Validity']}</label>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="validity" name="validity"
|
||||
value="{$d['validity']}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" id="validity_unit" name="validity_unit">
|
||||
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{$_L['Mins']}
|
||||
</option>
|
||||
<option value="Hrs" {if $d['validity_unit'] eq 'Hrs'} selected {/if}>{$_L['Hrs']}
|
||||
</option>
|
||||
<option value="Days" {if $d['validity_unit'] eq 'Days'} selected {/if}>{$_L['Days']}
|
||||
</option>
|
||||
<option value="Months" {if $d['validity_unit'] eq 'Months'} selected {/if}>
|
||||
{$_L['Months']}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<span id="routerChoose" class="{if $d['is_radius']}hidden{/if}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="routers" name="routers"
|
||||
value="{$d['routers']}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a
|
||||
href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
|
||||
<div class="col-md-6">
|
||||
<select id="pool_expired" name="pool_expired" class="form-control select2">
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $p as $ps}
|
||||
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']}
|
||||
selected {/if}>{$ps['pool_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button class="btn btn-success waves-effect waves-light"
|
||||
type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
{literal}
|
||||
<script>
|
||||
function isRadius(cek) {
|
||||
if (cek.checked) {
|
||||
$("#routerChoose").addClass('hidden');
|
||||
document.getElementById("routers").required = false;
|
||||
document.getElementById("Limited").disabled = true;
|
||||
} else {
|
||||
document.getElementById("Limited").disabled = false;
|
||||
document.getElementById("routers").required = true;
|
||||
$("#routerChoose").removeClass('hidden');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
{include file="sections/footer.tpl"}
|
@ -58,7 +58,7 @@
|
||||
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
|
||||
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
||||
<td>
|
||||
{if $ds['is_radius']==1}
|
||||
{if $ds['is_radius']}
|
||||
<span class="label label-primary">RADIUS</span>
|
||||
{else}
|
||||
{if $ds['routers']!=''}
|
||||
|
Loading…
x
Reference in New Issue
Block a user