/** * Execute the Friends.get method * * @return The user ids that are the friends. * * For example if the friend uids are 2,3,4 then the return value would be * array( uid=> array(2,3,4) ) * */ public function execute() { $response = array(); $friends = null; if ($this->m_uid == null) { $friends = Api_Bo_Friends::getFriends($this->getUserId()); } else { // What type of friend check should we do? $friends = Api_Bo_Friends::getFriends($this->m_uid); } if (empty($friends)) { $response['uid'] = ''; } else { $response['uid'] = $friends; } return $response; }
public function execute() { $response = array(); // can only be sent to friends $friends = Api_Bo_Friends::getFriends($this->getUserId()); $sendFriends = array_intersect($this->recipients, $friends); if (count($sendFriends) > 0) { // get Email address for each friend. $response['result'] = implode(",", $sendFriends); $mailid = Api_Bo_Notification::createMail($this->getUserId(), $this->subject); foreach ($sendFriends as $friend) { Api_Bo_Notification::addUserToMail($mailid, $friend); } Api_Bo_Notification::addMessage($mailid, $this->getUserId(), $this->message, 1); Api_Bo_Notification::sendEmail($this->getUserId(), $sendFriends, $this->subject, $this->message); } return $response; }