first commit 2

This commit is contained in:
hmw1001
2026-06-11 18:47:38 +09:00
parent c768729ce6
commit 6f534e33a6
11095 changed files with 1595758 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
<?php
include_once('../../common.php');
if (!$is_member)
alert('회원만 이용하실 수 있습니다.');
$sql = " delete from {$g5['memo_table']} where me_send_mb_id = 'system-msg' and me_recv_mb_id = '{$member['mb_id']}' ";
sql_query($sql);
$sql = " update `{$g5['member_table']}` set mb_memo_cnt = '".get_memo_not_read($member['mb_id'])."' where mb_id = '{$member['mb_id']}' ";
sql_query($sql);
+93
View File
@@ -0,0 +1,93 @@
<?php
include_once('../../common.php');
$mod_type = isset($_POST['mod_type']) ? $_POST['mod_type'] : '';
$is_shop = isset($_POST['is_shop']) ? $_POST['is_shop'] : '';
?>
<?php if(isset($mod_type) && $mod_type == "ca_name") {
$md_bo_table = isset($_POST['md_bo_table']) ? $_POST['md_bo_table'] : '';
if(isset($md_bo_table) && $md_bo_table) {
// 해당게시판의 카테고리 조회
$res_ca = sql_fetch (" select bo_category_list from {$g5['board_table']} where bo_table = '{$md_bo_table}' and bo_use_category = '1' ");
$cat = isset($res_ca['bo_category_list']) ? $res_ca['bo_category_list'] : '';
$cat_opt = explode("|", $cat);
}
?>
<?php if(isset($md_bo_table) && $md_bo_table) { ?>
<?php if(isset($cat) && $cat) { ?>
<ul class="mt-5 selected_latest selected_select">
<select class="select w100" name="md_sca" id="md_sca">
<option value="">전체 카테고리</option>
<?php foreach($cat_opt as $option): ?>
<option value="<?php echo $option; ?>"><?php echo $option; ?></option>
<?php endforeach; ?>
</select>
</ul>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if(isset($mod_type) && $mod_type == "ca_name_tab") {
$md_bo_table = isset($_POST['md_bo_table']) ? $_POST['md_bo_table'] : '';
if(isset($md_bo_table) && $md_bo_table) {
// 해당게시판의 카테고리 조회
$res_ca = sql_fetch (" select bo_category_list from {$g5['board_table']} where bo_table = '{$md_bo_table}' and bo_use_category = '1' ");
$cat = isset($res_ca['bo_category_list']) ? $res_ca['bo_category_list'] : '';
$cat_opt = explode("|", $cat);
}
?>
<?php if(isset($md_bo_table) && $md_bo_table) { ?>
<ul class="mt-5 selected_tab selected_select">
<select class="select w100" name="md_sca_tab" id="tab_sca">
<option value="">카테고리를 선택하세요.</option>
<?php foreach($cat_opt as $option): ?>
<?php if(isset($option) && $option) { ?>
<option value="<?php echo $option; ?>"><?php echo $option; ?></option>
<?php } ?>
<?php endforeach; ?>
<option value="">전체</option>
</select>
</ul>
<?php } ?>
<?php } ?>
<?php
if(isset($mod_type) && $mod_type == "mod_order") {
$order = $_POST['order'];
if ($order && is_array($order)) {
// 각 아이템의 순서를 업데이트
foreach ($order as $item) {
$md_id = $item['id'];
$order_id = $item['order_id'];
if(isset($is_shop) && $is_shop == 1) {
$sql = "UPDATE rb_module_shop SET md_order_id = {$order_id} WHERE md_id = {$md_id};";
} else {
$sql = "UPDATE rb_module SET md_order_id = {$order_id} WHERE md_id = {$md_id};";
}
sql_query($sql);
}
echo "success";
} else {
echo "Invalid order data";
}
}
?>
+138
View File
@@ -0,0 +1,138 @@
<?php
include_once('../../common.php');
include_once(G5_LIB_PATH.'/naver_syndi.lib.php');
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
$return = ['res' => 'false', 'msg' => '오류', 'list' => []];
if (empty($_POST['act_type']) || empty($_POST['bo_table']) || empty($_POST['write_table'])) {
echo json_encode($return);
exit;
}
$bo_table = preg_replace('/[^a-z0-9_]/i', '', $_POST['bo_table']);
$write_table = preg_replace('/[^a-z0-9_]/i', '', $_POST['write_table']);
$wr_id = isset($_POST['wr_id']) ? intval($_POST['wr_id']) : 0;
// 삭제 처리
if ($_POST['act_type'] === 'delete') {
if (empty($_POST['bf_file'])) {
echo json_encode($return);
exit;
}
$bf_file = basename($_POST['bf_file']);
$file_path = G5_DATA_PATH . "/file/{$bo_table}/{$bf_file}";
if (is_file($file_path)) {
@unlink($file_path);
if (isset($config['cf_image_extension']) && preg_match("/\.({$config['cf_image_extension']})$/i", $bf_file)) {
delete_board_thumbnail($bo_table, $bf_file);
}
}
sql_query("DELETE FROM {$g5['board_file_table']} WHERE bo_table = '" . sql_real_escape_string($bo_table) . "' AND wr_id = '{$wr_id}' AND bf_file = '" . sql_real_escape_string($bf_file) . "'");
$return['res'] = 'true';
$return['msg'] = '파일이 삭제 되었습니다.';
echo json_encode($return);
exit;
}
// 업로드 처리
@mkdir(G5_DATA_PATH . "/file/{$bo_table}", G5_DIR_PERMISSION, true);
@chmod(G5_DATA_PATH . "/file/{$bo_table}", G5_DIR_PERMISSION);
$allowed_extensions = explode('|', $config['cf_image_extension'] . '|' . $config['cf_movie_extension'] . '|webp|hwp|xlsx|xls|zip|pdf|ppt|pptx|docx|doc|txt');
$allowed_mimes = [
// 이미지
'image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp', 'image/svg+xml',
// 동영상
'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/x-msvideo', 'video/quicktime', 'video/x-flv',
// 오디오
'audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/mp4', 'audio/webm', 'audio/x-ms-wma',
// 문서
'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/rtf', 'text/plain', 'application/vnd.hancom.hwp',
// 압축파일
'application/zip', 'application/x-rar-compressed', 'application/x-7z-compressed', 'application/x-tar', 'application/gzip',
// 코드 및 기타
'text/html', 'application/javascript', 'text/css', 'application/json', 'application/xml', 'text/csv',
// 기타 가능성 있는 MIME
'application/octet-stream'
];
if (isset($_FILES['file']) && count($_FILES['file']['name']) > 0) {
$list = [];
for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
$tmp_file = $_FILES['file']['tmp_name'][$i];
$orig_name = $_FILES['file']['name'][$i];
$safe_name = preg_replace("/[^a-zA-Z0-9._-]/", "_", $orig_name);
// 이중 확장자 검사 (ex. test.php.jpg)
if (preg_match("/\.(php|pht|phtml|cgi|pl|exe|jsp|asp|inc|sh|js|html|htm|xml)(\.[a-z0-9]+)?$/i", $safe_name)) {
$return['msg'] = '이중 확장자 또는 금지된 확장자가 포함되어 있습니다.';
echo json_encode($return);
exit;
}
// MIME 타입 검사
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $tmp_file);
finfo_close($finfo);
$ext = strtolower(pathinfo($safe_name, PATHINFO_EXTENSION));
if (!in_array($ext, $allowed_extensions) || !in_array($mime, $allowed_mimes)) {
$return['msg'] = '허용되지 않는 파일 형식입니다.';
echo json_encode($return);
exit;
}
// 저장 파일명 생성
$unique = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . uniqid();
$new_filename = $unique . '_' . $safe_name;
$dest_file = G5_DATA_PATH . "/file/{$bo_table}/{$new_filename}";
if (move_uploaded_file($tmp_file, $dest_file)) {
chmod($dest_file, G5_FILE_PERMISSION);
$f = [
'bf_source' => htmlspecialchars($orig_name, ENT_QUOTES, 'UTF-8'),
'bf_file' => $new_filename,
'bf_filesize' => filesize($dest_file),
'bf_datetime' => G5_TIME_YMDHIS,
'extension' => $ext,
'view' => '',
];
$timg = @getimagesize($dest_file);
if ($timg) {
$f['bf_width'] = $timg[0];
$f['bf_height'] = $timg[1];
$f['bf_type'] = $timg[2];
$f['view'] = '<img src="' . G5_DATA_URL . '/file/' . $bo_table . '/' . $new_filename . '" style="max-width:100%;" />';
} else {
$f['view'] = "<div class=\"w_pd\"><a href=\"javascript:void(0);\" class=\"w_etc w_{$ext}\">{$ext}</a></div>";
}
$list[] = $f;
}
}
$return['res'] = 'true';
$return['msg'] = '업로드 완료';
$return['list'] = $list;
echo json_encode($return);
exit;
} else {
$return['msg'] = '파일을 선택하세요';
echo json_encode($return);
exit;
}
?>
+81
View File
@@ -0,0 +1,81 @@
<?php
include_once('../../common.php');
if (!$is_member) {
alert('회원만 이용하실 수 있습니다.');
}
// JSON 응답 함수
function send_json_response($success, $message, $image_url = '') {
echo json_encode(['success' => $success, 'message' => $message, 'image_url' => $image_url]);
exit;
}
// 요청 방식과 파일 확인
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['profile_image'])) {
$file = $_FILES['profile_image'];
$mb_id = isset($member['mb_id']) ? $member['mb_id'] : '';
if (empty($mb_id)) {
send_json_response(false, '회원 아이디가 없습니다.');
}
// 회원 ID 앞 두 글자로 디렉토리 생성
$first_two_chars = substr($mb_id, 0, 2);
$upload_dir = G5_DATA_PATH . "/member_image/$first_two_chars";
// 디렉토리 존재 확인 및 생성
if (!is_dir($upload_dir)) {
if (!mkdir($upload_dir, G5_DIR_PERMISSION, true) && !is_dir($upload_dir)) {
send_json_response(false, '디렉토리를 생성할 수 없습니다.');
}
chmod($upload_dir, G5_DIR_PERMISSION);
}
// 파일 확장자 확인
$allowed_ext = ['gif', 'jpg', 'jpeg', 'png'];
$file_ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($file_ext, $allowed_ext)) {
send_json_response(false, '허용되지 않은 파일 형식입니다.');
}
// 용량 제한 검사
if ($file['size'] > $config['cf_member_img_size']) {
send_json_response(false, '파일 크기가 너무 큽니다. 최대 ' . number_format($config['cf_member_img_size']) . ' 바이트까지 업로드 가능합니다.');
}
// 파일명 지정 (고정된 GIF 이름 사용)
$new_filename = "$mb_id.gif";
$upload_path = "$upload_dir/$new_filename";
// 파일 업로드
if (!move_uploaded_file($file['tmp_name'], $upload_path)) {
send_json_response(false, '파일 업로드 실패');
}
// 업로드된 이미지 정보 확인
$size = @getimagesize($upload_path);
if (!$size || !in_array($size[2], [IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG])) {
@unlink($upload_path);
send_json_response(false, '잘못된 이미지 파일입니다.');
}
// 섬네일 생성 (원본 크기보다 크면 생성)
if ($size[0] > $config['cf_member_img_width'] || $size[1] > $config['cf_member_img_height']) {
$thumb = thumbnail($new_filename, $upload_dir, $upload_dir, $config['cf_member_img_width'], $config['cf_member_img_height'], true, true);
if ($thumb) {
@unlink($upload_path);
rename("$upload_dir/$thumb", $upload_path);
} else {
@unlink($upload_path);
send_json_response(false, '섬네일 생성 실패');
}
}
// 업로드된 이미지 URL 반환
$image_url = G5_DATA_URL . "/member_image/$first_two_chars/$new_filename?v=".G5_SERVER_TIME;
send_json_response(true, '파일 업로드 성공', $image_url);
} else {
send_json_response(false, '잘못된 요청');
}
+68
View File
@@ -0,0 +1,68 @@
<?php
$ajax_files = json_decode(stripslashes($_POST['ajax_files']),true);
$files = empty($ajax_files['files']) ? [] : $ajax_files['files'];
$del = empty($ajax_files['del']) ? [] : $ajax_files['del'];
//echo '<pre>';
//print_r($ajax_files);
//print_r($files);
//print_r($del);
//exit;
if($files){
$file_cnt = count($files);
if($del){ //여집합으로 총파일수구함
$not_del = [];
foreach($files as $v){ $not_del[] = empty($v['file']) ? $v['bf_file'] : $v['file']; }
$c = array_intersect($del,$not_del);
$d = array_diff($del,$c);
$e = array_diff($not_del,$c);
$f = array_merge($d,$e);
$file_cnt = count($f);
}
if($file_cnt>$board['bo_upload_count']){
foreach($files as $v){
if(empty($v['href'])){
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$v['bf_file']);
delete_board_thumbnail($bo_table,$v['bf_file']);
}
}
alert('첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.');exit;
}
$row = sql_fetch(" select max(bf_no) as num from {$g5['board_file_table']} where bo_table='{$bo_table}' and wr_id ='{$wr_id}'");
$num = empty($row['num']) ? 0 : $row['num'];
foreach($files as $v){
if(empty($v['href'])){
$num++;
$sql = "insert into {$g5['board_file_table']} set
bo_table = '{$bo_table}',
wr_id = '{$wr_id}',
bf_no = '{$num}',
bf_source = '{$v['bf_source']}',
bf_file = '{$v['bf_file']}',
bf_filesize = '{$v['bf_filesize']}',
bf_width = '{$v['bf_width']}',
bf_height = '{$v['bf_height']}',
bf_type = '{$v['bf_type']}',
bf_datetime = '".G5_TIME_YMDHIS."' ";
sql_query($sql);
}
}
}
if($del){
sql_query('delete from `'.$g5['board_file_table'].'` where bo_table="'.$bo_table.'" and wr_id='.$wr_id.' and bf_file in ("'.implode('","',array_values($del)).'")');
}
$sql = "select * from {$g5['board_file_table']} where bo_table='{$bo_table}' and wr_id='{$wr_id}'";
$result = sql_query($sql);
$i=0;
while($row = sql_fetch_array($result)){
$sql = "update {$g5['board_file_table']} set bf_no='{$i}' where bo_table='{$bo_table}' and wr_id='{$wr_id}' and bf_no='{$row['bf_no']}'";
sql_query($sql);
$i++;
}
//sql_query('delete from `'.$g5['board_file_table'].'` where bo_table="'.$bo_table.'" and wr_id='.$wr_id.' and bf_file=""');
// 파일의 개수를 게시물에 업데이트 한다.
$rows = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
sql_query(" update {$write_table} set wr_file = '{$rows['cnt']}' where wr_id = '{$wr_id}' ");
?>
+52
View File
@@ -0,0 +1,52 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/**
* Rebuilder 모듈 설정 로드 라이브러리
* rb/rb.lib/module.lib.php
*/
function get_rb_module_config($md_id) {
global $g5, $rb_module_table;
if (!$md_id) return array();
// 모듈 설정 테이블 조회
$rb_skin = sql_fetch(" select * from {$rb_module_table} where md_id = '{$md_id}' ");
// 기본값 설정 (필요시)
if (!isset($rb_skin['md_width']) || !$rb_skin['md_width']) $rb_skin['md_width'] = 180;
if (!isset($rb_skin['md_height']) || !$rb_skin['md_height']) $rb_skin['md_height'] = 150;
return $rb_skin;
}
/*
[참고] 모듈설정 연동 변수 ($rb_skin 배열 키)
$rb_skin['md_id'] 설정ID
$rb_skin['md_layout'] 레이아웃 섹션ID
$rb_skin['md_layout_name'] 레이아웃 스킨명
$rb_skin['md_theme'] 테마명
$rb_skin['md_title'] 타이틀(제목)
$rb_skin['md_bo_table'] 게시판ID
$rb_skin['md_skin'] 스킨명
$rb_skin['md_cnt'] 출력갯수
$rb_skin['md_col'] 행갯수
$rb_skin['md_row'] 열갯수
$rb_skin['md_col_mo'] 행갯수(모바일)
$rb_skin['md_row_mo'] 열갯수(모바일)
$rb_skin['md_gap'] 게시물 간격(여백)
$rb_skin['md_gap_mo'] 모바일 게시물 간격(여백)
$rb_skin['md_width'] 가로사이즈
$rb_skin['md_height'] 세로사이즈
$rb_skin['md_auto_time'] 자동롤링 시간
$rb_skin['md_thumb_is'] 썸네일 출력여부(1,0)
$rb_skin['md_nick_is'] 닉네임 출력여부(1,0)
$rb_skin['md_date_is'] 작성일 출력여부(1,0)
$rb_skin['md_content_is'] 본문내용 출력여부(1,0)
$rb_skin['md_icon_is'] 아이콘 출력여부(1,0)
$rb_skin['md_comment_is'] 댓글수 출력여부(1,0)
$rb_skin['md_swiper_is'] 스와이프 여부(1,0)
$rb_skin['md_auto_is'] 자동롤링 여부(1,0)
*/
?>