2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 16:05:19 +00:00

72_FRITZBOX.pm: Pruefung define um URL erweitert

git-svn-id: https://svn.fhem.de/fhem/trunk@27334 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jowiemann 2023-03-17 14:42:39 +00:00
parent 0626233796
commit 5ce9906139

View File

@ -235,9 +235,11 @@ sub FRITZBOX_Define($$)
my ($hash, $def) = @_; my ($hash, $def) = @_;
my @args = split("[ \t][ \t]*", $def); my @args = split("[ \t][ \t]*", $def);
my $URL_MATCH = FRITZBOX_Url_Regex();
return "Usage: define <name> FRITZBOX [IP address]" if(@args <2 || @args >3); return "Usage: define <name> FRITZBOX [IP address]" if(@args <2 || @args >3);
return "Error: no valid IPv4 Address: $args[2]" if defined $args[2] && $args[2] !~ m/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/; return "Error: no valid IPv4 Address: $args[2]" if defined $args[2] && $args[2] !~ m=$URL_MATCH=i;
my $name = $args[0]; my $name = $args[0];
@ -245,7 +247,7 @@ sub FRITZBOX_Define($$)
$hash->{VERSION} = $ModulVersion; $hash->{VERSION} = $ModulVersion;
$hash->{HOST} = "undefined"; $hash->{HOST} = "undefined";
$hash->{HOST} = $args[2] if defined $args[2] && $args[2] =~ m/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/; $hash->{HOST} = $args[2] if defined $args[2] && $args[2] =~ m=$URL_MATCH=i;
$hash->{fhem}{definedHost} = $hash->{HOST}; # to cope with old attribute definitions $hash->{fhem}{definedHost} = $hash->{HOST}; # to cope with old attribute definitions
my $msg; my $msg;
@ -349,17 +351,17 @@ sub FRITZBOX_Rename($$)
} }
############################################################################### ###############################################################################
# Expression régulière pour valider une URL en Perl # # Expression régulière pour valider une URL en Perl #
# Regular expression for URL validation in Perl # # Regular expression for URL validation in Perl #
# # # #
# La sous-routine url_regex fournit l'expression régulière pour valider une # # La sous-routine url_regex fournit l'expression régulière pour valider une #
# URL. Ne sont pas reconnus les noms de domaine en punycode et les addresses # # URL. Ne sont pas reconnus les noms de domaine en punycode et les addresses #
# IPv6. # # IPv6. #
# The url_regex subroutine returns the regular expression used to validate an # # The url_regex subroutine returns the regular expression used to validate an #
# URL. Domain names in punycode and IPv6 adresses are not recognized. # # URL. Domain names in punycode and IPv6 adresses are not recognized. #
# # # #
# La liste de tests est celle publiée à l'adresse suivante, excepté deux # # La liste de tests est celle publiée à l'adresse suivante, excepté deux #
# cas qui sont donnés comme faux, alors qu'ils sont justes. # # cas qui sont donnés comme faux, alors qu'ils sont justes. #
# The test list is the one published at the following adress, except for two # # The test list is the one published at the following adress, except for two #
# cases given as false, although they are correct. # # cases given as false, although they are correct. #
# # # #
@ -370,14 +372,14 @@ sub FRITZBOX_Rename($$)
# # # #
# Auteur // Author : Guillaume Lestringant # # Auteur // Author : Guillaume Lestringant #
# # # #
# L'expression régulière est très largement basée sur celle publiée par # # L'expression régulière est très largement basée sur celle publiée par #
# Diego Perini sous licence MIT (https://gist.github.com/dperini/729294). # # Diego Perini sous licence MIT (https://gist.github.com/dperini/729294). #
# Voir plus loin le texte de ladite licence (en anglais seulement). # # Voir plus loin le texte de ladite licence (en anglais seulement). #
# The regular expression is very largely based on the one published by # # The regular expression is very largely based on the one published by #
# Diego Perini under MIT license (https://gist.github.com/dperini/729294). # # Diego Perini under MIT license (https://gist.github.com/dperini/729294). #
# See further for the text of sayed license. # # See further for the text of sayed license. #
# # # #
# Le présent code est placé sous licence CeCIll-B, dont le texte se trouve à # # Le présent code est placé sous licence CeCIll-B, dont le texte se trouve à #
# l'adresse http://cecill.info/licences/Licence_CeCILL-B_V1-fr.html # # l'adresse http://cecill.info/licences/Licence_CeCILL-B_V1-fr.html #
# This actual code is released under CeCIll-B license, whose text can be # # This actual code is released under CeCIll-B license, whose text can be #
# found at the adress http://cecill.info/licences/Licence_CeCILL-B_V1-en.html # # found at the adress http://cecill.info/licences/Licence_CeCILL-B_V1-en.html #
@ -4362,13 +4364,13 @@ sub FRITZBOX_SendMail_Shell($@)
chop $field{body}; chop $field{body};
$field{body} =~ s/"/\\"/g; $field{body} =~ s/"/\\"/g;
# change none ASCII chars in octal code for ISO-8859-1 (acc. http://www.pjb.com.au/comp/diacritics.html) # change none ASCII chars in octal code for ISO-8859-1 (acc. http://www.pjb.com.au/comp/diacritics.html)
$field{body} =~ s/Ä|Ä/\\304/g; $field{body} =~ s/Ä|Ä/\\304/g;
$field{body} =~ s/Ö|Ö/\\326/g; $field{body} =~ s/Ö|Ö/\\326/g;
$field{body} =~ s/Ü|Ãœ/\\334/g; $field{body} =~ s/Ü|Ãœ/\\334/g;
$field{body} =~ s/ß|ß/\\337/g; $field{body} =~ s/ß|ß/\\337/g;
$field{body} =~ s/ä|&auml;/\\344/g; $field{body} =~ s/ä|&auml;/\\344/g;
$field{body} =~ s/ö|ö/\\366/g; $field{body} =~ s/ö|ö/\\366/g;
$field{body} =~ s/ü|ü/\\374/g; $field{body} =~ s/ü|ü/\\374/g;
push @cmdArray, '/bin/echo -e "'.$field{body}.'" >/var/tmp/fhem_nachricht.txt'; push @cmdArray, '/bin/echo -e "'.$field{body}.'" >/var/tmp/fhem_nachricht.txt';
$cmd .= " -i '/var/tmp/fhem_nachricht.txt'"; $cmd .= " -i '/var/tmp/fhem_nachricht.txt'";
@ -6545,8 +6547,8 @@ sub FRITZBOX_fritztris($)
Aktiviert / Deaktiviert die Klingelsperre f&uuml;r das DECT-Telefon mit der ID dect<n> f&uuml;r Zeitr&auml;ume:<br> Aktiviert / Deaktiviert die Klingelsperre f&uuml;r das DECT-Telefon mit der ID dect<n> f&uuml;r Zeitr&auml;ume:<br>
&lt;hh:mm-hh:mm&gt; = Uhrzeit_von bis Uhrzeit_bis<br> &lt;hh:mm-hh:mm&gt; = Uhrzeit_von bis Uhrzeit_bis<br>
&lt;days&gt; = wd f&uuml;r Werktags, ed f&uuml;r Jeden Tag, we f&uuml;r Wochenende<br> &lt;days&gt; = wd f&uuml;r Werktags, ed f&uuml;r Jeden Tag, we f&uuml;r Wochenende<br>
lmode:on|off = lmode definiert die Sperre. Bei off ist sie aus, außer f&uuml;r den angegebenen Zeitraum.<br> lmode:on|off = lmode definiert die Sperre. Bei off ist sie aus, au&szlig;er f&uuml;r den angegebenen Zeitraum.<br>
Bei on ist die Sperre an, außer f&uuml;r den angegebenen Zeitraum<br> Bei on ist die Sperre an, au&szlig;er f&uuml;r den angegebenen Zeitraum<br>
emode:on|off = emode schaltet Events bei gesetzter Klingelsperre ein/aus. Siehe hierzu die FRITZ!BOX Dokumentation<br> emode:on|off = emode schaltet Events bei gesetzter Klingelsperre ein/aus. Siehe hierzu die FRITZ!BOX Dokumentation<br>
Ben&ouml;tigt FRITZ!OS 7.21 oder h&ouml;her. Ben&ouml;tigt FRITZ!OS 7.21 oder h&ouml;her.
</li><br> </li><br>