Skip to content

Commit

Permalink
Fixes #3605 - Check for past/future difference in toDate()
Browse files Browse the repository at this point in the history
and code clean-up
  • Loading branch information
Moc committed Jan 11, 2019
1 parent 0445f9f commit 01263ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
20 changes: 13 additions & 7 deletions e107_handlers/date_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -693,7 +690,16 @@ function computeLapse($older_date, $newer_date = FALSE, $mode = FALSE, $show_sec
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));
}

}


Expand Down
16 changes: 2 additions & 14 deletions e107_languages/English/lan_date.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_date.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
*/

define("LANDT_01", "year");
define("LANDT_02", "month");
Expand All @@ -30,8 +20,6 @@
define("LANDT_09", "sec");
define("LANDT_09s", "secs");
define("LANDT_AGO", "ago");
define("LANDT_IN", "in");

define("LANDT_10", "Just now");


?>
define("LANDT_10", "Just now");

0 comments on commit 01263ef

Please sign in to comment.