Commit 32d82fd5 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) spacing legacy.inc

parent 1bf660a4
...@@ -39,7 +39,6 @@ function xmlrpc_publishable_legacy() ...@@ -39,7 +39,6 @@ function xmlrpc_publishable_legacy()
'firmware_version_xmlrpc','reboot_xmlrpc','get_notices_xmlrpc' 'firmware_version_xmlrpc','reboot_xmlrpc','get_notices_xmlrpc'
); );
return $publish; return $publish;
} }
...@@ -48,88 +47,86 @@ function xmlrpc_publishable_legacy() ...@@ -48,88 +47,86 @@ function xmlrpc_publishable_legacy()
* configured. * configured.
*/ */
function does_vip_exist($vip) { function does_vip_exist($vip) {
global $config; global $config;
if(!$vip) if(!$vip) {
return false; return false;
}
switch ($vip['mode']) { switch ($vip['mode']) {
case "carp": case "carp":
case "ipalias": case "ipalias":
/* XXX: Make proper checks? */ /* XXX: Make proper checks? */
$realif = get_real_interface($vip['interface']); $realif = get_real_interface($vip['interface']);
if (!does_interface_exist($realif)) { if (!does_interface_exist($realif)) {
return false; return false;
} }
break; break;
case "proxyarp": case "proxyarp":
/* XXX: Implement this */ /* XXX: Implement this */
default: default:
return false; return false;
} }
$ifacedata = pfSense_getall_interface_addresses($realif); $ifacedata = pfSense_getall_interface_addresses($realif);
foreach ($ifacedata as $vipips) { foreach ($ifacedata as $vipips) {
if ($vipips == "{$vip['subnet']}/{$vip['subnet_bits']}") if ($vipips == "{$vip['subnet']}/{$vip['subnet_bits']}") {
return true; return true;
} }
}
return false;
return false;
} }
/* /*
This function was borrowed from a comment on PHP.net at the following URL: This function was borrowed from a comment on PHP.net at the following URL:
http://www.php.net/manual/en/function.array-merge-recursive.php#73843 http://www.php.net/manual/en/function.array-merge-recursive.php#73843
*/ */
function array_merge_recursive_unique($array0, $array1) { function array_merge_recursive_unique($array0, $array1) {
$arrays = func_get_args();
$arrays = func_get_args(); $remains = $arrays;
$remains = $arrays;
// We walk through each arrays and put value in the results (without
// We walk through each arrays and put value in the results (without // considering previous value).
// considering previous value). $result = array();
$result = array();
// loop available array
// loop available array foreach($arrays as $array) {
foreach($arrays as $array) { // The first remaining array is $array. We are processing it. So
// we remove it from remaing arrays.
// The first remaining array is $array. We are processing it. So array_shift($remains);
// we remove it from remaing arrays. // We don't care non array param, like array_merge since PHP 5.0.
array_shift($remains); if(is_array($array)) {
// Loop values
// We don't care non array param, like array_merge since PHP 5.0. foreach($array as $key => $value) {
if(is_array($array)) { if(is_array($value)) {
// Loop values // we gather all remaining arrays that have such key available
foreach($array as $key => $value) { $args = array();
if(is_array($value)) { foreach($remains as $remain) {
// we gather all remaining arrays that have such key available if(array_key_exists($key, $remain)) {
$args = array(); array_push($args, $remain[$key]);
foreach($remains as $remain) { }
if(array_key_exists($key, $remain)) { }
array_push($args, $remain[$key]);
} if(count($args) > 2) {
} // put the recursion
$result[$key] = call_user_func_array(__FUNCTION__, $args);
if(count($args) > 2) { } else {
// put the recursion foreach($value as $vkey => $vval) {
$result[$key] = call_user_func_array(__FUNCTION__, $args); if (!isset($result[$key]) || !is_array($result[$key])) {
} else { $result[$key] = array();
foreach($value as $vkey => $vval) { }
if (!isset($result[$key]) || !is_array($result[$key])) { $result[$key][$vkey] = $vval;
$result[$key] = array(); }
} }
$result[$key][$vkey] = $vval; } else {
} // simply put the value
} $result[$key] = $value;
} else { }
// simply put the value }
$result[$key] = $value; }
} }
} return $result;
}
}
return $result;
} }
...@@ -146,7 +143,6 @@ function get_notices_xmlrpc($category = null) ...@@ -146,7 +143,6 @@ function get_notices_xmlrpc($category = null)
} else { } else {
return get_notices($category); return get_notices($category);
} }
} }
/** /**
...@@ -156,7 +152,6 @@ function get_notices_xmlrpc($category = null) ...@@ -156,7 +152,6 @@ function get_notices_xmlrpc($category = null)
function reboot_xmlrpc() function reboot_xmlrpc()
{ {
mwexec_bg("/usr/local/etc/rc.reboot"); mwexec_bg("/usr/local/etc/rc.reboot");
return true; return true;
} }
...@@ -167,7 +162,6 @@ function reboot_xmlrpc() ...@@ -167,7 +162,6 @@ function reboot_xmlrpc()
function firmware_version_xmlrpc() function firmware_version_xmlrpc()
{ {
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
return host_firmware_version(); return host_firmware_version();
} }
...@@ -354,7 +348,6 @@ function restore_config_section_xmlrpc($new_config) ...@@ -354,7 +348,6 @@ function restore_config_section_xmlrpc($new_config)
vpn_ipsec_configure(); vpn_ipsec_configure();
} }
unset($old_config); unset($old_config);
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment