vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Yesterday/Today Datestamp Hack (https://vborg.vbsupport.ru/showthread.php?t=34527)

bigmattyh 08-27-2002 12:10 AM

This has officially gotten annoying. How motivated do you think I am going to be to help you if you won't even read the posts I write? Do you think I have hours and hours of free time for which I have no other use than to spend helping people who won't read?

*sigh*

Read the above post. Follow the actions in NUMBER TWO. Click on the link that says "do this." Is that spelled out easy enough for you?

I will not respond to any more of your requests unless you prove that you have investigated the matter further than asking "wut am i doing wrong? thx". YOU HAVE TO PUT FORTH EFFORT HERE, BUDDY. I AM NOT YOUR PERSONAL HELP DESK.

ExAvIoUr 08-27-2002 12:35 AM

i followed number 2. it failed. as i mentioned b4. then i went to the first post. i went to the link for the "extra feature". i don't have that code in my file. as i said b4. than boofo recommended what to do. i tried it and nothing happend.

so i have read the whole thing.

i have never demanded nething or asked u to help me. but u were kind enuff to do so, so i appreicate what u have done but nothing worked unless i have done something wrong.

DWZ 08-31-2002 12:52 PM

Hey,

I have this installed on my 2.2.5 board and it was working fine. Today I downloaded 2.2.7 and I have put all my hacks back into the code.

I uploaded the new files to my test server, but whenever I access any file I get:
Code:

Parse error: parse error, unexpected '}' in /home/dwz/public_html/vbtest/admin/functions.php on line 1763

Warning: Cannot add header information - headers already sent by (output started at /home/dwz/public_html/vbtest/admin/functions.php:1763) in /home/dwz/public_html/vbtest/admin/functions.php on line 1711

Fatal error: Call to undefined function: vbdate() in /home/dwz/public_html/vbtest/admin/sessions.php on line 399

When looking at functions.php around that area, I find it's talking about this hack. I have this in functions.php around that area:
PHP Code:

# Start replaced code for "Yesterday/Today Datestamp Hack" hack
/*REPLACED CODE:
function vbdate($format,$timestamp) {
*/
function vbdatenoty($format,$timestamp) {
# End replaced code for "Yesterday/Today Datestamp Hack" hack
  
global $bbuserinfo,$timeoffset;

  return 
date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);

}
# Start added code for "Yesterday/Today Datestamp Hack" hack
  
global $bbuserinfo,$timeoffset$dateformat$timeformat;

  if (
$dateformat==$format) {
    
$todaystamp=mktime();
    
$todaydate=date($format,$todaystamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
    
$yestdate=date($format,(($todaystamp-86400)+($bbuserinfo['timezoneoffset']-$timeoffset)*3600));
    
$date date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
    if (
$date==$todaydate) {
      
$date="Today";
    }
    if (
$date==$yestdate) {
      
$date="Yesterday";
    }
  } else {
    
$date date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
  }
  return 
$date;


That last line there is line number 1763, what I'm having problems with. Line 1711 is:
PHP Code:

setcookie($name$value$expire$cookiepath$cookiedomain$secure); 

When looking at sessions.php, I find that it's talking about this:
PHP Code:

// get formatted date/time
if ($bbuserinfo['lastvisit']) {
  
$bbuserinfo['lastvisitdate'] = vbdate($dateformat." ".$timeformat,$bbuserinfo['lastvisit']);
} else {
  
$bbuserinfo['lastvisitdate'] = "Never";


Line 399, what i'm having problems with is the
PHP Code:

  $bbuserinfo['lastvisitdate'] = vbdate($dateformat." ".$timeformat,$bbuserinfo['lastvisit']); 

part. I know your hack doesn't change sessions.php, but I havn't touched that file with adding in my new hacks.

Any idea?

Thanks :)

Alan

Rock 08-31-2002 01:33 PM

Thanks alot for this hack m8! :D

KarateKid 08-31-2002 02:31 PM

could someone fix the problem for 2.2.7 like DWZ showed it?

DWZ 09-02-2002 10:33 AM

hmmmmm.... I just added in the hack again for the hell of it, and it worked?

Same code and all, well, at least I think it was, and it's working?

oh well, we will see how we go :)

Erwin 09-02-2002 10:40 AM

I had the same problem when I upgraded - you need to remove the repeated vbdate function to avoid a repeat function error, and watch that each { is closed with a } to avoid the parse error.

:)

KarateKid 09-05-2002 03:04 PM

@bigmattyh:

Could you please fix the bug, cause I'm using 2.2.7 and need your hack! :)

Best regards

bigmattyh 09-05-2002 03:45 PM

I don't think there's a bug per se... It sounds like mistakes were made in copying the hack code to the newer files. (Leaving out the opening { bracket would do it.)

If you could post the specific error message PHP is giving you, I can help you out. :)

