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
+10
View File
@@ -0,0 +1,10 @@
<?php
define('G5_IS_ADMIN', true);
require_once '../../common.php';
require_once G5_ADMIN_PATH . '/admin.lib.php';
if (isset($token)) {
$token = @htmlspecialchars(strip_tags($token), ENT_QUOTES);
}
run_event('admin_common');
+225
View File
@@ -0,0 +1,225 @@
<?php
$sub_menu = '000300';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
$bn_id = isset($bn_id) ? preg_replace('/[^0-9]/', '', $bn_id) : '';
$html_title = '배너';
$g5['title'] = $html_title . ' 관리';
if (isset($w) && $w == "u") {
$html_title .= ' 수정';
$sql = "SELECT * FROM rb_banner WHERE bn_id = '$bn_id'";
$bn = sql_fetch($sql);
} else {
$html_title .= ' 입력';
$bn = [
'bn_url' => "http://",
'bn_begin_time' => date("Y-m-d 00:00:00", time()),
'bn_end_time' => date("Y-m-d 00:00:00", time() + (60 * 60 * 24 * 31)),
'bn_id' => ''
];
}
include_once(G5_ADMIN_PATH . '/admin.head.php');
?>
<form name="fbanner" action="./banner_form_update.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?php echo isset($w) ? $w : ''; ?>">
<input type="hidden" name="bn_id" value="<?php echo $bn_id; ?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">이미지</th>
<td>
<input type="file" name="bn_bimg">
<?php
$bimg_str = "";
$bimg = G5_DATA_PATH . "/banners/" . $bn['bn_id'];
if (isset($bn['bn_id']) && file_exists($bimg)) {
$size = @getimagesize($bimg);
$width = (isset($size[0]) && $size[0] > 750) ? 750 : (isset($size[0]) ? $size[0] : 0);
echo '<input type="checkbox" name="bn_bimg_del" value="1" id="bn_bimg_del"> <label for="bn_bimg_del">삭제</label>';
$bimg_str = '<img src="' . G5_DATA_URL . '/banners/' . $bn['bn_id'] . '?ver=' . G5_SERVER_TIME . '" width="' . $width . '">';
}
if (isset($bn['bn_id']) && $bn['bn_id']) {
echo '<div class="banner_or_img">';
echo $bimg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_alt">이미지 설명</label></th>
<td>
<?php echo help("이미지 태그의 alt, title 에 해당되는 내용입니다."); ?>
<input type="text" name="bn_alt" value="<?php echo isset($bn['bn_alt']) ? get_text($bn['bn_alt']) : ''; ?>" id="bn_alt" class="frm_input" size="80">
</td>
</tr>
<tr>
<th scope="row"><label for="bn_url">링크</label></th>
<td>
<?php echo help("배너이미지 클릭시 이동하는 Url입니다."); ?>
<input type="text" name="bn_url" size="80" value="<?php echo isset($bn['bn_url']) ? $bn['bn_url'] : 'http://'; ?>" id="bn_url" class="frm_input">
</td>
</tr>
<tr>
<th scope="row"><label for="bn_position">출력그룹</label></th>
<td>
<select name="bn_position" id="bn_position">
<?php echo rb_banner_group_list($bn['bn_position']) ?>
<option value="topbanner_left" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'topbanner_left'); ?>>상단 왼쪽 배너</option>
<option value="topbanner_rite" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'topbanner_rite'); ?>>상단 오른쪽 배너</option>
<option value="premium_main" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'premium_main'); ?>>프리미엄 광고</option>
<option value="general_main" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'general_main'); ?>>일반 광고</option>
<option value="floating_left" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'floating_left'); ?>>왼쪽 유동형 광고</option>
<option value="floating_right" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'floating_right'); ?>>오른쪽 유동형 광고</option>
<!-- 💡 [추가] 하단 롤링 배너 옵션 추가 -->
<option value="rolling_footer" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', 'rolling_footer'); ?>>하단 롤링 배너</option>
<option value="개별출력" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', '개별출력'); ?>>개별출력</option>
<option value="" <?php echo get_selected(isset($bn['bn_position']) ? $bn['bn_position'] : '', ''); ?>>미출력</option>
</select> <input type="text" name="bn_position_use" id="bn_position_use" class="frm_input" placeholder="그룹생성">
<br><br>
<?php echo help("개별출력의 경우 그룹화 되지 않습니다. 그룹이 없는 경우 그룹생성 항목에 직접 입력하시면 생성 됩니다.<br>생성되는 배너는 모두 모듈설정 패널에서 사용하실 수 있습니다."); ?>
<?php echo htmlspecialchars("그룹별 출력 : <?php echo rb_banners('그룹명'); ?>"); ?><br>
<?php echo htmlspecialchars("개별출력 : <?php echo rb_banners('개별출력', '배너ID'); ?>"); ?><br>
<?php echo htmlspecialchars("미출력 : 배너를 출력하지 않습니다."); ?>
</td>
</tr>
<tr id="bn_group_tr" style="display:none;">
<th scope="row"><label for="bn_group">슬라이드 그룹명</label></th>
<td>
<?php echo help("프리미엄/일반 광고 모듈에서 슬라이드로 묶을 배너들의 그룹명을 입력하세요. (예: slide_A)<br>비워두면 고정 배너로 처리됩니다."); ?>
<input type="text" name="bn_group" value="<?php echo isset($bn['bn_group']) ? get_text($bn['bn_group']) : ''; ?>" id="bn_group" class="frm_input" size="20">
</td>
</tr>
<tr>
<th scope="row"><label for="bn_device">출력기기</label></th>
<td>
<?php echo help('배너이미지를 출력할 기기를 선택할 수 있습니다.'); ?>
<?php $bn_device = isset($bn['bn_device']) ? $bn['bn_device'] : null; ?>
<select name="bn_device" id="bn_device">
<option value="both"<?php echo get_selected($bn_device, 'both', true); ?>>PC와 모바일</option>
<option value="pc"<?php echo get_selected($bn_device, 'pc', true); ?>>PC</option>
<option value="mobile"<?php echo get_selected($bn_device, 'mobile', true); ?>>모바일</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_border">테두리</label></th>
<td>
<?php echo help("배너이미지에 테두리를 넣을지를 설정합니다.", 50); ?>
<select name="bn_border" id="bn_border">
<option value="0" <?php echo get_selected(isset($bn['bn_border']) ? $bn['bn_border'] : 0, 0); ?>>사용안함</option>
<option value="1" <?php echo get_selected(isset($bn['bn_border']) ? $bn['bn_border'] : 1, 1); ?>>사용</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_radius">모서리</label></th>
<td>
<?php echo help("배너이미지에 모서리를 둥글게 처리할지를 설정 합니다.", 50); ?>
<select name="bn_radius" id="bn_radius">
<option value="0" <?php echo get_selected(isset($bn['bn_radius']) ? $bn['bn_radius'] : 0, 0); ?>>사용안함</option>
<option value="1" <?php echo get_selected(isset($bn['bn_radius']) ? $bn['bn_radius'] : 1, 1); ?>>사용</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_ad_ico">AD아이콘</label></th>
<td>
<?php echo help("배너이미지에 AD 아이콘을 보여줄지 설정 합니다.", 50); ?>
<select name="bn_ad_ico" id="bn_ad_ico">
<option value="0" <?php echo get_selected(isset($bn['bn_ad_ico']) ? $bn['bn_ad_ico'] : 0, 0); ?>>사용안함</option>
<option value="1" <?php echo get_selected(isset($bn['bn_ad_ico']) ? $bn['bn_ad_ico'] : 1, 1); ?>>사용</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_new_win">새창</label></th>
<td>
<?php echo help("배너이미지 클릭시 새창연결 여부를 선택할 수 있습니다.", 50); ?>
<select name="bn_new_win" id="bn_new_win">
<option value="0" <?php echo get_selected(isset($bn['bn_new_win']) ? $bn['bn_new_win'] : 0, 0); ?>>사용안함</option>
<option value="1" <?php echo get_selected(isset($bn['bn_new_win']) ? $bn['bn_new_win'] : 1, 1); ?>>사용</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_begin_time">게시 시작일시</label></th>
<td>
<?php echo help("배너 게시 시작일시를 설정합니다."); ?>
<input type="text" name="bn_begin_time" value="<?php echo isset($bn['bn_begin_time']) ? $bn['bn_begin_time'] : date("Y-m-d 00:00:00", time()); ?>" id="bn_begin_time" class="frm_input" size="21" maxlength="19">
<input type="checkbox" name="bn_begin_chk" value="<?php echo date("Y-m-d 00:00:00", time()); ?>" id="bn_begin_chk" onclick="if (this.checked == true) this.form.bn_begin_time.value=this.form.bn_begin_chk.value; else this.form.bn_begin_time.value = this.form.bn_begin_time.defaultValue;">
<label for="bn_begin_chk">오늘</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_end_time">게시 종료일시</label></th>
<td>
<?php echo help("배너 게시 종료일시를 설정합니다."); ?>
<input type="text" name="bn_end_time" value="<?php echo isset($bn['bn_end_time']) ? $bn['bn_end_time'] : date("Y-m-d 00:00:00", time() + 60 * 60 * 24 * 31); ?>" id="bn_end_time" class="frm_input" size=21 maxlength=19>
<input type="checkbox" name="bn_end_chk" value="<?php echo date("Y-m-d 23:59:59", time() + 60 * 60 * 24 * 31); ?>" id="bn_end_chk" onclick="if (this.checked == true) this.form.bn_end_time.value=this.form.bn_end_chk.value; else this.form.bn_end_time.value = this.form.bn_end_time.defaultValue;">
<label for="bn_end_chk">오늘+31일</label>
</td>
</tr>
<tr>
<th scope="row"><label for="bn_order">출력 순서</label></th>
<td>
<?php echo help("숫자가 작을수록 먼저 출력됩니다. (기본값: 0)"); ?>
<input type="number" name="bn_order" value="<?php echo isset($bn['bn_order']) ? (int)$bn['bn_order'] : '0'; ?>" id="bn_order" class="frm_input" size="5">
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<a href="./banner_list.php" class="btn_02 btn">목록</a>
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
jQuery(function($){
function toggle_bn_group() {
var position = $("#bn_position").val();
// 💡 [수정] rolling_footer는 슬라이드 그룹명이 필요 없으므로 제외 (또는 필요하다면 추가)
var target_positions = ["premium_main", "general_main", "floating_left", "floating_right"];
if (target_positions.includes(position)) {
$("#bn_group_tr").show();
} else {
$("#bn_group_tr").hide();
}
}
toggle_bn_group();
$("#bn_position").on("change", function() {
toggle_bn_group();
});
});
</script>
<?php
include_once(G5_ADMIN_PATH . '/admin.tail.php');
?>
+105
View File
@@ -0,0 +1,105 @@
<?php
$sub_menu = '000300';
include_once('./_common.php');
check_demo();
if ($w == 'd')
auth_check_menu($auth, $sub_menu, "d");
else
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
@mkdir(G5_DATA_PATH."/banners", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/banners", G5_DIR_PERMISSION);
$bn_bimg = isset($_FILES['bn_bimg']['tmp_name']) ? $_FILES['bn_bimg']['tmp_name'] : null;
$bn_bimg_name = isset($_FILES['bn_bimg']['name']) ? $_FILES['bn_bimg']['name'] : null;
$bn_id = isset($bn_id) ? (int) $bn_id : 0;
$bn_bimg_del = isset($bn_bimg_del) ? $bn_bimg_del : null;
if ($bn_bimg_del) {
@unlink(G5_DATA_PATH."/banners/$bn_id");
}
// 파일이 이미지인지 체크합니다.
if ($bn_bimg || $bn_bimg_name) {
if (!preg_match('/\.(gif|jpe?g|bmp|png)$/i', $bn_bimg_name)) {
alert("이미지 파일만 업로드 할 수 있습니다.");
}
$timg = @getimagesize($bn_bimg);
if ($timg === false || $timg[2] < 1 || $timg[2] > 16) {
alert("이미지 파일만 업로드 할 수 있습니다.");
}
}
$bn_url = isset($bn_url) ? clean_xss_tags($bn_url) : '';
$bn_alt = isset($bn_alt) ? (function_exists('clean_xss_attributes') ? clean_xss_attributes(strip_tags($bn_alt)) : strip_tags($bn_alt)) : '';
$bn_group = isset($_POST['bn_group']) ? preg_replace('/[^a-z0-9_]/i', '', $_POST['bn_group']) : ''; // 💡 [추가] bn_group 값 받기
if(isset($_POST['bn_position_use']) && $_POST['bn_position_use']) {
$bn_position = $_POST['bn_position_use'];
} else {
$bn_position = $_POST['bn_position'];
}
if ($w == "") {
if (!$bn_bimg_name) alert('배너 이미지를 업로드 하세요.');
sql_query("ALTER TABLE rb_banner AUTO_INCREMENT=1");
$sql = "INSERT INTO rb_banner
SET bn_alt = '$bn_alt',
bn_url = '$bn_url',
bn_device = '$bn_device',
bn_position = '$bn_position',
bn_group = '$bn_group', /* 💡 [추가] */
bn_border = '$bn_border',
bn_radius = '$bn_radius',
bn_ad_ico = '$bn_ad_ico',
bn_new_win = '$bn_new_win',
bn_begin_time = '$bn_begin_time',
bn_end_time = '$bn_end_time',
bn_time = '$now',
bn_hit = '0',
bn_order = '$bn_order'";
sql_query($sql);
$bn_id = sql_insert_id();
} elseif ($w == "u") {
$sql = "UPDATE rb_banner
SET bn_alt = '$bn_alt',
bn_url = '$bn_url',
bn_device = '$bn_device',
bn_position = '$bn_position',
bn_group = '$bn_group', /* 💡 [추가] */
bn_border = '$bn_border',
bn_radius = '$bn_radius',
bn_ad_ico = '$bn_ad_ico',
bn_new_win = '$bn_new_win',
bn_begin_time = '$bn_begin_time',
bn_end_time = '$bn_end_time',
bn_order = '$bn_order'
WHERE bn_id = '$bn_id'";
sql_query($sql);
} elseif ($w == "d") {
@unlink(G5_DATA_PATH."/banners/$bn_id");
$sql = "DELETE FROM rb_banner WHERE bn_id = $bn_id";
$result = sql_query($sql);
}
if ($w == "" || $w == "u") {
if (isset($_FILES['bn_bimg']['name']) && $_FILES['bn_bimg']['name']) {
rb_upload_files($_FILES['bn_bimg']['tmp_name'], $bn_id, G5_DATA_PATH."/banners");
}
goto_url("./banner_form.php?w=u&amp;bn_id=$bn_id");
} else {
goto_url("./banner_list.php");
}
?>
+165
View File
@@ -0,0 +1,165 @@
<?php
$sub_menu = '000300';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "r");
//배너 테이블이 있는지 검사한다.
if(!sql_query(" DESCRIBE rb_banner ", false)) {
$query_cp = sql_query(" CREATE TABLE IF NOT EXISTS `rb_banner` (
`bn_id` int(11) NOT NULL AUTO_INCREMENT,
`bn_alt` varchar(255) NOT NULL DEFAULT '',
`bn_url` varchar(255) NOT NULL DEFAULT '',
`bn_device` varchar(10) NOT NULL DEFAULT '',
`bn_position` varchar(255) NOT NULL DEFAULT '',
`bn_border` tinyint(4) NOT NULL DEFAULT '0',
`bn_radius` tinyint(4) NOT NULL DEFAULT '0',
`bn_ad_ico` tinyint(4) NOT NULL DEFAULT '0',
`bn_new_win` tinyint(4) NOT NULL DEFAULT '0',
`bn_begin_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_hit` int(11) NOT NULL DEFAULT '0',
`bn_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`bn_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
sql_query(" ALTER TABLE `rb_banner` ADD PRIMARY KEY (`bn_id`) ", false);
sql_query(" ALTER TABLE `rb_banner` MODIFY `bn_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;COMMIT ", false);
}
$g5['title'] = '배너관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$sql_common = " from rb_banner ";
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
?>
<div class="local_ov01 local_ov">
<span class="btn_ov01"><span class="ov_txt"> 등록된 배너 </span><span class="ov_num"> <?php echo $total_count; ?>개</span></span>
</div>
<div class="btn_fixed_top">
<a href="./banner_form.php" class="btn_01 btn">배너추가</a>
</div>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col" id="th_id">ID</th>
<th scope="col" id="th_dvc">배너 Url</th>
<th scope="col" id="th_inf">배너설명</th>
<th scope="col" id="th_loc">출력그룹</th>
<th scope="col" id="th_dev">출력기기</th>
<th scope="col" id="th_st">시작일시</th>
<th scope="col" id="th_end">종료일시</th>
<th scope="col" id="th_odr">출력순서</th>
<th scope="col" id="th_hit">클릭</th>
<th scope="col" id="th_mng">관리</th>
</tr>
</thead>
<tbody>
<?php
$sql = " select * from rb_banner
order by bn_position, bn_id desc
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$bn_border = $row['bn_border'];
$bn_radius = $row['bn_radius'];
$bn_ad_ico = $row['bn_ad_ico'];
// 새창 띄우기인지
$bn_new_win = ($row['bn_new_win']) ? 'target="_blank"' : '';
$bimg = G5_DATA_PATH.'/banners/'.$row['bn_id'];
if(file_exists($bimg)) {
$size = @getimagesize($bimg);
if($size[0] && $size[0] > 800)
$width = 800;
else
$width = $size[0];
$bn_img = "";
$bn_img .= G5_DATA_URL."/banners/".$row['bn_id'];
}
switch($row['bn_device']) {
case 'pc':
$bn_device = 'PC';
break;
case 'mobile':
$bn_device = '모바일';
break;
default:
$bn_device = 'PC와 모바일';
break;
}
$bn_begin_time = substr($row['bn_begin_time'], 0, 19);
$bn_end_time = substr($row['bn_end_time'], 0, 19);
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td headers="th_id" class="td_num"><?php echo $row['bn_id']; ?></td>
<td headers="th_dvc"><a href="<?php echo !empty($bn_img) ? $bn_img : '#'; ?>" target="_blank"><?php echo !empty($bn_img) ? $bn_img : '이미지 없음'; ?></a></td>
<td headers="th_loc"><?php echo !empty($row['bn_alt']) ? $row['bn_alt'] : '-'; ?></td>
<td headers="th_loc">
<?php if($row['bn_position'] == "") {
echo "-";
} else {
echo $row['bn_position'];
}
?>
</td>
<td headers="th_loc">
<?php echo $bn_device; ?>
</td>
<td headers="th_st" class="td_datetime"><?php echo $bn_begin_time; ?></td>
<td headers="th_end" class="td_datetime"><?php echo $bn_end_time; ?></td>
<td headers="th_odr" class="td_num"><?php echo $row['bn_order']; ?></td>
<td headers="th_hit" class="td_num"><?php echo number_format($row['bn_hit']); ?></td>
<td headers="th_mng" class="td_mng td_mns_m">
<a href="./banner_form.php?w=u&amp;bn_id=<?php echo $row['bn_id']; ?>" class="btn btn_03">수정</a>
<a href="./banner_form_update.php?w=d&amp;bn_id=<?php echo $row['bn_id']; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
</td>
</tr>
<?php
}
if ($i == 0) {
echo '<tr><td colspan="10" class="empty_table">자료가 없습니다.</td></tr>';
}
?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<div class="local_desc01 local_desc">
<p>
배너를 등록하시면 모듈설정에서 추가하실 수 있습니다.
</p>
</div>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>
+252
View File
@@ -0,0 +1,252 @@
<?php
$sub_menu = '000400';
include_once('./_common.php');
include_once(G5_EDITOR_LIB);
auth_check_menu($auth, $sub_menu, "w");
$bo_table = $_GET['bo_table'];
$write_table = $g5['write_prefix'] . $bo_table;
global $g5, $board;
if($w == "u") {
$wr_id = isset($_REQUEST['wr_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['wr_id']) : 0;
$sql = " select * from {$write_table} where wr_id = '$wr_id' and wr_is_comment = '0' ";
$wr = sql_fetch($sql);
if (! (isset($wr['wr_id']) && $wr['wr_id'])) alert('등록된 게시물이 없습니다.');
$name = get_text($wr['wr_name']);
}
$g5['title'] = '게시물 관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$qstr .= ($qstr ? '&amp;' : '').'sca='.$sca;
// 게시글에 첨부된 파일을 얻는다. (배열로 반환)
if($w == "u") {
function get_file_qa($bo_table, $wr_id)
{
global $g5, $qstr, $board;
$file['count'] = 0;
$sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = (int) $row['bf_no'];
$bf_content = $row['bf_content'] ? html_purifier($row['bf_content']) : '';
$file[$no]['href'] = G5_BBS_URL."/download.php?bo_table=$bo_table&amp;wr_id=$wr_id&amp;no=$no" . $qstr;
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no]['path'] = G5_DATA_URL.'/file/'.$bo_table;
$file[$no]['size'] = get_filesize($row['bf_filesize']);
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $bf_content;
$file[$no]['content'] = get_text($bf_content);
//$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
$file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
$file[$no]['file'] = $row['bf_file'];
$file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
$file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
$file[$no]['image_type'] = $row['bf_type'];
$file[$no]['bf_fileurl'] = $row['bf_fileurl'];
$file[$no]['bf_thumburl'] = $row['bf_thumburl'];
$file[$no]['bf_storage'] = $row['bf_storage'];
$file['count']++;
}
return run_replace('get_files', $file, $bo_table, $wr_id);
}
$file = get_file($bo_table, $wr_id);
if (!isset($file_count)) {
$file_count = 0;
}
if (isset($file['count']) && $file_count < $file['count']) {
$file_count = $file['count'];
}
for($i=0;$i<$file_count;$i++){
if(! isset($file[$i])) {
$file[$i] = array('file'=>null, 'source'=>null, 'size'=>null, 'bf_content' => null);
}
}
}
//카테고리
$is_category = false;
$category_option = '';
if ($board['bo_use_category']) {
$ca_name = "";
if (isset($wr['ca_name']))
$ca_name = $wr['ca_name'];
$category_option = get_category_option($bo_table, $ca_name);
$is_category = true;
}
//링크
$is_link = false;
if ($member['mb_level'] >= $board['bo_link_level']) {
$is_link = true;
}
//파일
$is_file = false;
if ($member['mb_level'] >= $board['bo_upload_level']) {
$is_file = true;
}
$is_file_content = false;
if ($board['bo_use_file_content']) {
$is_file_content = true;
}
$file_count = (int)$board['bo_upload_count'];
//공지
$notice_array = explode(',', trim($board['bo_notice']));
$notice_checked = '';
if ($w == 'u') {
if (in_array((int)$wr_id, $notice_array)) {
$notice_checked = 'checked';
}
}
?>
<form name="fitemqaform" method="post" action="./bbs_form_update.php" method="post" enctype="multipart/form-data" onsubmit="return fitemqaform_submit(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
<input type="hidden" value="html1" name="html">
<?php if($w == "u") { ?>
<input type="hidden" name="wr_id" value="<?php echo $wr_id; ?>">
<input type="hidden" name="mb_id" value="<?php echo $wr['mb_id']; ?>">
<input type="hidden" name="wr_name" value="<?php echo $wr['wr_name']; ?>">
<input type="hidden" name="wr_email" value="<?php echo $wr['wr_email']; ?>">
<?php } else { ?>
<input type="hidden" name="mb_id" value="<?php echo $member['mb_id']; ?>">
<input type="hidden" name="wr_name" value="<?php echo $member['mb_nick']; ?>">
<input type="hidden" name="wr_email" value="<?php echo $member['mb_email']; ?>">
<?php } ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<?php if ($is_category) { ?>
<tr>
<th scope="row">분류</th>
<td class="">
<select name="ca_name" id="ca_name" required class="select">
<option value="">분류를 선택하세요</option>
<?php echo $category_option ?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<th scope="row">옵션</th>
<td class="">
<input type="checkbox" id="notice" name="notice" value="1" <?php echo $notice_checked ?>><label for="notice"> 공지</label>
</td>
</tr>
<?php if($w == "u") { ?>
<tr>
<th scope="row">작성자</th>
<td>
<a href="./member_form.php?w=u&mb_id=<?php echo $wr['mb_id'] ?>"><?php echo $name; ?></a>
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="wr_subject">제목</label></th>
<td><input type="text" name="wr_subject" value="<?php echo isset($wr['wr_subject']) ? $wr['wr_subject'] : ''; ?>" id="wr_subject" required class="frm_input required" size="95"></td>
</tr>
<tr>
<th scope="row"><label for="wr_content">내용</label></th>
<td><?php echo editor_html('wr_content', get_text(html_purifier(isset($wr['wr_content']) ? $wr['wr_content'] : ''), 0)); ?></td>
</tr>
<?php for ($i=1; $is_link && $i<=G5_LINK_COUNT; $i++) { ?>
<tr>
<th scope="row">링크 <?php echo $i ?></th>
<td class="">
<input type="text" name="wr_link<?php echo $i ?>" value="<?php if($w=="u"){ echo $wr['wr_link'.$i]; } ?>" id="wr_link<?php echo $i ?>" class="frm_input" size="50" placeholder="링크 <?php echo $i ?>">
</td>
</tr>
<?php } ?>
<?php
if($w == "u") {
$file = get_file_qa($bo_table, $wr_id);
}
for ($i=0; $is_file && $i<$file_count; $i++) {
?>
<tr>
<th scope="row"><label for="mb_icon">첨부파일 <?php echo $i+1 ?></label></th>
<td>
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i+1 ?>" title="파일첨부 <?php echo $i+1 ?>" class="frm_input"> 
<?php if ($w == "u" && isset($file[$i]['source']) && $file[$i]['source']) { ?>
<a href="<?php echo $file[$i]['href']; ?>" style="font-weight:bold"><?php echo $file[$i]['source'] ?></a> (<?php echo $file[$i]['size'] ?>) 
<?php } ?>
<?php if ($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']) { ?>
<span class="file_del">
<input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i; ?>]" value="1"> <label for="bf_file_del<?php echo $i ?>"> 파일삭제</label>
</span>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<a href="./bbs_list.php?<?php echo $qstr; ?>&amp;bo_table=<?php echo $bo_table; ?>" class="btn btn_02">목록</a>
<input type="submit" accesskey='s' value="확인" class="btn_submit btn">
</div>
</form>
<script>
function fitemqaform_submit(f)
{
<?php echo get_editor_js('wr_content'); ?>
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+521
View File
@@ -0,0 +1,521 @@
<?php
$sub_menu = '000400';
include_once('./_common.php');
check_demo();
if ($w == 'd')
auth_check_menu($auth, $sub_menu, "d");
else
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
$bo_table = $_POST['bo_table'];
global $g5, $board;
if ($w == 'u') {
$wr_id = $_POST['wr_id'];
}
$mb_id = $_POST['mb_id'];
$msg = array();
//분류확인
if($board['bo_use_category']) {
$ca_name = isset($_POST['ca_name']) ? trim($_POST['ca_name']) : '';
if(!$ca_name) {
$msg[] = '<strong>분류</strong>를 선택하세요.';
}
} else {
$ca_name = '';
}
//제목확인
$wr_subject = '';
if (isset($_POST['wr_subject'])) {
$wr_subject = substr(trim($_POST['wr_subject']),0,255);
$wr_subject = preg_replace("#[\\\]+$#", "", $wr_subject);
}
if ($wr_subject == '') {
$msg[] = '<strong>제목</strong>을 입력하세요.';
}
//내용확인
$wr_content = '';
if (isset($_POST['wr_content'])) {
$wr_content = substr(trim($_POST['wr_content']),0,65536);
$wr_content = preg_replace("#[\\\]+$#", "", $wr_content);
}
if ($wr_content == '') {
$msg[] = '<strong>내용</strong>을 입력하세요.';
}
//링크확인
$wr_link1 = '';
if (isset($_POST['wr_link1'])) {
$wr_link1 = substr($_POST['wr_link1'],0,1000);
$wr_link1 = trim(strip_tags($wr_link1));
$wr_link1 = preg_replace("#[\\\]+$#", "", $wr_link1);
}
$wr_link2 = '';
if (isset($_POST['wr_link2'])) {
$wr_link2 = substr($_POST['wr_link2'],0,1000);
$wr_link2 = trim(strip_tags($wr_link2));
$wr_link2 = preg_replace("#[\\\]+$#", "", $wr_link2);
}
//경고출력
$msg = implode('<br>', $msg);
if ($msg) {
alert($msg);
}
$upload_max_filesize = ini_get('upload_max_filesize');
if (empty($_POST)) {
alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n서버관리자에게 문의 바랍니다.");
}
$notice_array = explode(",", $board['bo_notice']);
$wr_password = isset($_POST['wr_password']) ? $_POST['wr_password'] : '';
$bf_content = isset($_POST['bf_content']) ? (array) $_POST['bf_content'] : array();
$_POST['html'] = isset($_POST['html']) ? clean_xss_tags($_POST['html'], 1, 1) : '';
$_POST['secret'] = isset($_POST['secret']) ? clean_xss_tags($_POST['secret'], 1, 1) : '';
$_POST['mail'] = isset($_POST['mail']) ? clean_xss_tags($_POST['mail'], 1, 1) : '';
if ($w == 'u') {
$wr = get_write($write_table, $wr_id);
if (!$wr['wr_id']) {
alert("해당 게시물이 존재하지 않습니다.");
}
}
//비밀글 체크
$secret = '';
if (isset($_POST['secret']) && $_POST['secret']) {
if(preg_match('#secret#', strtolower($_POST['secret']), $matches))
$secret = $matches[0];
}
//html 체크
$html = '';
if (isset($_POST['html']) && $_POST['html']) {
if(preg_match('#html(1|2)#', strtolower($_POST['html']), $matches))
$html = $matches[0];
}
//메일발송 체크
$mail = '';
if (isset($_POST['mail']) && $_POST['mail']) {
if(preg_match('#mail#', strtolower($_POST['mail']), $matches))
$mail = $matches[0];
}
//공지체크
$notice = '';
if (isset($_POST['notice']) && $_POST['notice']) {
$notice = $_POST['notice'];
}
//여분필드 체크
for ($i=1; $i<=10; $i++) {
$var = "wr_$i";
$$var = "";
if (isset($_POST['wr_'.$i]) && settype($_POST['wr_'.$i], 'string')) {
$$var = trim($_POST['wr_'.$i]);
}
}
//옵션
$options = array($html,$secret,$mail);
$wr_option = implode(',', array_filter(array_map('trim', $options)));
if ($w == ""){
if ($member['mb_id']) {
$mb_id = $member['mb_id'];
$wr_name = addslashes(clean_xss_tags($board['bo_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']));
} else {
$mb_id = '';
// 비회원의 경우 이름이 누락되는 경우가 있음
$wr_name = clean_xss_tags(trim($_POST['wr_name']));
if (!$wr_name)
alert('이름은 필히 입력하셔야 합니다.');
$wr_password = get_encrypt_string($wr_password);
$wr_email = get_email_address(trim($_POST['wr_email']));
$wr_homepage = clean_xss_tags($wr_homepage);
}
}
$wr_seo_title = exist_seo_title_recursive('bbs', generate_seo_title($wr_subject), $write_table, $wr_id);
$wr_num = get_next_num($write_table);
$wr_reply = '';
if ($w == "") {
$sql = " insert into $write_table
set wr_num = '$wr_num',
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$wr_option',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_seo_title = '$wr_seo_title',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '{$member['mb_id']}',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql);
$wr_id = sql_insert_id();
// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
// 새글 INSERT
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
// 게시글 1 증가
sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
// 공지처리
if ($w == '') {
if ($notice) {
$bo_notice = $wr_id.($board['bo_notice'] ? ",".$board['bo_notice'] : '');
sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
}
} else {
}
} else if($w == "u") {
if ($member['mb_id']) {
// 자신의 글이라면
if ($member['mb_id'] === $wr['mb_id']) {
$mb_id = $member['mb_id'];
$wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));
$wr_email = addslashes($member['mb_email']);
$wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));
} else {
$mb_id = $wr['mb_id'];
if(isset($_POST['wr_name']) && $_POST['wr_name'])
$wr_name = clean_xss_tags(trim($_POST['wr_name']));
else
$wr_name = addslashes(clean_xss_tags($wr['wr_name']));
if(isset($_POST['wr_email']) && $_POST['wr_email'])
$wr_email = get_email_address(trim($_POST['wr_email']));
else
$wr_email = addslashes($wr['wr_email']);
if(isset($_POST['wr_homepage']) && $_POST['wr_homepage'])
$wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage']));
else
$wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage']));
}
} else {
$mb_id = "";
// 비회원의 경우 이름이 누락되는 경우가 있음
if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다.");
$wr_name = clean_xss_tags(trim($_POST['wr_name']));
$wr_email = get_email_address(trim($_POST['wr_email']));
}
$sql_password = $wr_password ? " , wr_password = '".get_encrypt_string($wr_password)."' " : "";
$sql_ip = '';
if (!$is_admin)
$sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$sql = " update {$write_table}
set ca_name = '{$ca_name}',
wr_option = '{$wr_option}',
wr_subject = '{$wr_subject}',
wr_content = '{$wr_content}',
wr_seo_title = '$wr_seo_title',
wr_link1 = '{$wr_link1}',
wr_link2 = '{$wr_link2}',
mb_id = '{$mb_id}',
wr_name = '{$wr_name}',
wr_email = '{$wr_email}',
wr_homepage = '{$wr_homepage}'
{$sql_ip}
{$sql_password}
where wr_id = '{$wr['wr_id']}' ";
sql_query($sql);
// 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함
// 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음
$sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' ";
sql_query($sql);
$bo_notice = board_notice($board['bo_notice'], $wr_id, $notice);
sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");
// 글을 수정한 경우에는 제목이 달라질수도 있으니 static variable 를 새로고침합니다.
$write = get_write( $write_table, $wr['wr_id'], false);
}
// 파일개수 체크
$file_count = 0;
$upload_count = (isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) ? count($_FILES['bf_file']['name']) : 0;
for ($i=0; $i<$upload_count; $i++) {
if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i]))
$file_count++;
}
if($w == 'u') {
$file = get_file($bo_table, $wr_id);
if($file_count && (int)$file['count'] > $board['bo_upload_count'])
alert('기존 파일을 삭제하신 후 첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.');
} else {
if($file_count > $board['bo_upload_count'])
alert('첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.');
}
// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
// 가변 파일 업로드
$file_upload_msg = '';
$upload = array();
if(isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) {
for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {
$upload[$i]['file'] = '';
$upload[$i]['source'] = '';
$upload[$i]['filesize'] = 0;
$upload[$i]['image'] = array();
$upload[$i]['image'][0] = 0;
$upload[$i]['image'][1] = 0;
$upload[$i]['image'][2] = 0;
$upload[$i]['fileurl'] = '';
$upload[$i]['thumburl'] = '';
$upload[$i]['storage'] = '';
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {
$upload[$i]['del_check'] = true;
$row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
$delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row);
if( file_exists($delete_file) ){
@unlink($delete_file);
}
// 썸네일삭제
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
delete_board_thumbnail($bo_table, $row['bf_file']);
}
}
else
$upload[$i]['del_check'] = false;
$tmp_file = $_FILES['bf_file']['tmp_name'][$i];
$filesize = $_FILES['bf_file']['size'][$i];
$filename = $_FILES['bf_file']['name'][$i];
$filename = get_safe_filename($filename);
// 서버에 설정된 값보다 큰파일을 업로드 한다면
if ($filename) {
if ($_FILES['bf_file']['error'][$i] == 1) {
$file_upload_msg .= '\"'.$filename.'\" 파일의 용량이 서버에 설정('.$upload_max_filesize.')된 값보다 크므로 업로드 할 수 없습니다.\\n';
continue;
}
else if ($_FILES['bf_file']['error'][$i] != 0) {
$file_upload_msg .= '\"'.$filename.'\" 파일이 정상적으로 업로드 되지 않았습니다.\\n';
continue;
}
}
if (is_uploaded_file($tmp_file)) {
// 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀
if (!$is_admin && $filesize > $board['bo_upload_size']) {
$file_upload_msg .= '\"'.$filename.'\" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($board['bo_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n';
continue;
}
//=================================================================\
// 090714
// 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지
// 에러메세지는 출력하지 않는다.
//-----------------------------------------------------------------
$timg = @getimagesize($tmp_file);
// image type
if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) ||
preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) {
if ($timg['2'] < 1 || $timg['2'] > 18)
continue;
}
//=================================================================
$upload[$i]['image'] = $timg;
// 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정
if ($w == 'u') {
// 존재하는 파일이 있다면 삭제합니다.
$row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
if(isset($row['bf_file']) && $row['bf_file']){
$delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row);
if( file_exists($delete_file) ){
@unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);
}
// 이미지파일이면 썸네일삭제
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {
delete_board_thumbnail($bo_table, $row['bf_file']);
}
}
}
// 프로그램 원래 파일명
$upload[$i]['source'] = $filename;
$upload[$i]['filesize'] = $filesize;
// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|pht|phtm|htm|cgi|pl|exe|jsp|asp|inc|phar)/i", "$0-x", $filename);
shuffle($chars_array);
$shuffle = implode('', $chars_array);
// 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
$upload[$i]['file'] = md5(sha1($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename);
$dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file'];
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, G5_FILE_PERMISSION);
$dest_file = run_replace('write_update_upload_file', $dest_file, $board, $wr_id, $w);
$upload[$i] = run_replace('write_update_upload_array', $upload[$i], $dest_file, $board, $wr_id, $w);
}
} // end for
} // end if
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
for ($i=0; $i<count($upload); $i++)
{
$upload[$i]['source'] = sql_real_escape_string($upload[$i]['source']);
$bf_content[$i] = isset($bf_content[$i]) ? sql_real_escape_string($bf_content[$i]) : '';
$bf_width = isset($upload[$i]['image'][0]) ? (int) $upload[$i]['image'][0] : 0;
$bf_height = isset($upload[$i]['image'][1]) ? (int) $upload[$i]['image'][1] : 0;
$bf_type = isset($upload[$i]['image'][2]) ? (int) $upload[$i]['image'][2] : 0;
$row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
if ($row['cnt'])
{
// 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
// 그렇지 않다면 내용만 업데이트 합니다.
if ($upload[$i]['del_check'] || $upload[$i]['file'])
{
$sql = " update {$g5['board_file_table']}
set bf_source = '{$upload[$i]['source']}',
bf_file = '{$upload[$i]['file']}',
bf_content = '{$bf_content[$i]}',
bf_fileurl = '{$upload[$i]['fileurl']}',
bf_thumburl = '{$upload[$i]['thumburl']}',
bf_storage = '{$upload[$i]['storage']}',
bf_filesize = '".(int)$upload[$i]['filesize']."',
bf_width = '".$bf_width."',
bf_height = '".$bf_height."',
bf_type = '".$bf_type."',
bf_datetime = '".G5_TIME_YMDHIS."'
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and bf_no = '{$i}' ";
sql_query($sql);
}
else
{
$sql = " update {$g5['board_file_table']}
set bf_content = '{$bf_content[$i]}'
where bo_table = '{$bo_table}'
and wr_id = '{$wr_id}'
and bf_no = '{$i}' ";
sql_query($sql);
}
}
else
{
$sql = " insert into {$g5['board_file_table']}
set bo_table = '{$bo_table}',
wr_id = '{$wr_id}',
bf_no = '{$i}',
bf_source = '{$upload[$i]['source']}',
bf_file = '{$upload[$i]['file']}',
bf_content = '{$bf_content[$i]}',
bf_fileurl = '{$upload[$i]['fileurl']}',
bf_thumburl = '{$upload[$i]['thumburl']}',
bf_storage = '{$upload[$i]['storage']}',
bf_download = 0,
bf_filesize = '".(int)$upload[$i]['filesize']."',
bf_width = '".$bf_width."',
bf_height = '".$bf_height."',
bf_type = '".$bf_type."',
bf_datetime = '".G5_TIME_YMDHIS."' ";
sql_query($sql);
run_event('write_update_file_insert', $bo_table, $wr_id, $upload[$i], $w);
}
}
// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
// 파일 정보가 없다면 테이블의 내용을 삭제합니다.
$row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
for ($i=(int)$row['max_bf_no']; $i>=0; $i--)
{
$row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
// 정보가 있다면 빠집니다.
if (isset($row2['bf_file']) && $row2['bf_file']) break;
// 그렇지 않다면 정보를 삭제합니다.
sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
}
// 파일의 개수를 게시물에 업데이트 한다.
$row = 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 = '{$row['cnt']}' where wr_id = '{$wr_id}' ");
// 자동저장된 레코드를 삭제한다.
sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' ");
//------------------------------------------------------------------------------
delete_cache_latest($bo_table);
if ($file_upload_msg) {
alert($file_upload_msg);
}
if($w == "u") {
goto_url("./bbs_form.php?w=u&amp;wr_id=$wr_id&amp;sca=$sca&amp;$qstr&amp;bo_table=$bo_table");
} else if ($w == "") {
goto_url("./bbs_list.php?$qstr&amp;bo_table=$bo_table");
}
+231
View File
@@ -0,0 +1,231 @@
<?php
$sub_menu = '000400';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "r");
$g5['title'] = '게시물 관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
add_stylesheet('<link rel="stylesheet" href="'.G5_ADMIN_URL.'/rb/css/style.css">', 1);
$bo_table = isset($_GET['bo_table']) ? $_GET['bo_table'] : '';
$write_table = isset($g5['write_prefix']) ? $g5['write_prefix'] . $bo_table : '';
global $board;
$where = " where wr_is_comment = 0 and ";
$sql_search = "";
if ($stx != "") {
if ($sfl != "") {
$sql_search .= " $where $sfl like '%$stx%' ";
$where = " and ";
}
if ($save_stx != $stx)
$page = 1;
}
if ($sca != "") {
$sql_search .= " and ca_id like '$sca%' ";
}
//if ($sfl == "") $sfl = "it_name";
if (!$sst) {
$sst = "wr_id";
$sod = "desc";
}
if ($stx) {
$sql_common = " from {$write_table} ";
} else {
$sql_common = " from {$write_table} where wr_is_comment = 0 ";
}
$sql_common .= $sql_search;
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = isset($row['cnt']) ? $row['cnt'] : 0;
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
$sql_common
order by $sst $sod, wr_id desc
limit $from_record, $rows ";
$result = sql_query($sql);
//$qstr = 'page='.$page.'&amp;sst='.$sst.'&amp;sod='.$sod.'&amp;stx='.$stx;
$qstr .= ($qstr ? '&amp;' : '').'sca='.$sca.'&amp;save_stx='.$stx;
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table.'" class="ov_listall">전체목록</a>';
//제외할 게시판이 있다면 아래 예제와 같이 추가
//$sql_wheres = " where (1) ";
//$sql_wheres .= " and bo_table != 'aaa' ";
//$sql_wheres .= " and bo_table != 'bbb' ";
//$sql_wheres .= " and bo_table != 'ccc' ";
$sql_wheres = isset($sql_wheres) ? $sql_wheres : '';
$sql_b = "SELECT bo_table, bo_subject FROM " . (isset($g5['board_table']) ? $g5['board_table'] : '') . " " . $sql_wheres . " ORDER BY bo_mobile_subject";
$res_b = sql_query($sql_b);
//
?>
<form name="fcategory" method="get" class="local_sch01 local_sch">
<div class="local_ov01 local_ov">
<select name="bo_table" onchange="this.form.submit();" class="select">
<option value=''>게시판 선택</option>
<?php
for ($i = 0; $row_b = sql_fetch_array($res_b); $i++) {
$bo_table_id = isset($row_b['bo_table']) ? $row_b['bo_table'] : '';
$bo_table_tit = isset($row_b['bo_subject']) ? $row_b['bo_subject'] : '';
$bo_table_partner_txt = isset($bo_table_partner_txt) ? $bo_table_partner_txt : '';
?>
<option value="<?php echo $bo_table_id ?>" <?php if (isset($bo_table) && $bo_table == $bo_table_id) { ?>selected<?php } ?>><?php echo $bo_table_partner_txt; ?><?php echo $bo_table_tit; ?></option>
<?php
}
?>
</select>
<!--
<?php echo $listall; ?>
-->
<?php if($bo_table) { ?>
<span class="btn_ov01"><span class="ov_txt"> <?php echo $board['bo_mobile_subject']; ?> </span><span class="ov_num"> <?php echo $total_count; ?>건</span></span>
<?php } else { ?>
<span class="btn_ov01"><span class="ov_txt"> 미선택</span><span class="ov_num">게시판을 선택해주세요.</span></span>
<?php } ?>
</div>
</form>
<!--
<form name="flist" class="local_sch01 local_sch">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="wr_name" <?php echo get_selected($sfl, 'wr_name'); ?>>작성자</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="frm_input required">
<input type="submit" value="검색" class="btn_submit">
</form>
-->
<form name="fitemqalist" method="post" action="./bbs_list_update.php" onsubmit="return fitemqalist_submit(this);" autocomplete="off">
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
<div class="tbl_head01 tbl_wrap" id="itemqalist">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col"><?php echo subject_sort_link('wr_subject'); ?>제목</a></th>
<th scope="col"><?php echo subject_sort_link('wr_datetime'); ?>작성일</a></th>
<th scope="col"><?php echo subject_sort_link('wr_name'); ?>작성자</a></th>
<th scope="col"><?php echo subject_sort_link('wr_hit'); ?>조회</a></th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
$row['wr_subject'] = $row['wr_subject'];
$mb_info = get_member($row['mb_id']);
$name = get_sideview($row['mb_id'], get_text($mb_info['mb_nick']), $mb_info['mb_email'], $mb_info['mb_homepage']);
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['wr_subject']) ?></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
<input type="hidden" name="wr_id[<?php echo $i; ?>]" value="<?php echo $row['wr_id']; ?>">
</td>
<td class="td_left">
<?php if($row['ca_name']) { ?>[<?php echo $row['ca_name']; ?>]<?php } ?> <a href="./bbs_form.php?w=u&amp;wr_id=<?php echo $row['wr_id']; ?>&amp;<?php echo $qstr; ?>&amp;bo_table=<?php echo $bo_table; ?>"><?php echo get_text($row['wr_subject']); ?></a>
</td>
<td class="td_datetime"><?php echo $row['wr_datetime']; ?></td>
<td class="td_name sv_use" nowrap><div><?php echo $name ?></div></td>
<td class="td_mng td_mng_s"><?php echo $row['wr_hit']; ?></td>
<td class="td_mng td_mng_s">
<a href="./bbs_form.php?w=u&amp;wr_id=<?php echo $row['wr_id']; ?>&amp;<?php echo $qstr; ?>&amp;bo_table=<?php echo $bo_table; ?>" class="btn btn_03"><span class="sound_only"><?php echo get_text($row['wr_subject']); ?> </span>수정</a>
</td>
</tr>
<?php
}
if ($i == 0) {
if($bo_table) {
echo '<tr><td colspan="6" class="empty_table"><span>게시물이 없습니다.</span></td></tr>';
} else {
echo '<tr><td colspan="6" class="empty_table"><span>게시판을 선택해주세요.</span></td></tr>';
}
}
?>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
<?php if(!$bo_table) { ?>
<a href="javascript:alert('게시판을 선택해주세요.');" id="bo_add" class="btn_01 btn">게시글 등록</a>
<?php } else { ?>
<a href="./bbs_form.php?bo_table=<?php echo $bo_table; ?>" id="bo_add" class="btn_01 btn">게시글 등록</a>
<?php } ?>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;bo_table=$bo_table&amp;page="); ?>
<script>
function fitemqalist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+38
View File
@@ -0,0 +1,38 @@
<?php
$sub_menu = '000400';
include_once('./_common.php');
check_demo();
check_admin_token();
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
$bo_table = $_POST['bo_table'];
$write_table = $g5['write_prefix'] . $bo_table;
if (! $count_post_chk) {
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
}
if ($_POST['act_button'] == "선택삭제") {
auth_check_menu($auth, $sub_menu, 'd');
for ($i=0; $i<$count_post_chk; $i++) {
// 실제 번호를 넘김
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
$iwr_id = isset($_POST['wr_id'][$i]) ? (int) $_POST['wr_id'][$k] : 0;
// 게시글과 댓글 삭제
sql_query(" delete from {$write_table} where wr_parent = '{$iwr_id}' ");
// 최근게시물 삭제
sql_query(" delete from {$g5['board_new_table']} where bo_table = '{$bo_table}' and wr_parent = '{$iwr_id}' ");
// 스크랩 삭제
sql_query(" delete from {$g5['scrap_table']} where bo_table = '{$bo_table}' and wr_id = '{$iwr_id}' ");
}
}
goto_url("./bbs_list.php?sca=$sca&amp;sst=$sst&amp;sod=$sod&amp;sfl=$sfl&amp;stx=$stx&amp;page=$page&amp;bo_table=$bo_table");
+17
View File
@@ -0,0 +1,17 @@
<?php
$sub_menu = '000100';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
$g5['title'] = '환경설정';
include_once (G5_ADMIN_PATH.'/admin.head.php');
?>
메인페이지 > 우측 하단의 환경설정 버튼을 이용해주세요.<br>
(추후 업데이트 예정)
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+7
View File
@@ -0,0 +1,7 @@
@charset "utf-8";
.border_box_adm {border:1px solid #ddd; padding: 15px 20px 15px 20px; margin-bottom: 20px; box-sizing: border-box;}
.td_name.sv_use a img {height: 12px; margin-left: 2px;}
.td_name.sv_use a .profile_img img {height:22px;}
.td_name.sv_use div .sv_wrap .sv {width: 100px !important;}
.sv_wrap .sv a {display: block !important;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

+287
View File
@@ -0,0 +1,287 @@
<?php
$sub_menu = '000630';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
add_stylesheet('<link rel="stylesheet" href="./css/style.css">', 0);
$g5['title'] = '쪽지 관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
// 메세지 목록처리
$where = " where me_recv_mb_id != '' and ";
$sql_search = "";
if ($stx != "") {
if ($sfl != "") {
$sql_search .= " $where $sfl like '%$stx%' ";
$where = " and ";
}
if ($save_stx != $stx)
$page = 1;
}
if (!$sst) {
$sst = "me_id";
$sod = "desc";
}
$sql_common = " from {$g5['memo_table']} ";
$sql_common .= $sql_search;
// 테이블의 전체 레코드수만 얻음
$sql_list = " select count(*) as cnt " . $sql_common;
$list = sql_fetch($sql_list);
$total_count = isset($list['cnt']) ? $list['cnt'] : 0;
$rows = 10;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql_is = " select *
$sql_common
order by $sst $sod
limit $from_record, $rows ";
$result_is = sql_query($sql_is);
$qstr .= ($qstr ? '&amp;' : '').'save_stx='.$stx;
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
?>
<style>
.chat_list_image img {height: 40px; width: auto; border-radius: 8px;}
.view_image img {height: 40px; width: auto; border-radius: 8px;}
.chat_list_video {border-radius: 8px;}
.chat_list_audio {height:40px;}
.chat_file_icos {margin-right: 5px;}
</style>
<form name="flist" class="local_sch01 local_sch">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl" id="sfl">
<option value="me_send_mb_id" <?php echo get_selected($sfl, 'me_send_mb_id'); ?>>발송인(ID)</option>
<option value="me_recv_mb_id" <?php echo get_selected($sfl, 'me_recv_mb_id'); ?>>수신인(ID)</option>
<option value="me_send_ip" <?php echo get_selected($sfl, 'me_send_ip'); ?>>발송 IP</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx; ?>" id="stx" required class="frm_input required">
<input type="submit" value="검색" class="btn_submit"> <?php echo $listall ?> <span class="btn_ov01"><span class="ov_txt">총 </span><span class="ov_num"> <?php echo number_format($total_count) ?>건 </span></span>
</form>
<form name="fitemqalist" method="post" action="./memo_list_update.php" onsubmit="return fitemqalist_submit(this);" autocomplete="off">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<div class="tbl_head01 tbl_wrap" id="itemqalist">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col"><?php echo subject_sort_link('me_send_mb_id'); ?>보냄</a></th>
<th scope="col"><?php echo subject_sort_link('me_recv_mb_id'); ?>받음</a></th>
<th scope="col"><?php echo subject_sort_link('me_memo'); ?>내용</a></th>
<th scope="col"><?php echo subject_sort_link('me_send_datetime'); ?>발송시간</a></th>
<th scope="col"><?php echo subject_sort_link('me_read_datetime'); ?>수신시간</a></th>
<th scope="col"><?php echo subject_sort_link('me_send_ip'); ?>발송IP</a></th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $rowss=sql_fetch_array($result_is); $i++) {
$mbx1 = isset($rowss['me_send_mb_id']) ? get_member($rowss['me_send_mb_id']) : '';
$mbx2 = isset($rowss['me_recv_mb_id']) ? get_member($rowss['me_recv_mb_id']) : '';
$name1 = isset($mbx1['mb_nick']) ? get_text($mbx1['mb_nick']) : '';
$name2 = isset($mbx2['mb_nick']) ? get_text($mbx2['mb_nick']) : '';
$bg = 'bg'.($i%2);
?>
<tr style="background-color:#fff;">
<td class="td_chk">
<label for="chk_<?php echo $i; ?>"></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
<input type="hidden" name="me_id[<?php echo $i; ?>]" value="<?php echo $rowss['me_id']; ?>">
<input type="hidden" name="mb_id[<?php echo $i; ?>]" value="<?php echo $mbx2['mb_id']; ?>">
</td>
<td class="td_datetime" nowrap>
<?php if(isset($name1) && $name1) { ?>
<a href="../member_form.php?w=u&mb_id=<?php echo $rowss['me_send_mb_id'] ?>"><?php echo $name1; ?></a>
<?php } else { ?>
<span style="color:#ff4081">시스템</span>
<?php } ?>
</td>
<td class="td_datetime" nowrap><a href="../member_form.php?w=u&mb_id=<?php echo $rowss['me_recv_mb_id'] ?>"><?php echo $name2; ?></a></td>
<td class="td_left">
<?php echo $rowss['me_memo']; ?>
</td>
<td class="td_datetime" nowrap><?php echo $rowss['me_send_datetime']; ?></td>
<td class="td_datetime" nowrap><?php echo $rowss['me_read_datetime']; ?></td>
<td class="td_datetime" nowrap>
<?php if(isset($rowss['me_send_ip']) && $rowss['me_send_ip']) { ?>
<?php echo $rowss['me_send_ip']; ?>
<?php } else { ?>
-
<?php } ?>
</td>
</tr>
<?php
}
if ($i == 0) {
echo '<tr><td colspan="7" class="empty_table"><span>메세지가 없습니다.</span></td></tr>';
}
?>
</tbody>
</table>
</div>
<div class="btn_fixed_top" style="right:60px;">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_02">
<input type="submit" name="act_button" value="전체삭제" onclick="document.pressed=this.value" class="btn btn_02">
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<script>
function fitemqalist_submit(f)
{
if(document.pressed == "선택삭제") {
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
if(document.pressed == "전체삭제") {
if(!confirm("전체 데이터를 삭제하시겠습니까?\n삭제된 데이터는 복구되지 않습니다.")) {
return false;
}
}
return true;
}
</script>
<form name="fmemoform" id="fmemoform" action="./memo_update.php" onsubmit="return fmemoform_submit(this);" method="post">
<section>
<h2 class="h2_frm">시스템메세지 전체 발송</h2>
<div class="local_desc01 local_desc">
<p>
쪽지미수신(정보비공개) 회원을 포함하여 발송 됩니다.<br>
10레벨 발송의 경우 최고 관리자는 제외합니다.
</p>
</div>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="de_admin_company_name">수신그룹</label></th>
<td>
<input type="checkbox" id="all_check" onclick="check_alls(this.form)">
<label for="all_check">전체회원</label> 
<?php for ($i=2; $i<=10; $i++) { ?>
<input type="checkbox" name="mb_level[]" id="mb_level_<?php echo $i ?>" value="<?php echo $i ?>">
<label for="mb_level_<?php echo $i ?>"><?php echo $i ?> 레벨</label> 
<?php } ?>
</td>
</tr>
<tr>
<th scope="row"><label for="de_admin_company_name">시스템메세지</label></th>
<td>
<textarea name="me_memo" id="me_memo" required></textarea>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" name="act_button" value="발송" onclick="document.pressed=this.value" class="btn btn_01">
</div>
</form>
<script>
function check_alls(f)
{
var chk = document.getElementsByName("mb_level[]");
for (i=0; i<chk.length; i++)
chk[i].checked = f.all_check.checked;
}
function fmemoform_submit(f)
{
var chk = document.getElementsByName("mb_level[]");
var isChecked = false;
for (i=0; i<chk.length; i++) {
if (chk[i].checked) {
isChecked = true;
break;
}
}
if (!isChecked) {
alert("수신그룹을 선택해주세요.");
return false;
}
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+46
View File
@@ -0,0 +1,46 @@
<?php
$sub_menu = '000630';
include_once('./_common.php');
check_demo();
check_admin_token();
if ($_POST['act_button'] == "선택삭제") {
$count_post_chk = (isset($_POST['chk']) && is_array($_POST['chk'])) ? count($_POST['chk']) : 0;
if (! $count_post_chk) {
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
}
auth_check_menu($auth, $sub_menu, 'd');
for ($i = 0; $i < $count_post_chk; $i++) {
// 실제 번호를 넘김
$k = isset($_POST['chk'][$i]) ? (int) $_POST['chk'][$i] : 0;
$ime_id = isset($_POST['me_id'][$k]) ? (int) $_POST['me_id'][$k] : 0;
$imb_id = isset($_POST['mb_id'][$k]) ? $_POST['mb_id'][$k] : '';
// 삭제를 위해 메모 내용을 가져옴
$sqls = "SELECT * FROM {$g5['memo_table']} WHERE me_id = '{$ime_id}'";
$rows = sql_fetch($sqls);
// 삭제
sql_query("DELETE FROM {$g5['memo_table']} WHERE me_id = '{$ime_id}'");
$sql = " update {$g5['member_table']} set mb_memo_cnt = '".get_memo_not_read($imb_id)."' where mb_id = '{$imb_id}' ";
sql_query($sql);
}
} else if ($_POST['act_button'] == "전체삭제") {
// 삭제
sql_query(" DELETE FROM {$g5['memo_table']} ");
sql_query(" update {$g5['member_table']} set mb_memo_cnt = '0' ");
alert('전체 데이터가 삭제 되었습니다.');
}
goto_url("./memo_form.php?sst=$sst&amp;sod=$sod&amp;sfl=$sfl&amp;stx=$stx&amp;page=$page");
+46
View File
@@ -0,0 +1,46 @@
<?php
$sub_menu = '000630';
include_once('./_common.php');
check_demo();
check_admin_token();
$sql_common = " FROM {$g5['member_table']}";
$sql_where = " WHERE (1) AND mb_id NOT IN ('{$config['cf_admin']}') ";
for ($i = 0; $i < count($_POST['mb_level']); $i++) {
$sql = "SELECT * {$sql_common} {$sql_where} AND mb_level = '".sql_escape_string($_POST['mb_level'][$i])."'";
$sql_cnt = sql_fetch ("SELECT COUNT(*) as cnt {$sql_common} {$sql_where} AND mb_level = '".sql_escape_string($_POST['mb_level'][$i])."'");
$result = sql_query($sql);
if (isset($sql_cnt['cnt']) && $sql_cnt['cnt'] > 0) {
while ($row = sql_fetch_array($result)) {
if (!$row['mb_leave_date']) {
$rows_me = sql_fetch("SELECT MAX(me_id) AS new_me_id FROM {$g5['memo_table']}");
$me_id = $rows_me['new_me_id'] + 1;
$send_id = 'system-msg'; // 발송할 아이디
$memo_content = sql_escape_string($_POST['me_memo']);
$from_id = $row['mb_id'];
$sql_m1 = "INSERT INTO {$g5['memo_table']} SET me_id='$me_id', me_recv_mb_id='$from_id', me_send_mb_id='$send_id', me_type='recv', me_send_datetime='".G5_TIME_YMDHIS."', me_memo='$memo_content'";
sql_query($sql_m1);
$sql_m2 = "UPDATE {$g5['member_table']} SET mb_memo_call='$send_id', mb_memo_cnt='".get_memo_not_read($from_id)."' WHERE mb_id='$from_id'";
sql_query($sql_m2);
}
}
alert('시스템메세지를 발송했습니다.');
} else {
alert('시스템메세지를 발송할 회원이 없습니다.');
}
}
?>
+312
View File
@@ -0,0 +1,312 @@
<?php
$sub_menu = '000200';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
$md_id = isset($_GET['md_id']) ? preg_replace('/[^0-9]/', '', $_GET['md_id']) : '';
$table_name = (isset($_GET['tables']) && $_GET['tables']) ? $_GET['tables'] : 'rb_module';
$w = isset($_GET['w']) ? $_GET['w'] : '';
$is_shop = (defined('G5_USE_SHOP') && G5_USE_SHOP) ? 1 : 0;
$html_title = '모듈';
$g5['title'] = $html_title . ' 관리';
if ($w == 'u') {
$html_title .= ' 수정';
$sql = "SELECT * FROM {$table_name} WHERE md_id = '{$md_id}'";
$module = sql_fetch($sql);
if (!$module['md_id']) {
alert('존재하지 않는 모듈입니다.');
}
} else {
$html_title .= ' 입력';
// 기본값 설정
$module = array(
'md_type' => 'latest', 'md_skin' => 'basic', 'md_col' => 4, 'md_row' => 1,
'md_col_mo' => 2, 'md_row_mo' => 2, 'md_cnt' => 4, 'md_title_color' => '#25282b',
'md_title_size' => 20, 'md_title_font' => 'font-B', 'md_width' => '100%', 'md_height' => 'auto',
'md_gap' => 40, 'md_gap_mo' => 20, 'md_auto_time' => 3000, 'md_subject_is' => 1,
'md_thumb_is' => 1, 'md_nick_is' => 1, 'md_date_is' => 1, 'md_content_is' => 1,
'md_icon_is' => 1, 'md_comment_is' => 1, 'md_ca_is' => 1, 'md_swiper_is' => 0,
'md_auto_is' => 0, 'md_order' => 'wr_num', 'md_order_id' => 0, 'md_title_hide' => 0,
'md_notice' => 0, 'md_show' => '1', 'md_size' => '%', 'md_border' => '', 'md_radius' => '',
'md_padding' => '', 'md_padding_mo' => '', 'md_margin_top_pc' => '', 'md_margin_btm_pc' => '',
'md_margin_top_mo' => '', 'md_margin_btm_mo' => '', 'md_banner_bg' => '', 'md_layout' => (isset($_GET['md_layout']) ? $_GET['md_layout'] : ''),
'md_theme' => (isset($_GET['theme_name']) ? $_GET['theme_name'] : ''), 'md_layout_name' => '', 'md_title' => '', 'md_bo_table' => '',
'md_sca' => '', 'md_widget' => '', 'md_poll' => '', 'md_poll_id' => '', 'md_custom_skin' => '',
'md_banner' => '', 'md_banner_id' => '', 'md_banner_skin' => '', 'md_module' => '',
'md_tab_list' => '', 'md_tab_skin' => '', 'md_order_latest' => '', 'md_custom_survey_key' => '',
);
}
include_once(G5_ADMIN_PATH . '/admin.head.php');
?>
<form name="fmodule" id="fmodule" action="./moduleformupdate.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="md_id" value="<?php echo $md_id; ?>">
<input type="hidden" name="tables" value="<?php echo $table_name; ?>">
<input type="hidden" name="qstr" value="<?php echo $qstr; ?>">
<input type="hidden" name="md_layout" value="<?php echo get_text($module['md_layout']); ?>">
<input type="hidden" name="md_theme" value="<?php echo get_text($module['md_theme']); ?>">
<input type="hidden" name="md_layout_name" value="<?php echo get_text($module['md_layout_name']); ?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<!-- 1. 기본 설정 -->
<tr>
<th scope="row"><label for="md_title">모듈 타이틀</label></th>
<td>
<input type="text" name="md_title" value="<?php echo get_text($module['md_title']); ?>" id="md_title" class="frm_input" size="80">
<input type="checkbox" name="md_title_hide" value="1" id="md_title_hide" <?php echo ($module['md_title_hide'] == 1) ? 'checked' : ''; ?>>
<label for="md_title_hide">타이틀 숨김</label>
</td>
</tr>
<tr>
<th scope="row"><label for="md_type">모듈 타입</label></th>
<td>
<select name="md_type" id="md_type">
<option value="">출력 타입을 선택하세요.</option>
<option value="latest" <?php echo get_selected($module['md_type'], 'latest'); ?>>최신글</option>
<option value="tab" <?php echo get_selected($module['md_type'], 'tab'); ?>>최신글 탭</option>
<option value="widget" <?php echo get_selected($module['md_type'], 'widget'); ?>>위젯</option>
<option value="banner" <?php echo get_selected($module['md_type'], 'banner'); ?>>배너</option>
<option value="poll" <?php echo get_selected($module['md_type'], 'poll'); ?>>투표</option>
<?php if($is_shop) { ?>
<option value="item" <?php echo get_selected($module['md_type'], 'item'); ?>>상품</option>
<?php } ?>
<option value="custom" <?php echo get_selected($module['md_type'], 'custom'); ?>>커스텀 모듈</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="md_show">출력 여부</label></th>
<td>
<select name="md_show" id="md_show">
<option value="1" <?php echo get_selected($module['md_show'], '1'); ?>>보임</option>
<option value="0" <?php echo get_selected($module['md_show'], '0'); ?>>숨김</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="md_order_id">출력 순서</label></th>
<td>
<input type="text" name="md_order_id" value="<?php echo $module['md_order_id']; ?>" id="md_order_id" class="frm_input" size="5">
</td>
</tr>
<!-- 2. 타입별 상세 설정 -->
<tbody class="module_options">
<!-- 최신글 옵션 -->
<tr class="latest_option">
<th scope="row"><label for="md_bo_table">게시판 선택</label></th>
<td>
<select name="md_bo_table" id="md_bo_table">
<option value="">선택하세요</option>
<?php echo rb_board_list($module['md_bo_table']); ?>
</select>
<label for="md_sca" class="ml-3">카테고리</label>
<input type="text" name="md_sca" value="<?php echo get_text($module['md_sca']); ?>" id="md_sca" class="frm_input" size="20">
</td>
</tr>
<tr class="latest_option">
<th scope="row"><label for="md_skin">최신글 스킨</label></th>
<td>
<select name="md_skin" id="md_skin">
<option value="">선택하세요</option>
<?php echo rb_skin_select('latest', $module['md_skin']); ?>
</select>
</td>
</tr>
<!-- 최신글 탭 옵션 -->
<tr class="tab_option">
<th scope="row">탭 리스트</th>
<td>
<textarea name="md_tab_list" id="md_tab_list" class="frm_input" style="width:100%; height:100px;" placeholder='[{"bo_table":"notice", "sca":"공지"}, {"bo_table":"free"}]'><?php echo get_text($module['md_tab_list']); ?></textarea>
<?php echo help('JSON 형식으로 입력합니다. 예: [{"bo_table":"notice", "sca":"공지"}, {"bo_table":"free"}]'); ?>
</td>
</tr>
<tr class="tab_option">
<th scope="row"><label for="md_tab_skin">탭 스킨</label></th>
<td>
<select name="md_tab_skin" id="md_tab_skin">
<option value="">선택하세요</option>
<?php echo rb_skin_select('latest_tabs', $module['md_tab_skin']); ?>
</select>
</td>
</tr>
<!-- 상품 옵션 -->
<?php if($is_shop): ?>
<tr class="item_option">
<th scope="row"><label for="md_module">상품 타입</label></th>
<td>
<select name="md_module" id="md_module">
<option value="0" <?php echo get_selected($module['md_module'], "0"); ?>>전체상품</option>
<option value="1" <?php echo get_selected($module['md_module'], "1"); ?>>히트상품</option>
<option value="2" <?php echo get_selected($module['md_module'], "2"); ?>>추천상품</option>
<option value="3" <?php echo get_selected($module['md_module'], "3"); ?>>최신상품</option>
<option value="4" <?php echo get_selected($module['md_module'], "4"); ?>>인기상품</option>
<option value="5" <?php echo get_selected($module['md_module'], "5"); ?>>할인상품</option>
</select>
</td>
</tr>
<tr class="item_option">
<th scope="row"><label for="md_sca_item">상품 카테고리</label></th>
<td>
<select name="md_sca_item" id="md_sca_item">
<option value="">전체</option>
<?php
$category_select = '';
$sql_cat = " select * from {$g5['g5_shop_category_table']} order by ca_order, ca_id ";
$result_cat = sql_query($sql_cat);
for ($i=0; $row_cat=sql_fetch_array($result_cat); $i++) {
$len = strlen($row_cat['ca_id']) / 2 - 1;
$nbsp = str_repeat("&nbsp;&nbsp;&nbsp;", $len);
$category_select .= "<option value=\"{$row_cat['ca_id']}\" ".get_selected($module['md_sca'], $row_cat['ca_id']).">$nbsp{$row_cat['ca_name']}</option>\n";
}
echo $category_select;
?>
</select>
</td>
</tr>
<?php endif; ?>
<!-- 기타 옵션들 (위젯, 배너, 투표, 커스텀) -->
<tr class="widget_option"><th scope="row"><label for="md_widget">위젯</label></th><td><input type="text" name="md_widget" value="<?php echo get_text($module['md_widget']); ?>" id="md_widget" class="frm_input" size="50"></td></tr>
<tr class="banner_option"><th scope="row"><label for="md_banner">배너 그룹</label></th><td><input type="text" name="md_banner" value="<?php echo get_text($module['md_banner']); ?>" id="md_banner" class="frm_input" size="20"></td></tr>
<tr class="banner_option"><th scope="row"><label for="md_banner_skin">배너 스킨</label></th><td><select name="md_banner_skin" id="md_banner_skin"><option value="">선택</option><?php echo rb_banner_skin_select('rb.mod/banner/skin', $module['md_banner_skin']); ?></select></td></tr>
<tr class="poll_option"><th scope="row"><label for="md_poll_id">투표 ID</label></th><td><input type="text" name="md_poll_id" value="<?php echo get_text($module['md_poll_id']); ?>" id="md_poll_id" class="frm_input" size="10"></td></tr>
<tr class="custom_option"><th scope="row"><label for="md_custom_skin">커스텀 모듈</label></th><td><select name="md_custom_skin" id="md_custom_skin"><option value="">선택</option><?php echo rb_dir_select("rb.custom", $module['md_custom_skin']); ?></select></td></tr>
<tr class="custom_option"><th scope="row"><label for="md_custom_survey_key">커스텀 설문 키</label></th><td><input type="text" name="md_custom_survey_key" value="<?php echo get_text($module['md_custom_survey_key']); ?>" id="md_custom_survey_key" class="frm_input" size="30"></td></tr>
</tbody>
<!-- 3. 레이아웃 및 디자인 설정 -->
<tbody class="common_options">
<tr><th colspan="2" class="title_heading">레이아웃 및 디자인</th></tr>
<tr>
<th scope="row">출력 갯수</th>
<td>
<label for="md_cnt">총 갯수</label> <input type="text" name="md_cnt" value="<?php echo get_text($module['md_cnt']); ?>" id="md_cnt" class="frm_input" size="5">
<label for="md_col" class="ml-3">PC 열</label> <input type="text" name="md_col" value="<?php echo get_text($module['md_col']); ?>" id="md_col" class="frm_input" size="5">
<label for="md_row">PC 행</label> <input type="text" name="md_row" value="<?php echo get_text($module['md_row']); ?>" id="md_row" class="frm_input" size="5">
<label for="md_col_mo" class="ml-3">모바일 열</label> <input type="text" name="md_col_mo" value="<?php echo get_text($module['md_col_mo']); ?>" id="md_col_mo" class="frm_input" size="5">
<label for="md_row_mo">모바일 행</label> <input type="text" name="md_row_mo" value="<?php echo get_text($module['md_row_mo']); ?>" id="md_row_mo" class="frm_input" size="5">
</td>
</tr>
<tr>
<th scope="row">크기 및 간격</th>
<td>
<label for="md_width">가로</label> <input type="text" name="md_width" value="<?php echo get_text($module['md_width']); ?>" id="md_width" class="frm_input" size="5">
<select name="md_size" id="md_size"><option value="%" <?php echo get_selected($module['md_size'], '%'); ?>>%</option><option value="px" <?php echo get_selected($module['md_size'], 'px'); ?>>px</option></select>
<label for="md_height" class="ml-3">세로</label> <input type="text" name="md_height" value="<?php echo get_text($module['md_height']); ?>" id="md_height" class="frm_input" size="5">
<label for="md_gap" class="ml-3">PC 간격</label> <input type="text" name="md_gap" value="<?php echo get_text($module['md_gap']); ?>" id="md_gap" class="frm_input" size="5">
<label for="md_gap_mo">모바일 간격</label> <input type="text" name="md_gap_mo" value="<?php echo get_text($module['md_gap_mo']); ?>" id="md_gap_mo" class="frm_input" size="5">
</td>
</tr>
<tr>
<th scope="row">여백 (Margin)</th>
<td>
<label for="md_margin_top_pc">PC 상단</label> <input type="text" name="md_margin_top_pc" value="<?php echo get_text($module['md_margin_top_pc']); ?>" id="md_margin_top_pc" class="frm_input" size="5">
<label for="md_margin_btm_pc">PC 하단</label> <input type="text" name="md_margin_btm_pc" value="<?php echo get_text($module['md_margin_btm_pc']); ?>" id="md_margin_btm_pc" class="frm_input" size="5">
<label for="md_margin_top_mo" class="ml-3">모바일 상단</label> <input type="text" name="md_margin_top_mo" value="<?php echo get_text($module['md_margin_top_mo']); ?>" id="md_margin_top_mo" class="frm_input" size="5">
<label for="md_margin_btm_mo">모바일 하단</label> <input type="text" name="md_margin_btm_mo" value="<?php echo get_text($module['md_margin_btm_mo']); ?>" id="md_margin_btm_mo" class="frm_input" size="5">
</td>
</tr>
<tr>
<th scope="row">안쪽 여백 (Padding)</th>
<td>
<label for="md_padding">PC</label> <input type="text" name="md_padding" value="<?php echo get_text($module['md_padding']); ?>" id="md_padding" class="frm_input" size="10">
<label for="md_padding_mo" class="ml-3">모바일</label> <input type="text" name="md_padding_mo" value="<?php echo get_text($module['md_padding_mo']); ?>" id="md_padding_mo" class="frm_input" size="10">
</td>
</tr>
<tr>
<th scope="row">스타일</th>
<td>
<label for="md_border">테두리</label> <input type="text" name="md_border" value="<?php echo get_text($module['md_border']); ?>" id="md_border" class="frm_input" size="10">
<label for="md_radius" class="ml-3">라운드</label> <input type="text" name="md_radius" value="<?php echo get_text($module['md_radius']); ?>" id="md_radius" class="frm_input" size="5">
<label for="md_banner_bg" class="ml-3">배경</label> <input type="text" name="md_banner_bg" value="<?php echo get_text($module['md_banner_bg']); ?>" id="md_banner_bg" class="frm_input" size="20">
</td>
</tr>
<tr>
<th scope="row">타이틀 스타일</th>
<td>
<label for="md_title_color">색상</label> <input type="text" name="md_title_color" value="<?php echo get_text($module['md_title_color']); ?>" id="md_title_color" class="frm_input" size="10">
<label for="md_title_size" class="ml-3">크기</label> <input type="text" name="md_title_size" value="<?php echo get_text($module['md_title_size']); ?>" id="md_title_size" class="frm_input" size="5">
<label for="md_title_font" class="ml-3">폰트</label> <input type="text" name="md_title_font" value="<?php echo get_text($module['md_title_font']); ?>" id="md_title_font" class="frm_input" size="10">
</td>
</tr>
</tbody>
<!-- 4. 기능 설정 -->
<tbody class="common_options">
<tr><th colspan="2" class="title_heading">기능 설정</th></tr>
<tr>
<th scope="row">기능 설정</th>
<td>
<input type="checkbox" name="md_swiper_is" value="1" id="md_swiper_is" <?php echo ($module['md_swiper_is'] == 1) ? 'checked' : ''; ?>> <label for="md_swiper_is">스와이프(슬라이드) 사용</label>
<span class="ml-3">
<input type="checkbox" name="md_auto_is" value="1" id="md_auto_is" <?php echo ($module['md_auto_is'] == 1) ? 'checked' : ''; ?>> <label for="md_auto_is">자동롤링</label>
(시간: <input type="text" name="md_auto_time" value="<?php echo get_text($module['md_auto_time']); ?>" id="md_auto_time" class="frm_input" size="5"> ms)
</span>
</td>
</tr>
<tr class="latest_option tab_option item_option">
<th scope="row">출력 항목</th>
<td>
<input type="checkbox" name="md_subject_is" value="1" id="md_subject_is" <?php echo ($module['md_subject_is'] == 1) ? 'checked' : ''; ?>> <label for="md_subject_is">제목</label>
<input type="checkbox" name="md_content_is" value="1" id="md_content_is" <?php echo ($module['md_content_is'] == 1) ? 'checked' : ''; ?>> <label for="md_content_is">내용</label>
<input type="checkbox" name="md_thumb_is" value="1" id="md_thumb_is" <?php echo ($module['md_thumb_is'] == 1) ? 'checked' : ''; ?>> <label for="md_thumb_is">썸네일</label>
<input type="checkbox" name="md_nick_is" value="1" id="md_nick_is" <?php echo ($module['md_nick_is'] == 1) ? 'checked' : ''; ?>> <label for="md_nick_is">작성자</label>
<input type="checkbox" name="md_date_is" value="1" id="md_date_is" <?php echo ($module['md_date_is'] == 1) ? 'checked' : ''; ?>> <label for="md_date_is">날짜</label>
<input type="checkbox" name="md_icon_is" value="1" id="md_icon_is" <?php echo ($module['md_icon_is'] == 1) ? 'checked' : ''; ?>> <label for="md_icon_is">아이콘</label>
<input type="checkbox" name="md_comment_is" value="1" id="md_comment_is" <?php echo ($module['md_comment_is'] == 1) ? 'checked' : ''; ?>> <label for="md_comment_is">댓글수</label>
<input type="checkbox" name="md_ca_is" value="1" id="md_ca_is" <?php echo ($module['md_ca_is'] == 1) ? 'checked' : ''; ?>> <label for="md_ca_is">카테고리</label>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<a href="./module_list.php?<?php echo $qstr; ?>" class="btn btn_02">목록</a>
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
jQuery(function($){
function toggle_fields() {
var type = $('#md_type').val();
$('.module_options > tr').hide();
if (type) {
$('.common_options').show();
$('.' + type + '_option').show();
} else {
$('.common_options').hide();
}
}
toggle_fields();
$('#md_type').on('change', function() {
toggle_fields();
});
});
</script>
<?php
include_once(G5_ADMIN_PATH . '/admin.tail.php');
?>
+74
View File
@@ -0,0 +1,74 @@
<?php
$sub_menu = '000200';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "r");
$g5['title'] = '모듈 관리';
include_once(G5_ADMIN_PATH.'/admin.head.php');
// 💡 [최종 수정] 버튼을 가로로 정렬하기 위한 스타일 추가
?>
<style>
.td_mng_s .btn {
display: inline-block;
margin: 0 2px;
vertical-align: middle;
}
</style>
<?php
$table_name = (isset($_GET['tables']) && $_GET['tables']) ? $_GET['tables'] : 'rb_module';
// SQL 쿼리
$sql = "SELECT * FROM {$table_name} where md_theme = '{$config['cf_theme']}' ORDER BY md_id DESC";
$result = sql_query($sql);
?>
<div class="local_ov01 local_ov">
<span class="btn_ov01"><span class="ov_txt"> 전체 모듈 수</span><span class="ov_num"> <?php echo sql_num_rows($result); ?>개</span></span>
</div>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">타이틀</th>
<th scope="col">타입</th>
<th scope="col">레이아웃</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $row['md_id'] ?></td>
<td class="td_left"><?php echo get_text($row['md_title']) ?></td>
<td class="td_left"><?php echo get_text($row['md_type']) ?></td>
<td class="td_left"><?php echo get_text($row['md_layout']) ?></td>
<td class="td_mng td_mng_s">
<a href="./module_form.php?w=u&amp;md_id=<?php echo $row['md_id']; ?>&amp;tables=<?php echo $table_name; ?>&amp;<?php echo $qstr; ?>" class="btn btn_03">수정</a>
<a href="./moduleformupdate.php?w=d&amp;md_id=<?php echo $row['md_id']; ?>&amp;tables=<?php echo $table_name; ?>&amp;<?php echo $qstr; ?>" onclick="return delete_confirm(this);" class="btn btn_02">삭제</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="5" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
<div class="btn_fixed_top">
<a href="./module_form.php?tables=<?php echo $table_name; ?>" class="btn btn_01">모듈 추가</a>
</div>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>
+59
View File
@@ -0,0 +1,59 @@
<?php
$sub_menu = '000200';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
// 💡 [핵심 수정] w, md_id 등 GET/POST 양쪽으로 올 수 있는 값은 $_REQUEST로 받습니다.
$w = isset($_REQUEST['w']) ? $_REQUEST['w'] : '';
$md_id = isset($_REQUEST['md_id']) ? preg_replace('/[^0-9]/', '', $_REQUEST['md_id']) : '';
$table_name = (isset($_REQUEST['tables']) && $_REQUEST['tables']) ? $_REQUEST['tables'] : 'rb_module';
$qstr = isset($_REQUEST['qstr']) ? $_REQUEST['qstr'] : '';
if ($w == 'd') {
if ($is_admin != 'super') {
alert("최고관리자만 삭제할 수 있습니다.");
}
if (!$md_id) {
alert('모듈 ID가 없습니다.');
}
// 삭제
$sql = " DELETE FROM {$table_name} WHERE md_id = '{$md_id}' ";
sql_query($sql);
} else {
// 💡 [핵심 수정] 나머지 폼 데이터는 $_POST로 받아서 동적으로 SQL SET 구문을 생성합니다.
$sql_set_array = array();
foreach ($_POST as $key => $value) {
// w, md_id 등 이미 처리한 변수나 불필요한 변수는 건너뜁니다.
if (in_array($key, ['w', 'md_id', 'tables', 'qstr', 'token'])) {
continue;
}
$sql_set_array[] = " {$key} = '" . sql_real_escape_string(trim($value)) . "' ";
}
// 공통으로 추가할 필드
$sql_set_array[] = " md_datetime = '".G5_TIME_YMDHIS."' ";
$sql_set_array[] = " md_ip = '{$_SERVER['REMOTE_ADDR']}' ";
$sql_set = implode(', ', $sql_set_array);
if ($w == 'u') {
if (!$md_id) {
alert('모듈 ID가 없습니다.');
}
// 수정
$sql = " UPDATE {$table_name} SET {$sql_set} WHERE md_id = '{$md_id}' ";
sql_query($sql);
} else {
// 생성
$sql = " INSERT INTO {$table_name} SET {$sql_set} ";
sql_query($sql);
}
}
goto_url("./module_list.php?tables=$table_name&amp;$qstr");
?>
+40
View File
@@ -0,0 +1,40 @@
<?php
$sub_menu = '000200';
include_once('./_common.php');
check_demo();
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
$post_md_id_count = (isset($_POST['md_id']) && is_array($_POST['md_id'])) ? count($_POST['md_id']) : 0;
$table_name = (isset($_POST['tables']) && $_POST['tables']) ? $_POST['tables'] : 'rb_module';
for ($i=0; $i<$post_md_id_count; $i++)
{
$p_md_title = is_array($_POST['md_title']) ? strip_tags(clean_xss_attributes($_POST['md_title'][$i])) : '';
$posts = array();
$check_keys = array('md_id', 'md_theme', 'md_layout_name', 'md_layout',);
foreach($check_keys as $key){
$posts[$key] = (isset($_POST[$key]) && isset($_POST[$key][$i])) ? $_POST[$key][$i] : '';
}
$sql = " update {$table_name}
set md_title = '".$p_md_title."',
md_theme = '".sql_real_escape_string(strip_tags($posts['md_theme']))."',
md_layout_name = '".sql_real_escape_string(strip_tags($posts['md_layout_name']))."',
md_layout = '".sql_real_escape_string(strip_tags($posts['md_layout']))."'
where md_id = '".sql_real_escape_string($posts['md_id'])."' ";
sql_query($sql);
}
goto_url("./module_list.php?tables=$table_name&amp;$qstr");
+27
View File
@@ -0,0 +1,27 @@
<?php
include_once('../../../common.php'); // 또는 경로에 맞게
$ca_id = isset($_POST['ca_id']) ? trim($_POST['ca_id']) : '';
$result = ['error' => 1, 'msg' => ''];
if ($ca_id) {
$sql = "SELECT ca_level, ca_level_opt FROM {$g5['g5_shop_category_table']} WHERE ca_id = '{$ca_id}'";
$row = sql_fetch($sql);
if ($row) {
$result = [
'error' => 0,
'ca_level' => $row['ca_level'],
'ca_level_opt' => $row['ca_level_opt']
];
} else {
$result['msg'] = '카테고리 정보가 없습니다.';
}
} else {
$result['msg'] = 'ca_id 값이 없습니다.';
}
echo json_encode($result);
exit;
?>
+275
View File
@@ -0,0 +1,275 @@
<?php
// ===================================================================================
// 리빌더 DB 자동 업그레이드
// 이 파일은 리빌더의 데이터베이스 테이블 구조를 최신 상태로 유지합니다.
// ===================================================================================
$sub_menu = "000060";
include_once "./_common.php";
// --- 권한 확인 ---
auth_check_menu($auth, $sub_menu, "w");
if ($is_admin != "super") {
alert("최고관리자만 접근 가능합니다.");
}
/**
* rb_key 테이블이 없으면 생성하고, 키가 없으면 기본 키를 삽입하는 함수
*/
function check_and_create_key_table()
{
// 테이블 존재 여부 확인
if (!sql_query("DESCRIBE rb_key", false)) {
// 테이블 생성
sql_query("CREATE TABLE IF NOT EXISTS `rb_key` (
`key_no` varchar(255) NOT NULL DEFAULT '',
`key_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=utf8", true);
}
// 키 존재 여부 확인
$key_count = sql_fetch("SELECT COUNT(*) as cnt FROM rb_key");
if ($key_count['cnt'] < 1) {
// 초기 키 생성 및 삽입
$in_key = get_random_token_string(24);
$in_key = sql_real_escape_string($in_key);
sql_query("INSERT INTO rb_key SET key_no = '{$in_key}', key_datetime = '" . G5_TIME_YMDHIS . "'");
}
}
/**
* DB에서 라이선스 키 정보를 가져오는 함수
* @return array|string 키 정보 배열 또는 에러 메시지
*/
function get_license_key()
{
check_and_create_key_table(); // 테이블 및 키 존재 보장
$key_info = sql_fetch("SELECT key_no FROM rb_key LIMIT 1");
if (!$key_info || empty($key_info["key_no"])) {
return "라이선스 키를 찾을 수 없습니다.";
}
return $key_info["key_no"];
}
/**
* 외부 API 서버에 라이선스를 검증하고 최신 DB 스키마를 받아오는 함수
* @param string $key 라이선스 키
* @param string $domain 사이트 도메인
* @param string $ip 사용자 IP
* @return array|string 성공 시 데이터 배열, 실패 시 에러 메시지
*/
function verify_license_and_get_schema($key, $domain, $ip)
{
if (!function_exists("curl_init")) {
return "cURL을 사용할 수 없는 서버입니다. 서버 관리자에게 문의하세요.";
}
$api_endpoint = "https://api.rebuilder.co.kr/_update.php";
$post_data = array(
"domain" => filter_var($domain, FILTER_SANITIZE_URL),
"key" => filter_var($key, FILTER_SANITIZE_STRING),
"user_ip" => filter_var($ip, FILTER_VALIDATE_IP) ? $ip : '0.0.0.0',
"g5_table_prefix" => defined("G5_TABLE_PREFIX") ? G5_TABLE_PREFIX : "g5_",
"g5_shop_table_prefix" => defined("G5_SHOP_TABLE_PREFIX") ? G5_SHOP_TABLE_PREFIX : "g5_shop_"
);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $api_endpoint,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($post_data),
CURLOPT_USERAGENT => "Mozilla/5.0 (rebuilder.co.kr)",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_TIMEOUT => 30
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
curl_close($ch);
return "업데이트 서버 연결 에러: " . $error_msg;
}
curl_close($ch);
if ($response === false) {
return "업데이트 서버로부터 응답이 없습니다.";
}
$response = preg_replace('/^\xEF\xBB\xBF/', '', $response); // UTF-8 BOM 제거
$data = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
return "업데이트 서버의 응답을 처리할 수 없습니다. (JSON 오류)";
}
if (isset($data["status"]) && $data["status"] === "error") {
return "업데이트 서버 응답: " . htmlspecialchars($data["data"]);
}
// 💡 [수정] 스키마 정보가 없어도 오류로 처리하지 않고, 로컬 강제 업데이트를 위해 빈 배열을 반환하도록 수정
if (empty($data["data"]["schema"]["tables"])) {
$data["data"]["schema"]["tables"] = [];
}
return $data;
}
/**
* DB 구조를 업그레이드하는 함수
* @param array $schema DB 스키마 정보
* @return string 결과 메시지
*/
function upgrade_database($schema)
{
$is_upgrade = false;
$messages = [];
if (!empty($schema["tables"])) {
foreach ($schema["tables"] as $table_name => $info) {
$columns = $info["columns"];
$table_name = sql_real_escape_string($table_name);
$result = sql_query("SHOW TABLES LIKE '{$table_name}'");
if (mysqli_num_rows($result) == 0) {
// 테이블이 없으면 새로 생성
$column_defs = [];
foreach ($columns as $col => $def) {
$column_defs[] = "`" . sql_real_escape_string($col) . "` " . sql_real_escape_string($def);
}
if (isset($info["primary_key"])) {
$column_defs[] = "PRIMARY KEY (`" . sql_real_escape_string($info["primary_key"]) . "`)";
}
$create_sql = "CREATE TABLE `{$table_name}` (" . implode(", ", $column_defs) . ") ENGINE=MyISAM DEFAULT CHARSET=utf8";
if (sql_query($create_sql)) {
$messages[] = "[{$table_name}] 테이블을 성공적으로 생성했습니다.";
$is_upgrade = true;
} else {
return "[{$table_name}] 테이블 생성 실패: " . mysqli_error($GLOBALS["g5"]["connect_db"]);
}
} else {
// 테이블이 있으면 컬럼 확인 후 추가
$add_columns = [];
foreach ($columns as $col => $def) {
$col = sql_real_escape_string($col);
$col_exists = sql_query("SHOW COLUMNS FROM `{$table_name}` LIKE '{$col}'");
if (mysqli_num_rows($col_exists) == 0) {
$add_columns[] = "ADD `" . $col . "` " . sql_real_escape_string($def);
}
}
if (!empty($add_columns)) {
$alter_sql = "ALTER TABLE `{$table_name}` " . implode(", ", $add_columns);
if (sql_query($alter_sql)) {
$messages[] = "[{$table_name}] 테이블에 새로운 컬럼을 추가했습니다.";
$is_upgrade = true;
} else {
return "[{$table_name}] 컬럼 추가 실패: " . mysqli_error($GLOBALS["g5"]["connect_db"]);
}
}
}
}
}
if ($is_upgrade) {
return implode("<br>", $messages);
} else {
return "공식 DB 업데이트 내역이 없습니다.";
}
}
/**
* 💡 [핵심 기능 추가] 커스텀 모듈용 컬럼을 강제로 확인하고 추가하는 함수
* @return array [ 'is_upgrade' => (bool), 'messages' => (array) ]
*/
function add_missing_custom_columns() {
$is_upgrade = false;
$messages = [];
$tables_to_check = ['rb_module', 'rb_module_shop'];
$column_to_add = 'md_custom_skin';
$column_definition = "VARCHAR(255) NOT NULL DEFAULT '' COMMENT '커스텀 모듈 스킨' AFTER `md_poll_id`";
foreach ($tables_to_check as $table) {
// 테이블이 존재하는지 먼저 확인
if (sql_query("DESCRIBE {$table}", false)) {
// 컬럼이 존재하는지 확인
$col_exists = sql_query("SHOW COLUMNS FROM `{$table}` LIKE '{$column_to_add}'");
if (mysqli_num_rows($col_exists) == 0) {
// 컬럼이 없으면 추가
$alter_sql = "ALTER TABLE `{$table}` ADD `{$column_to_add}` {$column_definition}";
if (sql_query($alter_sql)) {
$messages[] = "[{$table}] 테이블에 `{$column_to_add}` 컬럼을 성공적으로 추가했습니다.";
$is_upgrade = true;
} else {
$messages[] = "[{$table}] 테이블에 `{$column_to_add}` 컬럼 추가 실패: " . mysqli_error($GLOBALS["g5"]["connect_db"]);
}
}
}
}
return ['is_upgrade' => $is_upgrade, 'messages' => $messages];
}
// --- 메인 로직 시작 ---
$g5["title"] = "DB 업그레이드";
include_once "../admin.head.php";
$db_upgrade_msg = '';
$final_messages = [];
$official_upgrade_done = false;
$custom_upgrade_done = false;
$license_key = get_license_key();
if (!is_string($license_key)) {
$db_upgrade_msg = "라이선스 키를 가져오는 중 오류가 발생했습니다.";
} else {
$site_domain = $_SERVER["HTTP_HOST"];
$user_ip = get_real_client_ip();
$response_data = verify_license_and_get_schema($license_key, $site_domain, $user_ip);
if (is_string($response_data)) {
// verify_license_and_get_schema 함수에서 에러 메시지를 반환한 경우
$final_messages[] = $response_data;
} else {
// 성공적으로 스키마 정보를 받아온 경우, 공식 업데이트 실행
$schema = $response_data["data"]["schema"];
$official_upgrade_result = upgrade_database($schema);
$final_messages[] = $official_upgrade_result;
if (strpos($official_upgrade_result, '성공적으로') !== false || strpos($official_upgrade_result, '새로운 컬럼을 추가') !== false) {
$official_upgrade_done = true;
}
}
// 💡 [핵심] 공식 업데이트 후, 커스텀 컬럼 강제 추가 로직 실행
$custom_upgrade_result = add_missing_custom_columns();
if (!empty($custom_upgrade_result['messages'])) {
$final_messages = array_merge($final_messages, $custom_upgrade_result['messages']);
}
if ($custom_upgrade_result['is_upgrade']) {
$custom_upgrade_done = true;
}
// 최종 결과 메시지 조합
if ($official_upgrade_done || $custom_upgrade_done) {
$db_upgrade_msg = implode("<br>", array_filter($final_messages)) . "<br><br><b>DB 업그레이드가 완료되었습니다.</b>";
} else {
$db_upgrade_msg = "더 이상 업그레이드 할 내용이 없습니다.<br>현재 DB는 최신 상태입니다.";
}
}
?>
<!-- 결과 출력 -->
<div class="local_desc01 local_desc">
<p><?php echo $db_upgrade_msg; ?></p>
</div>
<?php
// 테일 포함
include_once "../admin.tail.php";
?>
+604
View File
@@ -0,0 +1,604 @@
<?php
$sub_menu = '000000';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
add_stylesheet('<link rel="stylesheet" href="./css/style.css">', 0);
$g5['title'] = '빌더설정';
include_once (G5_ADMIN_PATH.'/admin.head.php');
// 설치여부 (테이블조회)
$rbx = sql_fetch(" select COUNT(*) AS cnt FROM information_schema.TABLES WHERE `TABLE_NAME` = 'rb_builder' AND TABLE_SCHEMA = '".G5_MYSQL_DB."' ");
$is_rb = $rbx['cnt'];
?>
<?php if($rbx['cnt'] > 0) { ?>
<?php
$sql = " select * from rb_builder limit 1";
$bu = sql_fetch($sql);
$pg_anchor = '<ul class="anchor">
<li><a href="#anc_rb0">빌더정보</a></li>
<li><a href="#anc_rb1">로고설정</a></li>
<li><a href="#anc_rb_header">헤더설정</a></li>
<li><a href="#anc_rb2">회사정보</a></li>
<li><a href="#anc_rb3">로딩인디케이터</a></li>
<li><a href="#anc_rb6">시스템메세지</a></li>
<li><a href="#anc_rb5">모바일설정</a></li>
<li><a href="#anc_rb4">운영채널</a></li>
</ul>';
?>
<section id="anc_rb0">
<h2 class="h2_frm">빌더정보</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">빌더버전</th>
<td colspan="3">
<?php echo RB_VER ?>
</td>
</tr>
<tr>
<th scope="row">라이선스키</th>
<td colspan="3">
<?php echo help('최초설치 > DB 업데이트시에 자동 생성 됩니다.<br>라이선스키를 공식홈페이지 > 마이페이지 에서 등록해주세요.<br>키 등록이 되지않았거나, 키를 임의로 변경하시는 경우 빌더 업데이트가 불가능 합니다.') ?>
<?php
$key_info = sql_fetch (" select key_no from rb_key limit 1 ");
?>
<?php echo !empty($key_info['key_no']) ? $key_info['key_no'] : '라이선스키가 없습니다. DB업데이트를 진행해주세요.'; ?>
<?php if(!empty($key_info['key_no'])) { ?>
 <a href="javascript:void(0);" class="btn_frmline" style="height:25px; line-height:25px;" id="data-copy">복사하기</a>
<a href="https://rebuilder.co.kr" target="_blank" class="btn_frmline" style="height:25px; line-height:25px;">라이선스키 등록</a>
<input type="hidden" id="data-area" class="data-area" value="<?php echo !empty($key_info['key_no']) ? $key_info['key_no'] : ''; ?>">
<script>
$(document).ready(function() {
$('#data-copy').click(function() {
$('#data-area').attr('type', 'text'); // 화면에서 hidden 처리한 input box type을 text로 일시 변환
$('#data-area').select(); // input에 담긴 데이터를 선택
var copy = document.execCommand('copy'); // clipboard에 데이터 복사
$('#data-area').attr('type', 'hidden'); // input box를 다시 hidden 처리
if (copy) {
alert("라이선스키가 클립보드에 복사 되었습니다."); // 사용자 알림
}
});
});
</script>
<?php } ?>
</td>
</tr>
<tr>
<th scope="row">DB업데이트</th>
<td colspan="3">
<?php echo help('업데이트된 DB가 있는지 확인합니다.') ?>
<a href="./rb_db_update.php" class="btn_frmline">DB 업데이트 실행</a>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<form name="bu_form" id="bu_form" action="./rb_form_update.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="token" value="<?php echo get_admin_token(); ?>">
<input type="hidden" name="install" value="1" id="install">
<section id="anc_rb1">
<h2 class="h2_frm">로고설정</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">로고 PC</th>
<td>
<?php echo help('PC 버전 로고이미지를 등록하세요.') ?>
<input type="file" name="bu_logo_pc">
<?php
$lp_str = "";
$lpimg = G5_DATA_PATH."/logos/pc";
if (file_exists($lpimg)) {
$size = @getimagesize($lpimg);
if($size[0] && $size[0] > 400)
$width = 400;
else
$width = $size[0];
echo '<input type="checkbox" name="bu_logo_pc_del" value="1" id="bu_logo_pc_del"> <label for="bu_logo_pc_del">삭제</label>';
$lpimg_str = '<img src="'.G5_DATA_URL.'/logos/pc?ver='.G5_SERVER_TIME.'" width="'.$width.'">';
}
if (isset($lpimg_str) && $lpimg_str) {
echo '<br><span style="margin-top:20px; background-color:#f1f1f1; padding:10px 20px 10px 20px; display:inline-block; box-sizing:border-box;">';
echo $lpimg_str;
echo '</span>';
}
?>
</td>
</tr>
<tr>
<th scope="row">로고 PC (화이트)</th>
<td>
<?php echo help('PC 버전 로고이미지(화이트)를 등록하세요.<br>어두운 백그라운드가 사용될 때 변경 됩니다.') ?>
<input type="file" name="bu_logo_pc_w">
<?php
$lpw_str = "";
$lpwimg = G5_DATA_PATH."/logos/pc_w";
if (file_exists($lpwimg)) {
$size = @getimagesize($lpwimg);
if($size[0] && $size[0] > 400)
$width = 400;
else
$width = $size[0];
echo '<input type="checkbox" name="bu_logo_pc_w_del" value="1" id="bu_logo_pc_w_del"> <label for="bu_logo_pc_w_del">삭제</label>';
$lpwimg_str = '<img src="'.G5_DATA_URL.'/logos/pc_w?ver='.G5_SERVER_TIME.'" width="'.$width.'">';
}
if (isset($lpwimg_str) && $lpwimg_str) {
echo '<br><span style="margin-top:20px; background-color:#f1f1f1; padding:10px 20px 10px 20px; display:inline-block; box-sizing:border-box;">';
echo $lpwimg_str;
echo '</span>';
}
?>
</td>
</tr>
<tr>
<th scope="row">로고 Mobile</th>
<td>
<?php echo help('Mobile 버전 로고이미지를 등록하세요.') ?>
<input type="file" name="bu_logo_mo">
<?php
$lm_str = "";
$lmimg = G5_DATA_PATH."/logos/mo";
if (file_exists($lmimg)) {
$size = @getimagesize($lmimg);
if($size[0] && $size[0] > 400)
$width = 400;
else
$width = $size[0];
echo '<input type="checkbox" name="bu_logo_mo_del" value="1" id="bu_logo_mo_del"> <label for="bu_logo_mo_del">삭제</label>';
$lmimg_str = '<img src="'.G5_DATA_URL.'/logos/mo?ver='.G5_SERVER_TIME.'" width="'.$width.'">';
}
if (isset($lmimg_str) && $lmimg_str) {
echo '<br><span style="margin-top:20px; background-color:#f1f1f1; padding:10px 20px 10px 20px; display:inline-block; box-sizing:border-box;">';
echo $lmimg_str;
echo '</span>';
}
?>
</td>
</tr>
<tr>
<th scope="row">로고 Mobile (화이트)</th>
<td>
<?php echo help('Mobile 버전 로고이미지(화이트)를 등록하세요.<br>어두운 백그라운드가 사용될 때 변경 됩니다.') ?>
<input type="file" name="bu_logo_mo_w">
<?php
$lmw_str = "";
$lmwimg = G5_DATA_PATH."/logos/mo_w";
if (file_exists($lmwimg)) {
$size = @getimagesize($lmwimg);
if($size[0] && $size[0] > 400)
$width = 400;
else
$width = $size[0];
echo '<input type="checkbox" name="bu_logo_mo_w_del" value="1" id="bu_logo_mo_w_del"> <label for="bu_logo_mo_w_del">삭제</label>';
$lmwimg_str = '<img src="'.G5_DATA_URL.'/logos/mo_w?ver='.G5_SERVER_TIME.'" width="'.$width.'">';
}
if (isset($lmwimg_str) && $lmwimg_str) {
echo '<br><span style="margin-top:20px; background-color:#f1f1f1; padding:10px 20px 10px 20px; display:inline-block; box-sizing:border-box;">';
echo $lmwimg_str;
echo '</span>';
}
?>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb_header">
<h2 class="h2_frm">헤더 설정</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">메인페이지 헤더 투명 효과</th>
<td>
<?php echo help('메인페이지에서 스크롤 시 헤더 배경이 나타나는 효과를 사용합니다.') ?>
<input type="checkbox" name="bu_trans_header" value="1" id="bu_trans_header" <?php echo isset($bu['bu_trans_header']) && $bu['bu_trans_header'] ? 'checked' : ''; ?>> <label for="bu_trans_header">사용</label>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb2">
<h2 class="h2_frm">하단 회사정보</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">회사명(사이트명)</th>
<td>
<input type="text" name="bu_1" value="<?php echo isset($bu['bu_1']) ? get_sanitize_input($bu['bu_1']) : ''; ?>" id="bu_1" class="frm_input" size="40">
</td>
<th scope="row">대표자명</th>
<td>
<input type="text" name="bu_2" value="<?php echo isset($bu['bu_2']) ? get_sanitize_input($bu['bu_2']) : ''; ?>" id="bu_2" class="frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">전화번호</th>
<td>
<input type="text" name="bu_3" value="<?php echo isset($bu['bu_3']) ? get_sanitize_input($bu['bu_3']) : ''; ?>" id="bu_3" class="frm_input" size="40">
</td>
<th scope="row">팩스번호</th>
<td>
<input type="text" name="bu_4" value="<?php echo isset($bu['bu_4']) ? get_sanitize_input($bu['bu_4']) : ''; ?>" id="bu_4" class="frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">사업자등록번호</th>
<td>
<input type="text" name="bu_5" value="<?php echo isset($bu['bu_5']) ? get_sanitize_input($bu['bu_5']) : ''; ?>" id="bu_5" class="frm_input" size="40">
</td>
<th scope="row">통신판매업신고번호</th>
<td>
<input type="text" name="bu_6" value="<?php echo isset($bu['bu_6']) ? get_sanitize_input($bu['bu_6']) : ''; ?>" id="bu_6" class="frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">부가통신사업자번호</th>
<td>
<input type="text" name="bu_7" value="<?php echo isset($bu['bu_7']) ? get_sanitize_input($bu['bu_7']) : ''; ?>" id="bu_7" class="frm_input" size="40">
</td>
<th scope="row">기타등록번호</th>
<td>
<input type="text" name="bu_8" value="<?php echo isset($bu['bu_8']) ? get_sanitize_input($bu['bu_8']) : ''; ?>" id="bu_8" class="frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">우편번호</th>
<td>
<input type="text" name="bu_9" value="<?php echo isset($bu['bu_9']) ? get_sanitize_input($bu['bu_9']) : ''; ?>" id="bu_9" class="frm_input" size="40">
</td>
<th scope="row">사업장주소</th>
<td>
<input type="text" name="bu_10" value="<?php echo isset($bu['bu_10']) ? get_sanitize_input($bu['bu_10']) : ''; ?>" id="bu_10" class="frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">개인정보책임자(이메일)</th>
<td>
<input type="text" name="bu_11" value="<?php echo isset($bu['bu_11']) ? get_sanitize_input($bu['bu_11']) : ''; ?>" id="bu_11" class="frm_input" size="40">
</td>
<th scope="row">카피라이트</th>
<td>
<input type="text" name="bu_12" value="<?php echo isset($bu['bu_12']) ? get_sanitize_input($bu['bu_12']) : ''; ?>" id="bu_12" class="frm_input" size="40">
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb3">
<h2 class="h2_frm">로딩인디케이터</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">사용여부</th>
<td colspan="3">
<?php echo help('사용시 로딩 스피너를 표기하며<br>DOM을 포함한 모든 페이지가 준비 되면 사라집니다.') ?>
<input type="checkbox" name="bu_load" value="1" id="bu_load" <?php echo isset($bu['bu_load']) && $bu['bu_load'] ? 'checked' : ''; ?>> <label for="bu_load">사용</label>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb6">
<h2 class="h2_frm">시스템메세지</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">수신여부</th>
<td colspan="3">
<?php echo help('시스템메세지 관리자 수신 여부를 설정할 수 있습니다.<br>신규 게시물등록, 주문접수, 회원가입 등 웹사이트에서 일어나는 주요 활동에 대한 알림 입니다.') ?>
<input type="checkbox" name="bu_systemmsg_use" value="1" id="bu_systemmsg_use" <?php echo isset($bu['bu_systemmsg_use']) && $bu['bu_systemmsg_use'] ? 'checked' : ''; ?>> <label for="bu_systemmsg_use">수신함</label>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb5">
<h2 class="h2_frm">모바일설정</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">Viewport</th>
<td colspan="3">
<?php echo help('빌더의 기본 뷰포트 값은 0.9 입니다. 값이 없으면 0.9 로 적용되며,<br>/theme/테마폴더/head.sub.php 파일의 meta name="viewport" 값이 변경 됩니다.<br>숫자가 작을수록 오브젝트의 크기가 축소되며, 1이 정비율 입니다.<br>커스텀 테마를 사용하시는 경우 적용이 되지않을 수 있습니다.') ?>
<input type="text" name="bu_viewport" value="<?php echo isset($bu['bu_viewport']) ? get_sanitize_input($bu['bu_viewport']) : ''; ?>" id="bu_viewport" class="frm_input" size="10">
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_rb4">
<h2 class="h2_frm">운영채널</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">카카오채널 URL</th>
<td>
<input type="text" name="bu_sns1" value="<?php echo isset($bu['bu_sns1']) ? get_sanitize_input($bu['bu_sns1']) : ''; ?>" id="bu_sns1" class="frm_input" size="70">
</td>
<th scope="row">카카오채널 상담 URL</th>
<td>
<input type="text" name="bu_sns2" value="<?php echo isset($bu['bu_sns2']) ? get_sanitize_input($bu['bu_sns2']) : ''; ?>" id="bu_sns2" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row">유튜브 URL</th>
<td>
<input type="text" name="bu_sns3" value="<?php echo isset($bu['bu_sns3']) ? get_sanitize_input($bu['bu_sns3']) : ''; ?>" id="bu_sns3" class="frm_input" size="70">
</td>
<th scope="row">인스타그램 URL</th>
<td>
<input type="text" name="bu_sns4" value="<?php echo isset($bu['bu_sns4']) ? get_sanitize_input($bu['bu_sns4']) : ''; ?>" id="bu_sns4" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row">페이스북 URL</th>
<td>
<input type="text" name="bu_sns5" value="<?php echo isset($bu['bu_sns5']) ? get_sanitize_input($bu['bu_sns5']) : ''; ?>" id="bu_sns5" class="frm_input" size="70">
</td>
<th scope="row">트위터 URL</th>
<td>
<input type="text" name="bu_sns6" value="<?php echo isset($bu['bu_sns6']) ? get_sanitize_input($bu['bu_sns6']) : ''; ?>" id="bu_sns6" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row">네이버블로그 URL</th>
<td>
<input type="text" name="bu_sns7" value="<?php echo isset($bu['bu_sns7']) ? get_sanitize_input($bu['bu_sns7']) : ''; ?>" id="bu_sns7" class="frm_input" size="70">
</td>
<th scope="row">텔레그램 URL</th>
<td>
<input type="text" name="bu_sns8" value="<?php echo isset($bu['bu_sns8']) ? get_sanitize_input($bu['bu_sns8']) : ''; ?>" id="bu_sns8" class="frm_input" size="70">
</td>
</tr>
<tr>
<th scope="row">SIR URL</th>
<td>
<input type="text" name="bu_sns9" value="<?php echo isset($bu['bu_sns9']) ? get_sanitize_input($bu['bu_sns9']) : ''; ?>" id="bu_sns9" class="frm_input" size="70">
</td>
<th scope="row">기타 URL</th>
<td>
<input type="text" name="bu_sns10" value="<?php echo isset($bu['bu_sns10']) ? get_sanitize_input($bu['bu_sns10']) : ''; ?>" id="bu_sns10" class="frm_input" size="70">
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<?php } else { ?>
<section>
<h2 class="h2_frm">그누보드 리빌더</h2>
<div class="local_desc01 local_desc">
그누보드 리빌더를 사용해주셔서 고맙습니다.<br><br>
리빌더는 그누보드의 기능을 모두 그대로 사용하면서 폴더의 추가만으로<br>
손쉽게 웹사이트를 완성하고 다양한 편의기능을 사용할 수 있습니다.<br><br>
<b>본 페이지는 테이블이 설치되면 더이상 볼 수 없습니다.</b>
</div>
</section>
<section>
<h2 class="h2_frm">빌더 설치안내 및 주의사항</h2>
<div class="local_desc01 local_desc">
빌더 구동에 필요한 테이블이 설치 됩니다.<br><br>
rb_ 로 시작하는 동일한 테이블명 있는경우 테이블 생성이 되지 않을 수 있으며<br>
성능 보장을 위해 가급적 PHP7.X ~ PHP8.X 버전을 사용해주세요.<br>
<strong>DB 테이블 설치 후 빌더설정 > [DB 업데이트] 를 반드시 실행해주세요.</strong><br><br>
--------------<br>
<b>생성되는 테이블 목록</b><br>
rb_builder (빌더설정), rb_config (환경설정), rb_module (모듈설정)<br>
rb_banner (배너관리), rb_seo (SEO설정)<br>
--------------<br><br>
테이블 설치 후 <b>환경설정 > 테마설정</b> 메뉴에서<br>
<b>Rebuilder Basic 테마를 적용</b> 해주시고<br>
테마적용 직후 뜨는 팝업창에서 <b>[확인]</b> 을 클릭합니다.<br><br>
[확인] 을 클릭하지 못하였다면 <b>환경설정 > 기본환경설정</b> 메뉴에서<br>
<b>[테마 스킨설정 가져오기], [테마 회원스킨설정 가져오기]</b> 를 클릭하신 후<br>
반드시 <b>[확인]</b> 을 클릭 해주세요.<br><br>
설치가 완료 되었다면, <b>관리자모드 > 게시판관리</b> 에서<br>
게시판의 스킨을 <b>rb.XXX 로 변경</b> 합니다.<br><br>
메인페이지로 이동 후 <b>[모듈추가]</b> 버튼을 통해 메인페이지에 출력될 모듈을 구성 합니다.
</div>
</section>
<section>
<form name="rb_form" id="rb_form" action="./rb_form_update.php" method="post">
<!-- <input type="hidden" name="token" value="--><?php //echo get_admin_token(); ?><!--">-->
<!-- <input type="hidden" name="install" value="1" id="install">-->
<h2 class="h2_frm">라이선스 정책</h2>
<div class="local_desc01 local_desc">
본 빌더는 납품물 제작의 용도나 자사운영 목적의 용도로 사용할 수 있습니다.<br>
빌더 및 빌더를 구성하는 디자인, 스킨, 프로그램 등을 웹사이트에 게재(전시) 하여 판매 하는 행위 또는<br>
배포 (타인이 다운로드 할 수 있도록 게재하는 행위) 는 불가능 합니다.<br><br>
기타 문의사항 및 기술지원은<br>
공식홈페이지 <a href="https://rebuilder.co.kr" target="_blank"><strong>https://rebuilder.co.kr</strong></a> 를 이용해주세요.<br><br>
<input type="checkbox" value="1" id="agrees">
<label for="agrees">상기 내용을 모두 확인하였으며, 라이선스 정책에 동의 합니다.</label>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="DB 테이블 설치하기" class="btn_submit btn">
</div>
</form>
</section>
<script>
$(document).ready(function() {
$("#rb_form").on("submit", function(event) {
if (confirm("상기 주의사항 및 라이선스 정책을 확인해주세요.\nDB 테이블을 설치 하시겠습니까?")) {
if (!$("#agrees").is(":checked")) {
alert("라이선스 정책에 동의 하셔야 빌더를 사용할 수 있습니다.");
event.preventDefault();
}
} else {
event.preventDefault();
}
});
});
</script>
<?php } ?>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+287
View File
@@ -0,0 +1,287 @@
<?php
$sub_menu = '000000';
include_once('./_common.php');
check_demo();
auth_check_menu($auth, $sub_menu, "w");
/**
* 로고 파일 업로드 및 유효성 검사를 처리하는 함수
* @param array|null $file_info $_FILES 배열의 요소
* @param string $target_name 저장될 파일 이름 (예: 'pc', 'pc_w')
*/
function handle_logo_upload($file_info, $target_name) {
if (empty($file_info) || empty($file_info['name'])) {
return;
}
// 이미지 파일인지 확장자 검사
if (!preg_match('/\.(gif|jpe?g|bmp|png)$/i', $file_info['name'])) {
alert($file_info['name'] . " : 이미지 파일만 업로드할 수 있습니다.");
}
// 파일 업로드 실행
if (is_uploaded_file($file_info['tmp_name'])) {
$destination = G5_DATA_PATH."/logos/".$target_name;
move_uploaded_file($file_info['tmp_name'], $destination);
chmod($destination, G5_FILE_PERMISSION);
// DB에 파일명 업데이트 (파일이 실제로 존재할 때만)
$target_name_escaped = sql_real_escape_string($target_name);
sql_query("UPDATE rb_builder SET bu_logo_{$target_name_escaped} = '{$target_name_escaped}'");
}
}
// ==================================================================
// 1. 빌더 설정 저장 (폼 데이터가 전송된 경우)
// ==================================================================
if (isset($_POST['install']) && $_POST['install'] == 1) {
// 1-1. 토큰 검사를 이 블록 안으로 이동
check_admin_token();
// 1-2. 로고 저장 폴더 생성
@mkdir(G5_DATA_PATH."/logos", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/logos", G5_DIR_PERMISSION);
// 1-3. 로고 삭제 처리
if (!empty($_POST['bu_logo_pc_del'])) @unlink(G5_DATA_PATH."/logos/pc");
if (!empty($_POST['bu_logo_pc_w_del'])) @unlink(G5_DATA_PATH."/logos/pc_w");
if (!empty($_POST['bu_logo_mo_del'])) @unlink(G5_DATA_PATH."/logos/mo");
if (!empty($_POST['bu_logo_mo_w_del'])) @unlink(G5_DATA_PATH."/logos/mo_w");
// 1-4. 로고 업로드 처리 (함수화하여 중복 제거)
handle_logo_upload($_FILES['bu_logo_pc'] ?? null, 'pc');
handle_logo_upload($_FILES['bu_logo_pc_w'] ?? null, 'pc_w');
handle_logo_upload($_FILES['bu_logo_mo'] ?? null, 'mo');
handle_logo_upload($_FILES['bu_logo_mo_w'] ?? null, 'mo_w');
// 1-5. SQL Injection 방지 및 코드 통합
$bu_data = array();
// bu_ 로 시작하는 모든 POST 값을 가져와서 안전하게 이스케이프 처리
foreach ($_POST as $key => $value) {
if (strpos($key, 'bu_') === 0) {
// 로고 삭제 필드(_del)는 DB에 저장하지 않음
if (substr($key, -4) !== '_del') {
$bu_data[$key] = sql_real_escape_string($value);
}
}
}
// 숫자형으로 강제 변환하여 타입 안전성 확보
$bu_data['bu_load'] = isset($_POST['bu_load']) ? 1 : 0;
$bu_data['bu_systemmsg_use'] = isset($_POST['bu_systemmsg_use']) ? 1 : 0;
$bu_data['bu_trans_header'] = isset($_POST['bu_trans_header']) ? 1 : 0;
// SQL SET 구문 동적 생성
$sql_set_clauses = array();
foreach ($bu_data as $key => $value) {
$sql_set_clauses[] = "`{$key}` = '{$value}'";
}
$sql_set_clauses[] = "bu_datetime = '".G5_TIME_YMDHIS."'";
$sql_set_string = implode(', ', $sql_set_clauses);
$cnt_row = sql_fetch("SELECT COUNT(*) as cnt FROM rb_builder");
// 데이터 존재 여부에 따라 UPDATE 또는 INSERT 실행
if ($cnt_row['cnt'] > 0) {
$sql = "UPDATE rb_builder SET {$sql_set_string}";
} else {
$sql = "INSERT INTO rb_builder SET {$sql_set_string}";
}
sql_query($sql);
// ==================================================================
// 2. DB 테이블 설치 (최초 1회 실행)
// ==================================================================
} else {
//폴더생성
@mkdir(G5_DATA_PATH."/seo", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/seo", G5_DIR_PERMISSION);
@mkdir(G5_DATA_PATH."/banners", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/banners", G5_DIR_PERMISSION);
@mkdir(G5_DATA_PATH."/logos", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/logos", G5_DIR_PERMISSION);
//빌더설정 테이블
if(!sql_query(" DESCRIBE rb_builder ", false)) {
sql_query("
CREATE TABLE IF NOT EXISTS `rb_builder` (
`bu_logo_pc` varchar(255) NOT NULL DEFAULT '' COMMENT '로고 PC',
`bu_logo_pc_w` varchar(255) NOT NULL DEFAULT '' COMMENT '로고 PC W',
`bu_logo_mo` varchar(255) NOT NULL DEFAULT '' COMMENT '로고 MO',
`bu_logo_mo_w` varchar(255) NOT NULL DEFAULT '' COMMENT '로고 MO W',
`bu_trans_header` tinyint(4) NOT NULL DEFAULT 0 COMMENT '메인 헤더 투명 효과',
`bu_load` int(4) NOT NULL DEFAULT 1 COMMENT '로딩인디케이터',
`bu_systemmsg_use` int(4) NOT NULL DEFAULT 1 COMMENT '시스템메세지 관리자수신여부',
`bu_1` varchar(255) NOT NULL DEFAULT '' COMMENT '회사명',
`bu_2` varchar(255) NOT NULL DEFAULT '' COMMENT '대표자명',
`bu_3` varchar(255) NOT NULL DEFAULT '' COMMENT '전화번호',
`bu_4` varchar(255) NOT NULL DEFAULT '' COMMENT '팩스번호',
`bu_5` varchar(255) NOT NULL DEFAULT '' COMMENT '사업자등록번호',
`bu_6` varchar(255) NOT NULL DEFAULT '' COMMENT '통신판매업신고번호',
`bu_7` varchar(255) NOT NULL DEFAULT '' COMMENT '부가통신사업자번호',
`bu_8` varchar(255) NOT NULL DEFAULT '' COMMENT '기타등록번호1',
`bu_9` varchar(255) NOT NULL DEFAULT '' COMMENT '우편번호',
`bu_10` varchar(255) NOT NULL DEFAULT '' COMMENT '사업장주소',
`bu_11` varchar(255) NOT NULL DEFAULT '' COMMENT '개인정보책임자',
`bu_12` varchar(255) NOT NULL DEFAULT '' COMMENT '카피라이트',
`bu_13` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_14` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_15` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_16` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_17` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_18` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_19` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_20` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`bu_sns1` varchar(255) NOT NULL DEFAULT '' COMMENT '카카오채널',
`bu_sns2` varchar(255) NOT NULL DEFAULT '' COMMENT '카카오상담',
`bu_sns3` varchar(255) NOT NULL DEFAULT '' COMMENT '유튜브',
`bu_sns4` varchar(255) NOT NULL DEFAULT '' COMMENT '인스타그램',
`bu_sns5` varchar(255) NOT NULL DEFAULT '' COMMENT '페이스북',
`bu_sns6` varchar(255) NOT NULL DEFAULT '' COMMENT '트위터',
`bu_sns7` varchar(255) NOT NULL DEFAULT '' COMMENT '네이버블로그',
`bu_sns8` varchar(255) NOT NULL DEFAULT '' COMMENT '텔레그램',
`bu_sns9` varchar(255) NOT NULL DEFAULT '' COMMENT 'SIR',
`bu_sns10` varchar(255) NOT NULL DEFAULT '' COMMENT '기타',
`bu_viewport` varchar(10) NOT NULL,
`bu_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '등록일시(변경일시)'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
//환경설정 테이블
if(!sql_query(" DESCRIBE rb_config ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `rb_config` (
`co_id` int(11) NOT NULL AUTO_INCREMENT,
`co_color` varchar(20) NOT NULL DEFAULT '#aa20ff' COMMENT '강조 컬러',
`co_dark` varchar(20) NOT NULL DEFAULT '' COMMENT '다크모드',
`co_layout` varchar(20) NOT NULL DEFAULT '' COMMENT '레이아웃',
`co_layout_hd` varchar(20) NOT NULL DEFAULT '' COMMENT '레이아웃(헤더)',
`co_layout_ft` varchar(20) NOT NULL DEFAULT '' COMMENT '레이아웃(푸더)',
`co_sub_width` varchar(20) NOT NULL COMMENT '서브가로폭',
`co_main_width` varchar(20) NOT NULL COMMENT '메인가로폭',
`co_tb_width` varchar(20) NOT NULL COMMENT '상/하단가로폭',
`co_header` varchar(20) NOT NULL DEFAULT '#ffffff' COMMENT '헤더',
`co_footer` varchar(20) NOT NULL COMMENT '풋터',
`co_font` varchar(20) NOT NULL DEFAULT '' COMMENT '폰트',
`co_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '등록일시(변경일시)',
`co_ip` varchar(100) NOT NULL DEFAULT '' COMMENT '등록자IP',
PRIMARY KEY (`co_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
$cnt_config = sql_fetch("SELECT COUNT(*) as cnt FROM rb_config");
if ($cnt_config['cnt'] == 0) {
$sql = " insert rb_config
set co_color = '#aa20ff',
co_dark = '',
co_layout = 'basic',
co_layout_hd = 'basic',
co_layout_ft = 'basic',
co_sub_width = '960',
co_main_width = '1400',
co_tb_width = '1400',
co_header = '#ffffff',
co_footer = '0',
co_font = 'Pretendard',
co_datetime = '".G5_TIME_YMDHIS."',
co_ip = '' ";
sql_query($sql);
}
//모듈설정 테이블
if(!sql_query(" DESCRIBE rb_module ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `rb_module` (
`md_id` int(11) NOT NULL AUTO_INCREMENT,
`md_layout` varchar(255) NOT NULL DEFAULT '' COMMENT '레이아웃 아이디',
`md_layout_name` varchar(255) NOT NULL DEFAULT '' COMMENT '레이아웃이름',
`md_theme` varchar(255) NOT NULL DEFAULT '' COMMENT '테마명',
`md_title` varchar(255) NOT NULL DEFAULT '' COMMENT '모듈타이틀',
`md_type` varchar(255) NOT NULL DEFAULT '' COMMENT '모듈타입',
`md_bo_table` varchar(255) NOT NULL DEFAULT '' COMMENT '연결 게시판',
`md_sca` varchar(255) NOT NULL DEFAULT '' COMMENT '연결 카테고리',
`md_widget` varchar(255) NOT NULL DEFAULT '' COMMENT '프로그램',
`md_poll` varchar(255) NOT NULL DEFAULT '' COMMENT '투표',
`md_poll_id` varchar(20) NOT NULL DEFAULT '' COMMENT '투표ID',
`md_custom_skin` varchar(255) NOT NULL DEFAULT '' COMMENT '커스텀 모듈 스킨',
`md_banner` varchar(255) NOT NULL DEFAULT '' COMMENT '배너',
`md_banner_id` varchar(20) NOT NULL DEFAULT '' COMMENT '배너ID',
`md_banner_skin` varchar(255) NOT NULL DEFAULT '' COMMENT '배너스킨',
`md_module` varchar(255) NOT NULL DEFAULT '' COMMENT '출력모듈',
`md_skin` varchar(255) NOT NULL DEFAULT '' COMMENT '출력스킨',
`md_cnt` int(10) NOT NULL DEFAULT 1 COMMENT '출력갯수',
`md_auto_time` int(10) NOT NULL DEFAULT 3000 COMMENT '오토플레이타임',
`md_gap` int(10) NOT NULL DEFAULT 40 COMMENT '여백(간격)',
`md_gap_mo` int(10) NOT NULL DEFAULT 20 COMMENT '모바일 여백(간격)',
`md_col` int(10) NOT NULL DEFAULT 1 COMMENT '출력갯수(열/가로)',
`md_row` int(10) NOT NULL DEFAULT 1 COMMENT '출력갯수(행/세로)',
`md_col_mo` int(10) NOT NULL DEFAULT 1 COMMENT '모바일 출력갯수(열/가로)',
`md_row_mo` int(10) NOT NULL DEFAULT 1 COMMENT '모바일 출력갯수(행/세로)',
`md_width` varchar(20) NOT NULL DEFAULT '100%' COMMENT '가로사이즈',
`md_height` varchar(20) NOT NULL DEFAULT 'auto' COMMENT '세로사이즈',
`md_subject_is` int(4) NOT NULL COMMENT '출력항목(제목)',
`md_thumb_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(썸네일)',
`md_nick_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(닉네임)',
`md_date_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(작성일시)',
`md_content_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(본문)',
`md_icon_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(아이콘)',
`md_comment_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(코멘트)',
`md_ca_is` int(4) NOT NULL DEFAULT 1 COMMENT '출력항목(카테고리)',
`md_swiper_is` int(4) NOT NULL DEFAULT 0 COMMENT '스와이프여부',
`md_auto_is` int(4) NOT NULL DEFAULT 0 COMMENT '오토플레이 여부',
`md_order` varchar(255) NOT NULL DEFAULT 'wr_num' COMMENT '출력순서',
`md_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '등록일시(변경일시)',
`md_ip` varchar(100) NOT NULL DEFAULT '' COMMENT '등록자IP',
`md_order_id` int(4) NOT NULL DEFAULT 0 COMMENT '모듈순서',
PRIMARY KEY (`md_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
//배너관리 테이블
if(!sql_query(" DESCRIBE rb_banner ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `rb_banner` (
`bn_id` int(11) NOT NULL AUTO_INCREMENT,
`bn_alt` varchar(255) NOT NULL DEFAULT '',
`bn_url` varchar(255) NOT NULL DEFAULT '',
`bn_device` varchar(10) NOT NULL DEFAULT '',
`bn_position` varchar(255) NOT NULL DEFAULT '',
`bn_border` tinyint(4) NOT NULL DEFAULT '0',
`bn_radius` tinyint(4) NOT NULL DEFAULT '0',
`bn_ad_ico` tinyint(4) NOT NULL DEFAULT '0',
`bn_new_win` tinyint(4) NOT NULL DEFAULT '0',
`bn_begin_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bn_hit` int(11) NOT NULL DEFAULT '0',
`bn_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`bn_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
//SEO설정 테이블
if(!sql_query(" DESCRIBE rb_seo ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `rb_seo` (
`se_title` varchar(255) NOT NULL COMMENT '사이트명',
`se_description` mediumtext NOT NULL COMMENT '사이트설명',
`se_keywords` mediumtext NOT NULL COMMENT '키워드',
`se_favicon` varchar(255) NOT NULL COMMENT '파비콘',
`se_google_meta` varchar(255) NOT NULL COMMENT '구글 소유권 메타',
`se_naver_meta` varchar(255) NOT NULL COMMENT '네이버 소유권 메타',
`se_robots` mediumtext NOT NULL COMMENT '로봇접근제어',
`se_og_image` varchar(255) NOT NULL COMMENT '오픈그래프 이미지',
`se_og_site_name` varchar(255) NOT NULL COMMENT '오픈그래프 사이트명',
`se_og_title` varchar(255) NOT NULL COMMENT '오픈그래프 사이트명',
`se_og_description` varchar(255) NOT NULL COMMENT '오픈그래프 사이트 설명',
`se_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '등록일시(변경일시)'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
alert('DB 테이블 설치가 완료 되었습니다.\\n[DB 업데이트] 를 반드시 실행해주세요.\\n테이블 설치 후 환경설정 > 테마설정 메뉴에서\\nRebuilder Basic 테마를 적용해주세요.');
}
update_rewrite_rules();
goto_url('./rb_form.php', false);
+265
View File
@@ -0,0 +1,265 @@
<?php
$sub_menu = '000500';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
add_stylesheet('<link rel="stylesheet" href="./css/style.css">', 0);
//테이블이 있는지 검사한다.
if(!sql_query(" DESCRIBE rb_seo ", false)) {
$query_cp = sql_query(" CREATE TABLE IF NOT EXISTS `rb_seo` (
`se_title` varchar(255) NOT NULL COMMENT '사이트명',
`se_description` mediumtext NOT NULL COMMENT '사이트설명',
`se_keywords` mediumtext NOT NULL COMMENT '키워드',
`se_favicon` varchar(255) NOT NULL COMMENT '파비콘',
`se_google_meta` varchar(255) NOT NULL COMMENT '구글 소유권 메타',
`se_naver_meta` varchar(255) NOT NULL COMMENT '네이버 소유권 메타',
`se_robots` mediumtext NOT NULL COMMENT '로봇접근제어',
`se_og_image` varchar(255) NOT NULL COMMENT '오픈그래프 이미지',
`se_og_site_name` varchar(255) NOT NULL COMMENT '오픈그래프 사이트명',
`se_og_title` varchar(255) NOT NULL COMMENT '오픈그래프 사이트명',
`se_og_description` varchar(255) NOT NULL COMMENT '오픈그래프 사이트 설명',
`se_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '등록일시(변경일시)'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
$sql = " select * from rb_seo limit 1";
$seo = sql_fetch($sql);
$pg_anchor = '<ul class="anchor">
<li><a href="#anc_seo1">기본설정</a></li>
<li><a href="#anc_seo2">검색엔진</a></li>
<li><a href="#anc_seo3">오픈그래프</a></li>
<li><a href="#anc_seo4">기타설정</a></li>
</ul>';
$g5['title'] = 'SEO 관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="seo_form" id="seo_form" action="./seo_form_update.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="token" value="" id="token">
<section id="anc_seo1">
<h2 class="h2_frm">기본설정</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">웹사이트 제목<strong class="sound_only">필수</strong></th>
<td colspan="3">
<?php echo help('검색결과와 브라우저 제목에 반영되는 대표 정보로,<br>웹사이트 이름과 함께 고유한 브랜드메시지를 짧게 입력하는 것도 좋습니다.') ?>
<input type="text" name="se_title" value="<?php echo isset($seo['se_title']) ? get_sanitize_input($seo['se_title']) : ''; ?>" id="se_title" required class="required frm_input" size="40">
</td>
</tr>
<tr>
<th scope="row">웹사이트 설명</th>
<td colspan="3">
<?php echo help('웹사이트 유형, 판매 상품 정보, 사용자의 클릭을 유도하는 설명 등을 요약하여 입력하세요.') ?>
<input type="text" name="se_description" value="<?php echo isset($seo['se_description']) ? get_sanitize_input($seo['se_description']) : ''; ?>" id="se_description" class="frm_input" size="100">
</td>
</tr>
<tr>
<th scope="row">키워드</th>
<td colspan="3">
<?php echo help('검색형 키워드를 콤마로 구분하여 입력하세요.') ?>
<input type="text" name="se_keywords" value="<?php echo isset($seo['se_keywords']) ? get_sanitize_input($seo['se_keywords']) : ''; ?>" id="se_keywords" class="frm_input" size="100">
</td>
</tr>
<tr>
<th scope="row">파비콘</th>
<td>
<div class="border_box_adm">
<img src="./img/bg_favicon_example.png"><br><br>
<?php echo help('파비콘은 주소창에 표시되는 웹사이트를 대표하는 아이콘입니다.<br>브라우저의 상단 탭과 북마크 영역에서 나타납니다.') ?>
</div>
<?php echo help('ico 파일만 업로드 가능합니다.') ?>
<input type="file" name="se_favicon">
<?php
$favimg = G5_DATA_PATH . "/seo/favicon";
if (file_exists($favimg)) {
echo '<input type="checkbox" name="se_favicon_del" value="1" id="se_favicon_del"> <label for="se_favicon_del">삭제</label>';
if (isset($seo['se_favicon'])) {
echo '<div>' . G5_URL . '/data/seo/' . $seo['se_favicon'] . '</div>';
}
}
?>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_seo2">
<h2 class="h2_frm">검색엔진</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">구글 서치 콘솔</th>
<td colspan="3">
<?php echo help('구글에 웹사이트를 등록하고 발급받은 HTML 태그를 입력하여 사이트 소유권을 확인합니다.') ?>
<input type="text" name="se_google_meta" value="<?php echo isset($seo['se_google_meta']) ? get_text($seo['se_google_meta']) : ''; ?>" id="se_google_meta" class="frm_input" size="50" placeholder="<meta name=....">
<a href="https://search.google.com/search-console/about" target="_blank" class="btn_frmline">바로가기</a>
</td>
</tr>
<tr>
<th scope="row">네이버 서치 어드바이저</th>
<td colspan="3">
<?php echo help('네이버에 웹사이트를 등록하고 발급받은 HTML 태그를 입력하여 사이트 소유권을 확인합니다.') ?>
<input type="text" name="se_naver_meta" value="<?php echo isset($seo['se_naver_meta']) ? get_text($seo['se_naver_meta']) : ''; ?>" id="se_naver_meta" class="frm_input" size="50" placeholder="<meta name=....">
<a href="https://searchadvisor.naver.com/" target="_blank" class="btn_frmline">바로가기</a>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_seo3">
<h2 class="h2_frm">오픈그래프</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">og:image</th>
<td>
<?php echo help('SNS에서 공유할 때 노출되는 이미지를 설정합니다.<br>게시판, 상품 등의 페이지는 자동적용 됩니다.') ?>
<input type="file" name="se_og_image">
<?php
$ogimg_str = "";
$ogimg = G5_DATA_PATH . "/seo/og_image";
if (file_exists($ogimg)) {
$size = @getimagesize($ogimg);
if ($size !== false) {
if ($size[0] && $size[0] > 400) {
$width = 400;
} else {
$width = $size[0];
}
echo '<input type="checkbox" name="se_og_image_del" value="1" id="se_og_image_del"> <label for="se_og_image_del">삭제</label>';
$ogimg_str = '<img src="' . G5_DATA_URL . '/seo/og_image?ver=' . G5_SERVER_TIME . '" width="' . $width . '">';
}
}
if (isset($seo['se_og_image'])) {
echo '<div>' . G5_URL . '/data/seo/' . $seo['se_og_image'] . '</div>';
}
if (!empty($ogimg_str)) {
echo '<div style="margin-top:20px;">';
echo $ogimg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row">og:site_name</th>
<td colspan="3">
<?php echo help('SNS에서 공유할 때 노출되는 사이트이름을 설정합니다.<br>게시판, 상품 등의 페이지는 자동적용 됩니다.') ?>
<input type="text" name="se_og_site_name" value="<?php echo isset($seo['se_og_site_name']) ? get_sanitize_input($seo['se_og_site_name']) : ''; ?>" id="se_og_site_name" class="frm_input" size="30">
</td>
</tr>
<tr>
<th scope="row">og:title</th>
<td colspan="3">
<?php echo help('SNS에서 공유할 때 노출되는 페이지제목(사이트이름)을 설정합니다.<br>게시판, 상품 등의 페이지는 자동적용 됩니다.') ?>
<input type="text" name="se_og_title" value="<?php echo isset($seo['se_og_title']) ? get_sanitize_input($seo['se_og_title']) : ''; ?>" id="se_og_title" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row">og:description</th>
<td colspan="3">
<?php echo help('SNS에서 공유할 때 노출되는 페이지설명(사이트설명)을 설정합니다.<br>게시판, 상품 등의 페이지는 자동적용 됩니다.') ?>
<input type="text" name="se_og_description" value="<?php echo isset($seo['se_og_description']) ? get_sanitize_input($seo['se_og_description']) : ''; ?>" id="se_og_description" class="frm_input" size="100">
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_seo4">
<h2 class="h2_frm">기타설정</h2>
<?php echo $pg_anchor ?>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col class="grid_4">
<col>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">robots.txt</th>
<td>
<?php echo help('robots.txt 파일은 검색로봇에게 페이지를 수집할 수 있도록 허용하거나 제한하는 표준 규약입니다.') ?>
<textarea name="se_robots" id="se_robots"><?php echo isset($seo['se_robots']) ? get_text($seo['se_robots']) : ''; ?></textarea>
<?php
$r_files = G5_PATH."/robots.txt";
if (file_exists($r_files)) {
echo '<div>'.G5_URL.'/robots.txt</div>';
}
?>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
+122
View File
@@ -0,0 +1,122 @@
<?php
$sub_menu = '000500';
include_once('./_common.php');
check_demo();
auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
@mkdir(G5_DATA_PATH . "/seo", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH . "/seo", G5_DIR_PERMISSION);
$favimg = isset($_FILES['se_favicon']['tmp_name']) ? $_FILES['se_favicon']['tmp_name'] : null;
$favimg_name = isset($_FILES['se_favicon']['name']) ? $_FILES['se_favicon']['name'] : null;
$ogimg = isset($_FILES['se_og_image']['tmp_name']) ? $_FILES['se_og_image']['tmp_name'] : null;
$ogimg_name = isset($_FILES['se_og_image']['name']) ? $_FILES['se_og_image']['name'] : null;
$se_favicon_del = isset($_POST['se_favicon_del']) ? $_POST['se_favicon_del'] : null;
$se_og_image_del = isset($_POST['se_og_image_del']) ? $_POST['se_og_image_del'] : null;
if ($se_favicon_del) {
@unlink(G5_DATA_PATH . "/seo/favicon");
}
if ($se_og_image_del) {
@unlink(G5_DATA_PATH . "/seo/og_image");
}
// ico 파일인지 체크
if ($favimg || $favimg_name) {
if (!preg_match('/\.(ico)$/i', $favimg_name)) {
alert("ico 파일만 업로드 할수 있습니다.");
}
}
// 파일이 이미지인지 체크
if ($ogimg || $ogimg_name) {
if (!preg_match('/\.(gif|jpe?g|bmp|png)$/i', $ogimg_name)) {
alert("이미지 파일만 업로드 할수 있습니다.");
}
$oimg = @getimagesize($ogimg);
if ($oimg === false || $oimg[2] < 1 || $oimg[2] > 16) {
alert("이미지 파일만 업로드 할수 있습니다.");
}
}
// 컬럼이 있는지 검사한다.
$cnt = sql_fetch("SELECT COUNT(*) as cnt FROM rb_seo");
if ($cnt['cnt'] > 0) {
$sql = "UPDATE rb_seo
SET se_title = '{$_POST['se_title']}',
se_description = '{$_POST['se_description']}',
se_keywords = '{$_POST['se_keywords']}',
se_google_meta = '{$_POST['se_google_meta']}',
se_naver_meta = '{$_POST['se_naver_meta']}',
se_robots = '{$_POST['se_robots']}',
se_og_site_name = '{$_POST['se_og_site_name']}',
se_og_title = '{$_POST['se_og_title']}',
se_og_description = '{$_POST['se_og_description']}',
se_datetime = '" . G5_TIME_YMDHIS . "'";
sql_query($sql);
} else {
$sql = "INSERT INTO rb_seo
SET se_title = '{$_POST['se_title']}',
se_description = '{$_POST['se_description']}',
se_keywords = '{$_POST['se_keywords']}',
se_google_meta = '{$_POST['se_google_meta']}',
se_naver_meta = '{$_POST['se_naver_meta']}',
se_robots = '{$_POST['se_robots']}',
se_og_site_name = '{$_POST['se_og_site_name']}',
se_og_title = '{$_POST['se_og_title']}',
se_og_description = '{$_POST['se_og_description']}',
se_datetime = '" . G5_TIME_YMDHIS . "'";
sql_query($sql);
}
if ($favimg_name) {
rb_upload_files($favimg, 'favicon', G5_DATA_PATH . "/seo");
}
if ($ogimg_name) {
rb_upload_files($ogimg, 'og_image', G5_DATA_PATH . "/seo");
}
// 파일이 있는지 체크
$ogimg_in = G5_DATA_PATH . "/seo/og_image";
if (file_exists($ogimg_in)) {
$sql = "UPDATE rb_seo SET se_og_image = 'og_image'";
sql_query($sql);
}
$favimg_in = G5_DATA_PATH . "/seo/favicon";
if (file_exists($favimg_in)) {
$sql = "UPDATE rb_seo SET se_favicon = 'favicon'";
sql_query($sql);
}
// robots.txt 파일 생성
if (isset($_POST['se_robots'])) {
// textarea에서 입력된 내용을 가져옴
$robotsContent = $_POST['se_robots'];
// robots.txt 파일의 경로를 정의함
$filePath = G5_PATH . '/robots.txt';
// 쓰기 모드로 파일을 오픈
if ($fileHandle = fopen($filePath, 'w')) {
// 파일에 내용을 저장함
if (fwrite($fileHandle, $robotsContent) === false) {
echo "robots.txt 파일 쓰기에 실패 했습니다.";
}
// 파일 핸들을 닫음
fclose($fileHandle);
} else {
echo "robots.txt 파일을 쓰기 위해 여는 데 실패했습니다.";
}
}
update_rewrite_rules();
goto_url('./seo_form.php', false);
?>