Gestern - Heute - Mod

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Jürgen H.
Mitglied
Beiträge: 192
Registriert: 01.06.2003 23:13

Beitrag von Jürgen H. »

Hallo,
PS: jetzt mal zu meinem Problem mit dem Hack
wenn ich den Installiert hab funktioniet der
Geburtstags Mod nimmer
Das Problem hatte ich auch.

Abhilfe gibts hier

Code: Alles auswählen

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
function create_date($format, $gmepoch, $tz) 

# 
#-----[ IN-LINE FIND ]----------------------------------- 
# 
$tz 

# 
#-----[ IN-LINE AFTER, ADD  ]----------------------------------- 
# 
, $friendly = 0 

# 
#-----[ FIND ]------------------------------------------ 
#  
return(!empty($translate)) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
   if($friendly == 1) 
   { 
      $thetime = (!empty($translate)) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); 
    
      $L_Today = 'Today'; 
      $L_Yesterday = 'Yesterday'; 
      $time_format = " - h:i a";// - hour:minute am/pm 
    
      $date = getdate(); 
      $today = $date['mday']; 
      $month = $date['mon']; 
      $year = $date['year']; 

      $forum_date_today = @gmdate ("d", $gmepoch + (3600 * $tz)); 
      $forum_date_month = @gmdate ("m", $gmepoch + (3600 * $tz)); 
      $forum_date_year = @gmdate ("Y", $gmepoch + (3600 * $tz)); 
    
      if($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year) 
      { 
         //today 
         $thetime = $L_Today . @gmdate ($time_format, $gmepoch + (3600 * $tz)); 
      } 
    
      else 
      { 
         if($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year) 
         { 
            //yesterday 
            $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (3600 * $tz)); 
         } 
       
         else 
         { 
            //if today is 1 and the month is not 1, then we have to check how many days in the 
            // previews month and then set $yesterday to the last day in the previews month 
            if($today == 1 && $month != 1) 
            { 
               //returns how many days in the previews month 
               $yesterday = date ("t", gmmktime(0,0,0,($month-1),1,$year) + (3600 * $tz)); 

               if($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year) 
               { 
                  //yesterday 
                  $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (3600 * $tz)); 
               } 
            } 

            else 
            { 
               //if we are in the first day in the year 
               if($today == 1 && $month == 1) 
               { 
                  $yesterday = date("t", gmmktime(0,0,0,12,1,($year -1)) + (3600 * $tz)); 

                  if($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1)) 
                  { 
                     //yesterday 
                     $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (3600 * $tz)); 
                  } 
               } 
            } 
         } 
      } 

      return($thetime); 
   } 

   else 
   { 

# 
#-----[ FIND ]------------------------------------------ 
# 
return(!empty($translate)) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); 

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

# 
#-----[ OPEN ]------------------------------------------ 
# 
index.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
   $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']); 

# 
#-----[ IN-LINE FIND ]----------------------------------- 
# 
); 

# 
#-----[ IN-LINE BEFORE, ADD  ]----------------------------------- 
# 
, $friendly = 1 

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewforum.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
      $first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']); 

# 
#-----[ IN-LINE FIND ]----------------------------------- 
# 
); 

# 
#-----[ IN-LINE BEFORE, ADD  ]----------------------------------- 
# 
, $friendly = 1 

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

# 
#-----[ IN-LINE FIND ]----------------------------------- 
# 
); 

# 
#-----[ IN-LINE BEFORE, ADD  ]----------------------------------- 
# 
, $friendly = 1 

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

# 
#-----[ IN-LINE FIND ]----------------------------------- 
# 
); 

# 
#-----[ IN-LINE BEFORE, ADD  ]----------------------------------- 
# 
, $friendly = 1 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Funktioniert bis jetzt einwandfrei in meinen Foren.

Lg
Jürgen
Benutzeravatar
pmm
Mitglied
Beiträge: 126
Registriert: 03.03.2004 22:22
Wohnort: Bergisch Gladbach
Kontaktdaten:

Beitrag von pmm »

hackepeter13 hat geschrieben:Hallo,

habe mir den Mod http://www.phpbbhacks.com/viewhack.php?id=1936 runter geladen und installiert.

Mein Problem ist, dass die Zeit 2 Stunden zurück liegt und immer am oder pm da steht.

so siets aus, wenn "Heute um 13:11 Uhr" was gepostet wurde:

Heute - 11:11 am

ich will aber, das da steht:

Heute um 13:11


Kann mir einer bitte helfen!
@hackepeter13

Ich habe das so gelöst:

Code: Alles auswählen

