diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2016-01-27 17:24:05 +0100 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2016-01-27 17:24:05 +0100 |
commit | c766cf9565129b762998e709f5ee7c3eb14cffca (patch) | |
tree | c462e39540d6f63e30d10aca1c64ffefcfa4d4ef /include/items.php | |
parent | e4674142c6a205651d4bb207aa038e6d089da73f (diff) | |
parent | 722d7ff38d5bbf49a7c990d9219998c2c8a5b58f (diff) | |
download | volse-hubzilla-c766cf9565129b762998e709f5ee7c3eb14cffca.tar.gz volse-hubzilla-c766cf9565129b762998e709f5ee7c3eb14cffca.tar.bz2 volse-hubzilla-c766cf9565129b762998e709f5ee7c3eb14cffca.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php index 6acf1c883..b38049e70 100755 --- a/include/items.php +++ b/include/items.php @@ -159,7 +159,7 @@ function filter_insecure($channel_id, $arr) { $ret = array(); - if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_collections'))) || (! $arr)) + if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_privacy_groups'))) || (! $arr)) return $arr; $str = ''; @@ -3687,6 +3687,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { return; } + $sys_expire = intval(get_config('system','default_expire_days')); + $chn_expire = intval($importer['channel_expire_days']); + + $expire_days = $sys_expire; + + if(($chn_expire != 0) && ($chn_expire < $sys_expire)) + $expire_days = $chn_expire; + +logger('expire_days: ' . $expire_days); + $feed = new SimplePie(); $feed->set_raw_data($xml); $feed->init(); @@ -3790,6 +3800,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { intval($importer['channel_id']) ); + // Update content if 'updated' changes if($r) { @@ -3848,6 +3859,17 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $datarray['owner_xchan'] = $contact['xchan_hash']; + if(array_key_exists('created',$datarray) && $datarray['created'] != NULL_DATE && $expire_days) { + $t1 = $datarray['created']; + $t2 = datetime_convert('UTC','UTC','now - ' . $expire_days . 'days'); + if($t1 < $t2) { + logger('feed content older than expiration. Ignoring.', LOGGER_DEBUG, LOG_INFO); + continue; + } + } + + + $r = q("SELECT edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1", dbesc($item_id), intval($importer['channel_id']) @@ -4837,7 +4859,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C intval($uid) ); if(! $r) { - $result['message'] = t('Collection not found.'); + $result['message'] = t('Privacy group not found.'); return $result; } @@ -4853,14 +4875,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C } } else { $contact_str = ' 0 '; - $result['message'] = t('Collection is empty.'); + $result['message'] = t('Privacy group is empty.'); return $result; } $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent $item_normal ) "; $x = group_rec_byhash($uid,$r[0]['hash']); - $result['headline'] = sprintf( t('Collection: %s'),$x['name']); + $result['headline'] = sprintf( t('Privacy group: %s'),$x['name']); } elseif($arr['cid'] && $uid) { |