session_start();
if($_SESSION['infoAdmin']) {
define ('_PHPINFOBOARD_PATH', '.') ;
include("./lib/config.php");
$sHTML= "" ;
$sText = "" ;
$sAction = "" ;
function ArrWords($arrTemp){
$temp = "" ;
for($i=0; $i <= count($arrTemp)-1; $i++) {
$temp=$temp.$arrTemp[$i] ;
if ($i != count($arrTemp)-1) $temp=$temp.",";
}
return ( $temp ) ;
}
if(!isset($_POST['aEdit'])) $aEdit = ''; else $aEdit = $_POST['aEdit'] ;
if($aEdit != '') {
if (!is_writable("./$dataDir/wConfig.php")) {
echo "
ไฟล์ (wConfig.php) ไม่สามารถเขียนบันทึกได้
" ;
exit() ;
}else{
$aFile=fopen("./$dataDir/wConfig.php","w");
fputs($aFile ,"\r\n");
fputs($aFile ,"if (_INFOBOARD_INDEX != 'TRUE') exit() ;\r\n");
fputs($aFile ,"\$infoSite = \"".$_POST['infoSite']."\" ;\r\n");
fputs($aFile ,"\$infoTitle = \"".$_POST['infoTitle']."\" ;\r\n");
fputs($aFile ,"\$infomailMaster = \"".$_POST['infomailMaster']."\" ;\r\n");
fputs($aFile ,"\$dataDir = \"".$_POST['dataDir']."\" ;\r\n");
fputs($aFile ,"\$PostTopic = ".$_POST['PostTopic']." ;\r\n");
fputs($aFile ,"\$showtopic = ".$_POST['showtopic']." ;\r\n");
fputs($aFile ,"\$infoTarget = \"".$_POST['infoTarget']."\" ;\r\n");
fputs($aFile ,"\$infoCoverLink = \"".$_POST['infoCoverLink']."\" ;\r\n");
if ($_POST['infoUpload'] !="") {
fputs($aFile ,"\$infoUpload = ".$_POST['infoUpload']." ;\r\n");
}else{
fputs($aFile ,"\$infoUpload = 0 ;\r\n");
}
fputs($aFile ,"\$file_Maxsize = \"".($_POST['file_Maxsize']*1024)."\" ;\r\n");
fputs($aFile ,"\$file_Ext = array(\"".eregi_replace(",", Chr(34).", ".Chr(34), $_POST['file_Ext'])."\") ;\r\n");
if ($_POST['infoPostMem'] !="") {
fputs($aFile ,"\$infoPostMem = ".$_POST['infoPostMem']." ;\r\n");
}else{
fputs($aFile ,"\$infoPostMem = 0 ;\r\n");
}
fputs($aFile ,"\$infoWords = array(\"".eregi_replace(",", Chr(34).", ".Chr(34), $_POST['infoWords'])."\") ;\r\n");
fputs($aFile ,"\$badChars = array(\"".eregi_replace(",", Chr(34).", ".Chr(34), $_POST['badChars'])."\") ;\r\n");
fputs($aFile ,"\$hour = ".$_POST['hour']." ;\r\n");
fputs($aFile ,"\$min = ".$_POST['min']." ;\r\n");
fputs($aFile ,"\$Year = ".$_POST['Year']." ;\r\n");
fputs($aFile ,"\$thaimonth = array(\"".eregi_replace(",", Chr(34).", ".Chr(34), $_POST['thaimonth'])."\") ;\r\n");
if ($_POST['ipShow'] !="") {
fputs($aFile ,"\$ipShow = ".$_POST['ipShow']." ;\r\n");
}else{
fputs($aFile ,"\$ipShow = 0 ;\r\n");
}
fputs($aFile ,"\$infoCode = \"".$infoCode."\" ;\r\n");
fputs($aFile ,"\$infoDatCode = substr(\$infoCode, 2, 5).\"dat\" ;\r\n");
fputs($aFile ,"?>\r\n");
fclose($aFile);
unset($aFile) ;
$sText = "
แก้ไขเรียบร้อยแล้ว
" ;
$sAction = "true" ;
} // writable
}
if ($sAction == "true") {
$sHTML= $sText ;
}else{
$sHTML= $sHTML.$sText ;
if ($infoUpload ==1) $aUpload = "checked=\"checked\"" ;
if ($infoPostMem ==1) $aPostMem = "checked=\"checked\"" ;
if ($ipShow ==1) $aIP = "checked=\"checked\"" ;
if ($infoTarget == "_blank") {
$sTarget = "selected=\"selected\"" ;
$iTarget = "" ;
}else{
$sTarget = "" ;
$iTarget = "selected=\"selected\"" ;
}
$sHTML= $sHTML."
\n
\n" ;
}
require_once "./lib/template.php";
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile( $viewTemplate, true, true);
$tpl->setVariable("infoScript", "./") ;
$tpl->setVariable("infoTitle", "ADMIN") ;
$tpl->setVariable("infoWebBoard", $sHTML) ;
$tpl->show();
unset($sHTML) ;
}else{
header("Location: ./admin.php");
} //$_SESSION['infoAdmin']
?>