From 2302283047d4580aa4b97bc8987dd1525480c3ba Mon Sep 17 00:00:00 2001 From: Russ Handorf Date: Mon, 11 Apr 2016 22:34:39 -0400 Subject: [PATCH] new cleanup and updates --- alert_status.php | 13 +- cache/weather.Name=19046.cache | 1 + cameras.php | 28 +++++ config.php | 28 +++++ images/loading.gif | Bin 0 -> 2767 bytes includes.php | 47 +++---- index.php | 183 ++++++++++++---------------- scripts/minify | 104 ++++++++++++++++ set_summon_status.php | 3 +- sqlite.php | 26 ++++ summon.txt | 0 test/check_isy99i_status-lights.php | 72 +++++++++++ weather-php-test.php | 107 ++++++++++++++++ weather2.php | 2 +- weather4.php | 2 +- 15 files changed, 482 insertions(+), 134 deletions(-) create mode 100644 cache/weather.Name=19046.cache create mode 100644 cameras.php create mode 100644 config.php create mode 100644 images/loading.gif create mode 100644 scripts/minify create mode 100644 sqlite.php create mode 100644 summon.txt create mode 100644 test/check_isy99i_status-lights.php create mode 100644 weather-php-test.php diff --git a/alert_status.php b/alert_status.php index 0b3edee..38186b8 100644 --- a/alert_status.php +++ b/alert_status.php @@ -1,11 +1,10 @@ =1) { - echo "Russ- You're being summoned!
"; -} -if (summon_status("beth")>=1) { - echo "Beth- You're being summoned!
"; -} +foreach ($summon as $person) { + if (summon_status($person) >= 1) { + echo "$person- You're being summoned!
"; + } +} ?> diff --git a/cache/weather.Name=19046.cache b/cache/weather.Name=19046.cache new file mode 100644 index 0000000..3ad10ac --- /dev/null +++ b/cache/weather.Name=19046.cache @@ -0,0 +1 @@ +a:1:{s:7:"forexml";a:2:{s:1:"@";a:1:{s:4:"site";s:0:"";}s:1:"#";a:2:{s:11:"observation";a:1:{i:0;a:2:{s:1:"#";s:0:"";s:1:"@";a:19:{s:4:"city";s:8:"WXPRAW, ";s:8:"longname";s:8:"WXPRAW, ";s:5:"ident";s:0:"";s:8:"latitude";s:0:"";s:9:"longitude";s:0:"";s:8:"timezone";s:0:"";s:15:"daylight_saving";s:1:"1";s:5:"night";s:1:"1";s:12:"weather_code";s:0:"";s:16:"observation_name";s:11:" (WXPRAW, )";s:4:"time";s:13:"00Z 22 MAY 12";s:11:"wind.string";s:4:"calm";s:11:"wind_direct";s:1:"N";s:14:"wind_speed.knt";s:1:"-";s:15:"pressure.string";s:20:"1000.6 mb (29.56 in)";s:11:"pressure.mb";s:6:"1000.6";s:11:"pressure.in";s:5:"29.56";s:5:"skies";s:0:"";s:12:"text_weather";s:0:"";}}}s:7:"almanac";a:1:{i:0;a:2:{s:1:"#";s:0:"";s:1:"@";a:2:{s:7:"sunrise";s:0:"";s:6:"sunset";s:0:"";}}}}}} \ No newline at end of file diff --git a/cameras.php b/cameras.php new file mode 100644 index 0000000..51a80e7 --- /dev/null +++ b/cameras.php @@ -0,0 +1,28 @@ +$camera) { + if ($_GET['cam'] == $id) { + echo ""; + #echo ""; + } + } +} else { + $camera=$cameras[0]; + echo ""; +} +?> + + +$camera) { + echo " +
"; + ?> + , 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);"> + "; +} +?> +
diff --git a/config.php b/config.php new file mode 100644 index 0000000..c29126d --- /dev/null +++ b/config.php @@ -0,0 +1,28 @@ + diff --git a/images/loading.gif b/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..f864d5fd38b7466c76b5a36dc0e3e9455c0126e2 GIT binary patch literal 2767 zcmeH``%_bA0*1eHPVNawNVtR;Fkp-nQj8edfS`v<5L7TgR6wi;WfgH-0}4fE+c_uU zB6tf6auF}FAcDdgg|bMU&H)LR5jARM!8$tuwd$nHqS?K-=JNZ+yGvz=Iegxp{+qWGZ9j{-%9vvN>n3$NJp6==CAqYaF(LfM1Z{EEA{{Gt9 z+Ba|B7z_sR+xabl|E~mm-*OXmhLq??y)HONjX>1ze1D?RIn=G1`RR-%fb}zgSh6^a z(}Zw20U1L^Cs9UcyJfc+al#}J2xVlYUoR{`gd&QDxAb1w4>I~5gc?ccq(G+T!I;H};U_uyHR0@hr>Qk1P1=6fvU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IR^Z~yA XWBrHU7iSEP8X8hQyAJO{V6g1pwSv80 literal 0 HcmV?d00001 diff --git a/includes.php b/includes.php index f55dd8b..a4ef0cc 100644 --- a/includes.php +++ b/includes.php @@ -13,32 +13,37 @@ function get_data($item) { } function summon($person,$status) { - if ($person == "russ") { - $myFile = "russ.txt"; - $fh = fopen($myFile, 'w') or die("can't open file"); - fwrite($fh, $status); + $myFile = "summon.txt"; + $list = file("summon.txt"); + $fh = fopen($myFile, 'w') or die("can't open file"); + $matched=0; + foreach ($list as $summoned) { + list($item,$flag) = split("=",trim($summoned)); + if ($person == $item) { + fwrite($fh, "$person=$status\n"); + $matched=1; + } else { + if (strlen($item) > 0) { + fwrite($fh, "$item=$flag\n"); + } + } + } + fclose($fh); + if ($matched==0) { + $fh = fopen($myFile, 'a') or die("can't open file"); + fwrite($fh, "$person=$status\n"); fclose($fh); } - if ($person == "beth") { - $myFile = "beth.txt"; - $fh = fopen($myFile, 'w') or die("can't open file"); - fwrite($fh, $status); - fclose($fh); - } } function summon_status($person) { - if ($person == "russ") { - $myFile = "russ.txt"; - $fh = fopen($myFile, 'r') or die("can't open file"); - $status = fread($fh, 5); - fclose($fh); - } - if ($person == "beth") { - $myFile = "beth.txt"; - $fh = fopen($myFile, 'r') or die("can't open file"); - $status = fread($fh, 5); - fclose($fh); + $myFile = "summon.txt"; + $list = file("summon.txt"); + foreach ($list as $summoned) { + list($item,$flag) = split("=",$summoned); + if ($person == $item) { + return($flag); + } } return($status); } diff --git a/index.php b/index.php index f47bbef..e5a765a 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,6 @@ - @@ -228,18 +230,11 @@ function stopchanges(t) { function changeIcon(icon) { var icons=new Array(); - icons[0]="home"; - icons[1]="weather"; - icons[2]="lighting"; - icons[3]="music"; - icons[4]="cameras"; - icons[5]="security"; - icons[6]="climate"; - icons[7]="news"; - icons[8]="receipes"; - icons[9]="groceries"; - icons[10]="traffic"; - icons[11]="power"; + $icon) { + echo " icons[$key]='$icon';\n"; + } + ?> for ( var i=icons.length-1; i>=0; --i ){ if (icons[i] == icon) { document.getElementById(icon).src = "images/"+icon+"-on.png"; @@ -249,21 +244,8 @@ function changeIcon(icon) { } } -var securitypages=new Array(); - securitypages[0]="security1.html"; - securitypages[1]="security2.html"; - securitypages[2]="security3.html"; - securitypages[3]="security4.html"; - securitypages[4]="security5.html"; - securitypages[5]="security6.html"; - -function securitypageChange() { - ajaxpage(securitypages[i],'contentarea'); - i++; - if (i==securitypages.length) { - i=0; - } - t=setTimeout("securitypageChange()",10000); +function changepage() { + ajaxpage("cameras.php",'contentarea'); } function mediacenterSelect(ip) { @@ -327,8 +309,8 @@ function testDrawText3(canvas) context.shadowOffsetX=5; context.shadowOffsetY=5; context.shadowBlur=10; - context.fillText("HANDORF HOUSE", 10, 35); - context.strokeText("HANDORF HOUSE", 10, 35); + context.fillText("", 10, 35); + context.strokeText("", 10, 35); } testDrawText3(document.getElementById('canvas3')); @@ -362,7 +344,15 @@ title_status();
-Middle +
@@ -377,82 +367,69 @@ Middle - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- diff --git a/scripts/minify b/scripts/minify new file mode 100644 index 0000000..3524429 --- /dev/null +++ b/scripts/minify @@ -0,0 +1,104 @@ +#!/usr/bin/php -q + \ No newline at end of file diff --git a/set_summon_status.php b/set_summon_status.php index 9850723..2050b00 100644 --- a/set_summon_status.php +++ b/set_summon_status.php @@ -2,9 +2,10 @@ $person=$_GET['person']; $state=$_GET['status']; +include("config.php"); include("includes.php"); -echo "$person,$status"; +#echo "$person,$status"; summon($person,$status); ?> diff --git a/sqlite.php b/sqlite.php new file mode 100644 index 0000000..5752d9f --- /dev/null +++ b/sqlite.php @@ -0,0 +1,26 @@ + 0) { + // get each row as an array + // print values + echo ""; + while($row = sqlite_fetch_array($result)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
".$row[0]."".$row[1]."".$row[2]."
"; +} + +// all done +// close database file +sqlite_close($handle); +?> diff --git a/summon.txt b/summon.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/check_isy99i_status-lights.php b/test/check_isy99i_status-lights.php new file mode 100644 index 0000000..f492bcc --- /dev/null +++ b/test/check_isy99i_status-lights.php @@ -0,0 +1,72 @@ +"; + #print_r($array); + foreach($array['nodes']['node'] as $device) { + if ($device['enabled'] == "true") { + switch($device['type']) { + case "1.66.67.0": + echo $device['name']."\n"; + break; + case "1.31.65.0": + echo $device['name']."\n"; + break; + case "2.56.66.0": + echo $device['name']."\n"; + break; + case "2.20.56.0": + echo $device['name']."\n"; + break; + case "2.9.56.0": + echo $device['name']."\n"; + break; + case "2.6.64.15": + echo $device['name']."\n"; + break; + case "2.26.58.0": + echo $device['name']."\n"; + break; + case "2.20.56.30": + echo $device['name']."\n"; + break; + case "2.8.66.0": + echo $device['name']."\n"; + break; + case "1.32.65.0": + echo $device['name']."\n"; + break; + case "2.26.65.0": + echo $device['name']."\n"; + break; + case "1.65.69.0": + echo $device['name']."\n"; + break; + case "2.16.56.0": + echo $device['name']."\n"; + break; + case "2.18.56.0": + echo $device['name']."\n"; + break; + #case "": + # echo $device['name']."\n"; + # break; + } + } + } + #exit; + #echo substr(($array['nodeInfo']['node']['property']['0_attr']['formatted']),0,-1)." F"; +?> diff --git a/weather-php-test.php b/weather-php-test.php new file mode 100644 index 0000000..41fa20a --- /dev/null +++ b/weather-php-test.php @@ -0,0 +1,107 @@ + +load('http://weather/weather/all-output.xml'); + $arrFeeds = array(); + foreach ($doc->getElementsByTagName('weather') as $node) { + $itemRSS = array ( + $item => $node->getElementsByTagName($item)->item(0)->nodeValue, + ); + array_push($arrFeeds, $itemRSS); + } + echo $itemRSS[$item]; +} +?> + + + + + + + + + + + + + + + + + + + + +
TemperatureWind
+
+
[No canvas support]
+
+
+
+
[No canvas support]
+
+ +
+ + diff --git a/weather2.php b/weather2.php index 9df1549..ec07e1b 100644 --- a/weather2.php +++ b/weather2.php @@ -1,4 +1,4 @@ - + diff --git a/weather4.php b/weather4.php index e6cd238..320dae0 100644 --- a/weather4.php +++ b/weather4.php @@ -1,5 +1,5 @@
- +