Esempio n. 1
0
     if (strstr($row['wr_option'] . $row2['wr_option'], 'secret')) {
         $row['wr_content'] = '[비밀글 입니다.]';
     }
     $subject = get_text($row['wr_subject']);
     if (strstr($sfl, 'wr_subject')) {
         $subject = search_font($stx, $subject);
     }
     if ($read_level[$idx] <= $member['mb_level']) {
         //$content = cut_str(get_text(strip_tags($row['wr_content'])), 300, "…");
         $content = strip_tags($row['wr_content']);
         $content = get_text($content, 1);
         $content = strip_tags($content);
         $content = str_replace('&nbsp;', '', $content);
         $content = cut_str($content, 300, "…");
         if (strstr($sfl, 'wr_content')) {
             $content = search_font($stx, $content);
         }
     } else {
         $content = '';
     }
     $list[$idx][$i]['subject'] = $subject;
     $list[$idx][$i]['content'] = $content;
     $list[$idx][$i]['name'] = get_sideview($row['mb_id'], get_text(cut_str($row['wr_name'], $config['cf_cut_name'])), $row['wr_email'], $row['wr_homepage']);
     $k++;
     if ($k >= $rows) {
         break;
     }
 }
 sql_free_result($result);
 if ($k >= $rows) {
     break;
Esempio n. 2
0
    if ($board['bo_use_nogood']) {
        $nogood_href = './good.php?bo_table=' . $bo_table . '&amp;wr_id=' . $wr_id . '&amp;good=nogood';
    }
}
$view = get_view($write, $board, $board_skin_path);
if (strstr($sfl, 'subject')) {
    $view['subject'] = search_font($stx, $view['subject']);
}
$html = 0;
if (strstr($view['wr_option'], 'html1')) {
    $html = 1;
} else {
    if (strstr($view['wr_option'], 'html2')) {
        $html = 2;
    }
}
$view['content'] = conv_content($view['wr_content'], $html);
if (strstr($sfl, 'content')) {
    $view['content'] = search_font($stx, $view['content']);
}
$view['rich_content'] = preg_replace("/{이미지\\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view['content']);
$is_signature = false;
$signature = '';
if ($board['bo_use_signature'] && $view['mb_id']) {
    $is_signature = true;
    $mb = get_member($view['mb_id']);
    $signature = $mb['mb_signature'];
    $signature = conv_content($signature, 1);
}
include_once $board_skin_path . '/view.skin.php';
@(include_once $board_skin_path . '/view.tail.skin.php');
Esempio n. 3
0
}
$view = get_view($write, $board, $board_skin_path, 255);
if (strstr($sfl, "subject")) {
    $view[subject] = search_font($stx, $view[subject]);
}
$html = 0;
if (strstr($view[wr_option], "html1")) {
    $html = 1;
} else {
    if (strstr($view[wr_option], "html2")) {
        $html = 2;
    }
}
$view[content] = conv_content($view[wr_content], $html);
if (strstr($sfl, "content")) {
    $view[content] = search_font($stx, $view[content]);
}
$view[content] = preg_replace("/(\\<img )([^\\>]*)(\\>)/i", "\\1 name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;' \\2 \\3", $view[content]);
//$view[rich_content] = preg_replace("/{img\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
$view[rich_content] = preg_replace("/{이미지\\:([0-9]+)[:]?([^}]*)}/ie", "view_image(\$view, '\\1', '\\2')", $view[content]);
$is_signature = false;
$signature = "";
if ($board[bo_use_signature] && $view[mb_id]) {
    $is_signature = true;
    $mb = get_member($view[mb_id]);
    $signature = $mb[mb_signature];
    //$signature = bad_tag_convert($signature);
    // 081022 : CSRF 보안 결함으로 인한 코드 수정
    $signature = conv_content($signature, 1);
}
include_once "{$board_skin_path}/mw.lib/mw.skin.basic.lib.php";
Esempio n. 4
0
 } else {
     $ss_name = 'ss_secret_comment_' . $bo_table . '_' . $list[$i]['wr_id'];
     // APMS : 대댓글의 비밀글을 원댓글쓴이에게도 보이기
     $is_pre_commenter = false;
     if ($row['wr_comment_reply'] && $member['mb_id']) {
         $pre_comment = sql_fetch(" select mb_id from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 and wr_comment = '{$row['wr_comment']}' and wr_comment_reply = '" . substr($row['wr_comment_reply'], 0, -1) . "' ");
         if ($pre_comment['mb_id'] && $pre_comment['mb_id'] == $member['mb_id']) {
             $is_pre_commenter = true;
         }
     }
     if (get_session($ss_name) || $is_pre_commenter) {
         if ($is_cmt_shingo) {
             $list[$i]['content'] = '';
         } else {
             $list[$i]['content'] = conv_content($row['wr_content'], 0, 'wr_content');
             $list[$i]['content'] = search_font($stx, $list[$i]['content']);
             $is_content = true;
         }
     } else {
         $list[$i]['content'] = '<a href="./password.php?w=sc&amp;bo_table=' . $bo_table . '&amp;wr_id=' . $list[$i]['wr_id'] . $qstr . '" class="s_cmt">댓글내용 확인</a>';
         $is_secret = true;
     }
 }
 if ($is_content) {
     $list[$i]['content'] = preg_replace("/\\[<a\\s*href\\=\"(http|https|ftp)\\:\\/\\/([^[:space:]]+)\\.(gif|png|jpg|jpeg|bmp).*<\\/a>(\\s\\]|\\]|)/i", "<a href=\"" . G5_BBS_URL . "/view_img.php?img=\$1://\$2.\$3\" target=\"_blank\" class=\"item_image\"><img src=\"\$1://\$2.\$3\" alt=\"\" style=\"max-width:100%;border:0;\"></a>", $list[$i]['content']);
     $list[$i]['content'] = apms_content($list[$i]['content']);
     //럭키포인트
     if ($row['as_lucky']) {
         $list[$i]['content'] = $list[$i]['content'] . '' . str_replace("[point]", number_format($row['as_lucky']), APMS_LUCKY_TEXT);
     }
 }
