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
if($notification->ntype != 'follow') {
$notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id));
}
$notifications_populated[] = array(
'id'=> $notification->id,
'from_profile'=> self::twitterUserArray(Profile::getKV($notification->from_profile_id)),
'ntype'=> $notification->ntype,
'notice'=> $notice,
'created_at'=>self::dateTwitter($notification->created),
'is_seen'=>$notification->is_seen
);
}
// mark as seen foreach($this->notifications as $notification) {
foreach($this->notifications as $notification) {
if($notification->is_seen == 0) { // all but follow has an notice
$notification->is_seen = 1; if($notification->ntype != 'follow') {
$notification->update(); $notice = self::twitterSimpleStatusArray(Notice::getKV($notification->notice_id));
} }
}
$notifications_populated[] = array(
'id'=> $notification->id,
'from_profile'=> self::twitterUserArray(Profile::getKV($notification->from_profile_id)),
'ntype'=> $notification->ntype,
'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);