5.3 버전 내용 적용

This commit is contained in:
thisgun
2018-03-30 17:40:37 +09:00
parent 87fdbc7882
commit f7ac06d7d4
733 changed files with 36660 additions and 11623 deletions

View File

@ -394,15 +394,15 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
$reply = $list['wr_reply'];
$list['reply'] = strlen($reply)*10;
$list['reply'] = strlen($reply)*20;
$list['icon_reply'] = '';
if ($list['reply'])
$list['icon_reply'] = '<img src="'.$skin_url.'/img/icon_reply.gif" style="margin-left:'.$list['reply'].'px;" alt="답변글">';
$list['icon_reply'] = '<img src="'.$skin_url.'/img/icon_reply.gif" class="icon_reply" alt="답변글">';
$list['icon_link'] = '';
if ($list['wr_link1'] || $list['wr_link2'])
$list['icon_link'] = '<img src="'.$skin_url.'/img/icon_link.gif" alt="관련링크">';
$list['icon_link'] = '<i class="fa fa-link" aria-hidden="true"></i> ';
// 분류명 링크
$list['ca_name_href'] = G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'&amp;sca='.urlencode($list['ca_name']);
@ -412,15 +412,15 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
$list['icon_new'] = '';
if ($board['bo_new'] && $list['wr_datetime'] >= date("Y-m-d H:i:s", G5_SERVER_TIME - ($board['bo_new'] * 3600)))
$list['icon_new'] = '<img src="'.$skin_url.'/img/icon_new.gif" alt="새글">';
$list['icon_new'] = '<img src="'.$skin_url.'/img/icon_new.gif" alt="새글"> ';
$list['icon_hot'] = '';
if ($board['bo_hot'] && $list['wr_hit'] >= $board['bo_hot'])
$list['icon_hot'] = '<img src="'.$skin_url.'/img/icon_hot.gif" alt="인기글">';
$list['icon_hot'] = '<i class="fa fa-heart" aria-hidden="true"></i> ';
$list['icon_secret'] = '';
if (strstr($list['wr_option'], 'secret'))
$list['icon_secret'] = '<img src="'.$skin_url.'/img/icon_secret.gif" alt="비밀글">';
$list['icon_secret'] = '<i class="fa fa-lock" aria-hidden="true"></i> ';
// 링크
for ($i=1; $i<=G5_LINK_COUNT; $i++) {
@ -437,7 +437,7 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
}
if ($list['file']['count'])
$list['icon_file'] = '<img src="'.$skin_url.'/img/icon_file.gif" alt="첨부파일">';
$list['icon_file'] = '<i class="fa fa-download" aria-hidden="true"></i> ';
return $list;
}
@ -1234,12 +1234,18 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$icon_file_url = G5_DATA_URL.'/member/'.$mb_dir.'/'.$mb_id.'.gif';
$tmp_name .= '<img src="'.$icon_file_url.'" width="'.$width.'" height="'.$height.'" alt="">';
$tmp_name .= '<span class="profile_img"><img src="'.$icon_file_url.'" width="'.$width.'" height="'.$height.'" alt=""></span>';
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name.' '.$name;
} else {
$tmp_name = $tmp_name." ".$name;
if( defined('G5_THEME_NO_PROFILE_IMG') ){
$tmp_name .= G5_THEME_NO_PROFILE_IMG;
} else if( defined('G5_NO_PROFILE_IMG') ){
$tmp_name .= G5_NO_PROFILE_IMG;
}
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name.' '.$name;
}
} else {
$tmp_name = $tmp_name.' '.$name;
@ -2925,6 +2931,11 @@ function member_delete($mb_id)
// 게시판관리자인 경우 게시판관리자를 공백으로
sql_query(" update {$g5['board_table']} set bo_admin = '' where bo_admin = '$mb_id' ");
//소셜로그인에서 삭제 또는 해제
if(function_exists('social_member_link_delete')){
social_member_link_delete($mb_id);
}
// 아이콘 삭제
@unlink(G5_DATA_PATH.'/member/'.substr($mb_id,0,2).'/'.$mb_id.'.gif');
}
@ -3321,6 +3332,77 @@ function check_write_token($bo_table)
return true;
}
function get_member_profile_img($mb_id='', $width='', $height='', $alt='profile_image', $title=''){
global $member;
static $no_profile_cache = '';
static $member_cache = array();
$src = '';
if( $mb_id ){
if( isset($member_cache[$mb_id]) ){
$src = $member_cache[$mb_id];
} else {
$member_img = G5_DATA_PATH.'/member_image/'.substr($mb_id,0,2).'/'.$mb_id.'.gif';
if (is_file($member_img)) {
$member_cache[$mb_id] = $src = str_replace(G5_DATA_PATH, G5_DATA_URL, $member_img);
}
}
}
if( !$src ){
if( !empty($no_profile_cache) ){
$src = $no_profile_cache;
} else {
// 프로필 이미지가 없을때 기본 이미지
$no_profile_img = (defined('G5_THEME_NO_PROFILE_IMG') && G5_THEME_NO_PROFILE_IMG) ? G5_THEME_NO_PROFILE_IMG : G5_NO_PROFILE_IMG;
$tmp = array();
preg_match( '/src="([^"]*)"/i', $foo, $tmp );
$no_profile_cache = $src = isset($tmp[1]) ? $tmp[1] : G5_IMG_URL.'/no_profile.gif';
}
}
if( $src ){
$attributes = array('src'=>$src, 'width'=>$width, 'height'=>$height, 'alt'=>$alt, 'title'=>$title);
$output = '<img';
foreach ($attributes as $name => $value) {
if (!empty($value)) {
$output .= sprintf(' %s="%s"', $name, $value);
}
}
$output .= '>';
return $output;
}
return '';
}
function get_head_title($title){
global $g5;
if( isset($g5['board_title']) && $g5['board_title'] ){
$title = $g5['board_title'];
}
return $title;
}
function is_use_email_certify(){
global $config;
if( $config['cf_use_email_certify'] && function_exists('social_is_login_check') ){
if( $config['cf_social_login_use'] && (get_session('ss_social_provider') || social_is_login_check()) ){ //소셜 로그인을 사용한다면
$tmp = (defined('G5_SOCIAL_CERTIFY_MAIL') && G5_SOCIAL_CERTIFY_MAIL) ? 1 : 0;
return $tmp;
}
}
return $config['cf_use_email_certify'];
}
function get_call_func_cache($func, $args=array()){
static $cache = array();
@ -3402,4 +3484,18 @@ function is_include_path_check($path='', $is_input='')
return true;
}
function option_array_checked($option, $arr=array()){
$checked = '';
if( !is_array($arr) ){
$arr = explode(',', $arr);
}
if ( !empty($arr) && in_array($option, (array) $arr) ){
$checked = 'checked="checked"';
}
return $checked;
}
?>

