<?php
if(!defined('APP_PATH')||!defined('I_PATH')){exit('Access Denied');}

class ld_online extends controllerBase
{
	function __construct(){
		parent::__construct();
		$this->a=$this->sysParams('a',1);
	}
	function cache_write($file, $string, $dir = '') {
	if(is_array($string)) $string = "<?php defined('IN_DESTOON') or exit('Access Denied'); return ".strip_nr(var_export($string, true))."; ?>
";
    $file = $dir ? DT_CACHE.'/'.$dir.'/'.$file : DT_CACHE.'/'.$file;
    $strlen = file_put($file, $string);
    return $strlen;
    }
    
    
    function index(){
    if($this->sysParams('run')==1){
    require(APP_PATH."/config.php");
    $map=$iConfig['online'];
    $configfile='config.php';
    $fp_tp=@fopen($configfile,"r");
    $fp_txt=@fread($fp_tp,filesize($configfile));
    @fclose($fp_tp);
    syDB("sysconfig")->update(array('code'=>serviceconfig_compalte),array('value'=>1));//1代表已经设置完客服信息
    foreach($map as $k=>$v)
    {
    $fp_txt=preg_replace("/'".$k."' => '.*?',/","'".$k."' => '".$this->sysParams($k,1)."',",$fp_txt);
    }
    $fpt_tpl=@fopen($configfile,"w");
    @fwrite($fpt_tpl,$fp_txt);
    @fclose($fpt_tpl);
    message_a("在线客服修改成功",'?c=ld_online');
    }
    $this->toptxt='在线客服';
    $this->d=func_get_iglobal(array('online'));
    $this->display("online.html");
    }
    } 