<?php

class domainAdminPlugin extends commonMod
{
    public function __construct()
    {
        parent::__construct();
        $config['TPL_TEMPLATE_PATH'] = dirname(__file__) . '/template/';
        $this->tpl = new cpTemplate($config);
    }
    
//---------------------------------------全局信息结束----------------------------------------------------//


    //本插件后台首页
    public function index()
    {
		$this->display('admin_index');
    }

    //替换
    public function replace()
    {

    $domain=$_POST['domain'];
    $domain_replace=$_POST['domain_replace'];

    $data= "pic=replace(pic,\"".$domain."\",\"".$domain_replace."\")"; //替换缩略图
    $this->model->table('content')->data($data)->where('id>0')->update(); 
    $data= "content=replace(content,\"".$domain."\",\"".$domain_replace."\")"; //替换内容内图片
    $this->model->table('content_data')->data($data)->where('id>0')->update(); 
    $data= "pic=replace(pic,\"".$domain."\",\"".$domain_replace."\")"; //替换栏目形象图
    $this->model->table('channel')->data($data)->where('id>0')->update(); 
    $data= "content=replace(content,\"".$domain."\",\"".$domain_replace."\")"; //替换单页内容图片
    $this->model->table('channel_data')->data($data)->where('id>0')->update();
    $data= "content=replace(content,\"".$domain."\",\"".$domain_replace."\")"; //替换碎片内容图片
    $this->model->table('plus_fragment')->data($data)->where('id>0')->update(); 
    $this->success('域名替换成功！');
        
    }




}

?>