fix notices

This commit is contained in:
zottel 2014-01-09 17:06:28 +01:00
parent ab81458768
commit 5ee5bda998

View File

@ -177,6 +177,10 @@ function channel_content(&$a, $update = 0, $load = false) {
$r = q("SELECT parent AS item_id from item where mid = '%s' limit 1", $r = q("SELECT parent AS item_id from item where mid = '%s' limit 1",
dbesc($mid) dbesc($mid)
); );
if (! $r) {
notice( t('Item not found.') . EOL);
}
} else { } else {
$r = q("SELECT distinct id AS item_id FROM item $r = q("SELECT distinct id AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan left join abook on item.author_xchan = abook.abook_xchan
@ -207,8 +211,11 @@ function channel_content(&$a, $update = 0, $load = false) {
dbesc($r[0]['item_id']), dbesc($r[0]['item_id']),
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if (!$ismine) if (!$ismine) {
if ($load)
notice( t('Permission denied.') . EOL);
$r = array(); $r = array();
}
} }
if($r) { if($r) {
@ -228,12 +235,10 @@ function channel_content(&$a, $update = 0, $load = false) {
$items = fetch_post_tags($items, true); $items = fetch_post_tags($items, true);
$items = conv_sort($items,'created'); $items = conv_sort($items,'created');
if ($mid && (! count($items))) { if ($load && $mid && (! count($items))) {
// This will happen if channel is called with a mid from another // This will happen if we don't have sufficient permissions
// channel, if we don't have sufficient permissions to view the // to view the parent item (or the item itself if it is toplevel)
// item, or if it doesn't exist. notice( t('Permission denied.') . EOL);
// Do we need separate error messages for that?
notice( t('Item not found.') . EOL);
} }
} else { } else {