Author Topic: include-wxstatus.php update and wxstatus.php issue.  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 211
include-wxstatus.php update and wxstatus.php issue.
« on: April 26, 2020, 12:59:40 PM »
Hi Ken,

I applied the resent change to include-wxstatus.php and I'm getting the following error on my wxstatus.php page.

Fatal error: Cannot redeclare update_whos_online() (previously declared in C:\inetpub\weathercat\whos-online\include-whos-online-header.php:72) in C:\inetpub\weathercat\whos-online\include-whos-online-header.php on line 284

Any idea how I could fix this?

Thanks


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #1 on: April 26, 2020, 02:22:28 PM »
What's the URL to your website, and I'll take a look...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #2 on: April 26, 2020, 02:25:45 PM »
I found your site..

In Settings.php change
Code: [Select]
require ($C['files_path'].'include-whos-online-header.php'); to
Code: [Select]
require_once ($C['files_path'].'include-whos-online-header.php'); and that should fix the issue.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 211
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #3 on: April 26, 2020, 02:36:39 PM »
Thanks Ken, the page now loads but I still get the following on the page.

Notice: A session had already been started - ignoring session_start() in C:\inetpub\weathercat\Settings.php on line 366

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #4 on: April 26, 2020, 02:49:40 PM »
Those Notice: errata can be pesky.
Change Settings.php
Code: [Select]
  session_start(); // for preservation of language settings. to
Code: [Select]
  @session_start(); // for preservation of language settings. and that should suppress that Notice (and any other) error on that function call.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 211
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #5 on: April 26, 2020, 02:52:10 PM »
Yay, all is better now. Thanks Ken.

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #6 on: April 27, 2020, 05:39:00 AM »
Hi Ken ,
I think there is something wrong regarding the availability of the parameters defined in "Settings-weather.php".
After the new change, according to me these parameters are "not available" anymore.
When you look at the bottom of the page of wxstatus.php the weather software is now "(unspecified)", see attachment. 
I thought this was defined in "Settings-weather.php"

kr
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline ed_heaton

  • Contributor
  • ***
  • Posts: 147
    • Atglen Borough Weather Observatory
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #7 on: April 27, 2020, 02:58:28 PM »
Hey Ken, I'm getting some errors as well...
www.atglenweather.com
« Last Edit: April 27, 2020, 03:33:03 PM by ed_heaton »

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #8 on: April 27, 2020, 04:07:44 PM »
I was looking at this and just saw a tweet from Ken with an update... So maybe he's fixed it. I think it has to do with Settings.php getting included twice and then include-style-switcher.php trying to set a cookie long after the </head>. Let's see how good my guess is. :)
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline ed_heaton

  • Contributor
  • ***
  • Posts: 147
    • Atglen Borough Weather Observatory
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #9 on: April 27, 2020, 04:12:00 PM »
Jasiu as always you're right on the money!!!  The new update fixed my issues!!!  Thanks Ken :-)

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #10 on: April 27, 2020, 04:24:16 PM »
Jasiu, "You chose wisely" :)

Yes, today's update brings a fix to include-style-switcher.php (not touched since 2013) to avoid trying to set cookies when already done.
Thanks to lddaly, a simple fix to wxstatus.php corrects display issue present since 2012 (langtrans() v.s. langtransstr())
I also took the opportunity to make some adjustments to check-fetch-times.php (thanks to zmarfak) to:
1) clean up some HTML errors in the displays
2) add redaction of API key displays with both the show=settings and in the basic check-fetch-times.php run
3) add a Deprecated script check to alert you that an old file may now be removed.. currently only two are on that list:
   (WU-forecast.php and get-nnvl-iod.php as the source data for both have dried up)

Thanks to all for the continuing feedback regarding the scripts!
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #11 on: April 27, 2020, 05:55:30 PM »
Hi Ken,
thank you for the update and as always very quick to react to our problems. [tup]
However it seems that the "(unspecified)" is not solved.
I know, minor issue but it would be nice if it would show again the used weather software as on the other pages.
(Am I the only one who has this problem in the footer ?)

