diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php
index 8c885e18..eec181f3 100644
--- a/system/controllers/prepaid.php
+++ b/system/controllers/prepaid.php
@@ -190,9 +190,6 @@ switch ($action) {
$t->routers = $server;
$t->type = "Hotspot";
$t->save();
- sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
} else {
try {
$iport = explode(":", $mikrotik['ip_address']);
@@ -285,10 +282,10 @@ switch ($action) {
$t->routers = $server;
$t->type = "Hotspot";
$t->save();
- sendTelegram( $c['username']." Activate Voucher Hotspot\n".$p['name_plan'].
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
}
+ sendTelegram( "$admin[fullname] Recharge Voucher Hotspot for $c[username]\n".$p['name_plan'].
+ "\nRouter: ".$server.
+ "\nPrice: ".$p['price']);
} else {
if ($b) {
@@ -345,9 +342,6 @@ switch ($action) {
$t->routers = $server;
$t->type = "PPPOE";
$t->save();
- sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
} else {
try {
$iport = explode(":", $mikrotik['ip_address']);
@@ -391,14 +385,34 @@ switch ($action) {
$t->routers = $server;
$t->type = "PPPOE";
$t->save();
- sendTelegram( $c['username']." Activate Voucher PPPOE\n".$p['name_plan'].
- "\nRouter: ".$v1['routers'].
- "\nPrice: ".$p['price']);
}
+ sendTelegram( "$admin[fullname] Recharge Voucher PPPOE for $c[username]\n".$p['name_plan'].
+ "\nRouter: ".$server.
+ "\nPrice: ".$p['price']);
}
+
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
+ sendSMS($c['username'], "*$_c[CompanyName]*\n".
+ "$_c[address]\n".
+ "$_c[phone]\n".
+ "\n\n".
+ "INVOICE: *$in[invoice]*\n".
+ "$_L[Date] : $date_now\n".
+ "$_L[Sales] : $admin[fullname]\n".
+ "\n\n".
+ "$_L[Type] : *$in[type]*\n".
+ "$_L[Plan_Name] : *$in[plan_name]*\n".
+ "$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
+ "$_L[Username] : *$in[username]*\n".
+ "$_L[Password] : **********\n\n".
+ "$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
+ "$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
+ "\n\n".
+ "$_c[note]");
+
+
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {
@@ -894,6 +908,10 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
+
+ sendTelegram( "$admin[fullname] Refill Voucher Hotspot for $c[username]\n".$p['name_plan'].
+ "\nRouter: ".$v1['routers'].
+ "\nPrice: ".$p['price']);
} else {
if ($b) {
try {
@@ -997,10 +1015,34 @@ switch ($action) {
$v1->status = "1";
$v1->user = $c['username'];
$v1->save();
+
+
+ sendTelegram( "$admin[fullname] Refill Voucher PPPOE for $c[username]\n".$p['name_plan'].
+ "\nRouter: ".$v1['routers'].
+ "\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
$ui->assign('in', $in);
+
+ sendSMS($c['username'], "*$_c[CompanyName]*\n".
+ "$_c[address]\n".
+ "$_c[phone]\n".
+ "\n\n".
+ "INVOICE: *$in[invoice]*\n".
+ "$_L[Date] : $date_now\n".
+ "$_L[Sales] : $admin[fullname]\n".
+ "\n\n".
+ "$_L[Type] : *$in[type]*\n".
+ "$_L[Plan_Name] : *$in[plan_name]*\n".
+ "$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
+ "$_L[Username] : *$in[username]*\n".
+ "$_L[Password] : **********\n\n".
+ "$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
+ "$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
+ "\n\n".
+ "$_c[note]");
+
$ui->assign('date', $date_now);
$ui->display('invoice.tpl');
} else {
diff --git a/system/controllers/routers.php b/system/controllers/routers.php
index 04fbc970..bdc82e15 100644
--- a/system/controllers/routers.php
+++ b/system/controllers/routers.php
@@ -15,6 +15,10 @@ $action = $routes['1'];
$admin = Admin::_info();
$ui->assign('_admin', $admin);
+use PEAR2\Net\RouterOS;
+
+require_once 'system/autoload/PEAR2/Autoload.php';
+
if($admin['user_type'] != 'Admin'){
r2(U."dashboard",'e',$_L['Do_Not_Access']);
}
@@ -22,7 +26,7 @@ if($admin['user_type'] != 'Admin'){
switch ($action) {
case 'list':
$ui->assign('xfooter', '');
-
+
$name = _post('name');
if ($name != ''){
$paginator = Paginator::bootstrap('tbl_routers','name','%'.$name.'%');
@@ -31,7 +35,7 @@ switch ($action) {
$paginator = Paginator::bootstrap('tbl_routers');
$d = ORM::for_table('tbl_routers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
}
-
+
$ui->assign('d',$d);
$ui->assign('paginator',$paginator);
$ui->display('routers.tpl');
@@ -70,7 +74,7 @@ switch ($action) {
$username = _post('username');
$password = _post('password');
$description = _post('description');
-
+
$msg = '';
if(Validator::Length($name,30,4) == false){
$msg .= 'Name should be between 5 to 30 characters'. '
';
@@ -78,12 +82,19 @@ switch ($action) {
if ($ip_address == '' OR $username == ''){
$msg .= $_L['All_field_is_required']. '
';
}
-
+
$d = ORM::for_table('tbl_routers')->where('ip_address',$ip_address)->find_one();
if($d){
$msg .= $_L['Router_already_exist']. '
';
}
+ try {
+ $iport = explode(":", $ip_address);
+ $client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
+ } catch (Exception $e) {
+ $msg .= "Unable to connect to the router.
".$e->getMessage().'
';
+ }
+
if($msg == ''){
$d = ORM::for_table('tbl_routers')->create();
$d->name = $name;
@@ -130,6 +141,15 @@ switch ($action) {
}
}
+
+ try {
+ $iport = explode(":", $ip_address);
+ $client = new RouterOS\Client($iport[0], $username, $password, ($iport[1]) ? $iport[1] : null);
+ } catch (Exception $e) {
+ $msg .= "Unable to connect to the router.
".$e->getMessage().'
';
+ }
+
+
if($msg == ''){
$d->name = $name;
$d->ip_address = $ip_address;
diff --git a/ui/theme/default/app-settings.tpl b/ui/theme/default/app-settings.tpl
index f4e93aff..08782a10 100644
--- a/ui/theme/default/app-settings.tpl
+++ b/ui/theme/default/app-settings.tpl
@@ -50,7 +50,7 @@
-