mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
(plugins) add xmlrpc sync to plugins, closes https://github.com/opnsense/core/issues/1224
This commit is contained in:
parent
a5fc46bd97
commit
ad0109f60a
@ -183,3 +183,21 @@ function plugins_configure($hook, $verbose = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function plugins_xmlrpc_sync()
|
||||
{
|
||||
$sync_settings = array();
|
||||
foreach (plugins_scan() as $name => $path) {
|
||||
require_once $path;
|
||||
$func = sprintf('%s_xmlrpc_sync', $name);
|
||||
if (function_exists($func)) {
|
||||
foreach ($func() as $helper) {
|
||||
if (!empty($helper['id']) && !empty($helper['section'])) {
|
||||
$sync_settings[$helper['id']] = $helper;
|
||||
unset($sync_settings[$helper['id']]['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sync_settings;
|
||||
}
|
||||
|
||||
@ -294,6 +294,9 @@ if (isset($config['hasync']) && is_array($config['hasync'])) {
|
||||
$section_cnf['synchronizeschedules'] = 'schedules';
|
||||
$section_cnf['synchronizeshaper'] = 'OPNsense.TrafficShaper';
|
||||
$section_cnf['synchronizecaptiveportal'] = 'OPNsense.captiveportal';
|
||||
foreach (plugins_xmlrpc_sync() as $syncid => $syncconf) {
|
||||
$section_cnf['synchronize'.$syncid] = $syncconf['section'];
|
||||
}
|
||||
|
||||
$sections = array();
|
||||
foreach ($section_cnf as $cnf_key => $cnf_sections) {
|
||||
|
||||
@ -41,7 +41,9 @@ $checkbox_names = array('pfsyncenabled', 'synchronizeusers', 'synchronizeauthser
|
||||
'synchronizestaticroutes', 'synchronizelb', 'synchronizevirtualip',
|
||||
'synchronizednsforwarder','synchronizednsresolver', 'synchronizeshaper', 'synchronizecaptiveportal'
|
||||
);
|
||||
|
||||
foreach (array_keys(plugins_xmlrpc_sync()) as $key) {
|
||||
$checkbox_names[] = 'synchronize'.$key;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig = array();
|
||||
@ -355,6 +357,20 @@ include("head.inc");
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Hook xmlrpc sync plugins -->
|
||||
<?php
|
||||
foreach (plugins_xmlrpc_sync() as $syncid => $synccnf):?>
|
||||
<tr>
|
||||
<td><a id="help_for_synchronize<?=$syncid?>" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=$synccnf['description'];?></td>
|
||||
<td>
|
||||
<input type="checkbox" name="synchronize<?=$syncid?>" value="on" <?=!empty($pconfig['synchronize'.$syncid]) ? "checked=\"checked\"" :"";?> />
|
||||
<div class="hidden" for="help_for_synchronize<?=$syncid?>">
|
||||
<?=$synccnf['help'];?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user