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

This commit is contained in:
chicpro
2013-02-19 17:30:11 +09:00
80 changed files with 182 additions and 471 deletions

View File

@ -280,9 +280,7 @@ function get_file($bo_table, $wr_id)
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no]['path'] = G4_DATA_URL.'/file/'.$bo_table;
//$file[$no]['size'] = get_filesize("{$file[$no]['path']}/$row['bf_file']");
$file[$no]['size'] = get_filesize($row['bf_filesize']);
//$file[$no]['datetime'] = date("Y-m-d H:i:s", @filemtime("$g4['path']/data/file/$bo_table/$row['bf_file']"));
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $row['bf_content'];
@ -290,8 +288,6 @@ function get_file($bo_table, $wr_id)
//$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'];
// prosper 님 제안
//$file[$no]['imgsize'] = @getimagesize("{$file[$no]['path']}/$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'];
@ -1055,21 +1051,6 @@ function view_file_link($file, $width, $height, $content='')
// 이미지에 속성을 주지 않는 이유는 이미지 클릭시 원본 이미지를 보여주기 위한것임
// 게시판설정 이미지보다 크다면 스킨의 자바스크립트에서 이미지를 줄여준다
return "<img src='".G4_DATA_URL."/file/{$board['bo_table']}/".urlencode($file)."' onclick='image_window(this);' alt='{$content}'>";
/*
// 110106 : FLASH XSS 공격으로 인하여 코드 자체를 막음
else if (preg_match("/\.($config['cf_flash_extension'])$/i", $file))
//return "<embed src='$g4['path']/data/file/$board['bo_table']/$file' $attr></embed>";
return "<script>doc_write(flash_movie('$g4['path']/data/file/$board['bo_table']/$file', '_g4_{$ids}', '$width', '$height', 'transparent'));</script>";
*/
//=============================================================================================
// 동영상 파일에 악성코드를 심는 경우를 방지하기 위해 경로를 노출하지 않음
//---------------------------------------------------------------------------------------------
/*
else if (preg_match("/\.($config['cf_movie_extension'])$/i", $file))
//return "<embed src='$g4['path']/data/file/$board['bo_table']/$file' $attr></embed>";
return "<script>doc_write(obj_movie('$g4['path']/data/file/$board['bo_table']/$file', '_g4_{$ids}', '$width', '$height'));</script>";
*/
//=============================================================================================
}
@ -1732,4 +1713,13 @@ function check_device($device)
alert('모바일 전용 게시판입니다.', G4_URL);
}
}
// 게시판 최신글 캐시 파일 삭제
function delete_cache_latest($bo_table)
{
foreach (glob(G4_DATA_PATH.'/cache/latest-'.$bo_table.'-*') as $filename) {
unlink($filename);
}
}
?>

View File

@ -60,7 +60,7 @@ function mobile_thumb($matches)
$src = preg_replace("/^\.\.\//", "http://m.sir.co.kr/", $src);
$absolute = preg_replace("/^http\:\/\/(www\.)?sir\.co\.kr\/(.*)$/", "/home/sir/$2", $src);
$thumb_dir = "$g4[path]/data/thumb/$bo_table";
$thumb_dir = G4_DATA_PATH.'/thumb/'.$bo_table;
if (!is_dir($thumb_dir)) {
@mkdir($thumb_dir, 0707);
@chmod($thumb_dir, 0707);
@ -100,12 +100,12 @@ function mobile_thumb($matches)
$src = trim($m[1]);
//if ($is_admin) echo $src."<br>";
if (preg_match("/\.(jpe?g|png)$/i", $src)) {
// 상대경로(..)로 시작되면 sir.co.kr 도메인으로 여긴다.
$src = preg_replace("/^\.\.\//", "http://sir.co.kr/", $src);
// 상대경로(..)로 시작되면 도메인으로 여긴다.
$src = preg_replace("/^\.\.\//", 'http://'.$_SERVER['SERVER_NAME'].'/', $src);
// 유일한 파일명을 만든다.
$src_md5 = md5($src.$width);
$thumb = "$g4[path]/data/thumb/{$bo_table}-{$wr_id}-{$src_md5}";
$thumb = G4_DATA_PATH.'/thumb/'.$bo_table.'-'.$wr_id.'-'.$src_md5;
if (!file_exists($thumb)) {
$result = mobile_create_thumb($src, $width, $thumb);