public function ApiPostAddAction() { if (!$this->IsLoggedIn()) { return $this->ResponseNotLoggedIn(); } $Text = htmlentities(utf8_decode($this->Request->GetGET('text'))); if (empty($Text)) { return $this->ResponseWrongData(); } $Post = new \Dashbird\Model\Entities\Post(); $Post->Text = $Text; $Post->SearchHelper = ''; $Post->UserId = $this->GetUserId(); $Post->Insert(); $Tags = $this->Request->GetGET('tags'); if (is_array($Tags)) { $Post->SetTags($Tags); } else { $Post->SetTags(array()); } $Post->Update(); $Shares = $this->Request->GetGET('shares'); if (!is_array($Shares)) { $Shares = array(); } $Post->SetPostShares($Shares); return $this->ResponseSuccess($Post->ToArray()); }