mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2024-11-10 17:26:48 +08:00
sync pool to Mikrotik
This commit is contained in:
parent
95a8eaeadb
commit
e494570807
2 changed files with 22 additions and 4 deletions
|
@ -70,6 +70,17 @@ switch ($action) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'sync':
|
||||
$pools = ORM::for_table('tbl_pool')->find_many();
|
||||
$log = '';
|
||||
foreach($pools as $pool){
|
||||
$mikrotik = Mikrotik::info($pool['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPool($client, $pool['pool_name'], $pool['range_ip']);
|
||||
$log .= 'DONE: '.$pool['pool_name'].': '.$pool['range_ip'].'<br>';
|
||||
}
|
||||
r2(U . 'pool/list', 's', $log);
|
||||
break;
|
||||
case 'add-post':
|
||||
$name = _post('name');
|
||||
$ip_address = _post('ip_address');
|
||||
|
|
|
@ -3,7 +3,14 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-hovered mb20 panel-primary">
|
||||
<div class="panel-heading">{$_L['Pool']}</div>
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-primary btn-xs" title="save" href="{$_url}pool/sync"
|
||||
onclick="return confirm('This will sync/send IP Pool to Mikrotik?')"><span
|
||||
class="glyphicon glyphicon-refresh" aria-hidden="true"></span> sync</a>
|
||||
</div>
|
||||
{$_L['Pool']}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
|
||||
<div class="col-md-8">
|
||||
|
@ -45,9 +52,9 @@
|
|||
<td>{$ds['range_ip']}</td>
|
||||
<td>{$ds['routers']}</td>
|
||||
<td align="center">
|
||||
<a href="{$_url}pool/edit/{$ds['id']}"
|
||||
class="btn btn-info btn-xs">{$_L['Edit']}</a>
|
||||
<a href="{$_url}pool/delete/{$ds['id']}" id="{$ds['id']}" onclick="return confirm('{$_L['Delete']}?')"
|
||||
<a href="{$_url}pool/edit/{$ds['id']}" class="btn btn-info btn-xs">{$_L['Edit']}</a>
|
||||
<a href="{$_url}pool/delete/{$ds['id']}" id="{$ds['id']}"
|
||||
onclick="return confirm('{$_L['Delete']}?')"
|
||||
class="btn btn-danger btn-xs">{$_L['Delete']}</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue