コード例 #1
0
 /**
  * Atualiza uma postagem conforme os dados recebidos via POST
  */
 public function editPostAction()
 {
     $this->view->disable();
     $post_id = $this->request->getPost("post_id");
     $post_date_posted = $this->dateFormat($this->request->getPost('post_date_posted'), 1);
     $post_date_changed = date("Y-m-d H:i:s");
     $post_author = $this->request->getPost('post_author');
     $post_editor = $this->request->getPost('post_author');
     $post_title = $this->request->getPost('post_title');
     $post_content = addslashes(htmlentities($this->request->getPost('post_content')));
     $post_status_id = $this->request->getPost('post_status_id');
     $categories = explode(", ", $this->request->getPost('list_categories'));
     $post_id = Posts::updatePostAction($post_id, $post_date_posted, $post_date_changed, $post_author, $post_editor, $post_title, $post_content, $post_status_id);
     if ($post_id > 0) {
         $data['success'] = $this->updatePostCategories($categories, $post_id);
     }
     echo json_encode($data);
 }