Ejemplo n.º 1
0
 public function settitleAction()
 {
     // Get, check and setup the parameters
     $story_id = $this->getRequest()->getParam("story");
     // TODO We should also filter and strip tags here
     $title = substr($this->getRequest()->getParam("value"), 0, 25);
     //Verify if the requested story exist
     $stories = new Stories();
     if (!($story = $stories->getStory($story_id))) {
         return $this->_helper->json->sendJson(false);
     }
     // Check if we are the owner
     if ($this->_application->user->id != $story->user_id) {
         return $this->_helper->json->sendJson(false);
     }
     // Ok, we can set the title
     $stories->setTitle($story_id, $title);
     // Die with the string
     if (!$title) {
         $title = '[Edit Title]';
     }
     die($title);
 }