You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9 KiB

7 years ago
6 years ago
7 years ago
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require APPPATH . '/libraries/REST_Controller.php';
  4. /**************************************************************
  5. * Board API
  6. *************************************************************/
  7. class Board extends REST_Controller
  8. {
  9. function __construct()
  10. {
  11. parent::__construct();
  12. if (!$this->input->is_ajax_request()) $this->response(array("result" => FALSE, "message" => langs('공통/msg/invalid_access')), 400);
  13. }
  14. function info_get()
  15. {
  16. $brd_key = $this->get('brd_key', TRUE);
  17. $is_raw = $this->get('is_raw', TRUE) == TRUE ? TRUE : FALSE;
  18. if (empty($brd_key)) $this->error_return("FAQ 고유키값이 없습니다.", 400);
  19. $this->load->library('boardlib');
  20. $board = $this->boardlib->get($brd_key, $is_raw);
  21. $this->response($board, 200);
  22. }
  23. /**
  24. * 게시물 삭제
  25. */
  26. function posts_delete()
  27. {
  28. $idxs = $this->delete('post_idx', TRUE);
  29. if(count($idxs) <= 0)
  30. $this->response(array('status'=>FALSE, 'message'=>'삭제할 게시물을 선택해주세요'), 400);
  31. $this->db->where_in('post_idx', $idxs);
  32. $this->db->set('post_status', 'N');
  33. $this->db->update('board_post');
  34. }
  35. /**
  36. * 게시물 승인
  37. */
  38. function assign_post()
  39. {
  40. $post_idx = $this->post('post_idx', TRUE);
  41. $post_assign = $this->post('post_assign', TRUE);
  42. if(empty($post_idx))
  43. $this->response(array('status'=>FALSE, 'message'=>'잘못된 접근입니다.'), 400);
  44. if(! in_array($post_assign, array('Y','N')))
  45. $this->response(array('status'=>FALSE, 'message'=>'잘못된 접근입니다.'), 400);
  46. $this->db->where('post_idx', $post_idx);
  47. $this->db->set('post_assign',$post_assign);
  48. $this->db->update('board_post');
  49. }
  50. }