aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php11
-rw-r--r--include/feedutils.php4
-rw-r--r--include/items.php48
-rw-r--r--include/xchan.php6
4 files changed, 34 insertions, 35 deletions
diff --git a/include/attach.php b/include/attach.php
index 3b63bd651..fd418103d 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -707,13 +707,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$darr = array('pathname' => $pathname);
- // if we need to create a directory, use the channel default permissions.
-
- $darr['allow_cid'] = $channel['channel_allow_cid'];
- $darr['allow_gid'] = $channel['channel_allow_gid'];
- $darr['deny_cid'] = $channel['channel_deny_cid'];
- $darr['deny_gid'] = $channel['channel_deny_gid'];
+ // if we need to create a directory at this point, make it public
+ $darr['allow_cid'] = '';
+ $darr['allow_gid'] = '';
+ $darr['deny_cid'] = '';
+ $darr['deny_gid'] = '';
$direct = null;
diff --git a/include/feedutils.php b/include/feedutils.php
index 814e9c163..eea908fe8 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -1904,7 +1904,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $
if(! $item['parent'])
return;
- if($item['deleted'])
+ if($item['item_deleted'])
return '<at:deleted-entry ref="' . xmlify($item['mid']) . '" when="' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '" />' . "\r\n";
create_export_photo_body($item);
@@ -2024,7 +2024,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $
}
}
- if($item['term']) {
+ if (isset($item['term']) && $item['term']) {
foreach($item['term'] as $term) {
$scheme = '';
$label = '';
diff --git a/include/items.php b/include/items.php
index 46140b699..0f477e761 100644
--- a/include/items.php
+++ b/include/items.php
@@ -2659,9 +2659,10 @@ function tag_deliver($uid, $item_id) {
if ($is_group && intval($x[0]['item_wall'])) {
// don't let the forked delivery chain recurse
- if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u['channel_hash']) {
+ if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u[0]['channel_hash']) {
return;
}
+
// don't announce moderated content until it has been approved
if (intval($item['item_blocked']) === ITEM_MODERATED) {
return;
@@ -2678,7 +2679,7 @@ function tag_deliver($uid, $item_id) {
}
elseif (intval($x[0]['item_uplink'])) {
- start_delivery_chain($u,$item,$item_id,$x[0]);
+ start_delivery_chain($u[0], $item, $item_id, $x[0]);
}
}
@@ -4336,7 +4337,6 @@ function zot_feed($uid, $observer_hash, $arr) {
}
function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = CLIENT_MODE_NORMAL,$module = 'network') {
-
$result = ['success' => false];
$sql_extra = '';
$sql_nets = '';
@@ -4354,7 +4354,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
);
}
- if(isset($arr['uid'])) {
+ if(isset($arr['uid']) && $arr['uid']) {
$uid = $arr['uid'];
}
@@ -4364,30 +4364,30 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$item_uids = " item.uid = " . intval($uid) . " ";
}
- if(isset($arr['top']))
+ if(isset($arr['top']) && $arr['top'])
$sql_options .= " and item_thread_top = 1 ";
- if(isset($arr['star']))
+ if(isset($arr['star']) && $arr['star'])
$sql_options .= " and item_starred = 1 ";
- if(isset($arr['wall']))
+ if(isset($arr['wall']) && $arr['wall'])
$sql_options .= " and item_wall = 1 ";
- if(isset($arr['item_id']))
+ if(isset($arr['item_id']) && $arr['item_id'])
$sql_options .= " and parent = " . intval($arr['item_id']) . " ";
- if(isset($arr['mid']))
+ if(isset($arr['mid']) && $arr['mid'])
$sql_options .= " and parent_mid = '" . dbesc($arr['mid']) . "' ";
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE $item_uids and item_thread_top = 1 $sql_options $item_normal ) ";
- if(isset($arr['since_id']))
+ if(isset($arr['since_id']) && $arr['since_id'])
$sql_extra .= " and item.id > " . intval($arr['since_id']) . " ";
- if(isset($arr['cat']))
+ if(isset($arr['cat']) && $arr['cat'])
$sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY));
- if(isset($arr['gid']) && $uid) {
+ if((isset($arr['gid']) && $arr['gid']) && $uid) {
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
intval($uid)
@@ -4418,7 +4418,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$x = AccessList::by_hash($uid, $r[0]['hash']);
$result['headline'] = sprintf( t('Privacy group: %s'),$x['gname']);
}
- elseif(isset($arr['cid']) && $uid) {
+ elseif((isset($arr['cid']) && $arr['cid']) && $uid) {
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d and abook_blocked = 0 limit 1",
intval($arr['cid']),
@@ -4437,14 +4437,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra = " AND author_xchan = '" . $channel['channel_hash'] . "' and item_private = 0 $item_normal ";
}
- if (isset($arr['datequery'])) {
+ if (isset($arr['datequery']) && $arr['datequery']) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery']))));
}
- if (isset($arr['datequery2'])) {
+ if (isset($arr['datequery2']) && $arr['datequery2']) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert('UTC','UTC',$arr['datequery2']))));
}
- if(isset($arr['search'])) {
+ if(isset($arr['search']) && $arr['search']) {
if(strpos($arr['search'],'#') === 0)
$sql_extra .= term_query('item',substr($arr['search'],1),TERM_HASHTAG,TERM_COMMUNITYTAG);
else
@@ -4453,11 +4453,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
);
}
- if(isset($arr['file'])) {
- $sql_extra .= term_query('item',$arr['files'],TERM_FILE);
+ if(isset($arr['file']) && $arr['file']) {
+ $sql_extra .= term_query('item',$arr['file'],TERM_FILE);
}
- if(isset($arr['conv']) && $channel) {
+ if((isset($arr['conv']) && $arr['conv']) && $channel) {
$sql_extra .= sprintf(" AND parent IN (SELECT distinct parent from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
dbesc(protect_sprintf($uidhash))
);
@@ -4507,15 +4507,16 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
require_once('include/security.php');
$sql_extra .= item_permissions_sql($channel['channel_id'],$observer_hash);
- if(isset($arr['pages']))
+ if(isset($arr['pages']) && $arr['pages']) {
$item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " ";
+ }
else
$item_restrict = " AND item_type = 0 ";
if(isset($arr['item_type']) && $arr['item_type'] === '*')
$item_restrict = '';
- if (((isset($arr['compat'])) || (isset($arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) {
+ if (((isset($arr['compat']) && $arr['compat']) || ((isset($arr['nouveau']) && $arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) {
// "New Item View" - show all items unthreaded in reverse created date order
@@ -4552,9 +4553,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$ordering = "commented";
if(($client_mode & CLIENT_MODE_LOAD) || ($client_mode == CLIENT_MODE_NORMAL)) {
-
// Fetch a page full of parent items for this page
-
$r = dbq("SELECT distinct item.id AS item_id, item.$ordering FROM item
left join abook on item.author_xchan = abook.abook_xchan
WHERE $item_uids $item_restrict
@@ -4610,9 +4609,10 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$items = array();
}
- if($parents_str && $arr['mark_seen'])
+ if ($parents_str && (isset($arr['mark_seen']) && $arr['mark_seen'])) {
$update_unseen = ' AND parent IN ( ' . dbesc($parents_str) . ' )';
/** @FIXME finish mark unseen sql */
+ }
}
return $items;
diff --git a/include/xchan.php b/include/xchan.php
index a32064303..4a2d389c0 100644
--- a/include/xchan.php
+++ b/include/xchan.php
@@ -148,15 +148,15 @@ function xchan_store($arr) {
function xchan_fetch($arr) {
$key = '';
- if($arr['hash']) {
+ if(isset($arr['hash']) && $arr['hash']) {
$key = 'xchan_hash';
$v = $arr['hash'];
}
- elseif($arr['guid']) {
+ elseif(isset($arr['guid']) && $arr['guid']) {
$key = 'xchan_guid';
$v = $arr['guid'];
}
- elseif($arr['address']) {
+ elseif(isset($arr['address']) && $arr['address']) {
$key = 'xchan_addr';
$v = $arr['address'];
}