public function getChatsResponse() { $chats = array(); if (is_array($this->getResource())) { foreach ($this->getResource() as $chat) { $chat->time = array('hours' => gmdate('H', strtotime($chat->ts)), 'minutes' => gmdate('i', strtotime($chat->ts))); $chat->gravatar = Helper::gravatarFromHash($chat->gravatar); $chats[] = $chat; } $response = array('chats' => $chats); return json_encode($response); } return json_encode(array('chats' => $chats)); }
public function getLoginResponse() { $response = array('status' => 1, 'name' => $this->getName(), 'gravatar' => Helper::gravatarFromHash($this->getGravatar())); return json_encode($response); }
public function checkloggedAction() { $response = array('logged' => false); if ($_SESSION['user']['name']) { $response['logged'] = true; $response['loggedAs'] = array('name' => $_SESSION['user']['name'], 'gravatar' => Helper::gravatarFromHash($_SESSION['user']['gravatar'])); } $this->response = json_encode($response); return $this->response; }