Seite 1 von 3

Problem mit Today At/Yesterday At-Mod

Verfasst: 12.09.2002 09:19
von Thies
Ich habe den Today At/Yesterday At-Mod 1.2.1. eingebaut, der die Datumsanzeige ersetzt, sofern ein Post HEUTE oder GESTERN erfolgte.

Den Fix zum Sommerzeit habe ich eingebaut und als Datumsformat d.m.Y - G:i, Zeiteinstellung ist GMT + 1 Stunde.

Nun passiert aber folgendes:

Wenn zwischen 0:00 Uhr und 1:00 Uhr nachts jemand postet, erscheint nicht HEUTE um ... sondern GESTERN um ...

Ich habe per Suche hier leider nichts gefunden, kann mir jemand helfen, was da falsch laufen könnte ?

Danke

Frank-Andre

Verfasst: 13.09.2002 17:44
von saerdnaer
das problem ist bekannt... zeig mal den code das today/yesterday mods...

ah

Verfasst: 14.09.2002 12:21
von Thies
Hier ist der Mod, Danke für Deine Hilfe:

Code: Alles auswählen

################################################################# 
## Mod Title:    Today At/Yesterday At
## Mod Version:  1.2.1
## Author:       blulegend 
## Description:  Will show Today At if the post was posted today 
##               Will show Yesterday At if the post was posted yesterday
##
##               Modifies in index, viewforum, viewtopic, and search!
##
##               Includes code compatible with Daylight Savings Time Mod
## 
## Installation Level:  Easier than easy! 
## Installation Time:   10-15 Minutes 
## Files To Edit:       6 
## Included Files:      None 
################################################################# 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites 
################################################################# 
## 
## Author Note: 
## Enjoy! 
## 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
#
#-----[ OPEN ]------------------------------
# 

/includes/pageheader.php 

#
#-----[ FIND around line 70 ]-----------------------------------
# 

//
// Parse and show the overall header.
//

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

//
// PARSE DATEFORMAT TO GET TIME FORMAT // TODAY AT MOD
//
$time_reg = '([gh][[:punct:][:space:]]{1,2}[i][[:punct:][:space:]]{0,2}[a]?[[:punct:][:space:]]{0,2}[S]?)';
eregi($time_reg, $board_config['default_dateformat'], $regs);
$board_config['default_timeformat'] = $regs[1];
unset($time_reg);
unset($regs);

//
// GET THE TIME TODAY AND YESTERDAY
//
$today_ary = explode('|', create_date('m|d|Y', time(),$board_config['board_timezone']));
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]);
$board_config['time_yesterday'] = $board_config['time_today'] - 86400;
unset($today_ary);

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

/index.php 

#
#-----[ FIND around line 380 ]-----------------------------------
# 

								$last_post = $last_post_time . '<br />';

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

								// OLD
								// $last_post = $last_post_time . '<br />';
								//
								// TODAY AT MOD
								//
								if ( $board_config['time_today'] < $forum_data[$j]['post_time'])
								{ 
									$last_post = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
								}
								else if ( $board_config['time_yesterday'] < $forum_data[$j]['post_time'])
								{ 
									$last_post = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $forum_data[$j]['post_time'], $board_config['board_timezone'])) . '<br />'; 
								}
								else
								{ 
									$last_post = $last_post_time . '<br />'; 
								} 
								// END MOD

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

/search.php

#
#-----[ FIND around line 745 ]-----------------------------------
# 

			$post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']);

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

			//
			// TODAY AT MOD
			//
			if ( $board_config['time_today'] < $searchset[$i]['post_time'])
			{ 
				$post_date = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
			}
			else if ( $board_config['time_yesterday'] < $searchset[$i]['post_time'])
			{ 
				$post_date = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
			}
			// END MOD

#
#-----[ FIND around line 1120 ]-----------------------------------
# 

				$last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']);

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

				//
				// TODAY AT MOD
				//
				if ( $board_config['time_today'] < $searchset[$i]['post_time'])
				{ 
					$last_post_time = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
				}
				else if ( $board_config['time_yesterday'] < $searchset[$i]['post_time'])
				{ 
					$last_post_time = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $searchset[$i]['post_time'], $board_config['board_timezone'])); 
				}
				// END MOD

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

