<?php

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

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

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

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

  작성날짜 : 2024년 04월 24일 수요일 오후 14시 50분 / 흐림, 15.0, 약간 추움, 17, 11, 38%, 1.7mm, 20%, 3.9ms / 최고 좋음, 6, 6, 0.009

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

=====================================================================
 피리 카페 심플 > 프로그램 > 피리 카페 관리 > 내 카페 > 게시판 > 스크랩 보기 > 스크립 목록 보기
=====================================================================

*/

  include_once('./_common.php');

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

  $get__p770000_conf = 0;

  $get__p770099 = 1;

  $prog_config_page = 0;

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

  $g5['title'] = get_text($member['mb_nick']) .'님의 스크랩';

  include_once( get_cafe_skin_file('path', 'basic', '_head.sub.php') );

  $sql_common = " FROM `". $g5['scrap_table'] ."` WHERE `mb_id` = '". $member['mb_id'] ."'";

  $sql_order = " ORDER BY `ms_id` DESC ";

  $sql_select = "SELECT COUNT(*) ". $sql_common;
  $total_count = (int)sql_efv($sql_select);

  IF ( $total_count > 0 )
  {

    $rows = $config['cf_page_rows'];

    $total_page = ceil($total_count / $rows);

    IF ( $page < 1 )
    {
      $page = 1;
    }

    $from_record = ($page - 1) * $rows;

    $list = array();

    $sql_select  = "SELECT * ". $sql_common ." ";
    $sql_select .= $sql_order ." LIMIT ". $from_record .", ". $rows;
    $result = sql_query($sql_select);

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

        $list[$loop_n] = $row;

        $num = $total_count - ($page - 1) * $rows - $loop_n;

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

        IF ( $row['sc_pi_piree_cafe_n'] > 0 )
        {

          IF ( $row['sc_pi_piree_cafe_s'] )
          {

            $list[$loop_n]['cafe_name_s'] = $row['sc_pi_piree_cafe_s'];

          }

          $list[$loop_n]['opener_href'] = go_piree_cafe_board('', $row['sc_pi_piree_cafe_n']);

          $list[$loop_n]['opener_href_wr_id'] = go_piree_cafe_board('', $row['sc_pi_piree_cafe_n']);

          IF ( $row['sc_pi_board_cate_n'] > 0 )
          {

            $list[$loop_n]['opener_href'] = go_piree_cafe_board('', $row['sc_pi_piree_cafe_n'], $row['sc_pi_board_cate_n']);

            $list[$loop_n]['opener_href_wr_id'] = go_piree_cafe_board('', $row['sc_pi_piree_cafe_n'], $row['sc_pi_board_cate_n']);

            IF ( $row['wr_id'] > 0 )
            {

              $list[$loop_n]['opener_href_wr_id'] = go_piree_cafe_board('', $row['sc_pi_piree_cafe_n'], $row['sc_pi_board_cate_n'], $row['wr_id']);

            }

            $list[$loop_n]['bo_subject'] = trim(str_replace('--', ' > ', $row['sc_pi_board_cate_s']));

          }

          $article_list_table = $piree['cafe_article'];

        }

        IF ( !$list[$loop_n]['bo_subject'] || $list[$loop_n]['bo_subject'] == '' )
        {

          $sql_select  = "SELECT `bo_subject` FROM `". $g5['board_table'] ."` ";
          $sql_select .= "WHERE `bo_table` = '". $row['bo_table']."'";
          $row2 = sql_fetch($sql_select);

          IF ( !$row2['bo_subject'] )
          {
            $row2['bo_subject'] = '[게시판 없음]';
          }

          $list[$loop_n]['bo_subject'] = $row2['bo_subject'];

          $list[$loop_n]['opener_href'] = go_piree_cafe_board('', $piree_cafe_n, $board_cate_n);

          $list[$loop_n]['opener_href_wr_id'] = go_piree_cafe_board('', $piree_cafe_n, $board_cate_n, $row['wr_id']);

          $list[$loop_n]['del_href'] = './scrap_delete.php?ms_id='.$row['ms_id'].'&amp;page='.$page;

          $article_list_table = $g5['write_prefix'] . $row['bo_table'];

        }

        $sql_select  = "SELECT `wr_subject` FROM `". $article_list_table ."` ";
        $sql_select .= "WHERE `wr_id` = '". $row['wr_id'] ."'";
        $row3 = sql_fetch($sql_select, FALSE);

        $subject = get_text(cut_str($row3['wr_subject'], 100));

        IF ( !$row3['wr_subject'] )
        {
            $row3['wr_subject'] = '[글 없음]';
        }

        $list[$loop_n]['del_href']  = piree__url($piree_prog_a[770099]['num'], 'piree.cafe.scrap_delete.php') .'?';
        $list[$loop_n]['del_href'] .= 'ms_id='.$row['ms_id'] .'&amp;page='. $page .'&amp;piree_cafe_n='. $row['sc_pi_piree_cafe_n'];

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

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

    }

  }

  include_once( get_cafe_skin_file('path', 'basic', 'piree.cafe.scrap.skin.php') );

  include_once( get_cafe_skin_file('path', 'basic', '_tail.sub.php') );

