diff --git a/Sample/Voucher_after_print.jpg b/Sample/Voucher_after_print.jpg
deleted file mode 100644
index 553b2ba8..00000000
Binary files a/Sample/Voucher_after_print.jpg and /dev/null differ
diff --git a/Sample/Voucher_before_Printed.png b/Sample/Voucher_before_Printed.png
deleted file mode 100644
index 8d4a9985..00000000
Binary files a/Sample/Voucher_before_Printed.png and /dev/null differ
diff --git a/Sample/dont_upload_to_server b/Sample/dont_upload_to_server
deleted file mode 100644
index e69de29b..00000000
diff --git a/system/controllers/pool.php b/system/controllers/pool.php
index 925f2ef5..c633dc75 100644
--- a/system/controllers/pool.php
+++ b/system/controllers/pool.php
@@ -70,6 +70,17 @@ switch ($action) {
}
break;
+ case 'sync':
+ $pools = ORM::for_table('tbl_pool')->find_many();
+ $log = '';
+ foreach($pools as $pool){
+ $mikrotik = Mikrotik::info($pool['routers']);
+ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ Mikrotik::addPool($client, $pool['pool_name'], $pool['range_ip']);
+ $log .= 'DONE: '.$pool['pool_name'].': '.$pool['range_ip'].'
';
+ }
+ r2(U . 'pool/list', 's', $log);
+ break;
case 'add-post':
$name = _post('name');
$ip_address = _post('ip_address');
diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php
index 2f4e170a..6dd0709f 100644
--- a/system/controllers/prepaid.php
+++ b/system/controllers/prepaid.php
@@ -40,6 +40,28 @@ EOT;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
+ case 'sync':
+ set_time_limit(-1);
+ $plans = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many();
+ echo count($plans);
+ $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'];
+ }
+ $p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
+ $c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
+ if ($plan['type'] == 'Hotspot') {
+ Mikrotik::addHotspotUser($client, $p, $c);
+ } else if ($plan['type'] == 'PPPOE') {
+ Mikrotik::addPpoeUser($client, $p, $c);
+ }
+ $log .= "DONE : $plan[username], $plan[namebp], $plan[type], $plan[routers]
";
+ }
+ r2(U . 'prepaid/list', 's', $log);
case 'list':
$ui->assign('xfooter', '');
$ui->assign('_title', $_L['Customers']);
@@ -65,7 +87,7 @@ switch ($action) {
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
$ui->assign('r', $r);
- if(isset($routes['2']) && !empty($routes['2'])){
+ if (isset($routes['2']) && !empty($routes['2'])) {
$ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
}
run_hook('view_recharge'); #HOOK
diff --git a/system/controllers/services.php b/system/controllers/services.php
index 85f1c426..cce9e4d8 100644
--- a/system/controllers/services.php
+++ b/system/controllers/services.php
@@ -21,6 +21,68 @@ use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) {
+ case 'sync':
+ set_time_limit(-1);
+ if ($routes['2'] == 'hotspot') {
+ $plans = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where('tbl_plans.enabled', '1')->find_many();
+ $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
";
+ if (!empty($plan['pool_expired'])) {
+ Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired']);
+ $log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]
";
+ }
+ }
+ r2(U . 'services/hotspot', 's', $log);
+ }else if ($routes['2'] == 'pppoe') {
+ $plans = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many();
+ $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::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);
+ }
+ r2(U . 'services/hotspot', 'w', 'Unknown command');
case 'hotspot':
$ui->assign('xfooter', '');
@@ -135,8 +197,8 @@ switch ($action) {
$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);
+ if (!empty($pool_expired)) {
+ Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
}
}
@@ -220,8 +282,8 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
- if(!empty($pool_expired)){
- Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired);
+ if (!empty($pool_expired)) {
+ Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
}
}
@@ -358,8 +420,8 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
- if(!empty($pool_expired)){
- Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
+ if (!empty($pool_expired)) {
+ Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
}
}
@@ -429,8 +491,8 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
- if(!empty($pool_expired)){
- Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
+ if (!empty($pool_expired)) {
+ Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
}
}
diff --git a/ui/ui/hotspot.tpl b/ui/ui/hotspot.tpl
index a7d3acf8..fdd7ab3b 100644
--- a/ui/ui/hotspot.tpl
+++ b/ui/ui/hotspot.tpl
@@ -1,70 +1,81 @@
{include file="sections/header.tpl"}
-
-
-
-
{$_L['Hotspot_Plans']}
-
-
-
-
-
-
- {$_L['Plan_Name']} |
- {$_L['Plan_Type']} |
- {$_L['Bandwidth_Plans']} |
- {$_L['Plan_Price']} |
- {$_L['Time_Limit']} |
- {$_L['Data_Limit']} |
- {$_L['Plan_Validity']} |
- {$_L['Routers']} |
- {Lang::T('Expired IP Pool')} |
- {$_L['Manage']} |
-
-
-
- {foreach $d as $ds}
-
- {$ds['name_plan']} |
- {$ds['typebp']} |
- {$ds['name_bw']} |
- {Lang::moneyFormat($ds['price'])} |
- {$ds['time_limit']} {$ds['time_unit']} |
- {$ds['data_limit']} {$ds['data_unit']} |
- {$ds['validity']} {$ds['validity_unit']} |
- {$ds['routers']} |
- {$ds['pool_expired']} |
-
- {$_L['Edit']}
- {$_L['Delete']}
- |
-
- {/foreach}
-
-
-
- {$paginator['contents']}
+
+
+
+
+
{$_L['Hotspot_Plans']}
+
+
+
+
+
+
+
+ {$_L['Plan_Name']} |
+ {$_L['Plan_Type']} |
+ {$_L['Bandwidth_Plans']} |
+ {$_L['Plan_Price']} |
+ {$_L['Time_Limit']} |
+ {$_L['Data_Limit']} |
+ {$_L['Plan_Validity']} |
+ {$_L['Routers']} |
+ {Lang::T('Expired IP Pool')} |
+ {$_L['Manage']} |
+
+
+
+ {foreach $d as $ds}
+
+ {$ds['name_plan']} |
+ {$ds['typebp']} |
+ {$ds['name_bw']} |
+ {Lang::moneyFormat($ds['price'])} |
+ {$ds['time_limit']} {$ds['time_unit']} |
+ {$ds['data_limit']} {$ds['data_unit']} |
+ {$ds['validity']} {$ds['validity_unit']} |
+ {$ds['routers']} |
+ {$ds['pool_expired']} |
+
+ {$_L['Edit']}
+ {$_L['Delete']}
+ |
+
+ {/foreach}
+
+
+
+ {$paginator['contents']}
-
-
-
-
+
+
+
+
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/pool.tpl b/ui/ui/pool.tpl
index d49a78f1..a5e40ecd 100644
--- a/ui/ui/pool.tpl
+++ b/ui/ui/pool.tpl
@@ -3,7 +3,14 @@
-
{$_L['Pool']}
+
@@ -45,9 +52,9 @@
{$ds['range_ip']} |
{$ds['routers']} |
- {$_L['Edit']}
- {$_L['Edit']}
+ {$_L['Delete']}
|
diff --git a/ui/ui/pppoe.tpl b/ui/ui/pppoe.tpl
index e9d2ccb8..e6e34d79 100644
--- a/ui/ui/pppoe.tpl
+++ b/ui/ui/pppoe.tpl
@@ -1,65 +1,76 @@
{include file="sections/header.tpl"}
-
-
-
-
{$_L['PPPOE_Plans']}
-
-
-
-
-
-
- {$_L['Plan_Name']} |
- {$_L['Bandwidth_Plans']} |
- {$_L['Plan_Price']} |
- {$_L['Plan_Validity']} |
- {$_L['Pool']} |
- {Lang::T('Expired IP Pool')} |
- {$_L['Routers']} |
- {$_L['Manage']} |
-
-
-
- {foreach $d as $ds}
-
- {$ds['name_plan']} |
- {$ds['name_bw']} |
- {Lang::moneyFormat($ds['price'])} |
- {$ds['validity']} {$ds['validity_unit']} |
- {$ds['pool']} |
- {$ds['pool_expired']} |
- {$ds['routers']} |
-
- {$_L['Edit']}
- {$_L['Delete']}
- |
-
- {/foreach}
-
-
-
- {$paginator['contents']}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {$_L['Plan_Name']} |
+ {$_L['Bandwidth_Plans']} |
+ {$_L['Plan_Price']} |
+ {$_L['Plan_Validity']} |
+ {$_L['Pool']} |
+ {Lang::T('Expired IP Pool')} |
+ {$_L['Routers']} |
+ {$_L['Manage']} |
+
+
+
+ {foreach $d as $ds}
+
+ {$ds['name_plan']} |
+ {$ds['name_bw']} |
+ {Lang::moneyFormat($ds['price'])} |
+ {$ds['validity']} {$ds['validity_unit']} |
+ {$ds['pool']} |
+ {$ds['pool_expired']} |
+ {$ds['routers']} |
+
+ {$_L['Edit']}
+ {$_L['Delete']}
+ |
+
+ {/foreach}
+
+
+
+ {$paginator['contents']}
+
+
+
+
-{include file="sections/footer.tpl"}
+{include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/prepaid.tpl b/ui/ui/prepaid.tpl
index 878af3dd..bd7c0298 100644
--- a/ui/ui/prepaid.tpl
+++ b/ui/ui/prepaid.tpl
@@ -3,7 +3,13 @@
-
{$_L['Prepaid_User']}
+
+
{$_L['Prepaid_User']}
+
@@ -41,7 +47,7 @@
{foreach $d as $ds}
-
+
{$ds['username']} |
{$ds['namebp']} |
{$ds['type']} |
@@ -53,7 +59,7 @@
{$_L['Edit']}
{$_L['Delete']}
diff --git a/ui/ui/routers-add.tpl b/ui/ui/routers-add.tpl
index d5e2ffca..35329d36 100644
--- a/ui/ui/routers-add.tpl
+++ b/ui/ui/routers-add.tpl
@@ -42,7 +42,8 @@