'.$scrpt_vrsn_dt.PHP_EOL; # $read_net_data = true; # $scrpt = 'PWS_livedata.php'; $stck_lst .= basename(__FILE__).' ('.__LINE__.') include =>'.$scrpt.PHP_EOL; include $scrpt; #----------------------------------------------- # script settings #----------------------------------------------- #$body_image ='img/background-rain2.jpg'; $clr_offline = '#ff8841'; $clr_online = 'green'; $clr_trans = '1'; $clr_trans = '0.9'; // '1'; if ($current_theme == 'light') { $clr_htmlbg = '#dcdcdc'; /* bckground html */ $clr_mnbg = '#efeded'; /* bckground menu/header */ $clr_hdrdrk = '#cecece'; /* bckground text headers */ $clr_hdrbg = '#e0e0e0'; /* bckground block title */ $clr_blckbg = 'rgba(239,237,237,'.$clr_trans.')'; #'#efeded'; /* bckground block */ $clr_brdr = '#F0F0F0'; /* color border */ $clr_txt = '#000'; } /* color text */ elseif ($current_theme == 'user') { if (!file_exists('./_my_settings/user_theme.txt') ) { $clr_htmlbg = 'rgba(233,241,226)'; /* bckground html */ $clr_mnbg = '#b0cba0'; /* bckground menu/header */ $clr_hdrdrk = '#669966'; /* bckground text headers */ $clr_hdrbg = '#b0cba0'; /* bckground block title */ $clr_blckbg = 'rgba(233,241,226, 0.4)'; /* bckground block */ $clr_brdr = '#108400'; /* color border */ $clr_txt = '#000'; /* color text */ $clr_offline = '#f37867';} else { $lines = file( './_my_settings/user_theme.txt'); #echo print_r ($lines, true); exit; $stck_lst .= basename(__FILE__).' ('.__LINE__.') Processing ./_my_settings/user_theme.txt'.PHP_EOL; foreach ($lines as $line) { if (substr($line,0,1) <> '|') {continue;} list ($none,$key,$color) = explode ('|',$line.'|||'); $key = trim($key); $color = trim($color); if ($key == '' || $color == '') {continue;} $$key = $color; } // eo foreach } // customized colors } // eo user theme else { $clr_htmlbg = '#151819'; /* bckground html */ $clr_mnbg = '#393D40'; /* bckground menu/header */ $clr_hdrdrk = '#5b6165'; /* bckground text headers */ $clr_hdrbg = '#787f841a'; /* bckground headers */ $clr_blckbg = 'rgba(36,38,43,'.$clr_trans.')'; # '#24262B'; /* bckground block */ $clr_brdr = 'transparent'; /* color border */ $clr_txt = '#aaa'; } /* color text */ # $strng_style = 'html { color: '.$clr_txt.'; background-color: '.$clr_htmlbg.'; height: 100%; } a { color: '.$clr_txt.'; } h1 { background-color: '.$clr_mnbg.'; } .PWS_weather_item , .PWS_weather_item_s { border-color: '.$clr_brdr.'; background-color: '.$clr_blckbg.'; } .PWS_module_title { background-color: '.$clr_hdrbg.'; } .sidebarMenuInner .separator { border-top: 1px '.$clr_hdrdrk.' solid; border-bottom: 1px '.$clr_hdrdrk.' solid; } .PWS_bar { color: '.$clr_hdrbg.';} .PWS_border { border-color: '.$clr_brdr.';} .PWS_offline { color: '.$clr_offline.';} .PWS_online { color: '.$clr_online.';} #sidebarMenu { background-color: '.$clr_mnbg.'; }'.PHP_EOL; # if (isset ($_REQUEST['noborders']) ) {$txt_border = 'border: none;';} elseif (! isset ($txt_border) ) {$txt_border = '';} elseif ($txt_border == true) {$txt_border = '';} else {$txt_border = 'border: none;';} # header('Content-type: text/html; charset=UTF-8'); echo ' '; $frame_ok = false; // no invalid frames allowed $title_text = ' Home Weather Station ('.$livedataFormat.' version)'; # if (isset ($_REQUEST['frame']) && strlen(trim($_REQUEST['frame']) ) < 20 ) #### 2021-01-07 { $scrpt = 'PWS_frames.php'; $stck_lst .= basename(__FILE__).' ('.__LINE__.') include =>'.$scrpt.PHP_EOL; include $scrpt; # if (array_key_exists ($_REQUEST['frame'], $frm_ttls) ) { $key = $_REQUEST['frame']; if ( isset ($frm_ttls[$key]) ) { $title_text = ' '.$frm_ttls[$key];} $frame_ok = true;} } // eo check for menupage / frame ?>
'.print_r($arr_ppp,true); foreach ($arr_ppp as $key => $value) { $check = $value['show']; if ($check === true) {continue;} if ($check === false) {continue;} # echo ''.print_r($blck_ppp[$script][$key],true); $blck_ppp[$script][$key]['show'] = $$check; # echo ''.print_r($blck_ppp[$script][$key],true); exit; } } if (isset ($_REQUEST['test']) ) { echo ''.PHP_EOL; $stck_lst='';} if ($stripall == '') { $scrpt = 'clock_c_small.php'; $stck_lst .= basename(__FILE__).' ('.__LINE__.') include =>'.$scrpt.PHP_EOL; include $scrpt; # function PWS_weather_item ($id,$script) { global $info, $blck_ttls, $wdth, $reload_js_code, $used_lang, $current_theme, $blck_rfrs, $positionlast; #### 2021-06-18 echo ''.PHP_EOL; # echo ''.$blck_ttls[$script].''.PHP_EOL; if (array_key_exists($script,$blck_ttls) && $script <> $positionlast) #### 2021-08-03 2021-06-18 { $reload_js_code .='function '.$id.'()'.PHP_EOL; $reload_js_code .=' { $.ajax ( { cache:false,'.PHP_EOL; $reload_js_code .=' success:function(a){$("#'.$id.'").html(a); },'.PHP_EOL; $reload_js_code .=' type:"GET",url:"'.$script.'?lang='.$used_lang.'&theme='.$current_theme.'&id_blck='.$id.'"'.PHP_EOL; $reload_js_code .=' } )} '.PHP_EOL; if ($blck_rfrs[$script] > 0) { $reload_js_code .='setInterval('.$id.',' . '1000*'.$blck_rfrs[$script].');'.PHP_EOL;} $reload_js_code .='//'.PHP_EOL; } // load releoad #### 2021-06-18 } // eof PWS_weather_item $end_block= ''.PHP_EOL; PWS_weather_item ('positionlast',$positionlast);echo ''.PHP_EOL; } // eo stripall # # build middle part of page with x * y blocks # $loaded_bloks = array(); // register every block loaded once. # fill old default blocks $clean = array('position11' => 'temp_c_block.php', 'position21' => 'wind_c_block.php', 'position22' => 'baro_c_block.php', 'position23' => 'sun_c_block.php', 'position31' => 'rain_c_block.php'); foreach ($clean as $key => $default) { if (!isset ($$key) || $$key === '') {$$key = $default;}} # reset old block numers if (isset ($extra3used ) && $extra3used == 'wide' ) { $cols_extra = 1; unset ($extra3used); $position14 = $position1e; unset ($position1e); $position24 = $position2e; unset ($position2e); $position34 = $position3e; unset ($position3e);} elseif (isset ($extra3used ) && $extra3used == 'row' ) { $rows_extra = 1; unset ($extra3used); $position41 = $position1e; unset ($position1e); $position42 = $position2e; unset ($position2e); $position43 = $position3e; unset ($position3e);} # eo reset old block numers if (!isset ($rows_extra) ) {$rows_extra = 0;} if (!isset ($cols_extra) ) {$cols_extra = 0;} # echo ''; echo $end_block; PWS_weather_item ('position1',$position1); include $position1; echo $end_block; PWS_weather_item ('position2',$position2); include $position2; echo $end_block; if ((int)$cols_extra > 0) { PWS_weather_item ('position3',$position3); include $position3; echo $end_block; } PWS_weather_item ('position4',$position4); include $position4; echo $end_block; echo '
'.PHP_EOL; #$rows_extra = 2; $cols = 3 + $cols_extra; $rows = 3 + $rows_extra; echo ''.PHP_EOL; $blcks = array(); for ($n = 1; $n <= $rows; $n++) { for ($m = 1; $m <= $cols; $m ++) { $blcks[]= $m + (10 * $n); } } # echo ''.PHP_EOL; } // eo normal page display # # footer area # echo ''.print_r($blcks,true); exit; foreach ($blcks as $nr) { $id = 'position'.$nr; // postion11 if (!isset ($$id) ) // check if $position11 is defined (in settings) { $script = 'dummy'; $title = 'dummy'; } elseif ($$id == 'none') { continue; } elseif ($$id == 'dummy') { $script = 'dummy'; $title = 'dummy'; } elseif (! is_file ($$id) ) { $script = $$id; $title = 'not found'; } elseif (substr ($$id,-4) <> '.php' ) { $script = $$id; $title = 'not a script'; } else { $script = $$id; // contents of $position11 => script name if (!array_key_exists($script,$blck_ttls) ) { $title = 'not yet defined'; } else { $title = $blck_ttls[$script];} } # start block echo ''.PHP_EOL; # block header echo ''.PHP_EOL; } # echo ''.PHP_EOL; echo ' '.$title.''.PHP_EOL; echo ''.PHP_EOL; # block contents echo ''.PHP_EOL; # first check what we have to do for a block if ($script <> 'dummy' && array_key_exists ($script,$loaded_bloks) ) { echo 'already loaded at '.$loaded_bloks[$script];} // already used elseif ($script == 'dummy') { echo 'dummy placeholder ';} // empty block else { $loaded_bloks[$script] = $id; $s_script = $script; #### 2021-03-24 include $script; $script = $s_script; #### 2021-03-24 # now add $reload_js_code if it is a defined script if (array_key_exists($script,$blck_ttls) ) { $reload_js_code .='function '.$id.'()'.PHP_EOL; $reload_js_code .=' { $.ajax ( { cache:false,'.PHP_EOL; $reload_js_code .=' success:function(a){$("#'.$id.'").html(a); },'.PHP_EOL; $reload_js_code .=' type:"GET",url:"'.$script.'?lang='.$used_lang.'&theme='.$current_theme.'&units='.$units_used.'&id_blck='.$id.'"'.PHP_EOL; $reload_js_code .=' } )} '.PHP_EOL; if ($blck_rfrs[$script] > 0) { $reload_js_code .='setInterval('.$id.',' . '1000*'.$blck_rfrs[$script].');'.PHP_EOL;} $reload_js_code .='//'.PHP_EOL; } } // eo check if normal block # eo block contents echo ''.PHP_EOL; # block footer with links echo ''.PHP_EOL; if (key_exists($script,$blck_ppp)) { $img = ' '.$PWSpopup.' '; foreach ($blck_ppp [$script] as $arr) { if ($arr['show'] === false) {continue;} if ($arr['chartinfo'] == 'popup' ) { $string = $arr['popup']; if (strpos(' '.$string,'?') <> false ) { $string .= '&script='.$script;} else { $string .= '?script='.$script;} $string .= '&'.$url_theme # 2021-12-01 .'&'.$url_lang .'&'.$url_units; # 2021-12-01 echo '' .$img .$arr['text'] .''.PHP_EOL; } elseif ($arr['chartinfo'] == 'page' && $stripall == '') { echo '' .$img.$arr['text'].'';} elseif ($arr['chartinfo'] == 'external' ) { echo ''.$img.$arr['text'].'';} $img = ' - '; } // eo for each } // eo if key-exists echo '' .PHP_EOL; echo ''.PHP_EOL; # # generate reload of all blocks. # if ($frame_ok == false) { if (!isset ($test_started) ) {$test_started = '';} echo ''.PHP_EOL; } # now the menu is generated # if (!isset ($_REQUEST['stripall'])) { $scrpt = 'PWS_menu.php'; $stck_lst .= basename(__FILE__).' ('.__LINE__.') include_once =>'.$scrpt.PHP_EOL; include_once $scrpt; } if (isset ($_REQUEST['test']) ) echo ''.PHP_EOL; if (file_exists('_my_settings/hooks.txt')) {include '_my_settings/hooks.txt';} ?>
'.$weatherprogram['img'].' '; # # check age of history # $max_age= 24 * 3600; $title = 'Status '; if (!file_exists ('./_my_settings/history.txt')) { $hst_age= 0;} else { $hst_age= time() - filemtime('./_my_settings/history.txt') ;} if ( $hst_age > $max_age ) {$title .= 'history: stalled ';} if (!isset ($check_cron) ) {$check_cron = true; } #$check_cron = false; if (!file_exists ($livedata) ) { $live_time = 9999999;} else { $live_time = time() - filemtime ( $livedata);} if ( $live_time > 300) { $title .= ' Livedata: stalled';} if ( (time() - $weather['datetime']) > 400) { $title .= ' Weatherdata: old';} if ( !$check_cron === false ) # 2022-04-30 { if ( $hst_age > $max_age || $live_time > 300) { $bg = 'background-color: red; '; } else { $bg = ''; /* color: transparent; '; */} echo '' .'' .' ✓ ' .' '; } else { echo ''; } # echo $weather['swversion'].' - ' .$hardware.' - ' .$stationlocation.' '.PHP_EOL; if (trim($personalmessage) <> '') { echo '
'.lang($personalmessage);} echo ''; # show weather station icon if ($manufacturer == 'davis') { echo ' ';} elseif ($manufacturer == 'fineoffset') { echo '
';} elseif ($manufacturer == 'weatherflow' || $weatherflowoption == true) { echo '
';} else echo ''; # show bio link echo '
'.lang('Credits, contact and').' . . .