<?
$C_126cmsadmin_tname = 'center_config';

include(dirname(__FILE__)."/global.php");









$filename="../../data/config.php"; //核心设置文件

$article_auto_config_filename="../../data/article_auto_config.php"; //文章自动更新设置文件

$statcodFile = '../../126cmsjs/count.js';//第三方统计代码文件


@$job = $submitted_vars["job"];

if($job == "modify"){

  include( $filename );//取得 数组 $webdb
  
  $_webdbs = $_POST['webdbs'];
  $_webdbs['ifmakeindexhtml'] = $_POST['ifmakeindexhtml'];
  
  $webdbs = array_merge($webdb, $_webdbs);//合并数据有相同的后面替换前面
    
  $writefile="<?php	\r\n";
  $i = 0;
  foreach($webdbs AS $key=>$value){
  $i++;
  //$value=addslashes($value);
  $writefile.="\$webdb['$key']='$value';\r\n";
  }
 
  $query    =   updatetofile("$filename","$writefile");
	  
  if ($query)
     {
       $showmsg = "核心设置修改成功！";
	   $formurl = "config.php";
     }
  else
     {
       $showmsg = "核心设置修改失败！";
	   $formurl = "config.php";
     }
  
  
  
	//修改第三方统计代码文件
	$webdbs['statcode'] = stripslashes($webdbs['statcode']);
	$webdbs['statcode'] = str_replace('"','\"',$webdbs['statcode']);
	$str_statcod[] = explode("\r\n",$webdbs['statcode']);
	for( $i=0 ; $i<count($str_statcod[0]) ; $i++ ){
		$_str_statcod .= 'document.writeln("'.$str_statcod[0][$i].'");'."\r\n";
	}
	updatetofile("$statcodFile",$_str_statcod);
  	
	
	
	//记录文章总的自动更新数
	$e = file ($article_auto_config_filename);
	$article_auto = unserialize($e['0']);
	
	$article_auto['autoAllNum'] = $webdbs['autoAllNum'];
	
	$_article_auto=serialize($article_auto);
	
	$query    =   updatetofile("$article_auto_config_filename","$_article_auto");


	 
  include('showmsg.php');
  exit;

  
}

//从数据库中读出 产品的内容
require("$filename");

  foreach($webdb AS $key=>$value){
  $value=stripslashes($value);
  $webdbs[$key]=$value;
  }
  

?><!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=gb2312" />
<title>后台管理</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	text-decoration: none;
	color: #000000;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: underline;
	color: #FF0000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style></head>

<body>
<div align="center" class="font12">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#A4B6D7">
    <tr>
      <td width="100%" height="22" align="center" background="images/titlebg.jpg">&nbsp;</td>
    </tr>
  </table>
  <br />
  <table width="100%" height="25" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td align="left" bgcolor="#FFFFFF"> [<a href="config.php" class="a_bt">网站核心设置</a>] [<a href="configIndex.php" class="a_bt">首页设置</a>] [<a href="delCache.php" class="a_bt">清除缓存</a>]      </td>
    </tr>
  </table>
  <br />
  <br />
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tr>
      <td height="22" align="left" class="head">网站核心设置</td>
    </tr>
    <tr>
      <td height="24" align="left">
	  <form id="form1" name="form1" method="post" action="">
	  <table width="99%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table2">
        <tr>
          <td width="26%" height="28" bgcolor="#FFFFFF">网站名称1(显示在title里) </td>
          <td width="74%" bgcolor="#FFFFFF"><input name="webdbs[sitename1]" id="webdbs[sitename1]" value="<?=$webdbs['sitename1']?>" size="50" /></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网站名称2(显示在导航里)</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[sitename2]" id="webdbs[sitename2]" value="<?=$webdbs['sitename2']?>" size="50" /></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网站热点关键词</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[sitekeywords]" id="webdbs[sitekeywords]" value="<?=$webdbs['sitekeywords']?>" size="50" /></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网站描述</td>
          <td bgcolor="#FFFFFF"><textarea name="webdbs[sitedescription]" cols="60" rows="4" id="webdbs[sitedescription]"><?=$webdbs['sitedescription']?></textarea></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网站默认风格</td>
          <td bgcolor="#FFFFFF">
		  <select name="webdbs[style]">
            <option value="">选择风格</option>
			<?
			
