getUserSpace($uId); $result = array(); foreach($recipientIds as $recipientId) { $val = intval($recipientId); if($val) { if ($uId) { $result[$val] = notification_add($val, $appId, $notification) === null; } else { $result[$val] = notification_add($val, $appId, $notification, array(), 1) === null; } } else { $result[$recipientId] = null; } } return $result; } public function onNotificationsGet($uId) { $notify = $result = array(); $result = array( 'message' => array( 'unread' => 0, 'mostRecent' => 0 ), 'notification' => array( 'unread' => 0 , 'mostRecent' => 0 ), 'friendRequest' => array( 'uIds' => array() ) ); $i = 0; foreach(C::t('home_notification')->fetch_all_by_uid($uId, 1) as $value) { $i++; if(!$result['notification']['mostRecent']) $result['notification']['mostRecent'] = $value['dateline']; } $result['notification']['unread'] = $i; loaducenter(); $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm'); if($pmarr['count']) { $result['message']['unread'] = $pmarr['count']; $result['message']['mostRecent'] = $pmarr['data'][0]['dateline']; } $fIds = array(); foreach(C::t('home_friend_request')->fetch_all_by_uid($uId) as $value) { if(!$result['friendRequest']['mostRecent']) { $result['friendRequest']['mostRecent'] = $value['dateline']; } $fIds[] = $value['uid']; } $result['friendRequest']['uIds'] = $fIds; return $result; } }