// 메인페이지 대문 만들기
// 간략 보기 클래스 확장
class front_result extends pg_result {
function printheadtr($tinfo){
return "";
}
function printtr($tinfo){
$str = "";
for($i=0;$i<$this->maxrow;$i++){
if($i > 0) $str .= "
\n";
$row = pg_fetch_row($this->res, $i);
$str .= "\n";
$str .= $this->printrow($row);
$str .= "\n \n";
}
return $str;
}
function printrow($row){
$str = "";
for($j=0;$j<$this->maxcol;$j++){
if($row[$j] == "") $row[$j] = " ";
$str .= "$row[$j] ";
}
return $str;
}
}
// 해당 게시물 간략 보기
function briefsubcrit($fronttable, $newcriteria, $topic, $isnotice = null){
// $fronttable = 작업테이블
// $newcriteria = 작업 게시판명
// $topic = 게시판 서브 섹션
// $isnotice = 참이면 공지사항 처리
global $tinfo, $pgdb, $criteria, $worktable;
if($isnotice) $newcriteria = "notice";
$res = new front_result($pgdb->conn, $pgdb->exec("select ' ' || subject || ' ' || case when comments > 0 then ' [' || comments || ']' else '' end from $fronttable where id > 0 and topic = '$topic' and pid = 0 and deleted < 1 order by id desc limit 5"));
/*
$tinfo->border = 0;
$tinfo->cellpadding = 0;
$tinfo->cellspacing = 0;
*/
echo $res->printtable($tinfo);
}
if($criteria && ($critinfo->upper != 2)){
// 데이터베이스 게시판의 대문일 경우 사용자 쿠키에서 그것을 가져옮
if($usercrit){
list($newcriteria, $newdbname) = pg_fetch_row($pgdb->exec("select criteria,name from menus where menuid = " . substr($usercrit, 3)),0);
}
else {
$newcriteria = "pgsql";
}
echo "\n";
exit;
}
// 다음부터 html 템플릿
?>
공지사항
$tinfo->class = "brieftable";
$tinfo->style = "width: 99%";
$tinfo->border = "0";
$tinfo->cellpadding = "0";
$tinfo->cellspacing = "3";
briefsubcrit("bd_21", "notice", "", true);
if(! $usercrit) {
echo "\n";
// 기본 DB 게시판으로 mysql
$fronttable = "bd_13";
list($newcriteria, $newdbname) = pg_fetch_row($pgdb->exec("select criteria,name from menus where menuid = 13"),0);
}
else {
$fronttable = $usercrit;
list($newcriteria, $newdbname) = pg_fetch_row($pgdb->exec("select criteria,name from menus where menuid = " . substr($usercrit, 3)),0);
}
$res = $pgdb->exec("select '' || name || ' ' as t from menus where upper = 2 and menutype = 2 order by sortnum");
$i=0;
$tSelect = "\n";
while(list($optionstr) = @pg_fetch_row($res, $i++)){
$tSelect .= $optionstr;
}
$tSelect .= " \n";
?>
briefsubcrit($fronttable, $newcriteria, "news");
?>
briefsubcrit($fronttable, $newcriteria, "columns"); ?>
briefsubcrit($fronttable, $newcriteria, "qna"); ?>
briefsubcrit($fronttable, $newcriteria, "tutorials"); ?>
briefsubcrit($fronttable, $newcriteria, "devel"); ?>
briefsubcrit($fronttable, $newcriteria, "files"); ?>