|
@@ -205,6 +276,20 @@ include_once(G5_ADMIN_PATH . '/admin.head.php');
+
+
\ No newline at end of file
diff --git a/adm/rb/banner_form_update.php b/adm/rb/banner_form_update.php
index 358ddac37..2c8144bfd 100644
--- a/adm/rb/banner_form_update.php
+++ b/adm/rb/banner_form_update.php
@@ -16,24 +16,60 @@ check_admin_token();
$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_video_file = isset($_FILES['bn_video_file']['tmp_name']) ? $_FILES['bn_video_file']['tmp_name'] : null;
+$bn_video_name = isset($_FILES['bn_video_file']['name']) ? $_FILES['bn_video_file']['name'] : null;
+$bn_content_type = isset($bn_content_type) ? $bn_content_type : 'image';
+$bn_video_url = isset($bn_video_url) ? clean_xss_tags($bn_video_url) : '';
+$bn_youtube_url = isset($bn_youtube_url) ? clean_xss_tags($bn_youtube_url) : '';
+$bn_vimeo_url = isset($bn_vimeo_url) ? clean_xss_tags($bn_vimeo_url) : '';
$bn_id = isset($bn_id) ? (int) $bn_id : 0;
$bn_bimg_del = isset($bn_bimg_del) ? $bn_bimg_del : null;
+$bn_video_del = isset($bn_video_del) ? $bn_video_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("이미지 파일만 업로드 할 수 있습니다.");
- }
+if ($bn_video_del) {
+ @unlink(G5_DATA_PATH."/banners/$bn_id");
+}
- $timg = @getimagesize($bn_bimg);
- if ($timg === false || $timg[2] < 1 || $timg[2] > 16) {
- alert("이미지 파일만 업로드 할 수 있습니다.");
+// 콘텐츠 유형에 따른 검증
+if ($bn_content_type === 'image') {
+ // 파일이 이미지인지 체크합니다.
+ 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("이미지 파일만 업로드 할 수 있습니다.");
+ }
+ }
+} elseif ($bn_content_type === 'video') {
+ // 동영상 파일 검증
+ if ($bn_video_file || $bn_video_name) {
+ if (!preg_match('/\.(mp4|mkv|mov|avi|webm|flv|wmv|m4v)$/i', $bn_video_name)) {
+ alert("동영상 파일(MP4, MKV, MOV, AVI, WebM, FLV, WMV, M4V)만 업로드 할 수 있습니다.");
+ }
+ }
+} elseif ($bn_content_type === 'video_url') {
+ // URL 검증
+ if (!$bn_video_url) {
+ alert("비디오 URL을 입력하세요.");
+ }
+} elseif ($bn_content_type === 'youtube') {
+ // 유튜브 URL 검증
+ if (!$bn_youtube_url) {
+ alert("유튜브 URL을 입력하세요.");
+ }
+} elseif ($bn_content_type === 'vimeo') {
+ // 비메오 URL 검증
+ if (!$bn_vimeo_url) {
+ alert("비메오 URL을 입력하세요.");
}
}
@@ -50,7 +86,22 @@ if(isset($_POST['bn_position_use']) && $_POST['bn_position_use']) {
}
if ($w == "") {
- if (!$bn_bimg_name) alert('배너 이미지를 업로드 하세요.');
+ // 콘텐츠 유형별 필수 검사
+ if ($bn_content_type === 'image' && !$bn_bimg_name) {
+ alert('배너 이미지를 업로드 하세요.');
+ }
+ if ($bn_content_type === 'video' && !$bn_video_name) {
+ alert('동영상 파일을 업로드 하세요.');
+ }
+ if ($bn_content_type === 'video_url' && !$bn_video_url) {
+ alert('비디오 URL을 입력하세요.');
+ }
+ if ($bn_content_type === 'youtube' && !$bn_youtube_url) {
+ alert('유튜브 URL을 입력하세요.');
+ }
+ if ($bn_content_type === 'vimeo' && !$bn_vimeo_url) {
+ alert('비메오 URL을 입력하세요.');
+ }
sql_query("ALTER TABLE rb_banner AUTO_INCREMENT=1");
@@ -61,6 +112,10 @@ if ($w == "") {
bn_alt4 = '$bn_alt4',
bn_url = '$bn_url',
bn_device = '$bn_device',
+ bn_content_type = '$bn_content_type',
+ bn_video_url = '$bn_video_url',
+ bn_youtube_url = '$bn_youtube_url',
+ bn_vimeo_url = '$bn_vimeo_url',
bn_position = '$bn_position',
bn_border = '$bn_border',
bn_radius = '$bn_radius',
@@ -82,6 +137,10 @@ if ($w == "") {
bn_alt4 = '$bn_alt4',
bn_url = '$bn_url',
bn_device = '$bn_device',
+ bn_content_type = '$bn_content_type',
+ bn_video_url = '$bn_video_url',
+ bn_youtube_url = '$bn_youtube_url',
+ bn_vimeo_url = '$bn_vimeo_url',
bn_position = '$bn_position',
bn_border = '$bn_border',
bn_radius = '$bn_radius',
@@ -100,9 +159,17 @@ if ($w == "") {
}
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");
+ // 콘텐츠 유형에 따라 파일 업로드
+ if ($bn_content_type === 'image') {
+ if (isset($_FILES['bn_bimg']['name']) && $_FILES['bn_bimg']['name']) {
+ rb_upload_files($_FILES['bn_bimg']['tmp_name'], $bn_id, G5_DATA_PATH."/banners");
+ }
+ } elseif ($bn_content_type === 'video') {
+ if (isset($_FILES['bn_video_file']['name']) && $_FILES['bn_video_file']['name']) {
+ rb_upload_files($_FILES['bn_video_file']['tmp_name'], $bn_id, G5_DATA_PATH."/banners");
+ }
}
+ // 나머지 타입(video_url, youtube, vimeo)은 파일 업로드 필요 없음 (URL만 저장)
goto_url("./banner_form.php?w=u&bn_id=$bn_id");
} else {
diff --git a/rb/rb.mod/banner/skin/rb.wide_slide/banner.skin.php b/rb/rb.mod/banner/skin/rb.wide_slide/banner.skin.php
index 8f9b4758c..3decafca0 100644
--- a/rb/rb.mod/banner/skin/rb.wide_slide/banner.skin.php
+++ b/rb/rb.mod/banner/skin/rb.wide_slide/banner.skin.php
@@ -49,21 +49,85 @@ while ($row = sql_fetch_array($result)) {
$bn_border = isset($row['bn_border']) && $row['bn_border'] ? ' bn_border' : '';
$bn_radius = isset($row['bn_radius']) && $row['bn_radius'] ? ' bn_radius' : '';
$bn_image = G5_DATA_URL.'/banners/'.$row['bn_id'];
+ $bn_content_type = isset($row['bn_content_type']) ? $row['bn_content_type'] : 'image';
+ $bn_video_url = isset($row['bn_video_url']) ? $row['bn_video_url'] : '';
+ $bn_youtube_url = isset($row['bn_youtube_url']) ? $row['bn_youtube_url'] : '';
+ $bn_vimeo_url = isset($row['bn_vimeo_url']) ? $row['bn_vimeo_url'] : '';
// 새창 옵션
$bn_new_win = isset($row['bn_new_win']) && $row['bn_new_win'] ? ' target="_blank"' : '';
- if ($i == 0) echo ''.PHP_EOL; // swiper-slide 닫기
}
$i++;
}
|