[ Príspevok: 1 ] 
AutorSpráva
Offline

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

Registrovaný: 01.05.05
Príspevky: 12424
Témy: 1447 | 1447
Bydlisko: Bratislava
Vek: 32
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


_________________
SilverStone SST CS01 | Corsair SF600 600W SFX | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 (16 Cores / 32 Threads) & Noctua NH-U9DX i4 | Kingston HyperX Savage 32 GB DDR4 2400 MHz | PNY NVIDIA Quadro K1200 DP 4 GB DDR5 | Intel SSD 750 1.2 TB NVMe & Intel SSD 730 240 GB SATA & Seagate BackUp Plus Portable 12 TB USB | 31.5" 4K LCD EIZO FlexScan EV3237 & 2 x 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech Wireless G700s | Harman Kardon Nova | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 - Intel Core i7 5600U, 8 GB DDR3 1600 MHz, Intel HD Graphics 5500, SanDisk SSD 512 GB, 12.5 FHD LED IPS, WWAN 3G 4G LTE, Microsoft Windows 7 Ultimate | Nintendo Classic Mini | BlackBerry Passport 96 GB
 [ 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 PHP, ASP

4

134

30.10.2015 9:55

henrik35

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

Funkcia date()

v PHP, ASP

1

280

26.06.2011 14:43

Ďuri

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

DATE + dni

v PHP, ASP

6

552

30.11.2009 20:41

jtomcik

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

Meta name DATE ...

v HTML, XHTML, XML, CSS

1

342

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

116

05.06.2013 20:48

stenley

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

php time() or date()

v PHP, ASP

0

449

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

402

06.04.2007 23:52

maugggly

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

PHP, DATE a TIME problem

v PHP, ASP

3

1066

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 čipové sady

1

582

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

413

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

299

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 PHP, ASP

12

215

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 Bezpečnosť a firewally

6

613

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íry a antispywary

0

111

01.03.2015 11:23

Melouch



© 2005 - 2017 PCforum, edited by JanoF