diff --git a/.gitignore b/.gitignore index 862778a7..128783ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /system/config.php .DS_Store -.vscode/ \ No newline at end of file +.vscode/ +ui/compiled/*.tpl.php \ No newline at end of file diff --git a/index.php b/index.php index 635a7563..160aea56 100644 --- a/index.php +++ b/index.php @@ -7,8 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt * @donate PayPal: iesien22@yahoo.com / Bank Mandiri: 130.00.1024957.4 **/ -ini_set('display_errors', 1); -ini_set('display_startup_errors', 1); -error_reporting(E_ALL); +//ini_set('display_errors', 1); +//ini_set('display_startup_errors', 1); +//error_reporting(E_ALL); require ('system/boot.php'); App::_run(); diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index e2af5c79..6c78d211 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -105,13 +105,59 @@ switch ($action) { $client($removeRequest ->setArgument('numbers', $userName) ); + /* iBNuX Added: + * Time limit to Mikrotik + * 'Time_Limit', 'Data_Limit', 'Both_Limit' + */ $addRequest = new RouterOS\Request('/ip/hotspot/user/add'); - $client->sendSync($addRequest - ->setArgument('name', $c['username']) - ->setArgument('profile', $p['name_plan']) - ->setArgument('password', $c['password']) - ); - + if($p['typebp']=="Limited"){ + if($p['limit_type']=="Time_Limit"){ + if($p['time_unit']=='Hrs') + $timelimit = $p['time_limit'].":00:00"; + else + $timelimit = "00:".$p['time_limit'].":00"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-uptime', $timelimit) + ); + }else if($p['limit_type']=="Data_Limit"){ + if($p['data_unit']=='GB') + $datalimit = $p['data_limit']."000000000"; + else + $datalimit = $p['data_limit']."000000"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-bytes-total', $datalimit) + ); + }else if($p['limit_type']=="Both_Limit"){ + if($p['time_unit']=='Hrs') + $timelimit = $p['time_limit'].":00:00"; + else + $timelimit = "00:".$p['time_limit'].":00"; + if($p['data_unit']=='GB') + $datalimit = $p['data_limit']."000000000"; + else + $datalimit = $p['data_limit']."000000"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-uptime', $timelimit) + ->setArgument('limit-bytes-total', $datalimit) + ); + } + }else{ + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ); + } + $b->customer_id = $id_customer; $b->username = $c['username']; $b->plan_id = $plan; @@ -145,12 +191,59 @@ switch ($action) { } catch (Exception $e) { die('Unable to connect to the router.'); } + + /* iBNuX Added: + * Time limit to Mikrotik + * 'Time_Limit', 'Data_Limit', 'Both_Limit' + */ $addRequest = new RouterOS\Request('/ip/hotspot/user/add'); - $client->sendSync($addRequest - ->setArgument('name', $c['username']) - ->setArgument('profile', $p['name_plan']) - ->setArgument('password', $c['password']) - ); + if($p['typebp']=="Limited"){ + if($p['limit_type']=="Time_Limit"){ + if($p['time_unit']=='Hrs') + $timelimit = $p['time_limit'].":00:00"; + else + $timelimit = "00:".$p['time_limit'].":00"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-uptime', $timelimit) + ); + }else if($p['limit_type']=="Data_Limit"){ + if($p['data_unit']=='GB') + $datalimit = $p['data_limit']."000000000"; + else + $datalimit = $p['data_limit']."000000"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-bytes-total', $datalimit) + ); + }else if($p['limit_type']=="Both_Limit"){ + if($p['time_unit']=='Hrs') + $timelimit = $p['time_limit'].":00:00"; + else + $timelimit = "00:".$p['time_limit'].":00"; + if($p['data_unit']=='GB') + $datalimit = $p['data_limit']."000000000"; + else + $datalimit = $p['data_limit']."000000"; + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ->setArgument('limit-uptime', $timelimit) + ->setArgument('limit-bytes-total', $datalimit) + ); + } + }else{ + $client->sendSync($addRequest + ->setArgument('name', $c['username']) + ->setArgument('profile', $p['name_plan']) + ->setArgument('password', $c['password']) + ); + } $d = ORM::for_table('tbl_user_recharges')->create(); $d->customer_id = $id_customer; diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index 93d724ef..3f11f068 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -126,6 +126,7 @@ $_L['Select_Account'] = 'Select Account'; $_L['Service_Plan'] = 'Service Plan'; $_L['Recharge'] = 'Recharge'; $_L['Method'] = 'Method'; +$_L['account_created_successfully'] = 'Account Created Successfully'; $_L['Database_Status'] = 'Database Status'; $_L['Total_Database_Size'] = 'Total Database Size'; diff --git a/system/lan/indonesia/common.lan.php b/system/lan/indonesia/common.lan.php index 23d52e26..bba5eaa0 100644 --- a/system/lan/indonesia/common.lan.php +++ b/system/lan/indonesia/common.lan.php @@ -126,6 +126,7 @@ $_L['Select_Account'] = 'Pilih Akun'; $_L['Service_Plan'] = 'Paket'; $_L['Recharge'] = 'Isi Ulang Akun'; $_L['Method'] = 'Metode'; +$_L['account_created_successfully'] = 'Account Created Successfully'; $_L['Database_Status'] = 'Status Database'; $_L['Total_Database_Size'] = 'Ukuran Database'; diff --git a/ui/theme/default/app-settings.tpl b/ui/theme/default/app-settings.tpl index d1e0ecbe..ac5a9a90 100644 --- a/ui/theme/default/app-settings.tpl +++ b/ui/theme/default/app-settings.tpl @@ -27,12 +27,11 @@ -