aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/include/items.php b/include/items.php
index e4d16668a..828f43621 100755
--- a/include/items.php
+++ b/include/items.php
@@ -949,6 +949,14 @@ function import_author_diaspora($x) {
if(! $x['address'])
return false;
+ $r = q("select * from xchan where xchan_addr = '%s' limit 1",
+ dbesc($x['address'])
+ );
+ if($r) {
+ logger('in_cache: ' . $x['address'], LOGGER_DATA);
+ return $r[0]['chan_hash'];
+ }
+
if(discover_by_webbie($x['address'])) {
$r = q("select xchan_hash from xchan where xchan_addr = '%s' limit 1",
dbesc($x['address'])
@@ -4095,6 +4103,8 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
$linked_item = (($item['resource_id']) ? true : false);
+ logger('item: ' . $item . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA);
+
switch($stage) {
case DROPITEM_PHASE2:
$r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), body = '', title = '',
@@ -4333,12 +4343,14 @@ function fetch_post_tags($items,$link = false) {
-function zot_feed($uid,$observer_xchan,$arr) {
+function zot_feed($uid,$observer_hash,$arr) {
$result = array();
$mindate = null;
$message_id = null;
+ require_once('include/security.php');
+
if(array_key_exists('mindate',$arr)) {
$mindate = datetime_convert('UTC','UTC',$arr['mindate']);
}
@@ -4356,14 +4368,14 @@ function zot_feed($uid,$observer_xchan,$arr) {
if($message_id)
logger('message_id: ' . $message_id,LOGGER_DEBUG);
- if(! perm_is_allowed($uid,$observer_xchan,'view_stream')) {
+ if(! perm_is_allowed($uid,$observer_hash,'view_stream')) {
logger('zot_feed: permission denied.');
return $result;
}
if(! is_sys_channel($uid)) {
require_once('include/security.php');
- $sql_extra = item_permissions_sql($uid);
+ $sql_extra = item_permissions_sql($uid,$observer_hash);
}
$limit = " LIMIT 100 ";
@@ -4377,6 +4389,7 @@ function zot_feed($uid,$observer_xchan,$arr) {
$limit = '';
}
+
$items = array();
/** @FIXME fix this part for PostgreSQL */
@@ -4386,7 +4399,6 @@ function zot_feed($uid,$observer_xchan,$arr) {
}
if(is_sys_channel($uid)) {
- require_once('include/security.php');
$r = q("SELECT parent, created, postopts from item
WHERE uid != %d
and uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ") AND item_restrict = 0
@@ -4592,7 +4604,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
//$start = dba_timer();
require_once('include/security.php');
- $sql_extra .= item_permissions_sql($channel['channel_id']);
+ $sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash);
if($arr['pages'])
$item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " ";
@@ -4698,7 +4710,10 @@ function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remo
$page_type = '';
- if($webpage == ITEM_TYPE_WEBPAGE)
+ if(! $post_id)
+ return;
+
+ if($webpage == ITEM_TYPE_WEBPAGE)
$page_type = 'WEBPAGE';
elseif($webpage == ITEM_TYPE_BLOCK)
$page_type = 'BUILDBLOCK';