mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
RSS-Feeds added
git-svn-id: https://svn.fhem.de/fhem/trunk@114 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
28301215ce
commit
7f1c2217ec
@ -286,6 +286,8 @@ $userdef[$sortnumber]['logrotatelines']=2200;
|
||||
$showNOTI='no'; #show the NOTIFICATIONS at startup. Default: no Values: yes/no
|
||||
$showHIST='yes'; #show the HISTORY (if taillog=1) at startup. Default: yes Values: yes/no
|
||||
|
||||
$RSStitel='FHEM :-)';
|
||||
|
||||
|
||||
|
||||
$urlreload=90; # Automatic reloading page [sec]. Default fast: 60 slow:90
|
||||
|
181
fhem/webfrontend/pgm3/include/rssfeeds.php
Normal file
181
fhem/webfrontend/pgm3/include/rssfeeds.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
#### RSS-Feeds-- Provides RSS-Feeds
|
||||
|
||||
################################################################
|
||||
#
|
||||
# Copyright notice
|
||||
#
|
||||
# (c) 2006 Copyright: Martin Haas (fhz@martin-haas.de)
|
||||
# All rights reserved
|
||||
#
|
||||
# This script is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# The GNU General Public License can be found at
|
||||
# http://www.gnu.org/copyleft/gpl.html.
|
||||
# A copy is found in the textfile GPL.txt and important notices to the license
|
||||
# from the author is found in LICENSE.txt distributed with these scripts.
|
||||
#
|
||||
# This script is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# This copyright notice MUST APPEAR in all copies of the script!
|
||||
#
|
||||
# Homepage: http://martin-haas.de/fhz
|
||||
|
||||
##################################################################################
|
||||
|
||||
## make your settings in the config.php
|
||||
|
||||
############################### end of settings
|
||||
|
||||
|
||||
|
||||
header("Content-Type: text/xml");
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||
|
||||
|
||||
<rss version=\"2.0\">
|
||||
|
||||
<channel>
|
||||
<title>$RSStitel</title>
|
||||
<link>http://www.fhem.de</link>
|
||||
<description>RSS-Feeds for FHEM</description>
|
||||
<item>\n<title>Last Update: $now</title>\n<link>$forwardurl</link>\n</item>
|
||||
";
|
||||
|
||||
##### Let's go.... :-)))))
|
||||
for($i=0; $i < count($stack[0][children]); $i++)
|
||||
{
|
||||
############################
|
||||
if (substr($stack[0][children][$i][name],0,5)=='FS20_')
|
||||
{
|
||||
echo "<item>\n<title>************* FS20 state *************</title>\n<link>$forwardurl</link>\n</item>";
|
||||
$type=$stack[0][children][$i][name];
|
||||
$counter=0;
|
||||
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
||||
{
|
||||
$fs20=$stack[0][children][$i][children][$j][attrs][name];
|
||||
$state=$stack[0][children][$i][children][$j][attrs][state];
|
||||
$room='';
|
||||
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
|
||||
{
|
||||
$check=$stack[0][children][$i][children][$j][children][$k][attrs][name];
|
||||
if ($check='STATE')
|
||||
{
|
||||
$measured=$stack[0][children][$i][children][$j][children][$k][attrs][measured];
|
||||
}
|
||||
if ($check='ATTR')
|
||||
{
|
||||
if (($stack[0][children][$i][children][$j][children][$k][attrs][key])=='room')
|
||||
{
|
||||
$room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($state=='on') or ($state=='dimup'))
|
||||
{$order="set $fs20 off";}
|
||||
else
|
||||
{$order="set $fs20 on";};
|
||||
$url=$forwardurl.'rssorder='.$order;
|
||||
echo $url;
|
||||
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
|
||||
{
|
||||
echo "<item>\n<title>$fs20 $state</title>\n<link>$url</link>\n</item>\n";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
############################
|
||||
elseif (substr($stack[0][children][$i][name],0,4)=='FHT_')
|
||||
{
|
||||
echo "<item>\n<title>************* FHT state *************</title>\n<link>$forwardurl</link>\n</item>";
|
||||
$type=$stack[0][children][$i][name];
|
||||
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
||||
{
|
||||
$room="";
|
||||
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
|
||||
{
|
||||
$check=$stack[0][children][$i][children][$j][children][$k][attrs][key];
|
||||
if ( $check=="room")
|
||||
{$room=$stack[0][children][$i][children][$j][children][$k][attrs][value]; }
|
||||
if ( $check=="measured-temp")
|
||||
{$measuredtemp=$stack[0][children][$i][children][$j][children][$k][attrs][value];
|
||||
$pos=strpos($measuredtemp,' ');
|
||||
$measuredtemp=substr($measuredtemp,0,$pos);
|
||||
}
|
||||
}
|
||||
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
|
||||
{
|
||||
$FHTdev=$stack[0][children][$i][children][$j][attrs][name];
|
||||
echo "<item>\n<title>$FHTdev $measuredtemp</title>\n<link>$forwardurl</link>\n</item>\n";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
############################
|
||||
elseif (substr($stack[0][children][$i][name],0,4)=='HMS_')
|
||||
{
|
||||
echo "<item>\n<title>************* HMS state *************</title>\n<link>$forwardurl</link>\n</item>";
|
||||
$type=$stack[0][children][$i][name];
|
||||
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
||||
{
|
||||
$room="";
|
||||
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
|
||||
{
|
||||
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="room")
|
||||
{$room=$stack[0][children][$i][children][$j][children][$k][attrs][value];
|
||||
}
|
||||
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="type")
|
||||
{$type=$stack[0][children][$i][children][$j][children][$k][attrs][value];};
|
||||
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE")
|
||||
{$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];};
|
||||
}
|
||||
if (($room != 'hidden') and ($showroom=='ALL' or $showroom==$room))
|
||||
{
|
||||
$HMSdev=$stack[0][children][$i][children][$j][attrs][name];
|
||||
echo "<item>\n<title>$HMSdev $state</title>\n<link>$forwardurl</link>\n</item>\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
############################
|
||||
elseif (substr($stack[0][children][$i][name],0,6)=='KS300_' or substr($stack[0][children][$i][name],0,6)=='WS300_')
|
||||
{
|
||||
echo "<item>\n<title>*********** KS300/WS300 ***********</title>\n<link>$forwardurl</link>\n</item>";
|
||||
$type=$stack[0][children][$i][name];
|
||||
for($j=0; $j < count($stack[0][children][$i][children]); $j++)
|
||||
{
|
||||
$KSdev=$stack[0][children][$i][children][$j][attrs][name];
|
||||
$room='';
|
||||
for($k=0; $k < count($stack[0][children][$i][children][$j][children]); $k++)
|
||||
{
|
||||
if ( $stack[0][children][$i][children][$j][children][$k][attrs][key]=="STATE")
|
||||
{$state=$stack[0][children][$i][children][$j][children][$k][attrs][value];};
|
||||
}
|
||||
echo "<item>\n<title>$KSdev $state</title>\n<link>$forwardurl</link>\n</item>\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
############################
|
||||
}
|
||||
|
||||
|
||||
echo "
|
||||
</channel>
|
||||
</rss>
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -41,7 +41,7 @@ include "include/gnuplot.php";
|
||||
include "include/functions.php";
|
||||
|
||||
|
||||
$pgm3version='071030';
|
||||
$pgm3version='071130';
|
||||
|
||||
|
||||
$Action = $_POST['Action'];
|
||||
@ -64,6 +64,14 @@ $pgm3version='071030';
|
||||
$fs20dev = $_POST['fs20dev'];
|
||||
$errormessage = $_POST['errormessage'];
|
||||
|
||||
if (! isset($showrss)) $showrss=$_GET['showrss'];
|
||||
if (! isset($rssorder)) $rssorder=$_GET['rssorder'];
|
||||
if ($rssorder=="")
|
||||
{unset($rssorder);}
|
||||
else
|
||||
{$Action='exec'; $order=$rssorder;}
|
||||
|
||||
|
||||
if (! isset($showhmsgnu)) $showhmsgnu=$_GET['showhmsgnu'];
|
||||
if ($showhmsgnu=="") unset($showhmsgnu);
|
||||
|
||||
@ -230,17 +238,6 @@ $fp = stream_socket_client("tcp://$machine:$port", $errno, $errstr, 30);
|
||||
return $errormessage;
|
||||
}
|
||||
|
||||
###### write the header on screen
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='refresh' content='$urlreload; URL=$forwardurl'>
|
||||
<meta http-equiv='pragma' content='no-cache'>
|
||||
<meta http-equiv='Cache-Control' content='no-cache'>
|
||||
<link rel='shortcut icon' href='include/fs20.ico' >
|
||||
<title>$titel</title>";
|
||||
include ("include/style.css");
|
||||
echo " </head>";
|
||||
|
||||
|
||||
###### make an array from the xmllist
|
||||
@ -431,11 +428,34 @@ xml_parser_free($xml_parser);
|
||||
#print_r($fs20devs); exit;
|
||||
#echo count($stack[0][children]);exit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Print Array on Screen
|
||||
|
||||
$now=date($timeformat);
|
||||
|
||||
|
||||
# only RSS-Feeds??
|
||||
if (isset($showrss)) { include "include/rssfeeds.php"; exit; }
|
||||
|
||||
|
||||
|
||||
###### write the header on screen
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='refresh' content='$urlreload; URL=$forwardurl'>
|
||||
<meta http-equiv='pragma' content='no-cache'>
|
||||
<meta http-equiv='Cache-Control' content='no-cache'>
|
||||
<link rel='alternate' type='application/rss+xml' title='$RSStitel' href='index.php?showrss'>
|
||||
<link rel='shortcut icon' href='include/fs20.ico' >
|
||||
<title>$titel</title>";
|
||||
include ("include/style.css");
|
||||
echo " </head>";
|
||||
|
||||
|
||||
echo" <body $bodybg>
|
||||
$errormessage
|
||||
<table width='$winsize' cellspacing='1' cellpadding='10' border='0' $bgcolor1><tr><td></td></tr></table>
|
||||
@ -514,7 +534,7 @@ xml_parser_free($xml_parser);
|
||||
|
||||
##### Check Version of FHEM
|
||||
if (! ($stack[0][children][0][name]=='_internal__LIST')) ##older FHZ100 have no Internal_LIST
|
||||
{echo "Error!! You need at least FHEM-4.0 to run this pgm3!!";}
|
||||
{echo "Error!! There is no FHEM. You need at least FHEM-4.0 to run this pgm3!!";}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user