Browse Source

오류 수정

master
장선근 5 years ago
parent
commit
05e3532370
  1. 11
      wheeparam/application/controllers/Rss.php
  2. 12
      wheeparam/application/controllers/Sitemap.php
  3. 3
      wheeparam/application/controllers/admin/Board.php
  4. 60
      wheeparam/application/controllers/ajax/Board.php
  5. 31
      wheeparam/application/helpers/widgets_helper.php
  6. 10
      wheeparam/application/models/Search_model.php

11
wheeparam/application/controllers/Rss.php

@ -9,13 +9,13 @@ class Rss extends WB_Controller {
function index($brd_key="")
{
$this->load->model('board_model');
$this->load->library('boardlib');
$brd_array = array();
// 통합 RSS 인 경우
if( empty($brd_key) )
{
$board_list = $this->db->where('brd_use_total_rss','Y')->where('brd_lv_read', '0')->get('board')->result_array();
$board_list = $this->db->where('brd_lv_read', '0')->get('board')->result_array();
foreach($board_list as $b)
{
$brd_array[] = $b['brd_key'];
@ -23,7 +23,7 @@ class Rss extends WB_Controller {
}
else
{
$board = $this->board_model->get_board($brd_key, TRUE);
$board = $this->boardlib->get($brd_key, TRUE);
if( $board['brd_use_rss'] != 'Y' OR $board['brd_lv_read'] > 0 )
{
die('해당 게시판은 RSS 사용 설정이 되어있지 않습니다.');
@ -41,6 +41,7 @@ class Rss extends WB_Controller {
->join('board','board.brd_key=board_post.brd_key','inner')
->where_in('board_post.brd_key', $brd_array)
->where('post_status' ,'Y')
->where('post_secret', 'N')
->order_by('post_num DESC, post_reply ASC, post_idx DESC')
->limit(50)
->get('board_post')
@ -72,8 +73,8 @@ class Rss extends WB_Controller {
echo "<item>\n";
echo "<title><![CDATA[" . element('post_title', $row) . "]]></title>\n";
echo "<link>" . base_url( "board/{$row['brd_key']}/{$row['post_idx']}") . "</link>\n";
echo "<author>" . html_escape(element('mem_nickname', $row)) . "</author>\n";
echo "<pubDate>" . date('Y-m-d', strtotime($row['post_regtime'])) . "</pubDate>\n";
echo "<author>" . html_escape(element('post_nickname', $row)) . "</author>\n";
echo "<pubDate>" . date('Y-m-d', strtotime($row['reg_datetime'])) . "</pubDate>\n";
echo "<description><![CDATA[" . display_html_content($row['post_content']) . "]]></description>\n";
echo "<category>" . html_escape($row['brd_title']) . "</category>\n";
echo "</item>\n";

12
wheeparam/application/controllers/Sitemap.php

@ -47,7 +47,7 @@ class Sitemap extends WB_Controller {
*/
function index()
{
$list = $this->db->where('brd_use_sitemap','Y')->where('brd_lv_read','0')->get('board')->result_array();
$list = $this->db->where('brd_lv_read','0')->get('board')->result_array();
ob_start();
echo "<?xml version=\"1.0\" encoding=\"" . config_item('charset') . "\"?".">\n";
@ -78,16 +78,14 @@ class Sitemap extends WB_Controller {
*/
function board($brd_key)
{
$this->load->model('board_model');
if(empty($brd_key))
{
die('잘못된 접근입니다.');
}
$board = $this->board_model->get_board($brd_key, TRUE);
$board = $this->boardlib->get($brd_key, TRUE);
if( !$board OR $board['brd_use_sitemap'] != 'Y' OR $board['brd_lv_read'] > 0 )
if( !$board OR $board['brd_lv_read'] > 0 )
{
die('이 게시판은 사이트맵을 사용하지 않습니다.');
}
@ -98,7 +96,7 @@ class Sitemap extends WB_Controller {
// 게시판 자체 사이트맵 추가
// 게시판글 최종수정일 가져오기
$max_date = $this->db->select_max('post_modtime', 'max')->where('post_status','Y')->where('brd_key',$brd_key)->from('board_post')->get()->row(0)->max;
$max_date = $this->db->select_max('upd_datetime', 'max')->where('post_status','Y')->where('brd_key',$brd_key)->from('board_post')->get()->row(0)->max;
$data['list'][] = array(
"loc" => base_url("/board/{$brd_key}"),
"lastmod" => date('Y-m-d', strtotime($max_date)),
@ -110,7 +108,7 @@ class Sitemap extends WB_Controller {
{
$data['list'][] = array(
"loc" => base_url("/board/{$brd_key}/{$row['post_idx']}"),
"lastmod" => date('Y-m-d', strtotime($row['post_modtime'])),
"lastmod" => date('Y-m-d', strtotime($row['upd_datetime'])),
"priority" => "0.7",
"changefreq" => "daily"
);

3
wheeparam/application/controllers/admin/Board.php

@ -30,7 +30,6 @@ class Board extends WB_Controller
*/
public function form($brd_key="")
{
$this->load->model('board_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('brd_key','게시판 고유 키',"required|trim|min_length[3]|max_length[20]". (empty($brd_key)?"|callback_brd_key_check":""));
@ -144,7 +143,6 @@ class Board extends WB_Controller
*/
public function board_copy($brd_key)
{
$this->load->model('board_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('original', "원본 게시판", "required|trim");
@ -194,7 +192,6 @@ class Board extends WB_Controller
*/
function brd_key_check($str)
{
$this->load->model('board_model');
if(! preg_match("/^[a-z][a-z0-9_]{2,19}$/", $str))
{

60
wheeparam/application/controllers/ajax/Board.php

@ -20,68 +20,12 @@ class Board extends REST_Controller
if (empty($brd_key)) $this->error_return("FAQ 고유키값이 없습니다.", 400);
$this->load->model('board_model');
$board = $this->board_model->get_board($brd_key, $is_raw);
$this->load->library('boardlib');
$board = $this->boardlib->get($brd_key, $is_raw);
$this->response($board, 200);
}
function category_delete()
{
$bca_idx = $this->delete('bca_idx', TRUE);
if( empty($bca_idx) ) $this->error_return("FAQ 고유키값이 없습니다.", 400);
$this->db->where('bca_idx', $bca_idx);
$result = $this->db->delete('board_category');
$this->response(array('result'=>$result), 200);
}
/**
* 카테고리 순서 정렬
*/
function category_sort_post()
{
$this->load->model('board_model');
$brd_key = $this->post('brd_key', TRUE);
$idxs = $this->post('idxs', TRUE);
$update_array = array();
foreach($idxs as $i=>$idx)
{
$update_array[] = array(
'bca_idx' => $idx,
'bca_sort' => $i+1
);
}
$this->db->update_batch("board_category", $update_array, "bca_idx");
$this->board_model->delete_cache($brd_key);
}
function category_count_get()
{
$bca_idx = $this->get('bca_idx', TRUE);
if( empty($bca_idx) ) $this->error_return("카테고리 지정이 잘못되었습니다.", 400);
$count = (int) $this->db->select('COUNT(*) AS count')->where('bca_parent', $bca_idx)->get('board_category')->row(0)->count;
$this->response(array("result"=>$count), 200);
}
function category_post_count_get()
{
$bca_idx = $this->get('bca_idx', TRUE);
if( empty($bca_idx) ) $this->error_return("카테고리 지정이 잘못되었습니다.", 400);
$count = (int) $this->db->select('COUNT(*) AS count')->where('bca_idx', $bca_idx)->where_in('post_status',array('Y','B'))->get('board_post')->row(0)->count;
$this->response(array("result"=>$count), 200);
}
/**
* 게시물 삭제
*/

31
wheeparam/application/helpers/widgets_helper.php

@ -71,7 +71,7 @@ function latest($skin_name="", $brd_key="", $rows=5, $get_thumb_img=FALSE, $file
* @param int $cache_time 캐시 저장시간
* @return string
*/
function latest_multi($skin_name="", $except_brd_key=array(), $rows=5, $get_thumb_img=FALSE, $file_list=FALSE, $cache_time=1)
function latest_multi($skin_name="", $except_brd_key=array(), $rows=5, $get_thumb_img=FALSE, $cache_time=1)
{
$CI =& get_instance();
@ -85,34 +85,31 @@ function latest_multi($skin_name="", $except_brd_key=array(), $rows=5, $get_thum
$cache_name = "board-multiples-{$rows}-".($get_thumb_img ? 'thumb' : 'nothumb');
$CI->load->model('board_model');
$CI->load->library('boardlib');
if( ! $data['list'] = $CI->cache->get($cache_name) ) {
// 일반 글 목록 가져오기
$param['select'] = "P.*, PC.bca_name, B.brd_title";
if(is_array($except_brd_key) && count($except_brd_key) > 0)
{
foreach( $except_brd_key as $brd_key ) {
$param['where']['P.brd_key !='] = $brd_key;
$CI->db->where('P.brd_key !=', $brd_key);
}
}
$param['where_in']['post_status'] = array('Y','B');
$param['order_by'] = "post_num DESC, post_reply ASC, post_idx ASC";
$param['from'] = "board_post AS P";
$param['join'][] = array("board_category AS PC","PC.bca_idx=P.bca_idx","left");
$param['join'][] = array("board AS B","B.brd_key=P.brd_key","inner");
$param['limit'] = TRUE;
$param['where']['post_notice'] = "N";
$param['page_rows'] = $rows;
$param['page'] = 1;
$CI->db
->select("P.*, PC.bca_name, B.brd_title")
->where('post_status','Y')
->where('post_notice', 'N')
->order_by('post_num DESC, post_reply ASC, post_idx ASC')
->from('board_post AS P')
->join("board AS B","B.brd_key=P.brd_key","inner")
->limit($rows);
$post_list = $CI->board_model->get_list($param);
$post_list['list'] = $CI->db->get()->result_array();
foreach($post_list['list'] as &$row)
{
$board = $CI->board_model->get_board($row['brd_key'], FALSE);
$row = $CI->board_model->post_process($board, $row, "", $file_list, $get_thumb_img);
$row = $CI->boardlib->post_process($row['brd_key'], $row, "", FALSE);
}
$data['list'] = $post_list['list'];
@ -122,8 +119,6 @@ function latest_multi($skin_name="", $except_brd_key=array(), $rows=5, $get_thum
}
}
$data['brd_key'] = $brd_key;
// 스킨 불러오기
$skin = $CI->load->view( DIR_SKIN . DIRECTORY_SEPARATOR . 'latest'. DIRECTORY_SEPARATOR . $skin_name . DIRECTORY_SEPARATOR . "skin.php", $data, TRUE );

10
wheeparam/application/models/Search_model.php

@ -22,7 +22,7 @@ class Search_model extends WB_Model
foreach( $search_array as $st )
{
$this->db->like("post_title", trim($st));
$this->db->or_like("mem_nickname", trim($st));
$this->db->or_like("post_nickname", trim($st));
//$this->db->or_like("post_content", trim($st));
}
$this->db->group_end();
@ -42,12 +42,12 @@ class Search_model extends WB_Model
$result = $this->db->get();
$list = $result->result_array();
$this->load->model('board_model');
$this->load->library('boardlib');
foreach($list as &$row)
{
$b = $this->board_model->get_board($row['brd_key']);
$row = $this->board_model->post_process($b, $row, '', TRUE, TRUE);
$b = $this->boardlib->get($row['brd_key']);
$row = $this->boardlib->post_process($b, $row, '', TRUE, TRUE);
}
return $list;
@ -68,7 +68,7 @@ class Search_model extends WB_Model
foreach($search_array as $st)
{
$this->db->like("post_title", trim($st));
$this->db->or_like("mem_nickname", trim($st));
$this->db->or_like("post_nickname", trim($st));
//$this->db->or_like("post_content", trim($st));
}
$this->db->group_by("board_post.brd_key");

Loading…
Cancel
Save