$dh=opendir("../../data/style/");
while ($stylefile=readdir($dh)) {
        if (($stylefile!=".") && ($stylefile!="..") && ($stylefile!="") && ($stylefile!="Thumbs.db")){
		
            require("../../data/style/".$stylefile);
		    echo "<option value=\"".$styledb['keywords']."\"";
			if( $webdbs['style'] == $styledb['keywords'] ) echo ' selected="selected"';
			echo ">".$styledb['name']."</option>    \n";
            		
		}
}
closedir($dh);

             ?>
          </select>		  </td>
        </tr>
        <!--<tr>
          <td height="28" bgcolor="#FFFFFF">网站首页专用风格</td>
          <td bgcolor="#FFFFFF"><select name="webdbs[index_style]" id="webdbs[index_style]">
            <option value="" selected="selected">选择风格</option>
            <option value="default">官方风格</option>
          </select>
如果不选择,将依照上面的风格为标准</td>
        </tr>//-->
        <!--<tr>
          <td height="28" bgcolor="#FFFFFF">文章伪原创功能</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[NewsWYC]" value="1" <? if($webdbs['NewsWYC'] == 1) echo 'checked';?> />
开启
  <input name="webdbs[NewsWYC]" type="radio" value="0" <? if($webdbs['NewsWYC'] == 0) echo 'checked';?> />
关闭</td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">关键词站群功能</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[KeyZQ]" value="1" <? if($webdbs['KeyZQ'] == 1) echo 'checked';?> />
开启
  <input name="webdbs[KeyZQ]" type="radio" value="0" <? if($webdbs['KeyZQ'] == 0) echo 'checked';?> />
关闭</td>
        </tr>
		<tr>
          <td height="28" bgcolor="#FFFFFF">英文翻译功能</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[NewsFY]" value="1" <? if($webdbs['NewsFY'] == 1) echo 'checked';?> />
开启
  <input name="webdbs[NewsFY]" type="radio" value="0" <? if($webdbs['NewsFY'] == 0) echo 'checked';?> />
关闭</td>
        </tr>
		<tr>
          <td height="28" bgcolor="#FFFFFF">文章关键字提取功能</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[NewsKey]" value="1" <? if($webdbs['NewsKey'] == 1) echo 'checked';?> />
开启
  <input name="webdbs[NewsKey]" type="radio" value="0" <? if($webdbs['NewsKey'] == 0) echo 'checked';?> />
关闭</td>
        </tr>
		//-->
		
        <tr>
          <td height="28" bgcolor="#FFFFFF">整站访问网址</td>
          <td bgcolor="#FFFFFF"><input size="50" value="<?=$webdbs['www_url']?>" name="webdbs[www_url]" />
(非常重要,请正确填写) </td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">主页是否生成静态</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="ifmakeindexhtml" value="Y" <? if($webdbs['ifmakeindexhtml']=='Y') echo 'checked';?> onclick="ifmakeindex('1')"> 生成主页静态 
        <input type="radio" name="ifmakeindexhtml" value="N" <? if($webdbs['ifmakeindexhtml']=='N') echo 'checked';?> onclick="ifmakeindex('0')"> 不生成主页静态
		<span id="makeindexdiv"><br>
          自动生成静态的时间间隔: <input  id="MakeIndexHtmlTimeinput"  type='text' size='10' value='<?=$webdbs['MakeIndexHtmlTime']?>' name='webdbs[MakeIndexHtmlTime]'>
          单位(分钟)<br>
        <font color="#999999">留空或为0时,不生成静态,一般强烈推荐,可以大大加快首页的访问速度,此时你的服务器配置尽量设置成index.htm的访问优先级高于index.php</font></span> 
        <SCRIPT LANGUAGE="JavaScript">