Thanks
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #12 on: April 27, 2020, 06:12:26 PM »
Do you mean the line (from check-fetch-times.php?show=versions) that says
Quote
WL-plugin   WLtags.txt   Current   Vn/a - 2011-01-07   Vn/a - n/a   (not specified)
or the line in the footer on wxstatus.php that says
Quote
© 2020, Matar.be | (unspecified) (6.0.4) | Valid XHTML 1.0 | Valid CSS

or both...?
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 211
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #13 on: April 27, 2020, 06:31:48 PM »
Hi Ken,

I think zmarfak is talking about the second one on the footer of the wxstatus.php page.

I'm also seeing this on my page.

Offline ed_heaton

  • Contributor
  • ***
  • Posts: 147
    • Atglen Borough Weather Observatory
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #14 on: April 27, 2020, 07:15:04 PM »
I wanted to give a big shout out to Ken for his tireless work keeping our websites running smoothly and efficiently.   

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #15 on: April 27, 2020, 07:39:38 PM »

I think zmarfak is talking about the second one on the footer of the wxstatus.php page.


What I think could be happening here is that the addition of check-fetch-times.php within the status page then re-includes Settings.php at line 476 (version 1.33). Settings.php then rewrites the WXsoftware SITE settings. When it gets to the end of Settings.php and looks to include Settings-weather.php, that's an include_once() call, so it doesn't get pulled in, leaving you with the "unspecified" setting from Settings.php.  I hope that make sense.

I'm not sure if there is a reason why Ken has check-fetch-times.php line 476 with an include instead of include_once(). You could try to do the latter there ("include_once("Settings.php");").
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #16 on: April 27, 2020, 08:18:31 PM »
Wow, thanks Jasiu for spotting the root cause EXACTLY!   =D&gt; =D&gt; =D&gt;  \:D/  [tup]

I released 1.34 version with just that fix (and it worked correctly on my Canada, USA and World base sites).

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Forever

  • Senior Contributor
  • ****
  • Posts: 211
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #17 on: April 27, 2020, 08:33:14 PM »
Thanks, that fixed it.  :grin:

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #18 on: April 28, 2020, 03:16:13 AM »
Ken and Jasiu,
that fixed it and not only that.  [tup]
I can now reuse the original code in my status page because I use parameters defined in Settings-weather.php.

However (why always an however ?)
On my status page I use also a check on the file of the webcam , it does a check between sunrise and sunset.
After sunset the time is counting down until sunrise and gives the time when the camera will be up again.

Before the recent changes of including check-fetch-times.php (a very nice feature) it worked like a charm.
After that the time was way off.
It took me some time to figure out that the timezone was on "America/Los Angeles" (Saratoga time ?)
So I had to redefine my timezone to "Europe/Brussels" in wxstatus.php  just before the code I use

I guess something is still off ??
« Last Edit: April 28, 2020, 03:23:53 AM by zmarfak »
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #19 on: April 28, 2020, 08:19:38 AM »
As a test, go into Settings.php and uncomment lines 422 and 425.

Current:

Code: [Select]
  if (!function_exists('date_default_timezone_set')) {
     putenv("TZ=" . $SITE['tz']);
//     print "<!-- using putenv(\"TZ=". $SITE['tz']. "\") -->\n";
    } else {
     date_default_timezone_set($SITE['tz']);
//     print "<!-- using date_default_timezone_set(\"". $SITE['tz']. "\") -->\n";
   }

Test version:

Code: [Select]
  if (!function_exists('date_default_timezone_set')) {
     putenv("TZ=" . $SITE['tz']);
     print "<!-- using putenv(\"TZ=". $SITE['tz']. "\") -->\n";
    } else {
     date_default_timezone_set($SITE['tz']);
     print "<!-- using date_default_timezone_set(\"". $SITE['tz']. "\") -->\n";
   }

Then, when you display the status page, you can do a view-source and see when and how the time zone is being set.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #20 on: April 28, 2020, 10:31:53 AM »
Oops... sorry, I do have to run the version check in Pacific time (as that is what the files are updated in, and the update tool uses that).

What I forgot to do was restore the original timezone setting before exiting.

