// ÀÛ¼ºÀÚ : ÃÖ»ó¹Î
// ¼öÁ¤ÀÏ : 2002³â 2¿ù 17ÀÏ
// ÆÄÀϸí : boardList.html
// °Ô½ÃÆÇ ¸®½ºÆ®
include ("../inc/header.html"); // Çì´õ
include ("../common/dbConnect.php"); // Ä¿³Ø¼Ç Æ÷ÇÔ
include("boardInfo.php"); // °Ô½ÃÆÇ Á¤º¸ Æ÷ÇÔ
include("../common/pageSkip.php"); // ÆäÀÌÁö ½ºÅµ°ü·Ã Æ÷ÇÔ
include("../common/common.php"); // °øÅëÇÔ¼ö Æ÷ÇÔ
include("./inc/header.html");
include("./boardCommon.php");
// °Ô½ÃÆÇ°ªÀÌ ¾øÀ»°æ¿ì ±âº»°Ô½ÃÆÇÀ» °¡Á®¿Â´Ù. ±×°Íµµ ¾øÀ½..¿¡·¯Áö ¸ð
if($boardID == "")
$boardID = "freeboard";
// °Ô½ÃÆÇ Á¤º¸ ÃßÃâ
$info = new boardInfo($boardID);
// ±âº» º¯¼ö
if(!$page) { $page = 1; } // ÇöÀç ÆäÀÌÁö
function getPageNum() {
global $conn, $info, $maxLine, $start, $page, $findType, $findWord, $boardID, $pageSkip;
if($findWord == "" || $findType == "")
$totalCount = countRows($boardID);
else {
$query = "select count(no) from $boardID where $findType like '%$findWord%' ";
$result = $conn->runQuery($query);
$totalCount = mysql_result($result,0,0);
}
$start = ($page == 1)?0:($page-1)*$info->getMaxLine(); // ½ÃÀÛ Row
$pageSkip = new pageSkip("./boardList.html?boardID=$boardID&findType=$findType&findWord=$findWord&page=", $totalCount, $info->getMaxLine(), 10);
}
// °ü¸®ÀÚ °øÁö ÃßÃâ
function adminNotice() {
global $conn, $boardID;
$query = "select no, sortNo, writer, email, subject, writeDate, readCount, readLock, attachType from $boardID where notice='Y'";
$result = $conn->runQuery($query);
if (mysql_num_rows($result) > 0) {
$no = mysql_result($result, 0, 0);
$sortNo = mysql_result($result, 0, 1);
$writer = mysql_result($result, 0, 2);
$email = mysql_result($result, 0, 3);
$subject = mysql_result($result, 0, 4);
$writeDate = mysql_result($result, 0, 5);
$readCount = mysql_result($result, 0, 6);
$readLock = mysql_result($result, 0, 7);
$attachType = mysql_result($result, 0, 8);
printList($no, $sortNo, $writer, $email, $subject, $writeDate, $readCount, $readLock, $attachType);
}
}
// ¸®½ºÆ® ÃßÃâ
function getList($page) {
global $conn, $boardID, $start, $maxLine, $findType, $findWord, $totalCount, $info, $limitWord;
if ($findType != "" && $findWord != "") {
$query = "select b.no, sortNo, writer, email, subject, writeDate, readCount, replyNo, readLock, attachType, count(c.cNo) as count from $boardID b LEFT OUTER JOIN bComment c ON b.no=c.no and c.boardId='$boardID' where $findType like '%$findWord%' group by b.no order by sortNo desc limit $start, ".$info->getMaxLine()."";
}
else {
$query = "select b.no, sortNo, writer, email, subject, writeDate, readCount, replyNo, readLock, attachType, count(c.cNo) as count from $boardID b LEFT OUTER JOIN bComment c ON b.no=c.no and c.boardId='$boardID' group by b.no order by sortNo desc limit $start, ".$info->getMaxLine()."";
}
$result = $conn->runQuery($query);
if (mysql_num_rows($result) > 0) {
$space = "";
while($rows = mysql_fetch_array($result)) {
for($i=0 ; $i<$rows[replyNo] ; $i++) {
$space .= " ";
if(($i+1) == $rows[replyNo])
$space .= "
";
}
$rows[subject] = strSplit($rows[subject], $limitWord, "...");
$rows[subject] .= ($rows[count] > 0 && $info->getLimitComment() == "Y")?" [".$rows[count]."]":"";
printList($rows[no], $rows[sortNo], $rows[writer], $rows[email], $space.$rows[subject], $rows[writeDate], $rows[readCount], $rows[readLock], $rows[attachType]);
$space = "";
}
}
else {
printList("", "", "", "", "ÀÛ¼ºµÈ °Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù.", "", "", "","","");
}
}
// °ªÀ» ȸ鿡 Ãâ·Â
function printList($no, $sortNo, $writer, $email, $subject, $writeDate, $readCount, $readLock, $attachType) {
global $boardID, $page, $info, $findWord, $findType;
if(dateCheck($writeDate, 1))
$subject = "
".$subject;
if($readLock == "Y")
$subject = "
".$subject;
// º»¹® Ãâ·Â
echo "
$sortNo | ";
// ÆÄÀÏ÷ºÎ üũ
if($info->getLimitAttach() == "Y")
echo "".attachCheck($attachType)." | ";
echo " $subject | ";
// ³ª¸ÓÁö ³»¿ë ´Ù Ãâ·Â
echo "$writer |
".substr($writeDate,0,10)." |
$readCount |
|
";
}
// Å×À̺í Ãâ·Â
function printTable() {
global $info, $width, $align, $pageSkip, $page, $boardID, $totalCount, $maxLine, $pageSkip;
// Àüü °Ô½Ã¹° °è»ê
getPageNum();
echo "
¡Ý ".$info->getBoardName()." |
¹øÈ£ |
Á¦¸ñ |
±Û¾´ÀÌ |
±Û¾´³¯ |
ÀÐÀº¼ö |
|
";
// °ü¸®ÀÚ °øÁö üũ
adminNotice();
// ¸®½ºÆ® Ãâ·Â
getList($page);
echo " |
";
// ÆäÀÌÁö ³»ºñ°ÔÀ̼Ç
$pageSkip->printPage($page);
echo " |
";
// ÇÏ´Ü ¸µÅ©
printLink();
}
function printLink() {
global $width, $boardID, $align, $page;
echo "";
}
printTable();
include ("../inc/footer.html"); // ǪÅÍ
?>