aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-20 20:49:06 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-20 20:49:06 -0700
commit3763f74a104d5a9b91b3ddba5dd091640672e9bf (patch)
tree90883fc46613327fd17ebb19912d270e51664a2b /include/items.php
parentc10a4ca9c7422e2d68b3222e5c1a605ff6f456d6 (diff)
parent62df06b3d6b2e56d271b69bebf8427caa715dd16 (diff)
downloadvolse-hubzilla-3763f74a104d5a9b91b3ddba5dd091640672e9bf.tar.gz
volse-hubzilla-3763f74a104d5a9b91b3ddba5dd091640672e9bf.tar.bz2
volse-hubzilla-3763f74a104d5a9b91b3ddba5dd091640672e9bf.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts: include/items.php include/text.php mod/item.php view/nl/messages.po
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';