Esempio n. 5
0
     $page = 1;
 }
 // 페이지가 없으면 첫 페이지 (1 페이지)
 $from_record = ($page - 1) * $page_rows;
 // 시작 열을 구함
 $sql = " select *\n                {$sql_common}\n                {$sql_search}\n                {$sql_order}\n                limit {$from_record}, {$page_rows} ";
 $result = sql_query($sql);
 $list = array();
 $num = $total_count - ($page - 1) * $page_rows;
 $subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len'];
 for ($i = 0; $row = sql_fetch_array($result); $i++) {
     $list[$i] = $row;
     $list[$i]['category'] = get_text($row['qa_category']);
     $list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
     if ($stx) {
         $list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
     }
     $list[$i]['view_href'] = G5_BBS_URL . '/qaview.php?qa_id=' . $row['qa_id'] . $qstr;
     $list[$i]['icon_file'] = '';
     if (trim($row['qa_file1']) || trim($row['qa_file2'])) {
         $list[$i]['icon_file'] = '<img src="' . $qa_skin_url . '/img/icon_file.gif">';
     }
     $list[$i]['name'] = get_text($row['qa_name']);
     $list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
     $list[$i]['num'] = $num - $i;
 }
 $is_checkbox = false;
 $admin_href = '';
 if ($is_admin) {
     $is_checkbox = true;
     $admin_href = G5_ADMIN_URL . '/qa_config.php';
Esempio n. 6
0
    $stx = trim($stx);
    $sql_search = '';
    if ($stx) {
        $sql_search = " and ( INSTR(fa_subject, '{$stx}') > 0 or INSTR(fa_content, '{$stx}') > 0 ) ";
    }
    if ($page < 1) {
        $page = 1;
    }
    // 페이지가 없으면 첫 페이지 (1 페이지)
    $page_rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_page_rows'];
    $sql = " select count(*) as cnt\r\n                from {$g5['faq_table']}\r\n                where fm_id = '{$fm_id}'\r\n                  {$sql_search} ";
    $total = sql_fetch($sql);
    $total_count = $total['cnt'];
    $total_page = ceil($total_count / $page_rows);
    // 전체 페이지 계산
    $from_record = ($page - 1) * $page_rows;
    // 시작 열을 구함
    $sql = " select *\r\n                from {$g5['faq_table']}\r\n                where fm_id = '{$fm_id}'\r\n                  {$sql_search}\r\n                order by fa_order , fa_id\r\n                limit {$from_record}, {$page_rows} ";
    $result = sql_query($sql);
    for ($i = 0; $row = sql_fetch_array($result); $i++) {
        $faq_list[] = $row;
        if ($stx) {
            $faq_list[$i]['fa_subject'] = search_font($stx, conv_content($faq_list[$i]['fa_subject'], 1));
            $faq_list[$i]['fa_content'] = search_font($stx, conv_content($faq_list[$i]['fa_content'], 1));
        }
    }
    include_once $skin_file;
} else {
    echo '<p>' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.</p>';
}
include_once './_tail.php';
//if ($html > 0) {
//$row[wr_content] = mw_tag_debug($row[wr_content]);
$row[content] = $row[content1] = SECRET_COMMENT;
if (!strstr($row[wr_option], "secret") || $is_admin || $write[mb_id] == $member[mb_id] && $member[mb_id] || $row[mb_id] == $member[mb_id] && $member[mb_id]) {
    $row[content1] = $row[wr_content];
    $row[content] = conv_content($row[wr_content], $html, 'wr_content');
    $row[content] = search_font($stx, $row[content]);
}
//}
// 코멘트 비밀 리플 보이기
if ($row[content] == SECRET_COMMENT) {
    for ($j = $i - 1; $j >= 0; $j--) {
        if ($list[$j][wr_comment] == $row[wr_comment] && $list[$j][wr_comment_reply] == substr($row[wr_comment_reply], 0, strlen($row[wr_comment_reply]) - 1)) {
            if (trim($list[$j][mb_id]) && $list[$j][mb_id] == $member[mb_id]) {
                $row[content] = conv_content($row[wr_content], $html, 'wr_content');
                $row[content] = search_font($stx, $row[content]);
            }
            break;
        }
    }
}
// 코멘트 첨부파일
$file = get_comment_file($bo_table, $row[wr_id]);
if (preg_match("/\\.({$config['cf_movie_extension']})\$/i", $file[0][file])) {
    $tmp = '';
    ob_start();
    echo mw_jwplayer("{$g4[path]}/data/file/{$board[bo_table]}/{$file[0][file]}");
    if (trim($file[0][content])) {
        echo $file[0][content];
    }
    $jwcontent = ob_get_contents();
Esempio n. 8
0
 function qry()
 {
     $this->load->library('querystring');
     $param =& $this->querystring;
     $stx = $param->get('stx');
     $type = $this->uri->segment(5, 'write');
     $page = $this->uri->segment(4, 1);
     if (!$stx) {
         goto_url('/');
     }
     $ori_stx = $stx;
     $member = unserialize(MEMBER);
     // 검색 가능 게시판
     $result = $this->Search_model->search_board($member['mb_level'], $stx);
     $boards = array();
     foreach ($result as $row) {
         $boards[] = $row['bo_table'];
         $levels[$row['bo_table']] = $row['bo_read_level'];
     }
     $config['suffix'] = '/' . $type . $param->output();
     $config['base_url'] = RT_PATH . '/search/qry/page/';
     $config['per_page'] = 20;
     $config['uri_segment'] = 4;
     $offset = ($page - 1) * $config['per_page'];
     $result = $this->Search_model->list_result($type, $stx, $config['per_page'], $offset, $boards);
     $config['total_rows'] = $result['total_count'];
     $this->pagination->initialize($config);
     $list = array();
     if ($type == 'write') {
         // 게시글
         foreach ($result['qry'] as $i => $row) {
             $bo_table = $row['bo_table'];
             $href = RT_PATH . '/board/' . $bo_table . '/view/wr_id/' . $row['wr_id'] . '?sfl=wr_subject.wr_content&stx=' . $ori_stx;
             $row['wr_content'] = preg_replace("/\\s+&nbsp;+/", '', get_text(strip_tags(htmlspecialchars_decode($row['wr_content']))));
             $list[$i] = new stdClass();
             $list[$i]->href = $href;
             $list[$i]->subject = search_font(get_text($row['wr_subject']), $stx);
             $list[$i]->content = $levels[$bo_table] <= $member['mb_level'] ? search_font(cut_str($row['wr_content'], 300), $stx) : '';
             // $list[$i]->name = $row['wr_name'];
             $list[$i]->datetime = substr($row['wr_datetime'], 0, 10);
             $list[$i]->is_comment = FALSE;
             $i++;
         }
     } else {
         // 댓글
         foreach ($result['qry'] as $i => $row) {
             $bo_table = $row['bo_table'];
             $href = RT_PATH . '/board/' . $bo_table . '/view/wr_id/' . $row['wr_id'] . '?sfl=wr_subject.wr_content&stx=' . $ori_stx . '#c_' . $row['co_id'];
             $row['co_content'] = get_text($row['co_content']);
             $list[$i] = new stdClass();
             $list[$i]->href = $href;
             $list[$i]->content = $levels[$bo_table] <= $member['mb_level'] ? search_font(cut_str($row['co_content'], 300), $stx) : '';
             // $list[$i]->name = $row['co_name'];
             $list[$i]->datetime = substr($row['co_datetime'], 0, 10);
             $list[$i]->is_comment = TRUE;
         }
     }
     $head = array('title' => '검색어: ' . get_text(stripslashes($stx)));
     $data = array('stx' => $ori_stx, 'type' => $type, 'list' => $list, 'total_count' => number_format($config['total_rows']), 'paging' => $this->pagination->create_links());
     widget::run('head', $head);
     $this->load->view('main/search', $data);
     widget::run('tail');
 }
Esempio n. 9
0
 $list[$i] = $row;
 //$list[$i][name] = get_sideview($row[mb_id], cut_str($row[wr_name], 20, ''), $row[wr_email], $row[wr_homepage]);
 $tmp_name = get_text(cut_str($row[wr_name], $config[cf_cut_name]));
 // 설정된 자리수 만큼만 이름 출력
 if ($board[bo_use_sideview]) {
     $list[$i][name] = get_sideview($row[mb_id], $tmp_name, $row[wr_email], $row[wr_homepage]);
 } else {
     $list[$i][name] = "<span class='" . ($row[mb_id] ? 'member' : 'guest') . "'>{$tmp_name}</span>";
 }
 // 공백없이 연속 입력한 문자 자르기 (way 보드 참고. way.co.kr)
 //$list[$i][content] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row[wr_content]);
 $list[$i][content] = $list[$i][content1] = "비밀글 입니다.";
 if (!strstr($row[wr_option], "secret") || $is_admin || $write[mb_id] == $member[mb_id] && $member[mb_id] || $row[mb_id] == $member[mb_id] && $member[mb_id]) {
     $list[$i][content1] = $row[wr_content];
     $list[$i][content] = conv_content($row[wr_content], 0, 'wr_content');
     $list[$i][content] = search_font($stx, $list[$i][content]);
 }
 $list[$i][trackback] = url_auto_link($row[wr_trackback]);
 $list[$i][datetime] = substr($row[wr_datetime], 2, 14);
 // 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
 $list[$i][ip] = $row[wr_ip];
 if (!$is_admin) {
     $list[$i][ip] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[wr_ip]);
 }
 $list[$i][is_reply] = false;
 $list[$i][is_edit] = false;
 $list[$i][is_del] = false;
 if ($is_comment_write || $is_admin) {
     if ($member[mb_id]) {
         if ($row[mb_id] == $member[mb_id] || $is_admin) {
             $list[$i][del_link] = "./delete_comment.php?bo_table={$bo_table}&amp;comment_id={$row['wr_id']}&amp;token={$token}&amp;page={$page}" . $qstr;
Esempio n. 10
0
            continue;
        }
        $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
        $list[$i][is_notice] = true;
        $i++;
    }
}
$k = 0;
while ($row = sql_fetch_array($result)) {
    // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
    if ($sca || $stx) {
        $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");
    }
    $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
    if (strstr($sfl, "subject")) {
        $list[$i][subject] = search_font($stx, $list[$i][subject]);
    }
    $list[$i][is_notice] = false;
    //$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
    $list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;
    $i++;
    $k++;
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./board.php?bo_table={$bo_table}" . $qstr . "&amp;page=");
$list_href = '';
$prev_part_href = '';
$next_part_href = '';
if ($sca || $stx) {
    $list_href = "./board.php?bo_table={$bo_table}";
    //if ($prev_spt >= $min_spt)
    $prev_spt = $spt - $config[cf_search_part];
Esempio n. 11
0
 function index($view = FALSE)
 {
     $board =& $this->board;
     $member =& $this->member;
     $wr_field =& $this->wr_field;
     $seg =& $this->seg;
     $param =& $this->param;
     $wr_id = $seg->get('wr_id');
     // 게시물아이디
     $page = $seg->get('page', 1);
     // 페이지
     $qstr = $seg->replace('wr_id') . $param->output();
     $sst = $param->get('sst');
     // 정렬필드
     $sod = $param->get('sod');
     // 정렬순서
     $sfl = $param->get('sfl');
     // 검색필드
     $stx = $param->get('stx');
     // 검색어
     $sca = $param->get('sca');
     // 분류
     $spt = $param->get('spt');
     // 검색 파트
     $js = array('board');
     // JavaScript Files
     if ($member['mb_level'] < $board['bo_list_level']) {
         if (IS_MEMBER) {
             alert('목록을 볼 권한이 없습니다.');
         } else {
             alert("목록을 볼 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/lists' . $qstr));
         }
     }
     // 분류 사용 여부
     $sca_str = $sca ? '?sca=' . $sca : '';
     $category = FALSE;
     if ($board['bo_use_category']) {
         $this->load->helper('category');
         $category = make_category(array('type' => 'bo_' . BO_TABLE, 'id' => 'ca_code', 'code' => $sca, 'lst' => TRUE));
     }
     // 검색 파트 row
     $search_part = $this->config->item('cf_search_part');
     $btn_prev_part = $btn_next_part = '';
     // 분류 선택, 검색어, 검색 파트 적용
     if ($sca || $sfl && $stx || $board['bo_count_write'] > $search_part) {
         if ($stx) {
             $stx = get_text($stx);
         }
         $min_spt = $board['bo_min_wr_num'];
         if (!$spt) {
             $spt = $min_spt;
         }
         $total_count = $this->Board_model->list_count(BO_TABLE, $spt, $sca, $sfl, $stx);
         $prev_spt = $spt - $search_part;
         if ($min_spt && $prev_spt >= $min_spt) {
             $btn_prev_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $prev_spt, $qstr) . '">이전검색</a></li>';
         }
         $next_spt = $spt + $search_part;
         if ($next_spt < 0) {
             $btn_next_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $next_spt, $qstr) . '">다음검색</a></li>';
         }
     } else {
         $total_count = $board['bo_count_write'];
     }
     $config['suffix'] = $qstr;
     $config['base_url'] = RT_PATH . '/board/' . BO_TABLE . '/lists/page/';
     $config['per_page'] = $board['bo_page_rows'];
     $config['total_rows'] = $total_count;
     $config['uri_segment'] = $seg->pos('page');
     // 검색 파트 ADD
     $config['full_tag_open'] = '<ul class="pagination">' . $btn_prev_part;
     $config['full_tag_close'] = $btn_next_part . '</ul>';
     $CI =& get_instance();
     $CI->load->library('pagination', $config);
     // 정렬
     if (!$sst) {
         if ($board['bo_sort_field']) {
             $sst = $board['bo_sort_field'];
         } else {
             $sst = 'wr_num, wr_reply';
             $sod = 'asc';
         }
     } else {
         $sst = preg_match("/^(wr_datetime|wr_hit)\$/i", $sst) ? $sst : FALSE;
     }
     $offset = ($page - 1) * $config['per_page'];
     $result = $this->Board_model->list_result(BO_TABLE, $spt, $sca, $sst, $sod, $sfl, $stx, $config['per_page'], $offset, $wr_field);
     // 사이드 뷰
     if ($board['bo_use_sideview']) {
         $this->load->helper('sideview');
     }
     // 일반 리스트
     $list = $wr_ids = array();
     foreach ($result as $i => $row) {
         $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE);
         $list[$i] = new stdClass();
         $list[$i]->num = $total_count - ($page - 1) * $config['per_page'] - $i;
         $list[$i]->href = $row['href'];
         $list[$i]->wr_id = $row['wr_id'];
         $list[$i]->subject = strpos($sfl, 'subject') ? search_font($row['subject'], $stx) : $row['subject'];
         $list[$i]->comment_cnt = $row['comment_cnt'];
         $list[$i]->name = $row['name'];
         $list[$i]->datetime2 = $row['datetime2'];
         $list[$i]->wr_hit = $row['wr_hit'];
         $list[$i]->ico_reply = $row['ico_reply'];
         $list[$i]->ico_new = $row['ico_new'];
         $list[$i]->ico_hot = $row['ico_hot'];
         $list[$i]->ico_secret = $row['ico_secret'];
         $list[$i]->ico_file = $row['ico_file'];
         $list[$i]->ico_image = $row['ico_image'];
         $list[$i]->ico_movie = $row['ico_movie'];
         $wr_ids[$row['wr_id']] = $i;
     }
     // Extra
     if ($board['bo_use_extra'] && $wr_ids) {
         $result = $this->Board_model->get_extra(BO_TABLE, array_keys($wr_ids));
         foreach ($result as $row) {
             $i = $wr_ids[$row['wr_id']];
             foreach ($row as $fld => $val) {
                 $list[$i]->{$fld} = $val;
             }
         }
     }
     // 공지사항 리스트
     if (!$sca && !$stx) {
         $notice = explode(',', trim($board['bo_notice']));
         if ($notice[0]) {
             $result = $this->Board_model->list_notice(BO_TABLE, $notice, $wr_field);
             $list_nt = array();
             foreach ($result as $i => $row) {
                 $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE);
                 $list_nt[$i] = new stdClass();
                 $list_nt[$i]->href = $row['href'];
                 $list_nt[$i]->wr_id = $row['wr_id'];
                 $list_nt[$i]->subject = $row['subject'];
                 $list_nt[$i]->comment_cnt = $row['comment_cnt'];
                 $list_nt[$i]->name = $row['name'];
                 $list_nt[$i]->datetime2 = $row['datetime2'];
                 $list_nt[$i]->wr_hit = $row['wr_hit'];
             }
         }
     }
     // 리스트 버튼
     $btn_list = '';
     if ($sfl && $stx) {
         $btn_list = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $sca_str . '" class="btn btn-warning">목록</a>';
     }
     // 글쓰기 버튼
     $btn_write = '';
     if ($board['bo_use_private'] && !IS_ADMIN) {
         $btn_write = FALSE;
     } elseif ($member['mb_level'] >= $board['bo_write_level']) {
         $btn_write = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/write' . $sca_str . '" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span> 글쓰기</a>';
     }
     // RSS 버튼
     $btn_rss = '';
     if ($board['bo_use_rss']) {
         $btn_rss = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/rss" class="btn btn-xs btn-warning" target="_blank">RSS</a>';
     }
     // 관리자 버튼
     $btn_admin = '';
     if (SU_ADMIN) {
         $btn_admin = '<a href="' . RT_PATH . '/' . ADM_F . '/board/form/u/' . BO_TABLE . '" class="btn btn-xs btn-primary" target="_blank">관리자</a>';
     } else {
         if (IS_ADMIN) {
             $btn_admin = '<button type="button" class="btn btn-xs btn-primary" onclick="board_admin();">관리자</button>';
         }
     }
     // 관리자 체크박스 및 버튼 표시xsxs
     $btn_chkbox = '';
     if (IS_ADMIN) {
         $btn_chkbox = '<button type="button" class="btn btn-danger" onclick="select_delete();">선택삭제</button>';
         if (SU_ADMIN || IS_ADMIN == 'group') {
             $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'copy\');">선택복사</button>';
             $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'move\');">선택이동</button>';
         }
     }
     // 정렬 링크
     $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'], 'sca' => $sca);
     $data = array('total_count' => $total_count, 'category' => $category, 'btn_list' => $btn_list, 'btn_write' => $btn_write, 'btn_rss' => $btn_rss, 'btn_admin' => $btn_admin, 'btn_chkbox' => $btn_chkbox, 'wr_id' => $wr_id, 'sca' => $sca, 'sfl' => $sfl, 'stx' => $stx, 'list' => $list, 'list_nt' => isset($list_nt) ? $list_nt : array(), 'paging' => $CI->pagination->create_links(), 'sort_datetime' => $param->sort('wr_datetime', 'desc'), 'sort_hit' => $param->sort('wr_hit', 'desc'));
     if ($view) {
         $this->load->view('board/' . $board['bo_skin'] . '/list', $data);
     } else {
         // JavaScript Load
         if (IS_ADMIN) {
             $js[] = 'board_check';
         }
         if ($board['bo_use_sideview']) {
             $js[] = 'sideview';
         }
         if ($board['bo_use_category']) {
             $js[] = 'category';
         }
         widget::run('head', $head);
         $this->load->view('board/' . $board['bo_skin'] . '/list', $data);
         widget::run('tail', array('js' => $js));
     }
 }
