mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
00_CUL.pm: some cosmetic fixes (Forum #117934)
git-svn-id: https://svn.fhem.de/fhem/trunk@23727 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ba5266754e
commit
3c471139bf
@ -634,7 +634,8 @@ CUL_XmitDlyHM($$$)
|
||||
{
|
||||
my ($hash,$fn,$now) = @_;
|
||||
|
||||
my (undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
||||
my ($mTy,$id);
|
||||
(undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
||||
|
||||
if($id &&
|
||||
$modules{CUL_HM}{defptr}{$id} &&
|
||||
|
@ -484,7 +484,8 @@ ZWDongle_Get($@)
|
||||
my $msg="";
|
||||
$a[0] = $a0 if(defined($a0));
|
||||
$msg = $ret if($ret);
|
||||
my @r = map { ord($_) } split("", pack('H*', $ret)) if(defined($ret));
|
||||
my @r;
|
||||
@r = map { ord($_) } split("", pack('H*', $ret)) if(defined($ret));
|
||||
|
||||
if($cmd eq "nodeList") { ############################
|
||||
$msg =~ s/^.{10}(.{58}).*/$1/;
|
||||
|
@ -2212,7 +2212,8 @@ FW_returnFileAsStream($$$$$)
|
||||
"Transfer-Encoding: chunked\r\n" .
|
||||
"Content-Type: $type; charset=$FW_encoding\r\n\r\n");
|
||||
|
||||
my $d = Compress::Zlib::deflateInit(-WindowBits=>31) if($compr);
|
||||
my $d;
|
||||
$d = Compress::Zlib::deflateInit(-WindowBits=>31) if($compr);
|
||||
FW_outputChunk($FW_chash, $FW_RET, $d);
|
||||
FW_outputChunk($FW_chash, "<a name='top'></a>".
|
||||
"<a href='#end_of_file'>jump to the end</a><br><br>", $d)
|
||||
@ -2505,7 +2506,8 @@ FW_style($$)
|
||||
FW_addContent(">$filePath: $!</div");
|
||||
return;
|
||||
}
|
||||
my $ret = FW_fC("rereadcfg") if($filePath eq $attr{global}{configfile});
|
||||
my $ret;
|
||||
$ret = FW_fC("rereadcfg") if($filePath eq $attr{global}{configfile});
|
||||
$ret = FW_fC("reload $fileName") if($fileName =~ m,\.pm$,);
|
||||
$ret = FW_Set("","","rereadicons") if($isImg);
|
||||
DoTrigger("global", "FILEWRITE $filePath", 1) if(!$ret); # Forum #32592
|
||||
@ -2672,7 +2674,8 @@ FW_makeImage(@)
|
||||
$data =~ s/ *$//g;
|
||||
$data =~ s/<svg/<svg class="$class" data-txt="$txt"/; #52967
|
||||
$name =~ m/(@.*)$/;
|
||||
my $col = $1 if($1);
|
||||
my $col;
|
||||
$col = $1 if($1);
|
||||
if($col) {
|
||||
$col =~ s/@//;
|
||||
$col = "#$col" if($col =~ m/^([A-F0-9]{6})$/);
|
||||
|
@ -923,8 +923,9 @@ ZWave_execInits($$;$)
|
||||
|
||||
my $NAME = $hash->{NAME};
|
||||
my $iodev = $hash->{IODev};
|
||||
my $homeReading = ReadingsVal($iodev->{NAME}, "homeId", "") if($iodev);
|
||||
my $CTRLID=hex($1) if($homeReading && $homeReading =~ m/CtrlNodeIdHex:(..)/);
|
||||
my ($homeReading, $CTRLID);
|
||||
$homeReading = ReadingsVal($iodev->{NAME}, "homeId", "") if($iodev);
|
||||
$CTRLID = hex($1) if($homeReading && $homeReading =~ m/CtrlNodeIdHex:(..)/);
|
||||
|
||||
# ZWavePlus devices with MCA need mcaAdd instead of associationAdd
|
||||
my $cls = AttrVal($NAME, "classes", "");
|
||||
@ -980,7 +981,8 @@ ZWave_neighborList($)
|
||||
no strict "refs";
|
||||
my $iohash = $hash->{IODev};
|
||||
my $fn = $modules{$iohash->{TYPE}}{ReadAnswerFn};
|
||||
my ($err, $data) = &{$fn}($iohash, "neighborList", "^0180") if($fn);
|
||||
my ($err, $data);
|
||||
($err, $data) = &{$fn}($iohash, "neighborList", "^0180") if($fn);
|
||||
use strict "refs";
|
||||
|
||||
return $err if($err);
|
||||
@ -1131,7 +1133,8 @@ ZWave_Cmd($$@)
|
||||
$cmdFmt = sprintf($cmdFmt, @a);
|
||||
}
|
||||
$@ = undef;
|
||||
my ($err, $ncmd) = eval($cmdFmt) if($cmdFmt !~ m/^\d/);
|
||||
my ($err, $ncmd);
|
||||
($err, $ncmd) = eval($cmdFmt) if($cmdFmt !~ m/^\d/);
|
||||
return $err if($err);
|
||||
return $@ if($@);
|
||||
$cmdFmt = $ncmd if(defined($ncmd));
|
||||
@ -2908,8 +2911,9 @@ ZWave_configParseModel($;$)
|
||||
}
|
||||
|
||||
if($line =~ m/^\s*<Item/) {
|
||||
my $label = $1 if($line =~ m/label="([^"]*)"/i);
|
||||
my $value = $1 if($line =~ m/value="([^"]*)"/i);
|
||||
my ($label, $value);
|
||||
$label = $1 if($line =~ m/label="([^"]*)"/i);
|
||||
$value = $1 if($line =~ m/value="([^"]*)"/i);
|
||||
my ($item, $shortened) = ZWave_cleanString($label, $value, 1);
|
||||
$hash{$cmdName}{Item}{$item} = $value;
|
||||
$hash{$cmdName}{type} = "list"; # Forum #42604
|
||||
|
@ -87,7 +87,8 @@ HMS_Parse($$)
|
||||
my $cde = substr($msg, 11, 1);
|
||||
# 012345678901234567890123456789
|
||||
# 810e047f0214a001a81f000001000000 HMS100TFK
|
||||
my $val = substr($msg, 24, 8) if(length($msg) == 32);
|
||||
my $val;
|
||||
$val = substr($msg, 24, 8) if(length($msg) == 32);
|
||||
if(!defined($val)) {
|
||||
Log3 $hash, 3, "Strange HMS message $msg";
|
||||
return "";
|
||||
|
@ -836,7 +836,8 @@ FileLog_Get($@)
|
||||
}
|
||||
Log3 $name, 4, "$name get: Input file $inf, from:$from to:$to";
|
||||
|
||||
my $ifh = new IO::File $inf if($inf);
|
||||
my $ifh;
|
||||
$ifh = new IO::File $inf if($inf);
|
||||
FileLog_seekTo($inf, $ifh, $hash, $from, $reformatFn) if($ifh);
|
||||
|
||||
# Return the the plain file data, $outf is ignored
|
||||
|
@ -180,7 +180,8 @@ allowed_Authenticate($$$$)
|
||||
if($pwok && (!defined($authcookie) || $secret ne $authcookie)) {
|
||||
my $time = AttrVal($aName, "basicAuthExpiry", 0);
|
||||
if ( $time ) {
|
||||
my ($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||
my ($user, $password);
|
||||
($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||
$time = int($time*86400+time());
|
||||
# generate timestamp according to RFC-1130 in Expires
|
||||
my $expires = FmtDateTimeRFC1123($time);
|
||||
@ -248,7 +249,8 @@ allowed_CheckBasicAuth($$$$)
|
||||
my $aName = $me->{NAME};
|
||||
|
||||
my $pwok = ($secret && $secret eq $basicAuth) ? 1 : 2; # Base64
|
||||
my ($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||
my ($user, $password);
|
||||
($user, $password) = split(":", decode_base64($secret)) if($secret);
|
||||
($user,$password) = ("","") if(!defined($user) || !defined($password));
|
||||
|
||||
if($secret && $basicAuth =~ m/^{.*}$/) {
|
||||
|
@ -37,7 +37,8 @@ JsonList2_dumpHash($$$$$$)
|
||||
{
|
||||
my ($arrp, $name, $h, $isReading, $showInternal, $attr) = @_;
|
||||
my $ret = "";
|
||||
my %filter = map { $_=>1 } @$attr if(@$attr);
|
||||
my %filter;
|
||||
%filter = map { $_=>1 } @$attr if(@$attr);
|
||||
|
||||
my @arr = grep { ($showInternal || $_ !~ m/^\./) &&
|
||||
($isReading || $_ eq "IODev" || !ref($h->{$_}) ) &&
|
||||
|
@ -570,7 +570,7 @@ CommandUsb($$)
|
||||
my ($cl, $n) = @_;
|
||||
|
||||
return "Usage: usb [scan|create]" if("$n" !~ m/^(scan|create)$/);
|
||||
my $scan = 1 if($n eq "scan");
|
||||
my $scan = ($n eq "scan");
|
||||
my $ret = "";
|
||||
my $msg;
|
||||
my $dir = "/dev";
|
||||
|
@ -139,8 +139,8 @@ telnet_Define($$$)
|
||||
my $port = $pport;
|
||||
$port =~ s/^IPV6://;
|
||||
|
||||
my $isServer = 1 if(defined($port) && $port =~ m/^\d+$/);
|
||||
my $isClient = 1 if($port && $port =~ m/^(.+):\d+$/);
|
||||
my $isServer = (defined($port) && $port =~ m/^\d+$/);
|
||||
my $isClient = ($port && $port =~ m/^(.+):\d+$/);
|
||||
|
||||
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
|
||||
" [IPV6:]serverName:port }"
|
||||
|
@ -37,8 +37,9 @@ FB_doCheckPW($$$)
|
||||
"getpage=../html/login_sid.xml" );
|
||||
$data = join("&", map {join("=", map {urlEncode($_)} split("=",$_,2))} @d);
|
||||
$data = GetFileFromURL(FB_host2URL($host)."cgi-bin/webcm", undef, $data, 1);
|
||||
my $sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||
$sid = undef if($sid =~ m/^0*$/);
|
||||
my $sid;
|
||||
$sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||
$sid = undef if(defined($sid) && $sid =~ m/^0*$/);
|
||||
return $sid;
|
||||
|
||||
} else { # FritzOS >= 5.50
|
||||
@ -49,8 +50,9 @@ FB_doCheckPW($$$)
|
||||
|
||||
$data = GetFileFromURL($url, undef, $data, 1);
|
||||
return if(!$data);
|
||||
my $sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||
return if($sid =~ m/^0*$/);
|
||||
my $sid;
|
||||
$sid = $1 if($data =~ /<SID>(\w+)<\/SID>/i);
|
||||
return if(defined($sid) && $sid =~ m/^0*$/);
|
||||
return $sid;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user