1, // 템플릿 사용 // 1 list, 2 read, 4 write, 8 upload, 16 cate 'useBoard3' =>25 ); require($_SERVER['DOCUMENT_ROOT'].'/hk_gamsungdb/sinc/header.php'); $thisPath = dirname(__FILE__) .'/'; // 마지막이 '/'으로 끝나야함 //======================================================= // Ready... (변수 초기화 및 넘어온값 필터링) //======================================================= // 1. 넘어온값 체크 // 2. 기본 URL QueryString $qs_basic = 'mode=&limitno=&limitrows=&time=&utf8='; if($_GET['getinfo']!='cont') $qs_basic .= '&pern=&row_pern=&page_pern=&html_type=&html_skin=&skin='; $qs_basic .= '&data_pn='.$_GET['data_pn']; $qs_basic .= '&cate_sort='.$_GET['cate_sort']; $qs_basic = href_qs($qs_basic); // 해당값 초기화 // 3. $dbinfo 가져오기 include_once($thisPath.'config.php'); // - redirect 유무 if($dbinfo['redirect']) go_url($dbinfo['redirect']); //====================== // 4. 카테고리 정보 구함 //====================== if($dbinfo['enable_cate']=='Y') { $_GET['cateuid'] = (int)$_GET['cateuid']; // 카테고리정보구함 (dbinfo, cateuid, sw_catelist, string_view_firsttotal) // return : highcate[], samecate[], subcate[], subsubcate[], subcateuid[], catelist $sw_catelist = CATELIST_VIEW | CATELIST_VIEW_CATE_DEPTH; if(strlen($_GET['sc_string'])==0) $sw_catelist |= CATELIST_VIEW_DATACOUNT; $cateinfo=b3Cateinfo_cate($dbinfo, $_GET['cateuid'], $sw_catelist,$dbinfo['enable_cate']?'':'(전체)'); // 카테고리 정보가 없다면 if(!$cateinfo['uid']) $cateinfo['title'] = '(전체)'; else { // redirect 유무 if($cateinfo['redirect']) go_url($cateinfo['redirect']); if($_GET['cateuid']==1){$cateinfo['selected1'] = "selected";} elseif($_GET['cateuid']==2){$cateinfo['selected2'] = "selected";} elseif($_GET['cateuid']==3){$cateinfo['selected3'] = "selected";} // 카테고리 정보에 따른 dbinfo 변수 변경 if($dbinfo['enable_cateinfo']=='Y') { if($cateinfo['bid']>0) $dbinfo['cid'] = $cateinfo['bid']; // 카테고리 관리자도 모든 권한을 if( $cateinfo['skin'] and is_file($thisPath.'skin/'.$cateinfo['skin'].'/list.html') ) $dbinfo['skin'] = $cateinfo['skin']; if($cateinfo['html_type']) { $dbinfo['html_type'] = $cateinfo['html_type']; if( $cateinfo['html_skin'] and is_file($SITE['html_path'].'index_'.$cateinfo['html_skin'].'.php') ) $dbinfo['html_skin'] = $cateinfo['html_skin']; $dbinfo['html_head'] = $cateinfo['html_head']; $dbinfo['html_tail'] = $cateinfo['html_tail']; } // 나머지 dbinfo값 일괄 변경 $aTmp = array('orderby' , 'pern' , 'row_pern' , 'page_pern' , 'cut_length' , 'enable_memo' , 'enable_vote' , 'enable_hidelevel' , 'enable_listreply' , 'enable_getinfo' , 'enable_getinfoskins', 'include_listphp', 'priv_list', 'priv_write', 'priv_modify', 'priv_memowrite' , 'priv_reply' , 'priv_read', 'priv_download' , 'priv_delete'); foreach($aTmp as $tmp_field) { if($cateinfo[$tmp_field]!==NULL) $dbinfo[$tmp_field] = $cateinfo[$tmp_field]; } } } // end if } // end if //=================== // 5. 권한 체크 if(!privAuth($dbinfo, 'priv_list',1)) back('페이지를 보실 권한이 없습니다.'); // 6. 넘어온 값에 따라 $dbinfo값 변경 if($dbinfo['enable_getinfo']=='Y') { if(isset($_GET['pern'])) $dbinfo['pern'] = (int)$_GET['pern']; if(isset($_GET['limitrows'])) $dbinfo['pern'] = (int)$_GET['limitrows']; if(isset($_GET['row_pern'])) $dbinfo['row_pern'] = (int)$_GET['row_pern']; if(isset($_GET['cut_length'])) $dbinfo['cut_length'] = (int)$_GET['cut_length']; // skin 변경 if( isset($_GET['skin']) and preg_match('/^[_a-z0-9]+$/',$_GET['skin']) and is_file($thisPath.'skin/'.$_GET['skin'].'/list.html') ) { if($dbinfo['enable_getinfoskins']) { // 특정 스킨만 get값으로 사용할 수 있도록 했다면 $aTmp = explode(',',$dbinfo['enable_getinfoskins']); foreach($aTmp as $v) { if($v == $_GET['skin']) $dbinfo['skin'] = $_GET['skin']; } } else $dbinfo['skin'] = $_GET['skin']; } // 사이트 해더테일 변경 if(isset($_GET['html_type'])) $dbinfo['html_type'] = $_GET['html_type']; if( isset($_GET['html_skin']) and preg_match('/^[_a-z0-9]+$/',$_GET['html_skin']) and is_file($SITE['html_path'].'index_'.$_GET['html_skin'].'.php') ) $dbinfo['html_skin'] = $_GET['html_skin']; } //====================== // 7. SQL문 where절 정리 //====================== $sql_where = $dbinfo['sql_where']; // init // 공지글 기능이 있다면 if($dbinfo['enable_type']=='Y') { $sql_where .= $sql_where ? ' and type="docu" ' : ' type="docu" '; } // 해당 카테고리와 서브카테고리 데이터만 볼려면 if(is_array($cateinfo['subcate_uid']) and count($cateinfo['subcate_uid']) ) { if($sql_where) $sql_where .= ' and '; $sql_where .= ' ( cateuid in ( ' . implode(',',$cateinfo['subcate_uid']) . ') ) '; } // 20130202_분류별 sql 지정 - 윤상근 추가 // 예전 원인표출양상결과일때.....작업했던거 if($_GET['data']) { $data123abcd = explode('_',$_GET['data']); if($data123abcd[0] && $data123abcd[1]) { if($sql_where) $sql_where .= ' and '; $sql_where .= ' data'.$data123abcd[0].' = "'.$data123abcd[1].'"'; } } //칠정으로 구분될때 긍정감성과 부정감성을 구분하여 셀렉트 if($_GET['data_pn']) { if($sql_where) $sql_where .= ' and '; $sql_where .= " `data_pn` = '".$_GET['data_pn']."'"; } // 서치 게시물만.. $_GET['sc_column']="title,content,content2,data4,data5,data6"; // 컬럼 선택 안해도 이러한 필드에서 검색되도록 - 윤상근 2015-05-16 추가 if($_GET['sc_string'] and $_GET['sc_column']) { // sc_column으로 title,content이면, or로 두필드 검색하도록 $aTemp = explode(',',$_GET['sc_column']); $tmp = ''; for($i=0;$i0) $tmp .= ' or '; switch($aTemp[$i]) { case 'bid': case 'uid': case 'userid': $tmp .=' (`'.$aTemp[$i].'`="'.db_str($_GET['sc_string']).'") '; break; default : // bug - sc_column 장난 우려 $tmp .=' (`'.$aTemp[$i].'` like "%'.db_str(preg_replace('/(%|_|\?)/','\\\\1',$_GET['sc_string'])).'%") '; // default : back('잘못된 요청입니다.'); } } // end for if($tmp) { if($sql_where) $sql_where .= ' and '; $sql_where .= ' ('.$tmp.') '; } } // 두번째 서치 elseif($_GET['sc_string2'] and $_GET['sc_column2']) { // sc_column으로 title,content이면, or로 두필드 검색하도록 $aTemp = explode(',',$_GET['sc_column2']); $tmp = ''; for($i=0;$i0) $tmp .= ' or '; switch($aTemp[$i]) { case 'bid': case 'uid': case 'userid': $tmp .=' (`'.$aTemp[$i].'`="'.db_str($_GET['sc_string2']).'") '; break; default : // bug - sc_column 장난 우려 $tmp .=' (`'.$aTemp[$i].'` like "%'.db_str(preg_replace('/(%|_|\?)/','\\\\1',$_GET['sc_string2'])).'%") '; // default : back('잘못된 요청입니다.'); } } // end for if($tmp) { if($sql_where) $sql_where .= ' and '; $sql_where .= ' ('.$tmp.') '; } } // 호남학연구원 감성DB에서만 쓰이는 종합검색- 검색어를 다양한 필드에서 찾아라 // 2014.12.16 윤상근 작업 elseif($_GET['sc_string'] and $_GET['sc_column_gamsung']) { $search_sql_field_word = array("`title`", "`content`", "`content2`"); $search_sql_field_like = " LIKE '%$sc_string%' "; $s_s_field_total = count($search_sql_field_word); for ($f=0;$f<$s_s_field_total;$f++){ if ($f > 0){$sql_or = " OR ";} $search_sql_field_all = $search_sql_field_all.$sql_or.$search_sql_field_word[$f].$search_sql_field_like; } $sql_where = $search_sql_field_all; /* // sc_column으로 다양한 필드를, or로 연결해서 검색하도록 $aTemp = explode(',',$_GET['sc_column2']); $tmp = ''; for($i=0;$i0) $tmp .= ' or '; switch($aTemp[$i]) { case 'bid': case 'uid': case 'userid': $tmp .=' (`'.$aTemp[$i].'`="'.db_str($_GET['sc_string2']).'") '; break; default : // bug - sc_column 장난 우려 $tmp .=' (`'.$aTemp[$i].'` like "%'.db_str(ereg_replace('(%|_|\?)','\\\\1',$_GET['sc_string2'])).'%") '; // default : back('잘못된 요청입니다.'); } } // end for if($tmp) { if($sql_where) $sql_where .= ' and '; $sql_where .= ' ('.$tmp.') '; }*/ } // 답변글 안보이기, 서치시에는 답변글 무조건 보이기 위해 서치의 elseif 씀 elseif($dbinfo['enable_listreply']!='Y') { $sql_where .= $sql_where ? ' and re="" ': ' re="" '; } // 비공개글 제외시킴 if($dbinfo['enable_hidelevel']=='Y') { //if($sql_where) $sql_where .= ' and '; if($_SESSION['seUid']) { $priv_hidelevel = $dbinfo['gid'] ? (int)$_SESSION['seGroup'][$dbinfo['gid']]['level'] : (int)$_SESSION['sePriv']['level']; //$sql_where .=" ( priv_hidelevel<=$priv_hidelevel or bid='$_SESSION[seUid]' ) "; } //else $sql_where .=' priv_hidelevel=0 '; } // end if if(!$sql_where) $sql_where= ' 1 '; // 값이 없다면 //=========================== // 8. SQL문 order by..절 정리 //=========================== $sql_orderby = $dbinfo['sql_orderby']; // init if($_GET['sort']) { switch($_GET['sort']) { // get 해킹을 막기 위해 특정 값에만 order by 생성 case 'uid': case 'title': case 'hit': case 'vote': case 'rdate': $sql_orderby = $_GET['sort']; break; case '!uid': case '!title': case '!hit': case '!vote': case '!rdate': $sql_orderby = substr($_GET['sort'],1).' DESC'; break; /* default : if($_GET[sort] and eregi('^[a-z0-9_]+$',$_GET[sort])) $sql_orderby = $_GET['sort']; */ } } if(!$sql_orderby) $sql_orderby = ' num DESC, re '; // 9. 페이지 나눔등 각종 카운트 구하기 $count['total']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE $sql_where LIMIT 1", 0, 'count(*)'); // 전체 게시물 수 $count=b3count_list($count['total'],$_GET['page'],$dbinfo['pern'],$dbinfo['page_pern']); // 각종 카운트 구하기 $count['today']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE (rdate > unix_timestamp(curdate())) and $sql_where LIMIT 1", 0, 'count(*)'); if ($dbinfo['db']=="allnewdb"){ $count['total_p']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `data_pn`='p' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_n']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `data_pn`='n' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_1']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='1' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_2']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='2' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_3']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='3' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_4']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='4' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_5']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='5' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_6']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='6' and $sql_where LIMIT 1", 0, 'count(*)'); $count['total_7']=db_resultone("SELECT count(*) FROM `$dbinfo[table]` WHERE `cateuid`='7' and $sql_where LIMIT 1", 0, 'count(*)'); } // 10. URL Link... $href['listdb'] = $dbinfo['thisUrl'].'list.php?db='.$dbinfo['db']; $href['list'] = $dbinfo['thisUrl'].'list.php?'.href_qs('page=',$qs_basic); if($count['nowpage'] > 1) { // 처음, 이전 페이지 $href['firstpage'] =$dbinfo['thisUrl'].'list.php?'.href_qs('page=1',$qs_basic); $href['prevpage'] =$dbinfo['thisUrl'].'list.php?'.href_qs('page='.($count['nowpage']-1),$qs_basic); } else { $href['firstpage'] ='javascript: void(0);'; $href['prevpage'] ='javascript: void(0);'; } if($count['nowpage'] < $count['totalpage']){ // 다음, 마지막 페이지 $href['nextpage'] =$dbinfo['thisUrl'].'list.php?'.href_qs('page='.($count['nowpage']+1),$qs_basic); $href['lastpage'] =$dbinfo['thisUrl'].'list.php?'.href_qs('page='.$count['totalpage'],$qs_basic); } else { $href['nextpage'] ='javascript: void(0);'; $href['lastpage'] ='javascript: void(0);'; } $href['prevblock']= ($count['nowblock']>1) ? $dbinfo['thisUrl'].'list.php?'.href_qs('page='.($count['firstpage']-1) ,$qs_basic): 'javascript: void(0)';// 이전 페이지 블럭 $href['nextblock']= ($count['totalpage'] > $count['lastpage'])? $dbinfo['thisUrl'].'list.php?'.href_qs('page='.($count['lastpage'] +1),$qs_basic) : 'javascript: void(0)';// 다음 페이지 블럭 $href['write'] = $dbinfo['thisUrl'].'write.php?' . href_qs('mode=write',$qs_basic); // 글쓰기 if(privAuth($dbinfo, 'priv_modify')) $dbinfo['canModify'] =1; if(privAuth($dbinfo, 'priv_delete')) $dbinfo['canDelete'] =1; //======================================================= // Start... (DB 작업 및 display) //======================================================= // 템플릿 기반 웹 페이지 제작 $skinfile=basename(__FILE__,'.php').'.html'; if( !is_file($thisPath.'skin/'.$dbinfo['skin'].'/'.$skinfile) ) $dbinfo['skin']='basic'; $tpl = new phemplate($thisPath.'skin/'.$dbinfo['skin']); // 템플릿 시작 $tpl->set_file('html',$skinfile,TPL_BLOCK); // 템플릿 기본 할당 $tpl->tie_var('get' ,$_GET); // get값으로 넘어온것들 $tpl->tie_var('dbinfo' ,$dbinfo); // dbinfo 정보 변수 $tpl->set_var('href' ,$href); // 게시판 각종 링크 $tpl->set_var('sort_'.$_GET['sort'],true); // sort_??? $tpl->set_var('mode_'.$_GET['mode'],true); // mode_??? $tpl->tie_var('count' ,$count); // 게시판 각종 카운트 $tpl->set_var('get.cateuid.'.$_GET[cateuid] ,true); $tpl->tie_var('cateinfo' ,$cateinfo);// cateinfo 정보 변수 $tpl->tie_var('config_info' ,$config_info);// config_info 정보 변수//윤상근추가 // 서치 폼의 hidden 필드 모두!! $form_search =' action="'.$dbinfo['thisUrl'].'list.php"'.' method="get">'; $form_search .= href_qs('sc_column=&sc_string=',$qs_basic,1); $form_search = substr($form_search,0,-1); $tpl->set_var('form_search' ,$form_search); // form actions, hidden fields // Limit로 필요한 게시물만 읽음. $limitno = isset($_GET['limitno']) ? (int)$_GET['limitno'] : $count['firstno']; $limitrows = isset($_GET['limitrows']) ? (int)$_GET['limitrows'] : $count['pern']; $sql = "SELECT * FROM `$dbinfo[table]` WHERE $sql_where ORDER BY $sql_orderby LIMIT $limitno,$limitrows"; $rs_list = db_query($sql); if(!$total=db_count($rs_list)) { // 게시물이 하나도 없다면... if($_GET['sc_string']) { // 서치시 게시물이 없다면.. $tpl->process('LIST', 'nosearch'); } else // 게시물이 없다면.. $tpl->process('LIST', 'nolist'); } else{ if($dbinfo['row_pern']<1 or !$tpl->get_var('cell')) $dbinfo['row_pern']=1; // 스킨에 cell 블럭이 없으면, row_pern을 1로 바꿈 for($i=0; $i<$total; $i+=$dbinfo['row_pern']) { if($dbinfo['row_pern'] > 1) { $tpl->drop_var('blockloop'); $tpl->drop_var('CELL'); } for($j=$i; $j-$i<$dbinfo['row_pern']; $j++) { // 한줄에 여러값 출력시 루틴 if( $j>=$total ) { if($dbinfo['row_pern'] > 1) $tpl->process('CELL','nocell',TPL_APPEND); continue; } $list = db_array($rs_list); $list['no'] = $count['lastnum']--; $list['rede'] = strlen($list['re']); if(!$list['title']) $list['title'] = '제목없음…'; //답변이 있을 경우 자리는 길이를 더 줄임 $cut_length = $list['rede'] ? $dbinfo['cut_length'] - $list['rede'] -3 : $dbinfo['cut_length']; $list['cut_title'] = cut_string($list['title'], $cut_length); // new image넣을 수 있게 .. if($list['rdate']>time()-3600*24) $list['enable_newicon']=true; else $list['enable_newicon']=false; // ------ 원인, 표출양상, 결과의 내용을 한글로 표기--20130203 윤상근 추가 // 예전꺼라서 주석처리함. /* $data_code = array('a','b','c','d'); if ($dbinfo['db']=="allnew1"){ $list['db_han'] = array('슬픔'); $data1_han = array('상실(失)','아픔(痛)','낙심(傷)','기대(比)'); $data2_han = array('우울(憂)','눈물(淚)','비탄(嘆)','울분(鬱)'); $data3_han = array('풀림(克)','풂(容)','삭임(昇)','엉킴(鬱,滯)'); } elseif ($dbinfo['db']=="allnew2"){ $list['db_han'] = array('분노'); $data1_han = array('모욕(辱)','좌절(折)','박탈(乏)','상실(失)'); $data2_han = array('노여움(怒)','미움(惡)','질투(妬)','분개(慨)'); $data3_han = array('풀림(克)','풂(容)','삭임(昇)','엉킴(鬱,滯)'); } elseif ($dbinfo['db']=="allnew3"){ $list['db_han'] = array('사랑'); $data1_han = array('자비(慈)','화목(和)','연정(戀)','인정(情)'); $data2_han = array('행복(幸)','기쁨(喜)','만족(滿)','원망(怨)'); $data3_han = array('풀림(克)','풂(容)','삭임(昇)','엉킴(鬱,滯)'); } for($k=0;$k\\0', $list['cut_title']); $list[$aTemp[$k]] = preg_replace("/$_GET[sc_string]/", '\\0', $list[$aTemp[$k]]); } } // 메모개수 구해서 제목 옆에 붙임 if($dbinfo['enable_memo']=='Y') { $sql = "select count(*) as count from $dbinfo[table]_memo where pid='$list[uid]'"; if($list['count_memo']=db_resultone($sql,0,'count')) { $sql = "select uid from $dbinfo[table]_memo where pid='$list[uid]' and rdate > unix_timestamp()-86400 LIMIT 1"; if(db_count(db_query($sql))) $list['cut_title'] .= ' ['.$list['count_memo'].']'; else $list['cut_title'] .= ' ['.$list['count_memo'].']'; } } // end if // 답변 게시물 답변 아이콘 표시 if($list['rede'] > 0) { //$list['cut_title'] = str_repeat(' ', $count_redespace*($list['rede']-1)) . ' '.$list['cut_title']; $list['cut_title'] = ' '.$list['cut_title']; } // 업로드파일 처리 if($dbinfo['enable_upload']!='N') { b3unserializeUpfile($list,$dbinfo['thisUrl'].'download.php'); } // 삭제, 수정 가능한지 $list['canModify'] = 0; if($dbinfo['canModify'] or ( 'nobid'!=substr($dbinfo['priv_modify'],0,5) and $list['bid']==$_SESSION['seUid'] ) ) { $list['canModify'] = 1; } $list['canDelete'] = 0; if($dbinfo['canDelete'] or ( 'nobid'!=substr($dbinfo['priv_delete'],0,5) and $list['bid']==$_SESSION['seUid'] ) ) { $list['canDelete'] = 1; } // URL Link... $list['href']['read'] = $dbinfo['thisUrl'].'read.php?' . href_qs('uid='.$list['uid'],$qs_basic); $list['href']['modify'] = $dbinfo['thisUrl'].'modify.php?' . href_qs('mode=modify&uid='.$list['uid'],$qs_basic); $list['href']['delete'] = $dbinfo['thisUrl'].'ok.php?' . href_qs('mode=delete&uid='.$list['uid'],$qs_basic); $list['href']['download'] = $dbinfo['thisUrl'].'download.php?' . href_qs("db=$dbinfo[db]&uid=$list[uid]",'uid='); // enable_hidelevel if($dbinfo['enable_hidelevel']=='Y' and $list[priv_hidelevel]) { if($priv_hidelevel < $list[priv_hidelevel] and $list[bid]!=$_SESSION[seUid]) $list[cut_title]=$list[title] = "비밀글입니다 $list[userid] 회원님만 보실 수 있습니다"; } // end if // 템플릿 할당 $tpl->set_var('list' , $list); if($dbinfo['row_pern'] > 1) { $tpl->process('CELL','cell',TPL_OPTIONAL|TPL_APPEND); $tpl->set_var('blockloop',true); // 업로드부분 템플릿내장값 지우기 $tpl->drop_var('list.upfiles',$list['upfiles']); } } // end for (j) if($i==0) $tpl->drop_var('blockloop'); else $tpl->set_var('blockloop',true); $tpl->process('LIST','list',TPL_OPTIONAL|TPL_APPEND); $tpl->drop_var('list',$list); } // end for (i) // 템플릿내장값 지우기 $tpl->drop_var('blockloop'); } // end if (게시물이 있다면...) if(!$_GET['limitrows']) { // 게시물 일부 보기에서는 카테고리, 블럭이 필요 없을 것임 // 블럭 : 카테고리(상위, 동일, 서브) 생성 if($dbinfo['enable_cate']=='Y') { if(is_array($cateinfo['highcate'])) { foreach($cateinfo['highcate'] as $key => $value) { $tpl->set_var('href.highcate',$dbinfo['thisUrl'].'list.php?'.href_qs('cateuid='.$key,$qs_basic)); $tpl->set_var('highcate.uid',$key); $tpl->set_var('highcate.title',$value); $tpl->process('HIGHCATE','highcate',TPL_OPTIONAL|TPL_APPEND); $tpl->set_var('blockloop',true); } $tpl->drop_var('blockloop'); } // end if if(is_array($cateinfo['samecate'])) { foreach($cateinfo['samecate'] as $key => $value) { if($key==$cateinfo['uid']) $tpl->set_var('samecate.selected',' selected '); else $tpl->set_var('samecate.selected',''); $tpl->set_var('href.samecate',$dbinfo['thisUrl'].'list.php?'.href_qs('cateuid='.$key,$qs_basic)); $tpl->set_var('samecate.uid',$key); $tpl->set_var('samecate.title',$value); $tpl->process('SAMECATE','samecate',TPL_OPTIONAL|TPL_APPEND); $tpl->set_var('blockloop',true); } $tpl->drop_var('blockloop'); } // end if if(is_array($cateinfo['subcate'])) { foreach($cateinfo['subcate'] as $key => $value) { // subsubcate... $tpl->drop_var('SUBSUBCATE'); if(is_array($cateinfo['subsubcate'][$key])) { $blockloop = $tpl->get_var('blockloop'); $tpl->drop_var('blockloop'); foreach($cateinfo['subsubcate'][$key] as $subkey => $subvalue) { $tpl->set_var('href.subsubcate',$dbinfo['thisUrl'].'list.php?'.href_qs('cateuid='.$subkey,$qs_basic)); $tpl->set_var('subsubcate.uid',$subkey); $tpl->set_var('subsubcate.title',$subvalue); $tpl->process('SUBSUBCATE','subsubcate',TPL_OPTIONAL|TPL_APPEND); $tpl->set_var('blockloop',true); } $tpl->set_var('blockloop',$blockloop); } // end if $tpl->set_var('href.subcate',$dbinfo['thisUrl'].'list.php?'.href_qs('cateuid='.$key,$qs_basic)); $tpl->set_var('subcate.uid',$key); $tpl->set_var('subcate.title',$value); $tpl->process('SUBCATE','subcate',TPL_OPTIONAL|TPL_APPEND); $tpl->set_var('blockloop',true); } $tpl->drop_var('blockloop'); } // end if } // end if // 블럭 : 첫페이지, 이전페이지 if($count['nowpage'] > 1) { $tpl->process('FIRSTPAGE','firstpage'); $tpl->process('PREVPAGE','prevpage'); } else { $tpl->process('FIRSTPAGE','nofirstpage'); $tpl->process('PREVPAGE','noprevpage'); } // 블럭 : 페이지 블럭 표시 // <-- (이전블럭) 부분 if ($count['nowblock']>1) $tpl->process('PREVBLOCK','prevblock'); else $tpl->process('PREVBLOCK','noprevblock'); // 1 2 3 4 5 부분 for ($i=$count['firstpage'];$i<=$count['lastpage'];$i++) { $tpl->set_var('blockcount',$i); if($i==$count['nowpage']) $tpl->process('BLOCK','noblock',TPL_APPEND); else { $tpl->set_var('href.blockcount', $dbinfo['thisUrl'].'list.php?'.href_qs('page='.$i,$qs_basic) ); $tpl->process('BLOCK','block',TPL_APPEND); } } // end for // --> (다음블럭) 부분 if ($count['totalpage'] > $count['lastpage'] ) $tpl->process('NEXTBLOCK','nextblock'); else $tpl->process('NEXTBLOCK','nonextblock'); // 블럭 : 다음페이지, 마지막 페이지 if($count['nowpage'] < $count['totalpage']) { $tpl->process('NEXTPAGE','nextpage'); $tpl->process('LASTPAGE','lastpage'); } else { $tpl->process('NEXTPAGE','nonextpage'); $tpl->process('LASTPAGE','nolastpage'); } } // end if // 블럭 : 글쓰기 if(privAuth($dbinfo, 'priv_write')) $tpl->process('WRITE','write'); else $tpl->process('WRITE','nowrite'); // 블럭 : 칠정이냐 감성분류냐에 따른 메뉴 구별 출력 // 윤상근 추가 if ($_GET['cate_sort']=="7_pn") $tpl->process('NOWMENU','nowmenu_7_pn'); else $tpl->process('NOWMENU','nowmenu_pn_7'); //if($cateuid || $db=='board2') $tpl->process('WRITE','write'); //else $tpl->process('WRITE','nowrite'); //=============================================== // $dbinfo[include_listphp]에 따라서 모듈 include //=============================================== // - 공지글보기이면 무조건 list_info.php 실행 if($dbinfo['enable_type']=='Y' and strlen($_GET['sc_string'])==0 and $_GET['limitrows']<1) { @include_once($thisPath . 'list_info.php'); } if(trim($dbinfo['include_listphp'])) { $aInclude = explode(',',$dbinfo['include_listphp']); foreach($aInclude as $value) { if($value=='info') continue; if( preg_match('/^[a-z0-9_-]+$/',$value) and is_file($thisPath.'list_'.$value.'php') ) @include_once($thisPath.'list_'.$value.'php'); } } //=============================================== // 마무리 $tpl->echoHtml($dbinfo, $SITE, $dbinfo['thisUrl']); ?>