diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php index e5f056082b70ea1f608a6eb41c61feacf9bc5350..8ec44964536155a98128d7f3d8b7ea50a523842c 100644 --- a/interface/lib/classes/functions.inc.php +++ b/interface/lib/classes/functions.inc.php @@ -186,7 +186,8 @@ class functions { global $app; if($type == 'IPv4'){ - $regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/"; +// $regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/"; + $regex = "/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/"; } else { // IPv6 $regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i"; diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php index 784e96a448fe49f2407987cb2f080480edc717cf..4b5a76c5f14a7406eb50c7d5383b771c21b3cf29 100644 --- a/interface/lib/classes/tform_base.inc.php +++ b/interface/lib/classes/tform_base.inc.php @@ -1058,11 +1058,10 @@ class tform_base { } break; - - case 'ISIPV4': $vip=1; - if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ +// if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ + if(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $field_value)){ $groups=explode(".", $field_value); foreach($groups as $group){ if($group<0 or $group>255) @@ -1078,6 +1077,7 @@ class tform_base { } } break; + case 'ISIP': if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n'; if($validator['allowempty'] == 'y' && $field_value == '') { @@ -1107,7 +1107,8 @@ class tform_base { if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){ $ip_ok = 1; } - if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ +// if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ + if(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $field_value)){ $ip_ok = 1; } if($ip_ok == 0) { diff --git a/interface/lib/classes/validate_database.inc.php b/interface/lib/classes/validate_database.inc.php index 0e6ffef5d504926389a4098163e3fe1875e9954b..e348afe62c2dd1021ed4f318213dd6b24ab67e1a 100644 --- a/interface/lib/classes/validate_database.inc.php +++ b/interface/lib/classes/validate_database.inc.php @@ -44,7 +44,8 @@ class validate_database { $cur_value = trim($cur_value); $valid = true; - if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) { +// if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) { + if(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $cur_value)) { $groups = explode(".", $cur_value); foreach($groups as $group){ if($group<0 or $group>255) diff --git a/interface/lib/classes/validate_dns.inc.php b/interface/lib/classes/validate_dns.inc.php index a6920e0b01d4f033326b148f425d34631d2cb9bb..211d1639b65f7c6ccb47dd93ab19c5a6eff54db1 100644 --- a/interface/lib/classes/validate_dns.inc.php +++ b/interface/lib/classes/validate_dns.inc.php @@ -315,7 +315,8 @@ class validate_dns { if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){ $ip_ok = 1; } - if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ +// if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ + if(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $field_value)){ $ip_ok = 1; } if($ip_ok == 0) { diff --git a/interface/web/admin/form/server_ip_map.tform.php b/interface/web/admin/form/server_ip_map.tform.php index d85bab312869a67d1210ed53785538c3b95f2f07..fb61022ad2cd77fed5ed7235155ac2a991ba89f9 100644 --- a/interface/web/admin/form/server_ip_map.tform.php +++ b/interface/web/admin/form/server_ip_map.tform.php @@ -28,8 +28,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -$form["title"] = "IP Addresse mapping"; -$form["description"] = ""; +$form["title"] = "IPv4 Address mapping"; +$form["description"] = "Form to map IPv4-addresses for Web-Server"; $form["name"] = "server_ip_map"; $form["action"] = "server_ip_map_edit.php"; $form["db_table"] = "server_ip_map"; diff --git a/interface/web/admin/lib/lang/ar_server_ip_map.lng b/interface/web/admin/lib/lang/ar_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/ar_server_ip_map.lng +++ b/interface/web/admin/lib/lang/ar_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/bg_server_ip_map.lng b/interface/web/admin/lib/lang/bg_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/bg_server_ip_map.lng +++ b/interface/web/admin/lib/lang/bg_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/br_server_ip_map.lng b/interface/web/admin/lib/lang/br_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/br_server_ip_map.lng +++ b/interface/web/admin/lib/lang/br_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/cz_server_ip_map.lng b/interface/web/admin/lib/lang/cz_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/cz_server_ip_map.lng +++ b/interface/web/admin/lib/lang/cz_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/de_server_ip_map.lng b/interface/web/admin/lib/lang/de_server_ip_map.lng index 4e11c72f876151ad277e0d8618b038795edac5f9..1e7ef599a57831a72734edf71b3bea49ced6a4a2 100644 --- a/interface/web/admin/lib/lang/de_server_ip_map.lng +++ b/interface/web/admin/lib/lang/de_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Aktiv'; $wb["ip_error_wrong"] = 'Die neue IP ist ungueltig'; $wb["destination_ip_empty"] = 'Die neue IP ist leer.'; $wb["source_ip_empty"] = 'Die eigentliche IP ist leer.'; +$wb["server_empty_error"] = 'Der Server ist leer.'; $wb["duplicate_mapping_error"] = "Mapping existiert bereits."; -$wb["duplicate_mapping_error"] = "Die eigentliche IP darf keine IP des Rewrite-Servers sein."; +$wb["ip_mapping_error"] = "Die eigentliche IP darf keine IP des Rewrite-Servers sein."; ?> diff --git a/interface/web/admin/lib/lang/el_server_ip_map.lng b/interface/web/admin/lib/lang/el_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/el_server_ip_map.lng +++ b/interface/web/admin/lib/lang/el_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/en_server_ip_map.lng b/interface/web/admin/lib/lang/en_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/en_server_ip_map.lng +++ b/interface/web/admin/lib/lang/en_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/es_server_ip_map.lng b/interface/web/admin/lib/lang/es_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/es_server_ip_map.lng +++ b/interface/web/admin/lib/lang/es_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/fi_server_ip_map.lng b/interface/web/admin/lib/lang/fi_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/fi_server_ip_map.lng +++ b/interface/web/admin/lib/lang/fi_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/fr_server_ip_map.lng b/interface/web/admin/lib/lang/fr_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/fr_server_ip_map.lng +++ b/interface/web/admin/lib/lang/fr_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/hr_server_ip_map.lng b/interface/web/admin/lib/lang/hr_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/hr_server_ip_map.lng +++ b/interface/web/admin/lib/lang/hr_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/hu_server_ip_map.lng b/interface/web/admin/lib/lang/hu_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/hu_server_ip_map.lng +++ b/interface/web/admin/lib/lang/hu_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/id_server_ip_map.lng b/interface/web/admin/lib/lang/id_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/id_server_ip_map.lng +++ b/interface/web/admin/lib/lang/id_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/it_server_ip_map.lng b/interface/web/admin/lib/lang/it_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/it_server_ip_map.lng +++ b/interface/web/admin/lib/lang/it_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/ja_server_ip_map.lng b/interface/web/admin/lib/lang/ja_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/ja_server_ip_map.lng +++ b/interface/web/admin/lib/lang/ja_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/nl_server_ip_map.lng b/interface/web/admin/lib/lang/nl_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/nl_server_ip_map.lng +++ b/interface/web/admin/lib/lang/nl_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/pl_server_ip_map.lng b/interface/web/admin/lib/lang/pl_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/pl_server_ip_map.lng +++ b/interface/web/admin/lib/lang/pl_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/pt_server_ip_map.lng b/interface/web/admin/lib/lang/pt_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/pt_server_ip_map.lng +++ b/interface/web/admin/lib/lang/pt_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/ro_server_ip_map.lng b/interface/web/admin/lib/lang/ro_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/ro_server_ip_map.lng +++ b/interface/web/admin/lib/lang/ro_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/ru_server_ip_map.lng b/interface/web/admin/lib/lang/ru_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/ru_server_ip_map.lng +++ b/interface/web/admin/lib/lang/ru_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/se_server_ip_map.lng b/interface/web/admin/lib/lang/se_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/se_server_ip_map.lng +++ b/interface/web/admin/lib/lang/se_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/sk_server_ip_map.lng b/interface/web/admin/lib/lang/sk_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/sk_server_ip_map.lng +++ b/interface/web/admin/lib/lang/sk_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/lang/tr_server_ip_map.lng b/interface/web/admin/lib/lang/tr_server_ip_map.lng index b76eee71f264e06c9cd2fe577badf07df1b3d502..94508abb79482826e697520969cf9948b1dc61e4 100644 --- a/interface/web/admin/lib/lang/tr_server_ip_map.lng +++ b/interface/web/admin/lib/lang/tr_server_ip_map.lng @@ -6,6 +6,7 @@ $wb["active_txt"] = 'Active'; $wb["ip_error_wrong"] = 'The Destination IP address is invalid'; $wb["destination_ip_empty"] = 'The Destination IP is empty.'; $wb["source_ip_empty"] = 'The Source IP is empty.'; +$wb["server_empty_error"] = 'The Server is empty.'; $wb["duplicate_mapping_error"] = "Mapping already exists."; -$wb["duplicate_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; +$wb["ip_mapping_error"] = "Source IP can not be an IP of the Rewrite-Server"; ?> diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php index 0c4671e08e103c6d552b3ea0c3bb8f312980c799..124656b7f302df41d02cd388e21354f7d9688fbb 100644 --- a/interface/web/admin/lib/module.conf.php +++ b/interface/web/admin/lib/module.conf.php @@ -42,7 +42,7 @@ $items[] = array( 'title' => 'Server IP addresses', 'link' => 'admin/server_ip_list.php', 'html_id' => 'server_ip_list'); -$items[] = array( 'title' => 'Server IP mapping', +$items[] = array( 'title' => 'Server IPv4 mapping', 'target' => 'content', 'link' => 'admin/server_ip_map_list.php', 'html_id' => 'server_ip_map_list'); diff --git a/interface/web/admin/server_ip_map_edit.php b/interface/web/admin/server_ip_map_edit.php index c274e0b2d8a706f7afca006f91a14b62914daa87..4442287132f6f8c1c9b775b178c9b69dc1297d85 100644 --- a/interface/web/admin/server_ip_map_edit.php +++ b/interface/web/admin/server_ip_map_edit.php @@ -59,7 +59,7 @@ class page_action extends tform_actions { $app->tpl->setVar('server_id', $server_select); // ip-list - $sql = "SELECT server_ip.server_ip_id, server_ip.ip_address AS ip_address, server.server_name, CONCAT(server_ip.ip_address,' :: [', server.server_name, ']') AS source FROM server_ip, server WHERE (server_ip.server_id = server.server_id AND server.web_server =1 AND mirror_server_id = 0 AND virtualhost = 'y')"; + $sql = "SELECT server_ip.server_ip_id, server_ip.ip_address AS ip_address, server.server_name, CONCAT(server_ip.ip_address,' :: [', server.server_name, ']') AS source FROM server_ip, server WHERE (server_ip.server_id = server.server_id AND server.web_server =1 AND mirror_server_id = 0 AND virtualhost = 'y' AND IP_TYPE = 'IPv4')"; $ips = $app->db->queryAllRecords($sql); $ip_select = ""; if(is_array($ips)) { @@ -77,9 +77,11 @@ class page_action extends tform_actions { function onBeforeInsert() { global $app; + if($this->dataRecord['server_id']=='') $app->tform->errorMessage .= $app->tform->wordbook['server_empty_error']; + $sql = "SELECT * FROM server_ip WHERE server_id = ? and ip_address = ?"; $ip_check=$app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip']); - if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error']; + if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['ip_mapping_error']; $sql = 'SELECT count(*) as no FROM server_ip_map WHERE server_id = ? AND source_ip = ? AND destination_ip = ?'; $check = $app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip'], $this->dataRecord['destination_ip']); @@ -88,9 +90,12 @@ class page_action extends tform_actions { function onBeforeUpdate() { global $app; + + if($this->dataRecord['server_id']=='') $app->tform->errorMessage .= $app->tform->wordbook['server_empty_error']; + $sql = "SELECT * FROM server_ip WHERE server_id = ? and ip_address = ?"; $ip_check=$app->db->queryOneRecord($sql, $this->dataRecord['server_id'], $this->dataRecord['source_ip']); - if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['duplicate_mapping_error']; + if (is_array($ip_check)) $app->tform->errorMessage .= $app->tform->wordbook['ip_mapping_error']; $this->oldDataRecord = $app->tform->getDataRecord($this->id); if ($this->dataRecord['source_ip'] != $this->oldDataRecord['source_ip'] || $this->dataRecord['destination_ip'] != $this->oldDataRecord['destination_ip']) { diff --git a/server/lib/classes/functions.inc.php b/server/lib/classes/functions.inc.php index ec07a83cc941512dfd2d3e705d6766440887eb60..6a46d5e7fc3f2deb260ff7a5ce65af6a1515942a 100644 --- a/server/lib/classes/functions.inc.php +++ b/server/lib/classes/functions.inc.php @@ -230,7 +230,8 @@ class functions { global $app; if($type == 'IPv4'){ - $regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/"; +// $regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/"; + $regex = "/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/"; } else { // IPv6 $regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i"; diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php index 2f2171f19b11294df77bf47d8b36f653c1495577..7a5128a08d9c63a57f8ddb734db4796c399d0c26 100644 --- a/server/plugins-available/mysql_clientdb_plugin.inc.php +++ b/server/plugins-available/mysql_clientdb_plugin.inc.php @@ -101,7 +101,8 @@ class mysql_clientdb_plugin { $valid = true; if($db_host == '%' || $db_host == 'localhost') { $valid = true; - } elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) { +// } elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) { + } elseif(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $db_host)) { $groups = explode('.', $db_host); foreach($groups as $group){ if($group<0 or $group>255)