check if demo or not

This commit is contained in:
Ibnu Maksum
2024-06-12 15:39:43 +07:00
parent 987e21b3ce
commit 6a4ac274d1
13 changed files with 28 additions and 152 deletions

View File

@ -15,10 +15,6 @@ class MikrotikHotspot
function add_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$this->removeHotspotUser($client, $customer['username']);
@ -28,10 +24,6 @@ class MikrotikHotspot
function remove_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if (!empty($plan['plan_expired'])) {
@ -45,10 +37,6 @@ class MikrotikHotspot
function change_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$this->removeHotspotUser($client, $customer['username']);
@ -58,10 +46,6 @@ class MikrotikHotspot
function add_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$bw = ORM::for_table("tbl_bandwidth")->find_one($plan['id_bw']);
@ -90,10 +74,6 @@ 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(
@ -105,10 +85,6 @@ class MikrotikHotspot
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');
@ -123,10 +99,6 @@ class MikrotikHotspot
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(
@ -144,10 +116,6 @@ class MikrotikHotspot
function update_plan($old_plan, $new_plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($new_plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
@ -187,10 +155,6 @@ class MikrotikHotspot
function remove_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$printRequest = new RouterOS\Request(

View File

@ -15,10 +15,6 @@ class MikrotikPppoe
function add_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$this->removePpoeUser($client, $customer['username']);
@ -28,10 +24,6 @@ class MikrotikPppoe
function remove_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if (!empty($plan['plan_expired'])) {
@ -45,10 +37,6 @@ class MikrotikPppoe
function change_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$this->removePpoeUser($client, $customer['username']);
@ -59,10 +47,6 @@ class MikrotikPppoe
function add_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
@ -96,10 +80,6 @@ class MikrotikPppoe
function update_plan($old_name, $new_plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($new_plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
@ -140,10 +120,6 @@ class MikrotikPppoe
function remove_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
$mikrotik = $this->info($plan['routers']);
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
$printRequest = new RouterOS\Request(
@ -221,10 +197,6 @@ 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(
@ -237,18 +209,10 @@ class MikrotikPppoe
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)

View File

@ -19,10 +19,6 @@ class Radius {
function remove_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
if (empty($plan['plan_expired'])) {
$p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']);
$this->customerDeactivate($customer['username']);
@ -89,26 +85,14 @@ class Radius {
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()

View File

@ -9,74 +9,38 @@ class FileName {
function add_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
function remove_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
function change_customer($customer, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
function add_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
function update_plan($old_name, $plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
function remove_plan($plan)
{
global $_app_stage;
if ($_app_stage == 'demo') {
return;
}
}
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;
}
}
}