aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-14 17:55:14 -0700
committerfriendica <info@friendica.com>2014-08-14 17:55:14 -0700
commit414d86d3a92cc9645c5fac7c4569e3fe2822c051 (patch)
tree2819ed16d39224f6058ead6b7349c42e3ba520a8 /include/api.php
parent1d4fde71e0f7439804f312be54df80d230e454d5 (diff)
downloadvolse-hubzilla-414d86d3a92cc9645c5fac7c4569e3fe2822c051.tar.gz
volse-hubzilla-414d86d3a92cc9645c5fac7c4569e3fe2822c051.tar.bz2
volse-hubzilla-414d86d3a92cc9645c5fac7c4569e3fe2822c051.zip
api - foreach warnings
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/api.php b/include/api.php
index b26c4ea71..c0f54af19 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1518,6 +1518,9 @@ require_once('include/items.php');
$a = get_app();
$ret = array();
+ if(! $r)
+ return $ret;
+
foreach($r as $item) {
localize_item($item);
@@ -1895,17 +1898,19 @@ require_once('include/items.php');
);
$ret = Array();
- foreach($r as $item) {
- if ($box == "inbox" || $item['from-url'] != $profile_url){
- $recipient = $user_info;
- $sender = api_get_user($a,$item['contact-id']);
- }
- elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
- $recipient = api_get_user($a,$item['contact-id']);
- $sender = $user_info;
+ if($r) {
+ foreach($r as $item) {
+ if ($box == "inbox" || $item['from-url'] != $profile_url){
+ $recipient = $user_info;
+ $sender = api_get_user($a,$item['contact-id']);
+ }
+ elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
+ $recipient = api_get_user($a,$item['contact-id']);
+ $sender = $user_info;
+ }
+
+ $ret[]=api_format_messages($item, $recipient, $sender);
}
-
- $ret[]=api_format_messages($item, $recipient, $sender);
}