From 0c8f590f857dff301e77fc82d62ccb5992744e2b Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 5 Jun 2024 17:36:53 +0700 Subject: [PATCH] Routers can choose not to test it --- system/controllers/routers.php | 13 +++++++------ ui/ui/routers-add.tpl | 6 ++++++ ui/ui/routers-edit.tpl | 6 ++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/system/controllers/routers.php b/system/controllers/routers.php index acade1d3..a507207a 100644 --- a/system/controllers/routers.php +++ b/system/controllers/routers.php @@ -12,9 +12,7 @@ $ui->assign('_system_menu', 'network'); $action = $routes['1']; $ui->assign('_admin', $admin); -use PEAR2\Net\RouterOS; - -require_once 'system/autoload/PEAR2/Autoload.php'; +require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "MikrotikHotspot.php"; if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { _alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard"); @@ -93,8 +91,10 @@ switch ($action) { } if ($msg == '') { - Mikrotik::getClient($ip_address, $username, $password); run_hook('add_router'); #HOOK + if(_post("testIt")){ + (new MikrotikHotspot())->getClient($ip_address, $username, $password); + } $d = ORM::for_table('tbl_routers')->create(); $d->name = $name; $d->ip_address = $ip_address; @@ -152,10 +152,11 @@ switch ($action) { $msg .= 'Radius name is reserved
'; } - if ($msg == '') { - Mikrotik::getClient($ip_address, $username, $password); run_hook('router_edit'); #HOOK + if(_post("testIt")){ + (new MikrotikHotspot())->getClient($ip_address, $username, $password); + } $d->name = $name; $d->ip_address = $ip_address; $d->username = $username; diff --git a/ui/ui/routers-add.tpl b/ui/ui/routers-add.tpl index c9cca4e7..5d2ef2c6 100644 --- a/ui/ui/routers-add.tpl +++ b/ui/ui/routers-add.tpl @@ -53,6 +53,12 @@

{Lang::T('Explain Coverage of router')}

+
+ +
+ +
+
+
+ +
+ +
+