wsLoadSettings.php SettingsFiles should pe password protected - dated: 11-09-2015 11:48
1 | <?php ini_set('display_errors', 'On'); error_reporting(E_ALL);
2 | if (isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
3 | $filenameReal = __FILE__; # display source of script if requested so
4 | $download_size = filesize($filenameReal);
5 | header('Pragma: public');
6 | header('Cache-Control: private');
7 | header('Cache-Control: no-cache, must-revalidate');
8 | header("Content-type: text/plain");
9 | header("Accept-Ranges: bytes");
10 | header("Content-Length: $download_size");
11 | header('Connection: close');
12 | readfile($filenameReal);
13 | exit;
14 | }
15 | $pageName = 'wsLoadSettings.php';
16 | $pageVersion = '3.20 2015-09-06';
17 | #
18 | if (!isset($SITE)){echo "<h3>invalid call to script $pageName</h3>";exit;}
19 | $SITE['wsModules'][$pageName] = 'version: ' . $pageVersion;
20 | $pageFile = basename(__FILE__); // check to see this is the real script
21 | if ($pageFile <> $pageName) { $SITE['wsModules'][$pageFile] = 'this file loaded instead of '.$pageName; }
22 | if (!isset($pathString)) {$pathString='';}
23 | if (!function_exists ('ws_message') ){
24 | function ws_message ($message,$always=false,&$string=false) {
25 | global $wsDebug, $SITE;
26 | $echo = $always;
27 | if ( $echo == false && isset ($wsDebug) && $wsDebug == true ) {$echo = true;}
28 | if ( $echo == false && isset ($SIE['wsDebug']) && $SIE['wsDebug'] == true ) {$echo = true;}
29 | if ( $echo == true && $string === false) {echo $message.PHP_EOL;}
30 | if ( $echo == true && $string <> false) {$string .= $message.PHP_EOL;}
31 | }
32 | }
33 | ws_message ('<!-- module '.$pageFile.' ==== '.$SITE['wsModules'][$pageFile].' -->',true,$pathString);
34 | #---------------------------------------------------------------------------
35 | # '3.20 2015-09-06 beta rel 2.8 version
36 | #---------------------------------------------------------------------------
37 | $ws_arr_supp_wx = array ('CU', 'CW', 'DW', 'MB', 'MH', 'VW','WC', 'WD', 'WL', 'WS', 'WV', 'MP');
38 | # Set all defaults
39 | $SITE['noaaPage'] = $SITE['ecPage'] = $SITE['cwopPage'] = 'no'; // set to default / no values
40 | $SITE['canada'] = $SITE['europe'] = $SITE['america'] = $SITE['other'] = false;
41 | $SITE['belgium'] = $SITE['netherlands'] = $SITE['warnArea'] = false; // set to default / no values
42 | #
43 | $SITE['wdPage'] = $SITE['cwPage'] = $SITE['wdlPage'] = $SITE['wlPage'] = 'no';
44 | $SITE['wcPage'] = $SITE['cuPage'] = $SITE['mhPage'] = $SITE['mbPage'] = 'no';
45 | $SITE['MeteoplugPage'] =$SITE['cltrPage'] = $SITE['trendPage'] = $SITE['mwPage'] = 'no';
46 | $SITE['graphsPage'] = $SITE['wsYTags'] = 'no';
47 |
48 | $SITE['cookieName'] = 'weatherv4';
49 |
50 | $SITE['colorStyles'] = array ('weather adapted', 'green','blue','pastel','red','orange','none','ws_clouds','ws_cloudsn','ws_mist','ws_moon','ws_pclouds','ws_rain','ws_snow','ws_storm','ws_sun','ws_thunder');
51 | if (!defined('ENT_HTML5')) {define ('ENT_HTML5' , (16|32) );}
52 | $SITE['htmlVersion'] = ENT_HTML5; // html version of this template
53 | $SITE['commaDecimal'] = false; // most europeans use a comma for a decimal point. others a point
54 | $SITE['curlFollow'] = 'false'; // for sites using safe mode
55 | #---------------------------------------------------------------------------
56 | $SITE['imgDir'] = 'img/'; // directory under topfolder used for general images
57 | $SITE['cacheDir'] = 'cache/'; // directory to cache files
58 | $SITE['metarDir'] = 'metar/'; // directory for metar scripts
59 | $SITE['javascriptsDir'] = 'javaScripts/'; // all general javascripts
60 | $SITE['forecastsDir'] = 'forecasts/'; //
61 | $SITE['iconsDir'] = 'wsIcons/';
62 | $SITE['defaultIconsDir']= $SITE['iconsDir'].'default_icons/';
63 | $SITE['defaultIconsSml']= $SITE['iconsDir'].'default_icons_small/';
64 | $SITE['windIcons'] = $SITE['iconsDir'].'windIcons/';
65 | $SITE['windIconsSmall'] = $SITE['iconsDir'].'windIconsSmall/';
66 | $SITE['yrnoFcst'] = 'wsyrnofct/startMobi.php';
67 | #---------------------------------------------------------------------------
68 | # load user settings
69 | #---------------------------------------------------------------------------
70 | ws_message ( '<!-- module wsLoadSettings.php ('.__LINE__.'): loading wsUserSettings.php -->',true,$pathString);
71 | include '_my_texts/wsUserSettings.php';
72 | #
73 | if (isset($_REQUEST['debug']) || $SITE['wsDebug'] == true) {
74 | $SITE['wsDebug'] = true;
75 | $wsDebug = true;
76 | ini_set('display_errors', 'On'); error_reporting(E_ALL);
77 | ws_message ( '<!-- module wsLoadSettings.php ('.__LINE__.'): debug is switched on by user request - error reporting ALL -->',true,$pathString);
78 | $SITE['colorNumber'] = '3';
79 | }
80 | else { $SITE['wsDebug'] = false;
81 | ini_set('display_errors', NULL); error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
82 | $wsDebug = false;
83 | }
84 | if ($SITE['region'] <> 'europe') { // only works in europe
85 | $SITE['ewnID'] = false; $SITE['ewnMember'] = false;
86 | $SITE['hwaID'] = false; $SITE['hwaMember'] = false;
87 | } // only works in europe
88 | #
89 | if (isset($_REQUEST['wp'])) {
90 | $wp = substr(strtoupper($_REQUEST['wp']).$SITE['WXsoftware'],0,2);
91 | if (in_array ($wp, $ws_arr_supp_wx )) {
92 | $SITE['switch_wp'] = $SITE['WXsoftware'] = $wp;
93 | ws_message ( '<!-- module wsLoadSettings.php ('.__LINE__.'): user switches the weatherprogram to '.$SITE['WXsoftware'].' -->',true,$pathString);
94 | $extraP ='&wp='.$SITE['WXsoftware'];
95 | }
96 | }
97 | if (!isset ($SITE['WXsoftware']) ) {
98 | $SITE['WXsoftware'] = 'CU';
99 | ws_print_warning( 'WARNING - Please set your weather_program. Defaulted to '.$SITE['WXsoftware']);
100 | }
101 | if ($SITE['sideDisplay'] == false && $SITE['menuPlace'] == 'V') {$SITE['sideDisplay'] = true; };
102 | #
103 | if (!isset ($SITE['curCondFrom'])) {
104 | $SITE['curCondFrom'] = 'metar';
105 | ws_print_warning( 'WARNING - Please set your current conddition source. Defaulted to '.$SITE['curCondFrom']);
106 | }
107 | if ($SITE['curCondFrom'] == 'wd' && ($SITE['WXsoftware'] <> 'WD' && $SITE['WXsoftware'] <> 'CW')) {$SITE['curCondFrom'] = 'yahoo';}
108 | #
109 | if ($SITE['skipTop']) {$skiptopText = '#data-area';} else {$skiptopText = '';}
110 | #
111 | #---------------------------------------------------------------------------
112 | # W A R N I N G S
113 | #---------------------------------------------------------------------------
114 | $SITE['warningsEuro'] = $SITE['warningsNOAA'] = $SITE['warningsNWS'] = $SITE['warningsec'] = false;
115 | $SITE['warnImg'] = false; // set all default no
116 | #---------------------------------------------------------------------------
117 | #
118 | if ($SITE['region'] == 'america') { # U S A
119 | $SITE['america'] = true;
120 | if ($SITE['useCurly'] == true) {
121 | $SITE['warningScript'] = './usa/nws-alerts/wsnws-alerts.php';
122 | $SITE['warningsNWS'] = true;
123 | } else {
124 | $SITE['warningScript'] = './usa/noaa_warn/noaaWarning.php';
125 | $SITE['warningsNOAA'] = $SITE['warnings'] ;
126 | $SITE['warnImg'] = './wsIcons/NOAA_Icons_small/';
127 | }
128 | } elseif ($SITE['region'] == 'canada') { # C A N A D A
129 | $SITE['canada'] = true;
130 | $SITE['warningScript'] = './canada/ec_warning.php';
131 | $SITE['warningsec'] = $SITE['warnings'];
132 | } elseif ($SITE['region'] == 'europe') { # E U R O P E
133 | $SITE['europe'] = true;
134 | $SITE['warningScript'] = './europe/wrnWarningv3.php'; // Euro
135 | $SITE['warningsEuro'] = $SITE['warnPage'];
136 | $SITE['warnImg'] = './img/wrnImages/warn_';
137 | } else { // region = other
138 | $SITE['other'] = true;
139 | $SITE['warningsMenu'] = false;
140 | $SITE['warnings'] = false;
141 | $SITE['warnPage'] = false;
142 | $SITE['warningScript'] = './other/warning.php';
143 | }
144 | # // for more detailed info when there is a warning displayed
145 | $SITE['noaawarningURL'] = 'http://alerts.weather.gov/cap/wwaatmget.php?x='.$SITE['warnArea'].'&y=1';
146 | $SITE['EUwarningURL'] = 'http://www.meteoalarm.eu/index3.php?area='.$SITE['warnArea'].'&day=0&lang=ne_NL';
147 | #
148 | if ($SITE['warnings'] <> true) {
149 | $SITE['warnPage'] = false;
150 | $SITE['warningsEuro'] = $SITE['warningsNOAA'] = $SITE['warningsNWS'] = $SITE['warningsec'] = false;
151 | }
152 | #---------------------------------------------------------------------------
153 | # mobile site
154 | # detection which mobile device is used is done in index.php by loading mobi/ws_check_mobi.php
155 | #---------------------------------------------------------------------------
156 | $SITE['mobileDir'] = 'mobi/';
157 | $SITE['mobileSite'] = $SITE['mobileDir'].'mobi.php'; // for switching to mobile site; set to "" when no mobile support is needed
158 | #---------------------------------------------------------------------------
159 | # Ajax
160 | #---------------------------------------------------------------------------
161 | $SITE['imgAjaxDir'] = 'ajaxImages/'; // directory for ajaxImages with trailing slash
162 | $SITE['wsAjaxScript'] = $SITE['javascriptsDir'].'ajax.js'; // for AJAX enabled display
163 | $SITE['wsAjaxDataLoad'] = 'wsAjaxDataLoad_v3.php'; // load fresh data for ajax page at users site
164 | $SITE['ajaxGizmojs'] = $SITE['javascriptsDir'].'ajaxgizmo.js'; // rotate gizmo info
165 | $SITE['ajaxGizmo'] = 'wsAjaxGizmo.php'; // default Giozmo
166 | #---------------------------------------------------------------------------
167 | # Which scripts to use to process the supplied data
168 | #---------------------------------------------------------------------------
169 | $SITE['functions'] = 'wsFunctions.php'; // weather functions, override
170 | $SITE['langFunc'] = 'wsLangFunctions.php'; // general functions for languages
171 | $SITE['menuXml'] = 'wsMenuData.xml'; // menu processes 'incMenuDataWilsele.xml';
172 | $SITE['menuLoad'] = 'wsMenuLoad.php';
173 | $SITE['spidersTxt'] = 'spiders.txt';
174 | $SITE['uvScript'] = 'uvforecastv3.php'; // worldwide forecast script for UV Index
175 | $SITE['sideInc'] = 'wsSideColom.php';
176 | $SITE['bottomInc'] = 'wsBottom.php';
177 | $SITE['footer'] = 'wsFooter.php';
178 | #---------------------------------------------------------------------------
179 | # script names for conversion of weatherprogram data to website/ajax data
180 | #---------------------------------------------------------------------------
181 | $SITE['getData'] = 'wsDataGet.php'; // data from ws tags to intermidiate array
182 | $SITE['loadData'] = 'wsDataLoad.php'; // load data into variables (mostly ajax)
183 | #---------------------------------------------------------------------------
184 | # Website CSS files
185 | #---------------------------------------------------------------------------
186 | $SITE['CSSscreen'] = 'styleMain30.css'; // general stylesheet all pages
187 | $SITE['CSSprint'] = 'stylePrint20.css'; // general stylesheet all pages for printing
188 | $SITE['CSStable'] = 'styleTable20.css'; // general stylesheet all tables
189 | $SITE['CSSmenuHor'] = 'styleMenuDrop20.css'; // stylesheet horizontal drop down menus
190 | $SITE['CSSmenuVer'] = 'styleMenuVert20x.css'; // stylesheet vertical fly-out menus
191 | $SITE['CSSmood'] = 'styleMood20.css'; // stylesheet for adapting colors based on current weathercondition
192 |
193 | $SITE['noChoiceBackup'] = $SITE['noChoice'];
194 | $SITE['menuPlaceBackup']= $SITE['menuPlace'];
195 | $SITE['colorBackup'] = $SITE['colorNumber'];
196 | $SITE['headerBackup'] = $SITE['header'];
197 | $SITE['langBackup'] = $SITE['lang'];
198 |
199 | if (isset($_REQUEST['ipad']) ) { // modify standard settings if page formatting ipad is requested
200 | $SITE['ipad'] = true;
201 | $SITE['sideDisplay'] = false;
202 | $SITE['bottomDisplay'] = false;
203 | $SITE['stripAll'] = true;
204 | $SITE['stripMenu'] = true;
205 | $SITE['bannerTop'] = false;
206 | $SITE['bannerBottom'] = false;
207 | $SITE['warnings'] = false;
208 | $SITE['warningTxt'] = false;
209 | } else {$SITE['ipad'] = false;}
210 | #
211 | $SITE['supported_regions'] = array ('america','canada','europe','other');
212 | if (!in_array($SITE['region'], $SITE['supported_regions']) ) {$SITE['region'] = 'europe';}
213 | #
214 | $SITE['supportedUnits'] = array ();
215 | $SITE['supportedUnits'] ['temp'] = array('°C', '°F');
216 | $SITE['supportedUnits'] ['baro'] = array(' hPa', ' inHg',' mb' );
217 | $SITE['supportedUnits'] ['wind'] = array(' km/h', ' mph', ' kts', ' m/s', );
218 | $SITE['supportedUnits'] ['rain'] = array(' mm', ' in' );
219 | $SITE['supportedUnits'] ['snow'] = array(' cm', ' in' );
220 | #
221 | $region = $SITE['region'];
222 | #
223 | if (!in_array($SITE['uomTemp'], $SITE['supportedUnits'] ['temp']) ){
224 | if ($region == 'europe')
225 | {$SITE['uomTemp'] = $SITE['supportedUnits']['temp'][0];
226 | } else {$SITE['uomTemp'] = $SITE['supportedUnits']['temp'][1];}
227 | }
228 | if (!in_array($SITE['uomBaro'], $SITE['supportedUnits'] ['baro']) ){
229 | if ($region == 'europe')
230 | {$SITE['uomBaro'] = $SITE['supportedUnits']['baro'][0];
231 | } else {$SITE['uomBaro'] = $SITE['supportedUnits']['baro'][1];}
232 | }
233 | if (!in_array($SITE['uomWind'], $SITE['supportedUnits'] ['wind']) ){
234 | if ($region == 'europe')
235 | {$SITE['uomWind'] = $SITE['supportedUnits']['wind'][0];
236 | } else {$SITE['uomWind'] = $SITE['supportedUnits']['wind'][1];}
237 | }
238 | if (!in_array($SITE['uomRain'], $SITE['supportedUnits'] ['rain']) ){
239 | if ($region == 'europe')
240 | {$SITE['uomRain'] = $SITE['supportedUnits']['rain'][0];
241 | } else {$SITE['uomRain'] = $SITE['supportedUnits']['rain'][1];}
242 | }
243 | if (!in_array($SITE['uomSnow'], $SITE['supportedUnits'] ['snow']) ){
244 | if ($region == 'europe')
245 | {$SITE['uomSnow'] = $SITE['supportedUnits']['snow'][0];
246 | } else {$SITE['uomSnow'] = $SITE['supportedUnits']['snow'][1];}
247 | }
248 | #
249 | # ------------------------ check if we are allowed to set cookie and process all cookies
250 | #
251 | $uomBackup = array ();
252 | $uomBackup['uomTemp'] = $SITE['uomTemp'];
253 | $uomBackup['uomBaro'] = $SITE['uomBaro'];
254 | $uomBackup['uomWind'] = $SITE['uomWind'];
255 | $uomBackup['uomRain'] = $SITE['uomRain'];
256 | $uomBackup['uomSnow'] = $SITE['uomSnow'];
257 | $uomBackup['uomDistance']= $SITE['uomDistance'];
258 | $uomBackup['uomPerHour']= $SITE['uomPerHour'];
259 | $uomBackup['uomHeight'] = $SITE['uomHeight'];
260 |
261 | if (!isset ($SITE['fctOrg'] ) ) { $SITE['fctOrg'] = 'yahoo';}
262 | $SITE['fctOrgBackup'] = $SITE['fctOrg'];
263 |
264 | #
265 | if ($SITE['cookieSupport'] == true) {
266 | ws_message ( '<!-- module wsLoadSettings.php ('.__LINE__.'): loading wsCookie.php -->',false,$pathString);
267 | include 'wsCookie.php' ;
268 | }
269 | $uomTemp = $SITE['uomTemp'];
270 | $uomBaro = $SITE['uomBaro'];
271 | $uomRain = $SITE['uomRain'];
272 | $uomSnow = $SITE['uomSnow'];
273 | $uomDistance = $SITE['uomDistance'];
274 | $uomWind = $SITE['uomWind'];
275 | $uomPerHour = $SITE['uomPerHour'];
276 | $uomHeight = $SITE['uomHeight'];
277 |
278 | # set the Timezone abbreviation automatically based on $SITE['tz'];
279 | if (!function_exists('date_default_timezone_set')) {
280 | putenv("TZ=" . $SITE['tz']);
281 | } else {
282 | date_default_timezone_set($SITE['tz']);
283 | }
284 | $SITE['tzName'] = date("T",time());
285 | #
286 | #---------------------------------------------------------------------------
287 | # Automatic Info we might need
288 | #---------------------------------------------------------------------------
289 | if(isset($_SERVER['REMOTE_ADDR'])) {$SITE['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];}
290 | if(isset($_SERVER['REMOTE_HOST'])) {$SITE['REMOTE_HOST'] = $_SERVER['REMOTE_HOST'];}
291 | if(isset($_SERVER['DOCUMENT_ROOT'])) {$SITE['WEBROOT'] = $_SERVER['DOCUMENT_ROOT'];}
292 | if(isset($_SERVER['REQUEST_URI'])) {$SITE['REQURI'] = $_SERVER['REQUEST_URI'];}
293 | if(isset($_SERVER['SERVER_NAME'])) {$SITE['SERVERNAME'] = $_SERVER['SERVER_NAME'];}
294 | #---------------------------------------------------------------------------
295 | #
296 | if ($SITE['fctOrg'] == 'yahoo') {$SITE['yahooPage'] = true;}
297 | if ($SITE['fctOrg'] == 'metno') {$SITE['metnoPage'] = true;}
298 | if ($SITE['fctOrg'] == 'wxsim') {$SITE['wxsimPage'] = true;}
299 | if ($SITE['fctOrg'] == 'hwa') {$SITE['hwaPage'] = true;}
300 | if ($SITE['fctOrg'] == 'noaa') {$SITE['noaaPage'] = true;}
301 | if ($SITE['fctOrg'] == 'ec') {$SITE['ecPage'] = true;}
302 | #
303 | if ($SITE['region'] == 'america') {$SITE['hwaPage'] = $SITE['ecPage'] = false; }
304 | if ($SITE['region'] == 'canada') {$SITE['hwaPage'] = $SITE['noaaPage']= false; }
305 | if ($SITE['region'] == 'other') {$SITE['hwaPage'] = $SITE['noaaPage']= $SITE['ecPage'] = false; }
306 | if ($SITE['region'] == 'europe') {$SITE['noaaPage']= $SITE['ecPage'] = false; }
307 | if ($SITE['belgium'] == false && $SITE['netherlands'] == false) {$SITE['hwaPage'] = false;}
308 | #
309 | $string1 = '';
310 | if(isset($_SERVER['HTTP_HOST'])) {$string1 .= $_SERVER['HTTP_HOST'];}
311 | if(isset($_SERVER['PHP_SELF'])) {$string1 .= $_SERVER['PHP_SELF'];}
312 | $SITE['siteUrl']= 'http://'.str_replace ('index.php','',$string1);
313 | #
314 | if (isset ($index) && $index) {check_topfolder ($wsDebug);}
315 | #
316 | if (!isset ($SITE['uploadDir']) ) {$SITE['uploadDir'] = 'upload'.$SITE['WXsoftware'].'/';}
317 | if (!isset ($SITE['clientrawDir']) ) {$SITE['clientrawDir'] = 'upload'.$SITE['WXsoftware'].'/';}
318 | if (!isset ($SITE['graphImageDir']) ) {$SITE['graphImageDir'] = 'upload'.$SITE['WXsoftware'].'/';}
319 |
320 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
321 | $SITE['generatePage'] = 'no';
322 | if ($SITE['meteoplug']) {$SITE['MeteoplugPage'] = 'yes';}
323 | if ($SITE['wd_live']) {$SITE['wdlPage'] = $SITE['cltrPage'] = 'yes';}
324 | if ($SITE['meteoware']) {$SITE['mwPage'] = 'yes';}
325 | #
326 | if (!isset ($SITE['wuID']) || !$SITE['wuID'] || $SITE['wuID'] == '') { $SITE['wuHistPage'] = 'no'; } else {$SITE['wuHistPage'] = 'yes';}
327 | #
328 | $SITE['meteowareFile'] = './mwlive/mwliveRT.php?wp='.$SITE['WXsoftware'];
329 | $SITE['yrnoXmlName'] = 'yowindowRT.php?wp='.$SITE['WXsoftware'];
330 | $SITE['alltime_values'] = true; // weatherprogram supplies all-time values for temp and so on
331 | #---------------------------------------------------------------------------
332 | $save_to_cache = true;
333 |
334 | $SITE['wp_scripts'] = $SITE['uploadDir'];
335 |
336 | switch ($SITE['WXsoftware']) {
337 |
338 | case 'MH': # required settings for M E T E O H U B
339 | #
340 | $SITE['generatePage'] = 'yes';
341 | $SITE['trendPage'] = 'yes';
342 | $SITE['graphsPage'] = 'yes';
343 | #
344 | $SITE['WXsoftwareURL'] = 'http://wiki.meteohub.de/Main_Page';
345 | $SITE['WXsoftwareLongName']= 'Meteohub';
346 | $SITE['WXsoftwareIcon'] = 'img/meteohub.jpg';
347 |
348 | $SITE['realtime'] = 'cltrw';
349 | $SITE['realtime_file'] = $SITE['clientrawDir'].'clientraw.txt';
350 | $SITE['wp_scripts'] = 'scriptsMH/';
351 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsMH.txt';
352 | $SITE['ydayTags'] = $SITE['uploadDir'].'tagsYdayMH.txt';
353 |
354 | $SITE['process'] = $SITE['wp_scripts'].'tagsMH.php';
355 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.mh.html';
356 | $SITE['wsYTagsSrc'] = $SITE['wp_scripts'].'tagsyday.mh.html';
357 | break;
358 | #---------------------------------------------------------------------------
359 | case 'MB': # required settings for M E T E O B R I D G E
360 | #
361 | $SITE['mbPage'] = 'yes';
362 | $SITE['trendPage'] = 'yes';
363 | $SITE['graphsPage'] = 'yes';
364 | $SITE['cltrPage'] = $SITE['wdlPage'] = 'no';
365 | $SITE['wd_live'] = false;
366 | #
367 | $SITE['WXsoftwareURL'] = 'http://www.meteobridge.com/wiki/index.php/Main_Page';
368 | $SITE['WXsoftwareLongName']= 'Meteobridge';
369 | $SITE['WXsoftwareIcon'] = 'img/meteobridge.jpg';
370 |
371 | $SITE['realtime'] = 'http';
372 | $SITE['realtime_file'] = $SITE['clientrawDir'].'realtime.txt';
373 | $SITE['wp_scripts'] = 'scriptsMB/';
374 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsMB.txt';
375 | $SITE['process'] = $SITE['wp_scripts'].'tagsMB.php';
376 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.mb.txt';
377 | break;
378 |
379 | #---------------------------------------------------------------------------
380 | case 'MP': # required settings for Meteoplug
381 | #
382 | # $SITE['DavisVP'] = false; // false as Meteoplug does not support Davis forecast text in xml
383 | #
384 | $SITE['generatePage'] = 'yes';
385 | $SITE['MeteoplugPage'] = $SITE['meteoplug'] = true;
386 | $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
387 | $SITE['wd_live'] = false;
388 | $SITE['alltime_values'] = true;
389 | #
390 | $SITE['WXsoftwareURL'] = 'http://wiki.meteoplug.com/Main_Page';
391 | $SITE['WXsoftwareLongName'] = 'Meteoplug';
392 | $SITE['WXsoftwareIcon'] = 'img/meteoplug.jpg';
393 | #
394 | $SITE['realtime'] = 'none';
395 | $SITE['wp_scripts'] = 'scriptsMP/';
396 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsMP.txt';
397 | $SITE['moonSet'] = 'inc/astronomy.php'; // to calculate moon set & rise values
398 | $SITE['cacheMP'] = 300; // cache time max allowed in seconds
399 | $SITE['process'] = $SITE['wp_scripts'].'tagsMP.php';
400 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.mp.txt';
401 | $save_to_cache = false;
402 | $SITE['meteoplugID'] = '';
403 |
404 | # echo 'halt'; exit;
405 | break;
406 |
407 | #---------------------------------------------------------------------------
408 | case 'WD': # required settings for W E A T H E R D I S P L A Y
409 | #
410 | $SITE['wdPage'] = 'yes';
411 | $SITE['trendPage'] = 'yes';
412 | $SITE['graphsPage'] = 'yes';
413 | $SITE['MeteoplugPage'] = 'no';
414 | #
415 | $SITE['WXsoftwareURL'] = 'http://www.weather-display.com/';
416 | $SITE['WXsoftwareLongName'] = 'Weather Display';
417 | $SITE['WXsoftwareIcon'] = 'img/wd.jpg';
418 | #
419 | $SITE['realtime'] = 'cltrw';
420 | $SITE['realtime_file'] = $SITE['clientrawDir'].'clientraw.txt';
421 | $SITE['wp_scripts'] = 'scriptsWD/';
422 | if (isset ($SITE['use_testtags']) && $SITE['use_testtags']) {
423 | $SITE['wsTags'] = $SITE['uploadDir'].'testtags.php';
424 | $SITE['process'] = 'ws_testtags.php';
425 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'testtags.txt';
426 | } else {
427 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsWD.txt';
428 | $SITE['process'] = $SITE['wp_scripts'].'tagsWD.php';
429 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.wd.txt';
430 | }
431 | break;
432 | #---------------------------------------------------------------------------
433 | case 'CW': # required settings for C O N S O L E WD (= on raspberryPI)
434 | #
435 | $SITE['cwPage'] = 'yes';
436 | $SITE['trendPage'] = 'yes';
437 | $SITE['wxsimPage'] = 'no';
438 | $SITE['alltime_values'] = false;
439 | $SITE['MeteoplugPage'] = 'no';
440 | #
441 | $SITE['WXsoftwareURL'] = 'http://www.weather-display.com/';
442 | $SITE['WXsoftwareLongName'] = 'consoleWD';
443 | $SITE['WXsoftwareIcon'] = 'img/consolewd.png';
444 | #
445 | $SITE['realtime'] = 'cltrw';
446 | $SITE['realtime_file'] = $SITE['clientrawDir'].'clientraw.txt';
447 | $SITE['wp_scripts'] = 'scriptsCW/';
448 | if (isset ($SITE['use_testtags']) && $SITE['use_testtags']) {
449 | $SITE['wsTags'] = $SITE['uploadDir'].'testtags.php';
450 | $SITE['process'] = 'ws_testtags.php';
451 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'wxlocal-testtags.html';
452 | } else {
453 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsCW.txt';
454 | $SITE['process'] = $SITE['wp_scripts'].'tagsCW.php';
455 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'wxlocal.html';
456 | }
457 | break;
458 | #---------------------------------------------------------------------------
459 | case 'CU': # required settings for C U M U L U S
460 | #
461 | $SITE['cuPage'] = 'yes';
462 | $SITE['trendPage'] = 'yes';
463 | $SITE['graphsPage'] = 'yes';
464 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
465 | $SITE['wd_live'] = $SITE['meteoplug']= false;
466 | #
467 | $SITE['WXsoftwareURL'] = 'http://sandaysoft.com/products/cumulus';
468 | $SITE['WXsoftwareLongName'] = 'Cumulus';
469 | $SITE['WXsoftwareIcon'] = 'img/cumulus.gif';
470 | #
471 | $SITE['realtime'] = 'json';
472 | $SITE['realtime_file'] = $SITE['clientrawDir'].'realtimeTags.txt';
473 |
474 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsCU.txt';
475 | $SITE['wp_scripts'] = 'scriptsCU/';
476 | $SITE['process'] = $SITE['wp_scripts'].'tagsCU.php';
477 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.cu.txt';
478 | break;
479 | #---------------------------------------------------------------------------
480 | case 'WL': # required settings for W E A T H E R L I N K
481 | #
482 | $SITE['wlPage'] = 'yes';
483 | $SITE['graphsPage'] = 'yes';
484 | $SITE['alltime_values'] = false;
485 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
486 | $SITE['wd_live'] = $SITE['meteoplug']= false;
487 | #
488 | $SITE['WXsoftwareURL'] = 'http://www.davisnet.com/index.asp';
489 | $SITE['WXsoftwareLongName'] = 'WeatherLink';
490 | $SITE['WXsoftwareIcon'] = 'img/weatherlink.png';
491 | #
492 | $SITE['realtime'] = 'weatherlink';
493 | $SITE['realtime_file'] = $SITE['clientrawDir'].'realtimev3.txt';
494 | $SITE['wp_scripts'] = 'scriptsWL/';
495 | $SITE['wsTags'] = $SITE['uploadDir'].'tags.wl.txt';
496 | $SITE['ydayTags'] = $SITE['uploadDir'].'tagsyday.wl.txt';
497 | $SITE['moonSet'] = 'inc/astronomy.php'; // to calculate moon set & rise values
498 |
499 | $SITE['process'] = $SITE['wp_scripts'].'tagsWL.php';
500 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.wl.htx';
501 | $SITE['wsYTagsSrc'] = $SITE['wp_scripts'].'tagsyday.wl.htx';
502 |
503 | if (!ws_date_format()) {ws_print_warning( 'WARNING - Please set the date format correct in your settings');}
504 | break;
505 | #---------------------------------------------------------------------------
506 | case 'WC': # required settings for W E A T H E R C A T (for Mac)
507 | #
508 | $SITE['wcPage'] = 'yes';
509 | $SITE['graphsPage'] = 'yes';
510 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
511 | $SITE['wd_live'] = $SITE['meteoplug']= false;
512 | #
513 | $SITE['WXsoftwareURL'] = 'http://trixology.com/weathercat/';
514 | $SITE['WXsoftwareLongName'] = 'WeatherCat';
515 | $SITE['WXsoftwareIcon'] = 'img/weathercat.png';
516 | #
517 | $SITE['realtime'] = 'json';
518 | $SITE['realtime_file'] = $SITE['clientrawDir'].'realtime.wc.txt';
519 | $SITE['wp_scripts'] = 'scriptsWC/';
520 | $SITE['wsTags'] = $SITE['uploadDir'].'tags.wc.txt';
521 | $SITE['moonSet'] = 'inc/astronomy.php'; // to calculate moon set & rise values
522 | $SITE['process'] = $SITE['wp_scripts'].'tagsWC.php';
523 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.wc.txt';
524 | break;
525 | #---------------------------------------------------------------------------
526 | case 'DW': # required settings for WeatherLink.com
527 | #---------------------------------------------------------------------------
528 | #
529 | $SITE['DavisVP'] = false; // false as wl.com does not support Davis forecast text in xml
530 | #
531 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
532 | $SITE['wd_live'] = $SITE['meteoplug']= false;
533 | $SITE['alltime_values'] = false;
534 | #
535 | $SITE['WXsoftwareURL'] = 'http://www.weatherlink.com/user/'.$SITE['wlink_key'].'/index.php';
536 | $SITE['WXsoftwareLongName'] = 'Davis Weatherlink.Com';
537 | $SITE['WXsoftwareIcon'] = 'img/wl_top.png';
538 | #
539 | $SITE['realtime'] = 'none';
540 | $SITE['wp_scripts'] = 'scriptsDW/';
541 | $SITE['wsTags'] = $SITE['wp_scripts'].'tagsWLCOM.php';
542 | $SITE['ydayTags'] = $SITE['uploadDir'].'tagsydayWLCOM.txt';
543 | $SITE['moonSet'] = 'inc/astronomy.php'; // to calculate moon set & rise values
544 | $SITE['cacheDW'] = 140; // cache time max allowed in seconds
545 | $SITE['process'] = $SITE['wp_scripts'].'tagsWLCOM.php';
546 | $SITE['wsTagsSrc'] = '';
547 | $SITE['wsYTagsSrc'] = $SITE['wp_scripts'].'tagsyday.cron.txt';
548 | $save_to_cache = false;
549 | $SITE['weatherlinkID'] = $SITE['wlink_key'];
550 | break;
551 | #---------------------------------------------------------------------------
552 | case 'WS': # required settings for WSWIN /
553 | #
554 | $SITE['trendPage'] = 'yes'; // trendpage
555 | $SITE['MeteoplugPage'] = $SITE['cltrPage'] = 'no';
556 | $SITE['wd_live'] = $SITE['meteoplug']= false;
557 | $SITE['alltime_values'] = false;
558 | $SITE['WXsoftwareURL'] = 'http://www.pc-wetterstation.de/en1index.html';
559 | $SITE['WXsoftwareLongName'] = 'WSWIN';
560 | $SITE['WXsoftwareIcon'] = 'img/wswin.gif';
561 |
562 | $SITE['realtime'] = 'cltrw';
563 | $SITE['realtime_file'] = $SITE['clientrawDir'].'clientraw.txt';
564 |
565 | $SITE['wp_scripts'] = 'scriptsWS/';
566 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsws.txt';
567 | $SITE['ydayTags'] = $SITE['uploadDir'].'tagsydayWS.txt';
568 |
569 | $SITE['process'] = $SITE['wp_scripts'].'tagsWS.php';
570 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.ws.txt';
571 | $SITE['wsYTagsSrc'] = $SITE['wp_scripts'].'tagsyday.cron.txt';
572 |
573 | break;
574 | #---------------------------------------------------------------------------
575 | case 'WV': # required settings for WVIEW /
576 | #
577 | $SITE['WXsoftwareURL'] = 'http://www.wviewweather.com/';
578 | $SITE['WXsoftwareLongName'] = 'WVIEW';
579 | $SITE['WXsoftwareIcon'] = 'img/wview.png';
580 | $SITE['alltime_values'] = false;
581 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
582 | $SITE['wd_live'] = $SITE['meteoplug']= false;
583 | $SITE['realtime'] = 'none';
584 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsWV.htm';
585 |
586 | # $SITE['wview_day_txt'] = $SITE['uploadDir'].'tags.htm';
587 | # $SITE['wsCronTags'] = $SITE['uploadDir'].'yesterdayTagsWVIEW.php';
588 | $SITE['ydayTags'] = $SITE['uploadDir'].'tagsydayWV.txt';
589 | $SITE['moonSet'] = 'inc/astronomy.php'; // to calculate moon set & rise values
590 | $SITE['wp_scripts'] = 'scriptsWV/';
591 | $SITE['process'] = $SITE['wp_scripts'].'tagsWV.php';
592 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tagsWV.htx';
593 | $SITE['wsYTagsSrc'] = $SITE['wp_scripts'].'tagsyday.cron.txt';
594 | #
595 | if (!ws_date_format()) {ws_print_warning( 'WARNING - Please set the date format correct in your settings');}
596 | $SITE['soilUsed'] = false;
597 |
598 | break;
599 | #---------------------------------------------------------------------------
600 | case 'VW': # required settings for VWS /
601 | #
602 | $SITE['alltime_values'] = false;
603 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
604 | $SITE['wd_live'] = $SITE['meteoplug']= false;
605 | $SITE['WXsoftwareURL'] = 'http://www.ambientweather.com/virtualstation.html';
606 | $SITE['WXsoftwareLongName'] = 'VWS';
607 | $SITE['WXsoftwareIcon'] = 'img/vws.gif';
608 |
609 | if (!ws_date_format()) {ws_print_warning( 'WARNING - Please set the date format correct in your settings');}
610 | #
611 | $SITE['wsTags'] = $SITE['uploadDir'].'tagsVW.txt'; // ##### location and name of the uploaded tags file
612 | $SITE['vws_day_txt'] = $SITE['wsTags'];
613 |
614 | $SITE['wp_scripts'] = 'scriptsVW/';
615 | $SITE['process'] = $SITE['wp_scripts'].'tagsVWS.php';
616 | $SITE['wsTagsSrc'] = $SITE['wp_scripts'].'tags.vws.htx';
617 |
618 | # ---- VWS realtime ---------------------------------------------------------
619 | $SITE['realtime'] = 'wflash'; // type of realtime file supported
620 | $SITE['wflash_folder'] = $SITE['clientrawDir']; // location of wflash files => if we started to use wflash
621 | $SITE['realtime_file'] = $SITE['wflash_folder'].'wflash.txt'; // default names of realtime files
622 | $SITE['realtime_file2'] = $SITE['wflash_folder'].'wflash2.txt';
623 | #
624 | $SITE['soilUsed'] = false;
625 | $SITE['clientrawDir'] = false;
626 | $SITE['MeteoplugPage'] = $SITE['wdlPage'] = $SITE['cltrPage'] = 'no';
627 | $SITE['trendPage'] = 'no';
628 | $SITE['wd_live'] = $SITE['meteoplug']= false;
629 |
630 | break;
631 | #---------------------------------------------------------------------------
632 | default:
633 | echo '<H3>Other software not supported (yet)</h3>'.PHP_EOL; exit;
634 | }
635 | #---------------------------------------------------------------------------
636 | $SITE['wsRealTime'] = 1*60+30; // number of seconds before realtime (or clntraw) data is considered obsolete
637 | $SITE['wsNormTime'] = 5*60+30; // number of seconds before (tags) data is considered obsolete
638 | $SITE['wsFtpTime'] = 60*60+30; // number of seconds before all data (graphs) is considered obsolete
639 | $SITE['wsDataTime'] = 5*60+30; // number of seconds before all data (actual internal time) is considered obsolete
640 | #---------------------------------------------------------------------------
641 |
642 | $SITE['langDir'] = 'lang/'; // all language translation files are store here
643 |
644 | return;
645 | # --------------- functions for checking settings --------------------------------------
646 | function ws_print_warning ($message) {
647 | global $SITE;
648 | if ($SITE['wsDebug']) {
649 | if (!isset ($SITE['message']) ) {$SITE['message']='';}
650 | $SITE['message'] .= $message.'<br />'.PHP_EOL;
651 | }
652 | }
653 | function ws_check_setting (&$setting) {
654 | global $SITE;
655 | if (!isset ($setting) ) {return false;}
656 | elseif ($setting == false) {return false;}
657 | elseif ($setting === true) {return true;}
658 | elseif ($setting == 'yes') {return true;}
659 | elseif ($setting == '1') {return true;}
660 | else return false;
661 | }
662 | function check_topfolder ($check=true) {
663 | global $SITE;
664 | if ($check <> true) {return true;}
665 |
666 | $docRoot = $_SERVER['DOCUMENT_ROOT'].'/';
667 | # $docRoot = str_replace ('//','/',$docRoot);
668 | $string = $_SERVER['SCRIPT_FILENAME'];
669 | $folders = str_replace($docRoot , '', $string);
670 | $folders = str_replace('\\' , '/', $folders);
671 | $arr = explode ('/', $folders);
672 | $count = count($arr);
673 | $n = $count - 1;
674 | switch ($count) {
675 | case 2:
676 | $FIND['topfolder'] = $arr['0'].'/';
677 | break;
678 | case 1:
679 | $FIND['topfolder'] = './';
680 | break;
681 | default:
682 | $end = $count - 2;
683 | $FIND['topfolder'] = '';
684 | for ($i = 0; $i <= ($end); $i++) { // assemble the topfolder
685 | $FIND['topfolder'] .= $arr[$i].'/';
686 | }
687 | $end++;
688 | }
689 | if ($SITE["topfolder"] <> $FIND['topfolder']) {
690 | ws_print_warning ('WARNING - Change wsUserSettings.php: $SITE["topfolder"] from : '.$SITE["topfolder"].' to: '.$FIND['topfolder']);
691 | }
692 | }
693 | function ws_date_format() {
694 | global $SITE, $my_date_format, $my_char_sep, $my_month, $my_year, $my_day;
695 |
696 | if (!isset ($my_date_format) ) {
697 | $SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/';
698 | $SITE['my_date_format'] = 'dd-mm-yyyy';
699 | return false;
700 | }
701 | else {$SITE['my_date_format'] = $my_date_format;}
702 | #
703 | if ($my_date_format == 'dd-mm-yyyy') {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '-'; return true;}
704 | elseif ($my_date_format == 'dd-mm-yy') {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '-'; return true;}
705 | elseif ($my_date_format == 'dd/mm/yyyy') {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return true;}
706 | elseif ($my_date_format == 'dd/mm/yy') {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return true;}
707 |
708 | elseif ($my_date_format == 'mm-dd-yyyy') {$SITE['tags_ymd'] = array (3,1,2); $SITE['tags_ymd_sep'] = '-'; return true;}
709 | elseif ($my_date_format == 'mm-dd-yy') {$SITE['tags_ymd'] = array (3,1,2); $SITE['tags_ymd_sep'] = '-'; return true;}
710 | elseif ($my_date_format == 'mm/dd/yyyy') {$SITE['tags_ymd'] = array (3,1,2); $SITE['tags_ymd_sep'] = '/'; return true;}
711 | elseif ($my_date_format == 'mm/dd/yy') {$SITE['tags_ymd'] = array (3,1,2); $SITE['tags_ymd_sep'] = '/'; return true;}
712 | # no valid setting found so far
713 | if (!isset ($my_char_sep) ) {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
714 | $SITE['tags_ymd_sep'] = trim($my_char_sep);
715 | if (strlen ($SITE['tags_ymd_sep']) <> 1) {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
716 | # the separator is Ok, lets check the yy mm dd
717 | if (!isset ($my_month) || !isset ($my_year) || !isset ($my_day) )
718 | {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
719 | if (!is_numeric($my_month) || !is_numeric($my_year) || !is_numeric($my_day) )
720 | {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
721 | $my_month = (int) $my_month;
722 | $my_year = (int) $my_year;
723 | $my_day = (int) $my_day;
724 | $total = $my_month + $my_year + $my_day;
725 | if ($total <> 6) {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
726 | $error = false;
727 | if ($my_month > 3 || $my_month < 1) {$error = true;}
728 | if ($my_year > 3 || $my_year < 1) {$error = true;}
729 | if ($my_day > 3 || $my_day < 1) {$error = true;}
730 | if ($error) {$SITE['tags_ymd'] = array (3,2,1); $SITE['tags_ymd_sep'] = '/'; return false;}
731 | $SITE['tags_ymd'] = array ($my_year,$my_month,$my_day);
732 | return true;
733 | }
734 | # ---------------------- version history
735 | # 3.20 2015-09-06 release 2.8 version