Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Fix vbShout Timezone problem Details »»
Fix vbShout Timezone problem
Version: 1.00, by newhere newhere is offline
Developer Last Online: Dec 2009 Show Printable Version Email this Page

Category: Chat Modifications - Version: 3.6.5 Rating:
Released: 04-09-2007 Last Update: Never Installs: 13
 
No support by the author.

This vbShout plugin: http://www.vbhackers.com/f76/ajax-fl...ut-2-1-a-4536/

Has a serious bug with Time Zone changing to that of the last person to post in the shout box.

Here is a fix so that each user will see the time in their local timezone correctly.

1. Open template forumhome_vbshout_shout
Find this (should be at the very beginning):
Code:
<tr>
After it add:
Code:
                                <td nowrap align="left" valign="top">
                                <font size="1">
                                    <date>{$Shout['time']}</date>
                                    
                                </font>
                                </td>
Make sure that the "date" and "/date" tags are on the same line, and with no spaces between them and the $Shout variable, just as above. These are not valid html tags, and we are going to write code to replace them ourselves.



2. Open template forumhome_vbshout
Find:
Code:
Shouts.innerHTML = '<table cellpadding="1" cellspacing="3" border="0" width="95%" align="left">' + ShoutRequest.handler.responseText + '</table>'
Replace it with:
Code:
                        var formatMe = ShoutRequest.handler.responseText
			formatMe = replaceDates(formatMe);
                        Shouts.innerHTML = '<table cellpadding="1" cellspacing="0" border="0" width="100%" align="left">' + formatMe + '</table>'
In the same template
Find this:
Code:
function sb_CollectHV(sbForm)
Before it add:
Code:
// replaces <date> tags
function replaceDates(s) {
            var ret = "";
            var matches = s.match(/<date>\d+<\/date>/g);
            for(var i = 0; matches != null && i < matches.length; i++) {
                var utc = matches[i].match(/\d+/);
                var date = new Date(utc * 1000);
                ret = ret + s.substr(0, s.indexOf(matches[i]));
                ret = ret + (date.getMonth()+1) + "/" +
                            date.getDate() + "/" +
                            date.getFullYear() + " " +
                            date.getHours() + ":" +
                            ((date.getMinutes() < 10) ? "0" : "") +
                            date.getMinutes() + ":" +
                            ((date.getSeconds() < 10) ? "0" : "") +
                            date.getSeconds() + " ";


                s = s.substr(s.indexOf(matches[i]) + matches[i].length);
            }
            ret = ret + s;
            return ret;
}



3. Open file vbshout.php
FInd this (There are similar code blocks, this should be in the function rewrite_shoutbox_flatfile() around line 226):
Code:
        $Shout['time']     = buildTime($Shout['s_time']);
        $Shout['s_shout']  = bbcodeparser($Shout['s_shout']);
        $Shout['style']    = '';
        $Shout['data']     = unserialize($Shout['s_data']);
        $Shout['username'] = fetch_musername($Shout, 'usergroupid');

        if (preg_match("#(\#)?0099FF#i", $Shout['data']['color']) && $Shout['s_by'] != 1)
        {
            $Shout['data']['color'] = '';
        }
Replace it with:
Code:
        // $Shout['time']     = buildTime($Shout['s_time']);
        $Shout['time']     = $Shout['s_time'];
        $Shout['s_shout']  = bbcodeparser($Shout['s_shout']);
        $Shout['style']    = '';
        $Shout['data']     = unserialize($Shout['s_data']);
        $Shout['username'] = fetch_musername($Shout, 'usergroupid');
        
        if (preg_match("#(\#)?0099FF#i", $Shout['data']['color']) && $Shout['s_by'] != 1)
        {
            $Shout['data']['color'] = '';
        }

This should now pass the date as UTC and JavaScript will convert it on the client side to the appropriate date.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 04-10-2007, 09:38 PM
Tulsa Tulsa is offline
 
Join Date: Jul 2005
Location: Broken Arrow, Oklahoma
Posts: 475
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now this one had me totally baffled...

I have just a few users who are using eastern time zone, both that I know about have DST set in their profile. They are both showing an hour behind. It's not on their end as I have logged in as them and it's shows incorrectly to me as well. However I have other users with EST and they are fine. All the settings are the same.

I have people from Britan, Greece, France, Japan and of course all over the states and only these couple that I know about so far are an issue...
Reply With Quote
  #43  
Old 04-11-2007, 05:40 AM
rjmjr69's Avatar
rjmjr69 rjmjr69 is offline
 
Join Date: Jan 2007
Location: Southie
Posts: 876
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tulsa View Post
Now this one had me totally baffled...

I have just a few users who are using eastern time zone, both that I know about have DST set in their profile. They are both showing an hour behind. It's not on their end as I have logged in as them and it's shows incorrectly to me as well. However I have other users with EST and they are fine. All the settings are the same.

I have people from Britan, Greece, France, Japan and of course all over the states and only these couple that I know about so far are an issue...
Had this same problem when the DST came up. What I had to do to fix it for some members was ask them to select in the user cp/Edit Options/Date + TimeZone

