]> git.mxchange.org Git - friendica.git/commitdiff
Avoid time travel in posts (received before created)
authorMichael Vogel <icarus@dabo.de>
Mon, 13 Jun 2016 20:21:33 +0000 (22:21 +0200)
committerMichael Vogel <icarus@dabo.de>
Mon, 13 Jun 2016 20:21:33 +0000 (22:21 +0200)
include/items.php

index 5c0bb047ae63cf60d1d09b44d3ff6a4ec5798a9f..203b7d0eee6755d0699d8261e3d2da2dedae7d46 100644 (file)
@@ -507,6 +507,13 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr['inform']        = ((x($arr,'inform'))        ? trim($arr['inform'])                : '');
        $arr['file']          = ((x($arr,'file'))          ? trim($arr['file'])                  : '');
 
+       // Items cannot be stored before they happen ...
+       if ($arr['created'] > datetime_convert())
+               $arr['created'] = datetime_convert();
+
+       // We haven't invented time travel by now.
+       if ($arr['edited'] > datetime_convert())
+               $arr['edited'] = datetime_convert();
 
        if (($arr['author-link'] == "") AND ($arr['owner-link'] == ""))
                logger("Both author-link and owner-link are empty. Called by: ".App::callstack(), LOGGER_DEBUG);