<!--
function ifmakeindex(t){
	if(t=='0'||t==''){
		document.getElementById("makeindexdiv").style.display='none';
	}
	else{
		document.getElementById("makeindexdiv").style.display='';
		v=document.getElementById("MakeIndexHtmlTimeinput").value;
		if(v==''||v=='0'){
			document.getElementById("MakeIndexHtmlTimeinput").value='600';
		}
	}
}
ifmakeindex('<? if($webdbs['ifmakeindexhtml']=='N') echo '0'; else echo $webdbs['MakeIndexHtmlTime'];?>');
//-->
</SCRIPT></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">文章是否生成真静态</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[NewsMakeHtml]" value="0" <? if($webdbs['NewsMakeHtml'] == 0) echo 'checked';?>>
        不生成静态 
        <input type="radio" name="webdbs[NewsMakeHtml]" value="1" <? if($webdbs['NewsMakeHtml'] == 1) echo 'checked';?>>
        生成真静态 
        <input type="radio" name="webdbs[NewsMakeHtml]" value="2" <? if($webdbs['NewsMakeHtml'] == 2) echo 'checked';?>>
        伪静态 <br>
        <font color="#666666">(如果你选择生成真静态的话,请确保“静态网页管理”那里,已把整站所有文章生成静态,否则页面访问不正常)</font></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">开启大文件上传</td>
          <td bgcolor="#FFFFFF"><input type="radio" name="webdbs[bigFileSet]" value="1" <? if($webdbs['bigFileSet'] == 1) echo 'checked';?>>
        开启
        <input type="radio" name="webdbs[bigFileSet]" value="0" <? if($webdbs['bigFileSet'] == 0) echo 'checked';?>>
        不开启 
         <font color="#999999">(大文件上传需要安装ActiveX控件，<a href="../../XUploadFiles_php/xuploadfiles.cab">点击安装</a>)</font></td>
        </tr>
<tr>
          <td height="28" bgcolor="#FFFFFF">可上传单个文件不能超过多大</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[upfileMaxSize]" id="webdbs[upfileMaxSize]" value="<?=$webdbs['upfileMaxSize']?>" size="50" />K (留空或为0则不做限制)</td>
        </tr>
		<!--
		<tr>
          <td height="28" bgcolor="#FFFFFF">允许上传文件的类型</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[upfileType]" id="webdbs[upfileType]" value="<?=$webdbs['upfileType']?>" size="50" />
            (每个用英文空格隔开,表单留空则不能上传文件)<br />
            推荐是.rar .txt .jpg .gif .png .zip .mp3 .wma .mpeg .mpg .rm .ram   .htm .doc .swf .avi .flv .sql</td>
        </tr><tr>
          <td height="28" bgcolor="#FFFFFF">附件目录</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[updir]" id="webdbs[updir]" value="<?=$webdbs['updir']?>" size="50" />
            (建议不要修改) </td>
        </tr>
		//-->
		<tr>
          <td height="28" bgcolor="#FFFFFF">设置文章每日自动更新数</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[autoAllNum]" id="webdbs[autoAllNum]" value="<?=$webdbs['autoAllNum']?>" size="10" />
          (自动更新文章是将网站后台以审核但没有显示的文章，定时修改为显示状态，相应栏目也要设置)</td>
        </tr>
		<tr>
          <td height="28" bgcolor="#FFFFFF">网站备案号</td>
          <td bgcolor="#FFFFFF"><input name="webdbs[icp]" id="webdbs[icp]" value="<?=$webdbs['icp']?>" size="50" />
            <!--<input type="radio" name="webdbs[NewsMakeHtml]" value="2" <? if($webdbs['NewsMakeHtml'] == 2) echo 'checked';?>>
        伪静态 <br>
        <font color="#666666">(如果你选择生成真静态的话,请确保“静态网页管理”那里,已把整站所有文章生成静态,否则页面访问不正常)</font>//--></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网页底部版权信息</td>
          <td bgcolor="#FFFFFF"><textarea name="webdbs[copyright]" cols="60" rows="4" id="webdbs[copyright]"><?=$webdbs['copyright']?></textarea></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">网站第三方统计代码</td>
          <td bgcolor="#FFFFFF"><textarea name="webdbs[statcode]" cols="60" rows="3" id="webdbs[statcode]"><?=$webdbs['statcode']?></textarea></td>
        </tr>
		<tr>
          <td height="28" bgcolor="#FFFFFF">备注说明</td>
          <td bgcolor="#FFFFFF"><textarea name="webdbs[bzsm]" cols="60" rows="8" id="webdbs[bzsm]"><?=$webdbs['bzsm']?></textarea></td>
        </tr>
        <tr>
          <td height="28" bgcolor="#FFFFFF">&nbsp;</td>
          <td bgcolor="#FFFFFF"><input type="submit" value="提交" name="Submit" />
            <input name="job" type="hidden" id="job" value="modify" />            </td>
        </tr>
      </table>
        </form>
      </td>
    </tr>
  </table>
</div>
</body>
</html>
