gnu3호환 최신글 보이기 패치... 이미지 출력시 사이즈 조정 정보
gnu3호환 최신글 보이기 패치... 이미지 출력시 사이즈 조정
본문
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// edit by ⓒⓒⓒ ver 2005-06-24
// 최신글 추출
function latest($skin_dir='', $bo_table, $rows=10, $len=40, $img_width='', $img_height='')
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
$latest_skin = "./skin/latest/$skin_dir";
}
if(!$img_width) $img_width = 100;
if(!$img_height) $img_height= 100;
$bo_yn = sql_fetch(" select bo_table from $cfg[table_board] where bo_table = '$bo_table' ");
if ($bo_yn[bo_table] != $bo_table) {
echo "<br><br><br><center><font color=#FF0000>{$bo_table}게시판을 생성하세요!</font></center>";
} else {
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0
order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = mysql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
$list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
$list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
$list[$i][content] = get_text($row[wr_content]);
$list[$i][date] = substr($row[wr_datetime],2,8);
$list[$i][icon_new] = "";
if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
$list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
}
for ($k=1; $k<=$cfg[file_count]; $k++) {
if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
if ( file_exists("./data/file/$bo_table/".preg_replace("/.(jpg|JPG|png|PNG|gif|GIF)/","_s.\\1",$row["wr_file".$k]) ) ) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . preg_replace("/.(jpg|JPG|png|PNG|gif|GIF)/","_s.\\1",$row["wr_file".$k]) ;
} else if ( file_exists("./data/file/$bo_table/".$row["wr_file".$k]) ) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}
}
if (!$list[$i]["file_image1"]) {
$list[$i]["file_image1"] = "./data/file/$bo_table/" . sprintf("%05d", $row[wr_id])."_000_s.jpg";
if(!file_exists($list[$i]["file_image1"]) ) $list[$i]["file_image1"] = "$latest_skin/images/noimage.gif";
}
}
for ($k=1; $k<=$cfg[link_count]; $k++) {
if ($row["wr_link".$k]) {
$link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
$link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
}
$latest_skin = $tmp_latest_skin;
}
?>
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// edit by ⓒⓒⓒ ver 2005-06-24
// 최신글 추출
function latest($skin_dir='', $bo_table, $rows=10, $len=40, $img_width='', $img_height='')
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
$latest_skin = "./skin/latest/$skin_dir";
}
if(!$img_width) $img_width = 100;
if(!$img_height) $img_height= 100;
$bo_yn = sql_fetch(" select bo_table from $cfg[table_board] where bo_table = '$bo_table' ");
if ($bo_yn[bo_table] != $bo_table) {
echo "<br><br><br><center><font color=#FF0000>{$bo_table}게시판을 생성하세요!</font></center>";
} else {
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0
order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = mysql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
$list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
$list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
$list[$i][content] = get_text($row[wr_content]);
$list[$i][date] = substr($row[wr_datetime],2,8);
$list[$i][icon_new] = "";
if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
$list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
}
for ($k=1; $k<=$cfg[file_count]; $k++) {
if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
if ( file_exists("./data/file/$bo_table/".preg_replace("/.(jpg|JPG|png|PNG|gif|GIF)/","_s.\\1",$row["wr_file".$k]) ) ) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . preg_replace("/.(jpg|JPG|png|PNG|gif|GIF)/","_s.\\1",$row["wr_file".$k]) ;
} else if ( file_exists("./data/file/$bo_table/".$row["wr_file".$k]) ) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}
}
if (!$list[$i]["file_image1"]) {
$list[$i]["file_image1"] = "./data/file/$bo_table/" . sprintf("%05d", $row[wr_id])."_000_s.jpg";
if(!file_exists($list[$i]["file_image1"]) ) $list[$i]["file_image1"] = "$latest_skin/images/noimage.gif";
}
}
for ($k=1; $k<=$cfg[link_count]; $k++) {
if ($row["wr_link".$k]) {
$link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
$link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
}
$latest_skin = $tmp_latest_skin;
}
?>
추천
0
0
댓글 전체