various tiny improvements
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -333,8 +333,7 @@ class Database {
|
|||||||
require FROXLOR_INSTALL_DIR."/lib/userdata.inc.php";
|
require FROXLOR_INSTALL_DIR."/lib/userdata.inc.php";
|
||||||
|
|
||||||
// le format
|
// le format
|
||||||
if (self::$_needroot == true
|
if (isset($sql['root_user'])
|
||||||
&& isset($sql['root_user'])
|
|
||||||
&& isset($sql['root_password'])
|
&& isset($sql['root_password'])
|
||||||
&& (!isset($sql_root) || !is_array($sql_root))
|
&& (!isset($sql_root) || !is_array($sql_root))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -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 ($do_show) {
|
||||||
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
||||||
$fields .= getFormGroupOutput($groupname, $groupdetails);
|
$fields .= getFormGroupOutput($groupname, $groupdetails);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function validateFormFieldString($fieldname, $fielddata, $newfieldvalue)
|
|||||||
{
|
{
|
||||||
if(isset($fielddata['string_delimiter']) && $fielddata['string_delimiter'] != '')
|
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']);
|
unset($fielddata['string_delimiter']);
|
||||||
|
|
||||||
$returnvalue = true;
|
$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));
|
$mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
|
||||||
|
|
||||||
foreach($mysql_access_host_array as $host_entry)
|
foreach ($mysql_access_host_array as $host_entry) {
|
||||||
{
|
|
||||||
if(validate_ip($host_entry, true) == false
|
if (validate_ip2($host_entry, true, 'invalidip', true) == false
|
||||||
&& validateDomain($host_entry) == false
|
&& validateDomain($host_entry) == false
|
||||||
&& validateLocalHostname($host_entry) == false
|
&& validateLocalHostname($host_entry) == false
|
||||||
&& $host_entry != '%')
|
&& $host_entry != '%'
|
||||||
{
|
) {
|
||||||
return array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidmysqlhost', $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
|
* @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)
|
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
|
||||||
|| filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
|
|| filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
|
||||||
@@ -55,6 +55,11 @@ function validate_ip2($ip, $return_bool = false, $lng = 'invalidip') {
|
|||||||
return $ip;
|
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) {
|
if ($return_bool) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user