View File

@ -32,7 +32,7 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
$cache_fwrite = false;
if(G5_USE_CACHE) {
$cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php";
$cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-serial.php";
if(!file_exists($cache_file)) {
$cache_fwrite = true;
@ -44,9 +44,20 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
$cache_fwrite = true;
}
}
if(!$cache_fwrite) {
try{
$file_contents = file_get_contents($cache_file);
$file_ex = explode("\n\n", $file_contents);
$caches = unserialize(base64_decode($file_ex[1]));
if(!$cache_fwrite)
include($cache_file);
$list = (is_array($caches) && isset($caches['list'])) ? $caches['list'] : array();
$bo_subject = (is_array($caches) && isset($caches['bo_subject'])) ? $caches['bo_subject'] : '';
} catch(Exception $e){
$cache_fwrite = true;
$list = array();
}
}
}
}
@ -62,17 +73,30 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
try {
unset($row['wr_password']);
unset($row['wr_password']); //패스워드 저장 안함( 아예 삭제 )
} catch (Exception $e) {
}
$row['wr_email'] = ''; //이메일 저장 안함
if (strstr($row['wr_option'], 'secret')){ // 비밀글일 경우 내용, 링크, 파일 저장 안함
$row['wr_content'] = $row['wr_link1'] = $row['wr_link2'] = '';
$row['file'] = array('count'=>0);
}
$list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);
}
if($cache_fwrite) {
$handle = fopen($cache_file, 'w');
$cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject='".sql_escape_string($bo_subject)."';\n\$list=".var_export($list, true)."?>";
$caches = array(
'list' => $list,
'bo_subject' => sql_escape_string($bo_subject),
);
$cache_content = "<?php if (!defined('_GNUBOARD_')) exit; ?>\n\n";
$cache_content .= base64_encode(serialize($caches)); //serialize
fwrite($handle, $cache_content);
fclose($handle);
@chmod($cache_file, 0640);
}
}

