forked from kevinowino869/mitrobill
Change to devices
This commit is contained in:
@ -13,46 +13,46 @@ use PEAR2\Net\RouterOS;
|
||||
class MikrotikHotspot
|
||||
{
|
||||
|
||||
function connect_customer($customer, $plan)
|
||||
function add_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $customer['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $customer['username']);
|
||||
Mikrotik::addHotspotUser($client, $plan, $customer);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$this->removeHotspotUser($client, $customer['username']);
|
||||
$this->removeHotspotActiveUser($client, $customer['username']);
|
||||
$this->addHotspotUser($client, $plan, $customer);
|
||||
}
|
||||
|
||||
function disconnect_customer($customer, $plan)
|
||||
function remove_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (!empty($p['pool_expired'])) {
|
||||
Mikrotik::setHotspotUserPackage($client, $customer['username'], 'EXPIRED NUXBILL ' . $p['pool_expired']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (!empty($plan['pool_expired'])) {
|
||||
$this->setHotspotUserPackage($client, $customer['username'], 'EXPIRED NUXBILL ' . $plan['pool_expired']);
|
||||
} else {
|
||||
Mikrotik::removeHotspotUser($client, $customer['username']);
|
||||
$this->removeHotspotUser($client, $customer['username']);
|
||||
}
|
||||
Mikrotik::removeHotspotActiveUser($client, $customer['username']);
|
||||
$this->removeHotspotActiveUser($client, $customer['username']);
|
||||
}
|
||||
|
||||
function change_customer($tur, $customer, $plan)
|
||||
function change_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client, $customer['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $customer['username']);
|
||||
Mikrotik::addHotspotUser($client, $plan, $customer);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$this->removeHotspotUser($client, $customer['username']);
|
||||
$this->removeHotspotActiveUser($client, $customer['username']);
|
||||
$this->addHotspotUser($client, $plan, $customer);
|
||||
}
|
||||
|
||||
function add_plan($plan)
|
||||
@ -62,7 +62,7 @@ class MikrotikHotspot
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
@ -83,6 +83,60 @@ class MikrotikHotspot
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
'/ip hotspot 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;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($router_name);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$addRequest = new RouterOS\Request('/ip/hotspot/active/login');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
->setArgument('user', $customer['username'])
|
||||
->setArgument('password', $customer['password'])
|
||||
->setArgument('ip', $ip)
|
||||
->setArgument('mac-address', $mac_address)
|
||||
);
|
||||
}
|
||||
|
||||
function disconnect_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(
|
||||
'/ip hotspot active print',
|
||||
RouterOS\Query::where('user', $customer['username'])
|
||||
);
|
||||
$id = $client->sendSync($printRequest)->getProperty('.id');
|
||||
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
|
||||
$client->sendSync(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $id)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function update_plan($old_plan, $new_plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
@ -90,26 +144,27 @@ class MikrotikHotspot
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($new_plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if ($new_plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($new_plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $new_plan['rate_up'] . $unitup . "/" . $new_plan['rate_down'] . $unitdown;
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $old_plan['name_plan'])
|
||||
);
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
if (empty($profileID)) {
|
||||
Mikrotik::addHotspotPlan($client, $new_plan['name_plan'], $new_plan['shared_users'], $rate);
|
||||
$this->add_plan($new_plan);
|
||||
} else {
|
||||
if ($new_plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($new_plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $new_plan['rate_up'] . $unitup . "/" . $new_plan['rate_down'] . $unitdown;
|
||||
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
||||
$client->sendSync(
|
||||
$setRequest
|
||||
@ -128,7 +183,7 @@ class MikrotikHotspot
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $plan['name_plan'])
|
||||
@ -141,18 +196,6 @@ class MikrotikHotspot
|
||||
);
|
||||
}
|
||||
|
||||
function add_pool($pool){
|
||||
// Hotspot no need pool
|
||||
}
|
||||
|
||||
function update_pool($old_pool, $new_pool){
|
||||
// Hotspot no need pool
|
||||
}
|
||||
|
||||
function remove_pool($pool){
|
||||
// Hotspot no need pool
|
||||
}
|
||||
|
||||
function info($name)
|
||||
{
|
||||
return ORM::for_table('tbl_routers')->where('name', $name)->find_one();
|
||||
@ -168,53 +211,6 @@ class MikrotikHotspot
|
||||
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
|
||||
}
|
||||
|
||||
function isUserLogin($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot active print',
|
||||
RouterOS\Query::where('user', $username)
|
||||
);
|
||||
return $client->sendSync($printRequest)->getProperty('.id');
|
||||
}
|
||||
|
||||
function logMeIn($client, $user, $pass, $ip, $mac)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$addRequest = new RouterOS\Request('/ip/hotspot/active/login');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
->setArgument('user', $user)
|
||||
->setArgument('password', $pass)
|
||||
->setArgument('ip', $ip)
|
||||
->setArgument('mac-address', $mac)
|
||||
);
|
||||
}
|
||||
|
||||
function logMeOut($client, $user)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot active print',
|
||||
RouterOS\Query::where('user', $user)
|
||||
);
|
||||
$id = $client->sendSync($printRequest)->getProperty('.id');
|
||||
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
|
||||
$client->sendSync(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $id)
|
||||
);
|
||||
}
|
||||
|
||||
function removeHotspotUser($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
@ -351,19 +347,6 @@ class MikrotikHotspot
|
||||
$client->sendSync($removeRequest);
|
||||
}
|
||||
|
||||
function sendSMS($client, $to, $message)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$smsRequest = new RouterOS\Request('/tool sms send');
|
||||
$smsRequest
|
||||
->setArgument('phone-number', $to)
|
||||
->setArgument('message', $message);
|
||||
$client->sendSync($smsRequest);
|
||||
}
|
||||
|
||||
function getIpHotspotUser($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
|
@ -10,73 +10,49 @@
|
||||
|
||||
use PEAR2\Net\RouterOS;
|
||||
|
||||
class MikrotikHotspot
|
||||
class MikrotikPppoe
|
||||
{
|
||||
|
||||
/**
|
||||
* Establishes a connection between a MikroTik router and a customer.
|
||||
*
|
||||
* This function takes two parameters: $routers and $customer.
|
||||
*
|
||||
* @param array $routers An array containing information about the MikroTik routers.
|
||||
* This can include IP addresses or connection details.
|
||||
* @param mixed $customer An object or array representing a specific customer.
|
||||
* This can contain relevant information about the customer,
|
||||
* such as their username or account details.
|
||||
* @return void
|
||||
*/
|
||||
function connect_customer($customer, $plan)
|
||||
function add_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client, $customer['username']);
|
||||
Mikrotik::removePpoeActive($client, $customer['username']);
|
||||
Mikrotik::addPpoeUser($client, $plan, $customer);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$this->removePpoeUser($client, $customer['username']);
|
||||
$this->removePpoeActive($client, $customer['username']);
|
||||
$this->addPpoeUser($client, $plan, $customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects a customer from a MikroTik router.
|
||||
*
|
||||
* This function takes two parameters: $routers and $customer.
|
||||
*
|
||||
* @param array $routers An array containing information about the MikroTik routers.
|
||||
* This can include IP addresses or connection details.
|
||||
* @param mixed $customer An object or array representing a specific customer.
|
||||
* This can contain relevant information about the customer,
|
||||
* such as their username or account details.
|
||||
* @return void
|
||||
*/
|
||||
function disconnect_customer($customer, $plan)
|
||||
function remove_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (!empty($p['pool_expired'])) {
|
||||
Mikrotik::setPpoeUserPlan($client, $customer['username'], 'EXPIRED NUXBILL ' . $p['pool_expired']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if (!empty($plan['pool_expired'])) {
|
||||
$this->setPpoeUserPlan($client, $customer['username'], 'EXPIRED NUXBILL ' . $plan['pool_expired']);
|
||||
} else {
|
||||
Mikrotik::removePpoeUser($client, $customer['username']);
|
||||
$this->removePpoeUser($client, $customer['username']);
|
||||
}
|
||||
Mikrotik::removePpoeActive($client, $customer['username']);
|
||||
$this->removePpoeActive($client, $customer['username']);
|
||||
}
|
||||
|
||||
function change_customer($tur, $customer, $plan)
|
||||
function change_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client, $customer['username']);
|
||||
Mikrotik::removePpoeActive($client, $customer['username']);
|
||||
Mikrotik::addPpoeUser($client, $plan, $customer);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$this->removePpoeUser($client, $customer['username']);
|
||||
$this->removePpoeActive($client, $customer['username']);
|
||||
$this->addPpoeUser($client, $plan, $customer);
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +63,10 @@ class MikrotikHotspot
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
|
||||
//Add Pool
|
||||
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
@ -99,48 +78,51 @@ class MikrotikHotspot
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
||||
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
->setArgument('name', $plan['name_plan'])
|
||||
->setArgument('shared-users', $plan['shared_users'])
|
||||
->setArgument('local-address', $plan['pool'])
|
||||
->setArgument('remote-address', $plan['pool'])
|
||||
->setArgument('rate-limit', $rate)
|
||||
);
|
||||
}
|
||||
|
||||
function update_plan($old_name, $plan)
|
||||
function update_plan($old_name, $new_plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||
$mikrotik = $this->info($new_plan['routers']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $old_name)
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $old_name['name_plan'])
|
||||
);
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
if (empty($profileID)) {
|
||||
Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
|
||||
$this->add_plan($new_plan);
|
||||
} else {
|
||||
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
||||
if ($new_plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($new_plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $new_plan['rate_up'] . $unitup . "/" . $new_plan['rate_down'] . $unitdown;
|
||||
|
||||
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
||||
$client->sendSync(
|
||||
$setRequest
|
||||
->setArgument('numbers', $profileID)
|
||||
->setArgument('name', $plan['name_plan'])
|
||||
->setArgument('shared-users', $plan['shared_users'])
|
||||
->setArgument('local-address', $new_plan['pool'])
|
||||
->setArgument('remote-address', $new_plan['pool'])
|
||||
->setArgument('rate-limit', $rate)
|
||||
);
|
||||
}
|
||||
@ -153,13 +135,14 @@ class MikrotikHotspot
|
||||
return;
|
||||
}
|
||||
$mikrotik = $this->info($plan['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot user profile print .proplist=.id',
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $plan['name_plan'])
|
||||
);
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
|
||||
|
||||
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
|
||||
$client->sendSync(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $profileID)
|
||||
@ -172,7 +155,7 @@ class MikrotikHotspot
|
||||
return null;
|
||||
}
|
||||
$mikrotik = $this->info($pool['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$addRequest = new RouterOS\Request('/ip/pool/add');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
@ -187,7 +170,7 @@ class MikrotikHotspot
|
||||
return null;
|
||||
}
|
||||
$mikrotik = $this->info($new_pool['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip pool print .proplist=.id',
|
||||
RouterOS\Query::where('name', $old_pool['pool_name'])
|
||||
@ -212,7 +195,7 @@ class MikrotikHotspot
|
||||
return null;
|
||||
}
|
||||
$mikrotik = $this->info($pool['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip pool print .proplist=.id',
|
||||
RouterOS\Query::where('name', $pool['pool_name'])
|
||||
@ -225,6 +208,22 @@ class MikrotikHotspot
|
||||
);
|
||||
}
|
||||
|
||||
function connect_customer($customer, $ip, $mac_address, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function disconnect_customer($customer, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function info($name)
|
||||
{
|
||||
return ORM::for_table('tbl_routers')->where('name', $name)->find_one();
|
||||
@ -240,34 +239,6 @@ class MikrotikHotspot
|
||||
return new RouterOS\Client($iport[0], $user, $pass, ($iport[1]) ? $iport[1] : null);
|
||||
}
|
||||
|
||||
function isUserLogin($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ip hotspot active print',
|
||||
RouterOS\Query::where('user', $username)
|
||||
);
|
||||
return $client->sendSync($printRequest)->getProperty('.id');
|
||||
}
|
||||
|
||||
function logMeIn($client, $user, $pass, $ip, $mac)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$addRequest = new RouterOS\Request('/ip/hotspot/active/login');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
->setArgument('user', $user)
|
||||
->setArgument('password', $pass)
|
||||
->setArgument('ip', $ip)
|
||||
->setArgument('mac-address', $mac)
|
||||
);
|
||||
}
|
||||
function removePpoeUser($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
@ -355,79 +326,6 @@ class MikrotikHotspot
|
||||
$client->sendSync($removeRequest);
|
||||
}
|
||||
|
||||
function addPpoePlan($client, $name, $pool, $rate)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
||||
$client->sendSync(
|
||||
$addRequest
|
||||
->setArgument('name', $name)
|
||||
->setArgument('local-address', $pool)
|
||||
->setArgument('remote-address', $pool)
|
||||
->setArgument('rate-limit', $rate)
|
||||
);
|
||||
}
|
||||
|
||||
function setPpoePlan($client, $name, $pool, $rate)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
if (empty($profileID)) {
|
||||
self::addPpoePlan($client, $name, $pool, $rate);
|
||||
} else {
|
||||
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
||||
$client->sendSync(
|
||||
$setRequest
|
||||
->setArgument('numbers', $profileID)
|
||||
->setArgument('local-address', $pool)
|
||||
->setArgument('remote-address', $pool)
|
||||
->setArgument('rate-limit', $rate)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function removePpoePlan($client, $name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$printRequest = new RouterOS\Request(
|
||||
'/ppp profile print .proplist=.id',
|
||||
RouterOS\Query::where('name', $name)
|
||||
);
|
||||
$profileID = $client->sendSync($printRequest)->getProperty('.id');
|
||||
|
||||
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
|
||||
$client->sendSync(
|
||||
$removeRequest
|
||||
->setArgument('numbers', $profileID)
|
||||
);
|
||||
}
|
||||
|
||||
function sendSMS($client, $to, $message)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
$smsRequest = new RouterOS\Request('/tool sms send');
|
||||
$smsRequest
|
||||
->setArgument('phone-number', $to)
|
||||
->setArgument('message', $message);
|
||||
$client->sendSync($smsRequest);
|
||||
}
|
||||
|
||||
function getIpHotspotUser($client, $username)
|
||||
{
|
||||
global $_app_stage;
|
||||
|
@ -1,37 +1,417 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
* by https://t.me/ibnux
|
||||
*
|
||||
* This is Core, don't modification except you want to contribute
|
||||
* better create new plugin
|
||||
**/
|
||||
|
||||
class Radius {
|
||||
|
||||
/**
|
||||
* Establishes a connection between a MikroTik router and a customer.
|
||||
*
|
||||
* This function takes two parameters: $routers and $customer.
|
||||
*
|
||||
* @param array $routers An array containing information about the MikroTik routers.
|
||||
* This can include IP addresses or connection details.
|
||||
* @param mixed $customer An object or array representing a specific customer.
|
||||
* This can contain relevant information about the customer,
|
||||
* such as their username or account details.
|
||||
* @return void
|
||||
*/
|
||||
function connect_customer($routers, $customer){
|
||||
function add_customer($customer, $plan)
|
||||
{
|
||||
global $b;
|
||||
$this->customerAddPlan($customer, $plan, $b['expiration'] . '' . $b['time']);
|
||||
}
|
||||
|
||||
function remove_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
if (empty($plan['pool_expired'])) {
|
||||
$this->customerDeactivate($customer['username']);
|
||||
} else {
|
||||
$this->upsertCustomerAttr($customer['username'], 'Framed-Pool', $plan['pool_expired'], ':=');
|
||||
$this->disconnectCustomer($customer['username']);
|
||||
}
|
||||
}
|
||||
|
||||
function change_customer($customer, $plan)
|
||||
{
|
||||
$this->customerUpsert($customer, $plan);
|
||||
}
|
||||
|
||||
function add_plan($plan)
|
||||
{
|
||||
if ($plan['rate_down_unit'] == 'Kbps') {
|
||||
$unitdown = 'K';
|
||||
} else {
|
||||
$unitdown = 'M';
|
||||
}
|
||||
if ($plan['rate_up_unit'] == 'Kbps') {
|
||||
$unitup = 'K';
|
||||
} else {
|
||||
$unitup = 'M';
|
||||
}
|
||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||
|
||||
$rates = explode('/', $rate);
|
||||
##burst fixed
|
||||
if (strpos($rate, ' ')) {
|
||||
$ratos = $rates[0] . '/' . $rates[1] . ' ' . $rates[2] . '/' . $rates[3] . '/' . $rates[4] . '/' . $rates[5] . '/' . $rates[6];
|
||||
} else {
|
||||
$ratos = $rates[0] . '/' . $rates[1];
|
||||
}
|
||||
|
||||
$this->upsertPackage($plan['id'], 'Ascend-Data-Rate', $rates[1], ':=');
|
||||
$this->upsertPackage($plan['id'], 'Ascend-Xmit-Rate', $rates[0], ':=');
|
||||
$this->upsertPackage($plan['id'], 'Mikrotik-Rate-Limit', $ratos, ':=');
|
||||
}
|
||||
|
||||
function update_plan($old_name, $plan)
|
||||
{
|
||||
$this->add_plan($plan);
|
||||
}
|
||||
|
||||
function remove_plan($plan)
|
||||
{
|
||||
// Delete Plan
|
||||
$this->getTablePackage()->where_equal('plan_id', "plan_" . $plan['id'])->delete_many();
|
||||
// Reset User Plan
|
||||
$c = $this->getTableUserPackage()->where_equal('groupname', "plan_" . $plan['id'])->findMany();
|
||||
if ($c) {
|
||||
foreach ($c as $u) {
|
||||
$u->groupname = '';
|
||||
$u->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function online_customer($customer, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function connect_customer($customer, $ip, $mac_address, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function disconnect_customer($customer, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTableNas()
|
||||
{
|
||||
return ORM::for_table('nas', 'radius');
|
||||
}
|
||||
public function getTableAcct()
|
||||
{
|
||||
return ORM::for_table('radacct', 'radius');
|
||||
}
|
||||
public function getTableCustomer()
|
||||
{
|
||||
return ORM::for_table('radcheck', 'radius');
|
||||
}
|
||||
|
||||
public function getTableCustomerAttr()
|
||||
{
|
||||
return ORM::for_table('radreply', 'radius');
|
||||
}
|
||||
|
||||
public function getTablePackage()
|
||||
{
|
||||
return ORM::for_table('radgroupreply', 'radius');
|
||||
}
|
||||
|
||||
public function getTableUserPackage()
|
||||
{
|
||||
return ORM::for_table('radusergroup', 'radius');
|
||||
}
|
||||
|
||||
public function nasAdd($name, $ip, $ports, $secret, $routers = "", $description = "", $type = 'other', $server = null, $community = null)
|
||||
{
|
||||
$n = $this->getTableNas()->create();
|
||||
$n->nasname = $ip;
|
||||
$n->shortname = $name;
|
||||
$n->type = $type;
|
||||
$n->ports = $ports;
|
||||
$n->secret = $secret;
|
||||
$n->description = $description;
|
||||
$n->server = $server;
|
||||
$n->community = $community;
|
||||
$n->routers = $routers;
|
||||
$n->save();
|
||||
return $n->id();
|
||||
}
|
||||
|
||||
public function nasUpdate($id, $name, $ip, $ports, $secret, $routers = "", $description = "", $type = 'other', $server = null, $community = null)
|
||||
{
|
||||
$n = $this->getTableNas()->find_one($id);
|
||||
if (empty($n)) {
|
||||
return false;
|
||||
}
|
||||
$n->nasname = $ip;
|
||||
$n->shortname = $name;
|
||||
$n->type = $type;
|
||||
$n->ports = $ports;
|
||||
$n->secret = $secret;
|
||||
$n->description = $description;
|
||||
$n->server = $server;
|
||||
$n->community = $community;
|
||||
$n->routers = $routers;
|
||||
return $n->save();
|
||||
}
|
||||
|
||||
public function planUpSert($plan_id, $rate, $pool = null)
|
||||
{
|
||||
$rates = explode('/', $rate);
|
||||
##burst fixed
|
||||
if (strpos($rate, ' ')) {
|
||||
$ratos = $rates[0] . '/' . $rates[1] . ' ' . $rates[2] . '/' . $rates[3] . '/' . $rates[4] . '/' . $rates[5] . '/' . $rates[6];
|
||||
} else {
|
||||
$ratos = $rates[0] . '/' . $rates[1];
|
||||
}
|
||||
|
||||
$this->upsertPackage($plan_id, 'Ascend-Data-Rate', $rates[1], ':=');
|
||||
$this->upsertPackage($plan_id, 'Ascend-Xmit-Rate', $rates[0], ':=');
|
||||
$this->upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $ratos, ':=');
|
||||
// if ($pool != null) {
|
||||
// $this->upsertPackage($plan_id, 'Framed-Pool', $pool, ':=');
|
||||
// }
|
||||
}
|
||||
|
||||
public function customerChangeUsername($from, $to)
|
||||
{
|
||||
$c = $this->getTableCustomer()->where_equal('username', $from)->findMany();
|
||||
if ($c) {
|
||||
foreach ($c as $u) {
|
||||
$u->username = $to;
|
||||
$u->save();
|
||||
}
|
||||
}
|
||||
$c = $this->getTableUserPackage()->where_equal('username', $from)->findMany();
|
||||
if ($c) {
|
||||
foreach ($c as $u) {
|
||||
$u->username = $to;
|
||||
$u->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function customerDeactivate($username, $radiusDisconnect = true)
|
||||
{ {
|
||||
global $radius_pass;
|
||||
$r = $this->getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', 'Cleartext-Password')->findOne();
|
||||
if ($r) {
|
||||
// no need to delete, because it will make ID got higher
|
||||
// we just change the password
|
||||
$r->value = md5(time() . $username . $radius_pass);
|
||||
$r->save();
|
||||
if ($radiusDisconnect)
|
||||
return $this->disconnectCustomer($username);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function customerDelete($username)
|
||||
{
|
||||
$this->getTableCustomer()->where_equal('username', $username)->delete_many();
|
||||
$this->getTableUserPackage()->where_equal('username', $username)->delete_many();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects a customer from a MikroTik router.
|
||||
*
|
||||
* This function takes two parameters: $routers and $customer.
|
||||
*
|
||||
* @param array $routers An array containing information about the MikroTik routers.
|
||||
* This can include IP addresses or connection details.
|
||||
* @param mixed $customer An object or array representing a specific customer.
|
||||
* This can contain relevant information about the customer,
|
||||
* such as their username or account details.
|
||||
* @return void
|
||||
* When add a plan to Customer, use this
|
||||
*/
|
||||
function disconnect_customer($routers, $customer){
|
||||
public function customerAddPlan($customer, $plan, $expired = null)
|
||||
{
|
||||
global $config;
|
||||
if ($this->customerUpsert($customer, $plan)) {
|
||||
$p = $this->getTableUserPackage()->where_equal('username', $customer['username'])->findOne();
|
||||
if ($p) {
|
||||
// if exists
|
||||
$this->delAtribute($this->getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
//$this->delAtribute($this->getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||
$this->delAtribute($this->getTableCustomer(), 'Max-Data', 'username', $customer['username']);
|
||||
$p->groupname = "plan_" . $plan['id'];
|
||||
$p->save();
|
||||
} else {
|
||||
$p = $this->getTableUserPackage()->create();
|
||||
$p->username = $customer['username'];
|
||||
$p->groupname = "plan_" . $plan['id'];
|
||||
$p->priority = 1;
|
||||
$p->save();
|
||||
}
|
||||
if ($plan['type'] == 'Hotspot' && $plan['typebp'] == "Limited") {
|
||||
if ($plan['limit_type'] == "Time_Limit") {
|
||||
if ($plan['time_unit'] == 'Hrs')
|
||||
$timelimit = $plan['time_limit'] * 60 * 60;
|
||||
else
|
||||
$timelimit = $plan['time_limit'] * 60;
|
||||
$this->upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
|
||||
//$this->upsertCustomer($customer['username'], 'Expire-After', $timelimit);
|
||||
} else if ($plan['limit_type'] == "Data_Limit") {
|
||||
if ($plan['data_unit'] == 'GB')
|
||||
$datalimit = $plan['data_limit'] . "000000000";
|
||||
else
|
||||
$datalimit = $plan['data_limit'] . "000000";
|
||||
//$this->upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
// Mikrotik Spesific
|
||||
$this->upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
//$this->upsertCustomer($customer['username'], 'Mikrotik-Total-Limit', $datalimit);
|
||||
} else if ($plan['limit_type'] == "Both_Limit") {
|
||||
if ($plan['time_unit'] == 'Hrs')
|
||||
$timelimit = $plan['time_limit'] * 60 * 60;
|
||||
else
|
||||
$timelimit = $plan['time_limit'] * 60;
|
||||
if ($plan['data_unit'] == 'GB')
|
||||
$datalimit = $plan['data_limit'] . "000000000";
|
||||
else
|
||||
$datalimit = $plan['data_limit'] . "000000";
|
||||
//$this->upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
|
||||
$this->upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
|
||||
// Mikrotik Spesific
|
||||
$this->upsertCustomer($customer['username'], 'Max-Data', $datalimit);
|
||||
//$this->upsertCustomer($customer['username'], 'Mikrotik-Total-Limit', $datalimit);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
//$this->delAtribute($this->getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
|
||||
$this->delAtribute($this->getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
$this->delAtribute($this->getTableCustomer(), 'Max-Data', 'username', $customer['username']);
|
||||
}
|
||||
|
||||
$this->disconnectCustomer($customer['username']);
|
||||
$this->getTableAcct()->where_equal('username', $customer['username'])->delete_many();
|
||||
|
||||
|
||||
// expired user
|
||||
if ($expired != null) {
|
||||
//$this->upsertCustomer($customer['username'], 'access-period', strtotime($expired) - time());
|
||||
$this->upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
|
||||
//$this->upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
|
||||
// Mikrotik Spesific
|
||||
$this->upsertCustomer(
|
||||
$customer['username'],
|
||||
'WISPr-Session-Terminate-Time',
|
||||
date('Y-m-d', strtotime($expired)) . 'T' . date('H:i:s', strtotime($expired)) . Timezone::getTimeOffset($config['timezone'])
|
||||
);
|
||||
} else {
|
||||
$this->delAtribute($this->getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
|
||||
//$this->delAtribute($this->getTableCustomer(), 'access-period', 'username', $customer['username']);
|
||||
//$this->delAtribute($this->getTableCustomer(), 'expiration', 'username', $customer['username']);
|
||||
}
|
||||
|
||||
if ($plan['type'] == 'PPPOE') {
|
||||
$this->upsertCustomerAttr($customer['username'], 'Framed-Pool', $plan['pool'], ':=');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function customerUpsert($customer, $plan)
|
||||
{
|
||||
if ($plan['type'] == 'PPPOE') {
|
||||
$this->upsertCustomer($customer['username'], 'Cleartext-Password', (empty($customer['pppoe_password'])) ? $customer['password'] : $customer['pppoe_password']);
|
||||
} else {
|
||||
$this->upsertCustomer($customer['username'], 'Cleartext-Password', $customer['password']);
|
||||
}
|
||||
$this->upsertCustomer($customer['username'], 'Simultaneous-Use', ($plan['type'] == 'PPPOE') ? 1 : $plan['shared_users']);
|
||||
// Mikrotik Spesific
|
||||
$this->upsertCustomer($customer['username'], 'Port-Limit', ($plan['type'] == 'PPPOE') ? 1 : $plan['shared_users']);
|
||||
$this->upsertCustomer($customer['username'], 'Mikrotik-Wireless-Comment', $customer['fullname']);
|
||||
return true;
|
||||
}
|
||||
|
||||
private function delAtribute($tabel, $attribute, $key, $value)
|
||||
{
|
||||
$r = $tabel->where_equal($key, $value)->whereEqual('attribute', $attribute)->findOne();
|
||||
if ($r) $r->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert or update existing plan
|
||||
*/
|
||||
private function upsertPackage($plan_id, $attr, $value, $op = ':=')
|
||||
{
|
||||
$r = $this->getTablePackage()->where_equal('plan_id', $plan_id)->whereEqual('attribute', $attr)->find_one();
|
||||
if (!$r) {
|
||||
$r = $this->getTablePackage()->create();
|
||||
$r->groupname = "plan_" . $plan_id;
|
||||
$r->plan_id = $plan_id;
|
||||
}
|
||||
$r->attribute = $attr;
|
||||
$r->op = $op;
|
||||
$r->value = $value;
|
||||
return $r->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* To insert or update existing customer
|
||||
*/
|
||||
public function upsertCustomer($username, $attr, $value, $op = ':=')
|
||||
{
|
||||
$r = $this->getTableCustomer()->where_equal('username', $username)->whereEqual('attribute', $attr)->find_one();
|
||||
if (!$r) {
|
||||
$r = $this->getTableCustomer()->create();
|
||||
$r->username = $username;
|
||||
}
|
||||
$r->attribute = $attr;
|
||||
$r->op = $op;
|
||||
$r->value = $value;
|
||||
return $r->save();
|
||||
}
|
||||
/**
|
||||
* To insert or update existing customer Attribute
|
||||
*/
|
||||
public function upsertCustomerAttr($username, $attr, $value, $op = ':=')
|
||||
{
|
||||
$r = $this->getTableCustomerAttr()->where_equal('username', $username)->whereEqual('attribute', $attr)->find_one();
|
||||
if (!$r) {
|
||||
$r = $this->getTableCustomerAttr()->create();
|
||||
$r->username = $username;
|
||||
}
|
||||
$r->attribute = $attr;
|
||||
$r->op = $op;
|
||||
$r->value = $value;
|
||||
return $r->save();
|
||||
}
|
||||
|
||||
public function disconnectCustomer($username)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Fix loop to all Nas but still detecting Hotspot Multylogin from other Nas
|
||||
*/
|
||||
$act = ORM::for_table('radacct')->where_raw("acctstoptime IS NULL")->where('username', $username)->find_one();
|
||||
$nas = $this->getTableNas()->where('nasname', $act['nasipaddress'])->find_many();
|
||||
$count = count($nas) * 15;
|
||||
set_time_limit($count);
|
||||
$result = [];
|
||||
foreach ($nas as $n) {
|
||||
$port = 3799;
|
||||
if (!empty($n['ports'])) {
|
||||
$port = $n['ports'];
|
||||
}
|
||||
$result[] = $n['nasname'] . ': ' . @shell_exec("echo 'User-Name = $username,Framed-IP-Address = " . $act['framedipaddress'] . "' | radclient -x " . trim($n['nasname']) . ":$port disconnect '" . $n['secret'] . "'");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ just follow the template
|
||||
|
||||
class FileName {
|
||||
|
||||
function connect_customer($customer, $plan)
|
||||
function add_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
@ -15,7 +15,7 @@ class FileName {
|
||||
}
|
||||
}
|
||||
|
||||
function disconnect_customer($customer, $plan)
|
||||
function remove_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
@ -23,7 +23,7 @@ class FileName {
|
||||
}
|
||||
}
|
||||
|
||||
function change_customer($tur, $customer, $plan)
|
||||
function change_customer($customer, $plan)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
@ -55,25 +55,29 @@ class FileName {
|
||||
}
|
||||
}
|
||||
|
||||
function add_pool($pool){
|
||||
function online_customer($customer, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function update_pool($old_pool, $new_pool){
|
||||
function connect_customer($customer, $ip, $mac_address, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function remove_pool($pool){
|
||||
function disconnect_customer($customer, $router_name)
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'demo') {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user