更新首页

html.class.php

/**
* 更新首页
*/
public function index() {
if($this->siteid==1) {
$file = PHPCMS_PATH.'index.html';
//添加到发布点队列
$this->queue->add_queue('edit','/index.html',$this->siteid);
} else {
$site_dir = $this->sitelist[$this->siteid]['dirname'];
$file = $this->html_root.'/'.$site_dir.'/index.html';
//添加到发布点队列
$this->queue->add_queue('edit',$file,$this->siteid);
$file = PHPCMS_PATH.$file;
}
define('SITEID', $this->siteid);
//SEO
$SEO = seo($this->siteid);
$siteid = $this->siteid;
$CATEGORYS = $this->categorys;
$style = $this->sitelist[$siteid]['default_style'];
ob_start();
include template('content','index',$style);
return $this->createhtml($file, 1);
}

 

queue_model.class.php

/**
* 添加同步队列
* @param string $type 操作类型{add:添加,edit:修改,del:删除}
* @param string $path 文档地址
* @param integer $siteid 站点ID
*/
final public function add_queue($type = 'add', $path, $siteid = '') {
if (empty($siteid)) $siteid = get_siteid();
$sites = pc_base::load_app_class('sites', 'admin');
$site = $sites->get_by_id($siteid);
if (empty($site['release_point'])) return false;

if ($r = $this->get_one(array('type'=>$type, 'path'=>$path, 'siteid'=>$siteid), 'id')) {
if ($this->update(array('status1'=>'0', 'status2'=>'0', 'status3'=>'0', 'status4'=>'0', 'times'=>SYS_TIME), array('id'=>$r['id']))) {
return true;
} else {
return false;
}
} else {
if ($this->insert(array('type'=>$type, 'path'=>$path, 'siteid'=>$siteid, 'times'=>SYS_TIME))) {
return true;
} else {
return false;
}
}
}

posted @ 2013-01-19 11:08  为了这有限的生命  阅读(188)  评论(0编辑  收藏  举报