aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-17 16:50:32 -0800
committerfriendica <info@friendica.com>2013-11-17 16:50:32 -0800
commit06e0272db873ad0b7dbc96596e92b8c635f940a2 (patch)
treecc9c69c446e13de010baa4fe2dcd2c401aef4f94 /include
parent28b0eb9c330261ea6a8cd36248c194b6b153f5e6 (diff)
downloadvolse-hubzilla-06e0272db873ad0b7dbc96596e92b8c635f940a2.tar.gz
volse-hubzilla-06e0272db873ad0b7dbc96596e92b8c635f940a2.tar.bz2
volse-hubzilla-06e0272db873ad0b7dbc96596e92b8c635f940a2.zip
populate some posts when somebody is granted "read stream" permission
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php5
-rw-r--r--include/onepoll.php9
-rw-r--r--include/poller.php3
-rw-r--r--include/zot.php14
4 files changed, 27 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index 520ea7230..5793a7d66 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3757,6 +3757,7 @@ function fetch_post_tags($items,$link = false) {
function zot_feed($uid,$observer_xchan,$mindate) {
+
$result = array();
$mindate = datetime_convert('UTC','UTC',$mindate);
if(! $mindate)
@@ -3764,10 +3765,14 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$mindate = dbesc($mindate);
+ logger('zot_feed: ' . $uid);
+
if(! perm_is_allowed($uid,$observer_xchan,'view_stream')) {
+ logger('zot_feed: permission denied.');
return $result;
}
+ require_once('include/security.php');
$sql_extra = item_permissions_sql($uid);
if($mindate != '0000-00-00 00:00:00') {
diff --git a/include/onepoll.php b/include/onepoll.php
index 50c2566be..5e5589228 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -98,8 +98,11 @@ function onepoll_run($argv, $argc){
return;
if($contact['xchan_connurl']) {
- $feedurl = str_replace('/poco/','/zotfeed/',$channel['xchan_connurl']);
- $x = z_fetch_url($feedurl . '?f=&mindate=' . $last_update);
+ $feedurl = str_replace('/poco/','/zotfeed/',$contact['xchan_connurl']);
+ $x = z_fetch_url($feedurl . '?f=&mindate=' . urlencode($last_update));
+
+ logger('feed_update: ' . print_r($x,true), LOGGER_DATA);
+
if($x['success']) {
$total = 0;
logger('onepoll: feed update ' . $contact['xchan_name']);
@@ -107,7 +110,7 @@ function onepoll_run($argv, $argc){
$j = json_decode($x['body'],true);
if($j['success'] && $j['messages']) {
foreach($j['messages'] as $message) {
- $results = process_delivery(array('hash' => $contact['xchan_hash']),$message,
+ $results = process_delivery(array('hash' => $contact['xchan_hash']), get_item_elements($message),
array(array('hash' => $importer['xchan_hash'])), false);
$total ++;
}
diff --git a/include/poller.php b/include/poller.php
index 3c4e6402c..0dcec4c0f 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -117,7 +117,10 @@ function poller_run($argv, $argc){
set_config('system','last_expire_day',$d2);
+
// Uncomment when expire protocol component is working
+// Update - this is not going to happen. We are only going to
+// implement per-item expire, not blanket expiration
// proc_run('php','include/expire.php');
proc_run('php','include/cli_suggest.php');
diff --git a/include/zot.php b/include/zot.php
index 09a3c28fa..71f720a6d 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -306,6 +306,11 @@ function zot_refresh($them,$channel = null) {
);
if(! $y)
logger('abook update failed');
+ else {
+ // if we were just granted read stream permission and didn't have it before, try to pull in some posts
+ if((! ($r[0]['abook_their_perms'] & PERMS_R_STREAM)) && ($their_perms & PERMS_R_STREAM))
+ proc_run('php','include/onepoll.php',$r[0]['abook_id']);
+ }
}
else {
$default_perms = 0;
@@ -330,7 +335,6 @@ function zot_refresh($them,$channel = null) {
);
if($y) {
-
logger("New introduction received for {$channel['channel_name']}");
if($default_perms) {
// send back a permissions update for auto-friend/auto-permissions
@@ -342,6 +346,14 @@ function zot_refresh($them,$channel = null) {
if($z)
proc_run('php','include/notifier.php','permission_update',$z[0]['abook_id']);
}
+ $new_connection = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s' order by abook_created desc limit 1",
+ intval($channel['channel_id']),
+ dbesc($x['hash'])
+ );
+
+ if($new_connection && ($their_perms & PERMS_R_STREAM))
+ proc_run('php','include/onepoll.php',$new_connection[0]['abook_id']);
+
}
}
}