<?php

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

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

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

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

  작성날짜 : 2024년 04월 26일 금요일 오전 01시 20분 / 맑음, 11.6, 일교차 주의, 25, 10, 0%, 0%, 1.0ms / 나쁨, 40, 34, 0.012

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

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

*/

//('G5_CAPTCHA', true);

  include_once('./_common.php');

  IF ( !$is_member )
  {
    alert_close('회원만 댓글 작성/수정할 수 있습니다.');
  }

  $comment_token = trim(get_session('ss_comment_token'));

  set_session('ss_comment_token', '');

  IF ( empty($_POST['token']) || !$comment_token || $comment_token != $_POST['token'] )
  {
    alert('올바른 방법으로 이용해 주십시오.');
  }

  IF ( substr_count($wr_content, "&#") > 50 )
  {
    alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.');
  }

//(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') );

  $w                = isset($_POST['w'])                ? clean_xss_tags($_POST['w'])                      : '';
  $bo_table         = isset($_POST['bo_table'])         ? clean_xss_tags($_POST['bo_table'])               : '';
  $wr_name          = isset($_POST['wr_name'])          ? clean_xss_tags(trim($_POST['wr_name']))          : '';
  $wr_secret        = isset($_POST['wr_secret'])        ? clean_xss_tags($_POST['wr_secret'])              : '';
  $wr_1             = isset($_POST['wr_1'])             ? $_POST['wr_1']                                   : '';
  $wr_2             = isset($_POST['wr_2'])             ? $_POST['wr_2']                                   : '';
  $wr_3             = isset($_POST['wr_3'])             ? $_POST['wr_3']                                   : '';
  $wr_4             = isset($_POST['wr_4'])             ? $_POST['wr_4']                                   : '';
  $wr_5             = isset($_POST['wr_5'])             ? $_POST['wr_5']                                   : '';
  $wr_6             = isset($_POST['wr_6'])             ? $_POST['wr_6']                                   : '';
  $wr_7             = isset($_POST['wr_7'])             ? $_POST['wr_7']                                   : '';
  $wr_8             = isset($_POST['wr_8'])             ? $_POST['wr_8']                                   : '';
  $wr_9             = isset($_POST['wr_9'])             ? $_POST['wr_9']                                   : '';
  $wr_10            = isset($_POST['wr_10'])            ? $_POST['wr_10']                                  : '';
  $wr_facebook_user = isset($_POST['wr_facebook_user']) ? clean_xss_tags($_POST['wr_facebook_user'], 1, 1) : '';
  $wr_twitter_user  = isset($_POST['wr_twitter_user'])  ? clean_xss_tags($_POST['wr_twitter_user'], 1, 1)  : '';
  $wr_homepage      = isset($_POST['wr_homepage'])      ? clean_xss_tags($_POST['wr_homepage'], 1, 1)      : '';

  $wr_subject = '';

  $wr_email = '';

  $reply_array = array();

  IF ( !empty($_POST['wr_email']) )
  {
    $wr_email = get_email_address(trim($_POST['wr_email']));
  }

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

  IF ( $w == "c" || $w == "cu" )
  {
    IF ( $cafe_member_a['cafe_mem_level_n'] < $board_cate_list_a[$board_cate_n]['bca_comment_level'] )
    {
      alert('댓글을 쓸 권한이 없습니다.');
    }
  }
  ELSE
  {
    alert('w 값이 제대로 넘어오지 않았습니다.');
  }

// 검사
//.00.15 - 댓글 수정시 연속 게시물 등록 메시지로 인한 오류 수정
  IF  ($w == 'c' && !piree_cafe_auth_get() && isset($_SESSION['ss_datetime']) && $_SESSION['ss_datetime'] >= ( G5_SERVER_TIME - $config['cf_delay_sec'] ) )
  {
    alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.');
  }

  set_session('ss_datetime', G5_SERVER_TIME);

  $wr = get_write($piree['cafe_article'], $wr_id);

  IF ( empty($wr['wr_id']) )
  {
    alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다.");
  }

//"인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리
// 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다.
// ( !trim($_POST["wr_content"])) die ("내용을 입력하여 주십시오.");
  $post_wr_password = '';

  $mb_id = $member['mb_id'];

