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:
@@ -695,7 +695,7 @@ opcache.interned_strings_buffer'),
|
|||||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||||
('panel', 'customer_hide_options', ''),
|
('panel', 'customer_hide_options', ''),
|
||||||
('panel', 'is_configured', '0'),
|
('panel', 'is_configured', '0'),
|
||||||
('panel', 'version', '0.10.3'),
|
('panel', 'version', '0.10.4'),
|
||||||
('panel', 'db_version', '201910200');
|
('panel', 'db_version', '201910200');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -406,9 +406,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201910110')) {
|
|||||||
// select all domains with an ssl IP connected and specialsettings content to include these in the ssl-vhost
|
// select all domains with an ssl IP connected and specialsettings content to include these in the ssl-vhost
|
||||||
// to maintain former behavior
|
// to maintain former behavior
|
||||||
$sel_stmt = Database::prepare("
|
$sel_stmt = Database::prepare("
|
||||||
SELECT d.id FROM `". TABLE_PANEL_DOMAINS . "` d
|
SELECT d.id FROM `" . TABLE_PANEL_DOMAINS . "` d
|
||||||
LEFT JOIN `". TABLE_DOMAINTOIP . "` d2i ON d2i.id_domain = d.id
|
LEFT JOIN `" . TABLE_DOMAINTOIP . "` d2i ON d2i.id_domain = d.id
|
||||||
LEFT JOIN `". TABLE_PANEL_IPSANDPORTS."` i ON i.id = d2i.id_ipandports
|
LEFT JOIN `" . TABLE_PANEL_IPSANDPORTS . "` i ON i.id = d2i.id_ipandports
|
||||||
WHERE d.specialsettings <> '' AND i.ssl = '1'
|
WHERE d.specialsettings <> '' AND i.ssl = '1'
|
||||||
");
|
");
|
||||||
Database::pexecute($sel_stmt);
|
Database::pexecute($sel_stmt);
|
||||||
@@ -444,6 +444,11 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201910120')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.2')) {
|
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.2')) {
|
||||||
showUpdateStep("Updating from 0.10.2 to 0.10.3", false);
|
showUpdateStep("Updating from 0.10.2 to 0.10.3", false);
|
||||||
\Froxlor\Froxlor::updateToVersion('0.10.3');
|
\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');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ final class Froxlor
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Main version variable
|
// Main version variable
|
||||||
const VERSION = '0.10.3';
|
const VERSION = '0.10.4';
|
||||||
|
|
||||||
// Database version (YYYYMMDDC where C is a daily counter)
|
// Database version (YYYYMMDDC where C is a daily counter)
|
||||||
const DBVERSION = '201910200';
|
const DBVERSION = '201910200';
|
||||||
|
|||||||
@@ -252,28 +252,28 @@ class Store
|
|||||||
|
|
||||||
public static function storeSettingMysqlAccessHost($fieldname, $fielddata, $newfieldvalue)
|
public static function storeSettingMysqlAccessHost($fieldname, $fielddata, $newfieldvalue)
|
||||||
{
|
{
|
||||||
$ips = $newfieldvalue;
|
$ips = $newfieldvalue;
|
||||||
//Convert cidr to netmask for mysql, if needed be
|
// Convert cidr to netmask for mysql, if needed be
|
||||||
if(strpos($ips, ',') !== false) {
|
if (strpos($ips, ',') !== false) {
|
||||||
$ips = explode(',', $ips);
|
$ips = explode(',', $ips);
|
||||||
}
|
}
|
||||||
if(is_array($ips) && count($ips) > 0) {
|
if (is_array($ips) && count($ips) > 0) {
|
||||||
$newfieldvalue = [];
|
$newfieldvalue = [];
|
||||||
foreach ($ips as $ip) {
|
foreach ($ips as $ip) {
|
||||||
$org_ip = $ip;
|
$org_ip = $ip;
|
||||||
$ip_cidr = explode("/", $ip);
|
$ip_cidr = explode("/", $ip);
|
||||||
if (count($ip_cidr) === 2) {
|
if (count($ip_cidr) === 2) {
|
||||||
$ip = $ip_cidr[0];
|
$ip = $ip_cidr[0];
|
||||||
if (strlen($ip_cidr[1]) <= 2) {
|
if (strlen($ip_cidr[1]) <= 2) {
|
||||||
$ip_cidr[1] = \Froxlor\Validate\Validate::cidr2NetmaskAddr($org_ip);
|
$ip_cidr[1] = \Froxlor\Validate\Validate::cidr2NetmaskAddr($org_ip);
|
||||||
}
|
}
|
||||||
$newfieldvalue[] = $ip . '/' . $ip_cidr[1];
|
$newfieldvalue[] = $ip . '/' . $ip_cidr[1];
|
||||||
} else {
|
} else {
|
||||||
$newfieldvalue[] = $org_ip;
|
$newfieldvalue[] = $org_ip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$newfieldvalue = implode(',', $newfieldvalue);
|
$newfieldvalue = implode(',', $newfieldvalue);
|
||||||
}
|
}
|
||||||
$returnvalue = self::storeSettingField($fieldname, $fielddata, $newfieldvalue);
|
$returnvalue = self::storeSettingField($fieldname, $fielddata, $newfieldvalue);
|
||||||
|
|
||||||
if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'mysql_access_host') {
|
if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'mysql_access_host') {
|
||||||
|
|||||||
@@ -62,60 +62,60 @@ class Validate
|
|||||||
\Froxlor\UI\Response::standard_error($lng, $fieldname, $throw_exception);
|
\Froxlor\UI\Response::standard_error($lng, $fieldname, $throw_exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts CIDR to a netmask address
|
* Converts CIDR to a netmask address
|
||||||
*
|
*
|
||||||
* @thx to https://stackoverflow.com/a/5711080/3020926
|
* @thx to https://stackoverflow.com/a/5711080/3020926
|
||||||
* @param string $cidr
|
* @param string $cidr
|
||||||
*
|
*
|
||||||
* @return string
|
* @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);
|
||||||
|
|
||||||
$ta = substr ($cidr, strpos ($cidr, '/') + 1) * 1;
|
foreach ($netmask as &$element) {
|
||||||
$netmask = str_split (str_pad (str_pad ('', $ta, '1'), 32, '0'), 8);
|
$element = bindec($element);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($netmask as &$element) {
|
return implode('.', $netmask);
|
||||||
$element = bindec ($element);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return implode ('.', $netmask);
|
/**
|
||||||
}
|
* Checks if an $address (IP) is IPv6
|
||||||
|
*
|
||||||
|
* @param string $address
|
||||||
|
*
|
||||||
|
* @return string|bool ip address on success, false on failure
|
||||||
|
*/
|
||||||
|
public static function is_ipv6($address)
|
||||||
|
{
|
||||||
|
return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an $address (IP) is IPv6
|
* Checks whether it is a valid ip
|
||||||
*
|
*
|
||||||
* @param $address
|
* @param string $ip
|
||||||
*
|
* ip-address to check
|
||||||
* @return bool
|
* @param bool $return_bool
|
||||||
*/
|
* whether to return bool or call \Froxlor\UI\Response::standard_error()
|
||||||
public static function is_ipv6($address) {
|
* @param string $lng
|
||||||
return filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
* index for error-message (if $return_bool is false)
|
||||||
}
|
* @param bool $allow_localhost
|
||||||
|
* whether to allow 127.0.0.1
|
||||||
/**
|
* @param bool $allow_priv
|
||||||
* Checks whether it is a valid ip
|
* whether to allow private network addresses
|
||||||
*
|
* @param bool $allow_cidr
|
||||||
* @param string $ip
|
* whether to allow CIDR values e.g. 10.10.10.10/16
|
||||||
* ip-address to check
|
* @param bool $cidr_as_netmask
|
||||||
* @param bool $return_bool
|
* whether to format CIDR nodation to netmask notation
|
||||||
* whether to return bool or call \Froxlor\UI\Response::standard_error()
|
* @param bool $throw_exception
|
||||||
* @param string $lng
|
* whether to throw an exception on failure
|
||||||
* index for error-message (if $return_bool is false)
|
*
|
||||||
* @param bool $allow_localhost
|
* @return string|bool ip address on success, false on failure
|
||||||
* whether to allow 127.0.0.1
|
*/
|
||||||
* @param bool $allow_priv
|
|
||||||
* whether to allow private network addresses
|
|
||||||
* @param bool $allow_cidr
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* @return string|bool ip address on success, false on failure
|
|
||||||
*/
|
|
||||||
public static function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false, $allow_priv = false, $allow_cidr = false, $cidr_as_netmask = false, $throw_exception = false)
|
public static function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false, $allow_priv = false, $allow_cidr = false, $cidr_as_netmask = false, $throw_exception = false)
|
||||||
{
|
{
|
||||||
$cidr = "";
|
$cidr = "";
|
||||||
@@ -123,17 +123,21 @@ class Validate
|
|||||||
$org_ip = $ip;
|
$org_ip = $ip;
|
||||||
$ip_cidr = explode("/", $ip);
|
$ip_cidr = explode("/", $ip);
|
||||||
if (count($ip_cidr) === 2) {
|
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);
|
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
|
||||||
}
|
}
|
||||||
if ($cidr_as_netmask && self::is_ipv6($ip_cidr[0])) {
|
if ($cidr_as_netmask && self::is_ipv6($ip_cidr[0])) {
|
||||||
//MySQL does not handle CIDR of IPv6 addresses, return error
|
// MySQL does not handle CIDR of IPv6 addresses, return error
|
||||||
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
|
if ($return_bool) {
|
||||||
}
|
return false;
|
||||||
|
} else {
|
||||||
|
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
$ip = $ip_cidr[0];
|
$ip = $ip_cidr[0];
|
||||||
if ($cidr_as_netmask && strlen($ip_cidr[1]) <= 2) {
|
if ($cidr_as_netmask && strlen($ip_cidr[1]) <= 2) {
|
||||||
$ip_cidr[1] = self::cidr2NetmaskAddr($org_ip);
|
$ip_cidr[1] = self::cidr2NetmaskAddr($org_ip);
|
||||||
}
|
}
|
||||||
$cidr = "/" . $ip_cidr[1];
|
$cidr = "/" . $ip_cidr[1];
|
||||||
} else {
|
} else {
|
||||||
$ip = $org_ip;
|
$ip = $org_ip;
|
||||||
|
|||||||
Reference in New Issue
Block a user