<?php
// 首页
class WblogAction extends ListAction {
    public function index(){
		$listarr=$this->listinfo('News',array('catid'=>array('in','30')));
		$this->lists();    
		$this->assign('title', $title='WBlog');  
		$this->assign('info', $listarr['info']);
		$this->assign('page', $listarr['page']); 
        $this->display();
    }
	public function download() {
        import("ORG.Util.Http");
        $dao = M("Attach");
        $attach = $dao->where(array('id'=>$_GET['id']))->find();
        $filename = $attach["savepath"] . $attach["savename"];
        if (is_file($filename)) {
            /*if (!isset($_SESSION['attach_down_count_' . $id])) {
                //$dao->setInc('downCount', "id=" . $id);
				$dao->where('id=' . $id)->setInc('downCount', 1); 
                $_SESSION['attach_down_count_' . $id] = true;
            }*/
			$dao->where(array('id'=>$_GET['id']))->setInc('downCount', 1); 
            Http::download($filename, $attach->name);
        }
    }
	
}
?>