<?php

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

  프로젝트 이름 : 피리 카페 For 그누보드5.5 순정

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

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

  작성날짜 : 2024년 04월 04일 목요일 오전 0시 50분 / 흐림, 12.4, 쾌적, 17, 8, 26%, 20%, 1.5ms / 양호, 30, 19

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

=====================================================================
 피리 카페 For 그누보드5.5 순정 > 피리 카페 For 그누보드5.5 순정 > 피리 카페 관리 > 피리 카페 정보의 전달 및 ROW 유무 확인하기
=====================================================================


*/

  IF ( !defined('_GNUBOARD_') )                             EXIT;

  $get__p770000_conf = 0;

  $get__p770100 = 1;

  $prog_config_page = 0;

  include_once( piree__path($piree_prog_a[770100]['num'], 'config') );

    $mode_c = trim($_POST['mode_c']);

    IF ( $mode_c )
    {

      $piree_cafe_n = (int)trim($_POST['piree_cafe_n']);
      $piree_cafe_c = trim($_POST['piree_cafe_c']);
      $board_cate_n = trim($_POST['board_cate_n']);

    }
    ELSE
    {

      $mode_c       = trim($_GET['mode_c']);
      $piree_cafe_n = (int)trim($_GET['piree_cafe_n']);
      $piree_cafe_c = trim($_GET['piree_cafe_c']);
      $board_cate_n = trim($_GET['board_cate_n']);

    }

    IF ( !$piree_cafe_n && !$piree_cafe_c )
    {

      alert("[ 피리 카페 ] 정보가 전달되지 않았습니다.", piree__url($piree_prog_a[770100]['num'], ''));
      EXIT;

      piree__url($piree_prog_a[770100]['num'], '');
      EXIT;

    }

    $piree_cafe_a = get_piree_cafe_info($piree_cafe_n, $piree_cafe_c);

    IF ( $piree_cafe_n != $piree_cafe_a['cafe_row_n'] && $piree_cafe_c != $piree_cafe_a['cafe_code_c'] )
    {
      alert("존재하지 않는 카페입니다.", G5_URL);
      EXIT;
    }

    IF ( !piree_cafe_auth_get() )
    {
      alert('접근 권한이 없습니다.', G5_URL);
    }

    IF ( $member['mb_id'] != $piree_cafe_a['cafe_mem_id'] )
    {

      alert("[ 피리 카페 ] 주인이 아니므로 접근할수 없습니다.", cafe_index_go($piree_cafe_n, '', 1));
      EXIT;

    }

    $piree_cafe_n = $piree_cafe_a['cafe_row_n'];

    $piree_cafe_name_s = stripslashes($piree_cafe_a['cafe_name_s']);


    $piree_cafe_code_c = $piree_cafe_a['cafe_code_c'];

    $sql_where_cafe_cate_where_s = "`bca_cafe_n` = '". $piree_cafe_n ."'";

    $sql_where_cafe_article_where_s = "`wr_pi_piree_cafe_n` = '". $piree_cafe_n ."'";

