aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-14 18:34:58 -0700
committerFriendika <info@friendika.com>2011-03-14 18:34:58 -0700
commit852ea1aedd22ea55ae07bcba4eb9bcf0b0018704 (patch)
tree096d15eb8b19391498fa23f3865c24041d02ab7f
parentbae15f9aaee5737b5f2efc9b3acf749c0c61f01e (diff)
downloadvolse-hubzilla-852ea1aedd22ea55ae07bcba4eb9bcf0b0018704.tar.gz
volse-hubzilla-852ea1aedd22ea55ae07bcba4eb9bcf0b0018704.tar.bz2
volse-hubzilla-852ea1aedd22ea55ae07bcba4eb9bcf0b0018704.zip
force last-child on foster children, disallow time travel
-rw-r--r--include/items.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index e930ab5d2..2294fe294 100644
--- a/include/items.php
+++ b/include/items.php
@@ -401,6 +401,17 @@ function get_atom_elements($feed,$item) {
$res['edited'] = $item->get_date('c');
+ // Disallow time travelling posts
+
+ $d1 = strtotime($res['created']);
+ $d2 = strtotime($res['edited']);
+ $d3 = strtotime('now');
+
+ if($d1 > $d3)
+ $res['created'] = datetime_convert();
+ if($d2 > $d3)
+ $res['edited'] = datetime_convert();
+
$rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])
$res['owner-name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
@@ -702,6 +713,18 @@ function item_store($arr,$force_parent = false) {
intval($current_post)
);
+ /**
+ * If this is now the last-child, force all _other_ children of this parent to *not* be last-child
+ */
+
+ if($arr['last-child']) {
+ $r = q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d AND `id` != %d",
+ dbesc($arr['uri']),
+ intval($arr['uid']),
+ intval($current_post)
+ );
+ }
+
return $current_post;
}