From 7a94254df90313de583ae8b89a583e5b3052b105 Mon Sep 17 00:00:00 2001
From: Ibnu Maksum
';
}
if ($msg == '') {
- $id = Radius::nasAdd($shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community);
+ require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
+ (new Radius())->nasAdd($shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community);
if ($id > 0) {
r2(U . 'radius/nas-list/', 's', "NAS Added");
} else {
@@ -113,7 +114,8 @@ switch ($action) {
$type = null;
}
if ($msg == '') {
- if (Radius::nasUpdate($id, $shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community)) {
+ require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
+ if ((new Radius())->nasUpdate($id, $shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community)) {
r2(U . 'radius/list/', 's', "NAS Saved");
} else {
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
diff --git a/system/controllers/settings.php b/system/controllers/settings.php
index 83fcd41e..9596e2f5 100644
--- a/system/controllers/settings.php
+++ b/system/controllers/settings.php
@@ -41,14 +41,6 @@ switch ($action) {
$logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.default.png';
}
$ui->assign('logo', $logo);
- if ($config['radius_enable'] && empty($config['radius_client'])) {
- try {
- $config['radius_client'] = Radius::getClient();
- $ui->assign('_c', $_c);
- } catch (Exception $e) {
- //ignore
- }
- }
$themes = [];
$files = scandir('ui/themes/');
foreach ($files as $file) {
@@ -109,7 +101,8 @@ switch ($action) {
} else {
if ($radius_enable) {
try {
- Radius::getTableNas()->find_many();
+ require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
+ (new Radius())->getTableNas()->find_many();
} catch (Exception $e) {
$ui->assign("error_title", "RADIUS Error");
$ui->assign("error_message", "Radius table not found.
" .
diff --git a/system/devices/MikrotikHotspot.php b/system/devices/MikrotikHotspot.php
index bc6177a7..a2d88c38 100644
--- a/system/devices/MikrotikHotspot.php
+++ b/system/devices/MikrotikHotspot.php
@@ -93,7 +93,7 @@ class MikrotikHotspot
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$printRequest = new RouterOS\Request(
'/ip hotspot active print',
- RouterOS\Query::where('user', $customer['username'])
+ RouterOS\Query::where('name', $customer['username'])
);
return $client->sendSync($printRequest)->getProperty('.id');
}
diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php
index 0eb910d5..2f096c55 100644
--- a/system/devices/MikrotikPppoe.php
+++ b/system/devices/MikrotikPppoe.php
@@ -208,6 +208,23 @@ class MikrotikPppoe
);
}
+
+ function online_customer($customer, $router_name)
+ {
+ global $_app_stage;
+ if ($_app_stage == 'demo') {
+ return;
+ }
+ $mikrotik = $this->info($router_name);
+ $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
+ $printRequest = new RouterOS\Request(
+ '/ppp active print',
+ RouterOS\Query::where('user', $customer['username'])
+ );
+ return $client->sendSync($printRequest)->getProperty('.id');
+ }
+
+
function connect_customer($customer, $ip, $mac_address, $router_name)
{
global $_app_stage;
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index 141a0ab7..37ecad48 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -220,12 +220,6 @@
href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius"
target="_blank">Radius Instructions