EDIT: Just to clarify things, all you're doing with this hack is replacing the standard vbdate() function with the new hacked version. And you're adding the vbdatenoty() function. The line numbers change with every version, but the process is essentially the same.

KarateKid 09-05-2002 08:14 PM

I get many errors:

Quote:

Parse error: parse error in /forum/admin/functions.php on line 2294

Warning: Cannot add header information - headers already sent by (output started at /forum/admin/functions.php:2294) in /forum/admin/functions.php on line 1591

Fatal error: Call to undefined function: get_bbarraycookie() in /forum/index.php on line 284

Illuvatar 09-06-2002 07:58 PM

Hey bigmattyh!!!

[high]* Illuvatar moves site to new server, installs 2.2.7, and reapplys this most excellent hack with NO PROBLEMS!!
[/high]

lol

And get this...

I even modified the code a little cause I liked the "Today, at" in the last visited piece, and I wanted it on my individual forum display as well!

All I did was this:
PHP Code:

    if ($date==$todaydate) {
      
$date="Today, at";
    }
    if (
$date==$yestdate) {
      
$date="Yesterday, at"

and worked like a champ!

Many thanks again!

Illu

Baptizer 09-06-2002 08:37 PM

Wonder why he didnt add the ", at" that way in the first place...seems easier. I dont know much about code, but is there a reason why he chose to add it the other way? loads faster? god i stupid!

Greystang302 09-08-2002 08:35 AM

Hi, I am running vB 2.2.7 and I just installed this hack tonight. Everything seems to be working as advertised except for the display in Trilobyte's Welcome Panel hack. I have attached an image to show what the problem looks like.

I followed your instructions in this post and it made no difference irregardless of which line I posted it above ($getnewthread or $getnewpost). Any ideas about what could have gone wrong? I followed the instructions to the letter...

bigmattyh 09-09-2002 11:04 AM

Quote:

Originally posted by KarateKid
I get many errors...
Open up your functions.php file and post the offending section of it here -- from about line 2292 to 2296. That way I can see what's up.

Quote:

Wonder why he didnt add the ", at" that way in the first place
I seem to remember that there are some problems with doing it this way. Like on your memberlist page, you might get "Today, at" ... and no time. It's been a while, so I could be wrong.

Greystang302:
I don't have the welcome panel installed on my forums, so I can't troubleshoot this one. It looks like the value for $bbuserinfo[lastvisit] is being replaced elsewhere in the welcome panel code... Can you find a line in that hack that assigns a value to $bbuserinfo[lastvisit]? If so, comment it out (by typing // before any text on that line.

Greystang302 09-09-2002 12:57 PM

I will check on that after work tonight Matty, I was also looking at the code while eating breakfast this morning and it looks like for some reason some of the edits that I made to the file didn't get uploaded? Not sure what could have happened though...

I will verify this tonight and post the findings. :) Thanks for the help!

Greystang302 09-10-2002 02:39 AM

Well, I got the hack working again except for the Welcome Panel. I got home from work late so I didn't have time to do anything else otherwise. There is a code difference in the 2.2.7 release, but it's not major. I will post all of this tomorrow, I am beat! Gotta get to sleep for now...

ExAvIoUr 09-11-2002 06:01 AM

Very nice hack indeed ... simple and works. :)

Wanted to do as many others mentioned and have it display up top also like You last visited: 09-11-2002 01:58 AM

... but I don't have any code matching what you specified in an earlier post in my index.php:

Code:

if (isset($bbforumview[$forum['forumid']]) and $bbforumview[$forum['forumid']]>$bbuserinfo['lastvisit']) {
    $userlastvisit=$bbforumview[$forum['forumid']];
} else {
    $userlastvisit=$bbuserinfo['lastvisit'];
}

or anything close to it .... I have instead:

Code:

if (($fview = get_bbarraycookie('forumview', $forum['forumid'])) > $bbuserinfo['lastvisit']) {
                                                $userlastvisit=$fview;
                                        } else {
                                                $userlastvisit=$bbuserinfo['lastvisit'];

thanx for any assistance anyone can offer. :)

Greystang302 09-11-2002 08:49 PM

That code was one of the differences with 2.2.7 that I mentioned before... it was part of a change to the original code to fix an AOL cookie-dumping problem. I just haven't had a chance to post about it yet. :)

bigmattyh 09-12-2002 06:01 PM

Okay... I haven't upgraded to 2.2.7 (and I'm not planning to yet!), so I can't say for sure if this will work, but give it a try:

Replace this:
Code:

if (($fview = get_bbarraycookie('forumview', $forum['forumid'])) > $bbuserinfo['lastvisit']) {
                                                $userlastvisit=$fview;
                                        } else {
                                                $userlastvisit=$bbuserinfo['lastvisit'];

With this:
Code:

if (($fview = get_bbarraycookie('forumview', $forum['forumid'])) > $bbuserinfo['lastvisit']) {
                                                $userlastvisit=$fview;
                                        } else {
                                                $userlastvisit=vbdate($bbuserinfo['lastvisit']);

And then insert $userlastvisit into your template where you want the date to appear.

ExAvIoUr 09-13-2002 12:24 AM

you ^#^&@^&! you fecked my board!

hehe just kidding m8, thanx for the suggestion. tried it out and got:

Code:

Warning: Missing argument 2 for vbdate() in /home/choicein/public_html/forums/admin/functions.php3 on line 1609
sounds simple enugh to do, but beyond me at this point. hehe

bigmattyh 09-13-2002 08:15 PM

Right... Sorry 'bout that.

Try replacing the 4th line (from my suggestion above) with:
Code:

$userlastvisit=(vbdate($dateformat,$bbuserinfo['lastvisit']).", at ".vbdate($timeformat,$bbuserinfo['lastvisit']));

julius 09-15-2002 08:30 AM

Great Hack!
Thanks.

Areku 09-26-2002 10:34 AM

/me installed it onto v2.2.0!

AyaRose 09-29-2002 07:09 PM

It looks like a cool hack , I hope we get this when vb3 comes out

Paul 09-30-2002 06:48 AM

The "at" addition instructions do not make any sense whatsoever in the context of 2.2.8. What file does this change need to be made? I've searched high and low for that eval statement and I don't see it anywhere.

In index.php, I made the following change:

Find:
PHP Code:

$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']); 

And REPLACE with:
PHP Code:


          
// Hack: Today/Yesterday
          /*
          $forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
          */
          
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']) . ", at ";
          
// End hack: Today/Yesterday hack 


bigmattyh 10-02-2002 07:16 AM

Quote:

Originally posted by LoveShack
The "at" addition instructions do not make any sense whatsoever in the context of 2.2.8.
Yeah, so I've heard.

I won't be much help on this particular issue. Evidently, 2.2.8 changed some things that directly affect the ", at" functioning of this hack, and unfortunately, I don't have the time to investigate.

Talisman 10-14-2002 01:00 AM

Nice hack, thanks. You made it simple for us to install by being thorough with those updates.

Well done.

bigmattyh 10-14-2002 11:54 PM

Quote:

Originally posted by Talisman
Nice hack, thanks. You made it simple for us to install by being thorough with those updates.

Well done.

Thanks -- I appreciate that. :)

bigmattyh 11-27-2002 06:07 PM

I don't like to bump. But it's been over 5 weeks since anyone's posted to this thread.

One last spin around the vB-verse before vB3 makes it obsolete. Huzzah!

N9ne 11-27-2002 06:41 PM

Question: will this hack work properly under 2.2.8...ie. no innaccuracies in the text, such as some areas not making sense?

Dean C 11-28-2002 06:47 AM

Yes it works for me on vb 2.2.8 :)

- miSt

Paul 12-02-2002 05:22 AM

Hi,

When sending a reply to a private message (which automatically quotes the private message), I get the following:

Quote:

User wrote on Today 1:27 AM:
Hi there. This is a test message.
Before I go opening up the code at 2:30 in the morning, is anyone else experiencing this? :)

Thanks,
Paul

Smoothie 12-02-2002 05:44 AM

Get the same ;)

KarateKid 12-02-2002 06:59 AM

Info: it also works with 2.2.9 :)

Xer 12-03-2002 07:33 AM

o...working on my 2.2.9 vbb
thx hack~

Paul 12-03-2002 11:06 AM

Quote:

Originally posted by LoveShack
Hi,

When sending a reply to a private message (which automatically quotes the private message), I get the following:



Before I go opening up the code at 2:30 in the morning, is anyone else experiencing this? :)

Thanks,
Paul

By the way, I did verify that this was in fact a problem with my particular installation. I modified this hack when I installed it so that if vbdate() was passed a third argument, it would behave as it did before the yesterday/today hack was installed.

The argument, in this case doesn't matter--it simply counts--if it's more than 2, the yesterday/today replacement isn't made.

I won't provide the fix here since it doesn't apply to the same code. If you're getting it though, you'll need to make provisions to do the same.

Best wishes,
Paul

*UFA*3M 12-13-2002 01:46 AM

Installed on 2.2.9 works thanks!!

Trabia 12-21-2002 05:09 AM

I am a complete newbie to vB hacking and this was the first one I tried, worked a treat on 2.2.9!

Nice clear instructions and does what it says on the tin, thanks for helping a complete lameass gain some confidence (y)

agfisdn 12-28-2002 05:55 PM

Installed on 2.2.9 in a few secs !

Thanx bigmattyh !

5/5

glas 12-29-2002 05:50 PM

I'm using 2.2.9...tried installing it but doesn't work...now there's problems.

http://www.charming-holly.com/hhg


All times are GMT. The time now is 07:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01650 seconds
  • Memory Usage 1,861KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (7)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete