Compare commits

...
45 Commits
Author SHA1 Message Date
kagla c7de15f7f5 버전 5.4.14 수정 2021-08-10 11:28:17 +09:00
kagla 4595fefe7d 주석 오타 수정 (작은앙심님,210808) 2021-08-09 07:20:13 +00:00
kagla e3bfefab55 PHP8에서 Warning: Undefined variable $extensions 오류 나오지 않도록 수정 (다온테마님,210806) 2021-08-09 07:15:28 +00:00
kagla c024c7552b 게시글 입력시에도 $wr_1 ~ $wr_10 변수 사용시 오류 나오지 않도록 가변변수 생성 (다온테마님,210806) 2021-08-09 07:13:44 +00:00
kagla 8ed56ec293 네이버 소셜회원가입시 월/일 처리가 반대로 되는 현상 수정 (arrtres님,210727) 2021-07-28 11:19:45 +09:00
kagla ed3143b6fd 버전 5.4.13.1 수정중 2021-07-27 05:28:16 +00:00
kagla 1491ae6e17 잘못된 webp 검사 함수명 file_exists를 function_exists로 수정 2021-07-27 05:27:06 +00:00
EC2 Default User b29ced4553 버전 5.4.13 수정 2021-07-27 00:46:51 +00:00
EC2 Default User 77064a40c6 쇼핑몰을 사용하지 않을 경우 나오는 오류 수정 (열공중님,210723) 2021-07-26 03:17:22 +00:00
kagla 52ed0f3d64 움직이는 webp 이미지는 업로드 불가합니다. 문구를 삭제함 2021-07-24 06:18:56 +00:00
kagla d0e101b3e8 webp를 지원하는 서버에서만 이미지 업로드 확장자에 webp를 추가함 2021-07-24 06:18:20 +00:00
Cloud User 3f97138715 webp를 지원하지 않는 서버에서 경고 문구를 출력함 2021-07-24 06:16:22 +00:00
Cloud User d76b371a58 Merge branch '5.4.13' of github.com:gnuboard/gnuboard5 into 5.4.13 2021-07-21 04:54:28 +00:00
kagla 42bf3d6044 잘못된 주석 문구 수정 (해피정님,210720) 2021-07-20 14:49:01 +09:00
kagla 1d89af99b0 버전 5.4.12 수정 2021-07-20 01:23:06 +00:00
EC2 Default User 81635f7737 PHP 5 하위버전에서 상수 배열이 지원되지 않아 나오던 오류 수정 (한별아빠님,210719) 2021-07-20 01:20:35 +00:00
EC2 Default User e1e20f2dc2 skin 디렉토리가 없거나 경로가 잘못 된 경우 나오는 나오는 오류 수정 PHP Warning: array_merge(): Argument #2 is not an array (엑스엠엘님,210716) 2021-07-20 01:07:56 +00:00
kagla 0260fb9e33 버전 5.4.11 수정 2021-07-19 11:53:41 +09:00
kagla d9e6342c09 ckeditor4 는 별도의 브랜치에서 관리하기 위해 삭제함 2021-07-19 11:17:38 +09:00
kagla 8abf0dfcae Merge branch 'dhtml-editor' of github.com:gnuboard/gnuboard5 into dhtml-editor 2021-07-19 11:13:45 +09:00
kagla c2ce0f1d95 Merge branch 'reaonly' 2021-07-19 10:01:18 +09:00
kagla 4183ae5a42 Merge branch 'inicis-cancel' 2021-07-19 10:00:04 +09:00
kagla 8468a87f26 잘못 선언된 변수 $reaonly 를 삭제하고, $required_value 변수의 위치를 옮김 (작은별님,210718) 2021-07-19 09:58:31 +09:00
kagla fdbbe2d307 php5.x 버전에서만 stripslashes 가 되지 않는 오류가 있어 php 7.0 미만 버전에서 get_magic_quotes_gpc 가 실행되도록 예전 코드를 되돌림 2021-07-19 09:42:53 +09:00
kagla 9bc012f7f8 모바일결제에서 결제금액 불일치시 결제를 취소해야하는 이니시스 코드 누락되어 추가함. (위토즈님,210714) 2021-07-14 12:34:48 +09:00
kaglaandGitHub 76bbc41043 Merge pull request #79 from projectSylas/ckeditor4
editor 별 익스플로러 alert 안내문 추가
2021-07-06 15:41:32 +09:00
kaglaandGitHub bda235bf01 Merge branch 'dhtml-editor' into ckeditor4 2021-07-06 15:41:07 +09:00
projectSylas 57e41498bc 에디터 별 익스플로러 안내문 추가 2021-07-06 06:26:40 +00:00
kagla a58bc5d2fb 버전 5.4.10 수정 2021-07-01 11:55:00 +09:00
kagla ff9f5ee936 문자열 안에 포함된 변수에 {중괄호} 적용 (해피정님,210625) 2021-07-01 11:52:11 +09:00
kagla 69e37cbec9 그누보드, 영카트 통합으로 인하여 게시판그룹을 커뮤니티(community)로 생성 (NaviGator님,210624) 2021-07-01 11:43:07 +09:00
kagla f631b3dca7 KISA 취약점 권고사항 Stored XSS (210624) 2021-07-01 10:59:16 +09:00
kagla e3a7dfd319 관련상품을 삭제한 뒤에 경고가 노출되어 등록, 수정 없이 관련상품만 삭제될 수 있는 오류 수정 (squared2님,210617) 2021-07-01 10:42:11 +09:00
kagla 94cd7b2979 음수 입력 하지 못하도록 수정 2021-07-01 10:41:53 +09:00
projectSylas 6b293876da cheditor 익스플로러 안내문구 추가 2021-06-29 07:52:11 +00:00
kagla cf3570586a ss_qa_write_token 세션값이 넘어가지 않아 답변등록 되지 않던 오류를 해결하기 위해 추가함 2021-06-28 14:12:43 +09:00
kagla d8df299366 class EditorImage 추가 2021-06-26 08:20:09 +09:00
kagla b3b92d4e1c cheditor4 first commit 2021-06-25 11:26:13 +00:00
EC2 Default User f27e4c3c0c 설치시 환경설정 > 이미지 업로드 확장자에 webp 추가 2021-06-25 05:43:06 +00:00
kagla bd33a31a10 움직이는 webp 이미지 업로드 가능하도록 수정중 2021-06-25 14:03:45 +09:00
kagla 8ac1d25242 이미지 확장자 상수 선언 2021-06-25 14:03:38 +09:00
Ubuntu c82add0eca webp 지원하도록 수정중 2021-06-24 04:31:02 +00:00
kagla 58f5e9b5cd cheditor5 에 webp 이미지 업로드 할 수 있도록 수정. 움직이는 gif, webp 의 이미지가 정지되어 업로드 되고 있음. 원래 그런것 같음. 2021-06-23 09:18:48 +09:00
kagla 74798b93c1 webp 확장자를 추가하여 용량 큰 webp 파일이 업로드 되는 것을 확인함 2021-06-22 16:43:21 +09:00
kagla 178886c87a webp 이미지를 업로드 할 수 있도록 수정 중 2021-06-22 16:07:02 +09:00
36 changed files with 416 additions and 289 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ test.php
log
g5_tree
cheditor5.*/
ckeditor*/
!ckeditor*/
log/
g5_tree/
.vscode/
+1 -1
View File
@@ -83,7 +83,7 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
$dirname = $skin_path.'/'.$skin.'/';
if(!is_dir($dirname))
return;
return array();
$handle = opendir($dirname);
while ($file = readdir($handle)) {
+1 -2
View File
@@ -11,8 +11,6 @@ if (!$row['cnt'])
alert('게시판그룹이 한개 이상 생성되어야 합니다.', './boardgroup_form.php');
$html_title = '게시판';
$reaonly = '';
$required_valid = '';
if (!isset($board['bo_device'])) {
// 게시판 사용 필드 추가
@@ -142,6 +140,7 @@ run_event('adm_board_form_before', $board, $w);
$required = "";
$readonly = "";
$sound_only = "";
$required_valid = "";
if ($w == '') {
$html_title .= ' 생성';
+9
View File
@@ -1530,4 +1530,13 @@ if($config['cf_cert_use']) {
}
}
if (stripos($config['cf_image_extension'], "webp") !== false) {
if (!function_exists("imagewebp")) {
echo '<script>'.PHP_EOL;
echo 'alert("이 서버는 webp 이미지를 지원하고 있지 않습니다.\n이미지 업로드 확장자에서 webp 확장자를 제거해 주십시오.\n제거하지 않으면 이미지와 관련된 오류가 발생할 수 있습니다.");'.PHP_EOL;
echo 'document.getElementById("cf_image_extension").focus();'.PHP_EOL;
echo '</script>'.PHP_EOL;
}
}
include_once ('./admin.tail.php');
+25 -23
View File
@@ -177,31 +177,33 @@ if( !$row ) {
$is_check = true;
}
// 임시저장 테이블이 없을 경우 생성
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
`log_id` int(11) NOT NULL AUTO_INCREMENT,
`oid` bigint(20) unsigned NOT NULL,
`mb_id` varchar(255) NOT NULL DEFAULT '',
`post_data` text NOT NULL,
`ol_code` varchar(255) NOT NULL DEFAULT '',
`ol_msg` text NOT NULL,
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ol_ip` varchar(25) NOT NULL DEFAULT '',
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", true);
if (defined('G5_USE_SHOP') && G5_USE_SHOP) {
// 임시저장 테이블이 없을 경우 생성
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
`log_id` int(11) NOT NULL AUTO_INCREMENT,
`oid` bigint(20) unsigned NOT NULL,
`mb_id` varchar(255) NOT NULL DEFAULT '',
`post_data` text NOT NULL,
`ol_code` varchar(255) NOT NULL DEFAULT '',
`ol_msg` text NOT NULL,
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ol_ip` varchar(25) NOT NULL DEFAULT '',
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", true);
$is_check = true;
}
$result = sql_query("describe `{$g5['g5_shop_post_log_table']}`");
while ($row = sql_fetch_array($result)){
if( $row['Field'] === 'ol_msg' && $row['Type'] === 'varchar(255)' ){
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` MODIFY ol_msg TEXT NOT NULL;", false);
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` DROP PRIMARY KEY;", false);
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` ADD `log_id` int(11) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`log_id`);", false);
$is_check = true;
break;
}
$result = sql_query("describe `{$g5['g5_shop_post_log_table']}`");
while ($row = sql_fetch_array($result)){
if( $row['Field'] === 'ol_msg' && $row['Type'] === 'varchar(255)' ){
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` MODIFY ol_msg TEXT NOT NULL;", false);
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` DROP PRIMARY KEY;", false);
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` ADD `log_id` int(11) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`log_id`);", false);
$is_check = true;
break;
}
}
}
+3 -1
View File
@@ -1843,8 +1843,10 @@ function fitemformcheck(f)
if(f.it_point_type.value == "1" || f.it_point_type.value == "2") {
var point = parseInt(f.it_point.value);
if(point > 99) {
if(point < 0 || point > 99) {
alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
f.it_point.focus();
f.it_point.select();
return false;
}
}
+4 -4
View File
@@ -218,6 +218,10 @@ if ($w == "" || $w == "u")
@set_cookie("ck_origin", stripslashes($it_origin), time() + 86400*31);
}
// 관련상품을 삭제한 뒤에 경고가 노출되어 등록, 수정 없이 관련상품만 삭제될 수 있는 오류 수정 (squared2님,210617)
// 포인트 비율 값 체크
if(($it_point_type == 1 || $it_point_type == 2) && ($it_point < 0 || $it_point > 99))
alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
// 관련상품을 우선 삭제함
sql_query(" delete from {$g5['g5_shop_item_relation_table']} where it_id = '$it_id' ");
@@ -287,10 +291,6 @@ for($i=0; $i<$count_ii_article; $i++) {
}
$it_info_value = addslashes(serialize($value_array));
// 포인트 비율 값 체크
if(($it_point_type == 1 || $it_point_type == 2) && $it_point > 99)
alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
$it_name = isset($_POST['it_name']) ? strip_tags(clean_xss_attributes(trim($_POST['it_name']))) : '';
// KVE-2019-0708
+2 -2
View File
@@ -30,7 +30,7 @@ $qstr_device = '&amp;mode='.$mode.'&amp;device='.(G5_IS_MOBILE ? 'pc' : 'mobile
$sql = " select bo_table, wr_parent from {$g5['board_new_table']} order by bn_id desc limit 1 ";
$row = sql_fetch($sql);
$bo_table = $row['bo_table'];
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '{$bo_table}' ");
$write_table = $g5['write_prefix'] . $bo_table;
// theme.config.php 미리보기 게시판 스킨이 설정돼 있다면
@@ -172,7 +172,7 @@ require_once(G5_PATH.'/head.sub.php');
break;
case 'view':
$wr_id = $row['wr_parent'];
$write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
$write = sql_fetch(" select * from {$write_table} where wr_id = '{$wr_id}' ");
include(G5_BBS_PATH.'/board.php');
break;
case 'shop':
+1 -1
View File
@@ -26,4 +26,4 @@ for ($i=0; $i<count($filter); $i++) {
}
}
die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");
die("{\"subject\":\"{$subj}\",\"content\":\"{$cont}\"}");
+1
View File
@@ -12,6 +12,7 @@ $content = '';
$token = _token();
set_session('ss_qa_delete_token', $token);
set_session('ss_qa_write_token', $token);
$g5['title'] = $qaconfig['qa_title'];
include_once('./qahead.php');
+2 -1
View File
@@ -79,7 +79,8 @@ if(is_file($skin_file)) {
else
$content = "\n\n\n\n====== 이전 답변내용 =======\n";
$content .= get_text($write['qa_content'], 0);
// KISA 취약점 권고사항 Stored XSS (210624)
$content .= get_text(html_purifier($write['qa_content']), 0);
} else {
//$content = get_text($write['qa_content'], 0);
+2 -1
View File
@@ -197,7 +197,8 @@ for ($i=1; $i<=$upload_count; $i++) {
// 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'] > 16)
// webp 파일의 type 이 18 이므로 업로드가 가능하도록 수정
if ($timg['2'] < 1 || $timg['2'] > 18)
continue;
}
//=================================================================
+1 -1
View File
@@ -12,7 +12,7 @@ if(function_exists('clean_relative_paths')){
$extension = pathinfo($filename, PATHINFO_EXTENSION);
if ( ! preg_match('/(jpg|jpeg|png|gif|bmp)$/i', $extension) ){
if ( ! preg_match('/(jpg|jpeg|png|gif|bmp|webp)$/i', $extension) ){
alert_close('이미지 확장자가 아닙니다.');
}
+5
View File
@@ -29,6 +29,11 @@ if ($w == 'u' || $w == 'r') {
} else {
alert("글이 존재하지 않습니다.\\n삭제되었거나 이동된 경우입니다.", G5_URL);
}
} else if ($w == '') { // 게시글 입력시에도 $wr_1 ~ $wr_10 변수 사용시 오류 나오지 않도록 가변변수 생성 (다온테마님,210806)
for ($i=1; $i<=10; $i++) {
$vvar = "wr_".$i;
$$vvar = '';
}
}
run_event('bbs_write', $board, $wr_id, $w);
+1 -1
View File
@@ -532,7 +532,7 @@ if(isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) {
// 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'] > 16)
if ($timg['2'] < 1 || $timg['2'] > 18)
continue;
}
//=================================================================
+9
View File
@@ -101,6 +101,15 @@ function sql_escape_string($str)
//==============================================================================
// SQL Injection 등으로 부터 보호를 위해 sql_escape_string() 적용
//------------------------------------------------------------------------------
// magic_quotes_gpc 에 의한 backslashes 제거
if (7.0 > (float)phpversion()) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$_POST = array_map_deep('stripslashes', $_POST);
$_GET = array_map_deep('stripslashes', $_GET);
$_COOKIE = array_map_deep('stripslashes', $_COOKIE);
$_REQUEST = array_map_deep('stripslashes', $_REQUEST);
}
}
// sql_escape_string 적용
$_POST = array_map_deep(G5_ESCAPE_FUNCTION, $_POST);
+2 -1
View File
@@ -5,9 +5,10 @@
********************/
define('G5_VERSION', '그누보드5');
define('G5_GNUBOARD_VER', '5.4.9');
define('G5_GNUBOARD_VER', '5.4.14');
// 그누보드5.4.5.5 버전과 영카트5.4.5.5.1 버전을 합쳐서 그누보드5.4.6 버전에서 시작함 (kagla-210617)
// G5_YOUNGCART_VER 이 상수를 사용하는 곳이 있으므로 주석 처리 해제함
// 그누보드5.4.6 이상 버전 부터는 영카트를 그누보드에 포함하여 배포하므로 영카트5의 버전은 의미가 없습니다.
define('G5_YOUNGCART_VER', '5.4.5.5.1');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
+13 -3
View File
@@ -141,6 +141,13 @@ $download_point = 0;
//-------------------------------------------------------------------------------------------------
// config 테이블 설정
if($g5_install || !$result) {
// 기본 이미지 확장자를 설정하고
$image_extension = "gif|jpg|jpeg|png";
// 서버에서 webp 를 지원하면 확장자를 추가한다.
if (function_exists("imagewebp")) {
$image_extension .= "|webp";
}
$sql = " insert into `{$table_prefix}config`
set cf_title = '".G5_VERSION."',
cf_theme = 'basic',
@@ -197,7 +204,7 @@ if($g5_install || !$result) {
cf_member_img_width = '60',
cf_member_img_height = '60',
cf_login_minutes = '10',
cf_image_extension = 'gif|jpg|jpeg|png',
cf_image_extension = '{$image_extension}',
cf_flash_extension = 'swf',
cf_movie_extension = 'asx|asf|wmv|wma|mpg|mpeg|mov|avi|mp3',
cf_formmail_is_member = '1',
@@ -241,8 +248,11 @@ if($g5_install || !$result) {
// FAQ Master
sql_query(" insert into `{$table_prefix}faq_master` set fm_id = '1', fm_subject = '자주하시는 질문' ", true, $dblink);
$tmp_gr_id = defined('G5_YOUNGCART_VER') ? 'shop' : 'community';
$tmp_gr_subject = defined('G5_YOUNGCART_VER') ? '쇼핑몰' : '커뮤니티';
// 그누보드, 영카트 통합으로 인하여 게시판그룹을 커뮤니티(community)로 생성 (NaviGator님,210624)
// $tmp_gr_id = defined('G5_YOUNGCART_VER') ? 'shop' : 'community';
// $tmp_gr_subject = defined('G5_YOUNGCART_VER') ? '쇼핑몰' : '커뮤니티';
$tmp_gr_id = 'community';
$tmp_gr_subject = '커뮤니티';
// 게시판 그룹 생성
sql_query(" insert into `{$table_prefix}group` set gr_id = '$tmp_gr_id', gr_subject = '$tmp_gr_subject' ", true, $dblink);
+1 -1
View File
@@ -294,7 +294,7 @@ function get_thumbnail_find_cache($bo_table, $wr_id, $wr_key){
return get_write($write_table, $wr_id, true);
}
return get_board_file_db($bo_table, $wr_id, 'bf_file, bf_content', "and bf_type between '1' and '3'", true);
return get_board_file_db($bo_table, $wr_id, 'bf_file, bf_content', "and bf_type in (1, 2, 3, 18) ", true);
}
function get_write_table_name($bo_table){
+1 -1
View File
@@ -70,7 +70,7 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
}
$list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);
$list[$i]['first_file_thumb'] = (isset($row['wr_file']) && $row['wr_file']) ? get_board_file_db($bo_table, $row['wr_id'], 'bf_file, bf_content', "and bf_type between '1' and '3'", true) : array('bf_file'=>'', 'bf_content'=>'');
$list[$i]['first_file_thumb'] = (isset($row['wr_file']) && $row['wr_file']) ? get_board_file_db($bo_table, $row['wr_id'], 'bf_file, bf_content', "and bf_type in (1, 2, 3, 18) ", true) : array('bf_file'=>'', 'bf_content'=>'');
$list[$i]['bo_table'] = $bo_table;
// 썸네일 추가
if($options && is_string($options)) {
+61 -21
View File
@@ -85,7 +85,7 @@ function get_file_thumbnail($file){
if( ! is_array($file) ) return '';
if( preg_match('/(\.jpg|\.jpeg|\.gif|\.png|\.bmp)$/i', $file['file']) && $contents = run_replace('get_file_thumbnail_tags', '', $file) ){
if( preg_match('/(\.jpg|\.jpeg|\.gif|\.png|\.bmp|\.webp)$/i', $file['file']) && $contents = run_replace('get_file_thumbnail_tags', '', $file) ){
return $contents;
} else if ($file['view']) {
return get_view_thumbnail($file['view']);
@@ -108,6 +108,8 @@ function get_view_thumbnail($contents, $thumb_width=0)
if(empty($matches))
return $contents;
$extensions = array(1=>'gif', 2=>'jpg', 3=>'png', 18=>'webp');
for($i=0; $i<count($matches[1]); $i++) {
$img = $matches[1][$i];
@@ -138,8 +140,11 @@ function get_view_thumbnail($contents, $thumb_width=0)
if(empty($size))
continue;
$file_ext = $extensions[$size[2]];
if (!$file_ext) continue;
// jpg 이면 exif 체크
if($size[2] == 2 && function_exists('exif_read_data')) {
if( $file_ext === 'jpg' && function_exists('exif_read_data')) {
$degree = 0;
$exif = @exif_read_data($srcfile);
if(!empty($exif['Orientation'])) {
@@ -166,7 +171,7 @@ function get_view_thumbnail($contents, $thumb_width=0)
// Animated GIF 체크
$is_animated = false;
if($size[2] == 1) {
if($file_ext === 'gif') {
$is_animated = is_animated_gif($srcfile);
if($replace_content = run_replace('thumbnail_is_animated_gif_content', '', $contents, $srcfile, $is_animated, $img_tag, $data_path, $size)){
@@ -226,9 +231,20 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
if(!is_file($source_file)) // 원본 파일이 없다면
return;
$size = @getimagesize($source_file);
if(!isset($size[2]) || $size[2] < 1 || $size[2] > 3) // gif, jpg, png 에 대해서만 적용
return;
$extensions = array(1 => 'gif', 2 => 'jpg', 3 => 'png', 18 => 'webp');
$file_ext = $extensions[$size[2]]; // 파일 확장자
if (!$file_ext) return;
// gif, jpg, png, webp 에 대해서만 적용
// if ( !(isset($size[2]) && ($size[2] == 1 || $size[2] == 2 || $size[2] == 3 || $size[2] == 18)) )
// return;
// $extensions 배열에 없는 확장자 라면 썸네일 만들지 않음
// if (!in_array($file_ext, $extensions))
// return;
if (!is_dir($target_path)) {
@mkdir($target_path, G5_DIR_PERMISSION);
@@ -240,16 +256,19 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
return '';
// Animated GIF는 썸네일 생성하지 않음
if($size[2] == 1) {
if($file_ext === 'gif') {
if(is_animated_gif($source_file))
return basename($source_file);
} else if ($file_ext === 'webp') {
if(is_animated_webp($source_file))
return basename($source_file);
}
$ext = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
$thumb_filename = preg_replace("/\.[^\.]+$/i", "", $filename); // 확장자제거
$thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.".$ext[$size[2]];
// $thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.".$ext[$size[2]];
$thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.".$file_ext;
$thumb_time = @filemtime($thumb_file);
$source_time = @filemtime($source_file);
@@ -263,10 +282,10 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
$src = null;
$degree = 0;
if ($size[2] == 1) {
if ($file_ext === 'gif') {
$src = @imagecreatefromgif($source_file);
$src_transparency = @imagecolortransparent($src);
} else if ($size[2] == 2) {
} else if ($file_ext === 'jpg') {
$src = @imagecreatefromjpeg($source_file);
if(function_exists('exif_read_data')) {
@@ -298,9 +317,12 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
}
}
}
} else if ($size[2] == 3) {
} else if ($file_ext === 'png') {
$src = @imagecreatefrompng($source_file);
@imagealphablending($src, true);
} else if ($file_ext === 'webp') {
$src = @imagecreatefromwebp($source_file);
@imagealphablending($src, true);
} else {
return;
}
@@ -363,10 +385,10 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
$dst = imagecreatetruecolor($dst_w, $dst_h);
if($size[2] == 3) {
if($file_ext === 'png') {
imagealphablending($dst, false);
imagesavealpha($dst, true);
} else if($size[2] == 1) {
} else if($file_ext === 'gif') {
$palletsize = imagecolorstotal($src);
if($src_transparency >= 0 && $src_transparency < $palletsize) {
$transparent_color = imagecolorsforindex($src, $src_transparency);
@@ -391,12 +413,12 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
}
}
if($size[2] == 3) {
if($file_ext === 'png') {
$bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127);
imagefill($dst, 0, 0, $bgcolor);
imagealphablending($dst, false);
imagesavealpha($dst, true);
} else if($size[2] == 1) {
} else if($file_ext === 'gif') {
$palletsize = imagecolorstotal($src);
if($src_transparency >= 0 && $src_transparency < $palletsize) {
$transparent_color = imagecolorsforindex($src, $src_transparency);
@@ -474,12 +496,12 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
}
}
if($size[2] == 3) {
if($file_ext === 'png') {
$bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127);
imagefill($dst, 0, 0, $bgcolor);
imagealphablending($dst, false);
imagesavealpha($dst, true);
} else if($size[2] == 1) {
} else if($file_ext === 'gif') {
$palletsize = imagecolorstotal($src);
if($src_transparency >= 0 && $src_transparency < $palletsize) {
$transparent_color = imagecolorsforindex($src, $src_transparency);
@@ -502,22 +524,24 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
UnsharpMask($dst, $val[0], $val[1], $val[2]);
}
if($size[2] == 1) {
if($file_ext === 'gif') {
imagegif($dst, $thumb_file);
} else if($size[2] == 3) {
} else if($file_ext === 'png') {
if(!defined('G5_THUMB_PNG_COMPRESS'))
$png_compress = 5;
else
$png_compress = G5_THUMB_PNG_COMPRESS;
imagepng($dst, $thumb_file, $png_compress);
} else {
} else if ($file_ext === 'jpg') {
if(!defined('G5_THUMB_JPG_QUALITY'))
$jpg_quality = 90;
else
$jpg_quality = G5_THUMB_JPG_QUALITY;
imagejpeg($dst, $thumb_file, $jpg_quality);
} else if ($file_ext === 'webp') {
imagewebp($dst, $thumb_file);
}
chmod($thumb_file, G5_FILE_PERMISSION); // 추후 삭제를 위하여 파일모드 변경
@@ -695,6 +719,22 @@ and the roundoff errors in the Gaussian blur process, are welcome.
}
// 움직이는 webp 파일인지 검사한다.
// 출처) https://stackoverflow.com/questions/45190469/how-to-identify-whether-webp-image-is-static-or-animated?answertab=votes#tab-top
function is_animated_webp($filename) {
$contents = file_get_contents($filename);
$where = strpos($contents, "ANMF");
if ($where !== false){
// animated
$is_animated = true;
}
else{
// non animated
$is_animated = false;
}
return $is_animated;
}
function is_animated_gif($filename) {
static $cache = array();
+4 -1
View File
@@ -147,6 +147,9 @@ if((int)$pp['pp_price'] !== (int)$pg_price) {
case 'lg':
include G5_SHOP_PATH.'/lg/xpay_cancel.php';
break;
case 'inicis':
include G5_SHOP_PATH.'/inicis/inipay_cancel.php';
break;
default:
include G5_SHOP_PATH.'/kcp/pp_ax_hub_cancel.php';
break;
@@ -209,7 +212,7 @@ if($pp_receipt_price > 0 && $pp['pp_id'] && $pp['od_id']) {
where od_id = '{$pp['od_id']}' ";
$result = sql_query($sql, false);
// 결제정보 입력 오류시 kcp 결제 취소
// 결제정보 입력 오류시 결제 취소
if(!$result) {
$cancel_msg = '결제정보 입력 오류';
switch($default['de_pg_service']) {
@@ -9,10 +9,11 @@ if( !function_exists('che_reprocessImage') ){
function che_reprocessImage($file_path, $callback){
$MIME_TYPES_PROCESSORS = array(
"image/gif" => array("imagecreatefromgif", "imagegif"),
"image/gif" => array("imagecreatefromgif", "imagegif"),
"image/jpg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/jpeg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/png" => array("imagecreatefrompng", "imagepng"),
"image/png" => array("imagecreatefrompng", "imagepng"),
"image/webp" => array("imagecreatefromwebp", "imagewebp"),
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
);
@@ -84,6 +85,7 @@ switch ($type) {
case "jpeg":
case "gif":
case "png":
case "webp":
$found = true;
}
@@ -14,7 +14,7 @@
<div style="margin: 0px 0px 10px 0px;">
<img src="../icons/imageUpload/remove_all.gif" class="remove-button" onclick="removeImages();"
alt="" style="vertical-align: middle" />
<input type="file" name="imageUpload[]" accept="image/jpeg,image/png,image/gif" id="inputImageUpload" multiple="multiple"
<input type="file" name="imageUpload[]" accept="image/jpeg,image/png,image/gif,image/webp" id="inputImageUpload" multiple="multiple"
onchange="selectedFiles(event)" style="vertical-align: middle; visibility: hidden; width: 0px"/>
<img id="fileSelectButton" src="../icons/imageUpload/add.gif" alt="image button" onclick="inputImageUpload.click()"
style="vertical-align: middle; margin-left: -5px; cursor: pointer"/>
@@ -14,7 +14,7 @@
<div style="margin: 0px 0px 10px 0px;">
<img src="../icons/imageUpload/remove_all.gif" class="remove-button" onclick="removeImages();"
alt="" style="vertical-align: middle" />
<input type="file" name="imageUpload[]" accept="image/jpeg,image/png,image/gif" id="inputImageUpload" multiple="multiple"
<input type="file" name="imageUpload[]" accept="image/jpeg,image/png,image/gif,image/webp" id="inputImageUpload" multiple="multiple"
onchange="selectedFiles(event)" style="vertical-align: middle; visibility: hidden; width: 0px"/>
<img id="fileSelectButton" src="../icons/imageUpload/add.gif" alt="image button" onclick="inputImageUpload.click()"
style="vertical-align: middle; margin-left: -5px; cursor: pointer"/>
@@ -14,7 +14,7 @@ var activeImage = null,
dragDropDiv,
eventDiff_x = 0,
eventDiff_y = 0,
fileTypeRe = /^image\/(png|jpeg|gif)$/i,
fileTypeRe = /^image\/(png|jpeg|gif|webp)$/i,
geckoOffsetX_marker = -3,
geckoOffsetY_marker = -1,
imageCompleted = 0,
@@ -434,7 +434,12 @@ function startUpload(list) {
function fileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"gif, png, jpg 사진 파일만 전송할 수 있습니다.");
"gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
}
function explorerFileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
@@ -962,7 +967,13 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
fileFilterError(file.name);
// 엣지를 제외한 ie브라우저인지 체크
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
explorerFileFilterError(file.name);
} else {
FileFilterError(file.name);
}
continue;
}
this.list.push(file);
@@ -14,7 +14,7 @@ var activeImage = null,
dragDropDiv,
eventDiff_x = 0,
eventDiff_y = 0,
fileTypeRe = /^image\/(png|jpeg|gif)$/i,
fileTypeRe = /^image\/(png|jpeg|gif|webp)$/i,
geckoOffsetX_marker = -3,
geckoOffsetY_marker = -1,
imageCompleted = 0,
@@ -434,7 +434,12 @@ function startUpload(list) {
function fileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"gif, png, jpg 사진 파일만 전송할 수 있습니다.");
"gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
}
function explorerFileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
@@ -962,10 +967,16 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
fileFilterError(file.name);
// 엣지를 제외한 ie브라우저인지 체크
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
explorerFileFilterError(file.name);
} else {
FileFilterError(file.name);
}
continue;
}
this.list.push(file);
this.list.push(file);
}
if (this.list.length < 1) {
+1 -1
View File
@@ -335,7 +335,7 @@ function startUpload(count) {
function fileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"gif, png, jpg, 그림 파일만 전송할 수 있습니다.");
"gif, png, jpg, webp 그림 파일만 전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
@@ -54,7 +54,7 @@ function chkImgFormat (url)
{
var imageName = getFilename(url);
var allowSubmit = false;
var extArray = [".gif", ".jpg", ".jpeg", ".png"];
var extArray = [".gif", ".jpg", ".jpeg", ".png", ".webp"];
extArray.join(" ");
if (imageName === "") {
@@ -72,7 +72,7 @@ function chkImgFormat (url)
}
if (!allowSubmit) {
alert("사진은 GIF, JPG, PNG 형식만 넣을 수 있습니다.");
alert("사진은 GIF, JPG, PNG, WEBP 형식만 넣을 수 있습니다.");
return false;
}
@@ -1,64 +1,67 @@
<!DOCTYPE HTML>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>사진 첨부하기 :: SmartEditor2</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Generic page styles -->
<link rel="stylesheet" href="css/style.css?v=140715">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="css/jquery.fileupload.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<title>사진 첨부하기 :: SmartEditor2</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Generic page styles -->
<link rel="stylesheet" href="css/style.css?v=140715">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="css/jquery.fileupload.css">
</head>
<body>
<div class="container pop_container">
<!-- header -->
<div id="pop_header">
<h1>사진 첨부하기</h1>
</div>
<!-- //header -->
<div class="content_container">
<div class="drag_explain">
<p>마우스로 드래그하여 순서를 바꿀수 있습니다.</p>
<div class="file_selet_group">
<span class="btn btn-success fileinput-button">
<span>파일선택</span>
<!-- The file input field used as target for the file upload widget -->
<input id="fileupload" type="file" name="files[]" multiple accept="image/*">
</span>
<button type="button" class="btn btn-danger delete" id="all_remove_btn">
<span>전체삭제</span>
</button>
<div class="container pop_container">
<!-- header -->
<div id="pop_header">
<h1>사진 첨부하기</h1>
</div>
<!-- //header -->
<div class="content_container">
<div class="drag_explain">
<p>마우스로 드래그하여 순서를 바꿀수 있습니다.</p>
<div class="file_selet_group">
<span class="btn btn-success fileinput-button">
<span>파일선택</span>
<!-- The file input field used as target for the file upload widget -->
<input id="fileupload" type="file" name="files[]" multiple accept="image/*">
</span>
<button type="button" class="btn btn-danger delete" id="all_remove_btn">
<span>전체삭제</span>
</button>
</div>
</div>
<div class="drag_area" id="drag_area">
<ul class="sortable" id="sortable">
</ul>
<em class="blind">마우스로 드래그해서 이미지를 추가해주세요.</em><span id="guide_text" class="bg hidebg"></span>
</div>
<div class="seletion_explain">이미지는 한번에 10개까지 선택할수 있습니다.</div>
<div class="btn_group">
<button type="button" class="btn" id="img_upload_submit">
<span>등록</span>
</button>
<button type="button" class="btn" id="close_w_btn">
<span>취소</span>
</button>
</div>
</div>
<div class="drag_area" id="drag_area">
<ul class="sortable" id="sortable">
</ul>
<em class="blind">마우스로 드래그해서 이미지를 추가해주세요.</em><span id="guide_text" class="bg hidebg"></span>
</div>
<div class="seletion_explain">이미지는 한번에 10개까지 선택할수 있습니다.</div>
<div class="btn_group">
<button type="button" class="btn" id="img_upload_submit">
<span>등록</span>
</button>
<button type="button" class="btn" id="close_w_btn" >
<span>취소</span>
</button>
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="./js/jquery.iframe-transport.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="./js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="./swfupload/swfupload.js"></script>
<script type="text/javascript" src="./swfupload/jquery.swfupload.js"></script>
<script type="text/javascript" src="./swfupload/swfupload.js?v=210625-1329"></script>
<script type="text/javascript" src="./swfupload/jquery.swfupload.js?v=210625-1329"></script>
<!-- The basic File Upload plugin -->
<script src="./js/jquery.fileupload.js?v=140715"></script>
<!-- The basic File Upload plugin -->
<script src="./js/jquery.fileupload.js?v=210625-1329"></script>
<script src="./js/basic.js?v=210625-1329"></script>
</body>
<script src="./js/basic.js?v3"></script>
</body>
</html>
@@ -1,9 +1,9 @@
jQuery.fn.bindAll = function(options) {
var $this = this;
jQuery.each(options, function(key, val){
$this.bind(key, val);
});
return this;
jQuery.fn.bindAll = function (options) {
var $this = this;
jQuery.each(options, function (key, val) {
$this.bind(key, val);
});
return this;
}
jQuery(function ($) {
@@ -11,131 +11,133 @@ jQuery(function ($) {
var ed_nonce = '';
if( !!opener && !!opener.window && !!opener.window.nhn ){
if (!!opener && !!opener.window && !!opener.window.nhn) {
ed_nonce = opener.window.nhn.husky.SE2M_Configuration.SE2M_Accessibility.ed_nonce;
}
// Change this to the location of your server-side upload handler:
var gnu = {
url : './php/?_nonce='+ed_nonce,
container_el : 'body',
dreg_area : '#drag_area',
dreg_area_list : '#drag_area > ul',
progress_bar : '#progress .progress-bar',
filter : /^(image\/bmp|image\/gif|image\/jpg|image\/jpeg|image\/png)$/i,
files : [],
file_limit : 10, //한번에 올릴수 파일갯수 제한
imgw : 100,
imgh : 70,
file_api_support : !!(window.ProgressEvent && window.FileReader),
$elTextGuide : $("#guide_text"),
init : function(){
url: './php/?_nonce=' + ed_nonce,
container_el: 'body',
dreg_area: '#drag_area',
dreg_area_list: '#drag_area > ul',
progress_bar: '#progress .progress-bar',
filter: /^(image\/bmp|image\/gif|image\/jpg|image\/jpeg|image\/png|image\/webp)$/i,
files: [],
file_limit: 10, //한번에 올릴수 파일갯수 제한
imgw: 100,
imgh: 70,
file_api_support: !!(window.ProgressEvent && window.FileReader),
$elTextGuide: $("#guide_text"),
init: function () {
$(this.dreg_area_list).sortable({
'cursor':'pointer',
'placeholder':'placeholder'
'cursor': 'pointer',
'placeholder': 'placeholder'
});
$(this.dreg_area_list).disableSelection();
if( this.file_api_support ) this.$elTextGuide.removeClass("hidebg").addClass("showbg");
if (this.file_api_support) this.$elTextGuide.removeClass("hidebg").addClass("showbg");
},
file_push : function(file){
file_push: function (file) {
var othis = this,
last = othis.files.length;
othis.files.push(file);
},
_readymodebg : function(){
if( this.file_api_support ) {
_readymodebg: function () {
if (this.file_api_support) {
var sClass = this.$elTextGuide.attr('class');
if(sClass.indexOf('hidebg') > 0){
if (sClass.indexOf('hidebg') > 0) {
this.$elTextGuide.removeClass('hidebg');
this.$elTextGuide.addClass('showbg');
}
}
},
_startmodebg : function(){
if( this.file_api_support ) {
_startmodebg: function () {
if (this.file_api_support) {
var sClass = this.$elTextGuide.attr('class');
if(sClass.indexOf('hidebg') < 0){
if (sClass.indexOf('hidebg') < 0) {
this.$elTextGuide.removeClass('showbg');
this.$elTextGuide.addClass('hidebg');
}
}
},
_delete : function(e){
_delete: function (e) {
e.preventDefault();
var othis = gnu,
$button = $(e.currentTarget),
delete_url = $button.attr("data-delete");
if( delete_url ){
if (delete_url) {
$.ajax({
url: othis.url+"&del=1&file="+ delete_url
url: othis.url + "&del=1&file=" + delete_url
}).done(function (result) {
});
}
$button.parents('li.sort_list').fadeOut(300, function(){
$button.parents('li.sort_list').fadeOut(300, function () {
$(this).remove();
var $dreg_area = $(othis.dreg_area_list);
$dreg_area.sortable('refresh');
if( !$dreg_area.children('li').length ) othis._readymodebg();
if (!$dreg_area.children('li').length) othis._readymodebg();
});
},
_add : function(e, data, preload){
_add: function (e, data, preload) {
var othis = this;
othis._startmodebg();
data.context = $('<li/>').addClass("sort_list").appendTo(this.dreg_area_list);
$.each(data.files, function (index, file) {
if ( !preload && !othis.filter.test(file.type)) {
if (!preload && !othis.filter.test(file.type)) {
var agent = navigator.userAgent.toLowerCase();
var msg = '';
msg = (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1)? "익스플로러 환경에서는 gif, png, jpg 파일만 \n전송할 수 있습니다.":"이미지만 허용합니다.";
data.context.remove();
alert('이미지만 허용합니다.');
alert(msg);
return true;
}
var node = $('<div/>')
.append($('<span/>').text(file.name))
.append($('<span/>').addClass("delete_img").attr({"data-delete":file.name,"data-url":file.url}).html("<img src='./img/system_delete.png' alt='삭제' title='삭제' >")),
.append($('<span/>').text(file.name))
.append($('<span/>').addClass("delete_img").attr({ "data-delete": file.name, "data-url": file.url }).html("<img src='./img/system_delete.png' alt='삭제' title='삭제' >")),
$img = "<img src='./img/loading.gif' class='pre_thumb' />",
size_text = '';
if ( preload && preload != 'swfupload' ){
var ret = othis.get_ratio( file.width, file.height ),
size_text = file.width+" x "+file.height;
$img = "<img src='"+file.url+"' width='"+ret['width']+"' height='"+ret['height']+"' class='pre_thumb' />";
}
if (!index) {
node
.prepend('<br>')
.prepend($img);
if(size_text){
node.append('<br>')
if (preload && preload != 'swfupload') {
var ret = othis.get_ratio(file.width, file.height),
size_text = file.width + " x " + file.height;
$img = "<img src='" + file.url + "' width='" + ret['width'] + "' height='" + ret['height'] + "' class='pre_thumb' />";
}
if (!index) {
node.prepend('<br>')
.prepend($img);
if (size_text) {
node.append('<br>')
.append($('<span/>').text(size_text))
}
}
}
node.appendTo(data.context);
node.find(".delete_img").on("click", othis._delete);
});
$(othis.dreg_area_list).sortable('refresh');
},
get_file_all : function(){
get_file_all: function () {
var othis = this,
oDate = new Date();
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
//url: $('#fileupload').fileupload('option', 'url'),
url: this.url+"&t="+ oDate.getTime(),
url: this.url + "&t=" + oDate.getTime(),
dataType: 'json',
context: $('#fileupload')[0]
}).always(function () {
//$(this).removeClass('fileupload-processing');
}).done(function (result) {
$.each(result.files, function (index, data) {
var tmp = { files : [] };
var tmp = { files: [] };
tmp.files[0] = data;
othis._add( $.Event('add'), tmp, 'preload' );
othis._add($.Event('add'), tmp, 'preload');
});
});
},
_processalways : function(e, data){
_processalways: function (e, data) {
var index = data.index,
file = data.files[index],
node = $(data.context.children()[index]);
@@ -150,29 +152,29 @@ jQuery(function ($) {
.prop('disabled', !!data.files.error);
}
},
obj_to_arr : function(obj){
var array = $.map(obj, function(value, index) {
obj_to_arr: function (obj) {
var array = $.map(obj, function (value, index) {
return [value];
});
return array;
},
_done : function(e, data){
_done: function (e, data) {
var othis = this;
$.each(data.result.files, function (index, file) {
if (file.url && !file.error) {
var ret = othis.get_ratio( file.width, file.height ),
var ret = othis.get_ratio(file.width, file.height),
node = $(data.context.children()[index]),
size_text = file.width+" x "+file.height,
size_text = file.width + " x " + file.height,
//$img = "<img src='"+file.url+"' width='"+ret['width']+"' height='"+ret['height']+"' />",
link = $('<a>')
.attr('target', '_blank')
.prop('href', file.url);
node
//.wrap(link)
.append('<br>')
.append($('<span/>').text(size_text))
.find("img.pre_thumb").attr({"src":file.url,"width":ret['width'],"height":ret['height']})
.end().find(".delete_img").attr({"data-delete":file.name,"data-url":file.url});
.attr('target', '_blank')
.prop('href', file.url);
node
//.wrap(link)
.append('<br>')
.append($('<span/>').text(size_text))
.find("img.pre_thumb").attr({ "src": file.url, "width": ret['width'], "height": ret['height'] })
.end().find(".delete_img").attr({ "data-delete": file.name, "data-url": file.url });
} else if (file.error) {
var error = $('<span class="text-danger"/>').text(file.error);
$(data.context.children()[index])
@@ -182,20 +184,20 @@ jQuery(function ($) {
othis.file_push(file);
});
},
get_ratio : function(width, height){
get_ratio: function (width, height) {
var ratio = 0,
ret_img = [];
if( !width || !height ){
if (!width || !height) {
ret_img['width'] = this.imgw;
ret_img['height'] = this.imgh;
return ret_img;
}
if(width > this.imgw){
if (width > this.imgw) {
ratio = this.imgw / width;
height = height * ratio;
width = this.imgw;
}
if( height > this.imgh ){
if (height > this.imgh) {
ratio = this.imgh / height;
width = width * ratio;
height = this.imgh;
@@ -204,7 +206,7 @@ jQuery(function ($) {
ret_img['height'] = parseInt(height);
return ret_img;
},
setPhotoToEditor : function(oFileInfo){
setPhotoToEditor: function (oFileInfo) {
if (!!opener && !!opener.nhn && !!opener.nhn.husky && !!opener.nhn.husky.PopUpManager) {
//스마트 에디터 플러그인을 통해서 넣는 방법 (oFileInfo는 Array)
opener.nhn.husky.PopUpManager.setCallback(window, 'SET_PHOTO', [oFileInfo]);
@@ -221,19 +223,19 @@ jQuery(function ($) {
dropZone: $(gnu.dreg_area),
autoUpload: true,
sequentialUploads: true,
acceptFileTypes: /(\.|\/)(gif|jpe?g|bmp|png)$/i,
acceptFileTypes: /(\.|\/)(gif|jpe?g|bmp|png|webp)$/i,
// Enable image resizing, except for Android and Opera,
// which actually support image resizing, but fail to
// send Blob objects via XHR requests:
disableImageResize: true,
limit_filesLength : gnu.file_limit
limit_filesLength: gnu.file_limit
}).on('fileuploadadd', function (e, data) {
gnu._add(e, data);
}).on('fileuploadprocessalways', function (e, data) {
gnu._processalways(e, data);
}).on('fileuploaddone', function (e, data) {
gnu._done( e, data );
gnu._done(e, data);
}).on('fileuploadfail', function (e, data) {
$.each(data.files, function (index, file) {
@@ -247,85 +249,84 @@ jQuery(function ($) {
gnu.init();
var listeners = {
data : {},
log : false,
swfuploadLoaded: function(event){
if(this.log) $('.log', this).append('<li>Loaded</li>');
},
fileQueued: function(event, file){
if(this.log) $('.log', this).append('<li>File queued - '+file.name+'</li>');
// start the upload once it is queued
// but only if this queue is not disabled
if (!$('input[name=disabled]:checked', this).length) {
$(this).swfupload('startUpload');
}
},
fileQueueError: function(event, file, errorCode, message){
switch (errorCode)
{
case -100 :
alert("파일을 "+message+"개 이하로 선택해주세요.");
var listeners = {
data: {},
log: false,
swfuploadLoaded: function (event) {
if (this.log) $('.log', this).append('<li>Loaded</li>');
},
fileQueued: function (event, file) {
if (this.log) $('.log', this).append('<li>File queued - ' + file.name + '</li>');
// start the upload once it is queued
// but only if this queue is not disabled
if (!$('input[name=disabled]:checked', this).length) {
$(this).swfupload('startUpload');
}
},
fileQueueError: function (event, file, errorCode, message) {
switch (errorCode) {
case -100:
alert("파일을 " + message + "개 이하로 선택해주세요.");
break;
}
if(this.log) $('.log', this).append('<li>File queue error - '+message+'</li>');
},
fileDialogStart: function(event){
if(this.log) $('.log', this).append('<li>File dialog start</li>');
},
fileDialogComplete: function(event, numFilesSelected, numFilesQueued){
if(this.log) $('.log', this).append('<li>File dialog complete</li>');
},
uploadStart: function(event, file){
if (this.log) $('.log', this).append('<li>File queue error - ' + message + '</li>');
},
fileDialogStart: function (event) {
if (this.log) $('.log', this).append('<li>File dialog start</li>');
},
fileDialogComplete: function (event, numFilesSelected, numFilesQueued) {
if (this.log) $('.log', this).append('<li>File dialog complete</li>');
},
uploadStart: function (event, file) {
listeners.data.files = $.makeArray(file);
gnu._add( event, listeners.data, 'swfupload' );
if(this.log) $('.log', this).append('<li>Upload start - '+file.name+'</li>');
},
uploadProgress: function(event, file, bytesLoaded){
if(this.log) $('.log', this).append('<li>Upload progress - '+bytesLoaded+'</li>');
},
uploadSuccess: function(event, file, serverData){
listeners.data.result = jQuery.parseJSON( serverData );
gnu._done( event, listeners.data );
if(this.log) $('.log', this).append('<li>Upload success - '+file.name+'</li>');
gnu._add(event, listeners.data, 'swfupload');
if (this.log) $('.log', this).append('<li>Upload start - ' + file.name + '</li>');
},
uploadProgress: function (event, file, bytesLoaded) {
if (this.log) $('.log', this).append('<li>Upload progress - ' + bytesLoaded + '</li>');
},
uploadSuccess: function (event, file, serverData) {
listeners.data.result = jQuery.parseJSON(serverData);
gnu._done(event, listeners.data);
if (this.log) $('.log', this).append('<li>Upload success - ' + file.name + '</li>');
},
uploadComplete: function(event, file){
if(this.log) $('.log', this).append('<li>Upload complete - '+file.name+'</li>');
// upload has completed, lets try the next one in the queue
// but only if this queue is not disabled
if (!$('input[name=disabled]:checked', this).length) {
$(this).swfupload('startUpload');
}
},
uploadError: function(event, file, errorCode, message){
if(this.log) $('.log', this).append('<li>Upload error - '+message+'</li>');
}
};
},
uploadComplete: function (event, file) {
if (this.log) $('.log', this).append('<li>Upload complete - ' + file.name + '</li>');
// upload has completed, lets try the next one in the queue
// but only if this queue is not disabled
if (!$('input[name=disabled]:checked', this).length) {
$(this).swfupload('startUpload');
}
},
uploadError: function (event, file, errorCode, message) {
if (this.log) $('.log', this).append('<li>Upload error - ' + message + '</li>');
}
};
$(gnu.container_el).bindAll(listeners);
$(gnu.container_el).bindAll(listeners);
/* listeners이벤트 */
$(gnu.dreg_area).bind('drop dragover', function (e) {
e.preventDefault();
if( !gnu.file_api_support && e.type == 'drop' ) alert("브라우저가 드래그 앤 드랍을 지원하지 않습니다.");
if (!gnu.file_api_support && e.type == 'drop') alert("브라우저가 드래그 앤 드랍을 지원하지 않습니다.");
});
$("#all_remove_btn").bind("click", function(e){
$("#all_remove_btn").bind("click", function (e) {
e.preventDefault();
if( $(gnu.dreg_area_list).children().length ){
if (confirm("추가한 이미지가 있습니다.정말 삭제 하시겠습니까?")){
$(gnu.dreg_area_list).find(".delete_img").each( function(i){
if ($(gnu.dreg_area_list).children().length) {
if (confirm("추가한 이미지가 있습니다.정말 삭제 하시겠습니까?")) {
$(gnu.dreg_area_list).find(".delete_img").each(function (i) {
$(this).trigger("click");
});
$(gnu.dreg_area_list).sortable('refresh');
}
}
});
$("#img_upload_submit").bind("click", function(e){
$("#img_upload_submit").bind("click", function (e) {
e.preventDefault();
var aResult = [], j = 0;
$(gnu.dreg_area_list).find(".delete_img").each( function(i, f){
if( !$(this).attr("data-url") ) return true;
var aResult = [], j = 0;
$(gnu.dreg_area_list).find(".delete_img").each(function (i, f) {
if (!$(this).attr("data-url")) return true;
aResult[j] = [];
aResult[j]['bNewLine'] = 'true';
aResult[j]['sAlign'] = '';
@@ -333,13 +334,13 @@ jQuery(function ($) {
aResult[j]['sFileURL'] = $(this).attr("data-url");
j++;
});
if( aResult.length ){
if (aResult.length) {
gnu.setPhotoToEditor(aResult);
aResult = null;
}
window.close();
});
$("#close_w_btn").bind("click", function(e){
$("#close_w_btn").bind("click", function (e) {
e.preventDefault();
window.close();
});
@@ -1283,8 +1283,8 @@
file_size_limit : "10 MB",
file_upload_limit: 0,
file_queue_limit : this.options.limit_filesLength,
file_types : "*.jpeg; *.bmp; *.png; *.jpg; *.gif",
file_types_description : "Image Files (JPG, JPEG, PNG, BMP, GIF)",
file_types : "*.jpeg; *.bmp; *.png; *.jpg; *.gif; *.webp",
file_types_description : "Image Files (JPG, JPEG, PNG, BMP, GIF, WEBP)",
flash_url : "./swfupload/swfupload.swf",
button_placeholder : this.options.fileInput[0],
button_width : "100%",
@@ -26,6 +26,7 @@ class UploadHandler
"image/jpg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/jpeg" => array("imagecreatefromjpeg", "imagejpeg"),
"image/png" => array("imagecreatefrompng", "imagepng"),
"image/webp" => array("imagecreatefromwebp", "imagewebp"),
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
);
@@ -93,10 +94,10 @@ class UploadHandler
// is enabled, set to 0 to disable chunked reading of files:
'readfile_chunk_size' => 10 * 1024 * 1024, // 10 MiB
// Defines which files can be displayed inline when downloaded:
'inline_file_types' => '/\.(gif|jpe?g|bmp|png)$/i',
'inline_file_types' => '/\.(gif|jpe?g|bmp|png|webp)$/i',
// Defines which files (based on their names) are accepted for upload:
//'accept_file_types' => '/.+$/i',
'accept_file_types' => '/\.(gif|jpe?g|bmp|png)$/i',
'accept_file_types' => '/\.(gif|jpe?g|bmp|png|webp)$/i',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
@@ -104,7 +105,7 @@ class UploadHandler
// The maximum number of files for the upload directory:
'max_number_of_files' => null,
// Defines which files are handled as image files:
'image_file_types' => '/\.(gif|jpe?g|bmp|png)$/i',
'image_file_types' => '/\.(gif|jpe?g|bmp|png|webp)$/i',
'is_resize' => (defined('SMARTEDITOR_UPLOAD_RESIZE') && SMARTEDITOR_UPLOAD_RESIZE) ? true : false,
'resize_max_width' => (defined('SMARTEDITOR_UPLOAD_MAX_WIDTH') && SMARTEDITOR_UPLOAD_MAX_WIDTH) ? SMARTEDITOR_UPLOAD_MAX_WIDTH : 800,
'resize_max_height' => (defined('SMARTEDITOR_UPLOAD_MAX_HEIGHT') && SMARTEDITOR_UPLOAD_MAX_HEIGHT) ? SMARTEDITOR_UPLOAD_MAX_HEIGHT : 800,
@@ -498,7 +499,7 @@ class UploadHandler
}
// Add missing file extension for known image types:
if (strpos($name, '.') === false &&
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)) {
$name .= '.'.$matches[1];
}
if (function_exists('exif_imagetype') && $file_path) {
@@ -512,6 +513,9 @@ class UploadHandler
case IMAGETYPE_GIF:
$extensions = array('gif');
break;
case IMAGETYPE_WEBP:
$extensions = array('webp');
break;
}
// Adjust incorrect image file extensions:
if (!empty($extensions)) {
@@ -688,7 +692,7 @@ class UploadHandler
$src_func = 'imagecreatefromjpeg';
$write_func = 'imagejpeg';
$image_quality = isset($options['jpeg_quality']) ?
$options['jpeg_quality'] : 75;
$options['jpeg_quality'] : 75;
break;
case 'gif':
$src_func = 'imagecreatefromgif';
@@ -699,7 +703,12 @@ class UploadHandler
$src_func = 'imagecreatefrompng';
$write_func = 'imagepng';
$image_quality = isset($options['png_quality']) ?
$options['png_quality'] : 9;
$options['png_quality'] : 9;
break;
case 'webp':
$src_func = 'imagecreatefromwebp';
$write_func = 'imagewebp';
$image_quality = null;
break;
default:
return false;
@@ -1083,11 +1092,16 @@ class UploadHandler
//throw new Exception("Invalid image MIME type");
return false;
}
$image_from_file = self::$MIME_TYPES_PROCESSORS[$mime_type][0];
$image_to_file = self::$MIME_TYPES_PROCESSORS[$mime_type][1];
// webp 의 경우 gd-webp cannot allocate temporary buffer 오류가 발생하여 webp 이미지가 업로드 되지 않을 수 있음
// $reprocessed_image = imagecreatefromwebp($file_path); 이 코드로 웹서버의 error_log 에서 확인해 볼 수 있음
// https://stackoverflow.com/questions/61394477/php-e-error-gd-webp-cannot-allocate-temporary-buffer
// 움직이는 webp 이미지나 큰사이즈의 webp 이미지에 대한 해결 방안은 아직 없는 것 같다
$reprocessed_image = @$image_from_file($file_path);
// error_log("\$image_from_file = '$image_from_file', \$image_to_file = '$image_to_file', \$reprocessed_image = '$reprocessed_image', \$file_path ='$file_path' ");
if (!$reprocessed_image) {
//throw new Exception("Unable to create reprocessed image from file");
@@ -1288,6 +1302,8 @@ class UploadHandler
return 'image/png';
case 'gif':
return 'image/gif';
case 'webp':
return 'image/webp';
default:
return '';
}
@@ -287,7 +287,7 @@ function preview(thumb) {
var thumb = file.bf_file;
}
var pattern = /\.(jpg|png|gif)$/i;
var pattern = /\.(jpg|png|gif|webp)$/i;
if (pattern.test(thumb)) {
var thumb_kind = "img";
} else {
@@ -321,7 +321,7 @@ function file_to_editor() {
var file = get_file_info(files_list.options[i].value);
var path = board_file_path + '/' + file.bf_file;
var pattern = /\.(jpg|png|gif)$/i;
var pattern = /\.(jpg|png|gif|webp)$/i;
if (pattern.test(file.bf_file)) {
if (wr_id) {
html = "{이미지:" + file.bf_no + "}";
+2 -2
View File
@@ -131,10 +131,10 @@ class Hybrid_Providers_Naver extends Hybrid_Provider_Model_OAuth2
if( array_key_exists('birthday',$data) ){
$tmp = explode("-",$data['birthday']);
if( isset($tmp[0]) ){
$this->user->profile->birthDay = $tmp[0];
$this->user->profile->birthMonth = $tmp[0];
}
if( isset($tmp[1]) ){
$this->user->profile->birthMonth = $tmp[1];
$this->user->profile->birthDay = $tmp[1];
}
}
$this->user->profile->email = (array_key_exists('email',$data))?$data['email']:"";
+1 -1
View File
@@ -23,7 +23,7 @@ if( isset( $_REQUEST["redirect_to_idp"] ) ){
$get_login_url = G5_BBS_URL."/login.php?url=".$urlencode;
if( $content ){
//팝업으로 뜨웠다면 아래
//팝업으로 띄웠다면 아래 코드를 실행
?>
<script>
if( window.opener ){