Routers can choose not to test it

This commit is contained in:
Ibnu Maksum 2024-06-05 17:36:53 +07:00
parent 8ea853c617
commit 0c8f590f85
No known key found for this signature in database
GPG key ID: 7FC82848810579E5
3 changed files with 19 additions and 6 deletions

View file

@ -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 .= '<b>Radius</b> name is reserved<br>';
}
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;

View file

@ -53,6 +53,12 @@
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label"></label>
<div class="col-md-6">
<label><input type="checkbox" name="testIt" value="yes"> Test Connection</label>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary"

View file

@ -52,6 +52,12 @@
<p class="help-block">{Lang::T('Explain Coverage of router')}</p>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label"></label>
<div class="col-md-6">
<label><input type="checkbox" name="testIt" value="yes"> Test Connection</label>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary" type="submit">{Lang::T('Save Changes')}</button>