diff options
author | Colin Smith <colin@pfsense.org> | 2005-04-13 17:07:39 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-04-13 17:07:39 +0000 |
commit | 94c5a14d535a11eb8bc61d934a13597f3d05f080 (patch) | |
tree | addd73359bf2edb0a585680f2fde050884bc5b72 /etc | |
parent | 58f130e4070865bc28fa9cb670933cb258c6300d (diff) | |
download | pfsense-94c5a14d535a11eb8bc61d934a13597f3d05f080.zip pfsense-94c5a14d535a11eb8bc61d934a13597f3d05f080.tar.gz |
Add function to change XMLRPC values to their PHP equivalents.
XXX: xmlrpc_value_to_php does *not* currently handle structs.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index eab1abf..bc2b783 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1004,6 +1004,24 @@ function auto_upgrade() { return; } +function xmlrpc_value_to_php($value) { + if($value->kindOf() == 'array') { + $toreturn = array(); + for($i= 0; $i < $value->arraysize(); $i++) { + $arrayval = $value->arraymem($i); + if($arrayval->kindOf() == 'array') { + $toreturn[] = xmlrpc_value_to_php($arrayval); + } else { + $toreturn[] = $arrayval->scalarval(); + } + } + } else { + $toreturn = $value->scalarval(); + } + return $toreturn; +} + + /* * check_firmware_version(): Check whether the current firmware installed is the most recently released. */ @@ -1025,12 +1043,7 @@ function check_firmware_version($return_php = true) { if($resp->faultCode()) return -1; if($return_php == false) return $resp->serialize(); $raw_versions = $resp->value(); - $toreturn = array(); - for($i = 0; $i < $raw_versions->arraysize(); $i++) { - $arrayval = $raw_versions->arraymem($i); - $toreturn[] = $arrayval->scalarval(); - } - return $toreturn; + return xmlrpc_value_to_php($raw_versions); } ?> |