// friendly date mod\\*******************

	$thetime = ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * ($tz+date("I")))), $translate) : @gmdate($format, $gmepoch + (3600 * ($tz+date("I"))));

	$L_Today = '<b>Heute</b>';
	$L_Yesterday = '<b>Gestern</b>';
	$time_format = " - H:i";

	$date = getdate();
	$today = $date['mday'];
	$month = $date['mon'];
	$year = $date['year'];

	$forum_date_today = @gmdate ("d", $gmepoch);
	$forum_date_month = @gmdate ("m", $gmepoch);
	$forum_date_year = @gmdate ("Y", $gmepoch);

	if ($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year)
		$thetime = $L_Today . @gmdate ($time_format, $gmepoch);//today

	else
	if ($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year)
		$thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday

	else
	//if today is 1 and the month is not 1, then we have to check how many days in the previews month
	//and then set $yesterday to the last day in the previews month
	if ($today == 1 && $month != 1)
	{
	$yesterday = date ("t", mktime(0,0,0,($month-1),1,$year));//returns how many days in the previews month
	if ($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year)
		$thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
	}
	else
	//if we are in the first day in the year
	if ($today == 1 && $month == 1)
	{
	$yesterday = date ("t", mktime(0,0,0,12,1,($year -1)));
	if ($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1))
		$thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
	}

   	return ($thetime);
}
//end friendly date \\*******************************
Gruß Peter
kaum macht man´s richtig, schon funktioniert´s
hackepeter13
Valued Contributor
Beiträge: 3557
Registriert: 21.04.2004 12:22
Wohnort: Berlin
Kontaktdaten:

Beitrag von hackepeter13 »

@pmm

Danke werde es jetzt gleich mal ausprobieren! :grin:

%EDIT:

Hat schon mal geklappt, aber es ist immernoch 2 Stunden interher !?!?!?

Was nun ???
vb-biker hat geschrieben: Höh, isser nun installiert oder nicht?
Ne es ist noch nicht installiert - ich meinte nur wenn/falls er installiert sein sollte.
vb-biker hat geschrieben: Welches Datumsformat hast Du in der Konfig des ACP und in Deinem Profil definiert? Versuch's mal damit: d.m.y, H:i
Ja das ist schon so eingestellt - und auch GMT +1 Stunde !
Benutzeravatar
pmm
Mitglied
Beiträge: 126
Registriert: 03.03.2004 22:22
Wohnort: Bergisch Gladbach
Kontaktdaten:

Beitrag von pmm »

Das mit den 2 Stunden hinterherhängend habe ich jetzt leider auch.

Das muss an dem Mod liegen, man kann im Profile auch einstellen, was
man will also GMT +1 oder GMT +6.... die falsche Uhrzeit bleibt.

Was nun ????


Peter

EDIT:

ich habe den MOD gerade wieder deaktiviert und dabei festgestellt,
das in die Tabellen die richtige Zeit geschrieben wurde, weil bei den
Beiträgen, bei denen eben noch 21:37 Uhr stand jetzt wieder 23:27 Uhr
steht.

Vielleicht hilft das ja bei der Fehlersuche weiter ???
kaum macht man´s richtig, schon funktioniert´s
Jürgen H.
Mitglied
Beiträge: 192
Registriert: 01.06.2003 23:13

Beitrag von Jürgen H. »

@pmm & hackepeter:
I did a modification to fix the problem with time zones being ignored in this hack. Basically, I added a new variable, $gmepoch_tz, that does the calculation for the time zone, and then replaced all following instances of $gmepoch with the new variable:
http://www.phpbbhacks.com/forums/viewto ... +yesterday
Benutzeravatar
pmm
Mitglied
Beiträge: 126
Registriert: 03.03.2004 22:22
Wohnort: Bergisch Gladbach
Kontaktdaten:

Beitrag von pmm »

kuco hat geschrieben:@pmm & hackepeter:
I did a modification to fix the problem with time zones being ignored in this hack. Basically, I added a new variable, $gmepoch_tz, that does the calculation for the time zone, and then replaced all following instances of $gmepoch with the new variable:
http://www.phpbbhacks.com/forums/viewto ... +yesterday
Hi kuco,

danke für den Link... das läuft.

leider wird dir automatsche Umstellung der Sommerzeit nicht mehr
unterstützt, so das ich im Profile die GMT +2 einstellen musste.

Gruß Peter
kaum macht man´s richtig, schon funktioniert´s
Jürgen H.
Mitglied
Beiträge: 192
Registriert: 01.06.2003 23:13

Today - Yesterday Mod

Beitrag von Jürgen H. »

Hallo,
leider wird dir automatsche Umstellung der Sommerzeit nicht mehr
unterstützt, so das ich im Profile die GMT +2 einstellen musste.
Auch das verändert die Zeit nicht um + 1 Stunde in der Anzeige Gestern - Heute.

