-
Notifications
You must be signed in to change notification settings - Fork 10
/
earthquake.php
242 lines (187 loc) · 12.3 KB
/
earthquake.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php include('livedata.php');include('common.php');date_default_timezone_set($TZ);$json_string=file_get_contents('jsondata/eqnotification.txt');$parsed_json=json_decode($json_string,true);
$software = 'Cumulus <span>Software</span>';
$designedfor = '<br>For Cumulus';
$magnitude=number_format($parsed_json{0}{'magnitude'},1);
$eqtitle=$parsed_json{0}['location'];
$time=$parsed_json{0}['date_time'];
$lati=$parsed_json{0}['latitude'];
$longi=$parsed_json{0}['longitude'];
$time=$parsed_json{0}['date_time'];
$eventime=date($timeFormatShort,strtotime("$time"));
$magnitude1=number_format($parsed_json{1}{'magnitude'},1);
$eqtitle1=$parsed_json{1}['location'];
$lati1=$parsed_json{1}['latitude'];
$longi1=$parsed_json{1}['longitude'];
$time1=$parsed_json{1}['date_time'];
$eventime1=date($timeFormatShort,strtotime("$time1"));
$magnitude2=number_format($parsed_json{2}{'magnitude'},1);
$eqtitle2=$parsed_json{2}['location'];
$lati2=$parsed_json{2}['latitude'];
$longi2=$parsed_json{2}['longitude'];
$time2=$parsed_json{2}['date_time'];
$eventime2=date($timeFormatShort,strtotime("$time2"));
$magnitude3=number_format($parsed_json{3}{'magnitude'},1);
$eqtitle3=$parsed_json{3}['location'];
$lati3=$parsed_json{3}['latitude'];
$longi3=$parsed_json{3}['longitude'];
$time3=$parsed_json{3}['date_time'];
$eventime3=date($timeFormatShort,strtotime("$time3"));?>
<?php
// CALCULATE THE DISTANCE OF LATEST EARTHQUAKE //
// FROM LOCATION OF HOMEWEATHER STATION //
// Brian Underdown July 28th 2016 updated May 25th 2017//
$eqdist;
if ($weather["wind_units"] == 'mph') {
$eqdist = round(distance($lat, $lon, $lati, $longi) * 0.621371) . " mi";} else {$eqdist = round(distance($lat, $lon, $lati, $longi)) . " km";}
$eqdist1;
if ($weather["wind_units"] == 'mph') {
$eqdist1 = round(distance($lat, $lon, $lati1, $longi1) * 0.621371) . " mi";} else {$eqdist1 = round(distance($lat, $lon, $lati1, $longi1)) . " km";}
$eqdist2;
if ($weather["wind_units"] == 'mph') {
$eqdist2 = round(distance($lat, $lon, $lati2, $longi2) * 0.621371) . " mi";} else {$eqdist2 = round(distance($lat, $lon, $lati2, $longi2)) . " km";}
$eqdist3;
if ($weather["wind_units"] == 'mph') {
$eqdist3 = round(distance($lat, $lon, $lati3, $longi3) * 0.621371) . " mi";} else {$eqdist3 = round(distance($lat, $lon, $lati3, $longi3)) . " km";}
?>
<div class="eqcirclehomeregional">
<div class="eqtexthomeregional">
<?php ;
//compiled on May 25th 2017 weather earthquake the last 4 regional earthquakes will take priority //
//regional >
//+5.5
if ($eqdist<$notifyDistEQ && $magnitude>5){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalstrong>".$lang['StrongE']."</regionalstrong></div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
else if ($eqdist1<$notifyDistEQ && $magnitude1>5){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude1}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['Regional']." <regionalstrong>".$lang['Strong']."</regionalstrong></div>
<div class=\"eqtexthome\"> $eqtitle1 <br> Time: $eventime1 <br> Distance<colordist>".$eqdist1."</colordist> </div>";}
else if($eqdist2<$notifyDistEQ && $magnitude2>5){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude2}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalstrong>".$lang['StrongE']."</regionalstrong></div>
<div class=\"eqtexthome\"> $eqtitle2 <br> Time: $eventime2 <br> Distance<colordist>".$eqdist2."</colordist> </div>";}
else if ($eqdist3<$notifyDistEQ && $magnitude3>5){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude3}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionaEl']." <regionalstrong>".$lang['StrongE']."</regionalstrong></div>
<div class=\"eqtexthome\"> $eqtitle3 <br> Time: $eventime3 <br> Distance<colordist>".$eqdist3."</colordist> </div>";}
// regional +4
else if ($eqdist<$notifyDistEQ && $magnitude4>4){echo "<div class=\"eqcircle1home\"><spanyellowmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanyellowmag></eqcircle1home></div>
<div class =\"spane\">".$lang['RegionalE']." <regionalmoderate>".$lang['ModerateE']."</regionalmoderate></div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
else if ($eqdist1<$notifyDistEQ && $magnitude1>4){echo "<div class=\"eqcircle1home\"><spanyellowmag>${magnitude1}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanyellowmag></eqcircle1home></div>
<div class =\"spane\">".$lang['RegionalE']." <regionalmoderate>".$lang['ModerateE']."</regionalmoderate></div>
<div class=\"eqtexthome\"> $eqtitle1 <br> Time: $eventime1 <br> Distance<colordist>".$eqdist1."</colordist> </div>";}
else if($eqdist2<$notifyDistEQ && $magnitude2>4){echo "<div class=\"eqcircle1home\"><spanyellowmag>${magnitude2}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanyellowmag></eqcircle1home></div>
<div class =\"spane\">".$lang['RegionalE']." <regionalmoderate>".$lang['ModerateE']."</regionalmoderate></div>
<div class=\"eqtexthome\"> $eqtitle2 <br> Time: $eventime2 <br> Distance<colordist>".$eqdist2."</colordist> </div>";}
else if ($eqdist3<$notifyDistEQ && $magnitude3>4){echo "<div class=\"eqcircle1home\"><spanyellowmag>${magnitude3}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanyellowmag></eqcircle1home></div>
<div class =\"spane\">".$lang['RegionalE']." <regionalmoderate>".$lang['ModerateE']."</regionalmoderate></div>
<div class=\"eqtexthome\"> $eqtitle3 <br> Time: $eventime3 <br> Distance<colordist>".$eqdist3."</colordist> </div>";}
//regional <4
else if ($eqdist<$notifyDistEQ && $magnitude<4){echo "<div class=\"eqcircle1home\"><spangreenmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spangreenmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalminor>".$lang['MinorE']."</regionalminor></div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
else if ($eqdist1<$notifyDistEQ && $magnitude1<4){echo "<div class=\"eqcircle1home\"><spangreenmag>${magnitude1}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spangreenmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalminor>".$lang['MinorE']."</regionalminor></div>
<div class=\"eqtexthome\"> $eqtitle1 <br> Time: $eventime1 <br> Distance<colordist>".$eqdist1."</colordist> </div>";}
else if($eqdist2<$notifyDistEQ && $magnitude2<4){echo "<div class=\"eqcircle1home\"><spangreenmag>${magnitude2}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spangreenmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalminor>".$lang['MinorE']."</regionalminor></div>
<div class=\"eqtexthome\"> $eqtitle2 <br> Time: $eventime2 <br> Distance<colordist>".$eqdist2."</colordist> </div>";}
else if ($eqdist3<$notifyDistEQ && $magnitude3<4){echo "<div class=\"eqcircle1home\"><spangreenmag>${magnitude3}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spangreenmag></eqcircle1home></div>
<div class =\"spane\"> ".$lang['RegionalE']." <regionalminor>".$lang['MinorE']."</minorregional></div>
<div class=\"eqtexthome\"> $eqtitle3 <br> Time: $eventime3 <br> Distance<colordist>".$eqdist3."</colordist> </div>";}
//worldwide will appear if no regional earthquakes are listed or detected
//minor
else if ($magnitude<4){echo "<div class=\"eqcircle1home\"><spangreenmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spangreenmag></eqcircle1home></div>
<div class =\"spane\"> <regionalminor>".$lang['MinorE']."</regionalminor> </div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
//moderate
else if ($magnitude<5){echo "<div class=\"eqcircle1home\"><spanyellowmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanyellowmag></eqcircle1home></div>
<div class =\"spane\"> <regionalmoderate>".$lang['ModerateE']."</regionalmoderate> </div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
//strong
else if ($magnitude<7){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag> </eqcircle1home></div>
<div class =\"spane\"> <regionalstrong>".$lang['StrongE']."</regionalstrong> </div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
//very strong
else if ($magnitude<10){echo "<div class=\"eqcircle1home\"><spanredmag>${magnitude}
<svgearthquake>
<svg id='i-activity' viewBox='0 0 32 32' width='10' height='10' fill='none' stroke='currentcolor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'>
<path d='M4 16 L11 16 14 29 18 3 21 16 28 16' />
</svg><svgearthquake>
</spanredmag> </eqcircle1home></div>
<div class =\"spane\"> Very <regionalstrong>".$lang['StrongE']."</regionalstrong> !!</div>
<div class=\"eqtexthome\"> $eqtitle <br> Time: $eventime <br> Distance<colordist>".$eqdist."</colordist> </div>";}
?>