Select: DST CORRECTION ALWAYS ON.
Reply With Quote
  #44  
Old 04-11-2007, 08:11 PM
newhere newhere is offline
 
Join Date: Mar 2007
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rjmjr69 View Post
Had this same problem when the DST came up. What I had to do to fix it for some members was ask them to select in the user cp/Edit Options/Date + TimeZone

Select: DST CORRECTION ALWAYS ON.
Cool. Thanks rj! I have not seen any of these problems. As I say, the conversion all happens with javascript, (everyone gets the same UTC value sent to their client) so I would guess any problems with conversion are somehow related to the users own local timezone settings or their javascript settings. I don't know how vBulletin's user cp/Edit Options/Date effects the client. Is there a cookie being set or something? That might explain things??
Reply With Quote
  #45  
Old 04-11-2007, 08:17 PM
rjmjr69's Avatar
rjmjr69 rjmjr69 is offline
 
Join Date: Jan 2007
Location: Southie
Posts: 876
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by newhere View Post
Cool. Thanks rj! I have not seen any of these problems. As I say, the conversion all happens with javascript, (everyone gets the same UTC value sent to their client) so I would guess any problems with conversion are somehow related to the users own local timezone settings or their javascript settings. I don't know how vBulletin's user cp/Edit Options/Date effects the client. Is there a cookie being set or something? That might explain things??

This problem drove me insane for three days. I contacted everyone Jelsoft my host reinstalled VB to no avail. Just messing around with some users accounts I set the DST to always and BOOM everything worked. So I have no idea to be honest. One answer I got from Jelsoft was that maybe the server was not reporting the right time.
But whatever may cause it My trick worked to fix it I would like to know the cause tho Seeing how not everyone is affected by it. One other thing I will mention is if People have not updated their windows with ms updates for the DST then they also have this issue.
Reply With Quote
  #46  
Old 04-11-2007, 09:41 PM
Tulsa Tulsa is offline
 
Join Date: Jul 2005
Location: Broken Arrow, Oklahoma
Posts: 475
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use a MAC and Firefox so I missed seeing this till someone took a pic for me. For users of IE7 there is now a scroll bar at the bottom, just above the input line that is not showing in Firefox either PC or MAC.

Anyone else seeing this?
Reply With Quote
  #47  
Old 04-11-2007, 11:02 PM
newhere newhere is offline
 
Join Date: Mar 2007
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tulsa View Post
I use a MAC and Firefox so I missed seeing this till someone took a pic for me. For users of IE7 there is now a scroll bar at the bottom, just above the input line that is not showing in Firefox either PC or MAC.

Anyone else seeing this?
This might be due to the additional td tags.

You could try removing the td tags from the first step in the mod and instead place the
Code:
<date>...</date>
tags just before the username.
Reply With Quote
  #48  
Old 04-12-2007, 07:06 PM
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Posts: 877
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe the issue is with this code

PHP Code:
                        var formatMe ShoutRequest.handler.responseText
            formatMe 
replaceDates(formatMe);
                        
Shouts.innerHTML '<table cellpadding="1" cellspacing="0" border="0" width="100%" align="left">' formatMe '</table>' 
It should be

PHP Code:
                        var formatMe ShoutRequest.handler.responseText
            formatMe 
replaceDates(formatMe);
                        
Shouts.innerHTML '<table cellpadding="1" cellspacing="0" border="0" width="95%" align="left">' formatMe '</table>' 
Might want to make this change to the actuall mod itself, this causes a hscroll bar and its quite annoying.
Reply With Quote
  #49  
Old 04-12-2007, 08:25 PM
newhere newhere is offline
 
Join Date: Mar 2007
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ssslippy View Post
I believe the issue is with this code

PHP Code:
                        var formatMe ShoutRequest.handler.responseText
            formatMe 
replaceDates(formatMe);
                        
Shouts.innerHTML '<table cellpadding="1" cellspacing="0" border="0" width="100%" align="left">' formatMe '</table>' 
It should be

PHP Code:
                        var formatMe ShoutRequest.handler.responseText
            formatMe 
replaceDates(formatMe);
                        
Shouts.innerHTML '<table cellpadding="1" cellspacing="0" border="0" width="95%" align="left">' formatMe '</table>' 
Might want to make this change to the actuall mod itself, this causes a hscroll bar and its quite annoying.
Either way (with your code or with mine), I get a horizontal scroll bar when someone posts a shout which is too long.
Reply With Quote
  #50  
Old 04-28-2007, 07:59 PM
Terminatoronly's Avatar
Terminatoronly Terminatoronly is offline
 
Join Date: Mar 2006
Posts: 313
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when i installed it i didnt get any time with the shout how can i add the time ???
Reply With Quote
  #51  
Old 05-02-2007, 03:29 PM
parabat parabat is offline
 
Join Date: Apr 2006
Location: South Africa
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great hack, so thanx. works a treat :up:

-PB
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05406 seconds
  • Memory Usage 2,333KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_code
  • (4)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete