diff options
author | jim-p <jimp@pfsense.org> | 2014-07-02 12:07:33 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2014-07-02 12:07:33 -0400 |
commit | 7c8f3711075d9671eda430b86ac59d6013d12cae (patch) | |
tree | 7a4f6c4e9c01728a68a7bed6bfe7890823d0b40a /etc/inc/pfsense-utils.inc | |
parent | 38c7d42e4b47e9c8d968ebf2c7a5b75806d87203 (diff) | |
download | pfsense-7c8f3711075d9671eda430b86ac59d6013d12cae.zip pfsense-7c8f3711075d9671eda430b86ac59d6013d12cae.tar.gz |
More refinements to the unofficial package repository warning ( Issue #484 ) -- Now also shows on Dashboard and installed package list. Cleaned up some code and shuffled things around to avoid unnecessary repetition.
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index a1b26b9..d16a2f0 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -670,7 +670,7 @@ function rmdir_recursive($path,$follow_links=false) { function call_pfsense_method($method, $params, $timeout = 0) { global $g, $config; - $xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl']; + $xmlrpc_base_url = get_active_xml_rpc_base_url(); $xmlrpc_path = $g['xmlrpcpath']; $xmlrpcfqdn = preg_replace("(https?://)", "", $xmlrpc_base_url); @@ -718,7 +718,7 @@ function call_pfsense_method($method, $params, $timeout = 0) { function check_firmware_version($tocheck = "all", $return_php = true) { global $g, $config; - $xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl']; + $xmlrpc_base_url = get_active_xml_rpc_base_url(); $xmlrpcfqdn = preg_replace("(https?://)", "", $xmlrpc_base_url); $ip = gethostbyname($xmlrpcfqdn); if($ip == $xmlrpcfqdn) @@ -2897,4 +2897,15 @@ function pkg_call_plugins($plugin_type, $plugin_params) { return $results; } +/* Function to find and return the active XML RPC base URL to avoid code duplication */ +function get_active_xml_rpc_base_url() { + global $config, $g; + /* If the user has activated the option to enable an alternate xmlrpcbaseurl, and it's not empty, then use it */ + if (isset($config['system']['altpkgrepo']['enable']) && !empty($config['system']['altpkgrepo']['xmlrpcbaseurl'])) { + return $config['system']['altpkgrepo']['xmlrpcbaseurl']; + } else { + return $g['xmlrpcbaseurl']; + } +} + ?> |