set version to 0.10.4 for upcoming maintenance release; minor code formatting + adjustments

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-11-01 11:16:13 +01:00
parent 53b7420dc9
commit 6cd061d74c
5 changed files with 100 additions and 91 deletions

View File

@@ -695,7 +695,7 @@ opcache.interned_strings_buffer'),
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''),
('panel', 'is_configured', '0'),
('panel', 'version', '0.10.3'),
('panel', 'version', '0.10.4'),
('panel', 'db_version', '201910200');

View File

@@ -447,3 +447,8 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.2')) {
showUpdateStep("Updating from 0.10.2 to 0.10.3", false);
\Froxlor\Froxlor::updateToVersion('0.10.3');
}
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.3')) {
showUpdateStep("Updating from 0.10.3 to 0.10.4", false);
\Froxlor\Froxlor::updateToVersion('0.10.4');
}

View File

@@ -7,7 +7,7 @@ final class Froxlor
{
// Main version variable
const VERSION = '0.10.3';
const VERSION = '0.10.4';
// Database version (YYYYMMDDC where C is a daily counter)
const DBVERSION = '201910200';

View File

@@ -70,8 +70,8 @@ class Validate
*
* @return string
*/
public static function cidr2NetmaskAddr ($cidr) {
public static function cidr2NetmaskAddr($cidr)
{
$ta = substr($cidr, strpos($cidr, '/') + 1) * 1;
$netmask = str_split(str_pad(str_pad('', $ta, '1'), 32, '0'), 8);
@@ -85,11 +85,12 @@ class Validate
/**
* Checks if an $address (IP) is IPv6
*
* @param $address
* @param string $address
*
* @return bool
* @return string|bool ip address on success, false on failure
*/
public static function is_ipv6($address) {
public static function is_ipv6($address)
{
return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
}
@@ -110,7 +111,6 @@ class Validate
* whether to allow CIDR values e.g. 10.10.10.10/16
* @param bool $cidr_as_netmask
* whether to format CIDR nodation to netmask notation
*
* @param bool $throw_exception
* whether to throw an exception on failure
*
@@ -123,13 +123,17 @@ class Validate
$org_ip = $ip;
$ip_cidr = explode("/", $ip);
if (count($ip_cidr) === 2) {
if(strlen($ip_cidr[1]) <= 2 && in_array((int)$ip_cidr[1], array_values(range(1, 32)), TRUE) === false) {
if (strlen($ip_cidr[1]) <= 2 && in_array((int) $ip_cidr[1], array_values(range(1, 32)), true) === false) {
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
}
if ($cidr_as_netmask && self::is_ipv6($ip_cidr[0])) {
// MySQL does not handle CIDR of IPv6 addresses, return error
if ($return_bool) {
return false;
} else {
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
}
}
$ip = $ip_cidr[0];
if ($cidr_as_netmask && strlen($ip_cidr[1]) <= 2) {
$ip_cidr[1] = self::cidr2NetmaskAddr($org_ip);