public function setpublicAction() { // Get, check and setup the parameters $story_id = $this->getRequest()->getParam("story"); //Verify if the requested story exist $stories = new Stories(); if (!($story = $stories->getStory($story_id))) { if ($this->_ajax) { return $this->_helper->json->sendJson(false); } else { $this->_forward('view', 'story', 'public', array('id' => $story_id)); } } // Check if we are the owner if ($this->_application->user->id != $story->user_id) { if ($this->_ajax) { return $this->_helper->json->sendJson(false); } else { $this->_forward('view', 'story', 'public', array('id' => $story_id)); } } // Ok, we can show the item $stories->setHidden($story_id, 0); if ($this->_ajax) { return $this->_helper->json->sendJson(true); } else { $this->_forward('view', 'story', 'public', array('id' => $story_id)); } }