View File

@ -349,14 +349,17 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
} else { // 비율에 맞게 생성
$dst = imagecreatetruecolor($dst_w, $dst_h);
$bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색
if($src_w > $src_h) {
$tmp_h = round(($dst_w * $src_h) / $src_w);
$dst_y = round(($dst_h - $tmp_h) / 2);
$dst_h = $tmp_h;
} else {
$tmp_w = round(($dst_h * $src_w) / $src_h);
$dst_x = round(($dst_w - $tmp_w) / 2);
$dst_w = $tmp_w;
if ( !((defined('G5_USE_THUMB_RATIO') && false === G5_USE_THUMB_RATIO) || (defined('G5_THEME_USE_THUMB_RATIO') && false === G5_THEME_USE_THUMB_RATIO)) ){
if($src_w > $src_h) {
$tmp_h = round(($dst_w * $src_h) / $src_w);
$dst_y = round(($dst_h - $tmp_h) / 2);
$dst_h = $tmp_h;
} else {
$tmp_w = round(($dst_h * $src_w) / $src_h);
$dst_x = round(($dst_w - $tmp_w) / 2);
$dst_w = $tmp_w;
}
}
if($size[2] == 3) {
@ -382,34 +385,64 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
$dst = imagecreatetruecolor($dst_w, $dst_h);
$bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색
if($src_w < $dst_w) {
if($src_h >= $dst_h) {
if( $src_h > $src_w ){
$tmp_w = round(($dst_h * $src_w) / $src_h);
$dst_x = round(($dst_w - $tmp_w) / 2);
$dst_w = $tmp_w;
} else {
if ( ((defined('G5_USE_THUMB_RATIO') && false === G5_USE_THUMB_RATIO) || (defined('G5_THEME_USE_THUMB_RATIO') && false === G5_THEME_USE_THUMB_RATIO)) ){
//이미지 썸네일을 비율 유지하지 않습니다. (5.2.6 버전 이하에서 처리된 부분과 같음)
if($src_w < $dst_w) {
if($src_h >= $dst_h) {
$dst_x = round(($dst_w - $src_w) / 2);
$src_h = $dst_h;
if( $dst_w > $src_w ){
$dst_w = $src_w;
}
} else {
$dst_x = round(($dst_w - $src_w) / 2);
$dst_y = round(($dst_h - $src_h) / 2);
$dst_w = $src_w;
$dst_h = $src_h;
}
} else {
$dst_x = round(($dst_w - $src_w) / 2);
$dst_y = round(($dst_h - $src_h) / 2);
$dst_w = $src_w;
$dst_h = $src_h;
}
} else {
if($src_h < $dst_h) {
if( $src_w > $dst_w ){
$tmp_h = round(($dst_w * $src_h) / $src_w);
$dst_y = round(($dst_h - $tmp_h) / 2);
$dst_h = $tmp_h;
} else {
if($src_h < $dst_h) {
$dst_y = round(($dst_h - $src_h) / 2);
$dst_h = $src_h;
$src_w = $dst_w;
}
}
} else {
//이미지 썸네일을 비율 유지하며 썸네일 생성합니다.
if($src_w < $dst_w) {
if($src_h >= $dst_h) {
if( $src_h > $src_w ){
$tmp_w = round(($dst_h * $src_w) / $src_h);
$dst_x = round(($dst_w - $tmp_w) / 2);
$dst_w = $tmp_w;
} else {
$dst_x = round(($dst_w - $src_w) / 2);
$src_h = $dst_h;
if( $dst_w > $src_w ){
$dst_w = $src_w;
}
}
} else {
$dst_x = round(($dst_w - $src_w) / 2);
$dst_y = round(($dst_h - $src_h) / 2);
$dst_w = $src_w;
$dst_h = $src_h;
}
} else {
if($src_h < $dst_h) {
if( $src_w > $dst_w ){
$tmp_h = round(($dst_w * $src_h) / $src_w);
$dst_y = round(($dst_h - $tmp_h) / 2);
$dst_h = $tmp_h;
} else {
$dst_y = round(($dst_h - $src_h) / 2);
$dst_h = $src_h;
$src_w = $dst_w;
}
}
}
}
if($size[2] == 3) {