/viewforum.php 

#
#-----[ FIND around line 630 ]-----------------------------------
# 

		$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

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

		//
		// TODAY AT MOD
		//
		if ( $board_config['time_today'] < $topic_rowset[$i]['post_time'])
		{ 
			$last_post_time = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone'])); 
		}
		else if ( $board_config['time_yesterday'] < $topic_rowset[$i]['post_time'])
		{ 
			$last_post_time = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone'])); 
		}
		// END MOD

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

/viewtopic.php 

#
#-----[ FIND around line 806 ]-----------------------------------
# 

	$post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']);

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

	//
	// TODAY AT MOD
	//
	if ( $board_config['time_today'] < $postrow[$i]['post_time'])
	{ 
		$post_date = sprintf($lang['Today_at'], create_date($board_config['default_timeformat'], $postrow[$i]['post_time'], $board_config['board_timezone'])); 
	}
	else if ( $board_config['time_yesterday'] < $postrow[$i]['post_time'])
	{ 
		$post_date = sprintf($lang['Yesterday_at'], create_date($board_config['default_timeformat'], $postrow[$i]['post_time'], $board_config['board_timezone'])); 
	}
	// END MOD

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

/language/lang_xxx/lang_main.php 

#
#-----[ FIND at end of file ]-----------------------------------
# 

//
// That's all Folks!
// -------------------------------------------------

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

// TODAY AT MOD
$lang['Today_at'] = "Today at %s"; // %s is the time
$lang['Yesterday_at'] = "Yesterday at %s"; // %s is the time
//

# 
#-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
# EoM
Ich bin ja mal gespannt, woran es liegen könnte :)

CU

Frank-Andre

Verfasst: 23.09.2002 10:40
von Gast
Gibt es zu diesem Problem eine Lösung? Würde den Mod auch gerne einbauen, aber nur wenn es auch einwandfrei funktioniert!

Verfasst: 23.09.2002 13:58
von saerdnaer
in der page header

Code: Alles auswählen

$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]); 
durch folgendes ersetzen:

Code: Alles auswählen

$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'] - date('I'),0,0,$today_ary[0],$today_ary[1],$today_ary[2]); 

Verfasst: 23.09.2002 20:29
von Cauri_Gast
Danke dir!

Verfasst: 26.09.2002 09:54
von Gast
Hi,

so hab noch mal drüber geschaut. Kann es sein das du da was verwechselt hast???

Originaltext von Thies:
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]);
Dein Vorschlag:
Code:
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'] - date('I'),0,0,$today_ary[0],$today_ary[1],$today_ary[2]);

durch folgendes ersetzen:

Code:
$board_config['time_today'] = gmmktime(0 - $board_config['board_timezone'] - $board_config['dstime'],0,0,$today_ary[0],$today_ary[1],$today_ary[2]);
Kann es sein das du es vertauscht hast? Denn im Originaltext steht ja schon $board_config['dstime'],0,0,$today_ary[0]....

Also ich hab den Mod so eingebaut ($board_config['dstime'],0,0,$today_ary[0]) und hab dann das gleiche Problem wie Thies.

Gruss Cauri

Verfasst: 26.09.2002 17:09
von saerdnaer
stimmt hatte ich ausversehen vertauscht...

ah

Verfasst: 08.10.2002 13:17
von Thies
Alles was ich bisher probiert habe, ging schief. Entweder werden Postst zwischen 23.00 und 23:59 Uhr als HEUTE gekennzeichnet oder Posts zwischen 00:00 und 0:59 Uhr mit GESTERN.

Hat vielleicht noch jemand einen Tipp, was man machen muss, damit das richtig funktioniert?

Danke

Frank-Andre

Verfasst: 08.10.2002 17:06
von saerdnaer
wie jetzt? könntest du das etwas genauer erklären?

ah