Log in Register FAQ Memberlist Search Welcome to RCF - New Forum Index
alt : test.swf
Welcome to RCF - New
4fx3.gif 
Contact the Webmasters of RCFContact   Invite a friend to Join usRecommend   Chat in IRCChat   EZ Template Change OptionEZStyle   Listen to Internet Radio while you browse...iRadio   See your private message.Login for PMs   Important LinksLinks
Member Website LinksWeb Links   Play/View our GamesGames   Register.Register
calendar_open_closeCalendar 
Added Current Local Weather w/5 day forecast...
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - New Forum Index -> Announcements Add To Bookmarks
Added Current Local Weather w/5 day forecast...
PostPosted: 09/15/2005 6:40 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30756
Word Cnt. 2,628,677
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:06 AM
Location: St Pete, FL
peace.gif
I added the Current Local Weather w/5 day forecast display to our Index page, which allows registered members to pick a city from within the profile and have the current and 5 day forecast displayed on our Index page. If no city is selected or an invalid code is entered, then no weather is displayed. Guests will see nothing...

We can all thank SwissCheese for pointing this MOD out for us to enjoy...

headbang


Last edited by Nightrider on 09/19/2005 4:55 AM; edited 1 time in total
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 09/15/2005 10:46 AM Reply with quote
Site Admin
rb2d2
Site Admin
Posts 48041
Word Cnt. 2,737,256
BDay Apr 22
Sign Taurus
Sex Sex:Female
Joined: Sep 25, 2004
Local time: 8:06 AM
Location: Texas
texasC.gif
Now this is NEAT!   Thank you SwissCheese for telling us about it and thank you Nightrider for installing it!


Back to Top
View all pictures posted by this userView user's profile Find all posts by rb2d2 Send private message   Visit poster's website Phoogle Map
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 09/15/2005 11:51 AM Reply with quote
Citation
bigR
Citation
Posts 3489
Word Cnt. 137,488
BDay Mar 5
Sign Pisces
Sex Sex:Female
Joined: Oct 14, 2004
Local time: 9:06 AM
Location: Texas
blank.gif
Thank you, Nightrider and SwissCheese! That's a handy MOD.
Applause
Back to Top
View user's profile Find all posts by bigR Send private message  
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 09/15/2005 2:26 PM Reply with quote
Swan
SwissCheese
Swan
Posts 147
Word Cnt. 13,187
BDay Mar 7
Sign Pisces
Sex Sex:Male
Joined: Jul 29, 2005
Local time: 4:06 PM
Location: Zürich, Switzerland
switzerC.gif
You are welcome Nightrider, rb2d2xp and bigR...

Nightrider I thought you might be interested in this Patch I wrote for the Weather MOD...

Code:
##############################################################
## MOD Title:           Patch for Weather MOD
## MOD Author:          SwissCheese < N/A > (Daniel Schaad) http://www.RafikiTalk.com
## MOD Description:     A: Only calls function when user is logged in.
##                      B: Prevents remote hotlinking.
##                      C: Fixes broken HTML on errors.
##                      D: Adds user friendly messages for these errors:
##                         1) no Weather City Code provided
##                         2) wrong Code provided or weather server unavailable
##
## MOD Version:         1.0.0
##
## Installation Level:  Easy
## Installation Time:   ~1 Minutes
##
## Files To Edit:       3
##                      index.php
##                      includes/weather.php
##                      language/lang_english/lang_main.php
##
## Included Files:      (n/a)
##
## License:             http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
##
## Author Notes:  the Weather MOD must be installed
##                before this patch can be applied!
##
##
##         DEMO:  http://www.RafikiTalk.com
##                (you'll need to register to see the patch in action)
##
##
##        bug A:  the original MOD queried the weather server regardless
##                of whether it was needed (user logged in) or not.
##        fix A:  MOD now checks if user is logged in before calling the
##                function
##
##
##        bug B:  the original MOD could be called remotely by hotlinking.
##        fix B:  added if(!defined('IN_PHPBB')){die("Hacking attempt");}
##
##
##        bug C:  the original MOD breaks the HTML of the index_body.tpl when
##                the City Code is not provided or the server is not available.
##        fix C:  instead of parsing the remainder of the $gotWeather variable,
##                (which eventually adds </td></tr></table> to its 'empty' self
##                causing the HTML to break) the function returns straight to
##                the calling point when an error occurs.
##
##
##        bug D:  the original MOD returns the same Error Message regardless
##                of whether the Weather City Code is missing or incorrect,
##                or whether the Weather Server is unavailable.
##        fix D:  this patch makes the MOD more user friendly by returning
##                the following error messages (which both also provide a
##                link to the users profile) for these two possible cases:
##
##       case 1:  logged in, no code provided
##       before:  No City Selected
##        after:  No City Selected: click here to enter a Weather City Code in your profile...
##
##       case 2:  logged in, wrong code provided or weather server unavailable
##       before:  No City Selected
##        after:  Unable To Retrieve Weather Data
##                Either the weather server is temporarily unavailable,
##                or the Weather City Code in your Profile is incorrect.
##
##
##############################################################
## MOD History:
##
##   2005-09-15 - Version 1.0.0
##      - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################  
#
#-----[ OPEN ]------------------------------------------------
#

index.php

#
#-----[ FIND ]------------------------------------------------
#

      'MY_WEATHER' => weather($zip_code),

#
#-----[ REPLACE WITH ]----------------------------------------
#

      'MY_WEATHER' => ($userdata['session_logged_in']) ? weather($zip_code) : '',

#
#-----[ OPEN ]------------------------------------------------
#

includes/weather.php

#
#-----[ FIND ]------------------------------------------------
#

function weather($weather_code)

#
#-----[ BEFORE, ADD ]-----------------------------------------
#

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
}

#
#-----[ FIND ]------------------------------------------------
#

global $lang;

#
#-----[ REPLACE WITH ]----------------------------------------
#

   global $lang, $phpEx;

#
#-----[ AFTER, ADD ]------------------------------------------
#
   if ( !$weather_code )
   {
      $noWeather = '<td wrap="nowrap"><br /><span class="gen">' . sprintf($lang['weather_no_city_selected'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">', '</a>') . '</span><br /><br /></td>';
      return $noWeather;
   }

#
#-----[ FIND ]------------------------------------------------
#
   if ($weatherData == "")
   {
   $gotWeather = $lang['no_city_selected'];
   }

#
#-----[ REPLACE WITH ]----------------------------------------
#
   if ( !$weatherData )
   {
      $noWeather = '<td align="center" wrap="nowrap"><br /><span class="gen">' . sprintf($lang['weather_not_retrieved'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">', '</a>') . '</span><br /><br /></td>';
      return $noWeather;
   }

#
#-----[ OPEN ]------------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------------
#

$lang['no_city_selected'] = 'No City Selected';

#
#-----[ REPLACE WITH ]----------------------------------------
#

$lang['weather_no_city_selected'] = 'No City Selected: click %s<u>here</u>%s to enter a Weather City Code in your profile...';

#
#-----[ AFTER, ADD ]------------------------------------------
#

$lang['weather_not_retrieved'] = 'Unable To Retrieve Weather Data<br /><br />Either the weather server is temporarily unavailable,<br />or the Weather City Code in %s<u>your Profile</u>%s is incorrect.';

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM



...it fixes several issues, like querying the Weather Server
when guests visit (which is totally unnecessary) and some
others... details are in the MOD...

~enjoy


PS:
you can see the different error
messages at www.RafikiTalk.com

Try a) deleting the city code
and b) provide a wrong code
Back to Top
View user's profile Find all posts by SwissCheese Send private message   Visit poster's website Yahoo Messenger
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 09/16/2005 1:10 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30756
Word Cnt. 2,628,677
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:06 AM
Location: St Pete, FL
peace.gif
Thanks SwissCheese.  I applied this patch and all seems to be well.  I haven't tested it yet.  But since it didn't crash the board and since the weather continues to function, I'm a happy camper...

Applause
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 10/25/2005 4:30 AM Reply with quote
Citation
Peggysue
Citation
Posts 428
Word Cnt. 24,335
BDay N/A
Sign N/A
Sex Sex:Female
Joined: Sep 20, 2005
Local time: 9:06 AM
blank.gif
nicely done n scared the crap outa me..lol i never noticed it b4... it jumped out at me


heheheheheh im impressed i like it:) Applause  Applause  Applause
Back to Top
View user's profile Find all posts by Peggysue Send private message   Phoogle Map
Added Current Local Weather w/5 day forecast...
PostPosted: 10/26/2005 11:08 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30756
Word Cnt. 2,628,677
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:06 AM
Location: St Pete, FL
peace.gif
I'm glad you like it Peggy.  While I was looking through the data, I noticed that you had assigned your City code incorrectly.  A lot of people have, so it's no big deal.  I need to make the message a bit clearer.  Also there needs to be some code to prevent people from making the same mistake.  I couldn't assign your town, but I got as close as I could...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 10/26/2005 11:11 AM Reply with quote
Swan
SwissCheese
Swan
Posts 147
Word Cnt. 13,187
BDay Mar 7
Sign Pisces
Sex Sex:Male
Joined: Jul 29, 2005
Local time: 4:06 PM
Location: Zürich, Switzerland
switzerC.gif
Nightrider wrote:
I noticed that you had assigned your City code incorrectly.  A lot of people have...


Like how? enter a real city name?

That is what my users do sometimes...
Back to Top
View user's profile Find all posts by SwissCheese Send private message   Visit poster's website Yahoo Messenger
Added Current Local Weather w/5 day forecast...
PostPosted: 10/26/2005 11:28 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30756
Word Cnt. 2,628,677
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:06 AM
Location: St Pete, FL
peace.gif
Yes, they either enter their City or Zip Code.  Neither will work though.  There has to be a better way to handle this than they have...

dontknow



Post generated using Mail2Forum (http://4fxearth.net/phpBB2)
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Added Current Local Weather w/5 day forecast...
PostPosted: 10/26/2005 8:27 PM Reply with quote
Citation
Peggysue
Citation
Posts 428
Word Cnt. 24,335
BDay N/A
Sign N/A
Sex Sex:Female
Joined: Sep 20, 2005
Local time: 9:06 AM
blank.gif
huh? what ? where? your lying? lol show me or tell me what your talkin bout hun? grommit  violent1  Twisted Evil  wave  blob8  pottytrain2  puke_l  Brick wall  Rolling Eyes  headbang  Embarassed  Embarassed  Embarassed
Back to Top
View user's profile Find all posts by Peggysue Send private message   Phoogle Map
 Post new topic  Reply to topic
Information
Welcome to RCF - New Forum Index -> Announcements

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group
  ImageShack  
  Putfile  
  TinyURL  
  CommonDreams  
  Log in  

Page generation time: 0.2148s (PHP: 76% - SQL: 24%) - SQL queries: 61 - GZIP enabled - Debug on