downloadconfirm 을 download에 추가 필요 파일 함수 추가

This commit is contained in:
chicpro
2013-01-17 10:46:38 +09:00
parent e74797c847
commit fe78f5bc38
5 changed files with 61 additions and 51 deletions

24
bbs/confirm.php Normal file
View File

@ -0,0 +1,24 @@
<?
include_once('./_common.php');
include_once($g4['path'].'/head.sub.php');
?>
<article id="confirm_check">
<header>
<hgroup>
<h1><? echo $header; ?></h1> <!-- 수행 중이던 작업 내용 -->
<h2>아래 내용을 확인해 주세요.</h2>
</hgroup>
</header>
<p>
<? echo $msg; ?>
</p>
<a href="<? echo $url1; ?>">확인</a>
<a href="<? echo $url2; ?>">취소</a><br><br>
<a href="<? echo $url3; ?>">돌아가기</a>
</article>
<?
include_once($g4['path'].'/tail.sub.php');
?>

View File

@ -15,6 +15,15 @@ $file = sql_fetch($sql);
if (!$file['bf_file'])
alert_close('파일 정보가 존재하지 않습니다.');
// JavaScript 불가일 때
if($confirm != 'yes' && $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';
$url2 = $_SERVER['HTTP_REFERER'];
confirm($msg, $url1, $url2);
}
if ($member['mb_level'] < $board['bo_download_level']) {
$alert_msg = '다운로드 권한이 없습니다.';
if ($member['mb_id'])

View File

@ -1,44 +0,0 @@
<?php
include_once('./_common.php');
include_once($g4['path'].'/head.sub.php');
$no = (int)$no;
// 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생
// 다른곳에서 링크 거는것을 방지하기 위한 코드
if (!get_session('ss_view_'.$bo_table.'_'.$wr_id))
alert('잘못된 접근입니다.');
$sql = " select bf_source from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' ";
$file = sql_fetch($sql);
$board_href = 'bo_table='.$bo_table;
if($wr_id)
$board_href .= '&amp;wr_id='.$wr_id;
if($qstr)
$board_href .= $qstr;
if($board['bo_download_point'] < 0) {
echo '
<article>
<header>
<hgroup>
<h1>파일다운로드</h1>
<h2>아래 내용을 확인해 주세요.</h2>
</hgroup>
</header>
<p>
'.$file['bf_source'].' 파일을 다운로드 하시면 포인트가 차감('.number_format($board['bo_download_point']).'점)됩니다.<br />
포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.<br />
그래도 다운로드 하시겠습니까?
</p>
<a href="./download.php?'.$_SERVER['QUERY_STRING'].'">파일다운로드</a>
<a href="./board.php?'.$board_href.'">다운로드안함</a>
';
} else {
goto_url('./download.php?'.$_SERVER['QUERY_STRING']);
}
include_once($g4['path'].'/tail.sub.php');
?>

View File

@ -154,6 +154,33 @@ function alert_close($msg)
exit;
}
// confirm 창
function confirm($msg, $url1='', $url2='', $url3='')
{
global $g4;
if (!$msg) {
$msg = '올바른 방법으로 이용해 주십시오.';
alert($msg);
}
if(!trim($url1) || !trim($url2)) {
$msg = '$url1 과 $url2 를 지정해 주세요.';
alert($msg);
}
if (!$url3) $url3 = $_SERVER['HTTP_REFERER'];
$msg = str_replace("\\n", "<br>", $msg);
$header = '';
if (isset($g4['title'])) {
$header = $g4['title'];
}
include_once("{$g4['bbs_path']}/confirm.php");
exit;
}
// way.co.kr 의 wayboard 참고
function url_auto_link($str)

View File

@ -35,15 +35,9 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
$cnt++;
if($board['bo_download_point'] < 0) {
$view['file'][$i]['confirm_href'] = str_replace("download.php", "downloadconfirm.php", $view['file'][$i]['href']);
} else {
$view['file'][$i]['confirm_href'] = $view['file'][$i]['href'];
}
?>
<li>
<a href="<? echo $view['file'][$i]['confirm_href']; ?>" onclick="javascript:file_download('<?=$view['file'][$i]['href']?>', '<?=$view['file'][$i]['source']?>'); return false;">
<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;">
<span><?=$view['file'][$i]['source']?> (<?=$view['file'][$i]['size']?>)</span>
<span class="bo_v_file_cnt"><?=$view['file'][$i]['download']?></span>
<span>DATE : <?=$view['file'][$i]['datetime']?></span>