removes php warnings

This commit is contained in:
Hannes Mannerheim 2014-10-06 11:56:34 +02:00
parent afd4fb3b07
commit 461a1844bc

View File

@ -87,30 +87,34 @@ class ApiQvitterNotificationsAction extends ApiPrivateAuthAction
$notifications_populated = array(); $notifications_populated = array();
foreach($this->notifications as $notification) { if(!empty($this->notifications)) {
// all but follow has an notice foreach($this->notifications as $notification) {
if($notification->ntype != 'follow') {
$notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id));
}
$notifications_populated[] = array( // all but follow has an notice
'id'=> $notification->id, if($notification->ntype != 'follow') {
'from_profile'=> self::twitterUserArray(Profile::getKV($notification->from_profile_id)), $notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id));
'ntype'=> $notification->ntype, }
'notice'=> $notice,
'created_at'=>self::dateTwitter($notification->created),
'is_seen'=>$notification->is_seen
);
}
// mark as seen $notifications_populated[] = array(
foreach($this->notifications as $notification) { 'id'=> $notification->id,
if($notification->is_seen == 0) { 'from_profile'=> self::twitterUserArray(Profile::getKV($notification->from_profile_id)),
$notification->is_seen = 1; 'ntype'=> $notification->ntype,
$notification->update(); 'notice'=> $notice,
'created_at'=>self::dateTwitter($notification->created),
'is_seen'=>$notification->is_seen
);
} }
}
// mark as seen
foreach($this->notifications as $notification) {
if($notification->is_seen == 0) {
$notification->is_seen = 1;
$notification->update();
}
}
}
$this->initDocument('json'); $this->initDocument('json');
$this->showJsonObjects($notifications_populated); $this->showJsonObjects($notifications_populated);