'.$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 ?> <?php echo $stationlocation.$title_text; ?> '' && file_exists($body_image) ) { $bd_stl2 = "background: transparent url('$body_image') no-repeat fixed center; background-size: cover; background-attachment: fixed; margin: 0; ";} echo ' '.PHP_EOL; # $homeicon=' '; $menuicon=' '; # echo ' '.PHP_EOL; if (file_exists('_my_settings/before.txt')) { include '_my_settings/before.txt';} #### 2021-04-17 echo '
'.PHP_EOL; # echo '

'.PHP_EOL; echo ' '.$menuicon.' '.lang('Menu').'      '.$homeicon.' '.lang('Home').'  '.PHP_EOL; if (isset ($frame_ok) && $frame_ok == true) { echo ' X ';} if(trim($units_used) != 'us') { $o_units = 'us'; $text='F'; } elseif ( $EW_unit <> $units_used ) // 'us' is not the default unit { $o_units = $EW_unit; $text='C'; } // 2022-12-27 else { $o_units = 'metric'; $text='C'; } // 2022-12-27 echo ' °'.$text.' '.PHP_EOL; echo '

'.PHP_EOL; $PWSpopup = ' '.PHP_EOL; # if ($frame_ok == true) { $frame = $key; if ( isset ($frm_type[$key]) ) { $type = $frm_type[$key]; } else { $type = 'frame'; } if (!isset ($frm_wdth[$frame])) { $width = 'width: 100%;'; $pagew = '';} else { $width = 'width: '.$frm_wdth[$frame].'px;'; $pagew = ' style="'.$width.'"'; } echo '
'.PHP_EOL; if ($type == 'frame') { echo ''.PHP_EOL;} # if ($type == 'img') { if (!isset ($frm_wdth[$frame])) { $width = 'max-width: 100%; height: auto;';} else { $width = 'max-width: '.$frm_wdth[$frame].'px; width: 100%; height: auto;';} echo ' '.$frame.' '.PHP_EOL;} # width: 100%; max-height: '.$frm_hgth[$frame].'px; # if ($type == 'div') { include $frm_src[$frame];} # echo '
'.PHP_EOL; } // eo check and optional display extra page # else { // there was no frame / optional page $reload_js_code = ''; // assemble reload script #### 2021-06-18 $scrpt = 'PWS_blocks.php'; $stck_lst .= basename(__FILE__).' ('.__LINE__.') include =>'.$scrpt.PHP_EOL; include $scrpt; foreach ($blck_ppp as $script => $arr_ppp) { #echo '
'.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 '
'.$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; # echo '
'.PHP_EOL; PWS_weather_item ('positionlast',$positionlast);echo '
loading'; 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; } // 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 '
'.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 '
'.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 ' '.$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; } # echo '
'.PHP_EOL; } // eo normal page display # # footer area # 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';} ?>

'.PHP_EOL; }