board patch 하나더 합니다.

흠 1.0.2 의 일부 내용들을 마구 뿌리고 있네요 -)자원봉사자 게시판을 보시면 순선님이 첨부 파일 처리를 못하셨는지
링크가 깨져서 미리보기가 가능한 타입들(txt,html,php,sh등등)이
파일이 없다구 마구 에러 메세지를 뿌리고 있죠.아래와 같이요 ^^
---- 메일 서버 구축.txt 내용 --------------------------
Warning fopen("./data/prj/files/php0MwC9O/메일 서버 구
축.txt","r") - No such file or directory in include/print.ph on line
441Warning Supplied argument is not a valid File-Handle resource in
include/print.ph on line 442Warning Supplied argument is not a valid File-Handle resource in
include/print.ph on line 443이걸 좀 간단한 에러 메세지로 표현해 주는 것입니다.
---- example_html.phps 내용 --------------------------
example_html.phps file is broken link!!
와 같이 출력을 해 줍니다. -) 일단 첨부되어 있는 파일이 제대로
링크가 되어 있는지 출력해줄 필요는 있는 것 같은데.. 위와 같이
무식하게 출력이 되는 것은 좀 그래서.. 수정해 보았습니다.수정할 부분은.. 일단 read.php3 에서
=================================================================
// jpg, gif file이 있으면 미리 보기 출력음 함
if ($list[bofile]) {
$tail = check_filetype($list[bofile]);
viewfile($tail);
}echo "
<!-- ================= 글내용 ================= -->
$list[text]
<!-- ================= 글내용 ================== -->\n";// text등 ascii file이 있으면 미리 보기 출력음 함
if ($list[bofile]) viewfile($tail,1);=================================================================
부분을 아래와 같이 수정합니다.
=================================================================
if ($list[bofile]) {
$tail = check_filetype($list[bofile]);
$preview = viewfile($tail);
}echo "
$preview[up]
<!-- ================= 글내용 ================== -->
$list[text]
<!-- ================= 글내용 =================== -->
$preview[down]\n";=================================================================
다음.... include/print.php3 의 제일 하단의 viewfile() 함수를
과감하게 삭제를 합니다. -) 그리고 include/get.ph 의 제일 하단에=================================================================
function viewfile($tail) {
global $table, $list, $upload, $langs;
$upload_file = "./data/$table/$upload[dir]/$list[bcfile]/$list
[bofile]";$source1 = "<p><br>\n---- $list[bofile] $langs
[inc_file] -------------------------- \n<p>\n<pre>\n";
$source2 = "\n</pre>\n<br><br>";
$source3 = " <font color=red>$list[bofile]</font>
file is broken link!!\n\n";if (file_exists($upload_file)) {
if ($tail == "gif" || $tail == "jpg" || $tail == "png") $p[up]
= "<img src=\"$upload_file\">\n<p>\n";
else if ($tail == "phps" || $tail == "txt" || $tail == "htmls"
|| $tail == "htm" || $tail == "shs") {
$fp = fopen($upload_file, "r");
$view = fread($fp, filesize($upload_file));
fclose($fp);
$view = htmlspecialchars($view);$p[down] = "$source1$view$source2";
}
}if (!$p[up] && !$p[down]) $p[down] = "$source1$source3$source2";
return $p;
}=================================================================
를 넣어 주시면 됩니다. -)
Re: board patch 하나더 합니다.
감사합니다.
일단 문제의 원인은 저도 처음부터 알고 있었고
정균님이 근본적인 해결 방법을 알려 주셨기 때문에
아래 패치를 따로 적용할 필요가 없어졌습니다. -)
지금은 자~알 됩니다.
김정균 wrote..