Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
593ca31f18 | |||
7cc8d6f5e3 | |||
11a2fb8fc0 | |||
537623130c | |||
910be1946b | |||
e23abc1377 | |||
b912dd05d0 | |||
5c9a0d8ea6 | |||
b7eca582a6 | |||
b460e862e8 | |||
a33705c0c4 | |||
183a5ab242 | |||
04c480cafa |
10
.gitignore
vendored
10
.gitignore
vendored
@ -20,7 +20,9 @@ system/plugin/ui/*
|
||||
ui/ui_custom/**
|
||||
!ui/ui_custom/index.html
|
||||
!ui/ui_custom/README.md
|
||||
system/uploads/admin.png
|
||||
system/uploads/logo.png
|
||||
system/uploads/user.jpg
|
||||
system/uploads/notifications.json
|
||||
system/uploads/**
|
||||
!system/uploads/*.default.png
|
||||
system/uploads/sms/**
|
||||
!system/uploads/sms/index.html
|
||||
system/uploads/system/**
|
||||
!system/uploads/system/index.html
|
12
CHANGELOG.md
12
CHANGELOG.md
@ -2,6 +2,18 @@
|
||||
|
||||
# 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
|
||||
|
@ -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`
|
||||
|
||||
--
|
||||
@ -174,6 +158,7 @@ CREATE TABLE
|
||||
`shared_users` int(10) DEFAULT 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_expired` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '',
|
||||
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled\r\n'
|
||||
) 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`
|
||||
|
||||
--
|
||||
@ -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`
|
||||
|
||||
--
|
||||
@ -610,39 +578,4 @@ VALUES (
|
||||
'Active',
|
||||
'2022-09-06 16:09:50',
|
||||
'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'
|
||||
);
|
@ -17,7 +17,7 @@ class Mikrotik
|
||||
$iport = explode(":", $ip);
|
||||
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
|
||||
} 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');
|
||||
die();
|
||||
}
|
||||
@ -72,46 +72,77 @@ class Mikrotik
|
||||
public static function setHotspotPlan($client, $name, $sharedusers, $rate)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=name',
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
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');
|
||||
$client(
|
||||
$setRequest
|
||||
->setArgument('numbers', $profileName)
|
||||
->setArgument('shared-users', $sharedusers)
|
||||
->setArgument('rate-limit', $rate)
|
||||
public static function setHotspotExpiredPlan($client, $name, $pool)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$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)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=name',
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
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');
|
||||
$client(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $profileName)
|
||||
->setArgument('numbers', $profileID)
|
||||
);
|
||||
}
|
||||
|
||||
public static function removeHotspotUser($client, $username)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user print .proplist=name',
|
||||
'/ip hotspot user print .proplist=.id',
|
||||
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');
|
||||
$client(
|
||||
$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->setArgument('.proplist', '.id');
|
||||
@ -192,6 +223,19 @@ class Mikrotik
|
||||
$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)
|
||||
{
|
||||
$onlineRequest = new RouterOS\Request('/ip/hotspot/active/print');
|
||||
@ -204,32 +248,19 @@ class Mikrotik
|
||||
$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->setQuery(RouterOS\Query::where('name', $username));
|
||||
$id = $client->sendSync($printRequest)->getProperty('.id');
|
||||
|
||||
$setRequest = new RouterOS\Request('/ip/hotspot/user/set');
|
||||
$setRequest->setArgument('numbers', $id);
|
||||
$setRequest->setArgument('limit-uptime', '00:00:05');
|
||||
$client->sendSync($setRequest);
|
||||
}
|
||||
|
||||
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)
|
||||
);
|
||||
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
|
||||
$client(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $id)
|
||||
);
|
||||
}
|
||||
|
||||
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->setArgument('.proplist', '.id');
|
||||
@ -263,15 +294,16 @@ class Mikrotik
|
||||
$client->sendSync($setRequest);
|
||||
}
|
||||
|
||||
public static function disablePpoeUser($client, $username)
|
||||
public static function setPpoeUserPlan($client, $user, $plan)
|
||||
{
|
||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||
$printRequest->setArgument('.proplist', '.id');
|
||||
$printRequest->setQuery(RouterOS\Query::where('name', $username));
|
||||
$printRequest->setQuery(RouterOS\Query::where('name', $user));
|
||||
$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('profile', $plan);
|
||||
$client->sendSync($setRequest);
|
||||
}
|
||||
|
||||
@ -290,15 +322,15 @@ class Mikrotik
|
||||
public static function removePool($client, $name)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip pool print .proplist=name',
|
||||
'/ip pool print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$poolName = $client->sendSync($printRequest)->getProperty('name');
|
||||
$poolID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
|
||||
$removeRequest = new RouterOS\Request('/ip/pool/remove');
|
||||
$client(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $poolName)
|
||||
->setArgument('numbers', $poolID)
|
||||
);
|
||||
}
|
||||
|
||||
@ -315,18 +347,18 @@ class Mikrotik
|
||||
public static function setPool($client, $name, $ip_address)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip pool print .proplist=name',
|
||||
'/ip pool print .proplist=.id',
|
||||
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);
|
||||
} else {
|
||||
$setRequest = new RouterOS\Request('/ip/pool/set');
|
||||
$client(
|
||||
$setRequest
|
||||
->setArgument('numbers', $poolName)
|
||||
->setArgument('numbers', $poolID)
|
||||
->setArgument('ranges', $ip_address)
|
||||
);
|
||||
}
|
||||
@ -348,17 +380,17 @@ class Mikrotik
|
||||
public static function setPpoePlan($client, $name, $pool, $rate)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ppp profile print .proplist=name',
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||
if (empty($profileName)) {
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
if (empty($profileID)) {
|
||||
self::addPpoePlan($client, $name, $pool, $rate);
|
||||
} else {
|
||||
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
||||
$client(
|
||||
$setRequest
|
||||
->setArgument('numbers', $profileName)
|
||||
->setArgument('numbers', $profileID)
|
||||
->setArgument('local-address', $pool)
|
||||
->setArgument('remote-address', $pool)
|
||||
->setArgument('rate-limit', $rate)
|
||||
@ -369,15 +401,15 @@ class Mikrotik
|
||||
public static function removePpoePlan($client, $name)
|
||||
{
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ppp profile print .proplist=name',
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
|
||||
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
|
||||
$client(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $profileName)
|
||||
->setArgument('numbers', $profileID)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class Package
|
||||
*/
|
||||
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_only = date("Y-m-d");
|
||||
$time_only = date("H:i:s");
|
||||
@ -106,8 +106,10 @@ class Package
|
||||
// if it same internet plan, expired will extend
|
||||
if ($p['validity_unit'] == 'Months') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||
$time = $b['time'];
|
||||
} else if ($p['validity_unit'] == 'Days') {
|
||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||
$time = $b['time'];
|
||||
} else if ($p['validity_unit'] == 'Hrs') {
|
||||
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
|
||||
$date_exp = $datetime[0];
|
||||
@ -150,6 +152,7 @@ class Package
|
||||
} else {
|
||||
if (!$_c['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
Mikrotik::addHotspotUser($client, $p, $c);
|
||||
}
|
||||
|
@ -4,6 +4,33 @@
|
||||
* 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 = '')
|
||||
{
|
||||
if ($msg == '') {
|
||||
@ -47,8 +74,7 @@ function _get($param, $defvalue = '')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
require('system/orm.php');
|
||||
require_once File::pathFixer('system/orm.php');
|
||||
|
||||
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
||||
ORM::configure('username', $db_user);
|
||||
@ -81,15 +107,15 @@ function _notify($msg, $type = 'e')
|
||||
$_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);
|
||||
$ui = new Smarty();
|
||||
$ui->setTemplateDir(['custom' => 'ui/ui_custom/', 'default' => 'ui/ui/']);
|
||||
$ui->addTemplateDir('system/paymentgateway/ui/', 'pg');
|
||||
$ui->addTemplateDir('system/plugin/ui/', 'plugin');
|
||||
$ui->setCompileDir('ui/compiled/');
|
||||
$ui->setConfigDir('ui/conf/');
|
||||
$ui->setCacheDir('ui/cache/');
|
||||
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
|
||||
$ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg');
|
||||
$ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin');
|
||||
$ui->setCompileDir(File::pathFixer('ui/compiled/'));
|
||||
$ui->setConfigDir(File::pathFixer('ui/conf/'));
|
||||
$ui->setCacheDir(File::pathFixer('ui/cache/'));
|
||||
$ui->assign('app_url', APP_URL);
|
||||
$ui->assign('_domain', str_replace('www.', '', parse_url(APP_URL, PHP_URL_HOST)));
|
||||
define('U', APP_URL . '/index.php?_route=');
|
||||
@ -129,40 +155,16 @@ if (isset($_SESSION['notify'])) {
|
||||
include "autoload/Hookers.php";
|
||||
|
||||
// notification message
|
||||
if(file_exists("system/uploads/notifications.json")){
|
||||
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true);
|
||||
if (file_exists(File::pathFixer("system/uploads/notifications.json"))) {
|
||||
$_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
|
||||
foreach (glob("system/plugin/*.php") as $filename) {
|
||||
foreach (glob(File::pathFixer("system/plugin/*.php")) as $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)
|
||||
{
|
||||
@ -281,7 +283,7 @@ $handler = $routes[0];
|
||||
if ($handler == '') {
|
||||
$handler = 'default';
|
||||
}
|
||||
$sys_render = 'system/controllers/' . $handler . '.php';
|
||||
$sys_render = File::pathFixer('system/controllers/' . $handler . '.php');
|
||||
if (file_exists($sys_render)) {
|
||||
$menus = array();
|
||||
// "name" => $name,
|
||||
|
@ -15,9 +15,6 @@ if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
use PEAR2\Net\RouterOS;
|
||||
|
||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||
|
||||
switch ($action) {
|
||||
case 'list':
|
||||
|
@ -53,10 +53,10 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($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();
|
||||
$ui->assign('b', $b);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
run_hook('view_edit_plan'); #HOOK
|
||||
$ui->display('hotspot-edit.tpl');
|
||||
} else {
|
||||
@ -96,6 +96,7 @@ switch ($action) {
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool_expired = _post('pool_expired');
|
||||
$enabled = _post('enabled');
|
||||
|
||||
$msg = '';
|
||||
@ -134,8 +135,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
$d->name_plan = $name;
|
||||
$d->id_bw = $id_bw;
|
||||
@ -151,6 +156,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
@ -176,6 +182,7 @@ switch ($action) {
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool_expired = _post('pool_expired');
|
||||
$enabled = _post('enabled');
|
||||
|
||||
$msg = '';
|
||||
@ -213,6 +220,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
$d->name_plan = $name;
|
||||
@ -228,6 +238,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->pool_expired = $pool_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
@ -260,8 +271,6 @@ switch ($action) {
|
||||
$ui->assign('_title', $_L['PPPOE_Plans']);
|
||||
$d = ORM::for_table('tbl_bandwidth')->find_many();
|
||||
$ui->assign('d', $d);
|
||||
$p = ORM::for_table('tbl_pool')->find_many();
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
run_hook('view_add_ppoe'); #HOOK
|
||||
@ -274,10 +283,10 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_plans')->find_one($id);
|
||||
if ($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();
|
||||
$ui->assign('b', $b);
|
||||
$p = ORM::for_table('tbl_pool')->find_many();
|
||||
$ui->assign('p', $p);
|
||||
$r = ORM::for_table('tbl_routers')->find_many();
|
||||
$ui->assign('r', $r);
|
||||
run_hook('view_edit_ppoe'); #HOOK
|
||||
@ -312,6 +321,7 @@ switch ($action) {
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool = _post('pool_name');
|
||||
$pool_expired = _post('pool_expired');
|
||||
$enabled = _post('enabled');
|
||||
|
||||
$msg = '';
|
||||
@ -348,6 +358,9 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_plans')->create();
|
||||
@ -359,6 +372,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->pool_expired = $pool_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
@ -377,6 +391,7 @@ switch ($action) {
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool = _post('pool_name');
|
||||
$pool_expired = _post('pool_expired');
|
||||
$enabled = _post('enabled');
|
||||
|
||||
$msg = '';
|
||||
@ -414,6 +429,9 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
$d->name_plan = $name;
|
||||
@ -423,6 +441,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->pool_expired = $pool_expired;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
|
@ -31,8 +31,14 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
$lan = ORM::for_table('tbl_language')->find_many();
|
||||
$ui->assign('lan', $lan);
|
||||
$folders = [];
|
||||
$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();
|
||||
$ui->assign('tlist', $timezonelist);
|
||||
|
@ -4,10 +4,34 @@
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
**/
|
||||
|
||||
require('../config.php');
|
||||
require('orm.php');
|
||||
// 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(__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';
|
||||
include "autoload/Hookers.php";
|
||||
|
||||
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
||||
ORM::configure('username', $db_user);
|
||||
@ -16,44 +40,17 @@ 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);
|
||||
if (file_exists("uploads/notifications.json")) {
|
||||
$_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
|
||||
foreach (glob("plugin/*.php") as $filename) {
|
||||
foreach (glob(File::pathFixer("plugin/*.php")) as $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();
|
||||
foreach ($result as $value) {
|
||||
$config[$value['setting']] = $value['value'];
|
||||
@ -66,7 +63,7 @@ date_default_timezone_set($config['timezone']);
|
||||
$textExpired = Lang::getNotifText('expired');
|
||||
|
||||
$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
|
||||
|
||||
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();
|
||||
$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();
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||
|
||||
if (!$_c['radius_mode']) {
|
||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||
Mikrotik::setHotspotLimitUptime($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']);
|
||||
}
|
||||
//update database user dengan status off
|
||||
@ -92,7 +94,6 @@ foreach ($d as $ds) {
|
||||
|
||||
// autorenewal from deposit
|
||||
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 (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
|
||||
// if success, then get the balance
|
||||
@ -106,10 +107,10 @@ foreach ($d as $ds) {
|
||||
"\nRouter: " . $router_name .
|
||||
"\nPrice: " . $p['price']);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
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";
|
||||
}
|
||||
} 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();
|
||||
$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();
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||
|
||||
if (!$_c['radius_mode']) {
|
||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||
Mikrotik::disablePpoeUser($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']);
|
||||
}
|
||||
|
||||
@ -135,12 +141,15 @@ foreach ($d as $ds) {
|
||||
|
||||
// autorenewal from deposit
|
||||
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 (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
|
||||
// if success, then get the balance
|
||||
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 {
|
||||
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'] .
|
||||
"\nRouter: " . $router_name .
|
||||
"\nPrice: " . $p['price']);
|
||||
|
@ -7,46 +7,21 @@
|
||||
* 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
|
||||
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';
|
||||
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('autoload' . DIRECTORY_SEPARATOR . $class . '.php')) {
|
||||
include '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';
|
||||
} else {
|
||||
$class = str_replace("\\", DIRECTORY_SEPARATOR, $class);
|
||||
if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . $class . '.php'))
|
||||
@ -54,9 +29,30 @@ function _autoloader($class)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
foreach ($result as $value) {
|
||||
$config[$value['setting']] = $value['value'];
|
||||
|
@ -385,3 +385,5 @@ $_L['Received_Balance'] = 'Received Balance';
|
||||
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
|
||||
$_L['Minimum_Transfer'] = 'Minimum Transfer';
|
||||
$_L['Company_Logo'] = 'Company Logo';
|
||||
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
|
||||
$_L['Expired_IP_Pool'] = 'Expired IP Pool';
|
||||
|
@ -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['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['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';
|
||||
|
@ -340,4 +340,5 @@ $_L['Invoice'] = 'Invoice';
|
||||
$_L['Country_Code_Phone'] = 'Country Code Phone';
|
||||
$_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['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';
|
||||
|
@ -7,11 +7,12 @@ if(php_sapi_name() !== 'cli'){
|
||||
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
|
||||
}
|
||||
|
||||
require(__DIR__.'/../config.php');
|
||||
require(__DIR__.'/orm.php');
|
||||
require_once __DIR__.File::pathFixer('/../config.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;
|
||||
require_once 'autoload/PEAR2/Autoload.php';
|
||||
|
||||
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
||||
ORM::configure('username', $db_user);
|
||||
|
@ -17,5 +17,9 @@
|
||||
"2023.8.28" : [
|
||||
"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`;"
|
||||
],
|
||||
"2023.9.5" : [
|
||||
"DROP TABLE `tbl_language`;",
|
||||
"ALTER TABLE `tbl_plans` ADD `pool_expired` varchar(40) NOT NULL DEFAULT '' AFTER `pool`;"
|
||||
]
|
||||
}
|
@ -45,18 +45,16 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<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">
|
||||
{foreach $lan as $lans}
|
||||
<option value="{$lans['folder']}" {if $_c['language'] eq $lans['folder']}
|
||||
selected="selected" {/if}>{$lans['name']}</option>
|
||||
<option value="{$lans}" {if $_c['language'] eq $lans}
|
||||
selected="selected" {/if}>{$lans}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<a href="{$_url}settings/language" type="button"
|
||||
class="btn btn-line-success btn-icon-inline"><i
|
||||
class="ion ion-android-add"></i>{$_L['Add_Language']}</a>
|
||||
<div class="col-md-4 help-block">
|
||||
To add new Language, just add the folder, it will automatically detected
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -78,8 +76,8 @@
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="currency_code" name="currency_code"
|
||||
value="{$_c['currency_code']}">
|
||||
<span class="help-block">{$_L['currency_help']}</span>
|
||||
</div>
|
||||
<span class="help-block col-md-4">{$_L['currency_help']}</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Country Code Phone')}</label>
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
<option value=''>{$_L['Select_Pool']}</option>
|
||||
{foreach $d as $ds}
|
||||
<option value="{$ds['pool_name']}">{$ds['pool_name']}</option>
|
||||
{/foreach}
|
@ -1,4 +1,4 @@
|
||||
<option value="">Select Routers</option>
|
||||
<option value=''>{$_L['Select_Routers']}</option>
|
||||
{foreach $d as $ds}
|
||||
<option value="{$ds['name']}">{$ds['name']}</option>
|
||||
{/foreach}
|
@ -142,8 +142,7 @@
|
||||
<div class="box-footer" id="latestVersion">ver</div>
|
||||
<div class="box-footer">
|
||||
<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
|
||||
Version</a>
|
||||
<a href="./update.php" class="btn btn-success btn-sm btn-block">Install Latest Version</a>
|
||||
<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>
|
||||
</div>
|
||||
|
@ -112,7 +112,8 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<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}
|
||||
<option value="{$rs['name']}">{$rs['name']}</option>
|
||||
{/foreach}
|
||||
@ -120,9 +121,16 @@
|
||||
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
|
||||
</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="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>
|
||||
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
|
@ -114,9 +114,20 @@
|
||||
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
|
||||
</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="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>
|
||||
Or <a href="{$_url}services/hotspot">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
|
@ -35,6 +35,7 @@
|
||||
<th>{$_L['Data_Limit']}</th>
|
||||
<th>{$_L['Plan_Validity']}</th>
|
||||
<th>{$_L['Routers']}</th>
|
||||
<th>{Lang::T('Expired IP Pool')}</th>
|
||||
<th>{$_L['Manage']}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -49,6 +50,7 @@
|
||||
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
|
||||
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
||||
<td>{$ds['routers']}</td>
|
||||
<td>{$ds['pool_expired']}</td>
|
||||
<td>
|
||||
<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>
|
||||
|
@ -60,7 +60,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}routers/add">{$_L['Router_Name']}</a></label>
|
||||
<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}
|
||||
<option value="{$rs['name']}">{$rs['name']}</option>
|
||||
@ -72,14 +72,21 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
Or <a href="{$_url}services/pppoe">{$_L['Cancel']}</a>
|
||||
</div>
|
||||
|
@ -60,9 +60,20 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{$_L['Pool']}</a></label>
|
||||
<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}
|
||||
<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}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<th>{$_L['Plan_Price']}</th>
|
||||
<th>{$_L['Plan_Validity']}</th>
|
||||
<th>{$_L['Pool']}</th>
|
||||
<th>{Lang::T('Expired IP Pool')}</th>
|
||||
<th>{$_L['Routers']}</th>
|
||||
<th>{$_L['Manage']}</th>
|
||||
</tr>
|
||||
@ -44,6 +45,7 @@
|
||||
<td>{Lang::moneyFormat($ds['price'])}</td>
|
||||
<td>{$ds['validity']} {$ds['validity_unit']}</td>
|
||||
<td>{$ds['pool']}</td>
|
||||
<td>{$ds['pool_expired']}</td>
|
||||
<td>{$ds['routers']}</td>
|
||||
<td>
|
||||
<a href="{$_url}services/pppoe-edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
|
||||
|
@ -14,7 +14,7 @@ $(document).ready(function () {
|
||||
$('#TimeLimit').show();
|
||||
$('#DataLimit').show();
|
||||
}
|
||||
|
||||
|
||||
if ($('#Unlimited').is(':checked')) {
|
||||
$('#Type').hide();
|
||||
$('#TimeLimit').hide();
|
||||
@ -26,12 +26,12 @@ $(document).ready(function () {
|
||||
if ($('#Hotspot').is(':checked')) {
|
||||
$('#p').hide();
|
||||
$('#h').show();
|
||||
}
|
||||
}
|
||||
if ($('#PPPOE').is(':checked')) {
|
||||
$('#p').show();
|
||||
$('#h').hide();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
$("#Hotspot").prop("checked", true).change();
|
||||
@ -48,6 +48,7 @@ $(document).ready(function(){
|
||||
cache: false,
|
||||
success: function(msg){
|
||||
$("#pool_name").html(msg);
|
||||
$("#pool_expired").html(msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -62,10 +63,10 @@ $(function() {
|
||||
dataType: "html",
|
||||
url: "index.php?_route=autoload/server",
|
||||
success: function(msg){
|
||||
$("#server").html(msg);
|
||||
$("#server").html(msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#server").change(getAjaxAlamat);
|
||||
function getAjaxAlamat(){
|
||||
var server = $("#server").val();
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "2023.9.1"
|
||||
"version": "2023.9.6"
|
||||
}
|
Reference in New Issue
Block a user