//.00.13 - 실명 사용일때 댓글에 닉네임으로 입력되던 오류를 수정
  $wr_name = addslashes(clean_xss_tags($board_cate_list_a[$board_cate_n]['bca_use_name'] ? $member['mb_name'] : $member['mb_nick']));

  $wr_password = '';

  $wr_email = addslashes($member['mb_email']);

  $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));

  SWITCH ( $w )
  {

    CASE 'c' :

/*

      IF ( $member[mb_point] + $board[bo_comment_point] < 0 && !piree_cafe_auth_get() )
      {
          alert('보유하신 포인트('.number_format($member[mb_point]).')가 없거나 모자라서 댓글쓰기('.number_format($board[bo_comment_point]).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.');
      }

*/

      $tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0;

      IF ( $tmp_point + $board_cate_a['bca_comment_point'] < 0 && !piree_cafe_auth_get() )
      {
          alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 댓글쓰기('.number_format($board_cate_a['bca_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.');
      }

      IF ( $comment_id )
      {

        $reply_array = get_write($piree['cafe_article'], $comment_id, true);

        IF ( !$reply_array['wr_id'] )
        {
          alert('답변할 댓글이 없습니다.\\n\\n답변하는 동안 댓글이 삭제되었을 수 있습니다.');
        }

        IF ( $wr['wr_parent'] != $reply_array['wr_parent'] )
        {
          alert('댓글을 등록할 수 없습니다.');
        }

        $tmp_comment = $reply_array['wr_comment'];

        IF ( strlen($reply_array['wr_comment_reply']) == 5 )
        {
          alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 5단계 까지만 가능합니다.');
        }

        $reply_len = strlen($reply_array['wr_comment_reply']) + 1;

        IF ( $board_cate_a['bca_reply_order'] ) 
        {

          $begin_reply_char = 'A';

          $end_reply_char = 'Z';

          $reply_number = +1;

          $sql_select  = "SELECT MAX(SUBSTRING(`wr_comment_reply`, ". $reply_len .", 1)) AS `reply` ";
          $sql_select .= "FROM `". $piree['cafe_article'] ."` ";
          $sql_select .= "WHERE `wr_parent` = '". $wr_id ."' AND `wr_comment` = '". $tmp_comment ."' AND SUBSTRING(`wr_comment_reply`, ". $reply_len .", 1) <> ''";

        }
        ELSE
        {

          $begin_reply_char = 'Z';

          $end_reply_char = 'A';

          $reply_number = -1;

          $sql_select  = "SELECT MIN(SUBSTRING(`wr_comment_reply`, ". $reply_len .", 1)) AS `reply` ";
          $sql_select .= "FROM `". $piree['cafe_article'] ."` ";
          $sql_select .= "WHERE `wr_parent` = '". $wr_id ."' AND `wr_comment` = '". $tmp_comment ."' AND SUBSTRING(`wr_comment_reply`, ". $reply_len .", 1) <> ''";

        }

        IF ( $reply_array['wr_comment_reply'] )
        {
          $sql_select .= " AND `wr_comment_reply` LIKE '". $reply_array['wr_comment_reply'] ."%'";
        }

        $row = sql_fetch($sql_select);

        IF ( !$row['reply'] )
        {

          $reply_char = $begin_reply_char;

        }
        ELSE IF ( $row['reply'] == $end_reply_char )
        {

// A~Z은_26__입니다.

          alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.');

        }
        ELSE
        {

          $reply_char = chr(ord($row['reply']) + $reply_number);

        }

        $tmp_comment_reply = $reply_array['wr_comment_reply'] . $reply_char;

      }
      ELSE
      {

        $sql_select  = "SELECT MAX(`wr_comment`) AS `max_comment` FROM `". $piree['cafe_article'] ."` ";
        $sql_select .= "WHERE `wr_parent` = '". $wr_id ."' AND `wr_is_comment` = '1'";
        $row = sql_fetch($sql_select);

//$row[max_comment] -= 1;

        $row['max_comment'] += 1;

        $tmp_comment = $row['max_comment'];

        $tmp_comment_reply = '';

      }

      $wr_subject = get_text(stripslashes($wr['wr_subject']));

      $sql_insert  = "INSERT INTO `". $piree['cafe_article'] ."` SET ";
      $sql_insert .= "`ca_name`          = '". $wr['ca_name'] ."', ";
      $sql_insert .= "`wr_option`        = '". $wr_secret ."', ";
      $sql_insert .= "`wr_num`           = '". $wr['wr_num'] ."', ";
      $sql_insert .= "`wr_reply`         = '', ";
      $sql_insert .= "`wr_parent`        = '". $wr_id ."', ";
      $sql_insert .= "`wr_is_comment`    = '1', ";
      $sql_insert .= "`wr_comment`       = '". $tmp_comment ."', ";
      $sql_insert .= "`wr_comment_reply` = '". $tmp_comment_reply ."', ";
      $sql_insert .= "`wr_subject`       = '', ";
      $sql_insert .= "`wr_content`       = '". $wr_content ."', ";
      $sql_insert .= "`mb_id`            = '". $mb_id ."', ";
      $sql_insert .= "`wr_password`      = '". $wr_password ."', ";
      $sql_insert .= "`wr_name`          = '". $wr_name ."', ";
      $sql_insert .= "`wr_email`         = '". $wr_email ."', ";
      $sql_insert .= "`wr_homepage`      = '". $wr_homepage ."', ";
      $sql_insert .= "`wr_datetime`      = '". G5_TIME_YMDHIS ."', ";
      $sql_insert .= "`wr_last`          = '', ";
      $sql_insert .= "`wr_ip`            = '". $_SERVER['REMOTE_ADDR'] ."', ";
      $sql_insert .= "`wr_1`             = '". $wr_1 ."', ";
      $sql_insert .= "`wr_2`             = '". $wr_2 ."', ";
      $sql_insert .= "`wr_3`             = '". $wr_3 ."', ";
      $sql_insert .= "`wr_4`             = '". $wr_4 ."', ";
      $sql_insert .= "`wr_5`             = '". $wr_5 ."', ";
      $sql_insert .= "`wr_6`             = '". $wr_6 ."', ";
      $sql_insert .= "`wr_7`             = '". $wr_7 ."', ";
      $sql_insert .= "`wr_8`             = '". $wr_8 ."', ";
      $sql_insert .= "`wr_9`             = '". $wr_9 ."', ";
      $sql_insert .= "`wr_10`            = '". $wr_10 ."'";

      $sql_insert .= ", ";
      $sql_insert .= "`wr_pi_piree_cafe_n`  = '". $piree_cafe_n ."', ";
      $sql_insert .= "`wr_pi_board_cate_n`  = '". $board_cate_n ."', ";
      $sql_insert .= "`wr_pi_piree_cafe_s`  = '". $piree_cafe_name_s ."', ";
      $sql_insert .= "`wr_pi_board_cate_s`  = '". $board_cate_list_a[$board_cate_n]['board_cate_path_s'] ."'";

      IF ( !sql_query($sql_insert) )
      {

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_piree_cafe_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_board_cate_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_piree_cafe_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_board_cate_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        IF ( !sql_query($sql_insert) )
        {

          alert("댓글을 등록하지 못했습니다.");
        }

      }

      $comment_id = sql_insert_id();

      $sql_select  = "SELECT COUNT(*) FROM `". $piree['cafe_article'] ."` ";
      $sql_select .= "WHERE `wr_parent` = '". $wr_id ."' AND `wr_is_comment` = '1'";
      $comment_t = (int)sql_efv($sql_select);

      $sql_update  = "UPDATE `". $piree['cafe_article'] ."` SET ";
      $sql_update .= "`wr_comment` = '". $comment_t ."', ";
      $sql_update .= "`wr_last`    = '".G5_TIME_YMDHIS."' ";
      $sql_update .= "WHERE `wr_id` = '". $wr_id ."'";
      sql_query($sql_update);

      $sql_insert  = "INSERT INTO `". $g5['board_new_table'] ."` SET ";
      $sql_insert .= "`bo_table`    = '". $piree['cafe_board_code'] ."', ";
      $sql_insert .= "`wr_id`       = '". $comment_id ."', ";
      $sql_insert .= "`wr_parent`   = '". $wr_id ."', ";
      $sql_insert .= "`bn_datetime` = '". G5_TIME_YMDHIS ."', ";
      $sql_insert .= "`mb_id`       = '". $member['mb_id'] ."', ";

      $sql_insert .= "`bn_pi_piree_cafe_n`  = '". $piree_cafe_n ."', ";
      $sql_insert .= "`bn_pi_board_cate_n`  = '". $board_cate_n ."', ";
      $sql_insert .= "`bn_pi_piree_cafe_s`  = '". $piree_cafe_name_s ."', ";
      $sql_insert .= "`bn_pi_board_cate_s`  = '". $board_cate_list_a[$board_cate_n]['board_cate_path_s'] ."'";

      IF ( !sql_query($sql_insert) )
      {

        $sql_alter = "ALTER TABLE `". $g5['board_new_table'] ."` ADD `bn_pi_piree_cafe_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $g5['board_new_table'] ."` ADD `bn_pi_board_cate_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $g5['board_new_table'] ."` ADD `bn_pi_piree_cafe_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $g5['board_new_table'] ."` ADD `bn_pi_board_cate_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        IF ( !sql_query($sql_insert) )
        {

          alert("새글 테이블에 게시글을 등록하지 못했습니다.");
        }

      }

      $sql_update  = "UPDATE `". $g5['board_table'] ."` SET ";
      $sql_update .= "`bo_count_comment` = `bo_count_comment` + 1 ";
      $sql_update .= "`WHERE `bo_table` = '". $piree['cafe_board_code'] ."'";
      sql_query($sql_update);

      $point_geant_title_s = $board_cate_a['bca_subject'] ." ". $wr_id ."-". $comment_id ." 댓글쓰기";

      insert_point($member['mb_id'], $board_cate_a['bca_comment_point'], $point_geant_title_s, $piree['cafe_board_code'], $comment_id, '댓글');

      IF ( $config['cf_email_use'] && $board_cate_a['bca_use_email'] )
      {

        $super_admin = get_admin('super');

        $mail_content  = "원글\n". $wr['wr_subject'] ."\n\n\n";
        $mail_content .= "댓글\n". $wr_content;

        $wr_content = nl2br(get_text(stripslashes($mail_content)));

        $warr = array(''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'댓글 ', 'cu'=>'댓글 수정');

        $str = $warr[$w];

        $subject = '['.$config['cf_title'].'] '.$board_cate_a['bca_subject'].' 게시판에 '.$str.'글이 올라왔습니다.';

//.00.15 - 메일로 보내는 댓글의 바로가기 링크 수정
        $link_url = go_piree_cafe_board('', $piree_cafe_n, $board_cate_n, $wr_id) .'&amp;'. $qstr ."#c_". $comment_id;

        include_once(G5_LIB_PATH.'/mailer.lib.php' );

        ob_start();
        include_once ('./write_update_mail.php' );
        $content = ob_get_contents();
        ob_end_clean();

        $array_email = array();

        IF ( $config['cf_email_wr_super_admin'] )
        {
          $array_email[] = $super_admin['mb_email'];
        }

        IF ( $config['cf_email_wr_write'] )
        {
          $array_email[] = $wr['wr_email'];
        }

        IF ( $config['cf_email_wr_comment_all'] )
        {

          $sql_select  = "SELECT DISTINCT `wr_email` from `". $piree['cafe_article'] ."` ";
          $sql_select .= "WHERE `wr_email` NOT IN ('". $wr['wr_email'] ."', '". $member['mb_email'] ."', '') AND `wr_parent` = '". $wr_id ."'";
          $result = sql_query($sql_select);

          FOR ( $loop_n=0; $row=sql_fetch_array($result); $loop_n++ )
          {
             $array_email[] = $row['wr_email'];
          }

        }

        $unique_email = array_unique($array_email);

        $unique_email = array_values($unique_email);

        FOR ( $i=0; $i<count($unique_email); $i++ )
        {

          mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);

        }

      }

      include_once("./piree.cafe.board.write_comment_update.sns.php");

      IF ( $wr_facebook_user || $wr_twitter_user )
      {

          $sql_update  = "UPDATE `". $piree['cafe_article'] ."` SET ";
          $sql_update .= "wr_facebook_user = '". $wr_facebook_user ."', ";
          $sql_update .= "wr_twitter_user  = '". $wr_twitter_user ."' ";
          $sql_update .= "where wr_id = '". $comment_id ."'";
          sql_query($sql);

      }

    BREAK;

    CASE 'cu' :

      $sql_select  = "SELECT `mb_id`, `wr_password`, `wr_comment`, `wr_comment_reply` FROM `". $piree['cafe_article'] ."` ";
      $sql_select .= "WHERE `wr_id` = '". $comment_id ."'";
      $comment = $reply_array = sql_fetch($sql_select);

      $tmp_comment = $reply_array['wr_comment'];

      $len = strlen($reply_array['wr_comment_reply']);

      IF ( $len < 0 )
      {
        $len = 0;
      }

      $comment_reply = substr($reply_array['wr_comment_reply'], 0, $len);

//($GLOBALS); exit;

      IF ( piree_cafe_auth_get())
      {

        ;
      }
      ELSE IF ( $member['mb_id'])
      {

        IF ( $member['mb_id'] !== $comment['mb_id'] )
        {
          alert('자신의 글이 아니므로 수정할 수 없습니다.');
        }

      }
      ELSE
      {

        alert('댓글을 수정할 권한이 없습니다.');

      }

      $sql_select  = "SELECT COUNT(*) AS `cnt` FROM `". $piree['cafe_article'] ."` ";
      $sql_select .= "WHERE `wr_comment_reply` LIKE '". $comment_reply ."%' AND `wr_id` <> '". $comment_id ."' AND `wr_parent` = '". $wr_id ."' AND `wr_comment` = '". $tmp_comment ."' AND `wr_is_comment` = '1'";
      $row = sql_fetch($sql_select);

      IF ( $row['cnt'] && !piree_cafe_auth_get() )
      {
        alert('이 댓글와 관련된 답변댓글이 존재하므로 수정 할 수 없습니다.');
      }

      $sql_ip = "";

      IF ( !piree_cafe_auth_get() )
      {

          $sql_ip = " , wr_ip = '". $_SERVER['REMOTE_ADDR'] ."' ";
      }

      $sql_secret = ", wr_option = '". $wr_secret ."' ";

      $sql_update  = "UPDATE `". $piree['cafe_article'] ."` SET ";
      $sql_update .= "`wr_subject` = '". $wr_subject ."', ";
      $sql_update .= "`wr_content` = '". $wr_content ."', ";
      $sql_update .= "`wr_1`       = '". $wr_1 ."', ";
      $sql_update .= "`wr_2`       = '". $wr_2 ."', ";
      $sql_update .= "`wr_3`       = '". $wr_3 ."', ";
      $sql_update .= "`wr_4`       = '". $wr_4 ."', ";
      $sql_update .= "`wr_5`       = '". $wr_5 ."', ";
      $sql_update .= "`wr_6`       = '". $wr_6 ."', ";
      $sql_update .= "`wr_7`       = '". $wr_7 ."', ";
      $sql_update .= "`wr_8`       = '". $wr_8 ."', ";
      $sql_update .= "`wr_9`       = '". $wr_9 ."', ";
      $sql_update .= "`wr_10`      = '". $wr_10 ."' ";
      $sql_update .= $sql_ip;
      $sql_update .= $sql_secret;

      $sql_update .= ", ";
      $sql_update .= "`wr_pi_piree_cafe_n`  = '". $piree_cafe_n ."', ";
      $sql_update .= "`wr_pi_board_cate_n`  = '". $board_cate_n ."', ";
      $sql_update .= "`wr_pi_piree_cafe_s`  = '". $piree_cafe_name_s ."', ";
      $sql_update .= "`wr_pi_board_cate_s`  = '". $board_cate_list_a[$board_cate_n]['board_cate_path_s'] ."' ";

      $sql_update .= "WHERE `wr_id` = '". $comment_id ."'";

      IF ( !sql_query($sql_update) )
      {

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_piree_cafe_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_board_cate_n` INT UNSIGNED NOT NULL DEFAULT '0'";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_piree_cafe_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        $sql_alter = "ALTER TABLE `". $piree['cafe_article'] ."` ADD `wr_pi_board_cate_s` VARCHAR(255) NOT NULL DEFAULT ''";
        sql_query($sql_alter, false);

        IF ( !sql_query($sql_update) )
        {

          $msg_s = "댓글을 수정하지 못했습니다.";
          alert($msg_s);
        }

      }

    BREAK;

  }

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

  delete_cache_latest($piree['cafe_board_code']);

  $redirect_url = go_piree_cafe_board('', $piree_cafe_n, $board_cate_n, $wr['wr_parent'], $comment_id) .'&amp;'.$qstr.'&amp;#c_'.$comment_id;

  run_event('comment_update_after', $board, $wr_id, $w, $qstr, $redirect_url, $comment_id, $reply_array);

  goto_url($redirect_url);

?>