<?php
/**
 *	Generated by miceCMS
 *	http://www.miceCMS.com/
 */
class downAction extends security_normal {
	function action(){
		$downid=ceil($this->_getParamId(1));

		$article=new model_Article();
		$article->setSubsection('WHERE isvisible=0 AND type=\'article2\' AND article_id='.$downid);
		$ArticleRS=$article->doSelectOne();
		if(!$ArticleRS){
			$jsstring='Dialog.alert("对不起,您要下载的文件不存在或已经被删除",function(){history.back(-1);});';
			MessageBox($jsstring);
			exit;
		}
		$filename=MiceRestoreQuote('micefun',$ArticleRS->getUpfile());
		$files=split('/',$filename);
		$filename2=$files[sizeof($files)-1];
		include_once MICE_DIR.'/includes/download.php';
		
		if(!ereg("^(http|ftp)",$filename)){
			$filename=MICE_DIR."uploads/".$filename;
		}
		
		download($filename,$filename2);
		MessageBox('',MICE_URL);
		exit;
	}
}
?>