/*

    IF ( $member['mb_id'] != $piree_cafe_a['cafe_mem_id'] )
    {

      alert("[ 피리 카페 ] 주인이 아니므로 접근할수 없습니다.", cafe_HUB_URL, 0);
      EXIT;

    }

*/

    $is_cafe_manager = 0;

    IF ( $member['mb_id'] == $piree_cafe_a['cafe_mem_id'] )
    {

      $is_cafe_manager = $piree_cafe_n;

    }

    $piree_cafe_icon_image_url = '';

    $piree_cafe_icon_image_dir = 'piree_cafe/'. $piree_cafe_code_c;

    IF ( $piree_cafe_a['cafe_image_icon_s'] )
    {

      $piree_cafe_icon_image_path = G5_DATA_PATH .'/'. $piree_cafe_icon_image_dir .'/'. $piree_cafe_a['cafe_image_icon_s'];

      IF ( file_exists($piree_cafe_icon_image_path) )
      {

        $piree_cafe_icon_image_url = G5_DATA_URL .'/'. $piree_cafe_icon_image_dir .'/'. $piree_cafe_a['cafe_image_icon_s'];

      }

    }

    $piree_cafe_profile_image_url = '';

    $piree_cafe_profile_image_dir = 'piree_cafe/'. $piree_cafe_code_c;

    IF ( $piree_cafe_a['cafe_image_face_s'] )
    {

      $piree_cafe_profile_image_path = G5_DATA_PATH .'/'. $piree_cafe_profile_image_dir .'/'. $piree_cafe_a['cafe_image_face_s'];

      IF ( file_exists($piree_cafe_profile_image_path) )
      {

        $piree_cafe_profile_image_url = G5_DATA_URL .'/'. $piree_cafe_profile_image_dir .'/'. $piree_cafe_a['cafe_image_face_s'];

      }

    }

    $piree_cafe_manage_menu_a = array();
    $piree_cafe_manage_menu_a[770100] = array('num'=>770100, 'name_s'=>'모두의 카페', 'name_l'=>'모두의 카페 - 피리 카페 관리',  'url'=>PIREE_CAFE_MAIN_URL);
    $piree_cafe_manage_menu_a[770101] = array('num'=>770101, 'name_s'=>'우리 카페',   'name_l'=>'우리 카페 홈 - 피리 카페 관리', 'url'=>PIREE_CAFE_MAIN_URL .'?piree_cafe_n='. $piree_cafe_n);
    $piree_cafe_manage_menu_a[770102] = array('num'=>770102, 'name_s'=>'관리 홈',     'name_l'=>'관리 홈 - 피리 카페 관리',      'url'=>PIREE_CAFE_MANAGE_URL .'?piree_cafe_n='. $piree_cafe_n);
    $piree_cafe_manage_menu_a[770103] = array('num'=>770103, 'name_s'=>'기본 정보',   'name_l'=>'기본 정보 - 피리 카페 관리',    'url'=>PIREE_CAFE_MANAGE_URL .'/basic.info.form.php?piree_cafe_n='. $piree_cafe_n);
    $piree_cafe_manage_menu_a[770104] = array('num'=>770104, 'name_s'=>'가입 설정',   'name_l'=>'가입 설정 - 피리 카페 관리',    'url'=>PIREE_CAFE_MANAGE_URL .'/member.join.config.form.php?piree_cafe_n='. $piree_cafe_n);
    $piree_cafe_manage_menu_a[770105] = array('num'=>770105, 'name_s'=>'회원 목록',   'name_l'=>'회원 목록 - 피리 카페 관리',    'url'=>PIREE_CAFE_MANAGE_URL .'/member.list.php?piree_cafe_n='. $piree_cafe_n);

      $piree_cafe_skin_basic_c = '';
      $piree_cafe_skin_basic_u = '';
      $piree_cafe_skin_basic_p = '';

      $piree_cafe_skin_basic_pc_c = $piree_cafe_a['cafe_skin_basic_pc_c'];
      $piree_cafe_skin_basic_pc_u = $p770100__prog_u . PIREE_CAFE_SKIN_BASIC_PC_DIR ."/". $piree_cafe_skin_basic_pc_c;
      $piree_cafe_skin_basic_pc_p = $p770100__prog_p . PIREE_CAFE_SKIN_BASIC_PC_DIR ."/". $piree_cafe_skin_basic_pc_c;

      $piree_cafe_skin_basic_mo_c = $piree_cafe_a['cafe_skin_basic_mo_c'];
      $piree_cafe_skin_basic_mo_u = $p770100__prog_u . PIREE_CAFE_SKIN_BASIC_MO_DIR ."/". $piree_cafe_skin_basic_mo_c;
      $piree_cafe_skin_basic_mo_p = $p770100__prog_p . PIREE_CAFE_SKIN_BASIC_MO_DIR ."/". $piree_cafe_skin_basic_mo_c;

      IF ( G5_IS_MOBILE )
      {

          $piree_cafe_skin_basic_c = $piree_cafe_skin_basic_mo_c;
          $piree_cafe_skin_basic_u = $piree_cafe_skin_basic_mo_u;
          $piree_cafe_skin_basic_p = $piree_cafe_skin_basic_mo_p;

      }
      ELSE
      {

          $piree_cafe_skin_basic_c = $piree_cafe_skin_basic_pc_c;
          $piree_cafe_skin_basic_u = $piree_cafe_skin_basic_pc_u;
          $piree_cafe_skin_basic_p = $piree_cafe_skin_basic_pc_p;

      }

      $piree_cafe_skin_manage_c = '';
      $piree_cafe_skin_manage_u = '';
      $piree_cafe_skin_manage_p = '';

      $piree_cafe_skin_manage_pc_c = $piree_cafe_a['cafe_skin_manage_pc_c'];
      $piree_cafe_skin_manage_pc_u = PIREE_CAFE_MANAGE_URL .'/'. PIREE_CAFE_SKIN_MANAGE_PC_DIR ."/". $piree_cafe_skin_manage_pc_c;
      $piree_cafe_skin_manage_pc_p = PIREE_CAFE_MANAGE_PATH .'/'. PIREE_CAFE_SKIN_MANAGE_PC_DIR ."/". $piree_cafe_skin_manage_pc_c;

      $piree_cafe_skin_manage_mo_c = $piree_cafe_a['cafe_skin_manage_mo_c'];
      $piree_cafe_skin_manage_mo_u = PIREE_CAFE_MANAGE_URL . PIREE_CAFE_SKIN_MANAGE_MO_DIR ."/". $piree_cafe_skin_manage_mo_c;
      $piree_cafe_skin_manage_mo_p = PIREE_CAFE_MANAGE_PATH . PIREE_CAFE_SKIN_MANAGE_MO_DIR ."/". $piree_cafe_skin_manage_mo_c;

      IF ( G5_IS_MOBILE )
      {

          $piree_cafe_skin_manage_c = $piree_cafe_skin_manage_mo_c;
          $piree_cafe_skin_manage_u = $piree_cafe_skin_manage_mo_u;
          $piree_cafe_skin_manage_p = $piree_cafe_skin_manage_mo_p;

          $piree_cafe_skin_manage_c = $piree_cafe_skin_manage_pc_c;
          $piree_cafe_skin_manage_u = $piree_cafe_skin_manage_pc_u;
          $piree_cafe_skin_manage_p = $piree_cafe_skin_manage_pc_p;

      }
      ELSE
      {

          $piree_cafe_skin_manage_c = $piree_cafe_skin_manage_pc_c;
          $piree_cafe_skin_manage_u = $piree_cafe_skin_manage_pc_u;
          $piree_cafe_skin_manage_p = $piree_cafe_skin_manage_pc_p;

      }

      $piree_cafe_skin_board_c = '';
      $piree_cafe_skin_board_u = '';
      $piree_cafe_skin_board_p = '';

      $piree_cafe_skin_board_pc_c = $piree_cafe_a['cafe_skin_board_pc_c'];
      $piree_cafe_skin_board_pc_u = $p770100__prog_u . PIREE_CAFE_SKIN_BOARD_PC_DIR ."/". $piree_cafe_skin_board_pc_c;
      $piree_cafe_skin_board_pc_p = $p770100__prog_p . PIREE_CAFE_SKIN_BOARD_PC_DIR ."/". $piree_cafe_skin_board_pc_c;

      $piree_cafe_skin_board_mo_c = $piree_cafe_a['cafe_skin_board_mo_c'];
      $piree_cafe_skin_board_mo_u = $p770100__prog_u . PIREE_CAFE_SKIN_BOARD_MO_DIR ."/". $piree_cafe_skin_board_mo_c;
      $piree_cafe_skin_board_mo_p = $p770100__prog_p . PIREE_CAFE_SKIN_BOARD_MO_DIR ."/". $piree_cafe_skin_board_mo_c;

      IF ( G5_IS_MOBILE )
      {

          $piree_cafe_skin_board_c = $piree_cafe_skin_board_mo_c;
          $piree_cafe_skin_board_u = $piree_cafe_skin_board_mo_u;
          $piree_cafe_skin_board_p = $piree_cafe_skin_board_mo_p;

      }
      ELSE
      {

          $piree_cafe_skin_board_c = $piree_cafe_skin_board_pc_c;
          $piree_cafe_skin_board_u = $piree_cafe_skin_board_pc_u;
          $piree_cafe_skin_board_p = $piree_cafe_skin_board_pc_p;

      }

      $piree_cafe_skin_latest_c = '';
      $piree_cafe_skin_latest_u = '';
      $piree_cafe_skin_latest_p = '';

      $piree_cafe_skin_latest_pc_c = $piree_cafe_a['cafe_skin_latest_pc_c'];
      $piree_cafe_skin_latest_pc_u = $p770100__prog_u . PIREE_CAFE_SKIN_LATEST_PC_DIR ."/". $piree_cafe_skin_latest_pc_c;
      $piree_cafe_skin_latest_pc_p = $p770100__prog_p . PIREE_CAFE_SKIN_LATEST_PC_DIR ."/". $piree_cafe_skin_latest_pc_c;

      $piree_cafe_skin_latest_mo_c = $piree_cafe_a['cafe_skin_latest_mo_c'];
      $piree_cafe_skin_latest_mo_u = $p770100__prog_u . PIREE_CAFE_SKIN_LATEST_MO_DIR ."/". $piree_cafe_skin_latest_mo_c;
      $piree_cafe_skin_latest_mo_p = $p770100__prog_p . PIREE_CAFE_SKIN_LATEST_MO_DIR ."/". $piree_cafe_skin_latest_mo_c;

      IF ( G5_IS_MOBILE )
      {

          $piree_cafe_skin_latest_c = $piree_cafe_skin_latest_mo_c;
          $piree_cafe_skin_latest_u = $piree_cafe_skin_latest_mo_u;
          $piree_cafe_skin_latest_p = $piree_cafe_skin_latest_mo_p;

      }
      ELSE
      {

          $piree_cafe_skin_latest_c = $piree_cafe_skin_latest_pc_c;
          $piree_cafe_skin_latest_u = $piree_cafe_skin_latest_pc_u;
          $piree_cafe_skin_latest_p = $piree_cafe_skin_latest_pc_p;

      }

    $cafe_member_a = array();
    $cafe_member_a['cafe_mem_level_n'] = 0;
    $cafe_member_a['cafe_mem_level_s'] = '손님 (비회원)';

    IF ( $member['mb_id'] )
    {

      $row = get_piree_cafe_member_row($piree_cafe_n, $member['mb_id']);

      IF ( $member['mb_id'] == $row['cfml_mem_id'] )
      {

        $cafe_member_a['member_n']         = $row['cfml_row_n'];
        $cafe_member_a['cafe_n']           = $row['cfml_cafe_n'];
        $cafe_member_a['cafe_mem_level_n'] = $row['cfml_cafe_mem_level_n'];
        $cafe_member_a['cafe_mem_level_s'] = $cafe_member_level_a[$row['cfml_cafe_mem_level_n']]['name'];
        $cafe_member_a['mem_n']            = $row['cfml_mem_n'];
        $cafe_member_a['mem_id']           = $row['cfml_mem_id'];
        $cafe_member_a['mem_nick']         = $row['cfml_mem_nick'];
        $cafe_member_a['article_t']        = $row['cfml_article_t'];
        $cafe_member_a['comment_t']        = $row['cfml_comment_t'];
        $cafe_member_a['image_t']          = $row['cfml_image_t'];
        $cafe_member_a['ip_s']             = $row['cfml_ip_s'];
        $cafe_member_a['regi_time_n']      = $row['cfml_join_time_n'];
        $cafe_member_a['regi_date_s']      = date('Y-m-d H:i:s', $row['cfml_join_time_n']);
        $cafe_member_a['modi_time_n']      = $row['cfml_modi_time_n'];
        $cafe_member_a['modi_date_s']      = date('Y-m-d H:i:s', $row['cfml_modi_time_n']);

      }

    }

    $board_cate_n = (int)$board_cate_n;

    $piree_cafe_skin_board_c = '';
    $piree_cafe_skin_board_u = '';
    $piree_cafe_skin_board_p = '';

    $board_cate_all_t = 0;

    $board_cate_view_t = 0;

    $board_cate_list_a = array();

    $board_cate_list_one_a = array();

    $board_cate_list_two_a = array();

    IF ( $board_cate_n > 0 )
    {

/*

//카페_게시판_분류__SMALLINT_2단계__관련_파일__첨부
      include_once( piree__path($piree_prog_a[770000]['num'], 'cafe.board.category.smallint.2.lib.php') );

      $temp_cate_a = get_category_upper_smallint2_cafe_board($board_cate_n);

      SWITCH ( $temp_cate_a[0] )
      {
        CASE 1 :     $sql_where_cafe_cate_where_s .= " AND `bca_depth_n` = '1'";                                                   BREAK;
        CASE 2 :     $sql_where_cafe_cate_where_s .= " AND (`bca_depth_n` = '1' OR `bca_parent_n` = '". $temp_cate_a[1] ."')";     BREAK;
      }

*/

    }

    $sql_select  = "SELECT `bca_cate_n`, `bca_cate_s`, `bca_depth_n`, `bca_parent_n`, `bca_article_t` ";
    $sql_select  = "SELECT * ";
    $sql_select .= "FROM `". $piree['cafe_board'] ."` WHERE ". $sql_where_cafe_cate_where_s;
    $result_cate = sql_query($sql_select);

    FOR ( $loop=0; $row=sql_fetch_array($result_cate); $loop++ )
    {

      $loop_cate_n = $row['bca_cate_n'];

      $board_cate_list_a[$loop_cate_n] = $row;

      SWITCH ( $row['bca_depth_n'] )
      {

        CASE 1 :

          $board_cate_list_one_a[$loop_cate_n] = $row;

        BREAK;

        CASE 2 :

          $board_cate_list_two_a[$loop_cate_n] = $row;

        BREAK;

      }

      $board_cate_all_t++;

        $board_cate_a = $row;

        $board_cate_list_a[$loop_cate_n]['board_cate_s'] = $board_cate_list_a[$board_cate_n]['bca_cate_s'];

        $board_cate_list_a[$loop_cate_n]['board_cate_path_s'] = $board_cate_list_a[$board_cate_n]['bca_s_p'];

        IF ( $board_cate_n > 0 )
        {

          $board_cate_list_a[$loop_cate_n]['sql_where_cafe_article_where_s'] .= " AND ". get_piree_cafe_article_count($board_cate_n, $board_cate_list_a[$board_cate_n]['bca_depth_n'], 'wr_pi_board_cate_n');

        }

        $board_cate_list_a[$loop_cate_n]['piree_cafe_board_query'] = "piree_cafe_n=". $piree_cafe_n ."&board_cate_n=". $board_cate_n;

        $piree_cafe_article_query = "";

        IF ( $wr_id > 0 )
        {

          $piree_cafe_article_query = $board_cate_list_a[$loop_cate_n]['piree_cafe_board_query'] ."&wr_id=". $wr_id;

        }

        $board_cate_list_a[$loop_cate_n]['article_range_where_1_s'] = "`wr_pi_piree_cafe_n` = '". $piree_cafe_n ."'";

        $board_cate_list_a[$loop_cate_n]['article_range_where_0_s'] = "";

        IF ( $loop_cate_n > 0 )
        {

          $board_cate_list_a[$loop_cate_n]['article_range_where_2_s']  = "(". $board_cate_list_a[$loop_cate_n]['article_range_where_1_s'];
          $board_cate_list_a[$loop_cate_n]['article_range_where_2_s'] .= " AND ". get_piree_cafe_article_count($loop_cate_n, $board_cate_list_a[$board_cate_n]['bca_depth_n'], 'wr_pi_board_cate_n') .")";

          $board_cate_list_a[$loop_cate_n]['article_range_where_0_s'] = $board_cate_list_a[$loop_cate_n]['article_range_where_2_s'] ."  AND  ";

        }

        $board_cate_list_a[$loop_cate_n]['board_skin_pc_c'] = $board_cate_list_a[$board_cate_n]['bca_pc_skin'];
        $board_cate_list_a[$loop_cate_n]['board_skin_pc_u'] = $p770100__prog_u . PIREE_CAFE_SKIN_BOARD_PC_DIR ."/". $board_cate_list_a[$loop_cate_n]['board_skin_pc_c'];
        $board_cate_list_a[$loop_cate_n]['board_skin_pc_p'] = $p770100__prog_p . PIREE_CAFE_SKIN_BOARD_PC_DIR ."/". $board_cate_list_a[$loop_cate_n]['board_skin_pc_c'];

        $board_cate_list_a[$loop_cate_n]['board_skin_mo_c'] = $board_cate_list_a[$board_cate_n]['bca_mo_skin'];
        $board_cate_list_a[$loop_cate_n]['board_skin_mo_u'] = $p770100__prog_u . PIREE_CAFE_SKIN_BOARD_MO_DIR ."/". $board_cate_list_a[$loop_cate_n]['board_skin_mo_c'];
        $board_cate_list_a[$loop_cate_n]['board_skin_mo_p'] = $p770100__prog_p . PIREE_CAFE_SKIN_BOARD_MO_DIR ."/". $board_cate_list_a[$loop_cate_n]['board_skin_mo_c'];

        IF ( G5_IS_MOBILE )
        {

          $board_cate_list_a[$loop_cate_n]['board_skin_c'] = $board_cate_list_a[$loop_cate_n]['board_skin_mo_c'];
          $board_cate_list_a[$loop_cate_n]['board_skin_u'] = $board_cate_list_a[$loop_cate_n]['board_skin_mo_u'];
          $board_cate_list_a[$loop_cate_n]['board_skin_p'] = $board_cate_list_a[$loop_cate_n]['board_skin_mo_p'];

        }
        ELSE
        {

          $board_cate_list_a[$loop_cate_n]['board_skin_c'] = $board_cate_list_a[$loop_cate_n]['board_skin_pc_c'];
          $board_cate_list_a[$loop_cate_n]['board_skin_u'] = $board_cate_list_a[$loop_cate_n]['board_skin_pc_u'];
          $board_cate_list_a[$loop_cate_n]['board_skin_p'] = $board_cate_list_a[$loop_cate_n]['board_skin_pc_p'];

        }

    }

?>