diff --git a/contrib/simplepie/idn/idna_convert.class.php b/contrib/simplepie/idn/idna_convert.class.php index cce1b6150..97801dafd 100644 --- a/contrib/simplepie/idn/idna_convert.class.php +++ b/contrib/simplepie/idn/idna_convert.class.php @@ -54,7 +54,7 @@ class idna_convert { /** - * Holds all relevant mapping tables, loaded from a seperate file on construct + * Holds all relevant mapping tables, loaded from a separate file on construct * See RFC3454 for details * * @var array diff --git a/contrib/simplepie/library/SimplePie/Parse/Date.php b/contrib/simplepie/library/SimplePie/Parse/Date.php index 266313866..e65a56c66 100644 --- a/contrib/simplepie/library/SimplePie/Parse/Date.php +++ b/contrib/simplepie/library/SimplePie/Parse/Date.php @@ -630,7 +630,7 @@ class SimplePie_Parse_Date /** * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as * well as allowing any of upper or lower case "T", horizontal tabs, or - * spaces to be used as the time seperator (including more than one)) + * spaces to be used as the time separator (including more than one)) * * @access protected * @return int Timestamp diff --git a/src/etc/inc/IPv6.inc b/src/etc/inc/IPv6.inc index ef487d4de..34bafe07a 100644 --- a/src/etc/inc/IPv6.inc +++ b/src/etc/inc/IPv6.inc @@ -127,7 +127,7 @@ class Net_IPv6 * * @param String $ip the (compressed) IP as Hex representation * - * @return Array the first element is the IP, the second the prefix length + * @return array the first element is the IP, the second the prefix length * @since 1.2.0 * @access public * @static @@ -658,7 +658,7 @@ class Net_IPv6 * @param Boolean $uncompress if true, the address will be uncompressed * before processing * - * @return Array [0] contains the IPv6 part, + * @return array [0] contains the IPv6 part, * [1] the IPv4 part (hex format) * @access public * @static @@ -768,7 +768,7 @@ class Net_IPv6 * @param String $ipToParse the IPv6 address * @param String $bits the optional count of netmask bits * - * @return Array ['start', 'end'] the lowest and highest IPv6 address + * @return array ['start', 'end'] the lowest and highest IPv6 address * @access public * @static * @author Nicholas Williams diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index 7298f1f19..9869fab75 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -712,6 +712,10 @@ function ldap_setup_caenv($authcfg) putenv("LDAPTLS_CACERT=/var/run/certs/{$caref['refid']}.ca"); } +/** + * @param $name string name of the authentication system configured on the authentication server page or 'Local Database' for local authentication + * @return array|bool false if the authentication server was not found, otherwise the configuration of the authentication server + */ function auth_get_authserver($name) { global $config; diff --git a/src/etc/inc/filter.lib.inc b/src/etc/inc/filter.lib.inc index e9a755b17..4a513d7e3 100644 --- a/src/etc/inc/filter.lib.inc +++ b/src/etc/inc/filter.lib.inc @@ -141,9 +141,10 @@ function filter_core_get_antilockout() /** * recursively collect port alias(es) contents - * @param $aliasname string alias name or null to fetch all aliases - * @param $aliases aliases already parsed (prevent deadlock) + * @param string|null $aliasname alias name, or null to fetch all aliases + * @param array $aliases aliases already parsed (prevent deadlock) * @return array containing ports + * @throws \OPNsense\Base\ModelException */ function filter_core_get_port_alias($aliasname, $aliases=array()) { diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 604ec73e4..4b4b5d7eb 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4527,7 +4527,7 @@ function is_ipaddr_configured($ipaddr, $ignore_if = '') */ function get_carp_interface_status($carpinterface) { - $carp_query = ''; + $carp_query = []; /* XXX: Need to find a better way for this! */ list ($interface, $vhid) = explode("_vip", $carpinterface); diff --git a/src/etc/inc/legacy_bindings.inc b/src/etc/inc/legacy_bindings.inc index f0fce2b05..125ebd5bc 100644 --- a/src/etc/inc/legacy_bindings.inc +++ b/src/etc/inc/legacy_bindings.inc @@ -152,7 +152,7 @@ function legacy_move_config_list_items($source, $id, $items) { /** * Retrieve description text of firewall alias by specifying the alias name. * @param string $name alias name to retrieve the description from - * @return description of alias, or null if no description was set or alias + * @return string|null description of alias, or null if no description was set or alias * does not exist. */ function get_alias_description($name) diff --git a/src/etc/inc/plugins.inc.d/openvpn/wizard.inc b/src/etc/inc/plugins.inc.d/openvpn/wizard.inc index 62be83285..83a0ac853 100644 --- a/src/etc/inc/plugins.inc.d/openvpn/wizard.inc +++ b/src/etc/inc/plugins.inc.d/openvpn/wizard.inc @@ -108,11 +108,12 @@ function step3_submitphpaction() return; } + $authcfg = auth_get_authserver($_POST['name']); if (empty($_POST['name']) || empty($_POST['ip']) ||empty($_POST['transport']) || empty($_POST['scope']) || empty($_POST['basedn']) || empty($_POST['authscope']) || empty($_POST['nameattr'])) { $input_errors[] = gettext('Please enter all information for authentication server.'); $stepid--; - } elseif (count(($authcfg = auth_get_authserver($_POST['name']))) > 0) { + } elseif ($authcfg !== false && count($authcfg) > 0) { $input_errors[] = gettext('Please choose a different name because an authentication ' . 'server with this name already exists.'); $stepid--; @@ -173,10 +174,11 @@ function step5_submitphpaction() return; } + $authcfg = auth_get_authserver($_POST['name']); if (empty($_POST['name']) || empty($_POST['ip']) || empty($_POST['secret'])) { $input_errors[] = gettext('Please enter all information for authentication server.'); $stepid--; - } elseif (count(($authcfg = auth_get_authserver($_POST['name']))) > 0) { + } elseif ($authcfg !== false && count($authcfg) > 0) { $input_errors[] = gettext('Please choose a different name because an authentication ' . 'server with this name already exists.'); $stepid--; diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml index 871424e05..73d94a68a 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml +++ b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml @@ -51,7 +51,7 @@ select_multiple - TIP: You can also paste a comma seperated list into this field.]]> + TIP: You can also paste a comma separated list into this field.]]> Type IP addresses, followed by Enter or comma. true true diff --git a/src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php b/src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php index a537a8af2..304ac0782 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php +++ b/src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php @@ -197,9 +197,12 @@ class Radius extends Base implements IAuthConnector /** * stop radius accounting - * @param $username user name - * @param $sessionid session id - * @param $session_time total time spend on this session + * @param string $username user name + * @param string $sessionid session id + * @param int $session_time total time spent on this session + * @param $bytes_in + * @param $bytes_out + * @param $ip_address */ public function stopAccounting($username, $sessionid, $session_time, $bytes_in, $bytes_out, $ip_address) { @@ -271,9 +274,12 @@ class Radius extends Base implements IAuthConnector /** * update radius accounting (interim update) - * @param $username user name - * @param $sessionid session id - * @param $session_time total time spend on this session + * @param string $username user name + * @param string $sessionid session id + * @param int $session_time total time spend on this session + * @param $bytes_in + * @param $bytes_out + * @param $ip_address */ public function updateAccounting($username, $sessionid, $session_time, $bytes_in, $bytes_out, $ip_address) { @@ -346,8 +352,8 @@ class Radius extends Base implements IAuthConnector /** * authenticate user against radius - * @param $username username to authenticate - * @param $password user password + * @param string $username username to authenticate + * @param string $password user password * @return bool authentication status */ public function authenticate($username, $password) diff --git a/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php b/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php index 2d08a9109..850e28139 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php +++ b/src/opnsense/mvc/app/library/OPNsense/Core/Shell.php @@ -62,9 +62,9 @@ class Shell /** * execute command or list of commands * - * @param string/Array() $command command to execute + * @param string/array $command command to execute * @param bool $mute - * @param Array() &$output + * @param array &$output */ public function exec($command, $mute = false, &$output = null) { @@ -81,7 +81,7 @@ class Shell * execute shell command * @param string $command command to execute * @param bool $mute - * @param Array() &$output + * @param array &$output * @return int */ private function execSingle($command, $mute = false, &$output = null) diff --git a/src/opnsense/mvc/app/library/OPNsense/Core/Singleton.php b/src/opnsense/mvc/app/library/OPNsense/Core/Singleton.php index e812e6865..25bf90414 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Core/Singleton.php +++ b/src/opnsense/mvc/app/library/OPNsense/Core/Singleton.php @@ -51,7 +51,7 @@ abstract class Singleton /** * Do not clone - * @throws Exception + * @throws \Exception */ final private function __clone() { diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php index ca97ef7f9..094ee8f0c 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php @@ -206,7 +206,7 @@ class Plugin /** * fetch anchors as text (pf ruleset part) - * @param string $types anchor types (fw for filter, other options are nat,rdr,binat. comma seperated) + * @param string $types anchor types (fw for filter, other options are nat,rdr,binat. comma separated) * @param string $placement placement head,tail * @return string */ diff --git a/src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php b/src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php index 2a8e88c29..62517862a 100644 --- a/src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php +++ b/src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php @@ -61,8 +61,8 @@ class ViscosityVisz extends PlainOpenVPN /** * Create archive - * @param $tempdir used temp directory - * @param $content_dir full path to viscosity output files + * @param string $tempdir used temp directory + * @param string $content_dir full path to viscosity output files * @return string full (temp)path to */ protected function archive($tempdir, $content_dir) diff --git a/src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php b/src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php index efc88cc08..736fa4b32 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php +++ b/src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php @@ -144,7 +144,7 @@ class Alias extends BaseModel // find all used in this model (alias nesting) foreach ($this->aliases->alias->iterateItems() as $alias) { if (!in_array($alias->type, array('geoip', 'urltable'))) { - $sepchar = $alias->content->getSeperatorChar(); + $sepchar = $alias->content->getSeparatorChar(); $aliases = explode($sepchar, (string)$alias->content); if (in_array($oldname, $aliases)) { $aliases = array_unique($aliases); diff --git a/src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php b/src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php index a7ab14621..492c4e05a 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php +++ b/src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php @@ -90,10 +90,10 @@ class AliasContentField extends BaseField } /** - * return seperator character used + * return separator character used * @return string */ - public function getSeperatorChar() + public function getSeparatorChar() { return $this->separatorchar; } diff --git a/src/opnsense/mvc/app/models/OPNsense/IDS/IDS.php b/src/opnsense/mvc/app/models/OPNsense/IDS/IDS.php index b9e26faf1..b4a46c26c 100644 --- a/src/opnsense/mvc/app/models/OPNsense/IDS/IDS.php +++ b/src/opnsense/mvc/app/models/OPNsense/IDS/IDS.php @@ -127,7 +127,7 @@ class IDS extends BaseModel * retrieve current altered rule status * @param string $sid unique id * @param string $default default value - * @return default, 0, 1 ( default, true, false) + * @return string|bool default, 0, 1 ( default, true, false) */ public function getRuleStatus($sid, $default) { @@ -144,7 +144,7 @@ class IDS extends BaseModel * @param string $sid unique id * @param string $default default value * @param bool $response_plain response as text ot model (select list) - * @return default, ( default, true, false) + * @return string|bool default, ( default, true, false) */ public function getRuleAction($sid, $default, $response_plain = false) { diff --git a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/Export.php b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/Export.php index 41996bd45..71102ee6c 100644 --- a/src/opnsense/mvc/app/models/OPNsense/OpenVPN/Export.php +++ b/src/opnsense/mvc/app/models/OPNsense/OpenVPN/Export.php @@ -38,7 +38,7 @@ class Export extends BaseModel { /** * get or create server to store defaults - * @param $vpnid openvpn unique reference (number) + * @param string $vpnid openvpn unique reference (number) * @return mixed server object */ public function getServer($vpnid) diff --git a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt index aa6cf1944..b2d851c95 100644 --- a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt @@ -182,7 +182,7 @@ POSSIBILITY OF SUCH DAMAGE. * @param gridId: grid id to to use * @param url: ajax action to call * @param state: 0/1/undefined - * @param combine: number of keys to combine (seperate with ,) + * @param combine: number of keys to combine (separate with ,) * try to avoid too much items per call (results in too long url's) */ function actionToggleSelected(gridId, url, state, combine) { diff --git a/src/opnsense/scripts/firmware/check.sh b/src/opnsense/scripts/firmware/check.sh index f271680f9..a90b73e0f 100755 --- a/src/opnsense/scripts/firmware/check.sh +++ b/src/opnsense/scripts/firmware/check.sh @@ -156,7 +156,7 @@ if [ "$pkg_running" == "" ]; then else i=`echo $i | tr -d :` if [ -z "$packages_downgraded" ]; then - packages_downgraded=$packages_downgraded"{\"name\":\"$i\"," # If it is the first item then we do not want a seperator + packages_downgraded=$packages_downgraded"{\"name\":\"$i\"," # If it is the first item then we do not want a separator else packages_downgraded=$packages_downgraded", {\"name\":\"$i\"," fi @@ -232,7 +232,7 @@ if [ "$pkg_running" == "" ]; then # prevents leaking base / kernel advertising here pkg_upgraded="yes" fi - packages_upgraded=$packages_upgraded"{\"name\":\"$i\"," # If it is the first item then we do not want a seperator + packages_upgraded=$packages_upgraded"{\"name\":\"$i\"," # If it is the first item then we do not want a separator else packages_upgraded=$packages_upgraded", {\"name\":\"$i\"," fi @@ -283,7 +283,7 @@ if [ "$pkg_running" == "" ]; then base_is_size="$(opnsense-update -bfSr $base_to_reboot)" if [ "$base_to_reboot" != "$base_to_delete" -a -n "$base_is_size" ]; then if [ "$packages_upgraded" == "" ]; then - packages_upgraded=$packages_upgraded"{\"name\":\"base\"," # If it is the first item then we do not want a seperator + packages_upgraded=$packages_upgraded"{\"name\":\"base\"," # If it is the first item then we do not want a separator else packages_upgraded=$packages_upgraded", {\"name\":\"base\"," fi @@ -311,7 +311,7 @@ if [ "$pkg_running" == "" ]; then kernel_is_size="$(opnsense-update -fkSr $kernel_to_reboot)" if [ "$kernel_to_reboot" != "$kernel_to_delete" -a -n "$kernel_is_size" ]; then if [ "$packages_upgraded" == "" ]; then - packages_upgraded=$packages_upgraded"{\"name\":\"kernel\"," # If it is the first item then we do not want a seperator + packages_upgraded=$packages_upgraded"{\"name\":\"kernel\"," # If it is the first item then we do not want a separator else packages_upgraded=$packages_upgraded", {\"name\":\"kernel\"," fi diff --git a/src/opnsense/scripts/proxy/fetchACLs.py b/src/opnsense/scripts/proxy/fetchACLs.py index cee47cf6d..f78765de6 100755 --- a/src/opnsense/scripts/proxy/fetchACLs.py +++ b/src/opnsense/scripts/proxy/fetchACLs.py @@ -180,7 +180,7 @@ class DomainSorter(object): :param mode: file open mode """ self._num_targets = 20 - self._seperator = '|' + self._separator = '|' self._buckets = dict() self._sort_map = dict() # setup target @@ -220,7 +220,7 @@ class DomainSorter(object): """ target = key[0] if target in self._sort_map: - for part in (key, self._seperator, value, '\n'): + for part in (key, self._separator, value, '\n'): self._sort_map[target].write(part) else: # not supposed to happen, every key should have a calculated target pool diff --git a/src/www/diag_logs_filter_summary.php b/src/www/diag_logs_filter_summary.php index 1e03c6c7a..5fcdbb36b 100644 --- a/src/www/diag_logs_filter_summary.php +++ b/src/www/diag_logs_filter_summary.php @@ -63,7 +63,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil } /* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */ - $logarr = ""; + $logarr = []; exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr); diff --git a/src/www/interfaces_ppps_edit.php b/src/www/interfaces_ppps_edit.php index 1e2d86f49..06ab0c8c2 100644 --- a/src/www/interfaces_ppps_edit.php +++ b/src/www/interfaces_ppps_edit.php @@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig[$fieldname] = null; } } - // fields containing array data (comma seperated) + // fields containing array data (comma separated) $explode_fields = array('mtu', 'mru', 'mrru', 'bandwidth', 'localip', 'gateway', 'localip', 'subnet', 'ports'); foreach ($explode_fields as $fieldname) { if (isset($a_ppps[$id][$fieldname])) { diff --git a/src/www/javascript/opnsense_legacy.js b/src/www/javascript/opnsense_legacy.js index e91bbe0d5..0d183554c 100644 --- a/src/www/javascript/opnsense_legacy.js +++ b/src/www/javascript/opnsense_legacy.js @@ -97,7 +97,7 @@ function hook_stacked_form_tables(match) } } if (children.length == 1) { - // simple seperator line, colspan = 2 + // simple separator line, colspan = 2 $(this).before($(this).clone().removeAttr("id").attr('colspan', 1).addClass('hidden-sm hidden-md hidden-lg')); $(this).addClass('hidden-xs'); } else if (children.length == 2) { diff --git a/src/www/system_advanced_network.php b/src/www/system_advanced_network.php index 0678f77ab..464a8b084 100644 --- a/src/www/system_advanced_network.php +++ b/src/www/system_advanced_network.php @@ -124,7 +124,7 @@ function is_duid($duid) $valid_duid = true; } - /* max DUID length is 128, but with the seperators it could be up to 254 */ + /* max DUID length is 128, but with the separators it could be up to 254 */ if ($duid_length < 6 || $duid_length > 254) { $valid_duid = false; } diff --git a/src/www/vpn_ipsec_phase2.php b/src/www/vpn_ipsec_phase2.php index c4af4c151..12e6991eb 100644 --- a/src/www/vpn_ipsec_phase2.php +++ b/src/www/vpn_ipsec_phase2.php @@ -747,7 +747,7 @@ endif; ?> diff --git a/src/www/xmlrpc.php b/src/www/xmlrpc.php index 57363a72d..aa8f4db08 100644 --- a/src/www/xmlrpc.php +++ b/src/www/xmlrpc.php @@ -32,7 +32,7 @@ require_once("xmlrpc.inc"); /** * do a basic authentication, uses $_SERVER['HTTP_AUTHORIZATION'] to validate user. - * @param $http_auth_header http_authorization header content + * @param string $http_auth_header content of the Authorization HTTP header * @return bool */ function http_basic_auth($http_auth_header)