Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-03-18 14:53:52 +09:00
12 changed files with 100 additions and 41 deletions

View File

@ -68,6 +68,7 @@ $sql = " insert into {$g4['board_table']}
bo_hot = '{$board[bo_hot]}', bo_hot = '{$board[bo_hot]}',
bo_image_width = '{$board[bo_image_width]}', bo_image_width = '{$board[bo_image_width]}',
bo_skin = '{$board['bo_skin']}', bo_skin = '{$board['bo_skin']}',
bo_mobile_skin = '{$board['bo_mobile']}',
bo_include_head = '{$board['bo_include_head']}', bo_include_head = '{$board['bo_include_head']}',
bo_include_tail = '{$board['bo_include_tail']}', bo_include_tail = '{$board['bo_include_tail']}',
bo_content_head = '".addslashes($board['bo_content_head'])."', bo_content_head = '".addslashes($board['bo_content_head'])."',

View File

@ -160,10 +160,10 @@ $pg_anchor = "<ul class=\"anchor\">
</select> </select>
</td> </td>
<td class="group_setting"> <td class="group_setting">
<input type="checkbox" name="chk_grp_use" value="1" id="chk_grp_use"> <input type="checkbox" name="chk_grp_device" value="1" id="chk_grp_device">
<label for="chk_grp_use">그룹적용</label> <label for="chk_grp_device">그룹적용</label>
<input type="checkbox" name="chk_all_use" value="1" id="chk_all_use"> <input type="checkbox" name="chk_all_device" value="1" id="chk_all_device">
<label for="chk_all_use">전체적용</label> <label for="chk_all_device">전체적용</label>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -53,7 +53,7 @@ $bo_category_list = str_replace($src_char, $dst_char, $bo_category_list);
$sql_common = " gr_id = '{$_POST['gr_id']}', $sql_common = " gr_id = '{$_POST['gr_id']}',
bo_subject = '{$_POST['bo_subject']}', bo_subject = '{$_POST['bo_subject']}',
bo_device = '{$_POST['bo_device']}', bo_device = '{$_POST['bo_device']}',
bo_admin = '{$_POST['bo_admin']}', bo_admin = '{$_POST['bo_admin']}',
bo_list_level = '{$_POST['bo_list_level']}', bo_list_level = '{$_POST['bo_list_level']}',
bo_read_level = '{$_POST['bo_read_level']}', bo_read_level = '{$_POST['bo_read_level']}',
@ -109,6 +109,7 @@ $sql_common = " gr_id = '{$_POST['gr_id']}',
bo_reply_order = '{$_POST['bo_reply_order']}', bo_reply_order = '{$_POST['bo_reply_order']}',
bo_use_search = '{$_POST['bo_use_search']}', bo_use_search = '{$_POST['bo_use_search']}',
bo_order = '{$_POST['bo_order']}', bo_order = '{$_POST['bo_order']}',
bo_show_menu = '{$_POST['bo_show_menu']}',
bo_write_min = '{$_POST['bo_write_min']}', bo_write_min = '{$_POST['bo_write_min']}',
bo_write_max = '{$_POST['bo_write_max']}', bo_write_max = '{$_POST['bo_write_max']}',
bo_comment_min = '{$_POST['bo_comment_min']}', bo_comment_min = '{$_POST['bo_comment_min']}',
@ -222,7 +223,7 @@ if ($w == '') {
// 같은 그룹내 게시판 동일 옵션 적용 // 같은 그룹내 게시판 동일 옵션 적용
$grp_fields = ''; $grp_fields = '';
if (is_checked('chk_grp_use')) $grp_fields .= " , bo_use = '{$bo_use}' "; if (is_checked('chk_grp_device')) $grp_fields .= " , bo_device = '{$bo_device}' ";
if (is_checked('chk_grp_admin')) $grp_fields .= " , bo_admin = '{$bo_admin}' "; if (is_checked('chk_grp_admin')) $grp_fields .= " , bo_admin = '{$bo_admin}' ";
if (is_checked('chk_grp_list_level')) $grp_fields .= " , bo_list_level = '{$bo_list_level}' "; if (is_checked('chk_grp_list_level')) $grp_fields .= " , bo_list_level = '{$bo_list_level}' ";
if (is_checked('chk_grp_read_level')) $grp_fields .= " , bo_read_level = '{$bo_read_level}' "; if (is_checked('chk_grp_read_level')) $grp_fields .= " , bo_read_level = '{$bo_read_level}' ";
@ -285,6 +286,7 @@ if (is_checked('chk_grp_content_tail')) $grp_fields .= " , bo_content_ta
if (is_checked('chk_grp_insert_content')) $grp_fields .= " , bo_insert_content = '{$bo_insert_content}' "; if (is_checked('chk_grp_insert_content')) $grp_fields .= " , bo_insert_content = '{$bo_insert_content}' ";
if (is_checked('chk_grp_use_search')) $grp_fields .= " , bo_use_search = '{$bo_use_search}' "; if (is_checked('chk_grp_use_search')) $grp_fields .= " , bo_use_search = '{$bo_use_search}' ";
if (is_checked('chk_grp_order')) $grp_fields .= " , bo_order = '{$bo_order}' "; if (is_checked('chk_grp_order')) $grp_fields .= " , bo_order = '{$bo_order}' ";
if (is_checked('chk_grp_show_menu')) $grp_fields .= " , bo_show_menu = '{$bo_show_menu}' ";
for ($i=1; $i<=10; $i++) { for ($i=1; $i<=10; $i++) {
if (is_checked('chk_grp_'.$i)) { if (is_checked('chk_grp_'.$i)) {
$grp_fields .= " , bo_{$i}_subj = '".$_POST['bo_'.$i.'_subj']."' "; $grp_fields .= " , bo_{$i}_subj = '".$_POST['bo_'.$i.'_subj']."' ";
@ -299,7 +301,7 @@ if ($grp_fields) {
// 모든 게시판 동일 옵션 적용 // 모든 게시판 동일 옵션 적용
$all_fields = ''; $all_fields = '';
if (is_checked('chk_all_use')) $all_fields .= " , bo_use = '{$bo_use}' "; if (is_checked('chk_all_device')) $all_fields .= " , bo_device = '{$bo_device}' ";
if (is_checked('chk_all_admin')) $all_fields .= " , bo_admin = '{$bo_admin}' "; if (is_checked('chk_all_admin')) $all_fields .= " , bo_admin = '{$bo_admin}' ";
if (is_checked('chk_all_list_level')) $all_fields .= " , bo_list_level = '{$bo_list_level}' "; if (is_checked('chk_all_list_level')) $all_fields .= " , bo_list_level = '{$bo_list_level}' ";
if (is_checked('chk_all_read_level')) $all_fields .= " , bo_read_level = '{$bo_read_level}' "; if (is_checked('chk_all_read_level')) $all_fields .= " , bo_read_level = '{$bo_read_level}' ";
@ -362,6 +364,7 @@ if (is_checked('chk_all_content_tail')) $all_fields .= " , bo_content_ta
if (is_checked('chk_all_insert_content')) $all_fields .= " , bo_insert_content = '{$bo_insert_content}' "; if (is_checked('chk_all_insert_content')) $all_fields .= " , bo_insert_content = '{$bo_insert_content}' ";
if (is_checked('chk_all_use_search')) $all_fields .= " , bo_use_search = '{$bo_use_search}' "; if (is_checked('chk_all_use_search')) $all_fields .= " , bo_use_search = '{$bo_use_search}' ";
if (is_checked('chk_all_order')) $all_fields .= " , bo_order = '{$bo_order}' "; if (is_checked('chk_all_order')) $all_fields .= " , bo_order = '{$bo_order}' ";
if (is_checked('chk_all_show_menu')) $all_fields .= " , bo_show_menu = '{$bo_show_menu}' ";
for ($i=1; $i<=10; $i++) { for ($i=1; $i<=10; $i++) {
if (is_checked('chk_all_'.$i)) { if (is_checked('chk_all_'.$i)) {
$all_fields .= " , bo_{$i}_subj = '".$_POST['bo_'.$i.'_subj']."' "; $all_fields .= " , bo_{$i}_subj = '".$_POST['bo_'.$i.'_subj']."' ";

View File

@ -8,7 +8,7 @@ function editor_html($id, $content, $ckeditor=true, $class="")
$html = ""; $html = "";
$html .= "<span class=\"sound_only\">웹에디터 시작</span>"; $html .= "<span class=\"sound_only\">웹에디터 시작</span>";
$html .= "<div class=\"cke_sc\"><button type=\"button\" class=\"btn_cke_sc\">단축키 일람</button></div>"; $html .= '<script>document.write("<div class=\'cke_sc\'><button type=\'button\' class=\'btn_cke_sc\'>단축키 일람</button></div>");</script>';
if ($js) { if ($js) {
$html .= "\n".'<script src="'.G4_CKEDITOR_URL.'/ckeditor.js"></script>'; $html .= "\n".'<script src="'.G4_CKEDITOR_URL.'/ckeditor.js"></script>';

View File

@ -14,13 +14,18 @@ $CKEditor = $_GET['CKEditor'] ;
$langCode = $_GET['langCode'] ; $langCode = $_GET['langCode'] ;
if(isset($_FILES['upload']['tmp_name'])) { if(isset($_FILES['upload']['tmp_name'])) {
$file_name = $_FILES['upload']['name']; $file = $_FILES['upload']['name'];
$ext = substr($file_name, (strrpos($file_name, '.') + 1)); $pos = strrpos($file, '.');
if (!preg_match("/\.(jpe?g|gif|png)$/i", $file_name)) { $filename = substr($file, 0, $pos);
echo '이미지만 가능'; $extension = substr($file, $pos, strlen($file) - $pos);
if (!preg_match("/\.(jpe?g|gif|png)$/i", $extension)) {
echo '이미지 파일만 가능합니다.';
return false; return false;
} }
// 윈도우에서 한글파일명으로 업로드 되지 않는 오류 해결
$file_name = sprintf('%u', ip2long($_SERVER['REMOTE_ADDR'])).'_'.get_microtime().$extension;
$save_dir = sprintf('%s/%s', $data_dir, $file_name); $save_dir = sprintf('%s/%s', $data_dir, $file_name);
$save_url = sprintf('%s/%s', $data_url, $file_name); $save_url = sprintf('%s/%s', $data_url, $file_name);

View File

@ -15,7 +15,7 @@ $mb = get_member($mb_id);
// 회원아이디를 입력해 보고 맞으면 또 패스워드를 입력해보는 경우를 방지하기 위해서입니다. // 회원아이디를 입력해 보고 맞으면 또 패스워드를 입력해보는 경우를 방지하기 위해서입니다.
// 불법사용자의 경우 회원아이디가 틀린지, 패스워드가 틀린지를 알기까지는 많은 시간이 소요되기 때문입니다. // 불법사용자의 경우 회원아이디가 틀린지, 패스워드가 틀린지를 알기까지는 많은 시간이 소요되기 때문입니다.
if (!$mb['mb_id'] || (sql_password($mb_password) != $mb['mb_password'])) { if (!$mb['mb_id'] || (sql_password($mb_password) != $mb['mb_password'])) {
alert('가입된 회원아이디가 아니거나 패스워드가 틀립니다.\n패스워드는 대소문자를 구분합니다.'); alert('가입된 회원아이디가 아니거나 패스워드가 틀립니다.\\n패스워드는 대소문자를 구분합니다.');
} }
// 차단된 아이디인가? // 차단된 아이디인가?
@ -31,7 +31,7 @@ if ($mb['mb_leave_date'] && $mb['mb_leave_date'] <= date("Ymd", G4_SERVER_TIME))
} }
if ($config['cf_use_email_certify'] && !preg_match("/[1-9]/", $mb['mb_email_certify'])) if ($config['cf_use_email_certify'] && !preg_match("/[1-9]/", $mb['mb_email_certify']))
alert('메일인증을 받으셔야 로그인 하실 수 있습니다.\n회원님의 메일주소는 '.$mb['mb_email'].' 입니다.'); alert('메일인증을 받으셔야 로그인 하실 수 있습니다.\\n회원님의 메일주소는 '.$mb['mb_email'].' 입니다.');
@include_once($member_skin_path.'/login_check.skin.php'); @include_once($member_skin_path.'/login_check.skin.php');

View File

@ -71,7 +71,8 @@ function g4_path()
{ {
$path = dirname(__FILE__); // 예) /home/sir/www/g4s $path = dirname(__FILE__); // 예) /home/sir/www/g4s
$linux_dir = str_replace("\\", "/", $path); // 예) /home/sir/www/g4s $linux_dir = str_replace("\\", "/", $path); // 예) /home/sir/www/g4s
$document_root = str_replace("\\", "/", $_SERVER['DOCUMENT_ROOT']); // 예) /home/sir/www //$document_root = str_replace("\\", "/", $_SERVER['DOCUMENT_ROOT']); // 예) /home/sir/www
$document_root = str_replace("\\", "/", realpath($_SERVER['DOCUMENT_ROOT']));
$base_dir = preg_replace('#^'.$document_root.'#i', '', $linux_dir); // 예) /g4s $base_dir = preg_replace('#^'.$document_root.'#i', '', $linux_dir); // 예) /g4s
$port = $_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : ''; $port = $_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : '';
$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://'; $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';

View File

@ -139,7 +139,7 @@ if ($config['cf_include_head']) {
<a href="<?=G4_BBS_URL?>/group.php?gr_id=<?=$row['gr_id']?>"><?=$row['gr_subject']?></a> <a href="<?=G4_BBS_URL?>/group.php?gr_id=<?=$row['gr_id']?>"><?=$row['gr_subject']?></a>
<ul class="gnb_sub_ul"> <ul class="gnb_sub_ul">
<? <?
$sql2 = " select * from {$g4['board_table']} where gr_id = '{$row['gr_id']}' order by bo_order "; $sql2 = " select * from {$g4['board_table']} where gr_id = '{$row['gr_id']}' and bo_show_menu = '1' order by bo_order ";
$result2 = sql_query($sql2); $result2 = sql_query($sql2);
for ($bi=0; $row2=sql_fetch_array($result2); $bi++) { // bi 는 board index for ($bi=0; $row2=sql_fetch_array($result2); $bi++) { // bi 는 board index
?> ?>

View File

@ -11,8 +11,10 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file='', $cc=
// 메일발송 사용을 하지 않는다면 // 메일발송 사용을 하지 않는다면
if (!$config['cf_email_use']) return; if (!$config['cf_email_use']) return;
$fname = "=?$g4[charset]?B?" . base64_encode($fname) . "?="; //$fname = "=?$g4[charset]?B?" . base64_encode($fname) . "?=";
$subject = "=?$g4[charset]?B?" . base64_encode($subject) . "?="; //$subject = "=?$g4[charset]?B?" . base64_encode($subject) . "?=";
$fname = "=?utf-8?B?" . base64_encode($fname) . "?=";
$subject = "=?utf-8?B?" . base64_encode($subject) . "?=";
//$g4[charset] = ($g4[charset] != "") ? "charset=$g4[charset]" : ""; //$g4[charset] = ($g4[charset] != "") ? "charset=$g4[charset]" : "";
$header = "Return-Path: <$fmail>\n"; $header = "Return-Path: <$fmail>\n";
@ -31,11 +33,11 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file='', $cc=
} }
if ($type) { if ($type) {
$header .= "Content-Type: TEXT/HTML; charset=$g4[charset]\n"; $header .= "Content-Type: TEXT/HTML; charset=utf-8\n";
if ($type == 2) if ($type == 2)
$content = nl2br($content); $content = nl2br($content);
} else { } else {
$header .= "Content-Type: TEXT/PLAIN; charset=$g4[charset]\n"; $header .= "Content-Type: TEXT/PLAIN; charset=utf-8\n";
$content = stripslashes($content); $content = stripslashes($content);
} }
$header .= "Content-Transfer-Encoding: BASE64\n\n"; $header .= "Content-Transfer-Encoding: BASE64\n\n";

View File

@ -9,9 +9,62 @@ function it_img_thumb($filename, $filepath, $thumb_width, $thumb_height, $is_cre
} }
// 게시글리스트 썸네일 생성 // 게시글리스트 썸네일 생성
function get_list_thumbnail($filename, $filepath, $thumb_width, $thumb_height, $is_create=false, $is_crop=true) function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create=false, $is_crop=true)
{ {
return thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop); global $g4, $config;
$filename = $alt = "";
$edt = false;
$sql = " select bf_file, bf_content from {$g4['board_file_table']}
where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_type between '1' and '3' order by bf_no limit 0, 1 ";
$row = sql_fetch($sql);
if($row['bf_file']) {
$filename = $row['bf_file'];
$filepath = G4_DATA_PATH.'/file/'.$bo_table;
$src_url = G4_DATA_URL.'/file/'.$bo_table;
$alt = get_text($row['bf_content']);
} else {
$write_table = $g4['write_prefix'].$bo_table;
$sql = " select wr_content from $write_table where wr_id = '$wr_id' ";
$write = sql_fetch($sql);
$matchs = get_editor_image($write['wr_content']);
$edt = true;
for($i=0; $i<count($matchs[1]); $i++)
{
// 이미지 path 구함
$imgurl = parse_url($matchs[1][$i]);
$srcfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
$src_url = $matchs[1][$i];
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$filename = basename($srcfile);
$filepath = dirname($srcfile);
break;
}
}
}
if(!$filename)
return false;
$tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop);
if($tname) {
if($edt) {
$src = str_replace($filename, $tname, $src_url);
} else {
$src = $src_url.'/'.$tname;
}
} else {
return false;
}
$thumb = array("src"=>$src, "alt"=>$alt);
return $thumb;
} }
// 게시글보기 썸네일 생성 // 게시글보기 썸네일 생성

View File

@ -87,15 +87,12 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<strong style="width:<?=$board['bo_mobile_gallery_width']?>px;height:<?=$board['bo_mobile_gallery_height']?>px">공지</strong> <strong style="width:<?=$board['bo_mobile_gallery_width']?>px;height:<?=$board['bo_mobile_gallery_height']?>px">공지</strong>
<? <?
} else { } else {
$file = get_list_file($bo_table, $list[$i]['wr_id']); $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
$filepath = G4_DATA_PATH.'/file/'.$bo_table; if($thumb['src']) {
if(preg_match("/\.({$config['cf_image_extension']})$/i", $file['bf_file']) && is_file($filepath.'/'.$file['bf_file'])) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
$thumb = get_list_thumbnail($file['bf_file'], $filepath, $board['bo_mobile_gallery_width'], $board['bo_mobile_gallery_height']);
$imgsrc = G4_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
$img_content = '<img src="'.$imgsrc.'" alt="'.$file['bf_content'].'" width="'.$board['bo_mobile_gallery_width'].'" height="'.$board['bo_mobile_gallery_height'].'">';
} else { } else {
$img_content = '<span style="width:'.$board['bo_mobile_gallery_width'].'px;height:'.$board['bo_mobile_gallery_height'].'px">no image</span>'; $img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
} }
echo $img_content; echo $img_content;

View File

@ -72,13 +72,10 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<strong style="width:<?=$board['bo_gallery_width']?>px;height:<?=$board['bo_gallery_height']?>px">공지</strong> <strong style="width:<?=$board['bo_gallery_width']?>px;height:<?=$board['bo_gallery_height']?>px">공지</strong>
<? <?
} else { } else {
$file = get_list_file($bo_table, $list[$i]['wr_id']); $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
$filepath = G4_DATA_PATH.'/file/'.$bo_table; if($thumb['src']) {
if(preg_match("/\.({$config['cf_image_extension']})$/i", $file['bf_file']) && is_file($filepath.'/'.$file['bf_file'])) { $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
$thumb = get_list_thumbnail($file['bf_file'], $filepath, $board['bo_gallery_width'], $board['bo_gallery_height']);
$imgsrc = G4_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
$img_content = '<img src="'.$imgsrc.'" alt="'.$file['bf_content'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
} else { } else {
$img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>'; $img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
} }