[ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Frinendly date

Registrovaný: 01.05.05
Príspevky: 13557
Témy: 1483 | 1483
Bydlisko: Bratislava
NapísalOffline : 13.10.2006 9:09 | Frinendly date

Kód:
##############################################################
## MOD Title: frinendly date
## MOD Author: vegatron <webmaster@vega.4t.com>  - <www.jam3a.tk - www.alhandasa.net> (arabic sites)
## MOD Description:
##  This mod will replace the date with the word 'Today' or 'Yesterday' for the posts that are posted on today or yesterday,
##  which will make the date look more friendly.
##
## MOD Version: 1.0
##
## PHPBB Version: 2.0.0+
## Installation Level: easy
## Installation Time: ~ 1 Minutes
## Files To Edit:  1
##      includes/functions.php
##
## Included Files: N/A
##
##############################################################
## Author's Notes:
##
## The form of the displayed date is 'Today/yesterday - h:i a" ,so in case you wanted to change the date format
##  all you have to do is to edit the variable '$time_format'
##
## This MOD is released under the GPL License.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

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

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

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

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

   $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);
   $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 \\*******************************

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




Kód:
##############################################################
## MOD Title: frinendly date
## MOD Author: vegatron <webmaster@vega.4t.com>  - <www.jam3a.tk - www.alhandasa.net> (arabic sites)
## MOD Description:
##  This mod will replace the date with the word 'Today' or 'Yesterday' for the posts that are posted on today or yesterday,
##  which will make the date look more friendly.
##
## MOD Version: 1.0
##
## PHPBB Version: 2.0.0+
## Installation Level: easy
## Installation Time: ~ 1 Minutes
## Files To Edit:  1
##      includes/functions.php
##
## Included Files: N/A
##
##############################################################
## Author's Notes:
##
## The form of the displayed date is 'Today/yesterday - h:i a" ,so in case you wanted to change the date format
##  all you have to do is to edit the variable '$time_format'
##
## This MOD is released under the GPL License.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

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

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

#
#-----[ AFTER, ADD ]-----------------------------------
#
// friendly date mod\\*******************   
   $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);
   $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
   }

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

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


_________________
Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 11 Enterprise | APC Back-UPS BE-850 VA | Lenovo ThinkPad X1 Carbon | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA & Samsung SSD 860 1 TB | Ubuntu 24.04 LTS | Dell Wyse 3040 | Intel Atom x5-Z8350 | 2 GB DDR3 1600 MHz | 16 GB eMMC | 24" EIZO FlexScan EV2451 | Alpine Linux + XFCE4
 [ Príspevok: 1 ] 


Frinendly date



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

date()

v Backend

4

431

30.10.2015 9:55

henrik35

V tomto fóre nie sú ďalšie neprečítané témy.

Funkcia date()

v Backend

1

505

26.06.2011 14:43

Ďuri

V tomto fóre nie sú ďalšie neprečítané témy.

DATE + dni

v Backend

6

938

30.11.2009 20:41

jtomcik

V tomto fóre nie sú ďalšie neprečítané témy.

Meta name DATE ...

v Frontend

1

592

08.05.2009 10:22

Ďuri

V tomto fóre nie sú ďalšie neprečítané témy.

MySQL select date between

v Databázy

3

433

05.06.2013 20:48

stenley

V tomto fóre nie sú ďalšie neprečítané témy.

php time() or date()

v Backend

0

650

12.07.2008 11:53

Proxy69

V tomto fóre nie sú ďalšie neprečítané témy.

Kolko date za tuto zostavu??

v PC zostavy

12

815

06.04.2007 23:52

maugggly

V tomto fóre nie sú ďalšie neprečítané témy.

PHP, DATE a TIME problem

v Backend

3

1277

09.05.2008 17:37

Andreyco

V tomto fóre nie sú ďalšie neprečítané témy.

date mi infoo mojej maticnej ?

v Intel platformy

1

787

31.08.2007 13:04

Kamahl

V tomto fóre nie sú ďalšie neprečítané témy.

čo znamena <Date ()-30 v acces

v Ostatné programy

0

658

12.02.2008 19:20

Svajny

V tomto fóre nie sú ďalšie neprečítané témy.

Up to date gaming PC do 1000€ (+/-50€)

v PC zostavy

14

696

24.06.2012 19:32

Daron

V tomto fóre nie sú ďalšie neprečítané témy.

Funkcia date('Y-m-d H:i:s'); nefunguje

v Backend

12

658

28.03.2017 17:36

JanoF

V tomto fóre nie sú ďalšie neprečítané témy.

Virus? WARNING! Your Flash Player may be out of date

v Firewally a bezpečnosť

6

917

14.08.2014 14:46

Phanteom

V tomto fóre nie sú ďalšie neprečítané témy.

WARNING! Your Flash Player may be out of date NA MOBILE

v Antivírusy a ochrana

0

559

01.03.2015 11:23

Melouch



© 2005 - 2026 PCforum, edited by JanoF