2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

Bugfix: getting xmllist from FHEM without \r\n

git-svn-id: https://svn.fhem.de/fhem/trunk@1529 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nitroxmh 2012-05-03 10:51:51 +00:00
parent 1965c7c5bb
commit cb684b7e81
4 changed files with 22 additions and 21 deletions

View File

@ -213,3 +213,8 @@ It is not necessary to tell fhem that there are other logs.
2012-04-25
-- Feature: debugging for xmllist included
2012-05-02
-- Bugfix: getting xmllist from FHEM without \r\n, no netcat any more
Changed: index.php, config.php

View File

@ -116,3 +116,6 @@
- Martin 2012-04-25
-- Feature: debugging for xmllist included
- Martin 2012-05-03
-- Bugfix: getting xmllist from FHEM without \r\n

View File

@ -360,9 +360,6 @@ $userdef[$sortnumber]['logrotatelines']=30;
$winsize=800; # width of the pgm3
##### use netcat if your have problems with the stream_socket-tcp-connection
## package netcat must be installed
$usenetcat=0;
##########################
##### SKINS - change your colors

View File

@ -6,7 +6,7 @@
#
# Copyright notice
#
# (c) 2006-2010 Copyright: Martin Haas (fhz@martin-haas.de)
# (c) 2006-2012 Copyright: Martin Haas (fhz@martin-haas.de)
# All rights reserved
#
# This script is free software; you can redistribute it and/or modify
@ -41,7 +41,7 @@ include "include/gnuplot.php";
include "include/functions.php";
$pgm3version='120425';
$pgm3version='120503';
@ -226,35 +226,31 @@ if (! isset($showroom)) $showroom="ALL";
if (($taillog==1) and (isset ($showhist)) ) exec($taillogorder,$tailoutput);
#executes over the network to the fhem.pl (or localhost)
function execFHZ($order,$machine,$port)
{
global $errormessage;
if ($usenetcat=='1')
{
$order="$echo xmllist | netcat -w3 $machine $port";
exec($order,$res);
$errormessage = $res[0];
}
else
{
$fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "$order\n;quit\n");
fwrite($fp, "$order;quit\n");
$errormessage= fgets($fp);
fclose($fp);
}
}
#}
return $errormessage;
}
###### make an array from the xmllist
unset($output);
$stack = array();
@ -264,24 +260,23 @@ unset($longxml);
$version = explode('.', phpversion());
################################################################################
# get the xmllist from fhem
$fp = stream_socket_client("tcp://$fhem:$fhemport", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "xmllist\r\n;quit\r\n");
fwrite($fp, "xmllist;quit\n");
$outputvar=stream_get_contents($fp);
array_push($output,$outputvar);
fclose($fp);
}
# start_element_handler ( resource parser, string name, array attribs )
function startElement($parser, $name, $attribs)
{
@ -636,6 +631,7 @@ xml_parser_free($xml_parser);
############################ FHZ
if ($show_fs20pulldown==1 or $show_general==1 or $show_fhtpulldown==1)
{