aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-23 17:24:15 -0700
committerfriendica <info@friendica.com>2013-05-23 17:24:15 -0700
commitc721c3a20e17783835672365ce56fe64876002c7 (patch)
tree23f3c5436e0aaab35fd5510b7bbb135f0dc5a46f
parentbb31e6bd6a7ad9c24d3537719a656c86de0e0ee5 (diff)
downloadvolse-hubzilla-c721c3a20e17783835672365ce56fe64876002c7.tar.gz
volse-hubzilla-c721c3a20e17783835672365ce56fe64876002c7.tar.bz2
volse-hubzilla-c721c3a20e17783835672365ce56fe64876002c7.zip
implement time travelling posts
-rwxr-xr-xboot.php1
-rwxr-xr-xinclude/items.php9
-rw-r--r--include/poller.php10
3 files changed, 20 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index 80d7fe9d4..c9d0f7fe6 100755
--- a/boot.php
+++ b/boot.php
@@ -413,6 +413,7 @@ define ( 'ITEM_SPAM', 0x0008);
define ( 'ITEM_DELETED', 0x0010);
define ( 'ITEM_UNPUBLISHED', 0x0020);
define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
+define ( 'ITEM_DELAYED_PUBLISH', 0x0080);
/**
* Item Flags
diff --git a/include/items.php b/include/items.php
index 9abc2e330..ca8cbdfc0 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1486,6 +1486,15 @@ function item_store($arr,$force_parent = false) {
$arr['item_flags'] = $arr['item_flags'] | ITEM_UNSEEN;
+
+ // handle time travelers
+ // Allow a bit of fudge in case somebody just has a slightly slow/fast clock
+
+ $d1 = new DateTime('now +10 minutes');
+ $d2 = new DateTime($arr['created']);
+ if($d2 > $d1)
+ $arr['item_restrict'] = $arr['item_restrict'] | ITEM_DELAYED_PUBLISH;
+
$arr['llink'] = z_root() . '/display/' . $arr['mid'];
if(! $arr['plink'])
diff --git a/include/poller.php b/include/poller.php
index 33e882735..43c7b497b 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -38,6 +38,16 @@ function poller_run($argv, $argc){
intval(ACCOUNT_EXPIRED)
);
+ // publish any applicable items that were set to be published in the future
+ // (time travel posts)
+
+ q("update item set item_restrict = ( item_restrict ^ %d )
+ where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ",
+ intval(ITEM_DELAYED_PUBLISH),
+ intval(ITEM_DELAYED_PUBLISH)
+ );
+
+
$abandon_days = intval(get_config('system','account_abandon_days'));
if($abandon_days < 1)
$abandon_days = 0;