check-fetch-times.php Version 1.56 - 16-Mar-2024

Website PHP information

Running on webhost 'novawx.dscloud.me' @ IP='173.79.203.96' (reverse IP Name='pool-173-79-203-96.washdc.fios.verizon.net')
Webserver OS: Linux lightning 4.4.302+ #69057 SMP Sat Sep 23 21:48:04 CST 2023 x86_64
PHP Version: 7.4.33 built for Linux
PHP cmd location: /usr/local/bin/php
Document root: /var/services/web
Template root: /volume1/web
allow_url_fopen = ON
allow_url_include = off
request_order = GP
Stream support for http is available
Stream support for https is available
Streams supported: compress.bzip2, compress.zlib, data, file, ftp, ftps, glob, http, https, phar, php, ssh2.exec, ssh2.scp, ssh2.sftp, ssh2.shell, ssh2.tunnel, zip
Socket transports: ssl, tcp, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3, udg, udp, unix

Contents of Website Structure files

top.php permissions=-rwxrwxrwx [0777]

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
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Base-* template sets)
############################################################################
#
#    Project:    Sample Included Website Design
#    Module:        top.php
#    Purpose:    Provides the initial top section of the website
#     Authors:    Kevin W. Reed <kreed@tnet.com>
#                TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
#     Copyright:    (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#    This document uses Tab 4 Settings
############################################################################
require_once("Settings.php");
require_once(
"common.php");
global    
$TITLE;
//Version  V3.01 - 03-Mar-2011 - added Content-Type header for charset switching
//Version  V3.02 - 23-Jul-2011 - added WXtags upload copy capability
//Version  V3.03 - 17-Nov-2011 - added support for right-to-left presentation format
//Version  V3.04 - 05-Feb-2013 - added support for HTML5+UTF8
//Version  V3.05 - 13-May-2020 - fix validation for UTF8 usage
//Version  V3.06 - 14-May-2021 - added WeeWX native support for AJAX
############################################################################
if(isset($useUTF8) and function_exists('set_langtrans_UTF8') ) {
    
set_langtrans_UTF8(); // convert langrans items to UTF-8
}
header("Content-Type: text/html; charset=".strtoupper($SITE['charset']));
if(isset(
$useHTML5) and $useHTML5) {
  print 
"<!DOCTYPE html>\n";
  print 
"<html";
  if (isset(
$SITE['ISOLang'][$SITE['lang']])) { // 
    
$olang $SITE['ISOLang'][$SITE['lang']];
    echo 
" lang=\"$olang\""
  }
  print 
">\n";
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php 
// end HTML5 v.s. XHTML 1.0 Transitional header
?>
<?php
 
if(isset($SITE['WXtags']) and $SITE['WXtags'] <> '') {
    
// see if upload copy should be done
    
$siteUploadFile preg_replace('|\.php$|','-new.php',$SITE['WXtags']);
    if(
file_exists($siteUploadFile) and 
       
is_writable($SITE['WXtags']) and
       
filesize($siteUploadFile) > filesize($SITE['WXtags']) - 1023 and
       
filemtime($siteUploadFile) > filemtime($SITE['WXtags']) ) {
         
$didCopy copy($siteUploadFile,$SITE['WXtags']);
         if(
$didCopy) {
             print 
"<!-- WXtags file updated successfully from $siteUploadFile -->\n";
         } else {
             print 
"<!-- WXtags file update failed from $siteUploadFile -->\n";
         }
    }
    if (isset(
$_REQUEST['debug']) and strtolower($_REQUEST['debug']) == 'y') {
      
$canWriteTags is_writable($SITE['WXtags'])?"is":"IS NOT";
      print 
"<!-- WXtags '".$SITE['WXtags']. "' $canWriteTags writeable. -->";
    }
    include_once(
$SITE['WXtags']);
 }
 
$doIconvUTF8 = ($SITE['charset'] == 'UTF-8' and $SITE['origCharset'] <> 'UTF-8')?true:false;
?>
  <head>
<?php if(isset($SITE['ajaxScript'])) { ?>
    <!-- ##### start AJAX mods ##### -->
    <script type="text/javascript" src="<?php echo $SITE['ajaxScript']; ?>"></script>
    <!-- AJAX updates by Ken True - http://saratoga-weather.org/wxtemplates/ -->
    <?php if($SITE['WXsoftware'] == 'WEEWX') { ?>
    <script type="text/javascript"> var usingWeeWX = true; </script>
    <?php } else { ?>
    <script type="text/javascript"> var usingWeeWX = false; </script>
    <?php // end using WeeWX ?>
<?php 
// end if ajaxScript ?>
<?php 
if (isset($showGizmo) and $showGizmo) { ?>
    <script type="text/javascript" src="ajaxgizmo.js"></script>
<?php if (isset($SITE['UV']) and !$SITE['UV']) {  // turn gizmo uv display off ?>
    <script type="text/javascript"> showUV = false; </script>
<?php   }  // end of turn gizmo uv display off ?>
<?php 
// end of showGizmo ?>
<?php 
if (file_exists("language-"$SITE['lang'] . ".js") and (!$doIconvUTF8) ) { ?>
    <script type="text/javascript" src="language-<?php echo $SITE['lang']; ?>.js"></script>
    <!-- language for AJAX script included -->
<?php }
  if(isset(
$useUTF8) and $useUTF8 and file_exists("language-"$SITE['lang'] . ".js") and $doIconvUTF8) {
    
$tjsfile file("language-"$SITE['lang'] . ".js");
    
$sceCharset $SITE['origCharset']; // set in common.php when useUTF8 invoked
    
print "    <script type=\"text/javascript\">\n// <![CDATA[ /* converted to UTF-8 from $sceCharset */\n";
    foreach (
$tjsfile as $n => $line) {
        print 
iconv($sceCharset,'UTF-8//TRANSLIT',$line);
    }
    print 
"// converted ".count($tjsfile)." lines of language-".$SITE['lang'].".js from $sceCharset to UTF-8 inline -->\n// ]]>\n    </script>\n"
  }
?>
    <meta name="description" content="Northern Virginia Weather" />
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo strtoupper($SITE['charset']); ?>" />
    <link rel="stylesheet" type="text/css" href="<?php echo $SITE['CSSscreen']; ?>" media="screen" title="screen" />
    <link rel="stylesheet" type="text/css" href="<?php echo $SITE['CSSprint']; ?>" media="print" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<?php 
if(isset($useHTML5) and $useHTML5) { // no pragma/cache-control for us

} else { ?>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
<?php // end HTML5 check 

if(isset($SITE['showTitleTemp']) and $SITE['showTitleTemp'] and isset($temperature)) {
  
$dispTUOM $temperature '&deg;'.strtoupper(preg_replace('|[^CF]+|i','',$uomtemp)). ' - ';
} else {
  
$dispTUOM '';
}
if( isset (
$TITLE) ) {
    echo 
"    <title>$dispTUOM$TITLE "</title>\n";
} else {
    echo 
"    <title>$dispTUOMlangtransstr($SITE['organ']) . "</title>\n";
}

if (isset(
$SITE['flyoutmenu']) and $SITE['flyoutmenu'] or
    isset(
$_REQUEST['menu']) and strtolower($_REQUEST['menu']) == 'test' ) {
  
$SITE['flyoutmenu'] = true;
  
$PrintFlyoutMenu false;
  
$genDiv =false;
  global 
$FlyoutCSS$FlyoutMenuText;
  include_once(
'flyout-menu.php');
  print 
$FlyoutCSS;
}
// Right-to-left language CSS mod
if(isset($SITE['CSS-RTL']) and file_exists($SITE['CSS-RTL']) and isset($SITE['RTL-LANG']) and 
   (
strpos($SITE['RTL-LANG'],$SITE['lang']) !== false) ) { // use the override CSS
   
print "<!-- lang='".$SITE['lang']."' using RTL CSS Override -->\n"
  
// print "<style type=\"text/css\">\n";
  // readfile($SITE['CSS-RTL']);
  // print "</style>\n";
  
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$SITE['CSS-RTL']."\"/>\n";
// end Right-to-left CSS override 
?>
<!-- World-ML template from http://saratoga-weather.org/wxtemplates/ -->
<!-- end of top -->

header.php permissions=-rwxrwxrwx [0777]

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
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (WD-World-ML template set)
############################################################################
#
#    Project:    Sample Included Website Design
#    Module:        header.php
#    Purpose:    Provides the displayable top of the website
#     Authors:    Kevin W. Reed <kreed@tnet.com>
#                TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
#     Copyright:    (c) 1992-2007 Copyright TNET Services, Inc.
###########################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#    This document uses Tab 4 Settings
############################################################################
//Version 1.01 - 28-Jul-2012 - integrated support for nws-alerts scripts
# Version 1.02 - 29-Dec-2021 - replace 'split' with 'explode' for PHP8
require_once("Settings.php");
require_once(
"common.php");

// add support for noCron=true fetch of nws-alerts to get current alerts
    
if(isset($SITE['NWSalertsCodes']) and count($SITE['NWSalertsCodes']) > 0) {
        include_once(
"nws-alerts-config.php"); // load the configuration for nws-alerts
        
if(isset($noCron) and $noCron) {
            print 
"<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->\n";
            include_once(
"nws-alerts.php");
        }
    }

############################################################################
if (isset($SITE['uomTemp']) ) {
  
$tuom $SITE['uomTemp'];
} else {
$tuom explode('°',$temperature);  // extract units
$tuom '&deg;' $tuom[1];
}
?>
<div id="page"><!-- page wrapper -->
<!-- header -->
    <div id="header">
      <h1 class="headerTitle">
        <a href="index.php" title="Browse to homepage"><img src="images/banner2.png" border="none" height= "55"></a><!-- <?php echo langtransstr($SITE['organ']); ?> -->
      </h1>    
      <div class="headerTemp">
        <span class="doNotPrint">
           <span class="ajax" id="ajaxbigtemp"><?php print isset($tempnodp)?"$tempnodp$tuom":"&nbsp;"?>
          </span>
        </span>
       </div>

      <div class="subHeader">
        <?php echo $SITE['location']; ?>
        <?php if($SITE['allowLanguageSelect']) { // insert code for language select ?>
               <br />
        <!-- begin language select -->
        <?php echo print_language_selects(); ?>
        <!-- end language select -->
        <?php // end code for language select ?>
      </div>
      <div class="subHeaderRight">
      <?php 
        
if (isset($showGizmo) and $showGizmo) {
          include_once(
"ajax-gizmo.php");
        } else {
          print 
"&nbsp;<br/><br/>\n"// needed as placeholder if no gizmo
        
}
      
?>
      </div><!-- end subHeaderRight -->
</div>
<!-- end of header -->    

menubar.php permissions=-rwxrwxrwx [0777]

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
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Base-USA template set)
############################################################################
#
#    Project:    Sample Included Website Design
#    Module:        menubar.php
#    Purpose:    Provides the menubar for the system
#     Authors:    Kevin W. Reed <kreed@tnet.com>
#                TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
#     Copyright:    (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#    This document uses Tab 4 Settings
############################################################################
//Version 1.01 - 28-Jul-2012 - added support for nws-alerts scripts
require_once("Settings.php");
require_once(
"common.php");
############################################################################
?>
<!-- menubar -->
<div class="doNotPrint">
      <div class="leftSideBar">
        <p class="sideBarTitle"><?php langtrans('Navigation'); ?></p>
<?php 
// NOTE: when adding new links to the site, put them in as <li></li> entries in
//   the <ul></ul> shown below.  The order of the links is the order they appear
//   in the left navigation menu.  
// Be careful to only use html as shown below, otherwise the program that
//   automatically shows which page you're on won't work quite right.
// Don't use single-quotes in the following area unless you prefix it with a 
//   backslash.
//   Correct:  "Steve\'s page"
//   Wrong:    "Steve's page"    <=== this will cause a PHP error in menubar.php
//
// Be sure to include a title="..." tag so folks can see more info via a tooltip
//   as they mouse over the link in the menu.
//Don't change the next line in any way
$html '
        <ul>
          <li><a href="wxindex.php" title="Home">Home</a></li>
          <li><a href="wxforecast.php" title="5-day Forecast">Forecast</a></li>
          <li><a href="wxsimforecast.php" title="WXSIM Forecast">WXSIM Forecast</a></li>
          <li><a href="wxradar.php" title="Radar">Radar</a></li>
          <li><a href="wxadvisory.php" title="Watches, Warnings, Advisories">Advisories</a></li>
          <li><a href="wxtrends.php" title="Daily weather statistics">Daily Stats</a></li>
          <li><a href="wxgraphs.php" title="24, 72, &amp; Monthly Graphs">Graphs</a></li>
          <li><a href="wxastronomy.php" title="Sun and Moon Data">Astronomy</a></li>
          <li><a href="wxlinks.php" title="Useful Links">Links</a></li>
          <li><a href="wxabout.php" title="About This Site">About Us</a></li>
          <li><a href="wxstatus.php" title="Station Status">Status</a></li>
        </ul>
'
// end of links set for site. Don't change this line in any way
 
if (isset($SITE['flyoutmenu']) and $SITE['flyoutmenu']) {
   global 
$FlyoutMenuText;
   print 
"<div class=\"flyoutmenu\">\n";
   print 
$FlyoutMenuText;
   print 
"</div>\n";
 } else {
    
gen_navlinks($html); // generate the links set with highlight for the current page
 
}
?>
<?php 

 
if(isset($showSidebar) and $showSidebar) {
    include_once(
"ajax-sidebar.php");
 } 
# Note: add other links and stuff to the left sidebar above the </div><!-- end leftSidebar -->
# as shown in the sample below.
# Keep in mind that the width allowed is about 110px
#
# if you don't want anything to appear extra here, just delete the lines
# <!-- external links -->
#   down to and including
# <!-- end external links -->
?>
<!-- external links -->
<p class="sideBarTitle"><?php langtrans('External Links'); ?></p>
<ul>
   <li><a href="https://www.weather.gov/" target="blank title="NWS">NWS</a></li>
   <li><a href="https://www.wunderground.com/dashboard/pws/KVAALDIE28" target="blank title="Wx Underground">Wx Undrgrnd</a></li>
   <li><a href="http://www.wxforum.net/" target="blank title="WXForum">WXforum.net</a></li>
   <li><a href="https://discourse.weather-watch.com/" target="blank title="WX-Watch">Wx-Watch</a></li>
   <li><a href="https://www.weather-display.com/" target="blank title="Wx Display">Wx Display</a></li>
   <li><a href="https://www.pwsweather.com/station/pws/KVAALDIE28" target="blank title="PWS">PWS</a></li>
   <li><a href="http://www.findu.com/cgi-bin/wxpage.cgi?call=FW2194" target="blank title="CWOP">CWOP</a></li>
   <li><a href="https://midatlanticweather.net/" target="blank title="Mid-Atl Wx Net">Mid-Atl Wx</a></li> 
   </ul>
<?php if(
      isset(
$SITE['NWSalertsSidebar']) and $SITE['NWSalertsSidebar'] and
      isset(
$SITE['NWSalertsCodes']) and count($SITE['NWSalertsCodes']) > 0) { ?>

<!-- Air Quality Gauage -->
<p class="sideBarTitle" style="text-align:center"><?php langtrans('Current AQI'); ?></p>
<a href="https://novawx.dscloud.me/wxpurpleair.php"><img src="aqi.gif" width="114"></a>

<!-- nws-alerts icons -->
<p class="sideBarTitle" style="text-align:center"><?php langtrans('Alerts'); ?></p>
<?php
include_once("nws-alerts-config.php"); // include the config file
include($cacheFileDir.$iconFileName); // include the big icon file
// construct menu bar icons
$bigIcos '<div style="text-align:center">'."\n";
foreach(
$bigIcons as $bigI) {
$bigIcos .= $bigI;
}
$bigIcos .= " <br />\n</div>\n<!-- end nws-alerts icons -->\n";
echo 
$bigIcos?>
<?php 
// end of NWS alerts sidebar ?>
<!-- end external links -->
<?php if($SITE['allowThemeSwitch']) { // insert code for theme switcher ?>
  <!-- begin Color Theme Switcher Plugin http://www.642weather.com/weather/scripts.php -->
  <div class="thisPage" style="margin-left: 5px; font-weight: normal;">
  <?php print_css_style_menu(1); ?>
  </div>
  <!-- end Color Theme Switcher Plugin http://www.642weather.com/weather/scripts.php -->
<?php // end code for theme switcher ?>
      </div><!-- end leftSidebar -->
</div><!-- end doNotPrint -->    
<!-- end of menubar -->
<?php 

if (isset($_REQUEST['show']) and strtolower($_REQUEST['show']) == 'settings') {
  print 
"<!-- current settings\n" htmlentities(print_r($SITE,true)) . " -->\n";
}

// generate navigation links script - Ken True - webmaster@saratoga-weather.org

function gen_navlinks($html) {
 
preg_match('|<ul>(.*)</ul>|is'$html$betweenspan); // find the navigation div
 
$rawlinks  $betweenspan[1]; 

 
// Chop up each link and place in array 
 
preg_match_all("/<li.*>(.*)<\/li>/Uis"$rawlinks$betweenspan);  
 
$links $betweenspan[1]; 

 
$ourPage $_SERVER['PHP_SELF'];
 
$doDebug false;
 echo 
"<!-- this page='$ourPage' -->\n";
 if (isset(
$_REQUEST['page']) ) { // support testing
   
$ourPage $_REQUEST['page'];
   echo 
"<!-- using page='$ourPage' as test -->\n";
   
$doDebug true;
 }
 if (isset(
$_REQUEST['debug']) ) { // support testing
   
$doDebug true;
 }
  
$t pathinfo($ourPage); // extract base filename from link
  
if ($doDebug) {print "<!-- pathinfo\n" print_r($t,true) . "-->\n"; }
  
$ourPage $t['basename'];
  
// Now generate the code 
 
print "<!-- navigation links -->\n";
 print 
"<ul>\n";
 
 foreach (
$links as $i => $link) {
   if (
preg_match('|<a.*href="([^"]+)"[^>]*>(.*)</a>|i',$link,$matches) ) {
       if(
$doDebug) {  print "<!-- Matches for i=$i '$link': \n" print_r($matches,true) . "-->\n"; }
    
     
//Matches: Array
     //(
     //   [0] => <a href="index.php" title="Current Conditions/Home">Home</a>
     //   [1] => index.php
     //   [2] => Home
     //)
    
      
if ($matches[1] == $ourPage) {
        
// we're on our page
        
print "<li><span class=\"thisPage\">" langtransstr($matches[2]) . "</span></li>\n";
      } else {
        
$t langtransstr($matches[2]);
        print 
"<li>" str_replace($matches[2],$t,$matches[0]) . "</li>\n";
      }
    } else { 
// must be just text
      
print "<li>" $link "</li>\n";
    } 
// end if has an <a href=
 
}
 print 
"</ul>\n<!-- end of navigation links -->\n";
 } 
// end of gen_navlinks function
?>

footer.php permissions=-rwxrwxrwx [0777]

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
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (WD-USA-ML template set)
############################################################################
#
#    Project:    Sample Included Website Design
#    Module:        footer.php
#    Purpose:    Provides the bottom section of the website
#     Authors:    Kevin W. Reed <kreed@tnet.com>
#                TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
#     Copyright:    (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#    This document uses Tab 4 Settings
############################################################################
//Version 1.01 - 05-Feb-2012 - fixup for HTML5 validation
//Version 1.02 - 22-Apr-2017 - use HTTPS for validation links
require_once("Settings.php");
require_once(
"common.php");
############################################################################
?>
    <!-- ##### Footer ##### -->

    <div id="footer">
      <div class="doNotPrint">
        <!--<a href="#header"><?php langtrans('Top'); ?></a> | -->

     <!--   <a href="<?php print $SITE['email']; ?>" title="E-mail us"><?php langtrans('Contact Us'); ?></a> -->
     <!--   <script type="text/javascript"> 
        <!--
        if (navigator.appName == 'Microsoft Internet Explorer' && 
        parseInt(navigator.appVersion) >= 4)
        {
        document.write('| <a href=\"#\" onclick=\"javascript:window.external.AddFavorite        (location.href,document.title)\">');
        document.write('<?php langtrans('Bookmark Page'); ?></a>');
        }else
        {var msg = '| <a href="" title="<?php langtrans('Bookmark Page'); ?>" onClick="alert(' + "'Hit CTRL-D to bookmark this page'"+ ');"><?php langtrans('Bookmark Page'); ?></a>';
        if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
        }
        // 
        </script>-->
      </div><!-- end doNotPrint -->

      <div>

        <?php print $SITE['copyr'?><span class="doNotPrint"> |  
          <a target="blank" href="<?php echo $SITE['WXsoftwareURL']; ?>" title="Powered by <?php echo $SITE['WXsoftwareLongName']; ?>"><?php echo $SITE['WXsoftwareLongName'];?>
          <?php if(isset($wdversion)) {echo " (".$wdversion.")";} ?> </a> |
          <a href="https://validator.w3.org/check?uri=referer"><?php langtrans('Valid'); ?> 
          <?php  print (isset($useHTML5) and $useHTML5)?'HTML5':'XHTML 1.0'?></a> |
          <a href="https://jigsaw.w3.org/css-validator/check/referer"><?php langtrans('Valid'); ?> CSS</a> 
          </span><br class="doNotPrint" />
      <br/><font color="yellow" size="3"><?php langtrans('Never base important decisions on this or any weather information obtained from the Internet'); ?>.</font><br class="doNotPrint" />
      </div>
    </div><!-- end id="footer" -->
    
<table cellpadding="2" cellspacing="0" align="center" border="0">
    <tr>
        <td align="center" border="0"><a target="_blank" href="https://www.davisinstruments.com/pages/vantage-pro2"><img src="./images/davis-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.weather-display.com/"><img src="./images/wd-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://reolink.com/us/product/rlc-510a/"><img src="./images/reolink-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://iptimelapse.com/"><img src="./images/iptimelapse-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.dell.com/en-us"><img src="./images/dell-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.synology.com/en-us/products/DS220+"><img src="./images/synology-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.php.net/"><img src="./images/php-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://docs.microsoft.com/en-us/powershell/"><img src="./images/powershell.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.aomeitech.com/"><img src="./images/aomei-logo.png"></a></td>
        <td align="center"><a target="_blank" href="http://www.findu.com/cgi-bin/wxpage.cgi?call=FW2194"><img src="./images/cwop-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.pwsweather.com/station/pws/KVAALDIE28"><img src="./images/pws-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.wunderground.com/dashboard/pws/KVAALDIE28"><img src="./images/weather-underground-logo.png"></a></td>
        <td align="center"><a target="_blank" href="https://www.windy.com/"><img src="./images/windy-logo.png"></a></td>
    </tr>
</table>
<br>

<!-- United States visitor counter code from Flag Counter -->
<table cellpadding="2" cellspacing="0" align="center" border="0">
    <tr>
        <td align="left" border="0"><a target="_blank" href="https://info.flagcounter.com/ARbm"><img src="https://s05.flagcounter.com/count_US/ARbm/bg_4A4A4A/txt_FFFFFF/border_4A4A4A/columns_8/maxflags_50/viewers_Visitors+from+the+United+States+since+January+1+,+2024/labels_1/pageviews_1/flags_0/percent_0/" alt="Free counters!" border="0"></a>
        </td>
    </tr>
</table>

 </div><!-- end id="page" wrapper -->
  </body>
</html>
<?php 
# Leave this code here .. it will help you see what language translations are missing by running any page on your
# website with a ?show=missing argument
#
  
global $missingTrans,$SITE;
  if(isset(
$_REQUEST['show']) and strtolower($_REQUEST['show']) == 'missing') {
    echo 
"<!-- missing langlookup entries for lang=".$SITE['lang']." \n";
    foreach (
$missingTrans as $key => $val) {
        echo 
"langlookup|$key|$key|\n";
    }
    echo 
"\n ".count($missingTrans)." entries.  End of missing langlookup entries -->\n";
  }
?>

common.php permissions=-rwxrwxrwx [0777]

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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Canada/World-ML template set)
############################################################################
#
#    Project:    Sample Included Website Design
#    Module:        common.php
#    Purpose:    Provides common functions used throughout the website
#     Authors:    Kevin W. Reed <kreed@tnet.com>
#                TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
#     Copyright:    (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#    This document uses Tab 4 Settings
############################################################################
require_once("Settings.php");
global 
$forwardTrans,$reverseTrans,$missingTrans;
############################################################################
# Version 1.04 - 29-Nov-2011 - improved language translations for conditions
# Version 1.05 - 01-Dec-2012 - minor fix to cGetSeasonInfo
# Version 1.06 - 05-Feb-2013 - added UTF-8 conversion features for ISO-8859-n language files
# Version 1.07 - 09-Feb-2013 - added tman1991 cGetMoonInfo() mods for cell.php add-on
# Version 1.08 - 12-Aug-2015 - fixed deprecated /e preg_replace with preg_replace_callback
# Version 1.09 - 17-Aug-2015 - fixed HTML5 validation for print_language_selects()
# Version 1.10 - 19-Apr-2019 - updated season/moon tables for 2018-2030 years
# Version 1.11 - 07-Dec-2020 - minor fix for PHP 8.0.0
# Version 1.12 - 02-Jun-2021 - added cookie for persistent language selection (lang=)
# Version 1.13 - 29-Nov-2021 - add SameSite=Lax to lang= browser cookie
# Version 1.14 - 27-Dec-2022 - fixes for PHP 8.2
$CMNVersion 'common.php - Version 1.14 - 27-Dec-2022';
# Common Functions
############################################################################

function Mklink($url$title$desc$remote) {
    global 
$SITE;

    if (
$remote) {
        echo 
"<div class='link'>";
        echo 
"<a href='{$url}' title='{$title}' \n";
        echo 
"$SITE[remote] >";
        echo 
"$desc</a> <img src=\"./images/offsite.gif\" alt=\"*EXT*\" /></div>";

    } else {
        echo 
"<a href='{$url}' title='{$title}'>{$desc}</a>";
    }
}

#####################################################################
function langtrans $item ) {
  global 
$LANGLOOKUP,$missingTrans;
  
  if(isset(
$LANGLOOKUP[$item])) {
     echo 
$LANGLOOKUP[$item];
  } else {
     if(isset(
$item) and $item <> '') {$missingTrans[$item] = true; }
     echo 
$item;
  }

}
#####################################################################
function langtransstr $item ) {
  global 
$LANGLOOKUP,$missingTrans;
  
  if(isset(
$LANGLOOKUP[$item])) {
     return 
$LANGLOOKUP[$item];
  } else {
      if(isset(
$item) and $item <> '') {$missingTrans[$item] = true; }
     return 
$item;
  }

}
#####################################################################
function langtranssubs $item ) {
  global 
$LANGSUBS;

    
reset ($LANGSUBS); // process in order of the file
    
$text $item;
    foreach (
$LANGSUBS as $key => $replacement) {
      
$text str_replace($key,$replacement,$text);
    }
    
// put back translated text, fixing capitalization for sentence starts (except the first one).
    
if(count($LANGSUBS) >=1) {
      
$text preg_replace_callback('!\.\s+([a-z])!s',
      function (
$matches) { return('.  ' strtoupper($matches[1]) ); }
      ,
$text);
    }
    if (isset(
$_REQUEST['debug']) ) { echo "<!-- translated '$item' to '$text' -->\n"; }
 
  return(
$text);

}

#####################################################################
# load language translation settings (if any)

function load_langtrans () {
  global 
$LANGLOOKUP$LANGSUBS$SITE$forwardTrans$reverseTrans$missingTrans,$CMNVersion;
  
$LANGLOOKUP = array();
  
$LANGSUBS = array();
  
$forwardTrans = array();
  
$reverseTrans = array();
  
$missingTrans = array();
  
  
$Status "<!-- $CMNVersion -->\n";

  
$lang 'en'// default language
    
$setCookieLang false;
    
$Status .= "<!-- input load_langtrans ";
  if (isset(
$SITE['lang']) ) {    $lang_input strtolower($SITE['lang']); 
       
$Status .= "SITE['lang'] = '".$SITE['lang']."; ";}
  if (isset(
$_SESSION['lang'])) { $lang_input strtolower($_SESSION['lang']); 
       
$Status .= "SESSION['lang'] = '".$_SESSION['lang']."; ";}
    if (isset(
$_COOKIE['lang']))  { $lang_input strtolower($_COOKIE['lang']); 
       
$Status .= "COOKIE['lang'] = '".$_COOKIE['lang']."; ";}
  if (isset(
$_REQUEST['lang'])) { $lang_input strtolower($_REQUEST['lang']); $setCookieLang true;
       
$Status .= "REQUEST['lang'] = '".$_REQUEST['lang']."; ";}
         
$Status .= " -->\n";

  
# allow valid input only
  # allows en, en-us, en-gb, dk, etc.
  
if ((isset($lang_input) && preg_match('/^[a-z]{2}$/'$lang_input))
  || (isset(
$lang_input) && preg_match('/^[a-z]{2}-[a-z]{2}$/'$lang_input)) ) {
        
$Status .= "<!-- lang_input='$lang_input' used for \$lang -->\n";
    
$lang $lang_input;
  }
#  if($setCookieLang or !isset($_COOKIE['lang']) or $_COOKIE['lang'] !== $lang) {
        
$Status .= "<!-- set_lang_cookie ".set_lang_cookie('lang',$lang)." -->\n";;
#        $_COOKIE['lang'] = $lang;
#    }

  # always store in a PHP Session
  
$_SESSION['lang'] = $lang;
  
$_REQUEST['lang'] = $lang;  // establish for other scripts too
  
$SITE['lang'] = $lang;

    
$Status .= "<!-- result load_langtrans ";
  if (isset(
$SITE['lang']) ) { 
       
$Status .= "SITE['lang'] = '".$SITE['lang']."; ";}
  if (isset(
$_SESSION['lang'])) { 
       
$Status .= "SESSION['lang'] = '".$_SESSION['lang']."; ";}
    if (isset(
$_COOKIE['lang']))  { 
       
$Status .= "COOKIE['lang'] = '".$_COOKIE['lang']."; ";}
  if (isset(
$_REQUEST['lang'])) {
       
$Status .= "REQUEST['lang'] = '".$_REQUEST['lang']."; ";}
         
$Status .= " -->\n";


  
$langfile 'language-' $lang '.txt';
  if (! 
file_exists($langfile) ) {
        
$Status .= "<!-- load_langtrans fail. language-$lang.txt file not found. Using 'en' for language -->\n";
    
$_SESSION['lang'] = 'en';
    
$_REQUEST['lang'] = 'en';  // establish for other scripts too
    
$Status .= "<!-- load_langtrans finished -->\n";
    if (isset(
$_REQUEST['debug']) ) { echo $Status; }
    return; 
// use english throughout
  
}

  
$lfile file($langfile);
  
$Status .= "<!-- langfile '$langfile' loading -->\n";
  
  
$langfile 'language-' $lang '-local.txt';
  if (
file_exists($langfile)) { // load local translation file if it exists
     
$lfile2 file($langfile); 
     
$Status .= "<!-- langfile '$langfile' loading -->\n";
     
$lfile array_merge($lfile,$lfile2);
   }
/*  $langfile = 'plaintext-parser-lang-' . $lang . '.txt';
   if (file_exists($langfile)) { // load local translation file if it exists
     $lfile2 = file($langfile); 
     $Status .= "<!-- langfile '$langfile' loading -->\n";
     $lfile = array_merge($lfile,$lfile2);
   }
*/  
  
$n 0;
  
$nsite 0;
  
$nlang 0;
  
$langDefaultCharset 'iso-8859-1';  // overall default
  
$transtable get_html_translation_table(HTML_ENTITIES,ENT_NOQUOTES);
  
$doLoadTrans false;
  
  foreach (
$lfile as $rec) {  // process the control file(s)
    
$recin trim($rec);
    if (
substr($recin,0,1) <> '#' and $recin <> '') { // process non blank, non comment records
        
list($type$item,$translation) = explode('|',$recin '|||||');
        
$type trim($type);
        
$item trim($item);
        
$translation trim($translation);
        if (
strtolower($type) == 'conditions' and strtolower($item) == 'begin' ) {
            
$doLoadTrans true;
            continue;
        }
        if (
strtolower($type) == 'conditions' and strtolower($item) == 'end' ) {
            
$doLoadTrans false;
            continue;
        }
        if (isset(
$type) and strtolower($type) == 'charset' and isset($item)) {
            
$SITE['charset'] = trim($item);
            
$SITE['langDefaultCharset'] = trim($item); // save for language conversion
            
$Status .= "<!-- using charset '" $SITE['charset'] . "' -->\n";
            continue;
        }
        if (
$type == 'langlookup' and $item and $translation) {
            
$LANGLOOKUP[$item] = strtr($translation,$transtable);
            
$LANGLOOKUP[$item] = $translation;
            
$LANGLOOKUP[$item] = preg_replace('|\&amp;nbsp;|Uis','&nbsp;',$LANGLOOKUP[$item]);
            if (
$doLoadTrans) {
               
$forwardTrans[$item] = $translation;
               
$reverseTrans[$translation] = $item;
               
$t ucfirst(strtolower($item));
               if(
strcmp($item,$t) !== 0) {
                 
$LANGLOOKUP[$t]= $translation// add case normalize translation English term
                 
$Status .= "<!-- added langlookup|$t|$translation| for '$item' entry -->\n";
               }
               
$t strtolower($item);
               if(
strcmp($item,$t) !== 0) {
                 
$LANGLOOKUP[$t]= $translation// add case normalize translation English term
                 
$Status .= "<!-- added langlookup|$t|$translation| for '$item' entry -->\n";
               }
               
$t ucwords(strtolower($item));
               if(
strcmp($item,$t) !== 0) {
                 
$LANGLOOKUP[$t]= $translation// add case normalize translation English term
                 
$Status .= "<!-- added langlookup|$t|$translation| for '$item' entry -->\n";
               }
            }
            
$n++;
            continue;
        }
        if (
$type == 'lang' and $item and $translation) {
          
$LANGSUBS[$item] = $translation;
          
$nlang++;
        } 
        
        if (
$type == 'site' and $item and $translation) {
            
$SITE[$item] = $translation;
            
$nsite++;
            
$Status .= "<!-- override site['$item'] = '$translation' -->\n";
            continue;
        }
    
    } 
// end if nonblank, non comment

  
// end foreach

  
$Status .= "<!-- loaded $n langtrans entries, $nsite site entries -->\n";
  if (isset(
$SITE['langCharset'][$lang])) {
    
$SITE['charset'] = $SITE['langCharset'][$lang];
  }
  
$SITE['lang'] = $lang;
  
  
# Change WU Forecast url for language if we have enough data for it
 
if(isset($SITE['fcsturlWU']) and isset($SITE['WULanguages'][$lang])) {
    
$Status .= "<!-- WU URL is '".$SITE['fcsturlWU']."' -->\n";
     
$SITE['fcsturlWU'] = preg_replace('|http://([^\.]+)\.(.*)$|is',
        
"http://".$SITE['WULanguages'][$lang].".\\2",
        
$SITE['fcsturlWU']);
    
$Status .= "<!-- WU URL set to '".$SITE['fcsturlWU']."' -->\n";
  
  }
  if (isset(
$_SESSION['lastLang']) and $_SESSION['lastLang'] <> $lang) {
    
$_REQUEST['force'] = "1";  // trick WU-forecast into cache reload with new language
    
$Status .= "<!-- lastLang ='".$_SESSION['lastLang'].
    
"' - requesting cache refresh for WU-forecast for $lang=".$SITE['WULanguages'][$lang]." -->\n";
  }
   
$_SESSION['lastLang'] = $lang;
   
   
$SITE['xlateCOP'] = langtransstr('Chance of precipitation');

   if(
file_exists("language-".$lang.".js")) { // load extra translations from JavaScript spec
     
$langEntries = array(
       
'langMonths',
       
'langDays',
       
'langUVWords',
       
'langBaroTrend',
       
'langBeaufort',
       
'langHeatWords',
       
'langWindDir'
     
);
     
$Status .= "<!-- loading language-$lang.js -->\n";  
     
$jsfile file("language-".$lang.".js");
     
$recs implode('',$jsfile);
     
$recs preg_replace('|new Array|Uis','array',$recs);
     
$recs preg_replace('|var lang(\S+)\s+|Uis','$JSV[\'lang\\1\']',$recs);
     
$recs preg_replace('|langTransLookup|Uis','// langTransLookup',$recs);
     if(isset(
$_REQUEST['show']) and $_REQUEST['show'] == 'eval') {
         print 
"<!-- eval request is\n".print_r($recs,true)."\n-->\n";
     }
     eval(
$recs);
     foreach (
$langEntries as $l) {
        if(isset(
$JSV[$l])) {
            
$SITE[$l] = $JSV[$l];
          
$Status .= "<!-- $l='" print_r($SITE[$l],true) . " -->\n";
        } else {
          
$Status .= "<!-- '$l' not found in JS conversion -->\n";
        }
     }
     if(isset(
$SITE['langWindDir'])) { // use JavaScript winddir defs for PHP too
       
$cardinalDirs = array(
           
"N""NNE""NE""ENE"
        
"E""ESE""SE""SSE"
        
"S""SSW""SW""WSW"
        
"W""WNW""NW""NNW");
     
       foreach (
$SITE['langWindDir'] as $n => $trans) {
         
$LANGLOOKUP[$cardinalDirs[$n]] = $trans;
       
       }
     
     } 
// if translated winddirs exist
     
     
if(isset($SITE['langHeatWords'])) { // use JavaScript defs for PHP too
       
$engWords = array(
        
'Unknown''Extreme Heat Danger''Heat Danger''Extreme Heat Caution''Extremely Hot'
        
'Uncomfortably Hot',  'Hot''Warm'
        
'Comfortable'
        
'Cool''Cold''Uncomfortably Cold''Very Cold''Extreme Cold'
        
);
       foreach (
$SITE['langHeatWords'] as $n => $trans) {
         
$LANGLOOKUP[$engWords[$n]] = $trans;
       
       }
     } 
// if translated langHeatWords exist
     
     
if(isset($SITE['langBeaufort'])) { // use JavaScript defs for PHP too
       
$engWords = array ( /* Beaufort 0 to 12 in array */
         
"Calm""Light air""Light breeze""Gentle breeze""Moderate breeze""Fresh breeze",
         
"Strong breeze""Near gale""Gale""Strong gale""Storm",
         
"Violent storm""Hurricane"
       
);
       foreach (
$SITE['langBeaufort'] as $n => $trans) {
         
$LANGLOOKUP[$engWords[$n]] = $trans;
       
       }
     } 
// if translated langBeaufort exists

     
if(isset($SITE['langMonths'])) { // use JavaScript defs for PHP too
       
$engWords = array ( /* English Months */
       
"January","February","March","April","May",
            
"June","July","August","September","October","November","December");
       foreach (
$SITE['langMonths'] as $n => $trans) {
         
$LANGLOOKUP[ucwords($engWords[$n])] = $trans;
       
       }

     } 
// if translated langMonths exists

     
if(isset($SITE['langDays'])) { // use JavaScript defs for PHP too
       
$engWords = array ( /* English Days */
       
"Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun");
       foreach (
$SITE['langDays'] as $n => $trans) {
         
$LANGLOOKUP[ucwords($engWords[$n])] = $trans;
       
       }

     } 
// if translated langDays exists

     
if(isset($SITE['langBaroTrend'])) { // use JavaScript defs for PHP too
       
$engWords = array ( /* English Baro Trend */
       
"Steady""Rising Slowly""Rising Rapidly""Falling Slowly""Falling Rapidly");
       foreach (
$SITE['langBaroTrend'] as $n => $trans) {
         
$LANGLOOKUP[$engWords[$n]] = $trans;
//         $Status .= "<!-- baro '".$engWords[$n]."'='$trans' -->\n";
       
}

     } 
// if translated langBaroTrend exists
     
   
}
   
   
$Status .= "<!-- load_langtrans finished -->\n";
   if (isset(
$_REQUEST['debug']) ) { echo $Status; }

// end load_langtrans function
#####################################################################
# set a language memory cookie
function set_lang_cookie ($name$val) {
   global 
$SITE;
   
# this function sets a cookie
   # set expiration date 6 months ahead
   
$expire strtotime("+6 month");
   if ( isset(
$SITE['cookie_path']) ) {
     
$path $SITE['cookie_path']; // this can be set in Settings.php
   
} else {
     
$scripturlparts explode('/'$_SERVER['PHP_SELF']);
     
$scriptfilename $scripturlparts[count($scripturlparts)-1];
     
$scripturl preg_replace("/$scriptfilename$/i"''$_SERVER['PHP_SELF']);
     
$path $scripturl;
   }
 
   if(!
headers_sent()) {
             if(
PHP_VERSION_ID 70300) {
                 
$didit setcookie("$name",$val,$expire,$path.'; SameSite=Lax');
             } else {
                 
$arr_cookie_options = array (
                        
'expires' => $expire,
                        
'path' => $path,
                    
#    'domain' => $_SERVER['SERVER_NAME'], // leading dot for compatibility or use subdomain
                        
'secure' => false,     // or true
                        
'httponly' => false,    // or true
                        
'samesite' => 'Lax' // None || Lax  || Strict
                 
);
                 
$didit setcookie("$name",$val,$arr_cookie_options);
             }
         } else {
         
$didit false;
         }
    
$rtn "setcookie('$name','$val'); ";
  
$rtn .= $didit?"was successful":"was NOT successful";
    return(
$rtn);
}

#####################################################################
# convert language translation to UTF-8

function set_langtrans_UTF8 () {
  global 
$LANGLOOKUP$LANGSUBS$SITE$forwardTrans$reverseTrans;
  if(
$SITE['charset'] == 'UTF-8') {
      if (isset(
$_REQUEST['debug']) ) { echo "<!-- set_langtrans_UTF8 no conversion performed -- already in UTF-8 -->\n"; }
      
$SITE['origCharset'] = $SITE['charset'];
      return; 
// nothing to do
  
}
  
$Debug '';
  
// convert the existing $LANGLOOKUP array to UTF-8
  
$sceCharset $SITE['charset'];
  
$SITE['convertJS'] = true;  // indicate that the language-LL.js is to be converted too
  
  
foreach ($LANGLOOKUP as $english => $trans) {
      
$LANGLOOKUP[$english] = iconv($sceCharset,'UTF-8//TRANSLIT',$trans);
  }
  
$Debug .= "<!-- set_langtrans_UTF8 - converted '$sceCharset' to 'UTF-8' for ".count($LANGLOOKUP). " langtrans entries -->\n";
  
// now convert the other likely used items created by load_langtrans
       
$langEntries = array(
       
'langMonths',
       
'langDays',
       
'langUVWords',
       
'langBaroTrend',
       
'langBeaufort',
       
'langHeatWords',
       
'langWindDir'
     
);

  foreach (
$langEntries as $idx => $key) {
      
      if(isset(
$SITE[$key])) {
          foreach (
$SITE[$key] as $n => $val) {
              
$SITE[$key][$n] = iconv($sceCharset,'UTF-8//TRANSLIT',$val);
          }
          
$Debug .= "<!-- set_langtrans_UTF8 - converted ".count($SITE[$key])." SITE $key for UTF-8 -->\n";
      }
  }
  if(
count($forwardTrans)>0) {
    foreach (
$forwardTrans as $english => $trans) {
        
$forwardTrans[$english] = iconv($sceCharset,'UTF-8//TRANSLIT',$trans);
    }
    
$Debug .= "<!-- set_langtrans_UTF8 - converted forwardTrans to 'UTF-8' for ".count($forwardTrans). " langtrans entries -->\n";
  }
    
  
$SITE['origCharset'] = $sceCharset// remember the original character set
  
$SITE['charset'] = 'UTF-8'// change our default character set
  
if (isset($_REQUEST['debug']) ) { echo $Debug; }
    
}  
// end set_langtrans_UTF8 function
#####################################################################

function print_language_selects() {
    global 
$SITE;
    if(isset(
$SITE['languageSelectDropdown']) and $SITE['languageSelectDropdown'] ) {
        
$stuff print_language_selects_dropdown();
    } else {
        
$stuff print_language_selects_linear();
    }
    return 
$stuff;
}

#####################################################################

# this function by mchallis prints (language selection flags or language selection text links)
# based on the setting $SITE['useLanguageFlags'] true or false
function print_language_selects_linear() {
 global 
$SITE;

 
$string1 '';
 
$arr $SITE['installedLanguages'];
 if (
is_array($arr)){
    foreach (
$arr as $k => $v) {

      if(
$SITE['useLanguageFlags'] == true) {
           
$string .= '<a href="'$_SERVER['PHP_SELF'] .'?lang='.$k.'" title="'$v .'">
<img src="'
$SITE['imagesDir'] . 'flag-'$k .'.gif" alt="'$v .'" title="'$v .'" style="border: none;" /></a>
'
;
      }else{
           
$k_print $k;
           if (
$SITE['lang'] == $k) {
              
$k_print "[$k]";
            }
            
$string .= '<a href="'$_SERVER['PHP_SELF'] .'?lang='.$k.'" title="'$v .'">
<span style="font-size: 10px">'
$k_print .'</span></a>
'
;
     }
    } 
// end foreach

    # text links use bracket for indicator, image links print lang code
    
if($SITE['useLanguageFlags'] == true) {
          
$string1 '<span style="font-size: 10px">' langtransstr('Language') .': ' $_REQUEST['lang'] . '</span> ' $string;
    }else{
          
$string1 '<span style="font-size: 10px">' langtransstr('Language') .': </span>' $string;

    }
 } 
// end is_array
 
return $string1;

}
// end print_language_selects_linear function
#####################################################################
# this function by mchallis prints (language selection flags or language selection text links)
# based on the setting $SITE['useLanguageFlags'] true or false
# Revised by K. True for option box display instead.
function print_language_selects_dropdown() {
 global 
$SITE;
 
$use_onchange_submit true;
 if(isset(
$SITE['languageSelectButton']) ) {
    
$use_onchange_submit = ! $SITE['languageSelectButton'];
 }
 
$string1 '';
 
$arr $SITE['installedLanguages'];
 if (
is_array($arr)){
    
$string '
<form method="get" name="lang_select" action="#" style="padding: 0px; margin: 0px">
'
;
    
# text links use bracket for indicator, image links print lang code
    
if($SITE['useLanguageFlags'] == true) {
          
$string .= '<span style="font-size: 10px">' langtransstr('Language') .':&nbsp; </span>';
    }else{
          
$string .= '<span style="font-size: 10px">' langtransstr('Language') .':&nbsp; </span>';

    }

if(
$use_onchange_submit == false) {
$string .= '<select id="lang" name="lang" style="font-size: 9px; padding: 0px; margin: 0px;">
'
;
}
else {
$string .= '<select id="lang" name="lang"  style="font-size: 9px" onchange="this.form.submit();">';
}
$flag '';
    foreach (
$arr as $k => $v) {

      if(
$SITE['lang'] == $k) {
        
$selected ' selected="selected"';
        
$flag '<img src="'$SITE['imagesDir'] . 'flag-'$k .'.gif" alt="'$v .'" title="'$v .'" style="border: none" />';
      } else {
        
$selected '';
      }
      
$string .= '<option value="'.$k.'"'.$selected.'>'.$v.'</option>'."\n";
    } 
// end foreach
    
$string .= '</select>
'
;
if(
$use_onchange_submit == false) {
  
$string .= '<input type="submit" name="' langtransstr('Set') .'" value="' langtransstr('Set') .'" style="font-size: 9px" />';
} else {
  
$string .= '<noscript><input type="submit" name="' langtransstr('Set') .'" value="' langtransstr('Set') .'" style="font-size: 9px" /></noscript>';
    
}
    
# text links use bracket for indicator, image links print lang code
    
if($SITE['useLanguageFlags'] == true) {
          
$string .= '  ' $flag;
    }else{
          
$string .= ' ';

    }

$string .= '
</form>'
;


 } 
// end is_array
 
return $string;

}
// end print_language_selects_dropdown function

# load the language translation file and set up $LANGLOOKUP array
load_langtrans();

// -----------------------------------------------------------------------------
// MOON FUNTIONS  Courtesy of Bashewa Weather, PHP conversion by WebsterWeather from ajaxWDwx.js V9.13 (WD)                                                             .
// -----------------------------------------------------------------------------
function cGetMoonInfo ($hh=0,$mm=0,$ss=0,$MM=0,$DD=0,$YY=0) { // very crude way of determining moon phase (but very accurate)
// ------------- start of USNO moon data -----------------------------
// PHP tables generated from USNO moon ephemeris data https://api.usno.navy.mil/moon/phase?date=1/1/yyyy&nump=60
// for years 2009 to 2030 
// Ken True - Saratoga-weather.org generated by get-USNO-moonphases.php - Version 2.01 - 19-Apr-2019 on 19 April 2019 09:31 PDT

$newMoons = array( // unixtime values in UTC/GMT
/* 2009 */ /* 26-Jan-2009 07:55 */ 
123295650012355257001238083560124062978012431670601245699300124823010012507625201253299440125584398012583988401260964920
/* 2010 */ /* 15-Jan-2010 07:11 */ 126353946012661158601268686860127124814012737990401276341300127887720012814096801283941800128647704012890191201291570560
/* 2011 */ /* 04-Jan-2011 09:03 */ 1294131780129670026012992715601301841120130440546013069621801309510440131205120013145870401317121740131965896013222014001324749960
/* 2012 */ /* 23-Jan-2012 07:39 */ 132730434013298637001332427020133499268013375576201340118120134267184013452188401347761460135030252013528444801355388120
/* 2013 */ /* 11-Jan-2013 19:44 */ 135793344013604808001363031460136558650013681456801370706960137326764013758258601378380960138093324013834830001386030120
/* 2014 */ /* 01-Jan-2014 11:14 */ 1388574840139111788013936608001396205100139875204014013024001403856480140641452014089759801411539240141410142014166595201419212160
/* 2015 */ /* 20-Jan-2015 13:14 */ 142175964014243032201426844160142938342014319223801434463500143700984014395639801442126460144469476014472640201449829740
/* 2016 */ /* 10-Jan-2016 01:30 */ 1452389400145494234014574884401460028240146256294014650956001467630060147017064014727205801475280660147784908014804218801482994380
/* 2017 */ /* 28-Jan-2017 00:07 */ 148556202014881210801490669820149320896014957414401498271460150080316015033402001505885400150844032015110053201513578600
/* 2018 */ /* 17-Jan-2018 02:17 */ 151615542015187287001521292320152384382015263848801528918980153145008015339814801536516060153905682015416065201544167200
/* 2019 */ /* 06-Jan-2019 01:28 */ 1546738080154931424015518882401554454200155700990015595561201562094960156462912015671614201569695160157223388015747807601577337180
/* 2020 */ /* 24-Jan-2020 21:42 */ 157990212015824719201585042080158760876015901691401592721660159526638015978049201600340400160287666016054168201607962560
/* 2021 */ /* 13-Jan-2021 05:00 */ 161051400016130703601615630860161819466016207596001623322380162587982016284306001630975920163351830016360604401638603780
/* 2022 */ /* 02-Jan-2022 18:33 */ 1641148380164369436016462425001648794240165135048016539102001656471120165903090016615882201664142840166669494016692442201671790620
/* 2023 */ /* 21-Jan-2023 20:53 */ 167433438016768767601679419380168196392016845115801687063020168961872016921786801694742000169730610016998676201702423920
/* 2024 */ /* 11-Jan-2024 11:57 */ 1704974220170751954017100612001712600460171513852017176774801720220220172276998017253285001727894940173046522017330340601735597620
/* 2025 */ /* 29-Jan-2025 12:36 */ 173815416017407035001743245880174578226017483149201750847460175338426017559291601758484440176104950017636212201766194980
/* 2026 */ /* 18-Jan-2026 19:52 */ 176876592017713296601773883380177642672017789616601781492040178402218017865562201789097220179164740017942077201796777520
/* 2027 */ /* 07-Jan-2027 20:24 */ 1799353440180192936018044981401807055460180960108018121380001814670120181720110018197340601822271760182481696018273722401829938320
/* 2028 */ /* 26-Jan-2028 15:12 */ 183251232018350878201837657860184021842018427689601845311220184784772018503810401852914240185545062018579934801860545160
/* 2029 */ /* 14-Jan-2029 17:24 */ 186310584018656730601868242740187081080018733741201875930600187847946018810213601883558640188609484018886334401891176720
/* 2030 */ /* 04-Jan-2030 02:49 */ 1893725340189627882018988364401901397720190396152019065252601909085640191164026019141888201916733240191927622019218195601924363920
 
); /* end of newMoons array */

$Q1Moons = array( // unixtime values in UTC/GMT
/* 2009 */ /* 02-Feb-2009 23:13 */ 
123361638012361527601238682840124121064012437401201246274880124881840012513733201253940600125651772012590987401261676160
/* 2010 */ /* 23-Jan-2010 10:53 */ 126424398012667993201269342000127187400012743989801276921740127944780012819824401284529800128709162012896663401292248740
/* 2011 */ /* 12-Jan-2011 11:31 */ 129483186012974086801299973500130252350013050595801307585460131010654013126288801315157940131769810013202518801322819520
/* 2012 */ /* 01-Jan-2012 06:15 */ 1325398500132798300013305648601333136460133569342013382361601340767800134329296013458164401348342860135087672013534218601355980740
/* 2013 */ /* 18-Jan-2013 23:45 */ 135855270013611330601363714020136628826013688516401371403440137394468013764777601379005680138153252013840630201386601920
/* 2014 */ /* 08-Jan-2014 03:39 */ 1389152340139171452013942852201396859460139943250014020007401404561540140711340014096562601412191980141472368014172555601419791460
/* 2015 */ /* 27-Jan-2015 04:48 */ 142233408014248844401427442180143000610014325743401435143720143771064014402718601442825940144537306014479144201450451640
/* 2016 */ /* 16-Jan-2016 23:26 */ 145298676014555223601458061380146060634014631589201465719000146828472014708532601473421740147598758014785482601481101380
/* 2017 */ /* 05-Jan-2017 19:47 */ 1483645620148618194014887135201491244740149377962014963209201498870260150142818015039943801506567180150914292015117157801514280000
/* 2018 */ /* 24-Jan-2018 22:20 */ 151683240015193733401521905700152443356015269609401529491860153202992015345784801537139700153971292015422936401544874540
/* 2019 */ /* 14-Jan-2019 06:45 */ 154744830015500103601552559220155509596015576235201560146340156266970015651990601567739400157029402015728629801575442680
/* 2020 */ /* 03-Jan-2020 04:45 */ 1578026700158060772015831790201585736460158827908015908094001593332160159585312015983782801600912500160345938016060203001608594060
/* 2021 */ /* 20-Jan-2021 21:01 */ 161117646016137604201616337600161890194016214515801623988440162651666016290407401631565540163409550016366347601639186500
/* 2022 */ /* 09-Jan-2022 18:11 */ 1641751860164432820016469091001649486880165205566016546132801657160040165969756016622284801664756040166728462016698189601672363200
/* 2023 */ /* 28-Jan-2023 15:19 */ 167491914016774851601680057120168263040016852009201687765800169032282016928710201695411120169794534017004774001703011140
/* 2024 */ /* 18-Jan-2024 03:52 */ 170554992017080956601710648660171320838017157736801718342280172091094017234759401726034700172858650017311317001733671560
/* 2025 */ /* 06-Jan-2025 23:56 */ 1736207760173874252017412786601743819300174636672017489220601751484600175405206017566215001759190040176175486017643131401766862600
/* 2026 */ /* 26-Jan-2026 04:47 */ 176940282017719360201774466280177699792017795346601782078900178463190017871939601789764240179233992017949160801797486120
/* 2027 */ /* 15-Jan-2027 20:34 */ 180004524018025918801805127900180765696018101834401812711360181524474018177872401820341860182290962018254880001828070520
/* 2028 */ /* 05-Jan-2028 01:40 */ 1830649200183321780018357733201838315700184084716018433713601845893400184841880018509529601853500200185606238018586376401861220700
/* 2029 */ /* 22-Jan-2029 19:23 */ 186380418018663810001868945580187149540018740313601876557240187907844018816009001884130140188667054018892245001891792140
/* 2030 */ /* 11-Jan-2030 14:06 */ 1894370760189695454018995356201902106620190466346019072065601909738920191226498019147893001917316560191985096019223962201924954560
 
); /* end of Q1Moons array */

$fullMoons = array( // unixtime values in UTC/GMT
/* 2009 */ /* 09-Feb-2009 14:49 */ 
123419094012367390801239288960124184166012443983201246958460124952010012520801801254636600125718924012597390001262286780
/* 2010 */ /* 30-Jan-2010 06:18 */ 126483228012673750801269915900127245708012750016201277551800128010822012826695001285233420128779776012903604201292919180
/* 2011 */ /* 19-Jan-2011 21:21 */ 129547206012980181601300558200130309464013056305401308168840131071200013132618201315819620131838516013209561601323527760
/* 2012 */ /* 09-Jan-2012 07:30 */ 1326094200132865164013311995401333739940133627530013388083201341341520134387802013464214801348975140135154014013541139601356690060
/* 2013 */ /* 27-Jan-2013 04:38 */ 135926148013618239601364376420136691982013694559001371987120137451690013770495001379589180138213948013847013601387272480
/* 2014 */ /* 16-Jan-2014 04:52 */ 138984792013924219801394989680139754772014000949601402632660140516430014076941401410226680141276546014153125801417868820
/* 2015 */ /* 05-Jan-2015 04:53 */ 1420433580142300494014255787001428149100143071092014332619401435803600143833938014408733001443408600144594750014484914401451041860
/* 2016 */ /* 24-Jan-2016 01:46 */ 145359996014561652001458734460146130264014638652401466420520146896896014715123601474052700147659178014791315201481673900
/* 2017 */ /* 12-Jan-2017 11:34 */ 148422084014867731801489330440149189088014944525201497013800149957322015021294601504681380150722880015097729801512316020
/* 2018 */ /* 02-Jan-2018 02:24 */ 1514859840151740522015199518601522499820152504988015276035401530161580153272280015352845601537843920154039950015429515401545500940
/* 2019 */ /* 21-Jan-2019 05:16 */ 154804776015505915801553132580155567232015582138601560760260156331308015658721401568435580157100088015735656401576127520
/* 2020 */ /* 10-Jan-2020 19:21 */ 1578684060158123358015837760801586313300158884830015913843201593924240159647034015990241201601586300160415574016067286001609298880
/* 2021 */ /* 28-Jan-2021 19:16 */ 161186136016144138201616957280161949426016220276401624560000162709422016296337201632182100163474182016373122201639888500
/* 2022 */ /* 17-Jan-2022 23:48 */ 164246328016450305601647587820165013530016526744401655207520165773748016602681601662803940166534890016679053201670472480
/* 2023 */ /* 06-Jan-2023 23:08 */ 1673046480167562168016781928001680755640168330804016858501201688384340169091472016934457001695981420169852464017010765601703637180
/* 2024 */ /* 25-Jan-2024 17:54 */ 170620524017087778001711350000171391614017164723801719018480172155702017240919601726626840172916436017317060801734253320
/* 2025 */ /* 13-Jan-2025 22:27 */ 173680722017393683801741935300174450372017470689601749627840175217982017547261001757268540175980882017623487401764890040
/* 2026 */ /* 03-Jan-2026 10:03 */ 1767434580176998374017725378801775095920177765618017802171001782777360178533576017878906801790441340179298792017955319801798075680
/* 2027 */ /* 22-Jan-2027 12:17 */ 180062022018031657801805712240180826002018108107401813365840181592550018184877401821049380182360802018261627601828714140
/* 2028 */ /* 12-Jan-2028 04:03 */ 1831262580183380784018363495601838888760184142814018439709401846519860184907580018516376201854203100185676942018593340001861894080
/* 2029 */ /* 30-Jan-2029 06:03 */ 186444738018669930001869531960187206702018746014201877138520187968096018822306601884788940188735562018899281801892501160
/* 2030 */ /* 19-Jan-2030 15:54 */ 189506844018976260001900173360190271280019052471401907779260191031192019128482401915391880191794602019205118001923086400
 
); /* end of fullMoons array */

$Q3Moons = array( // unixtime values in UTC/GMT
/* 2009 */ /* 16-Feb-2009 21:37 */ 
12348202201237398420123997536012425451601245104100124765158012501897001252721760125525136012577821601260317580
/* 2010 */ /* 07-Jan-2010 10:39 */ 1262860740126541368012679765201270546620127311930012756895801278254100128081154012833617201285905120128844276012909765601293509880
/* 2011 */ /* 26-Jan-2011 12:57 */ 129604662012985899601301141220130369962013062631201308829680131139732013139636401316525940131908140013216289401324169280
/* 2012 */ /* 16-Jan-2012 09:08 */ 132670488013292390401331774700133431420013368592201339411260134197128013445385001347110100134968158013522485601354807860
/* 2013 */ /* 05-Jan-2013 03:58 */ 1357358280135989976013624339801364963820136749324013700266801372567980137511978013776825001380254100138283080013854076801387979280
/* 2014 */ /* 24-Jan-2014 05:19 */ 139054074013930893001395625560139815312014006771401403203140140573568014082783601410833100141340032014159781001418561460
/* 2015 */ /* 13-Jan-2015 09:46 */ 142114236014237130001426268880142881024014313405601433864520143638704014389129801441446840144399276014465534401449128400
/* 2016 */ /* 02-Jan-2016 05:30 */ 1451712600145429728014568738601459437420146198694014645239201467051540146957400014720964601474624560147716364014797171801482285360
/* 2017 */ /* 19-Jan-2017 22:13 */ 148486398014874463801490025480149259582014951539801497699180150023316015027597001505283900150781110015103461601512892260
/* 2018 */ /* 08-Jan-2018 22:25 */ 1515450300151801884015205944001523171820152574534015283099201530863460153340668015359422201538473500154100400015435371401546076040
/* 2019 */ /* 27-Jan-2019 21:10 */ 154862340015511804801553746200155631708015588884401561455960156401748015665721601569120060157166154015741978601576731420
/* 2020 */ /* 17-Jan-2020 12:58 */ 157926588015818050201584351240158690496015894649801592029440159459654015971643001599729960160229034016048431601607387760
/* 2021 */ /* 06-Jan-2021 09:37 */ 1609925820161246022016149942001617530520162007140016226186401625173860162773736016303075801632880620163545150016380160801640571840
/* 2022 */ /* 25-Jan-2022 13:41 */ 164311806016456555201648186620165071496016532449801655781060165832674016608837601663451520166602690016686052201671180960
/* 2023 */ /* 15-Jan-2023 02:10 */ 167374860016763040601678846080168137706016839016801686425460168895368016914904801694038860169660008016991734201701755340
/* 2024 */ /* 04-Jan-2024 03:30 */ 1704339000170691588017094793801712027700171456282017170891801719611580172213506017246643601727203800172975698017323252801734905880
/* 2025 */ /* 21-Jan-2025 20:31 */ 173749146017400727201742642940174519930017477423401750274340175279908017553211201757845980176037918017629252801765486320
/* 2026 */ /* 10-Jan-2026 15:48 */ 1768060080177064098017732218801775796660177836100017809128001783452540178598286017885082601791033900179356488017961052801798657140
/* 2027 */ /* 29-Jan-2027 10:55 */ 180122010018037917601806368040180894348018115126801814072040181662090018191608201821694800182422614018267580801829293860
/* 2028 */ /* 18-Jan-2028 19:26 */ 183183636018343876801836948180183951582018420865801844656020184722096018497799001852332360185487822018574179601859953140
/* 2029 */ /* 07-Jan-2029 13:26 */ 1862486760186502272018675642601870113060187266888018752303401877795820188036370018829315801885496220188805432018906040801893145740
/* 2030 */ /* 26-Jan-2030 18:14 */ 189568164018982150801900749060190328634019058290201908379140191093802019135053001916078160191865180019212211201923782460
 
); /* end of Q3Moons array */

// ------------- end of USNO moon data -----------------------------

   
if ($hh==0$hh=idate("H");
   if (
$mm==0$mm=idate("i");
   if (
$ss==0$ss=idate("s");
   if (
$MM==0$MM=idate("m");
   if (
$DD==0$DD=idate("d");
   if (
$YY==0$YY=idate("Y");

   
$date mktime($hh,$mm,$ss,$MM,$DD,$YY);  // Unix date from local time
     
$info = new STDclass;
   @
$info->date $date;
   
$info->datetxt gmdate('D, d-M-Y H:i T',$date);
   
   if (
$date $newMoons[1]) {
       
$info->error "Date must be after " .date("r",$newMoons[1]);
       return 
$info;
   }
   if (
$date $newMoons[count($newMoons)-1]) {
       
$info->error "Date must be before ".date("r",$newMoons[count($newMoons)-1]);
       return 
$info;
   }

   foreach (
$newMoons as $mi=>$newMoon) { // find next New Moon from given date
      
if ($newMoon>$date) {break;}
   }
   
// Get Moon dates
   
$NM $newMoons [$mi-1]; // previous new moon
   
$Q1 $Q1Moons  [$mi-1]; // 1st Q end
   
$Q2 $fullMoons[$mi-1]; // 2nd Q end - Full moon
   
$Q3 $Q3Moons  [$mi-1]; // 3rd Q end
   
$Q4 $newMoons [$mi  ]; // 4th Q end - next new moon

   // Divide each phase into 7 periods (4 phases x 7 = 28 periods)
   
$Q1p round(($Q1-$NM)/7);
   
$Q2p round(($Q2-$Q1)/7);
   
$Q3p round(($Q3-$Q2)/7);
   
$Q4p round(($Q4-$Q3)/7);

   
// Determine start and end times for major phases (lasting 1 period of 28)
   
$NMe $NM+($Q1p/2);                         //  0% .... - New moon
   
$Q1s $Q1-($Q1p/2);  $Q1e $Q1+($Q2p/2);   // 50% 1stQ - First Quarter
   
$Q2s $Q2-($Q2p/2);  $Q2e $Q2+($Q3p/2);   //100% 2ndQ - Full moon
   
$Q3s $Q3-($Q3p/2);  $Q3e $Q3+($Q4p/2);   // 50% 3rdQ - Last Quarter
   
$NMs $Q4-($Q4p/2);                         //  0% 4thQ - New Moon

// Determine age of moon in days since last new moon
   
$age = ($date $newMoons[$mi-1])/86400// age in days since last new moon
   
$dd  intval($age);
   
$hh  intval(($age-$dd)*24);
   
$mm  intval(((($age-$dd)*24)-$hh)*60);
   
$info->age $dd.' days, '.$hh.' hours, '.$mm.' minutes';

// Illumination
   
switch (true) { // Determine moon age in degrees (0 to 360)
   
case ($date<=$Q1): $ma = ($date $NM) * (90 / ($Q1 $NM))+  0; break; // NM to Q1
   
case ($date<=$Q2): $ma = ($date $Q1) * (90 / ($Q2 $Q1))+ 90; break; // Q1 to FM
   
case ($date<=$Q3): $ma = ($date $Q2) * (90 / ($Q3 $Q2))+180; break; // FM to Q3
   
case ($date<=$Q4): $ma = ($date $Q3) * (90 / ($Q4 $Q3))+270; break; // Q3 to NM
   
}
   
$info->ill abs(round(100*(1+cos($ma*(M_PI/180)))/2)-100);

// Deterime picture number (0-27) and moon phase
   
switch (true) {
   case (
$date<=$NMe): $pic =  0;                        $ph 'New Moon';          break;
   case (
$date$Q1s): $pic =  1  +(($date-$NMe)/$Q1p);  $ph 'Waxing Crescent';   break; // Waxing Crescent
   
case ($date<=$Q1e): $pic =  7;                        $ph 'First Quarter';     break;
   case (
$date$Q2s): $pic =  7.5+(($date-$Q1e)/$Q2p);  $ph 'Waxing Gibbous';    break;
   case (
$date<=$Q2e): $pic 14;                        $ph 'Full Moon';         break;
   case (
$date$Q3s): $pic 14.5+(($date-$Q2e)/$Q3p);  $ph 'Waning Gibbous';    break;
   case (
$date<=$Q3e): $pic 21;                        $ph 'Last Quarter';      break;
   case (
$date$NMs): $pic 21.5+(($date-$Q3e)/$Q4p);  $ph 'Waning Crescent';   break; // Waning Crecent
   
default           : $pic =  0;                        $ph 'New Moon';
   }
   
$info->pic   round($pic);
   
$info->phase $ph;
   
$info->NM    $NM;
   
$info->NMGMT    gmdate('D, d-M-Y H:i T',$NM);
   
$info->NMWD    gmdate('H:i T d F Y',$NM);
   
$info->Q1    $Q1;
   
$info->Q1GMT    gmdate('D, d-M-Y H:i T',$Q1);
   
$info->Q1WD    gmdate('H:i T d F Y',$Q1);
   
$info->FM    $Q2;
   
$info->FMGMT    gmdate('D, d-M-Y H:i T',$Q2);
   
$info->FMWD    gmdate('H:i T d F Y',$Q2);
   
$info->Q3    $Q3;
   
$info->Q3GMT    gmdate('D, d-M-Y H:i T',$Q3);
   
$info->Q3WD    gmdate('H:i T d F Y',$Q3);
   
$info->Q4    $Q4;
   
$info->Q4GMT    gmdate('D, d-M-Y H:i T',$Q4);
   
$info->Q4WD    gmdate('H:i T d F Y',$Q4);
   
$info->FM2   $fullMoons[$mi];
   
$info->FM2GMT   gmdate('D, d-M-Y H:i T',$fullMoons[$mi]);
   
$info->FM2WD   gmdate('H:i T d F Y',$fullMoons[$mi]);

#  tman1991 mods for cell.php add-on 
   
$moonD = array($NM       $Q1            $Q2        $Q3           $Q4       $Q1Moons[$mi]  , $fullMoons[$mi], $Q3Moons[$mi] );
   
$moonP = array("New Moon""First Quarter""Full Moon""Last Quarter""New Moon""First Quarter""Full Moon"    "Last Quarter");
   
$moonI = array("NM"      "Q1"           "FM"       "Q3"          "NM"      "Q1"           "FM"           "Q3"          );
   foreach(
$moonD as $key=>$mdate) {
      if (
$mdate>$date) {
         
$info->moons[] = array ($moonP[$key], $mdate$moonI[$key], date("r",$mdate));
      }
   }
#  end tman1991 mods for cell.php add-on 

return $info;
}
// -----------------------------------------------------------------------------
// SEASON FUNCTIONS  return season dates based on USNO dates for Spring, Summer, Fall, Winter                                                             .
// -----------------------------------------------------------------------------
function cGetSeasonInfo ($YY=0) { // feed it the year

$seasonList = array( // seasons from USNO in WD date format
// generated from https://api.usno.navy.mil/seasons?year=YYYY&tz=0&dst=false JSON
// year => 'Spring|Summer|Autumn|Winter' (Northern Hemisphere)
 
'2018' => '16:15 GMT 20 March 2018|10:07 GMT 21 June 2018|01:54 GMT 23 September 2018|22:23 GMT 21 December 2018|',
 
'2019' => '21:58 GMT 20 March 2019|15:54 GMT 21 June 2019|07:50 GMT 23 September 2019|04:19 GMT 22 December 2019|',
 
'2020' => '03:50 GMT 20 March 2020|21:44 GMT 20 June 2020|13:31 GMT 22 September 2020|10:02 GMT 21 December 2020|',
 
'2021' => '09:37 GMT 20 March 2021|03:32 GMT 21 June 2021|19:21 GMT 22 September 2021|15:59 GMT 21 December 2021|',
 
'2022' => '15:33 GMT 20 March 2022|09:14 GMT 21 June 2022|01:04 GMT 23 September 2022|21:48 GMT 21 December 2022|',
 
'2023' => '21:24 GMT 20 March 2023|14:58 GMT 21 June 2023|06:50 GMT 23 September 2023|03:27 GMT 22 December 2023|',
 
'2024' => '03:06 GMT 20 March 2024|20:51 GMT 20 June 2024|12:44 GMT 22 September 2024|09:20 GMT 21 December 2024|',
 
'2025' => '09:01 GMT 20 March 2025|02:42 GMT 21 June 2025|18:19 GMT 22 September 2025|15:03 GMT 21 December 2025|',
 
'2026' => '14:46 GMT 20 March 2026|08:24 GMT 21 June 2026|00:05 GMT 23 September 2026|20:50 GMT 21 December 2026|',
 
'2027' => '20:25 GMT 20 March 2027|14:11 GMT 21 June 2027|06:02 GMT 23 September 2027|02:42 GMT 22 December 2027|',
 
'2028' => '02:17 GMT 20 March 2028|20:02 GMT 20 June 2028|11:45 GMT 22 September 2028|08:19 GMT 21 December 2028|',
 
'2029' => '08:02 GMT 20 March 2029|01:48 GMT 21 June 2029|17:38 GMT 22 September 2029|14:14 GMT 21 December 2029|',
 
'2030' => '13:52 GMT 20 March 2030|07:31 GMT 21 June 2030|23:27 GMT 22 September 2030|20:09 GMT 21 December 2030|',
); 
// end of seasonList
  
if($YY<2009) {$YY idate('Y');} // use current year 
  
$info = new stdClass();
  if(!isset(
$seasonList[$YY])) {
       
$info->error "Year $YY not in list";
       return 
$info;
   }
   list(
$spring,$summer,$fall,$winter) = explode('|',$seasonList[$YY]);
   
$info->spring $spring;
   
$info->summer $summer;
   
$info->fall   $fall;
   
$info->winter $winter;
   
   return 
$info;

}

?>

include-style-switcher.php permissions=-rwxrwxrwx [0777]

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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?php
/*
PHP script by Mike Challis, www.642weather.com/weather/
Carterlake/AJAX/PHP Template - Color Theme Switcher Plugin PHP Script

Version: 1.17 - 19-Dec-2008 - tweaks to initial release
- adjustment to cookie path setting
Version 1.18 - 10-Feb-2011 - fix duplicate id= in wide/narrow selection HTML
Version 1.19 - 05-Feb-2013 - fix HTML5 validation issues
Version 1.20 - 27-Apr-2020 - fix warnings if headers were already sent
Version 1.21 - 29-Nov-2021 - add SameSite=Lax to all cookies

see changelog.txt for all change history

Support comes from saratogaWX in this topic at the Weather-Watch.com forum:
http://www.weather-watch.com/smf/index.php/topic,30183.0.html

You are free to use and modify the code

This php code provided "as is", and Long Beach Weather (Michael Challis)
disclaims any and all warranties, whether express or implied, including
(without limitation) any implied warranties of merchantability or
fitness for a particular purpose.
*/

# session_start() must be processed before any other output
# or you might get a warning "headers already sent".
if( !isset( $_SESSION ) ) {
    
session_start();
}

#################
# begin settings
# ##############

# note the style names in this array are intentionally missing
# the '-wide' and '-narrow' part of the file name, because it is automatically
# replaced by the program based on the user's setting for wide or narrow
# ie: a css file on the server has weather-screen-blue-wide.css
# but the name of it in this array is weather-screen-blue.css

# You can make new styles and add them, just add a new file to the server
# and add a new entry in the array below using the file name conventions noted above

# you can add or remove styles from this array
$CSSstyles = array(
'weather-screen-black.css'   => 'Black',
'weather-screen-blue.css'    => 'Blue',
'weather-screen-dark.css'    => 'Dark',
'weather-screen-fall.css'    => 'Fall',
'weather-screen-green.css'   => 'Green',
'weather-screen-icetea.css'  => 'Ice Tea',
'weather-screen-mocha.css'   => 'Mocha',
'weather-screen-orange.css'  => 'Orange',
'weather-screen-pastel.css'  => 'Pastel',
'weather-screen-purple.css'  => 'Purple',
'weather-screen-red.css'     => 'Red',
'weather-screen-salmon.css'  => 'Salmon',
'weather-screen-silver.css'  => 'Silver',
'weather-screen-spring.css'  => 'Spring',
'weather-screen-taupe.css'   => 'Taupe',
'weather-screen-teal.css'    => 'Teal',
);

############
# Use javascript 'OnChange' to post form
############
# if set to true, the style select will not need a "set" button
# if set to false, the style select show a "set" button
# There is a known issue with IE6 and the onchange feature,
# the ajax updates sometimes interfere causing the onchange not to change when changing a selection

# recommended setting: false
$use_onchange_submit false# set to true or false

############
# Use cookies to remember settings between site visits
############
# cookies are used to remember the users style settings on each visit to the web site
# you can disable use of cookies, but then the settings would have to be set by
# the user each visit to the web site

# recommended setting: true
$use_cookies true# set to true or false

# sets allowable user style select options: (can be overriden with $SITE['CSSsettings_mode'])
$settings_mode 1# user can select style and widescreen (show style select and screen width select)
//$settings_mode = 2; # user can select styles only (hide screen width select)
//$settings_mode = 3; # user can select screen width only (hide style select)
#################
# end settings
# ##############

  
include_once("Settings.php");
  include_once(
"common.php");
  global 
$SITE$LANGLOOKUP;

if (isset(
$SITE['CSSsettings_mode']) && $SITE['CSSsettings_mode'] > && $SITE['CSSsettings_mode'] < 4) {
  
$settings_mode $SITE['CSSsettings_mode'];
}
function 
print_css_style_menu ($menubar 0$output 'echo') {

  global 
$SITE$LANGLOOKUP;

$string '';

/* ###

  # this function makes the form input html so a user can select a style
  # it can be called in menubar.php or on index.php

  # when using on on menubar.php, you can have it print narrow on a few lines this:
  #<div style="margin-left: 5px">
  #<?php print_css_style_menu(1); ?>
  #</div>

  # when using on on index.php, you can have it print horizontal on one line like this:
  #<?php print_css_style_menu(0); ?>

*/ ###

  
global $CSSstyles$use_onchange_submit$settings_mode;

$CSSstyle '';
# was there a style selected from the form input
if (isset($_POST['CSSstyle']) && preg_match("/^[a-z0-9-]{1,50}.css$/i"$_POST['CSSstyle'])) {
     
$CSSstyle $_POST['CSSstyle'];
} else if (isset(
$_SESSION['CSSstyle'])) {
     
$CSSstyle $_SESSION['CSSstyle'];
}

# was use widescreen template selected from the form input?
$CSSwscreenOnChecked '';
$CSSwscreenOffChecked '';
if (isset(
$_SESSION['CSSwidescreen']) && $_SESSION['CSSwidescreen'] == 1) {
    
$CSSwscreenOnChecked ' checked="checked"';
} else if (isset(
$_SESSION['CSSwidescreen']) && $_SESSION['CSSwidescreen'] == 0) {
    
$CSSwscreenOffChecked ' checked="checked"';
} else {
    
$CSSwscreenOffChecked ' checked="checked"';
}
$string .= '<p class="sideBarTitle" style="margin-left: -5px;">'langtransstr('Style Options') .'</p>';
$string .= '
<form method="post" name="style_select" action="#">
<p>'
;

if (
$settings_mode != 3) {  // style settings allowed

    
$string .= '<label for="CSSstyle">'.langtransstr('Style').':</label>';
    if (
$menubar$string .= '<br />';
    
    if(
$use_onchange_submit == false) {
    
$string .= '
     <select id="CSSstyle" name="CSSstyle">'
;
    }
    else {
    
$string .= '
    <select id="CSSstyle" name="CSSstyle" onchange="this.form.submit();">'
;
    }
    
    
$CSSstyleSelected '';
    foreach (
$CSSstyles as $k => $v) {
     if (
$CSSstyle == "$k"$CSSstyleSelected ' selected="selected"';
    
$string .= '<option value="'.$k.'"'.$CSSstyleSelected.'>'.langtransstr($v).'</option>'."\n";
     
$CSSstyleSelected '';
    }
    
$string .= '</select>';
    
    if (
$menubar) {
           
$string .= '<br />';
    }else{
           
$string .= ' &nbsp;&nbsp; ';
           if(
$use_onchange_submit == false) {
              
$string .= '<input type="submit" name="' langtransstr('Set') .'" value="' langtransstr('Set') .'" />';
           }
    }
    
    if (!
$menubar) {
           
$string .= ' &nbsp;&nbsp; ';
    }
}
if (
$settings_mode != 2) {  // screen width settings allowed

    
$string .= langtransstr('Widescreen') . ':';
    if (
$menubar) {
           
$string .= '<br />';
    }else{
           
$string .= ' ';
    }
    
    if(
$use_onchange_submit == true) {
    
$string .= '<label for="CSSwidescreenOn">'.langtransstr('On').'</label> <input type="radio" id="CSSwidescreenOn" name="CSSwidescreen" value="1" '.$CSSwscreenOnChecked.' onchange="this.form.submit();" />
    | <label for="CSSwidescreenOff">'
.langtransstr('Off').'</label> <input type="radio" id="CSSwidescreenOff" name="CSSwidescreen" value="0" '.$CSSwscreenOffChecked.' onchange="this.form.submit();" />';
    }
    else {
    
$string .= '<label for="CSSwidescreenOn">'.langtransstr('On').'</label> <input type="radio" id="CSSwidescreenOn" name="CSSwidescreen" value="1" '.$CSSwscreenOnChecked.' />
    | <label for="CSSwidescreenOff">'
.langtransstr('Off').'</label> <input type="radio" id="CSSwidescreenOff" name="CSSwidescreen" value="0" '.$CSSwscreenOffChecked.' />';
    }
}
if (
$menubar) {
       
$string .= '<br />';
}else{
       
$string .= ' &nbsp;&nbsp; ';
}

if(
$use_onchange_submit == false) {
  
$string .= '<input type="submit" name="' langtransstr('Set') .'" value="' langtransstr('Set') .'" />';
}

$string .= '</p>
</form>'
;

# can be printed right where you call it or loaded into a string for later print
# $menubottom .= print_css_style_menu(1,'string');
# print_css_style_menu(1);

if ($output == 'echo') {
         echo 
$string;
} else {
         return 
$string;
}

 
# uncomment only for debugging
// echo '<p><b>COOKIE INFO:</b><br>';
// print_r($_COOKIE).'</p>';
// echo '<hr>';
// echo '<p><b>SESSION INFO:</b><br>';
// print_r($_SESSION).'</p>';
// echo '<p>Style choice ' .$SITE['CSSscreen'] .'</p>';

}


function 
validate_style_choice() {

   
# this function sets the working style based on user's input or not
   # input can come from post, cookie, or session

   
global $CSSstyles$SITE$use_cookies$settings_mode;

  
$wide_style 0;
  
$narrow_style 0;
  
$CSSstyle '';

  
// incase site admin sets up $SITE['CSSscreenDefault'] wrong
  
$SITE['CSSscreenDefault'] = str_replace ('-narrow','',$SITE['CSSscreenDefault']);
  
$SITE['CSSscreenDefault'] = str_replace ('-wide','',$SITE['CSSscreenDefault']);

  if (
$settings_mode == 2) { // user can select styles only (screen width will be $SITE['CSSscreenDefault'])
    
if ($SITE['CSSwideOrNarrowDefault'] == 'wide') {
            
$_SESSION['CSSwidescreen'] = 1;
            
$wide_style 1;
    }else {
            
$_SESSION['CSSwidescreen'] = 0;
            
$narrow_style 1;
    }
  }
  
# is there a CSSstyle selection from the post, cookie, or session?
  
if (isset($_POST['CSSstyle']) && preg_match("/^[a-z0-9-]{1,50}.css$/i"$_POST['CSSstyle'])) {
       
$CSSstyle $_POST['CSSstyle'];
  }
  else if (
$use_cookies == true && isset($_COOKIE['CSSstyle'])) {
       
$_SESSION['CSSstyle'] = $_COOKIE['CSSstyle'];
       
$CSSstyle $_COOKIE['CSSstyle'];
  }
  else if (isset(
$_SESSION['CSSstyle'])) {
       
$CSSstyle $_SESSION['CSSstyle'];
  }

  if (
$settings_mode == 3) { // widescreen on off only (user cannot select styles)
       
$_SESSION['CSSstyle'] = $SITE['CSSscreenDefault'];
       
$CSSstyle $SITE['CSSscreenDefault'];
  }
  
# was use CSSwidescreen template selected from the form post?
  
if (isset($_POST['CSSwidescreen']) && $_POST['CSSwidescreen'] == 1) {
       if (
$use_cookies == trueset_style_cookie ('CSSwidescreen''1');
       
$_SESSION['CSSwidescreen'] = 1;
       
$wide_style 1;
  }
  
# was use CSSwidescreen template unselected from the form post?
  
else if (isset($_POST['CSSwidescreen']) && $_POST['CSSwidescreen'] == 0) {
       if (
$use_cookies == trueset_style_cookie ('CSSwidescreen''0');
       
$_SESSION['CSSwidescreen'] = 0;
       
$narrow_style 1;
  }

  
//  fixed bug (default widescreen not being set)
  
if (isset($_SESSION['CSSwidescreen']) && $_SESSION['CSSwidescreen'] == 1) {
       
$wide_style 1;
  }

  
# was use CSSwidescreen template selected from a stored cookie?
  
if ($wide_style == && $narrow_style == && $use_cookies == true && isset($_COOKIE['CSSwidescreen']) && $_COOKIE['CSSwidescreen'] == 1) {
       if (
$use_cookies == trueset_style_cookie ('CSSwidescreen''1');
       
$_SESSION['CSSwidescreen'] = 1;
       
$wide_style 1;
  }
  
# was use CSSwidescreen template unselected from a stored cookie?
  
if ($wide_style == && $narrow_style == && $use_cookies == true && isset($_COOKIE['CSSwidescreen']) && $_COOKIE['CSSwidescreen'] == 0) {
       if (
$use_cookies == trueset_style_cookie ('CSSwidescreen''0');
       
$_SESSION['CSSwidescreen'] = 0;
  }

  
# is the seletcted template or one in session one we really have?
  
if ($CSSstyle != '') {
       foreach (
$CSSstyles as $k => $v) {
          if (
$CSSstyle == "$k")  {
              
$_SESSION['CSSstyle'] = $k;
              if (
$use_cookies == true) {
                  
set_style_cookie ('CSSstyle'$k);
                  
set_style_cookie ('CSSwidescreen' $wide_style);
              }
              if (isset(
$_SESSION['CSSwidescreen']) && $_SESSION['CSSwidescreen'] == 1) {
                      
$CSSstyle str_replace ('.css','-wide.css',$k);
              } else {
                      
$CSSstyle str_replace ('.css','-narrow.css',$k);
              }
              return 
$CSSstyle;
          }
       }
  }else{
       
# nothing was matched, show default, no set cookie
       
$_SESSION['CSSstyle'] = $SITE['CSSscreenDefault'];
       if (
$SITE['CSSwideOrNarrowDefault'] == 'wide') {
               
$_SESSION['CSSwidescreen'] = 1;
               
$CSSstyle str_replace ('.css','-wide.css',$SITE['CSSscreenDefault']);
       } else {
               
$_SESSION['CSSwidescreen'] = 0;
               
$CSSstyle str_replace ('.css','-narrow.css',$SITE['CSSscreenDefault']);
       }
       return 
$CSSstyle;
  }
}

function 
set_style_cookie ($name$val) {
   global 
$SITE;
   
# this function sets a cookie
   # set expiration date 6 months ahead
   
$expire strtotime("+6 month");
   if ( isset(
$SITE['cookie_path']) ) {
     
$path $SITE['cookie_path']; // this can be set in Settings.php
   
} else {
     
$scripturlparts explode('/'$_SERVER['PHP_SELF']);
     
$scriptfilename $scripturlparts[count($scripturlparts)-1];
     
$scripturl preg_replace("/$scriptfilename$/i"''$_SERVER['PHP_SELF']);
     
$path $scripturl;
   }
     
   if(!
headers_sent()) {
             if(
PHP_VERSION_ID 70300) {
                 
$didit setcookie("$name",$val,$expire,$path.'; SameSite=Lax');
             } else {
                 
$arr_cookie_options = array (
                        
'expires' => $expire,
                        
'path' => $path,
                    
#    'domain' => $_SERVER['SERVER_NAME'], // leading dot for compatibility or use subdomain
                        
'secure' => false,     // or true
                        
'httponly' => false,    // or true
                        
'samesite' => 'Lax' // None || Lax  || Strict
                 
);
                 
$didit setcookie("$name",$val,$arr_cookie_options);
             }
     }
}

?>

flyout-menu.php permissions=-rwxrwxrwx [0777]

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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<?php
// flyout menu generator using http://www.cssplay.co.uk/menus/flyout_4level.html
// menu stylesheet adapted by Ken True - http://saratoga-weather.org/
//                         and Mike Challis - http://www.642weather.com/weather/
//
// this release is specifically for the Weather-Display/AJAX/PHP template set
//
// Version 1.00 - 18-Mar-2008 - Initial release
// Version 1.01 - 23-Apr-2008 - added support for WD-World-ML (multilingual)
// Version 1.02 - 18-Aug-2008 - fix for 'unknown' css processing by Mike Challis
// Version 1.03 - 20-Jan-2009 - added translation for <item title="..." /> in menu set
// Version 1.04 - 23-Jul-2010 - added tags target=,img=,align= to parsing, use menu=<name> for flyout-menu-<name>.xml
// Version 1.05 - 19-Jan-2011 - added wx="..." conditionals for universal templates
// Version 1.06 - 05-Feb-2011 - fixed IE8+ display of $FlyoutMenuText
// Version 1.07 - 04-Mar-2011 - fixed errata casting Strict: messages
// Version 1.08 - 05-Feb-2013 - fixed HTML5 validation with literal quote in translation
// Version 1.09 - 07-Dec-2020 - minor fix for PHP8.0.0
// Version 1.10 - 27-Dec-2022 - fixes for PHP 8.2
//
$Version 'flyout-menu.php (ML) Version 1.10 - 27-Dec-2022';
//
// ---------- settings ------------------------------
$MENUdef './flyout-menu.xml'// (relative) file location of XML menu definition file
$MENUdefTest './flyout-menu-%s.xml'// (relative) file location of test XML menu definition file
$imagesDir './ajax-images/';  // (relative) URL location of images dir (with trailing '/')
//
$lang 'en';  // default language
$WXsoftware 'WD'// default weather software
//
// ---------- end settings --------------------------
//  error_reporting(E_ALL); // for testing
//------------------------------------------------
// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['imagesDir']))     {$imagesDir $SITE['imagesDir'];}
if (isset(
$SITE['menudef']))     {$MENUdef $SITE['menudef'];}
if (isset(
$SITE['menudeftest']))     {$MENUdefTest $SITE['menudeftest'];}
if (isset(
$SITE['lang']))    {$lang $SITE['lang'];}
if (isset(
$SITE['WXsoftware']))    {$WXsoftware $SITE['WXsoftware'];}
// end of overrides from Settings.php if available
if (isset($_REQUEST['sce']) && ( strtolower($_REQUEST['sce']) == 'view' or
    
strtolower($_REQUEST['sce']) == 'show') ) {
   
//--self downloader --
   
$filenameReal __FILE__;
   
$download_size filesize($filenameReal);
   
header('Pragma: public');
   
header('Cache-Control: private');
   
header('Cache-Control: no-cache, must-revalidate');
   
header("Content-type: text/plain");
   
header("Accept-Ranges: bytes");
   
header("Content-Length: $download_size");
   
header('Connection: close');
   
   
readfile($filenameReal);
   exit;
}

$Debug false;
if (isset(
$_REQUEST['debug']) && strtolower($_REQUEST['debug']) == 'y') {
  
$Debug true;
}
$doDiv false;
if (isset(
$_REQUEST['gendiv']) && strtolower($_REQUEST['gendiv']) == 'y') {
  
$doDiv true;
}
if (isset(
$genDiv)) {
  
$doDiv $genDiv;
}

$doCSS false;
if (isset(
$_REQUEST['css']) && strtolower($_REQUEST['css']) == 'y') {
  
$doCSS true;
}
if (isset(
$genCSS)) {
  
$doCSS $genCSS;
}
  
$CSS '';
  
$FlyoutMenuColors loadStyleSettings(); // Get the colors to use
  
genCSSFlyout($FlyoutMenuColors);

$doPrintMenu true;
if (isset(
$PrintFlyoutMenu)) {
  
$doPrintMenu $PrintFlyoutMenu;
}
if (
$doCSS) { // only return the necessary CSS for direct include
  
print $FlyoutCSS;
  return;

}
$usingAltXML false;
if(isset(
$_REQUEST['menu']) and  preg_match('|%s|',$MENUdefTest)) {
   
$tMenu sprintf($MENUdefTest,strtolower($_REQUEST['menu']));
   
// print "<!-- checking '$tMenu' -->\n";
   
if(file_exists($tMenu)) {                                                            
     
$MENUdef $tMenu;
     
$usingAltXML true;
     print 
"<!-- using '$tMenu' -->\n";
   }
 }

$depth = array();
$MENU = array();
$MENUcnt 0;
$lastDepth 0;
$Status "<!-- $Version -->\n";

// ------------- main routine --------------------
$xml_parser xml_parser_create();
xml_set_element_handler($xml_parser"startElementFlyout""endElementFlyout");
$doTrans true;
if (
$lang <> 'en') { // special handling for non-english menu constructions
  
$tfile preg_replace('|\.xml|',"-$lang.xml",$MENUdef);
  if (
file_exists($tfile)) {
     
$MENUdef $tfile// use the XML and no other translation.
     
$doTrans false;
   }
}

if (!(
$fp fopen($MENUdef"r"))) {
    die(
"could not open XML input from $MENUdef ");
}

while (
$data fread($fp8192)) {
    if (!
xml_parse($xml_parser$datafeof($fp))) {
        die(
sprintf("XML error: %s at line %d",
                    
xml_error_string(xml_get_error_code($xml_parser)),
                    
xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);

// ----------- generate the menu XHTML ---------------
$FlyoutMenuText "<!-- begin generated flyout menu -->\n";

if (
$doDiv) {
  
$FlyoutMenuText .= "<div class=\"flyoutmenu\">\n";
}
$FlyoutMenuText .= "<!-- $Version -->\n";
$FlyoutMenuText .= "<!-- by Ken True - webmaster[at]saratoga-weather.org and -->\n";
$FlyoutMenuText .= "<!-- by Mike Challis - webmaster[at]642weather.com  -->\n";
$FlyoutMenuText .= "<!-- Adapted from Stu Nicholl's CSS/XHTML at http://www.cssplay.co.uk/menus/flyout_4level.html -->\n";
$FlyoutMenuText .= "<!-- script available at http://saratoga-weather.org/scripts-CSSmenu.php#flyout -->\n";


$FlyoutMenuText .= "<!-- using \n" print_r($FlyoutMenuColors,true) . " -->\n";
$FlyoutMenuText .= "<!-- using $MENUdef for XML, doTrans=$doTrans -->\n";

for (
$i=1;$i<count($MENU);$i++) { // loop over all menu items -1
  
$depth $MENU[$i]['depth'];
  
$nextdepth $MENU[$i+1]['depth'];
  
$indent str_repeat("  ",$depth);
  
$link $MENU[$i]['link'];
  
$title $MENU[$i]['title'];
  
$target $MENU[$i]['target'];
  
$img $MENU[$i]['img'];
  
$align $MENU[$i]['align'];
  
$wxonly $MENU[$i]['wxonly'];
  
$wxonlydisplay '';
  
$wxonlyPrefix '';
  
$wxonlySuffix '';
  if(
$wxonly <> '' and ! preg_match("|$WXsoftware|i",$wxonly) ) { // see if this menu is allowed
      
$wxonlydisplay 'wxonly=\''.$wxonly.'\' ';
      
$wxonlyPrefix "<!-- not used with $WXsoftware ";
      
$wxonlySuffix " -->";
  }
  if (
$doTrans and $title <> '') { $title preg_replace('|"|','&quot;',langtransstr($title)); }
  
$caption $doTrans?preg_replace('|"|','&quot;',langtransstr($MENU[$i]['caption'])):$MENU[$i]['caption'];
//  $caption = htmlspecialchars($caption);

  
if ($target <> '') {
    
$target ' target="' $target '"';
  } else {
    
$target '';
  }
  
  if (
$link <> '') {
    
$link 'href="' $link '"';
  } else {
    
$link 'href="' "#" '"';
  }
  
  if (
$title <> '') {
    
$title ' title="' $title '"';
  } else {
    
$title '';
  }
  
  
$leftimg '';
  
$rightimg '';
  
  if (
$img <> '') {
    
$img '<img src="' $img '" style="border:none" alt=" "/>';
    if (
preg_match('|left|i',$align)) {
       
$leftimg $img;
    } else {
        
$rightimg $img;
    }
  }

  if (
$i==1) { // start of entire image
    
$FlyoutMenuText .= "<ul>\n";
  }
  if (
$Debug) {
    
$FlyoutMenuText .= "$indent<!-- $i: depth=$depth next=$nextdepth $wxonlydisplay caption='" $MENU[$i]['caption'] . "' link='" $MENU[$i]['link'] ."' title='" $MENU[$i]['title'] . "' -  ";
  }
  if (
$depth $nextdepth) { // -------------------  start of new submenu 
    
if ($Debug) {
      
$FlyoutMenuText .= "Start new submenu -->\n";
    }
    
$FlyoutMenuText .= "$indent$wxonlyPrefix<li class=\"sub\"><a $link$title$target>$leftimg$caption "$rightimg<!--[if gte IE 7]><!--></a>$wxonlySuffix<!--<![endif]-->
$indent  <!--[if lte IE 6]><table><tr><td><![endif]-->
$indent  <ul>\n";
    
  }
  
  if (
$depth $nextdepth) { // --------------------  end of new submenu
    
if ($Debug) {
      
$FlyoutMenuText .= "End new submenu -->\n";
    }
    
$FlyoutMenuText .= "$indent$wxonlyPrefix<li><a $link$title$target>$leftimg$caption "$rightimg</a></li>$wxonlySuffix\n";
    
    for (
$j=$depth$j $nextdepth ;$j--) { // close off intervening submenu(s)
    
      
$newindent str_repeat("  ",$j-1);
    
$FlyoutMenuText .= "$newindent  </ul>
$newindent  <!--[if lte IE 6]></td></tr></table></a><![endif]-->
$newindent</li>\n";
    }
   

  }
  
  if (
$depth == $nextdepth) { // ---------------------- menu item at current depth
    
if ($Debug) {
      
$FlyoutMenuText .= "Normal menu item -->\n";
    }
    
$FlyoutMenuText .= "$indent$wxonlyPrefix<li><a $link$title$target>$leftimg$caption "$rightimg</a></li>$wxonlySuffix\n";
  
  }
  
  if (
$i==count($MENU)-1) {
    
$FlyoutMenuText .= "</ul>\n";
  }
// end of loop over menu items
if ($doDiv) {
  
$FlyoutMenuText .= "</div>\n";
}
$FlyoutMenuText .= "<!-- end generated flyout menu -->\n";

if (
$doPrintMenu) {
  print 
$FlyoutMenuText;
}

if (
$Debug) {
  print 
$Status;
}

// functions invoked by XML_parser

function startElementFlyout($parser$name$attrs
{
    global 
$depth,$Status,$lastDepth,$MENU,$MENUcnt,$WXsoftware;

    
$indent '';
    if (! @empty(
$depth[(integer)$parser]) ) {
      
$j = @$depth[(integer)$parser];
    } else {
      
$j 0;
    }
    for (
$i 0$i $j$i++) {
        
$Status .= "  ";
        
$indent .= "  ";
    }
    
$Status .= "<!-- Depth: $j - $name " print_r($attrs,true) . " -->\n";
    
// format the CAPTION and LINK entries
    
if (! empty($attrs['LINK']) ) {
      
$link $attrs['LINK'];
     } else {
      
$link '';
     }
    if (! empty(
$attrs['CAPTION']) ) {
      
$caption $attrs['CAPTION'];
    } else {
      
$caption '';
    }

    if (! empty(
$attrs['TITLE']) ) {
      
$title $attrs['TITLE'];
    } else {
      
$title '';
    }
    if (! empty(
$attrs['TARGET']) ) {
      
$target $attrs['TARGET'];
    } else {
      
$target '';
    }
    if (! empty(
$attrs['IMG']) ) {
      
$img $attrs['IMG'];
    } else {
      
$img '';
    }
    if (! empty(
$attrs['ALIGN']) ) {
      
$align preg_match('|left|i',$attrs['ALIGN'])?'left':'right';
    } else {
      
$align '';
    }
    if (! empty(
$attrs['WXONLY']) ) {
        
$wxonly $attrs['WXONLY'];
    } else {
      
$wxonly '';
    }

    if (
$caption <> '' or $link <> '') { // ignore entries that are wholly blank
      
$MENUcnt++;
      
$MENU[$MENUcnt]['depth'] = $j;
      
$MENU[$MENUcnt]['caption'] = $caption;
      
$MENU[$MENUcnt]['title'] = $title;
      
$MENU[$MENUcnt]['link'] = $link;
      
$MENU[$MENUcnt]['target'] = $target;
      
$MENU[$MENUcnt]['img'] = $img;
      
$MENU[$MENUcnt]['align'] = $align;
      
$MENU[$MENUcnt]['wxonly'] = $wxonly;
      
// store dummy next entry at highest level for final run-through to generate
      // the XHTML.  This will be overwritten by a 'real' entry if any
      
$MENU[$MENUcnt+1]['depth'] = 1
      
$MENU[$MENUcnt+1]['caption'] = '';
      
$MENU[$MENUcnt+1]['title'] = '';
      
$MENU[$MENUcnt+1]['link'] = '';
      
$MENU[$MENUcnt+1]['target'] = '';
      
$MENU[$MENUcnt+1]['img'] = '';
      
$MENU[$MENUcnt+1]['align'] = '';
      
$MENU[$MENUcnt+1]['wxonly'] = '';
    
    }
    
    
$lastDepth $j// remember for next time
    
$j++;
    @
$depth[(integer)$parser] = $j;
}

// called at end of particular element
function endElementFlyout($parser$name
{
    global 
$depth,$Status;
    @
$depth[(integer)$parser]--;
}
// end of XML_parser functions

// return the CSS
function genCSSFlyout ($color)
{
global  
$FlyoutCSS,$imagesDir$SITE;
global  
$TopMenuWidth,$SubMenuWidth;
global  
$TopMenuBkgnd,$TopMenuTextColor,$TopMenuTextHover,$TopMenuTextBkgnd;
global  
$TopMenuBkgrndHover,$TopMenuBorder;
global  
$SubMenuPresent,$SubMenuTextColor,$SubMenuTextHover,$SubMenuBkgrnd,$SubMenuBkgrndHover;

$SNAME $color['NAME'];
$LC $color['LINK_COLOR'];
$LBG $color['LINK_BACKGROUND'];
$HC $color['HOVER_COLOR'];
$HBG $color['HOVER_BACKGROUND'];
$BC $color['BORDER_COLOR'];
$SC $color['SHADE_IMAGE']; 

$FlyoutCSS = <<<END_OF_CSS
<!-- begin flyout-menu.php CSS definition style='{$SNAME}' -->
<style type="text/css">
/* ================================================================
This copyright notice must be untouched at all times.

The original version of this stylesheet and the associated (x)html
is available at http://www.cssplay.co.uk/menus/flyout_4level.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the associated (x)html may be modified in any
way to fit your requirements.
Modified by Ken True and Mike Challis for Weather-Display/AJAX/PHP
template set.
=================================================================== */
.flyoutmenu {
font-size:90%;
}

/* remove all the bullets, borders and padding from the default list styling */
.flyoutmenu ul {
position:relative;
z-index:500;
padding:0;
margin:0;
padding-left: 4px; /* mchallis added to center links in firefox */
list-style-type:none;
width: 110px;
}

/* style the list items */
.flyoutmenu li {
color: 
{$LC};
background:
{$LBG} url({$imagesDir}{$SC});
/* for IE7 */
float:left;
margin:0; /* mchallis added to tighten gaps between links */
}
.flyoutmenu li.sub {background:
{$LBG} url({$imagesDir}flyout-sub.gif) no-repeat right center;}

/* get rid of the table */
.flyoutmenu table {position:absolute; border-collapse:collapse; top:0; left:0; z-index:100; font-size:1em;}

/* style the links */
.flyoutmenu a, .flyoutmenu a:visited {
display:block;
text-decoration:none;
line-height: 1.8em; 
width:95px; /* mchallis changed for adjusting firefox link width */
color:
{$LC};
padding: 0 2px 0 5px; 
border:1px solid 
{$BC};
border-width:0 1px 1px 1px;
}
/* hack for IE5.5 */
         /* mchallis lowered the two width values to (101, 100)to fix IE6 links wider than menu width */
* html .flyoutmenu a, * html .flyoutmenu a:visited {width:95px; w\idth:94px;}
/* style the link hover */
* html .flyoutmenu a:hover {color:
{$HC}; background:{$HBG}; position:relative;}

.flyoutmenu li:hover {position:relative;}

/* For accessibility of the top level menu when tabbing */
.flyoutmenu a:active, .flyoutmenu a:focus {color:
{$HC}; background:{$HBG};}

/* retain the hover colors for each sublevel IE7 and Firefox etc */
.flyoutmenu li:hover > a {color:
{$HC}; background:{$HBG};}

/* hide the sub levels and give them a positon absolute so that they take up no room */
.flyoutmenu li ul {
visibility:hidden;
position:absolute;
top:-10px;
/* set up the overlap (minus the overrun) */
left:90px;
/* set up the overrun area */
padding:10px;
/* this is for IE to make it interpret the overrrun padding */
background:transparent url(
{$imagesDir}flyout-transparent.gif);
}

/* for browsers that understand this is all you need for the flyouts */
.flyoutmenu li:hover > ul {visibility:visible;}


/* for IE5.5 and IE6 you need to style each level hover */

/* keep the third level+ hidden when you hover on first level link */
.flyoutmenu ul a:hover ul ul{
visibility:hidden;
}
/* keep the fourth level+ hidden when you hover on second level link */
.flyoutmenu ul a:hover ul a:hover ul ul{
visibility:hidden;
}
/* keep the fifth level hidden when you hover on third level link */
.flyoutmenu ul a:hover ul a:hover ul a:hover ul ul{
visibility:hidden;
}

/* make the second level visible when hover on first level link */
.flyoutmenu ul a:hover ul {
visibility:visible;
}
/* make the third level visible when you hover over second level link */
.flyoutmenu ul a:hover ul a:hover ul{
visibility:visible;
}
/* make the fourth level visible when you hover over third level link */
.flyoutmenu ul a:hover ul a:hover ul a:hover ul {
visibility:visible;
}
/* make the fifth level visible when you hover over fourth level link */
.flyoutmenu ul a:hover ul a:hover ul a:hover ul a:hover ul {
visibility:visible;
}

</style>
<!-- end of flyout-menu.php CSS definition -->

END_OF_CSS;

// end of genCSS function

function loadStyleSettings ( ) {

global 
$SITE;

# array of css style names, when adding a new style ...
# edit this to add a new name, also add a new link color array below,
# weather-screen-[NAME]-[narrow or wide].css

$styles_array_all = array(
array(
'NAME' => 'black',  'SHADE_IMAGE'=> 'flyout-shade-4A4A4A.gif''BORDER_COLOR'=> 'black''LINK_COLOR'=> '#CC9933''LINK_BACKGROUND'=> '#4A4A4A''HOVER_COLOR' => 'white''HOVER_BACKGROUND' => 'black',),   # black
array('NAME' => 'blue',   'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#336699''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#3173B1',), # blue
array('NAME' => 'dark',   'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#58B6C7',), # dark
array('NAME' => 'fall',   'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#E87510',), # fall
array('NAME' => 'green',  'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#00745B',), # green
array('NAME' => 'icetea''SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#786032',), # icetea
array('NAME' => 'mocha',  'SHADE_IMAGE'=> 'flyout-shade-CCBFAD.gif''BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> '#CCBFAD''HOVER_COLOR' => 'black''HOVER_BACKGROUND' => '#D7E2E8',), # mocha
array('NAME' => 'orange''SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#CC6600''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#CC6600',), # orange
array('NAME' => 'pastel''SHADE_IMAGE'=> 'flyout-shade-E1EBF2.gif''BORDER_COLOR'=> 'black''LINK_COLOR'=> '#03447D''LINK_BACKGROUND'=> '#E1EBF2''HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#7190BF',), # pastel
array('NAME' => 'purple''SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#993333''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#993333',), # purple
array('NAME' => 'red',    'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#993333''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#993333',), # red
array('NAME' => 'salmon''SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#46222E''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#A4CB32',), # salmon
array('NAME' => 'silver''SHADE_IMAGE'=> 'flyout-shade-9A9A9A.gif''BORDER_COLOR'=> 'black''LINK_COLOR'=> '#EDDD2F''LINK_BACKGROUND'=> '#9A9A9A''HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#666666',), # silver
array('NAME' => 'spring''SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#A9D26A',), # spring
array('NAME' => 'taupe',  'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> 'black',   'LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#75B7BF',), # taupe
array('NAME' => 'teal',   'SHADE_IMAGE'=> 'flyout-shade-white.gif',  'BORDER_COLOR'=> 'black''LINK_COLOR'=> '#006666''LINK_BACKGROUND'=> 'white',   'HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#006666',), # teal
);

# default
$menu_colors = array('NAME' => 'unknown''SHADE_IMAGE'=> 'flyout-shade.gif',  'BORDER_COLOR'=> 'white''LINK_COLOR'=> 'black''LINK_BACKGROUND'=> '#D4D8BD''HOVER_COLOR' => 'white''HOVER_BACKGROUND' => '#AA7');

if (isset(
$SITE['CSSscreen']) && preg_match("/^[a-z0-9-]{1,50}.css$/i"$SITE['CSSscreen'])) {
  
preg_match("/^weather-screen-([a-z0-9]+)-(wide|narrow).css$/i"$SITE['CSSscreen'], $matches);

  
# this can be used for any conditionals requiring color style name
  
$style_color trim($matches[1]);

  
# this can be used for any conditionals requiring wide or narrow
  
$style_wide_or_narrow trim($matches[2]);
}

foreach (
$styles_array_all as $v) {
     if(
$style_color == $v['NAME']) {
       
$menu_colors $v;
       break;
     }
}

return (
$menu_colors); // return the color choice associative array

// end loadStyleSettings

// end of flyout-menu.php
?>