Esempio n. 12
0
 function index()
 {
     $board =& $this->board;
     $member =& $this->member;
     $seg =& $this->seg;
     $param =& $this->param;
     $wr_id = $seg->get('wr_id');
     // 게시물아이디
     $qstr = $seg->output();
     $dqstr = $seg->replace('wr_id') . $param->output();
     $stx = $param->get('stx');
     // 검색어
     $sfl = $param->get('sfl');
     // 검색필드
     $sca = $param->get('sca');
     // 분류
     $js = array('board');
     // JavaScript Files
     if ($wr_id) {
         $write =& $this->write;
         if (!isset($write['wr_id'])) {
             alert('글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.', 'board/' . BO_TABLE);
         }
         // 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면
         if ($member['mb_level'] < $board['bo_read_level']) {
             if (IS_MEMBER) {
                 alert('글을 읽을 권한이 없습니다.');
             } else {
                 alert('글을 읽을 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.', 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/view' . $qstr));
             }
         }
         // 자신의 글 and 관리자가 아니라면 비밀글 체크
         if (!(IS_MEMBER && $write['mb_id'] && $write['mb_id'] == $member['mb_id']) && !IS_ADMIN) {
             if (strpos($write['wr_option'], 'secret') !== FALSE) {
                 $is_owner = FALSE;
                 if ($write['wr_reply'] && IS_MEMBER) {
                     // 자신의 비밀글의 답변이라면 통과
                     $row = $this->Board_model->is_owner(BO_TABLE, $write['wr_num']);
                     if ($row['mb_id'] == $member['mb_id']) {
                         $is_owner = TRUE;
                     }
                 }
                 $ss_name = 'ss_secret_' . BO_TABLE . '_' . $write['wr_num'];
                 if (!$is_owner) {
                     // 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 비밀번호를 묻지 않습니다.
                     // 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면
                     if (!$this->session->userdata($ss_name)) {
                         goto_url('board/' . BO_TABLE . '/password/w/s/wr_id/' . $wr_id . $dqstr);
                     }
                 }
                 $this->session->set_userdata($ss_name, TRUE);
             }
         }
         // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음
         $ss_name = 'ss_view_' . BO_TABLE . '_' . $wr_id;
         if (!$this->session->userdata($ss_name)) {
             $this->Board_model->hit_update(BO_TABLE, $wr_id);
             $this->session->set_userdata($ss_name, TRUE);
         }
     } else {
         goto_url('board/' . BO_TABLE);
     }
     // IP 표시
     $is_ip_view = $board['bo_use_ip_view'];
     if (IS_ADMIN) {
         $is_ip_view = TRUE;
         $ip = $write['wr_ip'];
     } else {
         // 관리자가 아니라면 IP 주소를 감춘후 보여줍니다.
         $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $write['wr_ip']);
     }
     if ($stx) {
         $stx = get_text($stx);
     }
     // 최고, 그룹관리자라면 글 복사, 이동 버튼
     $btn_admin = '';
     if ($write['wr_reply'] == '' && (IS_ADMIN == 'super' || IS_ADMIN == 'group')) {
         $start = "post_win('mvcp', '_board/movecopy', {'is_admin':'" . IS_ADMIN . "','bo_table':'" . BO_TABLE . "','wr_id':'" . $wr_id . "','sw':'";
         $end = "'}, 'left=50, top=50, width=500, height=550, scrollbars=1');";
         $btn_admin = '<span class="btn-group">';
         $btn_admin .= "<button type='button' class='btn btn-default' onclick=\"" . $start . "copy" . $end . "\">복사</button>";
         $btn_admin .= "<button type='button' class='btn btn-default' onclick=\"" . $start . "move" . $end . "\">이동</button>";
         $btn_admin .= '</span> ';
     }
     // 목록 버튼
     $btn_list = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/lists" . $dqstr . "' class='btn btn-warning'>목록</a>";
     // 글쓰기 & 답변 버튼
     $btn_write = $btn_reply = '';
     if ($board['bo_use_private'] && !IS_ADMIN) {
         $btn_write = $btn_reply = FALSE;
     } else {
         if ($member['mb_level'] >= $board['bo_write_level']) {
             $btn_write = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write" . ($sca ? '?sca=' . $sca : '') . "' class='btn btn-primary'><span class='glyphicon glyphicon-pencil'></span> 글쓰기</a>";
         }
         if ($member['mb_level'] >= $board['bo_reply_level']) {
             $btn_reply = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write/w/r" . $qstr . "' class='btn btn-info'>답변</a>";
         }
     }
     // 수정 & 삭제 버튼
     $btn_update = $btn_delete = '';
     // 로그인중이고 자신의 글이라면 또는 관리자라면 비밀번호를 묻지 않고 바로 수정, 삭제 가능
     if (IS_MEMBER && $member['mb_id'] == $write['mb_id'] || IS_ADMIN) {
         $btn_update = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write/w/u" . $qstr . "' class='btn btn-info'>수정</a>";
         $btn_delete = "<button type='button' class='btn btn-danger' onclick=\"javascript:post_send('_trans/board_write/delete', {bo_table:'" . BO_TABLE . "', wr_id:'" . $wr_id . "', is_admin:'" . IS_ADMIN . "', qstr:'" . $dqstr . "'}, true);\">삭제</button>";
     } else {
         if (!$write['mb_id']) {
             // 회원이 쓴 글이 아니라면
             $btn_update = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/password/w/u" . $qstr . "' class='btn btn-info'>수정</a>";
             $btn_delete = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/password/w/d" . $qstr . "' class='btn btn-danger'>삭제</a>";
         }
     }
     $btn_prev = $btn_next = '';
     if (!$board['bo_use_list_view']) {
         $pn = $this->Board_model->prev_next_link(BO_TABLE, $write['wr_num'], $write['wr_reply'], $sca, $sfl, $stx);
         // 이전글 링크
         $prev = $pn['prev'];
         if ($prev['wr_id']) {
             $prev_wr_subject = cut_str(get_text($prev['wr_subject']), 255);
             $btn_prev = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/view" . $seg->replace('wr_id', $prev['wr_id']) . "' title='" . $prev_wr_subject . "'>&larr; 이전글</a>";
         }
         // 다음글 링크
         $next = $pn['next'];
         if ($next['wr_id']) {
             $next_wr_subject = cut_str(get_text($next['wr_subject']), 255);
             $btn_next = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/view" . $seg->replace('wr_id', $next['wr_id']) . "' title='" . $next_wr_subject . "'>다음글 &rarr;</a>";
         }
     }
     // 버튼s
     $link_btns = $btn_admin . '<span class="btn-group">' . $btn_list . $btn_update . $btn_delete . $btn_reply . $btn_write . '</span>';
     // 전체목록보이기
     $list_view = FALSE;
     if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view']) {
         $list_view = TRUE;
     }
     // 사이드 뷰
     if ($board['bo_use_sideview']) {
         $this->load->helper('sideview');
     }
     // 가공
     $view = get_convert($write, $board, 255, $qstr);
     if (strpos($sfl, 'subject')) {
         $view['subject'] = search_font($view['subject'], $stx);
     }
     // 이미지 리사이즈
     if ($write['wr_count_image'] > 0) {
         define('RESIZE_WIDTH', $board['bo_image_width']);
         $this->load->helper('resize');
         $view['wr_content'] = resize_content($view['wr_content']);
     }
     $is_editor = strpos($view['wr_option'], 'editor') !== FALSE ? TRUE : FALSE;
     $view['content'] = conv_content($view['wr_content'], $is_editor);
     if (strpos($sfl, 'content')) {
         $view['content'] = search_font($view['content'], $stx);
     }
     // SyntaxHighlighter
     $is_syntax = FALSE;
     if ($board['bo_use_syntax'] && $is_editor) {
         $this->load->config('cf_syntax');
         $brush_js = $this->config->item('brush_js');
         preg_match_all("/brush: (" . implode('|', array_keys($brush_js)) . ")/i", $view['content'], $match);
         $match = array_unique($match[1]);
         if ($match) {
             $is_syntax = TRUE;
             // 있을 때
             $view['content'] = preg_replace_callback('/(<pre class="brush:[^>]+>)([\\s\\S]+?)(<\\/pre>)/i', create_function('$content', 'return $content[1]
                         .str_ireplace("<br>", "\\n",strip_tags(str_ireplace("</p>", "<br>", $content[2]), "<br>"))
                         .$content[3];'), $view['content']);
             $js[] = 'syntax/shCore';
             foreach ($match as $brush) {
                 $js[] = 'syntax/' . $brush_js[$brush];
             }
         }
     }
     // 댓글 출력 여부
     $is_comment = FALSE;
     if ($board['bo_use_comment'] && strpos($write['wr_option'], 'nocomt') === FALSE) {
         $is_comment = TRUE;
     }
     $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'] . ' > ' . strip_tags($view['subject']), 'sca' => $sca);
     $data = array('subject' => $view['subject'], 'content' => $view['content'], 'name' => $view['name'], 'ip' => $is_ip_view ? '(' . $ip . ')' : '', 'datetime' => date('y-m-d H:i', strtotime($view['wr_datetime'])), 'hit' => number_format($view['wr_hit']), 'btn_prev' => $btn_prev, 'btn_next' => $btn_next, 'link_btns' => $link_btns, 'btn_sns' => $board['bo_use_sns'] ? sns_post(BO_TABLE, $wr_id, $view['subject'], $view['content']) : '', 'is_comment' => $is_comment, 'is_syntax' => $is_syntax, 'wr_id' => $wr_id, 'qstr' => $qstr);
     // JavaScript Load
     if ($board['bo_use_sideview']) {
         $js[] = 'sideview';
     }
     if (!IS_MEMBER && $is_comment) {
         $js[] = 'md5';
         $js[] = 'kcaptcha';
     }
     // Extra
     if ($board['bo_use_extra']) {
         $data = array_merge($data, $this->Board_model->get_extra(BO_TABLE, $wr_id));
     }
     widget::run('head', $head);
     $this->load->view('board/' . $board['bo_skin'] . '/view', $data);
     if ($list_view) {
         if (IS_ADMIN) {
             $js[] = 'board_check';
         }
         if ($board['bo_use_category']) {
             $js[] = 'category';
         }
         widget::run('_board/lists', TRUE);
     }
     widget::run('tail', array('js' => $js));
 }