git-svn-id: http://xe-core.googlecode.com/svn/trunk@565 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-20 06:44:40 +00:00
parent ca67eeea6e
commit d7238d8932
4 changed files with 23 additions and 9 deletions

View file

@ -61,7 +61,7 @@
<td>{$lang->uploaded_file}</td>
<td>
<!--@foreach($document->uploaded_list as $key => $file)-->
<div><a href="./?mid={$mid}&amp;act=procDownloadFile&amp;file_srl={$file->file_srl}&amp;sid={$file->sid}&amp;upload_target_srl={$file->upload_target_srl}">{$file->source_filename} ({FileHandler::filesize($file->file_size)})</a> ({number_format($file->download_count)})</div>
<div><a href="{$file->download_url}"/>{$file->source_filename} ({FileHandler::filesize($file->file_size)})</a> ({number_format($file->download_count)})</div>
<!--@end-->
</td>
</tr>

View file

@ -193,7 +193,7 @@ function editor_insert_file(upload_target_srl) {
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value;
var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?mid="+mid+"&amp;act=procDownloadFile&amp;upload_target_srl="+upload_target_srl+"&amp;file_srl="+file_srl+"&amp;sid="+sid;
var url = "./?module=file&amp;act=procDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
openComponent("url_link", upload_target_srl, url);
}
}

View file

@ -3,6 +3,7 @@
<grants />
<actions>
<action name="dispList" type="view" admin_index="true" standalone="true" />
<action name="procDownload" type="model" standalone="true" />
<action name="procDeleteChecked" type="controller" standalone="true" />
</actions>
</module>

View file

@ -32,7 +32,15 @@
$args->file_srl = $file_srl;
$output = $oDB->executeQuery('file.getFile', $args);
return $output->data;
if(!$output->toBool()) return $output;
$file = $output->data;
$direct_download = $file->direct_download;
if($direct_download=='Y') $file->download_url = $uploaded_filename;
else $file->download_url = "./?module=file&amp;act=procDownload&amp;file_srl=".$file->file_srl."&amp;sid=".$file->sid;
return $file;
}
/**
@ -51,12 +59,14 @@
for($i=0;$i<count($file_list);$i++) {
$direct_download = $file_list[$i]->direct_download;
if($direct_download=='Y') {
$download_url = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2);
$file_list[$i]->download_url = $download_url;
} else {
$file_list[$i]->download_url = "./?module=file&amp;act=procDownload&amp;file_srl=".$file_list[$i]->file_srl."&amp;sid=".$file_list[$i]->sid;
}
if($direct_download!='Y') continue;
$uploaded_filename = Context::getRequestUri().substr($file_list[$i]->uploaded_filename,2);
$file_list[$i]->uploaded_filename = $uploaded_filename;
}
return $file_list;
}
@ -113,7 +123,10 @@
* @brief 파일 출력
* 이미지나 멀티미디어등이 아닌 download를 받을 사용하는 method
**/
function procDownload($file_srl, $sid) {
function procDownload() {
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// 파일의 정보를 DB에서 받아옴
$file_obj = $this->getFile($file_srl);
if($file_obj->file_srl!=$file_srl||$file_obj->sid!=$sid) exit();