various tiny improvements
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -42,6 +42,12 @@ function buildFormEx($form, $part = '') {
|
||||
}
|
||||
}
|
||||
|
||||
// visible = Settings::Get('phpfpm.enabled') for example would result in false if not enabled
|
||||
// and therefore not shown as intended
|
||||
if (isset($groupdetails['visible'])) {
|
||||
$do_show = $groupdetails['visible'];
|
||||
}
|
||||
|
||||
if ($do_show) {
|
||||
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
||||
$fields .= getFormGroupOutput($groupname, $groupdetails);
|
||||
|
||||
@@ -21,7 +21,7 @@ function validateFormFieldString($fieldname, $fielddata, $newfieldvalue)
|
||||
{
|
||||
if(isset($fielddata['string_delimiter']) && $fielddata['string_delimiter'] != '')
|
||||
{
|
||||
$newfieldvalues = explode($fielddata['string_delimiter'], $newfieldvalue);
|
||||
$newfieldvalues = array_map('trim', explode($fielddata['string_delimiter'], $newfieldvalue));
|
||||
unset($fielddata['string_delimiter']);
|
||||
|
||||
$returnvalue = true;
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
$mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
|
||||
|
||||
foreach($mysql_access_host_array as $host_entry)
|
||||
{
|
||||
if(validate_ip($host_entry, true) == false
|
||||
foreach ($mysql_access_host_array as $host_entry) {
|
||||
|
||||
if (validate_ip2($host_entry, true, 'invalidip', true) == false
|
||||
&& validateDomain($host_entry) == false
|
||||
&& validateLocalHostname($host_entry) == false
|
||||
&& $host_entry != '%')
|
||||
{
|
||||
&& $host_entry != '%'
|
||||
) {
|
||||
return array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidmysqlhost', $host_entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ function validate_ip($ip, $return_bool = false, $lng = 'invalidip') {
|
||||
*
|
||||
* @return mixed ip address on success, false on failure
|
||||
*/
|
||||
function validate_ip2($ip, $return_bool = false, $lng = 'invalidip') {
|
||||
function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false) {
|
||||
|
||||
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
|
||||
|| filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
|
||||
@@ -55,6 +55,11 @@ function validate_ip2($ip, $return_bool = false, $lng = 'invalidip') {
|
||||
return $ip;
|
||||
}
|
||||
|
||||
// special case where localhost ip is allowed (mysql-access-hosts for example)
|
||||
if ($allow_localhost && $ip == '127.0.0.1') {
|
||||
return $ip;
|
||||
}
|
||||
|
||||
if ($return_bool) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user