get["p"]= Util::argStrip($this->get["p"],Util::ARG_NUMBERIC); $this->req["no"]= Util::argStrip($this->req["no"],Util::ARG_NUMBERIC); $this->get["no"]= Util::argStrip($this->get["no"],Util::ARG_NUMBERIC); $this->get["m"]= Util::argStrip($this->get["m"],Util::ARG_ALPHARIC); $this->get["p"] = ($this->get["p"] <= 0 )? 1: $this->get["p"]; $this->get["bid"]= Util::argStrip($this->get["bid"],Util::ARG_ALPHARIC); $this->config = $this->cnf->board; $this->output['config'] = $this->config; $this->config_base = $this->cnf->base; $this->output['config_base'] = $this->config_base; $this->output["bid"] = $this->get['bid']; $this->output["link"] = &$this->makeLink(); // 타이틀 $brdTitle = $this->config_base['cate'][$this->get['bid']]; $this->output['brd_title']= ($brdTitle == NULL) ? $this->config_base['menu_txt'][1] : $brdTitle; // 사이트번호 //$this->siteNo = ($this->get['bid'] == 1) ? 3 : $this->config_base['site_no']; $this->output["mobileChk"] = Util::isMobile(); } protected function run() { switch($this->get["m"]) { case "like": $this->setLike(); break; case "v": $this->view(); break; case "l": default: $this->getList(); break; } } private function makeLink() { return array( "view"=>$_SERVER['PHP_SELF']."?m=v&p=".$this->get['p']."&bid=".$this->get['bid']."&no=", "list"=>$_SERVER['PHP_SELF']."?m=i&p=".$this->get['p']."&bid=".$this->get['bid'], "back"=>"javascript:history.back()", ); } private function getList() { $this->output['head']['base'] = $this->html->getHead(array("")); $tbl = $this->cnf->tables['board']; $fields = "*"; $_where = array(); //$_where[] = "b_site = ".$this->siteNo; if($this->get['bid'] == NULL) { $_where[] = "(b_cate=4 OR b_cate=1 OR b_cate=6 OR b_cate=9)"; } else { $_where[] = "b_cate=".$this->get['bid']; } ($this->get['q'] == NULL) ? NULL : $_where[] ="b_title LIKE '%".trim($this->get['q'])."%'"; $where = implode(" AND ", $_where); $groupby = NULL; $sort = "b_no DESC"; $res = $this->brd->getList($tbl, $fields, $where, $groupby, $sort, $this->get["p"],$this->config["listNum"]); $url_format=$_SERVER['PHP_SELF'] ."?". Util::makeGetLink($this->get, array("m","bid")) . "&p=%d"; $this->output["total"]=$res["total"]; $this->output["list"]=$res["list"]; # 페이징 $this->output['page'] = $this->page->makePageLink($url_format, $this->get["p"], ceil($res["total"] / $this->config["listNum"]), 7); // 우측 게시물 $this->output['rList']= $this->brd->getListRight(); // 메타 셋 $this->output['meta_subject']= $this->output['brd_title']." | ".$this->config_base['site_name']; $this->output['meta_desc']= ""; $this->output['meta_icon']= ""; $this->files['body'] = "brd_list.html"; } private function view() { $this->output['head']['base'] = $this->html->getHead(array("")); if($this->get['no'] == NULL) { $this->js->redirect("/"); exit; } $res = $this->brd->getView($this->get['no']); $this->output['res'] = $res; $no = $res['b_no']; // 우측 게시물 $this->output['rList']= $this->brd->getListRight(); // 이미지 목록 $imgList = $this->brd->getImageList(array($res['b_no'])); $this->output['img_list'] = $imgList[$res['b_no']]; // 메타 셋 $this->output['meta_subject']= trim($res['b_title'])." | ".$this->config_base['site_name']; $_meta_rtext = preg_replace("/\s+/","", strip_tags($res['b_rtext'])); if(strlen($_meta_rtext) > 5) { $this->output['meta_desc']= trim($this->string->stringCut(strip_tags($res['b_rtext']), 200, "" )); } else { $this->output['meta_desc']= ""; } $this->output['meta_icon']= $res['b_thumbnail']== NULL ? NULL : $this->config_base['img_thumb_dir']."/".date("Ym",strtotime($res['b_rdate']))."/".$res['b_thumbnail']; $this->output['meta_url']= $this->config_base['site_url'].$_SERVER['REQUEST_URI']; // 리스트 $tbl = $this->cnf->tables['board']; $fields = "*"; $_where = array(); //$_where[] = "b_site = ".$this->siteNo; //$_where[] = "b_cate = ".$this->get['bid']; if($this->get['bid'] == NULL) { $_where[] = "(b_cate=4 OR b_cate=1 OR b_cate=6 OR b_cate=9)"; } else { $_where[] = "b_cate=".$this->get['bid']; } $where = implode(" AND ", $_where); $groupby = NULL; $sort = "b_no DESC"; $list = $this->brd->getList($tbl, $fields, $where, $groupby, $sort, $this->get["p"],$this->config["listNum_sub"]); $url_format=$_SERVER['PHP_SELF'] ."?". Util::makeGetLink($this->get, array("bid")) . "&p=%d"; $this->output["total"]=$list["total"]; $this->output["list"]=$list["list"]; # 페이징 $this->output['page'] = $this->page->makePageLink($url_format, $this->get["p"], ceil($list["total"] / $this->config["listNum_sub"]), 7); $this->output["head"]["script"] =<<<__EOT__ __EOT__; // 이전 다음글 보기 시작 $_pnNoWhereCommon = array(); //$_pnNoWhereCommon[] = "b_site=".$this->siteNo; if($this->get['bid'] == NULL) { $_pnNoWhereCommon[] = "(b_cate=3 OR b_cate=1 OR b_cate=6 OR b_cate=9)"; } else { $_pnNoWhereCommon[] = "b_cate=".$this->get['bid']; } $pnNoWhereCommon = implode(" AND ", $_pnNoWhereCommon); $prevNo= $this->brd->getPrevNo($pnNoWhereCommon." AND b_no < ".$res['b_no']); $nextNo= $this->brd->getNextNo($pnNoWhereCommon." AND b_no > ".$res['b_no']); if($prevNo['no'] == NULL) { $this->output['link']['prev'] = "javascript:alert('ⓘ 처음 게시물 입니다.')"; $this->output['title']['prev'] = ""; } else { $this->output['link']['prev'] = $this->output['link']['view'].$prevNo['no']; $this->output['title']['prev'] = $prevNo['b_title']; } if($nextNo['no'] == NULL) { $this->output['link']['next'] = "javascript:alert('ⓘ 마지막 게시물 입니다.')"; $this->output['title']['next'] = ""; } else { $this->output['link']['next'] = $this->output['link']['view'].$nextNo['no']; $this->output['title']['next'] = $nextNo['b_title']; } // 이전 다음글 보기 여기까지 $this->files['body'] = "brd_view.html"; } private function setLike() { $this->display = false; $no= Util::argStrip($this->post["no"],Util::ARG_ALPHARIC); $tp= Util::argStrip($this->post["tp"],Util::ARG_ALPHARIC); if($this->post['no'] == NULL || $this->post['tp'] == NULL) { print 201; exit; } if($this->brd->setLikeHate($no, $tp)) { print 101; exit; } else { print 202; exit; } } protected function finalize() { } } new Application();