Ich hab mal testweise im Zierfischforum das ausprobiert: den Wert 3600 (= 1 Stunde) gegen den Wert 7200 ersetzt (= 2 Stunden). So wird das Datum des Postings richtig ausgegeben. Bitte nur im zitierten Code-Snippet des Mods (functions.php) austauschen! Nach dem Ende der Sommerzeit müssen dann die Werte wieder auf 3600 zurückgesetzt werden.

Code: Alles auswählen

//
// Create date/time from format and timezone
//
function create_date($format, $gmepoch, $tz, $friendly = 0)
{
	global $board_config, $lang;
	static $translate;

	if ( empty($translate) && $board_config['default_lang'] != 'english' )
	{
		@reset($lang['datetime']);
		while ( list($match, $replace) = @each($lang['datetime']) )
		{
			$translate[$match] = $replace;
		}
	}
   if($friendly == 1) 
   { 
      $thetime = (!empty($translate)) ? strtr(@gmdate($format, $gmepoch + (7200 * $tz)), $translate) : @gmdate($format, $gmepoch + (7200 * $tz)); 
    
      $L_Today = '<b>Heute</b> um';
      $L_Yesterday = '<b>Gestern</b> um';
      $time_format = " H:i";// - hour:minute am/pm 
    
      $date = getdate(); 
      $today = $date['mday']; 
      $month = $date['mon']; 
      $year = $date['year']; 

      $forum_date_today = @gmdate ("d", $gmepoch + (7200 * $tz));
      $forum_date_month = @gmdate ("m", $gmepoch + (7200 * $tz));
      $forum_date_year = @gmdate ("Y", $gmepoch + (7200 * $tz));
    
      if($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year) 
      { 
         //today 
         $thetime = $L_Today . @gmdate ($time_format, $gmepoch + (7200 * $tz));
      } 
    
      else 
      { 
         if($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year) 
         { 
            //yesterday 
            $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (7200 * $tz));
         } 
       
         else 
         { 
            //if today is 1 and the month is not 1, then we have to check how many days in the 
            // previews month and then set $yesterday to the last day in the previews month 
            if($today == 1 && $month != 1) 
            { 
               //returns how many days in the previews month 
               $yesterday = date ("t", gmmktime(0,0,0,($month-1),1,$year) + (7200 * $tz));

               if($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year) 
               { 
                  //yesterday 
                  $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (7200 * $tz));
               } 
            } 

            else 
            { 
               //if we are in the first day in the year 
               if($today == 1 && $month == 1) 
               { 
                  $yesterday = date("t", gmmktime(0,0,0,12,1,($year -1)) + (7200 * $tz));

                  if($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1)) 
                  { 
                     //yesterday 
                     $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch + (7200 * $tz));
                  } 
               } 
            } 
         } 
      } 

      return($thetime); 
   } 
GMT + 2 Stunden: Zeit im ACP wieder zurückstellen nicht vergessen :)

Lg
Jürgen
hackepeter13
Valued Contributor
Beiträge: 3557
Registriert: 21.04.2004 12:22
Wohnort: Berlin
Kontaktdaten:

Beitrag von hackepeter13 »

Supi - Funktioniert bei mir jetzt einwandfrei !

Mal noch ne andere Sache zu diesen Mod.
Und zwar, überall wo "Aktuelles Datum und Uhrzeit:" steht, steht jetzt "Heute um xx:xx".
Wie kann man aus dem "Heute" da jetzt das "richtige Datum" anzeigen lassen, ohne dass bei neuen Beiträgen auch wieder das Datum steht.
Jürgen H.
Mitglied
Beiträge: 192
Registriert: 01.06.2003 23:13

Beitrag von Jürgen H. »

Wie kann man aus dem "Heute" da jetzt das "richtige Datum" anzeigen lassen, ohne dass bei neuen Beiträgen auch wieder das Datum steht.
Gar nicht, du hast den Code vom Original-Mod noch drin. Die Modifikation am Seitenanfang der 2. Seite verwendet aber für die *gestern-heute*-Zeit eine neue Variable. Solange die nicht eingeführt wird, greift der Mod auf die Standard-Forumszeit zu und verändert sie.

Lg
Jürgen
Eisiku
Mitglied
Beiträge: 55
Registriert: 10.04.2004 23:51

Beitrag von Eisiku »

Ich wollte das jetzt so abändern wie kuco gepostet hat, nur hab ich in meiner viewforum.php kein

Code: Alles auswählen

#-----[ FIND ]------------------------------------------ 
# 
   $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); 
Ich denke, daher wird auf der Startseite auch noch die falsche Uhrzeit angezeigt, denn in den Postigs selbst passt es jetzt.

Ähem.....kann mir jemand helfen?
Antworten

Zurück zu „phpBB 2.0: Mod Support“