From 01263ef4975c7bdd50c3afe633cf2bacdfa40e8c Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Fri, 11 Jan 2019 11:39:20 +0100 Subject: [PATCH] Fixes #3605 - Check for past/future difference in toDate() and code clean-up --- e107_handlers/date_handler.php | 20 +++++++++++++------- e107_languages/English/lan_date.php | 16 ++-------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index b9e5a0b0d..3811fbce4 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -6,15 +6,12 @@ * Released under the terms and conditions of the * GNU General Public License (http://gnu.org). * - * $Source: /cvs_backup/e107_0.8/e107_handlers/date_handler.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ + if (!defined('e107_INIT')) { exit; } -e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php"); +//e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php"); +e107::lan('date'); class e_date { @@ -693,7 +690,16 @@ class e_date return deftrue('LANDT_10',"Just now"); } - return ($mode ? $outputArray : implode(", ", $outputArray) . " " . LANDT_AGO); + // Check if it is 'past' or 'future' + if($older_date > $newer_date) // past + { + return ($mode ? $outputArray : implode(", ", $outputArray) . " " . LANDT_AGO); + } + else // future + { + return ($mode ? $outputArray : LANDT_IN ." ". implode(", ", $outputArray)); + } + } diff --git a/e107_languages/English/lan_date.php b/e107_languages/English/lan_date.php index 2a4c2f3f5..4cd15baee 100644 --- a/e107_languages/English/lan_date.php +++ b/e107_languages/English/lan_date.php @@ -1,14 +1,4 @@ \ No newline at end of file +define("LANDT_10", "Just now"); \ No newline at end of file