Compare commits

...

21 Commits

Author SHA1 Message Date
593ca31f18 pool_expired in SQL Instalation 2023-09-06 11:52:09 +07:00
7cc8d6f5e3 delete debug script 2023-09-06 11:25:13 +07:00
11a2fb8fc0 2023.9.6 2023-09-06 10:57:54 +07:00
537623130c Fix expired pool in pppoe 2023-09-06 10:55:28 +07:00
910be1946b Fix cron can move plan 2023-09-06 10:48:52 +07:00
e23abc1377 move user to expired profile when expired if set 2023-09-06 10:02:31 +07:00
b912dd05d0 Set expired plan 2023-09-05 17:06:43 +07:00
5c9a0d8ea6 Expired IP Pool Hotspot/PPPOE 2023-09-05 16:40:23 +07:00
b7eca582a6 Not using tbl_language anymore 2023-09-05 15:25:41 +07:00
b460e862e8 fix git ignore 2023-09-01 16:43:53 +07:00
a33705c0c4 Fix Text Cron 2023-09-01 14:03:02 +07:00
183a5ab242 Fix Reminder text 2023-09-01 13:56:14 +07:00
04c480cafa Fix cronjob Delete customer 2023-09-01 13:40:26 +07:00
8be8737236 2023.9.1 2023-09-01 09:21:35 +07:00
a8515b7d60 Fix Username in user dashboard 2023-09-01 09:18:17 +07:00
d71eb37f48 add Cancel Button in user dashboard 2023-09-01 09:16:40 +07:00
8fcca70ead Time will not change while extending package 2023-09-01 09:06:00 +07:00
59f6c180cf Critical Fix extending user package 2023-09-01 09:02:39 +07:00
d53c4cf8c8 Best 2023-08-30 15:14:18 +07:00
620bfaeb29 unlink after upload 2023-08-30 11:24:08 +07:00
863dd65145 remove debug echo 2023-08-30 10:22:58 +07:00
32 changed files with 383 additions and 295 deletions

10
.gitignore vendored
View File

