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

This commit is contained in:
gnuboard
2013-03-20 16:01:43 +09:00
7 changed files with 83 additions and 29 deletions

View File

@ -16,9 +16,9 @@ if (!$file['bf_file'])
alert_close('파일 정보가 존재하지 않습니다.');
// JavaScript 불가일 때
if($confirm != 'yes' && $board['bo_download_point'] < 0) {
if($js != 'on' && $board['bo_download_point'] < 0) {
$msg = $file['bf_source'].' 파일을 다운로드 하시면 포인트가 차감('.number_format($board['bo_download_point']).'점)됩니다.\\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\\n그래도 다운로드 하시겠습니까?';
$url1 = './download.php?'.$_SERVER['QUERY_STRING'].'&amp;confirm=yes';
$url1 = G4_BBS_URL.'/download.php?'.$_SERVER['QUERY_STRING'].'&amp;js=on';
$url2 = $_SERVER['HTTP_REFERER'];
//$url1 = 확인link, $url2=취소link
@ -54,7 +54,7 @@ if (!get_session($ss_name))
{
// 다운로드 포인트가 음수이고 회원의 포인트가 0 이거나 작다면
if ($member['mb_point'] + $board['bo_download_point'] < 0)
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 다운로드('.number_format($board['bo_download_point']).')가 불가합니다.'."\n\n".'포인트를 적립하신 후 다시 다운로드 해 주십시오.');
alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 다운로드('.number_format($board['bo_download_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 다운로드 해 주십시오.');
// 게시물당 한번만 차감하도록 수정
insert_point($member['mb_id'], $board['bo_download_point'], "{$board['bo_subject']} $wr_id 파일 다운로드", $bo_table, $wr_id, "다운로드");

View File

@ -1753,7 +1753,7 @@ function get_editor_image($contents)
return false;
// $contents 중 img 태그 추출
$pattern = "/<img[^>]*src=[\'\"]?([^>\'\"]+".str_replace(".", "\.", $_SERVER['HTTP_HOST'])."[^>\'\"]+)[\'\"]?[^>]*>/";
$pattern = "/<img[^>]*src=[\'\"]?([^>\'\"]+[^>\'\"]+)[\'\"]?[^>]*>/";
preg_match_all($pattern, $contents, $matchs);
return $matchs;

View File

@ -34,9 +34,11 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_
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(!stristr($src_url, G4_URL) || stripos($src_url, G4_URL) != 0)
continue;
$srcfile = G4_PATH.str_replace(G4_URL, "", $matchs[1][$i]);
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$filename = basename($srcfile);
@ -94,13 +96,15 @@ function get_view_thumbnail($contents)
// $contents 중 img 태그 추출
$matchs = get_editor_image($contents);
if(!$matchs)
if(empty($matchs))
return $contents;
for($i=0; $i<count($matchs[1]); $i++) {
if(!stristr($matchs[1][$i], G4_URL) || stripos($matchs[1][$i], G4_URL) != 0)
continue;
// 이미지 path 구함
$imgurl = parse_url($matchs[1][$i]);
$srcfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
$srcfile = G4_PATH.str_replace(G4_URL, "", $matchs[1][$i]);
if(is_file($srcfile)) {
// 썸네일 높이
@ -145,7 +149,8 @@ function get_view_thumbnail($contents)
// $img_tag에 editor 경로가 있으면 원본보기 링크 추가
if(strpos($matchs[1][$i], 'data/editor') && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {
$thumb_tag = '<a href="'.G4_BBS_URL.'/view_image.php?fn='.urlencode($imgurl['path']).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
$imgurl = str_replace(G4_URL, "", $matchs[1][$i]);
$thumb_tag = '<a href="'.G4_BBS_URL.'/view_image.php?fn='.urlencode($imgurl).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
}
$contents = str_replace($img_tag, $thumb_tag, $contents);

View File

@ -40,7 +40,7 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<a href="<? echo $view['file'][$i]['href']; ?>" onclick="javascript:file_download('<? echo $view['file'][$i]['href'].'&amp;confirm=yes'; ?>', '<?=$view['file'][$i]['source']?>'); return false;">
<a href="<? echo $view['file'][$i]['href']; ?>" class="view_file_download">
<img src="<?=$board_skin_url?>/img/icon_file.gif" alt="첨부파일">
<strong><?=$view['file'][$i]['source']?></strong>
<span> (<?=$view['file'][$i]['size']?>)</span>
@ -183,10 +183,22 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<script>
function file_download(link, file) {
<? if ($board['bo_download_point'] < 0) { ?>if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
document.location.href=link;
}
<? if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
var msg = "파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?}?>
function board_move(href)
{

View File

@ -40,7 +40,7 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<a href="<? echo $view['file'][$i]['href']; ?>" onclick="javascript:file_download('<? echo $view['file'][$i]['href'].'&amp;confirm=yes'; ?>', '<?=$view['file'][$i]['source']?>'); return false;">
<a href="<? echo $view['file'][$i]['href']; ?>" class="view_file_download">
<img src="<?=$board_skin_url?>/img/icon_file.gif" alt="첨부파일">
<strong><?=$view['file'][$i]['source']?></strong>
<span> (<?=$view['file'][$i]['size']?>)</span>
@ -182,10 +182,22 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<script>
function file_download(link, file) {
<? if ($board['bo_download_point'] < 0) { ?>if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
document.location.href=link;
}
<? if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
var msg = "파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?}?>
function board_move(href)
{

View File

@ -40,7 +40,7 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<a href="<? echo $view['file'][$i]['href']; ?>" onclick="return file_download('<?=$view['file'][$i]['source']?>');">
<a href="<? echo $view['file'][$i]['href']; ?>" class="view_file_download">
<img src="<?=$board_skin_url?>/img/icon_file.gif" alt="첨부파일">
<strong><?=$view['file'][$i]['source']?></strong>
<span> (<?=$view['file'][$i]['size']?>)</span>
@ -184,9 +184,22 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<script>
function file_download(file) {
<? if ($board['bo_download_point'] < 0) { ?>return (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"));<?}?>
}
<? if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
var msg = "파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?}?>
function board_move(href)
{

View File

@ -40,7 +40,7 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<a href="<? echo $view['file'][$i]['href']; ?>" onclick="javascript:file_download('<? echo $view['file'][$i]['href'].'&amp;confirm=yes'; ?>', '<?=$view['file'][$i]['source']?>'); return false;">
<a href="<? echo $view['file'][$i]['href']; ?>" class="view_file_download">
<img src="<?=$board_skin_url?>/img/icon_file.gif" alt="첨부파일">
<strong><?=$view['file'][$i]['source']?></strong>
<span> (<?=$view['file'][$i]['size']?>)</span>
@ -182,10 +182,22 @@ include_once(G4_LIB_PATH.'/thumbnail.lib.php');
<script>
function file_download(link, file) {
<? if ($board['bo_download_point'] < 0) { ?>if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
document.location.href=link;
}
<? if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
var msg = "파일을 다운로드 하시면 포인트가 차감(<?=number_format($board['bo_download_point'])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?}?>
function board_move(href)
{