diff --git a/system/controllers/home.php b/system/controllers/home.php index e480b92a..265c8e89 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -96,6 +96,12 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) { $router = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one(); if ($config['enable_balance'] == 'yes') { $plan = ORM::for_table('tbl_plans')->find_one($bill['plan_id']); + if(!$plan['enabled']){ + r2(U . "home", 'e', 'Plan is not exists'); + } + if($plan['allow_purchase'] != 'yes'){ + r2(U . "home", 'e', 'Cannot recharge this plan'); + } if ($user['balance'] > $plan['price']) { r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan'); } else { diff --git a/system/controllers/order.php b/system/controllers/order.php index a14d15e0..31b53dd0 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -149,6 +149,12 @@ switch ($action) { if (empty($plan)) { r2(U . "order/package", 'e', Lang::T("Plan Not found")); } + if(!$plan['enabled']){ + r2(U . "home", 'e', 'Plan is not exists'); + } + if($plan['allow_purchase'] != 'yes'){ + r2(U . "home", 'e', 'Cannot recharge this plan'); + } if ($routes['2'] == 'radius') { $router_name = 'radius'; } else { @@ -166,7 +172,7 @@ switch ($action) { "\nPrice: " . $p['price']); } } else { - echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n"; + r2(U . "home", 'e', 'Plan is not exists'); } break; case 'send': @@ -179,6 +185,12 @@ switch ($action) { if (empty($plan)) { r2(U . "order/package", 'e', Lang::T("Plan Not found")); } + if(!$plan['enabled']){ + r2(U . "home", 'e', 'Plan is not exists'); + } + if($plan['allow_purchase'] != 'yes'){ + r2(U . "home", 'e', 'Cannot recharge this plan'); + } if ($routes['2'] == 'radius') { $router_name = 'radius'; } else { diff --git a/system/controllers/pool.php b/system/controllers/pool.php index de7b2932..2261d8eb 100644 --- a/system/controllers/pool.php +++ b/system/controllers/pool.php @@ -68,6 +68,8 @@ switch ($action) { Mikrotik::removePool($client, $d['pool_name']); } catch (Exception $e) { //ignore exception, it means router has already deleted + } catch(Throwable $e){ + //ignore exception, it means router has already deleted } } $d->delete(); diff --git a/system/controllers/services.php b/system/controllers/services.php index 093c1343..4909a9c3 100644 --- a/system/controllers/services.php +++ b/system/controllers/services.php @@ -173,6 +173,8 @@ switch ($action) { Mikrotik::removeHotspotPlan($client, $d['name_plan']); } catch (Exception $e) { //ignore exception, it means router has already deleted + } catch(Throwable $e){ + //ignore exception, it means router has already deleted } } @@ -441,6 +443,8 @@ switch ($action) { Mikrotik::removePpoePlan($client, $d['name_plan']); } catch (Exception $e) { //ignore exception, it means router has already deleted + } catch(Throwable $e){ + //ignore exception, it means router has already deleted } } $d->delete(); diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index 2dd0680e..d0d1e4ac 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -420,3 +420,9 @@ $_L['After_Customer_activate_voucher_or_login_customer_will_be_redirected_to_thi $_L['Voucher_Prefix'] = 'Voucher Prefix'; $_L['Voucher_activation_success_now_you_can_login'] = 'Voucher activation success, now you can login'; $_L['Client_Can_Purchase'] = 'Client Can Purchase'; +$_L['Buy_this_your_active_package_will_be_overwritten'] = 'Buy this? your active package will be overwritten'; +$_L['Pay_this_with_Balance_your_active_package_will_be_overwritten'] = 'Pay this with Balance? your active package will be overwritten'; +$_L['Buy_this_your_active_package_will_be_overwritten'] = 'Buy this? your active package will be overwritten'; +$_L['Pay_this_with_Balance_your_active_package_will_be_overwritten'] = 'Pay this with Balance? your active package will be overwritten'; +$_L['Buy_this_your_active_package_will_be_overwritten'] = 'Buy this? your active package will be overwritten'; +$_L['Pay_this_with_Balance_your_active_package_will_be_overwritten'] = 'Pay this with Balance? your active package will be overwritten'; diff --git a/ui/ui/hotspot.tpl b/ui/ui/hotspot.tpl index ffd33913..6203b307 100644 --- a/ui/ui/hotspot.tpl +++ b/ui/ui/hotspot.tpl @@ -49,7 +49,8 @@ {foreach $d as $ds} - + {$ds['name_plan']} {$ds['typebp']} {$ds['name_bw']} diff --git a/ui/ui/pppoe.tpl b/ui/ui/pppoe.tpl index 5fe10771..dd3c548a 100644 --- a/ui/ui/pppoe.tpl +++ b/ui/ui/pppoe.tpl @@ -47,7 +47,8 @@ {foreach $d as $ds} - + {$ds['name_plan']} {$ds['name_bw']} {Lang::moneyFormat($ds['price'])}