This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathupdater.php
169 lines (149 loc) · 6.89 KB
/
updater.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!-- begin updater.php 30-Mar-2019 -->
<?php
include_once('settings1.php');
include_once('common.php');
date_default_timezone_set($TZ);
?>
<script src="js/jquery.js"></script>
<script>
//update the charts,eq,forecast data and current conditions//
var refreshId;$(document).ready(function(){stationcron()});function stationcron(){$.ajax({cache:false,
success:function(a){$("#blank")
.html(a);<?php if ($wuupdate >0) {
echo 'setTimeout(stationcron,' . 221000*$wuupdate.')';}?>},
contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
type:"GET",url:"jsondata/wuupdate.php"})};
//update the modules
//update the modules position 1
var refreshId;$(document).ready(function(){position1()});function position1(){$.ajax({cache:false,success:function(a){$("#position1").html(a);<?php if ($notifyRefresh > 0) {
echo 'setTimeout(position1,' . 221000*$indoorRefresh.')';
} ?>},
contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
type:"GET",url:"<?php echo $position1 ;?>"})};
//update the modules position 2
var refreshId;$(document).ready(function(){indoor()});function indoor(){$.ajax({cache:false,success:function(a){$("#position2").html(a);<?php if ($indoorRefresh > 0) {
echo 'setTimeout(indoor,' . 60000*$indoorRefresh.')';
} ?>},
contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
type:"GET",url:"<?php echo $position2 ;?>"})};
// position 3
var refreshId;$(document).ready(function(){earthquake()});function earthquake(){$.ajax({cache:false,success:function(a){$("#position3").html(a);<?php if ($eqRefresh > 0) {
echo 'setTimeout(earthquake,' . 1000*$eqRefresh.')';
} ?>},type:"GET",url:"<?php echo $position3 ?>"})};
// position 4
var refreshId;$(document).ready(function(){notification()});function notification(){$.ajax({cache:false,success:function(a){$("#position4").html(a);<?php if ($notifyRefresh > 0) {
echo 'setTimeout(notification,' . 1000*$notifyRefresh.')';
} ?>},type:"GET",url:"<?php echo $position4 ;?>"})};
// outdoor temp
var refreshId;$(document).ready(function(){temperature()});function temperature(){$.ajax({cache:false,success:function(a){$("#temperature").html(a);<?php if ($tempRefresh > 0) {
echo 'setTimeout(temperature,' . 1000*$tempRefresh.')';
} ?>},type:"GET",url:"<?php echo $temperaturemodule?>"})};
//current conditions icon
var refreshId;$(document).ready(function(){currentsky()});function currentsky(){$.ajax({cache:false,success:function(a){$("#currentsky").html(a);<?php if ($skyRefresh > 0) {
echo 'setTimeout(currentsky,' . 1000*$skyRefresh.')';
} ?>},type:"GET",url:"<?php echo $currentconditions ;?>"})};
// wind speed / direction
var refreshId;$(document).ready(function(){windspeed()});function windspeed(){$.ajax({cache:false,success:function(a){$("#windspeed").html(a);<?php if ($windSpeedRefresh > 0) {
echo 'setTimeout(windspeed,' . 1000*$windSpeedRefresh.')';
} ?>},type:"GET",url:"windspeeddirection.php"})};
//barometer
var refreshId;$(document).ready(function(){barometer()});function barometer(){$.ajax({cache:false,success:function(a){$("#barometer").html(a);<?php if ($baroRefresh > 0) {
echo 'setTimeout(barometer,' . 1000*$baroRefresh.')';
} ?>},type:"GET",url:"barometer.php"})};
// moonphase
var refreshId;$(document).ready(function(){moonphase()});function moonphase(){$.ajax({cache:false,success:function(a){$("#moonphase").html(a);<?php if ($moonRefresh > 0) {
echo 'setTimeout(moonphase,' . 1000*$moonRefresh .')';
} ?>},type:"GET",url:"<?php echo $sunoption?>"})};
// rainfall
var refreshId;$(document).ready(function(){rainfall()});function rainfall(){$.ajax({cache:false,success:function(a){$("#rainfall").html(a);<?php if ($rainRefresh > 0) {
echo 'setTimeout(rainfall,' . 1000*$rainRefresh.')';
} ?>},type:"GET",url:"rainfall.php"})};
// position12
var refreshId;$(document).ready(function(){solar()});function solar(){$.ajax({cache:false,success:function(a){$("#solar").html(a);<?php if ($solarRefresh > 0) {
echo 'setTimeout(solar,' . 1000*$solarRefresh.')';
} ?>},type:"GET",url:'<?php echo $position12?>'})};
//last module
var refreshId;$(document).ready(function(){dldata()});function dldata(){$.ajax({cache:false,success:function(a){$("#dldata").html(a);<?php if ($daylightRefresh > 0) { echo 'setTimeout(dldata,' . 1000*$daylightRefresh.')'; } ?>}, type:"GET",url:"<?php echo $positionlastmodule?>"})};
//current 3dy forecast
var refreshId;$(document).ready(function(){currentfore()});function currentfore(){$.ajax({cache:false,success:function(a){$("#currentfore").html(a);setTimeout(currentfore,360000)},type:"GET",url:"<?php echo $position6?>"})};
</script>
<?php if ($position1=="weather34clock.php"){?>
<script>
// power the clock display in position1 using JavaScript
var clockID;var yourTimeZoneFrom=<?php echo $UTC?>;var d=new Date();
<?php
// Added code to display clock using supported languages - ktrue - 30-Mar-2019
$rc = setlocale(LC_TIME,explode(',',$lang_locale));
print "// language='$language' lang_locale='$lang_locale' setlocale='$rc' \n";
$months = array_map(
function($m){
return strftime("%b",mktime(0, 0, 0, $m, 2, 1970)) ;
},
range(1, 12)
);
//var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
print "var months=[";
foreach ($months as $n => $abbr) {
if($n>0) {print ",";}
print "\"$abbr\"";
}
print "]; //using $language month names\n";
$days = array_map(
function($m) {
return strftime("%a",mktime(0, 0, 0, 1, $m+3, 1970)) ; // days of the week (Sun first)
},
range(1, 7)
);
//var weekdays=["Sun","Mon","Tue","Wed","Thur","Fri","Sat"];
print "var weekdays=[";
foreach ($days as $n => $abbr) {
if($n>0) {print ",";}
print "\"$abbr\"";
}
print "]; //using $language day names\n";
print "var useAMPM = ";
print preg_match('|g|',$timeFormat)?' true':' false';
print " // time format\n";
print "var ampmLegend = '".date('a')."';\n";
?>
var tzDifference = yourTimeZoneFrom * 60 + d.getTimezoneOffset();
var offset = tzDifference * 60 * 1000;
function UpdateClock() {
var e = new Date(new Date().getTime() + offset);
var c = e.getHours();
var a = e.getMinutes();
var g = e.getSeconds();
var f = e.getFullYear();
var h = months[e.getMonth()];
var b = e.getDate();
var i = weekdays[e.getDay()];
if (a < 10) {
a = "0" + a
}
if (g < 10) {
g = "0" + g
}
if (!useAMPM & c < 10) {
c = "0" + c
}
var c2 = c;
if (useAMPM) {
if (c > 12) {c2 = c - 12; ampm = 'pm'} else { ampm = 'am' } // afternoon v.s. morning
if (c == 12) { ampm='pm' } // noon
if (c < 1 ) {c2 = c+12;} // midnight
}
if(useAMPM) {c = c2;} else {ampm = '';}
document.getElementById("theTime").innerHTML = "<div class='weatherclock34'> " + i + " " + b + " " + h + " " + f + "<div class='orangeclock'>" + c + ":" + a + ":" + g + ampm
}
function StartClock() {
clockID = setInterval(UpdateClock, 500)
}
function KillClock() {
clearTimeout(clockID)
}
window.onload = function () {
StartClock()
};
</script>
<?php }?>
<!-- end updater.php -->