aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-17 19:22:24 -0800
committerfriendica <info@friendica.com>2013-11-17 19:22:24 -0800
commit13538cdd21c6e13a2ff108f1b42dbecaab8b375a (patch)
treeb9d67c87b02bf7d5b823cbe2eb3d5a381e2cd3bd /include/items.php
parent772e3795bf1513b5f8ac3ab520c6c8cdb68de3af (diff)
downloadvolse-hubzilla-13538cdd21c6e13a2ff108f1b42dbecaab8b375a.tar.gz
volse-hubzilla-13538cdd21c6e13a2ff108f1b42dbecaab8b375a.tar.bz2
volse-hubzilla-13538cdd21c6e13a2ff108f1b42dbecaab8b375a.zip
pull in some posts when we first connect with a new channel (if allowed to) - if not allowed to, do it if that condition changes
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/items.php b/include/items.php
index 5793a7d66..f8b698a4a 100755
--- a/include/items.php
+++ b/include/items.php
@@ -552,15 +552,20 @@ function get_item_elements($x) {
$arr['created'] = datetime_convert('UTC','UTC',$x['created']);
$arr['edited'] = datetime_convert('UTC','UTC',$x['edited']);
- $arr['expires'] = ((x($x,'expires') && $x['expires'])
- ? datetime_convert('UTC','UTC',$x['expires'])
- : '0000-00-00 00:00:00');
if($arr['created'] > datetime_convert())
$arr['created'] = datetime_convert();
if($arr['edited'] > datetime_convert())
$arr['edited'] = datetime_convert();
+ $arr['expires'] = ((x($x,'expires') && $x['expires'])
+ ? datetime_convert('UTC','UTC',$x['expires'])
+ : '0000-00-00 00:00:00');
+
+ $arr['commented'] = ((x($x,'commented') && $x['commented'])
+ ? datetime_convert('UTC','UTC',$x['commented'])
+ : $arr['created']);
+
$arr['title'] = (($x['title']) ? htmlentities($x['title'], ENT_COMPAT,'UTF-8',false) : '');
if(mb_strlen($arr['title']) > 255)
@@ -714,6 +719,7 @@ function encode_item($item) {
$x['created'] = $item['created'];
$x['edited'] = $item['edited'];
$x['expires'] = $item['expires'];
+ $x['commented'] = $item['commented'];
$x['mimetype'] = $item['mimetype'];
$x['title'] = $item['title'];
$x['body'] = $item['body'];
@@ -1539,8 +1545,8 @@ function item_store($arr,$allow_exec = false) {
$arr['owner_xchan'] = ((x($arr,'owner_xchan')) ? notags(trim($arr['owner_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
- $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : '0000-00-00 00:00:00');
- $arr['commented'] = datetime_convert();
+ $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : '0000-00-00 00:00:00');
+ $arr['commented'] = ((x($arr,'commented') !== false) ? datetime_convert('UTC','UTC',$arr['commented']) : datetime_convert());
$arr['received'] = datetime_convert();
$arr['changed'] = datetime_convert();
$arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
@@ -1777,8 +1783,15 @@ function item_store($arr,$allow_exec = false) {
// update the commented timestamp on the parent
- q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d LIMIT 1",
- dbesc(datetime_convert()),
+ q("update item set commented = ( select max(created) from item where parent_mid = '%s' and uid = %d )
+ where id = %d limit 1",
+ dbesc($arr['parent_mid']),
+ intval($arr['uid']),
+ intval($parent_id)
+ );
+
+
+ q("UPDATE item set changed = '%s' WHERE id = %d LIMIT 1",
dbesc(datetime_convert()),
intval($parent_id)
);