Please try the attached version (and take your extra reset out of your wxstatus.php) .. if that works out for you zmarfak, let me know and I'll update the distributions.   Thanks for spotting the anomaly.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #21 on: April 28, 2020, 10:32:28 AM »
Jasiu,
I have done that (you can check my page source of https://www.matar.be/weather/wxstatus.php)
first line on the page is :
Code: [Select]
<!-- using date_default_timezone_set("Europe/Brussels") -->I have also put some lines  with the function : "date_default_timezone_get()"    (I hope this is the correct function to use)
here are the results you will see the change before and after the include

Code: [Select]
<!-- timezone before standard checks is Europe/Brussels-->
<!-- include-wxstatus.php - V1.09 - 24-Apr-2020 -->
<!-- WLtags.php age = 266 secs. 0:04:26 -->
    <tr>
      <td>WeatherLink FTP</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:04:26</td>
      <td align="right">2020-04-28 16:17 </td>
    </tr>
<!-- WLtags.php internal update date time='28/04/20 16:17' fixed='2020-04-28 16:17' -->
<!-- age = 314 secs. 0:05:14 -->
    <tr>
      <td>WeatherLink weather data</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:05:14</td>
      <td align="right">2020-04-28 16:17 </td>
    </tr>
<!-- ./noaa/NOAAMO.TXT age = 266 secs. 0:04:26 -->
    <tr>
      <td>WeatherLink NOAA report</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:04:26</td>
      <td align="right">2020-04-28 16:17 </td>
    </tr>
<!-- end include-wxstatus.php -->
<!-- timezone after stand checks is America/Los_Angeles-->

Probably the America/Los Angeles is there for a correct check on date/time of changed files on the server of Ken ?? Just guessing here
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #22 on: April 28, 2020, 10:39:52 AM »
He Ken,
version 1.35 corrects the problem

Thank you
 hereby the prove
Code: [Select]
<!-- timezone before standard checks is Europe/Brussels-->
<!-- include-wxstatus.php - V1.09 - 24-Apr-2020 -->
<!-- WLtags.php age = 209 secs. 0:03:29 -->
    <tr>
      <td>WeatherLink FTP</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:03:29</td>
      <td align="right">2020-04-28 16:32 </td>
    </tr>
<!-- WLtags.php internal update date time='28/04/20 16:32' fixed='2020-04-28 16:32' -->
<!-- age = 260 secs. 0:04:20 -->
    <tr>
      <td>WeatherLink weather data</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:04:20</td>
      <td align="right">2020-04-28 16:32 </td>
    </tr>
<!-- ./noaa/NOAAMO.TXT age = 209 secs. 0:03:29 -->
    <tr>
      <td>WeatherLink NOAA report</td>
      <td align="center"><span style="color: green"><b>Current</b></span></td>
      <td align="right">0:03:29</td>
      <td align="right">2020-04-28 16:32 </td>
    </tr>
<!-- end include-wxstatus.php -->
<!-- timezone after stand checks is Europe/Brussels-->
<!-- ./day/OutsideTempHistory.gif age = 209 secs. 0:03:29 -->

:

Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #23 on: April 28, 2020, 10:48:31 AM »
Whew!  Thanks for the testing.  I'll update the distribution.

As a side note, the timezone force to America/Los_Angeles is only used inside the show=versions processing.  The check-fetch-times.php script was (until now) only used as a separate script, not intended for use on a Saratoga wx...php page.  I thought it would be useful to folks to get a summary scripts update status on the wxstatus.php page so it's easy to tell when new versions are available.  It meant a fairly comprehensive redo of how the check-fetch-times.php show=versions process runs (standalone=verbose, included=silently) and I just missed the timezone reset in that redo.  Hopefully, the only updates needed in the future will be to add/deprecate scripts to be monitored in that area.
Thanks again to all who worked with testing and feedback.. it really helped!
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: include-wxstatus.php update and wxstatus.php issue.
« Reply #24 on: April 28, 2020, 11:06:20 AM »
Glad that it's working now! And big thanks to Ken as always!!  [tup]
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

 

anything