@ -20,7 +20,9 @@ system/plugin/ui/*
ui/ui_custom/** ui/ui_custom/**
!ui/ui_custom/index.html !ui/ui_custom/index.html
!ui/ui_custom/README.md !ui/ui_custom/README.md
system/uploads/admin.png system/uploads/**
system/uploads/logo.png !system/uploads/*.default.png
system/uploads/user.jpg system/uploads/sms/**
system/uploads/notifications.json !system/uploads/sms/index.html
system/uploads/system/**
!system/uploads/system/index.html

View File

@ -2,6 +2,25 @@
# CHANGELOG # CHANGELOG
## 2023.9.6
- Expired Pool
Customer can be move to expired pool after plan expired by cron
- Fix Delete customer
- tbl_language removed
## 2023.9.1.1
- Fix cronjob Delete customer
- Fix reminder text
## 2023.9.1
- Critical bug fixes, bug happen when user buy package, expired time will be calculated from last expired, not from when they buy the package
- Time not change after user buy package for extending
- Add Cancel Button to user dashboard when it show unpaid package
- Fix username in user dashboard
## 2023.8.30 ## 2023.8.30
- Upload Logo from settings - Upload Logo from settings

View File

@ -65,22 +65,6 @@ CREATE TABLE
-- --
-- Struktur dari tabel `tbl_language`
--
CREATE TABLE
`tbl_language` (
`id` int(10) NOT NULL,
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`folder` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`author` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_logs` -- Struktur dari tabel `tbl_logs`
-- --
@ -174,6 +158,7 @@ CREATE TABLE
`shared_users` int(10) DEFAULT NULL, `shared_users` int(10) DEFAULT NULL,
`routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`pool` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `pool` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`pool_expired` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled\r\n' `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled\r\n'
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci; ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
@ -345,14 +330,6 @@ ALTER TABLE `tbl_customers` ADD PRIMARY KEY (`id`);
-- --
-- Indeks untuk tabel `tbl_language`
--
ALTER TABLE `tbl_language` ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tbl_logs` -- Indeks untuk tabel `tbl_logs`
-- --
@ -466,15 +443,6 @@ ALTER TABLE
-- --
-- AUTO_INCREMENT untuk tabel `tbl_language`
--
ALTER TABLE
`tbl_language` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `tbl_logs` -- AUTO_INCREMENT untuk tabel `tbl_logs`
-- --
@ -610,39 +578,4 @@ VALUES (
'Active', 'Active',
'2022-09-06 16:09:50', '2022-09-06 16:09:50',
'2014-06-23 01:43:07' '2014-06-23 01:43:07'
);
--
-- Dumping data untuk tabel `tbl_language`
--
INSERT INTO
`tbl_language` (
`id`,
`name`,
`folder`,
`author`
)
VALUES (
1,
'Indonesia',
'indonesia',
'Ismail Marzuqi'
), (
2,
'English',
'english',
'Ismail Marzuqi'
), (
3,
'Spanish',
'spanish',
'Luis Hernandez'
), (
4,
'Türkçe',
'turkish',
'Goktug Bogac Ogel'
); );

View File

@ -39,7 +39,11 @@ class Lang
public static function dateTimeFormat($date){ public static function dateTimeFormat($date){
global $config; global $config;
return date($config['date_format']. ' H:i', strtotime($date)); if(strtotime($date) < strtotime("2000-01-01 00:00:00")){
return "";
}else{
return date($config['date_format']. ' H:i', strtotime($date));
}
} }
public static function dateAndTimeFormat($date, $time){ public static function dateAndTimeFormat($date, $time){

View File

@ -17,7 +17,7 @@ class Mikrotik
$iport = explode(":", $ip); $iport = explode(":", $ip);
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null); return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) { } catch (Exception $e) {
$ui->assign("error_meesage","Unable to connect to the router.<br>" . $e->getMessage()); $ui->assign("error_meesage", "Unable to connect to the router.<br>" . $e->getMessage());
$ui->display('router-error.tpl'); $ui->display('router-error.tpl');
die(); die();
} }
@ -72,46 +72,77 @@ class Mikrotik
public static function setHotspotPlan($client, $name, $sharedusers, $rate) public static function setHotspotPlan($client, $name, $sharedusers, $rate)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name', '/ip hotspot user profile print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$profileName = $client->sendSync($printRequest)->getProperty('name'); $profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileID)) {
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
}else{
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileID)
->setArgument('shared-users', $sharedusers)
->setArgument('rate-limit', $rate)
);
}
}
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set'); public static function setHotspotExpiredPlan($client, $name, $pool)
$client( {
$setRequest $printRequest = new RouterOS\Request(
->setArgument('numbers', $profileName) '/ip hotspot user profile print .proplist=.id',
->setArgument('shared-users', $sharedusers) RouterOS\Query::where('name', $name)
->setArgument('rate-limit', $rate)
); );
$profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileID)) {
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
$client->sendSync(
$addRequest
->setArgument('name', $name)
->setArgument('shared-users', 3)
->setArgument('address-pool', $pool)
->setArgument('rate-limit', '512K/512K')
);
}else{
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
$client(
$setRequest
->setArgument('numbers', $profileID)
->setArgument('shared-users', 3)
->setArgument('address-pool', $pool)
->setArgument('rate-limit', '512K/512K')
);
}
} }
public static function removeHotspotPlan($client, $name) public static function removeHotspotPlan($client, $name)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ip hotspot user profile print .proplist=name', '/ip hotspot user profile print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$profileName = $client->sendSync($printRequest)->getProperty('name'); $profileID = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove'); $removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
$client( $client(
$removeRequest $removeRequest
->setArgument('numbers', $profileName) ->setArgument('numbers', $profileID)
); );
} }
public static function removeHotspotUser($client, $username) public static function removeHotspotUser($client, $username)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name', '/ip hotspot user print .proplist=.id',
RouterOS\Query::where('name', $username) RouterOS\Query::where('name', $username)
); );
$userName = $client->sendSync($printRequest)->getProperty('name'); $userID = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove'); $removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client( $client(
$removeRequest $removeRequest
->setArgument('numbers', $userName) ->setArgument('numbers', $userID)
); );
} }
@ -179,7 +210,7 @@ class Mikrotik
} }
} }
public static function setHotspotUser($client, $user, $pass, $nuser = null) public static function setHotspotUser($client, $user, $pass)
{ {
$printRequest = new RouterOS\Request('/ip/hotspot/user/print'); $printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id'); $printRequest->setArgument('.proplist', '.id');
@ -192,6 +223,19 @@ class Mikrotik
$client->sendSync($setRequest); $client->sendSync($setRequest);
} }
public static function setHotspotUserPackage($client, $user, $plan)
{
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $user));
$id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
$setRequest->setArgument('numbers', $id);
$setRequest->setArgument('profile', $plan);
$client->sendSync($setRequest);
}
public static function removeHotspotActiveUser($client, $username) public static function removeHotspotActiveUser($client, $username)
{ {
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print'); $onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
@ -204,32 +248,19 @@ class Mikrotik
$client->sendSync($removeRequest); $client->sendSync($removeRequest);
} }
public static function setHotspotLimitUptime($client, $username) public static function removePpoeUser($client, $username)
{ {
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id'); $printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $username)); $printRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($printRequest)->getProperty('.id'); $id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ip/hotspot/user/set'); $removeRequest = new RouterOS\Request('/ppp/secret/remove');
$setRequest->setArgument('numbers', $id); $client(
$setRequest->setArgument('limit-uptime', '00:00:05'); $removeRequest
$client->sendSync($setRequest); ->setArgument('numbers', $id)
} );
public static function removePpoeUser($client, $username)
{
$printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $username));
$id = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $id)
);
} }
public static function addPpoeUser($client, $plan, $customer) public static function addPpoeUser($client, $plan, $customer)
@ -250,7 +281,7 @@ class Mikrotik
); );
} }
public static function setPpoeUser($client, $user, $pass, $nuser = null) public static function setPpoeUser($client, $user, $pass)
{ {
$printRequest = new RouterOS\Request('/ppp/secret/print'); $printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id'); $printRequest->setArgument('.proplist', '.id');
@ -263,15 +294,16 @@ class Mikrotik
$client->sendSync($setRequest); $client->sendSync($setRequest);
} }
public static function disablePpoeUser($client, $username) public static function setPpoeUserPlan($client, $user, $plan)
{ {
$printRequest = new RouterOS\Request('/ppp/secret/print'); $printRequest = new RouterOS\Request('/ppp/secret/print');
$printRequest->setArgument('.proplist', '.id'); $printRequest->setArgument('.proplist', '.id');
$printRequest->setQuery(RouterOS\Query::where('name', $username)); $printRequest->setQuery(RouterOS\Query::where('name', $user));
$id = $client->sendSync($printRequest)->getProperty('.id'); $id = $client->sendSync($printRequest)->getProperty('.id');
$setRequest = new RouterOS\Request('/ppp/secret/disable'); $setRequest = new RouterOS\Request('/ppp/secret/set');
$setRequest->setArgument('numbers', $id); $setRequest->setArgument('numbers', $id);
$setRequest->setArgument('profile', $plan);
$client->sendSync($setRequest); $client->sendSync($setRequest);
} }
@ -290,15 +322,15 @@ class Mikrotik
public static function removePool($client, $name) public static function removePool($client, $name)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ip pool print .proplist=name', '/ip pool print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$poolName = $client->sendSync($printRequest)->getProperty('name'); $poolID = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ip/pool/remove'); $removeRequest = new RouterOS\Request('/ip/pool/remove');
$client( $client(
$removeRequest $removeRequest
->setArgument('numbers', $poolName) ->setArgument('numbers', $poolID)
); );
} }
@ -315,18 +347,18 @@ class Mikrotik
public static function setPool($client, $name, $ip_address) public static function setPool($client, $name, $ip_address)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ip pool print .proplist=name', '/ip pool print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$poolName = $client->sendSync($printRequest)->getProperty('name'); $poolID = $client->sendSync($printRequest)->getProperty('id');
if (empty($poolName)) { if (empty($poolID)) {
self::addPool($client, $name, $ip_address); self::addPool($client, $name, $ip_address);
} else { } else {
$setRequest = new RouterOS\Request('/ip/pool/set'); $setRequest = new RouterOS\Request('/ip/pool/set');
$client( $client(
$setRequest $setRequest
->setArgument('numbers', $poolName) ->setArgument('numbers', $poolID)
->setArgument('ranges', $ip_address) ->setArgument('ranges', $ip_address)
); );
} }
@ -348,17 +380,17 @@ class Mikrotik
public static function setPpoePlan($client, $name, $pool, $rate) public static function setPpoePlan($client, $name, $pool, $rate)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name', '/ppp profile print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$profileName = $client->sendSync($printRequest)->getProperty('name'); $profileID = $client->sendSync($printRequest)->getProperty('.id');
if (empty($profileName)) { if (empty($profileID)) {
self::addPpoePlan($client, $name, $pool, $rate); self::addPpoePlan($client, $name, $pool, $rate);
} else { } else {
$setRequest = new RouterOS\Request('/ppp/profile/set'); $setRequest = new RouterOS\Request('/ppp/profile/set');
$client( $client(
$setRequest $setRequest
->setArgument('numbers', $profileName) ->setArgument('numbers', $profileID)
->setArgument('local-address', $pool) ->setArgument('local-address', $pool)
->setArgument('remote-address', $pool) ->setArgument('remote-address', $pool)
->setArgument('rate-limit', $rate) ->setArgument('rate-limit', $rate)
@ -369,15 +401,15 @@ class Mikrotik
public static function removePpoePlan($client, $name) public static function removePpoePlan($client, $name)
{ {
$printRequest = new RouterOS\Request( $printRequest = new RouterOS\Request(
'/ppp profile print .proplist=name', '/ppp profile print .proplist=.id',
RouterOS\Query::where('name', $name) RouterOS\Query::where('name', $name)
); );
$profileName = $client->sendSync($printRequest)->getProperty('name'); $profileID = $client->sendSync($printRequest)->getProperty('.id');
$removeRequest = new RouterOS\Request('/ppp/profile/remove'); $removeRequest = new RouterOS\Request('/ppp/profile/remove');
$client( $client(
$removeRequest $removeRequest
->setArgument('numbers', $profileName) ->setArgument('numbers', $profileID)
); );
} }
} }

View File

@ -19,7 +19,7 @@ class Package
*/ */
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel) public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{ {
global $_c, $_L, $_notifmsg; global $_c;
$date_now = date("Y-m-d H:i:s"); $date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d"); $date_only = date("Y-m-d");
$time_only = date("H:i:s"); $time_only = date("H:i:s");
@ -102,12 +102,14 @@ class Package
Mikrotik::addHotspotUser($client, $p, $c); Mikrotik::addHotspotUser($client, $p, $c);
} }
if ($b['namebp'] == $p['name_plan']) { if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend // if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') { if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Days') { } else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Hrs') { } else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours'))); $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
$date_exp = $datetime[0]; $date_exp = $datetime[0];
@ -150,6 +152,7 @@ class Package
} else { } else {
if (!$_c['radius_mode']) { if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::removeHotspotUser($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']);
Mikrotik::addHotspotUser($client, $p, $c); Mikrotik::addHotspotUser($client, $p, $c);
} }
@ -200,12 +203,14 @@ class Package
} }
if ($b['namebp'] == $p['name_plan']) { if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend // if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') { if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Days') { } else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Hrs') { } else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours'))); $datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
$date_exp = $datetime[0]; $date_exp = $datetime[0];

View File

@ -4,6 +4,33 @@
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/ **/
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
function r2($to, $ntype = 'e', $msg = '') function r2($to, $ntype = 'e', $msg = '')
{ {
if ($msg == '') { if ($msg == '') {
@ -47,8 +74,7 @@ function _get($param, $defvalue = '')
} }
} }
require_once File::pathFixer('system/orm.php');
require('system/orm.php');
ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user); ORM::configure('username', $db_user);
@ -81,15 +107,15 @@ function _notify($msg, $type = 'e')
$_SESSION['notify'] = $msg; $_SESSION['notify'] = $msg;
} }
$lan_file = 'system/lan/' . $config['language'] . '/common.lan.php'; $lan_file = File::pathFixer('system/lan/' . $config['language'] . '/common.lan.php');
require($lan_file); require($lan_file);
$ui = new Smarty(); $ui = new Smarty();
$ui->setTemplateDir(['custom' => 'ui/ui_custom/', 'default' => 'ui/ui/']); $ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
$ui->addTemplateDir('system/paymentgateway/ui/', 'pg'); $ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg');
$ui->addTemplateDir('system/plugin/ui/', 'plugin'); $ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin');
$ui->setCompileDir('ui/compiled/'); $ui->setCompileDir(File::pathFixer('ui/compiled/'));
$ui->setConfigDir('ui/conf/'); $ui->setConfigDir(File::pathFixer('ui/conf/'));
$ui->setCacheDir('ui/cache/'); $ui->setCacheDir(File::pathFixer('ui/cache/'));
$ui->assign('app_url', APP_URL); $ui->assign('app_url', APP_URL);
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST))); $ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST)));
define('U', APP_URL . '/index.php?_route='); define('U', APP_URL . '/index.php?_route=');
@ -129,40 +155,16 @@ if (isset($_SESSION['notify'])) {
include "autoload/Hookers.php"; include "autoload/Hookers.php";
// notification message // notification message
if(file_exists("system/uploads/notifications.json")){ if (file_exists(File::pathFixer("system/uploads/notifications.json"))) {
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true); $_notifmsg = json_decode(file_get_contents(File::pathFixer('system/uploads/notifications.json')), true);
} }
$_notifmsg_default = json_decode(file_get_contents('system/uploads/notifications.default.json'), true); $_notifmsg_default = json_decode(file_get_contents(File::pathFixer('system/uploads/notifications.default.json')), true);
//register all plugin //register all plugin
foreach (glob("system/plugin/*.php") as $filename) { foreach (glob(File::pathFixer("system/plugin/*.php")) as $filename) {
include $filename; include $filename;
} }
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
function _auth($login = true) function _auth($login = true)
{ {
@ -281,7 +283,7 @@ $handler = $routes[0];
if ($handler == '') { if ($handler == '') {
$handler = 'default'; $handler = 'default';
} }
$sys_render = 'system/controllers/' . $handler . '.php'; $sys_render = File::pathFixer('system/controllers/' . $handler . '.php');
if (file_exists($sys_render)) { if (file_exists($sys_render)) {
$menus = array(); $menus = array();
// "name" => $name, // "name" => $name,

View File

@ -15,9 +15,6 @@ if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']); r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
} }
use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) { switch ($action) {
case 'list': case 'list':

View File

@ -53,10 +53,10 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id); $d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) { if ($d) {
$ui->assign('d', $d); $ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->where('routers', $d['routers'])->find_many();
$ui->assign('p', $p);
$b = ORM::for_table('tbl_bandwidth')->find_many(); $b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b); $ui->assign('b', $b);
$r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r);
run_hook('view_edit_plan'); #HOOK run_hook('view_edit_plan'); #HOOK
$ui->display('hotspot-edit.tpl'); $ui->display('hotspot-edit.tpl');
} else { } else {
@ -96,6 +96,7 @@ switch ($action) {
$validity = _post('validity'); $validity = _post('validity');
$validity_unit = _post('validity_unit'); $validity_unit = _post('validity_unit');
$routers = _post('routers'); $routers = _post('routers');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$msg = ''; $msg = '';
@ -134,8 +135,12 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers); $mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate); Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
if(!empty($pool_expired)){
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired);
}
} }
$d = ORM::for_table('tbl_plans')->create(); $d = ORM::for_table('tbl_plans')->create();
$d->name_plan = $name; $d->name_plan = $name;
$d->id_bw = $id_bw; $d->id_bw = $id_bw;
@ -151,6 +156,7 @@ switch ($action) {
$d->validity_unit = $validity_unit; $d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers; $d->shared_users = $sharedusers;
$d->routers = $routers; $d->routers = $routers;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->save(); $d->save();
@ -176,6 +182,7 @@ switch ($action) {
$validity = _post('validity'); $validity = _post('validity');
$validity_unit = _post('validity_unit'); $validity_unit = _post('validity_unit');
$routers = _post('routers'); $routers = _post('routers');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$msg = ''; $msg = '';
@ -213,6 +220,9 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers); $mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate); Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
if(!empty($pool_expired)){
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired);
}
} }
$d->name_plan = $name; $d->name_plan = $name;
@ -228,6 +238,7 @@ switch ($action) {
$d->validity_unit = $validity_unit; $d->validity_unit = $validity_unit;
$d->shared_users = $sharedusers; $d->shared_users = $sharedusers;
$d->routers = $routers; $d->routers = $routers;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->save(); $d->save();
@ -260,8 +271,6 @@ switch ($action) {
$ui->assign('_title', $_L['PPPOE_Plans']); $ui->assign('_title', $_L['PPPOE_Plans']);
$d = ORM::for_table('tbl_bandwidth')->find_many(); $d = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('d', $d); $ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many(); $r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r); $ui->assign('r', $r);
run_hook('view_add_ppoe'); #HOOK run_hook('view_add_ppoe'); #HOOK
@ -274,10 +283,10 @@ switch ($action) {
$d = ORM::for_table('tbl_plans')->find_one($id); $d = ORM::for_table('tbl_plans')->find_one($id);
if ($d) { if ($d) {
$ui->assign('d', $d); $ui->assign('d', $d);
$p = ORM::for_table('tbl_pool')->where('routers', $d['routers'])->find_many();
$ui->assign('p', $p);
$b = ORM::for_table('tbl_bandwidth')->find_many(); $b = ORM::for_table('tbl_bandwidth')->find_many();
$ui->assign('b', $b); $ui->assign('b', $b);
$p = ORM::for_table('tbl_pool')->find_many();
$ui->assign('p', $p);
$r = ORM::for_table('tbl_routers')->find_many(); $r = ORM::for_table('tbl_routers')->find_many();
$ui->assign('r', $r); $ui->assign('r', $r);
run_hook('view_edit_ppoe'); #HOOK run_hook('view_edit_ppoe'); #HOOK
@ -312,6 +321,7 @@ switch ($action) {
$validity_unit = _post('validity_unit'); $validity_unit = _post('validity_unit');
$routers = _post('routers'); $routers = _post('routers');
$pool = _post('pool_name'); $pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$msg = ''; $msg = '';
@ -348,6 +358,9 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers); $mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::addPpoePlan($client, $name, $pool, $rate); Mikrotik::addPpoePlan($client, $name, $pool, $rate);
if(!empty($pool_expired)){
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
}
} }
$d = ORM::for_table('tbl_plans')->create(); $d = ORM::for_table('tbl_plans')->create();
@ -359,6 +372,7 @@ switch ($action) {
$d->validity_unit = $validity_unit; $d->validity_unit = $validity_unit;
$d->routers = $routers; $d->routers = $routers;
$d->pool = $pool; $d->pool = $pool;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->save(); $d->save();
@ -377,6 +391,7 @@ switch ($action) {
$validity_unit = _post('validity_unit'); $validity_unit = _post('validity_unit');
$routers = _post('routers'); $routers = _post('routers');
$pool = _post('pool_name'); $pool = _post('pool_name');
$pool_expired = _post('pool_expired');
$enabled = _post('enabled'); $enabled = _post('enabled');
$msg = ''; $msg = '';
@ -414,6 +429,9 @@ switch ($action) {
$mikrotik = Mikrotik::info($routers); $mikrotik = Mikrotik::info($routers);
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
Mikrotik::setPpoePlan($client, $name, $pool, $rate); Mikrotik::setPpoePlan($client, $name, $pool, $rate);
if(!empty($pool_expired)){
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL '.$pool_expired, $pool_expired, '512K/512K');
}
} }
$d->name_plan = $name; $d->name_plan = $name;
@ -423,6 +441,7 @@ switch ($action) {
$d->validity_unit = $validity_unit; $d->validity_unit = $validity_unit;
$d->routers = $routers; $d->routers = $routers;
$d->pool = $pool; $d->pool = $pool;
$d->pool_expired = $pool_expired;
$d->enabled = $enabled; $d->enabled = $enabled;
$d->save(); $d->save();

View File

@ -31,8 +31,14 @@ switch ($action) {
if ($admin['user_type'] != 'Admin') { if ($admin['user_type'] != 'Admin') {
r2(U . "dashboard", 'e', $_L['Do_Not_Access']); r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
} }
$lan = ORM::for_table('tbl_language')->find_many(); $folders = [];
$ui->assign('lan', $lan); $files = scandir('system/lan/');
foreach ($files as $file) {
if(is_dir('system/lan/'.$file) && !in_array($file,['.','..'])){
$folders[] = $file;
}
}
$ui->assign('lan', $folders);
$timezonelist = Timezone::timezoneList(); $timezonelist = Timezone::timezoneList();
$ui->assign('tlist', $timezonelist); $ui->assign('tlist', $timezonelist);
@ -229,12 +235,10 @@ switch ($action) {
run_hook('save_settings'); #HOOK run_hook('save_settings'); #HOOK
if ($_FILES['logo']['error'] > 0) {
r2(U . 'settings/app', 'e', 'Failed to process logo');
}
if (!empty($_FILES['logo']['name'])) { if (!empty($_FILES['logo']['name'])) {
if (file_exists('system/uploads/logo.png')) unlink('system/uploads/logo.png'); if (file_exists('system/uploads/logo.png')) unlink('system/uploads/logo.png');
File::resizeCropImage($_FILES['logo']['tmp_name'], 'system/uploads/logo.png', 1078, 200, 100); File::resizeCropImage($_FILES['logo']['tmp_name'], 'system/uploads/logo.png', 1078, 200, 100);
if (file_exists($_FILES['logo']['tmp_name'])) unlink($_FILES['logo']['tmp_name']);
} }
if ($company == '') { if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']); r2(U . 'settings/app', 'e', $_L['All_field_is_required']);

View File

@ -4,10 +4,34 @@
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/ **/
require('../config.php'); // on some server, it getting error because of slash is backwards
require('orm.php'); function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
require_once '../config.php';
require_once 'orm.php';
require_once 'autoload/PEAR2/Autoload.php'; require_once 'autoload/PEAR2/Autoload.php';
include "autoload/Hookers.php";
ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user); ORM::configure('username', $db_user);
@ -16,44 +40,17 @@ ORM::configure('return_result_sets', true);
ORM::configure('logging', true); ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message // notification message
if(file_exists("system/uploads/notifications.json")){ if (file_exists("uploads/notifications.json")) {
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true); $_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true);
} }
$_notifmsg_default = json_decode(file_get_contents('system/uploads/notifications.default.json'), true); $_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true);
//register all plugin //register all plugin
foreach (glob("plugin/*.php") as $filename) { foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
include $filename; include $filename;
} }
// on some server, it getting error because of slash is backwards
function _autoloader($class)
{
if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
} else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
}
}
}
spl_autoload_register('_autoloader');
$result = ORM::for_table('tbl_appconfig')->find_many(); $result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) { foreach ($result as $value) {
$config[$value['setting']] = $value['value']; $config[$value['setting']] = $value['value'];
@ -66,7 +63,7 @@ date_default_timezone_set($config['timezone']);
$textExpired = Lang::getNotifText('expired'); $textExpired = Lang::getNotifText('expired');
$d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->where_lte('expiration', date("Y-m-d"))->find_many(); $d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->where_lte('expiration', date("Y-m-d"))->find_many();
echo "Found ".count($d)." user(s)\n"; echo "Found " . count($d) . " user(s)\n";
run_hook('cronjob'); #HOOK run_hook('cronjob'); #HOOK
foreach ($d as $ds) { foreach ($d as $ds) {
@ -79,11 +76,16 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one(); $u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one(); $m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if (!$_c['radius_mode']) { if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']); $client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::setHotspotLimitUptime($client, $c['username']);
Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']);
if(!empty($p['pool_expired'])){
Mikrotik::setHotspotUserPackage($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
}else{
Mikrotik::removeHotspotUser($client, $c['username']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']); Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
} }
//update database user dengan status off //update database user dengan status off
@ -92,7 +94,6 @@ foreach ($d as $ds) {
// autorenewal from deposit // autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) { if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p && $p['enabled'] && $c['balance'] >= $p['price']) { if ($p && $p['enabled'] && $c['balance'] >= $p['price']) {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) { if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance // if success, then get the balance
@ -106,10 +107,10 @@ foreach ($d as $ds) {
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nPrice: " . $p['price']); "\nPrice: " . $p['price']);
} }
}else{ } else {
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n"; echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
} }
}else{ } else {
echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n"; echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n";
} }
} else echo " : ACTIVE \r\n"; } else echo " : ACTIVE \r\n";
@ -122,11 +123,16 @@ foreach ($d as $ds) {
$u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one(); $u = ORM::for_table('tbl_user_recharges')->where('id', $ds['id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one(); $m = ORM::for_table('tbl_routers')->where('name', $ds['routers'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if (!$_c['radius_mode']) { if (!$_c['radius_mode']) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']); $client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::disablePpoeUser($client, $c['username']);
Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']);
if(!empty($p['pool_expired'])){
Mikrotik::setPpoeUserPlan($client, $c['username'], 'EXPIRED NUXBILL '.$p['pool_expired']);
}else{
Mikrotik::removePpoeUser($client, $c['username']);
}
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']); Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
} }
@ -135,12 +141,15 @@ foreach ($d as $ds) {
// autorenewal from deposit // autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) { if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
if ($p && $p['enabled'] && $c['balance'] >= $p['price']) { if ($p && $p['enabled'] && $c['balance'] >= $p['price']) {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) { if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance // if success, then get the balance
Balance::min($ds['customer_id'], $p['price']); Balance::min($ds['customer_id'], $p['price']);
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
echo "auto renewall Success\n";
} else { } else {
echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
echo "auto renewall Failed\n";
Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #PPPOE \n" . $p['name_plan'] . Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nPrice: " . $p['price']); "\nPrice: " . $p['price']);

View File

@ -7,46 +7,21 @@
* 0 7 * * * /usr/bin/php /var/www/system/cron_reminder.php * 0 7 * * * /usr/bin/php /var/www/system/cron_reminder.php
**/ **/
require('../config.php');
require('orm.php');
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message
if(file_exists("system/uploads/notifications.json")){
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('system/uploads/notifications.default.json'), true);
//register all plugin
foreach (glob("plugin/*.php") as $filename) {
include $filename;
}
// on some server, it getting error because of slash is backwards // on some server, it getting error because of slash is backwards
function _autoloader($class) function _autoloader($class)
{ {
if (strpos($class, '_') !== false) { if (strpos($class, '_') !== false) {
$class = str_replace('_', DIRECTORY_SEPARATOR, $class); $class = str_replace('_', DIRECTORY_SEPARATOR, $class);
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else { } else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class); $class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; include __DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} }
} else { } else {
if (file_exists('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) { if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
include 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'; include __DIR__.DIRECTORY_SEPARATOR.'autoload' . DIRECTORY_SEPARATOR . $class . '.php';
} else { } else {
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class); $class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php')) if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
@ -54,9 +29,30 @@ function _autoloader($class)
} }
} }
} }
spl_autoload_register('_autoloader'); spl_autoload_register('_autoloader');
require_once '../config.php';
require_once 'orm.php';
require_once 'autoload/PEAR2/Autoload.php';
include "autoload/Hookers.php";
ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user);
ORM::configure('password', $db_password);
ORM::configure('return_result_sets', true);
ORM::configure('logging', true);
// notification message
if (file_exists("uploads/notifications.json")) {
$_notifmsg = json_decode(file_get_contents('uploads/notifications.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('uploads/notifications.default.json'), true);
//register all plugin
foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
include $filename;
}
$result = ORM::for_table('tbl_appconfig')->find_many(); $result = ORM::for_table('tbl_appconfig')->find_many();
foreach ($result as $value) { foreach ($result as $value) {
$config[$value['setting']] = $value['value']; $config[$value['setting']] = $value['value'];

View File

@ -385,3 +385,5 @@ $_L['Received_Balance'] = 'Received Balance';
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer'; $_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
$_L['Minimum_Transfer'] = 'Minimum Transfer'; $_L['Minimum_Transfer'] = 'Minimum Transfer';
$_L['Company_Logo'] = 'Company Logo'; $_L['Company_Logo'] = 'Company Logo';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';

View File

@ -338,3 +338,11 @@ $_L['Country_Code_Phone'] = 'Kode Negara Telepon';
$_L['Voucher_activation_menu_will_be_hidden'] = 'Info Pembelian Voucher dan Redeem akan disembunyikan'; $_L['Voucher_activation_menu_will_be_hidden'] = 'Info Pembelian Voucher dan Redeem akan disembunyikan';
$_L['Customer_can_deposit_money_to_buy_voucher'] = 'Pelanggan dapat topup saldo untuk langganan Internet'; $_L['Customer_can_deposit_money_to_buy_voucher'] = 'Pelanggan dapat topup saldo untuk langganan Internet';
$_L['Allow_balance_transfer_between_customers'] = 'Bolehkan transfer saldo antar pelanggan'; $_L['Allow_balance_transfer_between_customers'] = 'Bolehkan transfer saldo antar pelanggan';
$_L['Refill_Balance'] = 'Refill Balance';
$_L['Balance_Plans'] = 'Balance Plans';
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
$_L['Company_Logo'] = 'Company Logo';
$_L['Disable_Voucher'] = 'Disable Voucher';
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
$_L['Reminder_Notification'] = 'Reminder Notification';
$_L['Invoice_Footer'] = 'Invoice Footer';

View File

@ -340,4 +340,5 @@ $_L['Invoice'] = 'Invoice';
$_L['Country_Code_Phone'] = 'Country Code Phone'; $_L['Country_Code_Phone'] = 'Country Code Phone';
$_L['Voucher_activation_menu_will_be_hidden'] = 'Voucher activation menu will be hidden'; $_L['Voucher_activation_menu_will_be_hidden'] = 'Voucher activation menu will be hidden';
$_L['Customer_can_deposit_money_to_buy_voucher'] = 'Customer can deposit money to buy voucher'; $_L['Customer_can_deposit_money_to_buy_voucher'] = 'Customer can deposit money to buy voucher';
$_L['Allow_balance_transfer_between_customers'] = 'Allow balance transfer between customers'; $_L['Allow_balance_transfer_between_customers'] = 'Allow balance transfer between customers';$_L['Refill_Balance'] = 'Refill Balance';
$_L['Balance_Plans'] = 'Balance Plans';

View File

@ -7,11 +7,12 @@ if(php_sapi_name() !== 'cli'){
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE"); die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
} }
require(__DIR__.'/../config.php'); require_once __DIR__.File::pathFixer('/../config.php');
require(__DIR__.'/orm.php'); require_once __DIR__.File::pathFixer('orm.php');
require_once __DIR__.File::pathFixer('/autoload/PEAR2/Autoload.php');
include __DIR__.File::pathFixer("/autoload/Hookers.php");
use PEAR2\Net\RouterOS; use PEAR2\Net\RouterOS;
require_once 'autoload/PEAR2/Autoload.php';
ORM::configure("mysql:host=$db_host;dbname=$db_name"); ORM::configure("mysql:host=$db_host;dbname=$db_name");
ORM::configure('username', $db_user); ORM::configure('username', $db_user);

View File

@ -17,5 +17,9 @@
"2023.8.28" : [ "2023.8.28" : [
"ALTER TABLE `tbl_user_recharges` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;", "ALTER TABLE `tbl_user_recharges` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;",
"ALTER TABLE `tbl_transactions` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;" "ALTER TABLE `tbl_transactions` ADD `recharged_time` time NOT NULL DEFAULT '00:00:00' AFTER `recharged_on`;"
],
"2023.9.5" : [
"DROP TABLE `tbl_language`;",
"ALTER TABLE `tbl_plans` ADD `pool_expired` varchar(40) NOT NULL DEFAULT '' AFTER `pool`;"
] ]
} }

View File

@ -45,18 +45,16 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{$_L['Default_Language']}</label> <label class="col-md-2 control-label">{$_L['Default_Language']}</label>
<div class="col-md-4"> <div class="col-md-6">
<select class="form-control" name="lan" id="lan"> <select class="form-control" name="lan" id="lan">
{foreach $lan as $lans} {foreach $lan as $lans}
<option value="{$lans['folder']}" {if $_c['language'] eq $lans['folder']} <option value="{$lans}" {if $_c['language'] eq $lans}
selected="selected" {/if}>{$lans['name']}</option> selected="selected" {/if}>{$lans}</option>
{/foreach} {/foreach}
</select> </select>
</div> </div>
<div class="col-md-2"> <div class="col-md-4 help-block">
<a href="{$_url}settings/language" type="button" To add new Language, just add the folder, it will automatically detected
class="btn btn-line-success btn-icon-inline"><i
class="ion ion-android-add"></i>{$_L['Add_Language']}</a>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -78,8 +76,8 @@
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="currency_code" name="currency_code" <input type="text" class="form-control" id="currency_code" name="currency_code"
value="{$_c['currency_code']}"> value="{$_c['currency_code']}">
<span class="help-block">{$_L['currency_help']}</span>
</div> </div>
<span class="help-block col-md-4">{$_L['currency_help']}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Country Code Phone')}</label> <label class="col-md-2 control-label">{Lang::T('Country Code Phone')}</label>

View File

@ -24,7 +24,7 @@
<label class="col-md-2 control-label">{Lang::T('Company Logo')}</label> <label class="col-md-2 control-label">{Lang::T('Company Logo')}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="file" class="form-control" id="logo" name="logo" accept="image/*"> <input type="file" class="form-control" id="logo" name="logo" accept="image/*">
<span class="help-block">For PDF Reports | Beset size 1078 x 200 | uploaded image will be autosize</span> <span class="help-block">For PDF Reports | Best size 1078 x 200 | uploaded image will be autosize</span>
</div> </div>
<span class="help-block col-md-4"> <span class="help-block col-md-4">
<a href="./{$logo}" target="_blank"><img src="./{$logo}" height="48" alt="logo for PDF"></a> <a href="./{$logo}" target="_blank"><img src="./{$logo}" height="48" alt="logo for PDF"></a>

View File

@ -1,4 +1,4 @@
<option value=''>{$_L['Select_Pool']}</option>
{foreach $d as $ds} {foreach $d as $ds}
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option> <option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
{/foreach} {/foreach}

View File

@ -1,4 +1,4 @@
<option value="">Select Routers</option> <option value=''>{$_L['Select_Routers']}</option>
{foreach $d as $ds} {foreach $d as $ds}
<option value="{$ds['name']}">{$ds['name']}</option> <option value="{$ds['name']}">{$ds['name']}</option>
{/foreach} {/foreach}

View File

@ -142,8 +142,7 @@
<div class="box-footer" id="latestVersion">ver</div> <div class="box-footer" id="latestVersion">ver</div>
<div class="box-footer"> <div class="box-footer">
<div class="btn-group btn-group-justified" role="group" aria-label="..."> <div class="btn-group btn-group-justified" role="group" aria-label="...">
<a href="./update.php" target="_blank" class="btn btn-success btn-sm btn-block">Install Latest <a href="./update.php" class="btn btn-success btn-sm btn-block">Install Latest Version</a>
Version</a>
<a href="https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip" target="_blank" <a href="https://github.com/hotspotbilling/phpnuxbill/archive/refs/heads/master.zip" target="_blank"
class="btn btn-warning btn-sm btn-block">Download Latest Version</a> class="btn btn-warning btn-sm btn-block">Download Latest Version</a>
</div> </div>

View File

@ -112,7 +112,8 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label> <label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
<div class="col-md-6"> <div class="col-md-6">
<select id="routers" name="routers" class="form-control select2"> <select id="routers" name="routers" required class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
{foreach $r as $rs} {foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option> <option value="{$rs['name']}">{$rs['name']}</option>
{/foreach} {/foreach}
@ -120,9 +121,16 @@
<p class="help-block">{Lang::T('Cannot be change after saved')}</p> <p class="help-block">{Lang::T('Cannot be change after saved')}</p>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-md-offset-2 col-md-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button> <button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a> Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
</div> </div>

View File

@ -114,9 +114,20 @@
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly> <input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-md-offset-2 col-md-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button> <button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a> Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
</div> </div>

View File

@ -35,6 +35,7 @@
<th>{$_L['Data_Limit']}</th> <th>{$_L['Data_Limit']}</th>
<th>{$_L['Plan_Validity']}</th> <th>{$_L['Plan_Validity']}</th>
<th>{$_L['Routers']}</th> <th>{$_L['Routers']}</th>
<th>{Lang::T('Expired IP Pool')}</th>
<th>{$_L['Manage']}</th> <th>{$_L['Manage']}</th>
</tr> </tr>
</thead> </thead>
@ -49,6 +50,7 @@
<td>{$ds['data_limit']} {$ds['data_unit']}</td> <td>{$ds['data_limit']} {$ds['data_unit']}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td> <td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['routers']}</td> <td>{$ds['routers']}</td>
<td>{$ds['pool_expired']}</td>
<td> <td>
<a href="{$_url}services/edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a> <a href="{$_url}services/edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
<a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" onclick="return confirm('{$_L['Delete']}?')" class="btn btn-danger btn-xs">{$_L['Delete']}</a> <a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" onclick="return confirm('{$_L['Delete']}?')" class="btn btn-danger btn-xs">{$_L['Delete']}</a>

View File

@ -60,7 +60,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label> <label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
<div class="col-md-6"> <div class="col-md-6">
<select id="routers" name="routers" class="form-control select2"> <select id="routers" name="routers" required class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option> <option value=''>{$_L['Select_Routers']}</option>
{foreach $r as $rs} {foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option> <option value="{$rs['name']}">{$rs['name']}</option>
@ -72,14 +72,21 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label> <label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
<div class="col-md-6"> <div class="col-md-6">
<select id="pool_name" name="pool_name" class="form-control select2"> <select id="pool_name" name="pool_name" required class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option> <option value=''>{$_L['Select_Pool']}</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button> <button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a> Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
</div> </div>

View File

@ -60,9 +60,20 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label> <label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
<div class="col-md-6"> <div class="col-md-6">
<select id="pool_name" name="pool_name" class="form-control select2"> <select id="pool_name" name="pool_name" required class="form-control select2">
{foreach $p as $ps} {foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_name'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option> <option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('Expired IP Pool')}</a></label>
<div class="col-md-6">
<select id="pool_expired" name="pool_expired" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_expired'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach} {/foreach}
</select> </select>
</div> </div>

View File

@ -32,6 +32,7 @@
<th>{$_L['Plan_Price']}</th> <th>{$_L['Plan_Price']}</th>
<th>{$_L['Plan_Validity']}</th> <th>{$_L['Plan_Validity']}</th>
<th>{$_L['Pool']}</th> <th>{$_L['Pool']}</th>
<th>{Lang::T('Expired IP Pool')}</th>
<th>{$_L['Routers']}</th> <th>{$_L['Routers']}</th>
<th>{$_L['Manage']}</th> <th>{$_L['Manage']}</th>
</tr> </tr>
@ -44,6 +45,7 @@
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td> <td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['pool']}</td> <td>{$ds['pool']}</td>
<td>{$ds['pool_expired']}</td>
<td>{$ds['routers']}</td> <td>{$ds['routers']}</td>
<td> <td>
<a href="{$_url}services/pppoe-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a> <a href="{$_url}services/pppoe-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>

View File

@ -14,7 +14,7 @@ $(document).ready(function () {
$('#TimeLimit').show(); $('#TimeLimit').show();
$('#DataLimit').show(); $('#DataLimit').show();
} }
if ($('#Unlimited').is(':checked')) { if ($('#Unlimited').is(':checked')) {
$('#Type').hide(); $('#Type').hide();
$('#TimeLimit').hide(); $('#TimeLimit').hide();
@ -26,12 +26,12 @@ $(document).ready(function () {
if ($('#Hotspot').is(':checked')) { if ($('#Hotspot').is(':checked')) {
$('#p').hide(); $('#p').hide();
$('#h').show(); $('#h').show();
} }
if ($('#PPPOE').is(':checked')) { if ($('#PPPOE').is(':checked')) {
$('#p').show(); $('#p').show();
$('#h').hide(); $('#h').hide();
} }
}); });
}); });
$("#Hotspot").prop("checked", true).change(); $("#Hotspot").prop("checked", true).change();
@ -48,6 +48,7 @@ $(document).ready(function(){
cache: false, cache: false,
success: function(msg){ success: function(msg){
$("#pool_name").html(msg); $("#pool_name").html(msg);
$("#pool_expired").html(msg);
} }
}); });
}); });
@ -62,10 +63,10 @@ $(function() {
dataType: "html", dataType: "html",
url: "index.php?_route=autoload/server", url: "index.php?_route=autoload/server",
success: function(msg){ success: function(msg){
$("#server").html(msg); $("#server").html(msg);
} }
}); });
$("#server").change(getAjaxAlamat); $("#server").change(getAjaxAlamat);
function getAjaxAlamat(){ function getAjaxAlamat(){
var server = $("#server").val(); var server = $("#server").val();

View File

@ -12,8 +12,7 @@
<tbody> <tbody>
<tr> <tr>
<td>{Lang::T('expired')}</td> <td>{Lang::T('expired')}</td>
<td>{date({$_c['date_format']}, strtotime($unpaid['expired_date']))} <td>{Lang::dateTimeFormat($unpaid['expired_date'])} </td>
{date('H:i', strtotime($unpaid['expired_date']))} </td>
</tr> </tr>
<tr> <tr>
<td>{$_L['Plan_Name']}</td> <td>{$_L['Plan_Name']}</td>
@ -30,10 +29,22 @@
</tbody> </tbody>
</table> </table>
<div class="box-footer p-2"> <div class="box-footer p-2">
<a class="btn btn-danger btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}"> <div class="btn-group btn-group-justified mb15">
<span class="icon"><i class="ion ion-card"></i></span> <div class="btn-group">
<span>{Lang::T('PAY NOW')}</span> <a href="{$_url}order/view/{$unpaid['id']}/cancel" class="btn btn-danger btn-sm"
</a> onclick="return confirm('{Lang::T('Cancel it?')}')">
<span class="glyphicon glyphicon-trash"></span>
{Lang::T('Cancel')}
</a>
</div>
<div class="btn-group">
<a class="btn btn-success btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}">
<span class="icon"><i class="ion ion-card"></i></span>
<span>{Lang::T('PAY NOW')}</span>
</a>
</div>
</div>
</div> </div>
</div> </div>
{/if} {/if}
@ -54,7 +65,7 @@
<table class="table table-bordered table-striped table-bordered table-hover"> <table class="table table-bordered table-striped table-bordered table-hover">
<tr> <tr>
<td class="small text-success text-uppercase text-normal">{$_L['Username']}</td> <td class="small text-success text-uppercase text-normal">{$_L['Username']}</td>
<td class="small mb15">{$_bill['username']}</td> <td class="small mb15">{$_user['username']}</td>
</tr> </tr>
<tr> <tr>
<td class="small text-success text-uppercase text-normal">{$_L['Password']}</td> <td class="small text-success text-uppercase text-normal">{$_L['Password']}</td>

View File

@ -70,10 +70,10 @@
</div> </div>
<div class="btn-group btn-group-justified mb15"> <div class="btn-group btn-group-justified mb15">
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-primary">{$_L['Login']}</button> <a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a> <button type="submit" class="btn btn-primary">{$_L['Login']}</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -1,3 +1,3 @@
{ {
"version": "2023.8.30" "version": "2023.9.6"
} }