aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-26 18:45:01 -0700
committerfriendica <info@friendica.com>2014-03-26 18:45:01 -0700
commited14c1f224afadb5dd5417d4078f853ff97b30cb (patch)
treecd527019841d3b3bfd98e8cdefaf03154db64bb0
parent150bc9866a24303c86b78614b58b8d01a245b424 (diff)
downloadvolse-hubzilla-ed14c1f224afadb5dd5417d4078f853ff97b30cb.tar.gz
volse-hubzilla-ed14c1f224afadb5dd5417d4078f853ff97b30cb.tar.bz2
volse-hubzilla-ed14c1f224afadb5dd5417d4078f853ff97b30cb.zip
more work on firehose
-rw-r--r--include/expire.php4
-rwxr-xr-xinclude/items.php2
-rw-r--r--include/poller.php24
-rw-r--r--include/security.php10
-rw-r--r--include/zot.php12
-rw-r--r--mod/dirsearch.php2
6 files changed, 44 insertions, 10 deletions
diff --git a/include/expire.php b/include/expire.php
index 2d94d64c0..ee9956ef3 100644
--- a/include/expire.php
+++ b/include/expire.php
@@ -29,6 +29,10 @@ function expire_run($argv, $argc){
}
}
+ $x = get_sys_channel();
+ if($x)
+ item_expire($x['channel_id'],30);
+
return;
}
diff --git a/include/items.php b/include/items.php
index dd5f4aac1..5cc1ef05c 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3767,7 +3767,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$r = q("SELECT item.*, item.id as item_id from item
WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent
AND (item_flags & %d)
- $sql_extra ORDER BY created ASC $limit",
+ and item_private = 0 ORDER BY created ASC $limit",
intval($uid),
intval(ITEM_WALL)
);
diff --git a/include/poller.php b/include/poller.php
index bae39dd2e..aa09afd5d 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -167,6 +167,30 @@ function poller_run($argv, $argc){
}
}
+ // pull in some public posts
+
+ $r = q("select site_url from site where site_url != '%s' order by rand() limit 1",
+ dbesc(z_root())
+ );
+
+ if($r) {
+ $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 1 month'));
+ $x = z_fetch_url($feedurl);
+ if(($x) && ($x['success'])) {
+ $total = 0;
+ $j = json_decode($x['body'],true);
+ if($j['success'] && $j['messages']) {
+ require_once('include/identity.php');
+ $sys = get_sys_channel();
+ foreach($j['messages'] as $message) {
+ $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message),
+ array(array('hash' => $sys['xchan_hash'])), false, true);
+ $total ++;
+ }
+ logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG);
+ }
+ }
+ }
$manual_id = 0;
$generation = 0;
diff --git a/include/security.php b/include/security.php
index d974efb8f..282c8ab73 100644
--- a/include/security.php
+++ b/include/security.php
@@ -346,9 +346,10 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) {
$ret = array();
if(local_user())
$ret[] = local_user();
- $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)",
+ $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)",
intval($perms_min),
- intval(PAGE_CENSORED)
+ intval(PAGE_CENSORED),
+ intval(PAGE_SYSTEM)
);
if($r)
foreach($r as $rr)
@@ -371,9 +372,10 @@ function stream_perms_xchans($perms_min = PERMS_SITE) {
if(local_user())
$ret[] = get_observer_hash();
- $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)",
+ $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)",
intval($perms_min),
- intval(PAGE_CENSORED)
+ intval(PAGE_CENSORED),
+ intval(PAGE_SYSTEM)
);
if($r)
foreach($r as $rr)
diff --git a/include/zot.php b/include/zot.php
index c82918b3a..186f1da10 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1354,16 +1354,18 @@ function allowed_public_recips($msg) {
}
-function process_delivery($sender,$arr,$deliveries,$relay) {
+function process_delivery($sender,$arr,$deliveries,$relay,$public = false) {
$result = array();
// We've validated the sender. Now make sure that the sender is the owner or author
- if($sender['hash'] != $arr['owner_xchan'] && $sender['hash'] != $arr['author_xchan']) {
- logger("process_delivery: sender {$sender['hash']} is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}");
- return;
+ if(! $public) {
+ if($sender['hash'] != $arr['owner_xchan'] && $sender['hash'] != $arr['author_xchan']) {
+ logger("process_delivery: sender {$sender['hash']} is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}");
+ return;
+ }
}
foreach($deliveries as $d) {
@@ -1394,7 +1396,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
}
}
- if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery)) {
+ if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $public)) {
logger("permission denied for delivery {$channel['channel_id']}");
$result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
continue;
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 801be6189..0ace4ecae 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -324,6 +324,8 @@ function dir_parse_query($s) {
function list_public_sites() {
+
+
$r = q("select * from site where site_access != 0 and site_register !=0 order by rand()");
$ret = array('success' => false);