<?php
if (!defined('_GNUBOARD_')) exit;
// =================================================================
// 1. [구멍 뚫기] 오빠의 UPBIT DB (upbit_data) 연결
// =================================================================
include_once('/home/www/DB/db_upbit.php');
// 혹시 몰라 연결 변수($db_upbit)가 제대로 살아있는지 확인 (혜정이의 센스)
if (!isset($pdo)) {
die("오빠! db_upbit.php 파일은 불렀는데 연결이 안 됐어! 파일 다시 확인해줘!");
}
$db_upbit = $pdo; // ★ UPBIT 전용 DB 핸들러
// 상단 아이콘 및 폰트 추가 (원본 유지)
add_stylesheet('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">', 0);
add_stylesheet('<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Noto+Sans+KR:wght@300;500&display=swap">', 0);
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.list.css">', 0);
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', '0');
// bo_1, bo_2, bo_3 값을 배열로 변환 (셀렉트 메뉴용)
$ca2_list = explode('|', $board['bo_1']);
$ca3_list = explode('|', $board['bo_2']);
$ca4_list = explode('|', $board['bo_3']);
// 필터 및 검색 값 설정
$s_ca2 = isset($_GET['s_ca2']) ? $_GET['s_ca2'] : '';
$s_ca3 = isset($_GET['s_ca3']) ? $_GET['s_ca3'] : '';
$s_ca4 = isset($_GET['s_ca4']) ? $_GET['s_ca4'] : '';
$is_ing = isset($_GET['is_ing']) ? $_GET['is_ing'] : '';
$is_project = isset($_GET['is_project']) ? $_GET['is_project'] : '';
$is_label = isset($_GET['is_label']) ? $_GET['is_label'] : '';
$stx = isset($_GET['stx']) ? $_GET['stx'] : '';
if (!function_exists('work_project_icon')) {
function work_project_icon($project_name) {
$project_name = strtolower(trim((string)$project_name));
if ($project_name === '') return '';
if (strpos($project_name, 'api') !== false || strpos($project_name, 'server') !== false) return 'fa-solid fa-server';
if (strpos($project_name, 'mobile') !== false || strpos($project_name, 'app') !== false) return 'fa-solid fa-mobile-screen-button';
if (strpos($project_name, 'db') !== false || strpos($project_name, 'data') !== false) return 'fa-solid fa-database';
if (strpos($project_name, 'web') !== false || strpos($project_name, 'site') !== false) return 'fa-solid fa-globe';
return 'fa-solid fa-diagram-project';
}
}
$list_params = array(
'bo_table' => $bo_table,
's_ca2' => $s_ca2,
's_ca3' => $s_ca3,
's_ca4' => $s_ca4,
'is_ing' => $is_ing,
'is_project' => $is_project,
'is_label' => $is_label,
'stx' => $stx
);
$ing_toggle_url = G5_BBS_URL.'/board.php?'.http_build_query(array_merge($list_params, array(
'is_ing' => ($is_ing == 'y') ? '' : 'y'
)));
$project_toggle_url = G5_BBS_URL.'/board.php?'.http_build_query(array_merge($list_params, array(
'is_project' => ($is_project == 'y') ? '' : 'y'
)));
$label_toggle_url = G5_BBS_URL.'/board.php?'.http_build_query(array_merge($list_params, array(
'is_label' => ($is_label == 'y') ? '' : 'y'
)));
$sql_count_where = " WHERE wr_is_comment = '0' AND wr_parent = wr_id ";
if($s_ca2) $sql_count_where .= " AND x2_ca2 = '".sql_real_escape_string($s_ca2)."' ";
if($s_ca3) $sql_count_where .= " AND x2_ca3 = '".sql_real_escape_string($s_ca3)."' ";
if($s_ca4) $sql_count_where .= " AND x2_ca4 = '".sql_real_escape_string($s_ca4)."' ";
if($is_ing == 'y') $sql_count_where .= " AND x2_ca4 <> '완료' ";
if($is_project == 'y') $sql_count_where .= " AND TRIM(IFNULL(x2_project, '')) <> '' ";
if($is_label == 'y') $sql_count_where .= " AND x2_label = '1' ";
if($stx) {
$stx_esc = sql_real_escape_string($stx);
$sql_count_where .= " AND (wr_subject LIKE '%{$stx_esc}%' OR wr_content LIKE '%{$stx_esc}%') ";
}
$total_count_row = sql_fetch("SELECT COUNT(*) AS cnt FROM {$write_table} {$sql_count_where}");
$total_count = isset($total_count_row['cnt']) ? (int)$total_count_row['cnt'] : 0;
$memo_cards = array();
$memo_sql = "SELECT wr_id, wr_subject, wr_datetime, x2_memo FROM {$write_table} WHERE wr_is_comment = '0' AND wr_parent = wr_id AND TRIM(IFNULL(x2_memo, '')) <> '' AND IFNULL(x2_memo_clean, '0') <> '1' ORDER BY wr_id DESC";
$memo_res = sql_query($memo_sql);
while($memo_row = sql_fetch_array($memo_res)) {
$memo_plain = trim(preg_replace('/\s+/', ' ', strip_tags($memo_row['x2_memo'])));
if ($memo_plain === '') continue;
if (function_exists('mb_substr')) {
$memo_preview = mb_substr($memo_plain, 0, 110, 'UTF-8');
if (mb_strlen($memo_plain, 'UTF-8') > 110) $memo_preview .= '...';
} else {
$memo_preview = substr($memo_plain, 0, 110);
if (strlen($memo_plain) > 110) $memo_preview .= '...';
}
$memo_cards[] = array(
'wr_id' => $memo_row['wr_id'],
'subject' => $memo_row['wr_subject'],
'datetime' => $memo_row['wr_datetime'],
'preview' => $memo_preview,
'href' => get_pretty_url($bo_table, $memo_row['wr_id'])
);
}
// 데이터 로드 (원본 유지)
$new_board = sql_query("select * from $write_table where wr_is_comment = '0' AND wr_parent = wr_id order by wr_datetime desc limit 1");
$lat_board = sql_fetch_array($new_board);
?>
<div id="SPACE_WRAP">
<div class="nebula"></div>
<div id="stars-container"></div>
<article id='LIST'>
<section class="TopTitle">
<p><?php echo strtoupper($bo_table); ?></p>
<span><i class="fa-solid fa-satellite"></i> <?php echo $board["bo_subject"]; ?></span>
<div class="board-ver">
<span class="board-total">TOTAL <?php echo number_format($total_count); ?></span>
<?php if (!empty($lat_board['x2_ver'])) { ?>
<span class="board-ver-sep">|</span>
<span class="board-version">VER <?php echo get_text($lat_board['x2_ver']); ?></span>
<?php } ?>
</div>
</section>
<div class="Control-Bar">
<div class="Left control-left">
<button type="button" class="label-toggle-btn label-toggle-btn2" onclick="$('#NoticeLayer').fadeIn();"><i class="fa-solid fa-bullhorn"></i> NOTICE</button>
<select onchange="location.href='?bo_table=<?php echo $bo_table ?>&s_ca2='+this.value+'&s_ca3=<?php echo urlencode($s_ca3); ?>&s_ca4=<?php echo urlencode($s_ca4); ?>&is_ing=<?php echo urlencode($is_ing); ?>&is_project=<?php echo urlencode($is_project); ?>&is_label=<?php echo urlencode($is_label); ?>&stx=<?php echo urlencode($stx); ?>';">
<option value="">KIND</option>
<?php foreach($ca2_list as $ca) { if(!trim($ca)) continue; $sel = ($s_ca2==$ca)?"selected":""; echo "<option value='".urlencode($ca)."' $sel>$ca</option>"; } ?>
</select>
<select onchange="location.href='?bo_table=<?php echo $bo_table ?>&s_ca2=<?php echo urlencode($s_ca2); ?>&s_ca3='+this.value+'&s_ca4=<?php echo urlencode($s_ca4); ?>&is_ing=<?php echo urlencode($is_ing); ?>&is_project=<?php echo urlencode($is_project); ?>&is_label=<?php echo urlencode($is_label); ?>&stx=<?php echo urlencode($stx); ?>';">
<option value="">FORM</option>
<?php foreach($ca3_list as $ca) { if(!trim($ca)) continue; $sel = ($s_ca3==$ca)?"selected":""; echo "<option value='".urlencode($ca)."' $sel>$ca</option>"; } ?>
</select>
<select onchange="location.href='?bo_table=<?php echo $bo_table ?>&s_ca2=<?php echo urlencode($s_ca2); ?>&s_ca3=<?php echo urlencode($s_ca3); ?>&s_ca4='+this.value+'&is_ing=<?php echo urlencode($is_ing); ?>&is_project=<?php echo urlencode($is_project); ?>&is_label=<?php echo urlencode($is_label); ?>&stx=<?php echo urlencode($stx); ?>';">
<option value="">STATE</option>
<?php foreach($ca4_list as $ca) { if(!trim($ca)) continue; $sel = ($s_ca4==$ca)?"selected":""; echo "<option value='".urlencode($ca)."' $sel>$ca</option>"; } ?>
</select>
<button type="button" class="label-toggle-btn btn-project-filter <?php echo ($is_project=='y')?'active':'' ?>" onclick="location.href='<?php echo $project_toggle_url; ?>'">
<i class="fa-solid fa-diagram-project"></i> PROJECT
</button>
<button type="button" class="label-toggle-btn btn-ing-filter <?php echo ($is_ing=='y')?'active':'' ?>" onclick="location.href='<?php echo $ing_toggle_url; ?>'">
<i class="fa-solid fa-bolt"></i> <?php echo ($is_ing=='y')?'ING':'ALL' ?>
</button>
<button type="button" class="label-toggle-btn btn-label-filter <?php echo ($is_label=='y')?'active':'' ?>" onclick="location.href='<?php echo $label_toggle_url; ?>'" title="LABEL">
<i class="fa-solid fa-star"></i>
</button>
<button type="button" class="label-toggle-btn memo-note-btn" id="memoPanelToggleBtn" title="메모지">
<i class="fa-solid fa-note-sticky"></i> MEMO
</button>
</div>
<div class="Right control-right">
<input type="text" id="live_search" value="<?php echo stripslashes($stx); ?>" placeholder="LIVE SIGNAL..." class="live-search-input">
<button type="button" class="label-toggle-btn label-toggle-btn2" onclick="$('#SCH').css('display','flex').fadeIn();"><i class="fa-solid fa-magnifying-glass"></i> SEARCH</button>
<?php if ($is_admin) { ?>
<button type="button" onclick="location.href='<?php echo G5_ADMIN_URL; ?>/board_form.php?w=u&bo_table=<?php echo $bo_table; ?>'" class="btn-admin"><i class="fa-solid fa-gear"></i> ADMIN</button>
<?php } ?>
<?php if ($write_href) { ?>
<button type="button" onclick="location.href='<?php echo $write_href; ?>'" class="btn-write"><i class="fa-solid fa-pen"></i> WRITE</button>
<?php } ?>
</div>
</div>
<div id="TOP_FIXED_AREA">
<table class="List-Table top-fixed-table">
<tbody>
<?php
$sql_top_where = " where wr_is_comment = '0' AND wr_parent = wr_id AND IFNULL(TRIM(x2_top), '') = '1' ";
if($s_ca2) $sql_top_where .= " AND x2_ca2 = '".sql_real_escape_string($s_ca2)."' ";
if($s_ca3) $sql_top_where .= " AND x2_ca3 = '".sql_real_escape_string($s_ca3)."' ";
if($s_ca4) $sql_top_where .= " AND x2_ca4 = '".sql_real_escape_string($s_ca4)."' ";
if($is_ing == 'y') $sql_top_where .= " AND x2_ca4 <> '완료' ";
if($is_project == 'y') $sql_top_where .= " AND TRIM(IFNULL(x2_project, '')) <> '' ";
if($is_label == 'y') $sql_top_where .= " AND x2_label = '1' ";
if($stx) {
$stx_esc = sql_real_escape_string($stx);
$sql_top_where .= " AND (wr_subject LIKE '%{$stx_esc}%' OR wr_content LIKE '%{$stx_esc}%') ";
}
$sql_top = " select * from $write_table {$sql_top_where} order by wr_id desc ";
$res_top = sql_query($sql_top);
while($row_t = sql_fetch_array($res_top)) {
$st_cl = ($row_t['x2_ca4'] == "진행") ? "st_blue" : (($row_t['x2_ca4'] == "완료") ? "st_purple" : "st_default");
$href_t = get_pretty_url($bo_table, $row_t['wr_id']);
$project_icon_t = work_project_icon($row_t['x2_project']);
$has_routine_t = trim($row_t['x2_routine']) !== '';
$has_way_t = trim($row_t['x2_way']) !== '';
$has_point_t = trim($row_t['x2_point']) !== '';
$has_healing_t = trim($row_t['x2_healing']) !== '';
$has_week_t = trim($row_t['x2_week']) !== '';
$has_daily_t = trim($row_t['x2_daily']) !== '';
$has_key_t = trim($row_t['x2_key']) !== '';
$ess_value_t = isset($row_t['x2_ess']) ? trim($row_t['x2_ess']) : (isset($row_t['x2_Ess']) ? trim($row_t['x2_Ess']) : '');
$has_ess_t = $ess_value_t !== '';
?>
<tr onclick="location.href='<?php echo $href_t; ?>'" class="top-row <?php echo (!empty($row_t['x2_see']) && $row_t['x2_see'] == '1') ? 'see-row' : ''; ?>">
<td class="Num top-num"><i class="fa-solid fa-anchor"></i></td>
<td class="Subject">
<strong><?php echo $row_t['wr_subject']; ?></strong>
</td>
<td class="Day">
<span class="item-icons">
<?php if($project_icon_t) echo '<i class="'.$project_icon_t.'" title="PROJECT: '.get_text($row_t['x2_project']).'"></i>'; ?>
<?php if($row_t['x2_label']) echo '<i class="fa-solid fa-star label-star-icon" title="LABEL"></i>'; ?>
<?php if($row_t['wr_link1'] || $row_t['wr_link2']) echo '<i class="fa-solid fa-link" title="링크"></i>'; ?>
<?php if($row_t['wr_file']) echo '<i class="fa-solid fa-paperclip" title="첨부파일"></i>'; ?>
<?php if(trim($row_t['x2_txt'])) echo '<i class="fa-solid fa-code" title="추가 코드"></i>'; ?>
<?php if(trim($row_t['x2_memo'])) echo '<i class="fa-solid fa-note-sticky" title="메모"></i>'; ?>
<?php if(trim($row_t['x2_line'])) echo '<i class="fa-solid fa-list-check" title="작업라인"></i>'; ?>
<?php if($has_routine_t) echo '<i class="fa-solid fa-repeat" title="루틴"></i>'; ?>
<?php if($has_way_t) echo '<i class="fa-solid fa-route" title="길"></i>'; ?>
<?php if($has_point_t) echo '<i class="fa-solid fa-location-crosshairs" title="포인트"></i>'; ?>
<?php if($has_healing_t) echo '<i class="fa-solid fa-leaf" title="힐링"></i>'; ?>
<?php if($has_week_t) echo '<i class="fa-solid fa-calendar-days" title="요일"></i>'; ?>
<?php if($has_daily_t) echo '<i class="fa-solid fa-book-open" title="일상"></i>'; ?>
<?php if($has_key_t) echo '<i class="fa-solid fa-key" title="중요"></i>'; ?>
<?php if($has_ess_t) echo '<i class="fa-solid fa-shield-heart" title="필수"></i>'; ?>
</span>
<span class="item-meta">
<?php if($row_t['x2_ca4']) { ?><span class="st_badge <?php echo $st_cl; ?>"><?php echo $row_t['x2_ca4']; ?></span><?php } ?>
<span class="item-date"><?php echo substr($row_t['wr_datetime'], 2, 8); ?></span>
</span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" method="post">
<table class="List-Table">
<tbody id="board-list-body"></tbody>
</table>
</form>
<div id="list_loader" class="list-loader">
<i class="fa-solid fa-spinner fa-spin fa-2x"></i>
</div>
<aside id="memo_side_panel" class="memo-side-panel" aria-hidden="true">
<div class="memo-panel-head">
<div class="memo-panel-title"><i class="fa-solid fa-note-sticky"></i> MENO</div>
<button type="button" class="memo-panel-close" id="memoPanelCloseBtn"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="memo-panel-layout-wrap">
<button type="button" class="memo-layout-switch" id="memoLayoutToggle" aria-pressed="false">
<span class="memo-layout-label memo-layout-label-1">1x1</span>
<span class="memo-layout-thumb"></span>
<span class="memo-layout-label memo-layout-label-2">1x2</span>
</button>
<span class="memo-total-text">TOTAL : <?php echo number_format(count($memo_cards)); ?></span>
</div>
<div class="memo-card-list layout-1" id="memoCardList">
<?php if (!empty($memo_cards)) { ?>
<?php foreach ($memo_cards as $memo_card) { ?>
<article class="memo-card-item">
<div class="memo-card-date"><?php echo date('Y-m-d H:i', strtotime($memo_card['datetime'])); ?></div>
<div class="memo-card-content"><?php echo get_text($memo_card['preview']); ?></div>
<a href="<?php echo $memo_card['href']; ?>" class="memo-card-link">VIEW POST</a>
</article>
<?php } ?>
<?php } else { ?>
<div class="memo-empty">표시할 메모가 없습니다.</div>
<?php } ?>
</div>
</aside>
<div id="NoticeLayer" class="NoticeLayer">
<h3 class="notice-title"><i class="fa-solid fa-terminal"></i> SYSTEM NOTICE</h3>
<div class="notice-content">
<?php echo nl2br(stripslashes($board['notice'])); // notice.php에서 저장하는 컬럼으로 수정 ?>
</div>
<div class="notice-actions">
<?php if ($is_admin) { ?>
<button type="button" onclick="const w=800, h=850; const left=(screen.availWidth-w)/2, top=(screen.availHeight-h)/2; window.open('<?php echo $board_skin_url;?>/notice.php?bo_table=<?php echo $bo_table;?>', 'notice_win', 'width='+w+',height='+h+',left='+left+',top='+top+',scrollbars=yes');" class="btn-edit-notice">EDIT NOTICE</button>
<?php } ?>
<button type="button" class="btn-edit-notice-dis" onclick="$('#NoticeLayer').fadeOut();">DISMISS</button>
</div>
</div>
<section id="SCH" class="Search">
<div class="search-modal-box">
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
<h3 class="search-title">TERMINAL SEARCH</h3>
<input type="text" name="stx" value="<?php echo stripslashes($stx); ?>" required placeholder="Keyword entry..." class="search-input">
<div class="search-actions">
<button type="submit" class="btn-search-submit">EXECUTE</button>
<button type="button" onclick="$('#SCH').fadeOut();" class="btn-search-cancel">CANCEL</button>
</div>
</form>
</div>
</section>
</article>
</div>
<?php include_once("{$board_skin_path}/list/list.script.php"); ?>