set_filenames(array("body" => $html_file)); $start = formatstring((isset($_REQUEST['start'])) ? $_REQUEST['start'] : 0); $pagerow = 20; $bhxh = $prefix.'announce'; $prefix_table = "announce_"; $menu1 = $prefix.'menu_1'; $menu2 = $prefix.'menu_2'; $id_table = $thongbao; $dir = "uploadfile/thongbao/"; $id = $_REQUEST['value'] + 0; if(isset($_REQUEST['value'])) { $sql = "select * from ".$menu2." where menu_2_id = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2"); $row = $db->sql_fetchrowset($result); $template->assign_block_vars("bhxh", array( "NAME" => $row[0]['menu_2_name'], )); $sql = "select * from ".$menu2." where menu_2_sub = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2"); $row = $db->sql_fetchrowset($result) ; if(count($row)>0) { $template->assign_block_vars("bhxh.list", array()); for ($i=0 ; $iassign_block_vars("bhxh.list.menu_1", array( "NAME" => $row[$i]['menu_2_name'], "LINK" => ($row[$i]['menu_2_link'] == "")?($row[$i]['menu_1_link']."?value=".$row[$i]['menu_2_id']):$row[$i]['menu_2_link'], )); } } else { if(CheckSecurity($id, $security)) { if(isset($_SESSION['user'])) { $sql = "select * from ".$bhxh." where announce_group = '".$id."' order by right(announce_reg_sign,4) DESC, left(right(announce_reg_sign,7),2) DESC, left(announce_reg_sign,2) DESC"; $tmp_sql = $sql; $sql.=" limit ".$start.",".$pagerow; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce 1"); $record = $db->sql_fetchrowset($result); if(count($record) > 0) { $template->assign_block_vars("bhxh.record", array()); for ($i=0 ; $iassign_block_vars("bhxh.record.row", array( "ID" => $record[$i]['announce_id'], "LINK" => $php_file."?id=".$record[$i]['announce_id'], "TITLE" => $record[$i]['announce_title'], "CONTENT" => $record[$i]['announce_content'], "REG" => $record[$i]['announce_reg'], )); } // phan trang $result = $db->sql_query($tmp_sql) ; $row = $db->sql_numrows($result) ; $numpage = (int)($row/$pagerow); if($row > $pagerow) $numpage = (($row % $pagerow) > 0) ? $numpage + 1 : $numpage ; if ( $numpage > 1 ) { $page = "" ; for ( $i = 1 ; $i <= $numpage ; $i++ ) { if ( $i * $pagerow == $start + $pagerow) { $page .="".$i."" ; } else { $start1 = $i * $pagerow - $pagerow ; $page .= "".$i."  " ; } } } if ( $start < $row-$pagerow ) { $next = $start + $pagerow ; $page .= " ".$xemtiep."" ; } if($numpage>1) $template->assign_block_vars("bhxh.record.page",array( "PAGE" => $page) ) ; /// phan trang } else { $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alert, )); } } else { $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alertsecurity, )); } } else { $sql = "select * from ".$bhxh." where announce_group = '".$id."' order by announce_id DESC"; $tmp_sql = $sql; $sql.=" limit ".$start.",".$pagerow; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce 2"); $record = $db->sql_fetchrowset($result); if(count($record) > 0) { $template->assign_block_vars("bhxh.record", array()); for ($i=0 ; $iassign_block_vars("bhxh.record.row", array( "ID" => $record[$i]['announce_id'], "LINK" => $php_file."?id=".$record[$i]['announce_id'], "TITLE" => $record[$i]['announce_title'], "CONTENT" => $record[$i]['announce_content'], "REG" => $record[$i]['announce_reg'], )); } // phan trang $result = $db->sql_query($tmp_sql) ; $row = $db->sql_numrows($result) ; $numpage = (int)($row/$pagerow); if($row > $pagerow) $numpage = (($row % $pagerow) > 0) ? $numpage + 1 : $numpage ; if ( $numpage > 1 ) { $page = "" ; for ( $i = 1 ; $i <= $numpage ; $i++ ) { if ( $i * $pagerow == $start + $pagerow) { $page .="".$i."" ; } else { $start1 = $i * $pagerow - $pagerow ; $page .= "".$i."  " ; } } } if ( $start < $row-$pagerow ) { $next = $start + $pagerow ; $page .= " ".$xemtiep."" ; } if($numpage>1) $template->assign_block_vars("bhxh.record.page",array( "PAGE" => $page) ) ; /// phan trang } else { $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alert, )); } } } } else if(isset($_REQUEST['id'])) { $id = $_REQUEST['id'] + 0; $sql = "select * from ".$bhxh." inner join ".$menu2 ." on ".$prefix_table."group = menu_2_id where announce_id = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce"); $row = $db->sql_fetchrowset($result); if(count($row) > 0) { if(CheckSecurity($row[0][$prefix_table.'group'], $security)) { if(isset($_SESSION['user'])) { $template->assign_block_vars("view", array( "id" => $row[0][$prefix_table.'id'], "title" => $row[0][$prefix_table.'title'], "detail" => $row[0][$prefix_table.'detail'], "date" => $row[0][$prefix_table.'reg'], "content" => $row[0][$prefix_table.'content'], )); if((strlen($row[0][$prefix_table.'attach_doc']) > 0) || (strlen($row[0][$prefix_table.'attach_xls']) > 0) || (strlen($row[0][$prefix_table.'attach_pdf']) > 0)) { $template->assign_block_vars("view.attach", array( "name" => $attach, )); if(strlen($row[0][$prefix_table.'attach_doc']) > 0) $template->assign_block_vars("view.attach.doc", array( "file" => ('download.php?fd=3&file=1&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_xls']) > 0) $template->assign_block_vars("view.attach.xls", array( "file" => ('download.php?fd=3&file=2&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_pdf']) > 0) $template->assign_block_vars("view.attach.pdf", array( "file" => ('download.php?fd=3&file=3&id='.$id), )); } } else { $template->assign_block_vars("bhxh", array("NAME" => $row[0]['menu_2_name'], )); $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alertsecurity, )); } } else { $template->assign_block_vars("view", array( "id" => $row[0][$prefix_table.'id'], "title" => $row[0][$prefix_table.'title'], "detail" => $row[0][$prefix_table.'detail'], "date" => $row[0][$prefix_table.'reg'], "content" => $row[0][$prefix_table.'content'], )); if((strlen($row[0][$prefix_table.'attach_doc']) > 0) || (strlen($row[0][$prefix_table.'attach_xls']) > 0) || (strlen($row[0][$prefix_table.'attach_pdf']) > 0)) { $template->assign_block_vars("view.attach", array( "name" => $attach, )); if(strlen($row[0][$prefix_table.'attach_doc']) > 0) $template->assign_block_vars("view.attach.doc", array( "file" => ('download.php?fd=2&file=1&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_xls']) > 0) $template->assign_block_vars("view.attach.xls", array( "file" => ('download.php?fd=2&file=2&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_pdf']) > 0) $template->assign_block_vars("view.attach.pdf", array( "file" => ('download.php?fd=2&file=3&id='.$id), )); } } } else { $template->assign_block_vars("bhxh", array()); $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alert, )); } } else { $sql = "select * from ".$menu1." inner join ".$menu2." on ".$menu1.".menu_1_id = ".$menu2.".menu_1_id where ".$menu1.".menu_1_id = '".$id_table."' and menu_2_sub = '0'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce"); $row = $db->sql_fetchrowset($result) ; $template->assign_block_vars("bhxh", array( "NAME" => $row[0]['menu_1_name'], )); if(count($row) > 0) { $template->assign_block_vars("bhxh.list", array()); for ($i=0 ; $iassign_block_vars("bhxh.list.menu_1", array( "NAME" => $row[$i]['menu_2_name'], "LINK" => ($row[$i]['menu_2_link'] == "")?($row[$i]['menu_1_link']."?value=".$row[$i]['menu_2_id']):$row[$i]['menu_2_link'], )); } } } $template->pparse("body"); include('include/right.php') ; include('include/page_footer.php') ; ?>