diff --git a/system/controllers/services.php b/system/controllers/services.php
index 11f00772..5ddfa440 100644
--- a/system/controllers/services.php
+++ b/system/controllers/services.php
@@ -1,4 +1,5 @@
";
} else {
if ($router != $plan['routers']) {
$mikrotik = Mikrotik::info($plan['routers']);
@@ -59,27 +73,43 @@ 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';
+ if ($plan['is_radius']) {
+ if ($b['rate_down_unit'] == 'Kbps') {
+ $raddown = '000';
+ } else {
+ $raddown = '000000';
+ }
+ if ($b['rate_up_unit'] == 'Kbps') {
+ $radup = '000';
+ } else {
+ $radup = '000000';
+ }
+ $radiusRate = $plan['rate_up'] . $radup . '/' . $plan['rate_down'] . $raddown;
+ Radius::planUpSert($plan['id'], $radiusRate, $plan['pool']);
+ $log .= "DONE : RADIUS $plan[name_plan], $plan[pool], $rate
";
} else {
- $unitdown = 'M';
- }
- if ($plan['rate_up_unit'] == 'Kbps') {
- $unitup = 'K';
- } else {
- $unitup = 'M';
- }
- $rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
- Mikrotik::addPpoePlan($client, $plan['name_plan'], $plan['pool'], $rate);
- $log .= "DONE : $plan[name_plan], $plan[pool], $rate
";
- if (!empty($plan['pool_expired'])) {
- Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired'], '512K/512K');
- $log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]
";
+ 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::addPpoePlan($client, $plan['name_plan'], $plan['pool'], $rate);
+ $log .= "DONE : $plan[name_plan], $plan[pool], $rate
";
+ if (!empty($plan['pool_expired'])) {
+ Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired'], '512K/512K');
+ $log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]
";
+ }
}
}
r2(U . 'services/pppoe', 's', $log);
@@ -136,7 +166,7 @@ switch ($action) {
run_hook('delete_plan'); #HOOK
if ($d['is_radius']) {
Radius::planDelete($d['id']);
- }else{
+ } else {
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
@@ -396,7 +426,7 @@ switch ($action) {
run_hook('delete_ppoe'); #HOOK
if ($d['is_radius']) {
Radius::planDelete($d['id']);
- }else{
+ } else {
$mikrotik = Mikrotik::info($d['routers']);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removePpoePlan($client, $d['name_plan']);