<?php

/*
=====================================================================

  프로젝트 이름 : 피리 카페 심플

  만든사람 : 피리 PIREE ( tosports@naver.com )

  홈페이지 : https://piree.kr/nett_dev

  작성날짜 : 2024년 04월 25일 목요일 오전 02시 54분 / 흐림, 10.3, 일교차 주의, 21, 10, 4%, 20%, 1.6ms / 보통, 26, 23, 0.005

  저 작 권 : Copyright ⓒ 2024 피리 piree.kr All right reserved
              그누보드 외에 추가된 소스는~
              만든사람의 허락없이 무단으로 사용할수 없습니다.
              사용하고자 할 경우 만든사람의 허락을 받아야 합니다.
              http://.piree.kr 에 문의해 주세요.

=====================================================================
 피리 카페 심플 > 프로그램 > 피리 카페 관리 > 내 카페 > 게시판 > 댓글 보기
=====================================================================

*/

  include_once('./_common.php');

  IF ( !$is_member )
  {
    alert_close('회원만 조회하실 수 있습니다.');
  }

  include_once(G5_CAPTCHA_PATH.'/captcha.lib.php' );

  include_once( piree__path($piree_prog_a[770000]['num'], 'form.lib.php') );

  include_once( piree__path($piree_prog_a[770099]['num'], '_CAFE.INFO.CHECK.inc.php') );

  $captcha_html = "";

  IF ( $board_cate_list_a[$board_cate_n]['bca_comment_level'] < 2 )
  {
    $captcha_html = captcha_html('_comment');
  }

  $c_id = isset($_GET['c_id']) ? clean_xss_tags($_GET['c_id'], 1, 1) : '';

  $c_wr_content = '';

  $is_comment_write = false;

  IF ( $cafe_member_a['cafe_mem_level_n'] >= $board_cate_list_a[$board_cate_n]['bca_comment_level'] )
  {
    $is_comment_write = true;
  }

  @include_once($board_cate_list_a[$board_cate_n]['board_skin_p'].'/view_comment.head.skin.php' );

  $list = array();

//$sql_select = " select * from `". $piree['cafe_article'] ."` where wr_parent = '". $wr_id}' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply ";
  $sql_select  = "SELECT * FROM `". $piree['cafe_article'] ."` ";
  $sql_select .= "WHERE `wr_parent` = '". $wr_id ."' AND `wr_is_comment` = '1' ORDER BY `wr_comment`, `wr_comment_reply`";
  $result = sql_query($sql_select);

  FOR ( $loop_n=0; $row=sql_fetch_array($result); $loop_n++ )
  {

      $list[$loop_n] = $row;

//$list[$loop_n]['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_cate_list_a[$board_cate_n]['bca_use_sideview'] )
      {
          $list[$loop_n]['name'] = get_sideview($row['mb_id'], $tmp_name, $row['wr_email'], $row['wr_homepage']);
      }
      ELSE
      {
          $list[$loop_n]['name'] = '<span class="'. ( $row['mb_id'] ? 'member' : 'guest' ) .'">'. $tmp_name .'</span>';
      }

// 입력한 문자 자르기 (way 보드 참고. way.co.kr)
//$list[$loop_n]['content'] = eregi_replace("[^ \n<>]{130}", "\\0\n", $row['wr_content']);

      $list[$loop_n]['content'] = $list[$loop_n]['content1'] = '비밀글 입니다.';

      IF ( !strstr($row['wr_option'], 'secret') || piree_cafe_auth_get() > 0 || ( $write['mb_id'] === $member['mb_id'] && $member['mb_id'] ) || ( $row['mb_id']=== $member['mb_id'] && $member['mb_id'] ) )
      {

          $list[$loop_n]['content1'] = $row['wr_content'];
          $list[$loop_n]['content'] = conv_content($row['wr_content'], 0, 'wr_content');
          $list[$loop_n]['content'] = search_font($stx, $list[$loop_n]['content']);

      }

      $list[$loop_n]['datetime'] = substr($row['wr_datetime'], 2, 14);

      $list[$loop_n]['ip'] = $row['wr_ip'];

      IF ( !piree_cafe_auth_get() )
      {
          $list[$loop_n]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['wr_ip']);
      }

      $list[$loop_n]['is_reply'] = false;

      $list[$loop_n]['is_edit'] = false;

      $list[$loop_n]['is_del']  = false;

      $list[$loop_n]['del_link'] = '';

      IF ( $is_comment_write || piree_cafe_auth_get() > 0 )
      {

          $token = '';

          IF ( $member['mb_id'] )
          {

              IF ( $row['mb_id'] === $member['mb_id'] || piree_cafe_auth_get() > 0 )
              {

                  set_session('ss_delete_comment_'. $row['wr_id'].'_token', $token = uniqid(time()));

                  $list[$loop_n]['del_link'] = go_piree_cafe_board('piree.cafe.board.comment_delete.php', $piree_cafe_n, $board_cate_n) .'&amp;bo_table='. $piree['cafe_board_code']. '&amp;comment_id='. $row['wr_id']. '&amp;token='. $token. '&amp;page='. $page.$qstr;

                  $list[$loop_n]['is_edit'] = true;

                  $list[$loop_n]['is_del'] = true;

              }

          }

          IF ( strlen($row['wr_comment_reply']) < 5 )
          {
              $list[$loop_n]['is_reply'] = true;
          }

      }

// 수정, 삭제 불가 / 05.05.22
      IF ( $loop_n > 0 && !piree_cafe_auth_get() )
      {

          IF ( $row['wr_comment_reply'] )
          {

              $tmp_comment_reply = substr($row['wr_comment_reply'], 0, strlen($row['wr_comment_reply']) - 1);

              IF ( $tmp_comment_reply == $list[$loop_n-1]['wr_comment_reply'] )
              {

                  $list[$loop_n-1]['is_edit'] = false;

                  $list[$loop_n-1]['is_del']  = false;

              }

          }

      }

// 수정, 삭제 불가 / 05.05.22

  }

  IF ( piree_cafe_auth_get() > 0 )
  {
    $comment_min = $comment_max = 0;
  }
  ELSE
  {
    $comment_min = (int)$board_cate_list_a[$board_cate_n]['bca_comment_min'];
    $comment_max = (int)$board_cate_list_a[$board_cate_n]['bca_comment_max'];
  }

  $comment_action_url = https_url_get( piree__url($piree_prog_a[770099]['num'], 'piree.cafe.board.comment_write_update.php') );

  $comment_common_url = go_piree_cafe_board('', $piree_cafe_n, $board_cate_n, $wr_id) .'&'. clean_query_string($_SERVER['QUERY_STRING']);

  @include_once($board_cate_list_a[$board_cate_n]['board_skin_p'] .'/piree.cafe.comment_view.skin.php' );

  @include_once($board_cate_list_a[$board_cate_n]['board_skin_p'] .'/piree.cafe.comment_view.tail.skin.php' );

?>
