mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 23:32:54 +09:00
위젯 검출 정규 표현식을 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2892 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f9896fe51a
commit
90aa62a6ac
993 changed files with 9190 additions and 10457 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module version="0.1">
|
||||
<module version="0.1" category="utility">
|
||||
<title xml:lang="ko">첨부파일</title>
|
||||
<title xml:lang="zh-CN">上传附件</title>
|
||||
<title xml:lang="en">Attachment</title>
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@
|
|||
<action name="procFileDownload" type="controller" standalone="true" />
|
||||
<action name="procFileAdminDeleteChecked" type="controller" standalone="true" />
|
||||
<action name="procFileAdminInsertConfig" type="controller" standalone="true" />
|
||||
<action name="procFileAdminInsertModuleConfig" type="controller" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -58,14 +58,43 @@
|
|||
* @brief 파일 기본 정보의 추가
|
||||
**/
|
||||
function procFileAdminInsertConfig() {
|
||||
// 기본 정보를 받음
|
||||
$args = Context::gets('allowed_filesize','allowed_attach_size','allowed_filetypes');
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('file');
|
||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
|
||||
// module Controller 객체 생성하여 입력
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$args);
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈별 파일 기본 정보의 추가
|
||||
**/
|
||||
function procFileAdminInsertModuleConfig() {
|
||||
// 필요한 변수를 받아옴
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
$download_grant = trim(Context::get('download_grant'));
|
||||
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('file');
|
||||
|
||||
$module_file_config->module_srl = $module_srl;
|
||||
$module_file_config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$module_file_config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$module_file_config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
if($download_grant) $module_file_config->download_grant = explode('|@|',$download_grant);
|
||||
else $module_file_config->download_grant = array();
|
||||
$config->module_config[$module_srl] = $module_file_config;
|
||||
|
||||
// module Controller 객체 생성하여 입력
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,24 @@
|
|||
FileHandler::makeDir('./files/attach/images');
|
||||
FileHandler::makeDir('./files/attach/binaries');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +54,26 @@
|
|||
* @brief 설치가 이상이 없는지 체크하는 method
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true;
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +81,49 @@
|
|||
* @brief 업데이트 실행
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
return new Object();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,6 +40,77 @@
|
|||
return $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 다운로드
|
||||
* 직접 요청을 받음
|
||||
* file_srl : 파일의 sequence
|
||||
* sid : db에 저장된 비교 값, 틀리면 다운로드 하지 낳음
|
||||
**/
|
||||
function procFileDownload() {
|
||||
$file_srl = Context::get('file_srl');
|
||||
$sid = Context::get('sid');
|
||||
|
||||
// 파일의 정보를 DB에서 받아옴
|
||||
$oFileModel = &getModel('file');
|
||||
$file_obj = $oFileModel->getFile($file_srl);
|
||||
if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid || $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download');
|
||||
|
||||
// 파일 다운로드 권한이 있는지 확인
|
||||
$file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);
|
||||
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
|
||||
if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y') {
|
||||
$is_permitted = false;
|
||||
for($i=0;$i<count($file_module_config->download_grant);$i++) {
|
||||
$group_srl = $file_module_config->download_grant[$i];
|
||||
if($logged_info->group_list[$group_srl]) {
|
||||
$is_permitted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$is_permitted) return $this->stop('msg_not_permitted_download');
|
||||
}
|
||||
}
|
||||
|
||||
// trigger 호출 (before)
|
||||
$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
|
||||
if(!$output->toBool()) return $this->stop('msg_not_permitted_download');
|
||||
|
||||
// 파일 출력
|
||||
$filename = $file_obj->source_filename;
|
||||
|
||||
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
|
||||
$filename = urlencode($filename);
|
||||
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
|
||||
}
|
||||
|
||||
$uploaded_filename = $file_obj->uploaded_filename;
|
||||
if(!file_exists($uploaded_filename)) return $this->stop('msg_not_permitted_download');
|
||||
|
||||
$fp = fopen($uploaded_filename, 'rb');
|
||||
if(!$fp) return $this->stop('msg_not_permitted_download');
|
||||
|
||||
header("Cache-Control: ");
|
||||
header("Pragma: ");
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
|
||||
header("Content-Length: " .(string)($file_obj->file_size));
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
header("Content-Transfer-Encoding: binary\n");
|
||||
|
||||
fpassthru($fp);
|
||||
|
||||
// 이상이 없으면 download_count 증가
|
||||
$args->file_srl = $file_srl;
|
||||
executeQuery('file.updateFileDownloadCount', $args);
|
||||
|
||||
// trigger 호출 (after)
|
||||
$output = ModuleHandler::triggerCall('file.downloadFile', 'after', $file_obj);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 에디터에서 첨부 파일 삭제
|
||||
|
|
@ -61,6 +132,95 @@
|
|||
$this->printUploadedFileList($editor_sequence, $upload_target_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일의 갯수를 return하는 trigger
|
||||
**/
|
||||
function triggerCheckAttached(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
if(!$document_srl) return new Object();
|
||||
|
||||
// 첨부 파일의 갯수를 구함
|
||||
$oFileModel = &getModel('file');
|
||||
$obj->uploaded_count = $oFileModel->getFilesCount($document_srl);
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 연결하는 trigger
|
||||
**/
|
||||
function triggerAttachFiles(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
$uploaded_count = $obj->uploaded_count;
|
||||
if(!$document_srl || !$uploaded_count) return new Object();
|
||||
|
||||
$output = $this->setFilesValid($document_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 삭제하는 trigger
|
||||
**/
|
||||
function triggerDeleteAttached(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
if(!$document_srl) return new Object();
|
||||
|
||||
$output = $this->deleteFiles($document_srl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일의 갯수를 return하는 trigger
|
||||
**/
|
||||
function triggerCommentCheckAttached(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
if(!$comment_srl) return new Object();
|
||||
|
||||
// 첨부 파일의 갯수를 구함
|
||||
$oFileModel = &getModel('file');
|
||||
$obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 연결하는 trigger
|
||||
**/
|
||||
function triggerCommentAttachFiles(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
$uploaded_count = $obj->uploaded_count;
|
||||
if(!$comment_srl || !$uploaded_count) return new Object();
|
||||
|
||||
$output = $this->setFilesValid($comment_srl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 삭제하는 trigger
|
||||
**/
|
||||
function triggerCommentDeleteAttached(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
if(!$comment_srl) return new Object();
|
||||
|
||||
$output = $this->deleteFiles($comment_srl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module 삭제시 해당 첨부파일 모두 삭제하는 trigger
|
||||
**/
|
||||
function triggerDeleteModuleFiles(&$obj) {
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
|
||||
$oFileController = &getAdminController('file');
|
||||
return $oFileController->deleteModuleFiles($module_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 업로드 가능하다고 세팅
|
||||
**/
|
||||
|
|
@ -69,16 +229,31 @@
|
|||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경
|
||||
* 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록 함
|
||||
**/
|
||||
function setFilesValid($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
return executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 추가
|
||||
**/
|
||||
function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false) {
|
||||
// trigger 호출 (before)
|
||||
$trigger_obj->module_srl = $module_srl;
|
||||
$trigger_obj->upload_target_srl = $upload_target_srl;
|
||||
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
if(!$manual_insert) {
|
||||
// 첨부파일 설정 가져옴
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y') {
|
||||
$oFileModel = &getModel('file');
|
||||
$config = $oFileModel->getFileConfig();
|
||||
$config = $oFileModel->getFileConfig($module_srl);
|
||||
$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
|
||||
|
||||
// 해당 문서에 첨부된 모든 파일의 용량을 가져옴 (DB에서 가져옴)
|
||||
|
|
@ -127,6 +302,10 @@
|
|||
$output = executeQuery('file.insertFile', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// trigger 호출 (after)
|
||||
$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
$output->add('file_srl', $args->file_srl);
|
||||
$output->add('file_size', $args->file_size);
|
||||
$output->add('source_filename', $args->source_filename);
|
||||
|
|
@ -134,15 +313,6 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경
|
||||
* 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록 함
|
||||
**/
|
||||
function setFilesValid($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
return executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 삭제
|
||||
**/
|
||||
|
|
@ -159,10 +329,19 @@
|
|||
$source_filename = $output->data->source_filename;
|
||||
$uploaded_filename = $output->data->uploaded_filename;
|
||||
|
||||
// trigger 호출 (before)
|
||||
$trigger_obj = $output->data;
|
||||
$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// DB에서 삭제
|
||||
$output = executeQuery('file.deleteFile', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// trigger 호출 (after)
|
||||
$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
// 삭제 성공하면 파일 삭제
|
||||
@unlink($uploaded_filename);
|
||||
|
||||
|
|
@ -278,53 +457,5 @@
|
|||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('print_uploaded_file_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 다운로드
|
||||
* 직접 요청을 받음
|
||||
* file_srl : 파일의 sequence
|
||||
* sid : db에 저장된 비교 값, 틀리면 다운로드 하지 낳음
|
||||
**/
|
||||
function procFileDownload() {
|
||||
$file_srl = Context::get('file_srl');
|
||||
$sid = Context::get('sid');
|
||||
|
||||
// 파일의 정보를 DB에서 받아옴
|
||||
$oFileModel = &getModel('file');
|
||||
$file_obj = $oFileModel->getFile($file_srl);
|
||||
if($file_obj->file_srl!=$file_srl||$file_obj->sid!=$sid) exit();
|
||||
|
||||
// 이상이 없으면 download_count 증가
|
||||
$args->file_srl = $file_srl;
|
||||
executeQuery('file.updateFileDownloadCount', $args);
|
||||
|
||||
// 파일 출력
|
||||
$filename = $file_obj->source_filename;
|
||||
|
||||
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
|
||||
$filename = urlencode($filename);
|
||||
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
|
||||
}
|
||||
|
||||
$uploaded_filename = $file_obj->uploaded_filename;
|
||||
if(!file_exists($uploaded_filename)) exit();
|
||||
|
||||
$fp = fopen($uploaded_filename, 'rb');
|
||||
if(!$fp) exit();
|
||||
|
||||
header("Cache-Control: ");
|
||||
header("Pragma: ");
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
|
||||
header("Content-Length: " .(string)($file_obj->file_size));
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
header("Content-Transfer-Encoding: binary\n");
|
||||
|
||||
fpassthru($fp);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -32,14 +32,26 @@
|
|||
/**
|
||||
* @brief 파일 설정 정보를 구함
|
||||
**/
|
||||
function getFileConfig() {
|
||||
function getFileConfig($module_srl = null) {
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('file');
|
||||
$file_config = $oModuleModel->getModuleConfig('file');
|
||||
|
||||
$config->allowed_filesize = $file_config->allowed_filesize;
|
||||
$config->allowed_attach_size = $file_config->allowed_attach_size;
|
||||
$config->allowed_filetypes = $file_config->allowed_filetypes;
|
||||
|
||||
if(!$config->allowed_filesize) $config->allowed_filesize = '2';
|
||||
if(!$config->allowed_attach_size) $config->allowed_attach_size = '3';
|
||||
if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*';
|
||||
|
||||
if($module_srl && $file_config->module_config[$module_srl]) {
|
||||
$module_config = $file_config->module_config[$module_srl];
|
||||
$config->allowed_filesize = $module_config->allowed_filesize;
|
||||
$config->allowed_attach_size = $module_config->allowed_attach_size;
|
||||
$config->allowed_filetypes = $module_config->allowed_filetypes;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +104,8 @@
|
|||
$file_config->allowed_attach_size = ini_get('upload_max_filesize');
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
} else {
|
||||
$file_config = $this->getFileConfig();
|
||||
$module_srl = Context::get('module_srl');
|
||||
$file_config = $this->getFileConfig($module_srl);
|
||||
}
|
||||
return $file_config;
|
||||
}
|
||||
|
|
@ -116,5 +129,29 @@
|
|||
);
|
||||
return $upload_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 모듈의 file 설정을 return
|
||||
**/
|
||||
function getFileModuleConfig($module_srl) {
|
||||
// file 모듈의 config를 가져옴
|
||||
$oModuleModel = &getModel('module');
|
||||
$file_config = $oModuleModel->getModuleConfig('file');
|
||||
|
||||
$module_file_config = $file_config->module_config[$module_srl];
|
||||
if(!is_object($module_file_config)) $module_file_config = null;
|
||||
|
||||
if(!$module_file_config->module_srl) {
|
||||
$module_file_config->module_srl = $module_srl;
|
||||
$module_file_config->allowed_filesize = $file_config->allowed_filesize;
|
||||
$module_file_config->allowed_attach_size = $file_config->allowed_attach_size;
|
||||
$module_file_config->allowed_filetypes = $file_config->allowed_filetypes;
|
||||
$module_file_config->download_grant = array();
|
||||
} else {
|
||||
if(!$module_file_config->download_grant) $module_file_config->download_grant = array();
|
||||
}
|
||||
|
||||
return $module_file_config;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
52
modules/file/file.view.php
Normal file
52
modules/file/file.view.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* @class fileView
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief file module의 view class
|
||||
*
|
||||
* RSS 2.0형식으로 문서 출력
|
||||
*
|
||||
**/
|
||||
|
||||
class fileView extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 서비스형 모듈의 추가 설정을 위한 부분
|
||||
* file의 사용 형태에 대한 설정만 받음
|
||||
**/
|
||||
function triggerDispFileAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
|
||||
if(!$current_module_srl) {
|
||||
// 선택된 모듈의 정보를 가져옴
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
|
||||
if(!$current_module_srl) return new Object();
|
||||
|
||||
// 선택된 모듈의 file설정을 가져옴
|
||||
$oFileModel = &getModel('file');
|
||||
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
|
||||
Context::set('file_config', $file_config);
|
||||
|
||||
// 그룹의 설정을 위한 권한 가져오기
|
||||
$oMemberModel = &getModel('member');
|
||||
$group_list = $oMemberModel->getGroups();
|
||||
Context::set('group_list', $group_list);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
$lang->allowed_filesize = 'File size limit';
|
||||
$lang->allowed_attach_size = 'Total size limit';
|
||||
$lang->allowed_filetypes = 'Allowed extensions';
|
||||
$lang->enable_download_group = '다운로드 가능 그룹';
|
||||
|
||||
$lang->about_allowed_filesize = 'You can assign file size limit for each file. (Excluding administrators)';
|
||||
$lang->about_allowed_attach_size = 'You can assign file size limit for each document. (Excluding administrators)';
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
$lang->cmd_move_to_document = 'Move to document';
|
||||
$lang->cmd_download = 'Download';
|
||||
|
||||
$lang->msg_not_permitted_download = '다운로드 할 수 있는 권한이 없습니다';
|
||||
$lang->msg_cart_is_null = 'Select the file you wish to delete';
|
||||
$lang->msg_checked_file_is_deleted = 'Total of %d attachments has been deleted';
|
||||
$lang->msg_exceeds_limit_size = 'Attachment faild; exceeded the file size limit';
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
$lang->allowed_filesize = 'Límite del tamaño del archivo adjunto';
|
||||
$lang->allowed_attach_size = 'Límite del tamaño total de los archivos adjuntos por documento';
|
||||
$lang->allowed_filetypes = 'Tipos de archivos permitidos';
|
||||
$lang->enable_download_group = '다운로드 가능 그룹';
|
||||
|
||||
$lang->about_allowed_filesize = 'Puede definir el límite del tamaño del archivo adjunto. (exceptuando el administrador)';
|
||||
$lang->about_allowed_attach_size = 'Puede definir el límite del tamaño total de los archivos adjuntos por documento. (exceptuando el administrador)';
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
$lang->cmd_move_to_document = 'Mover hacia el doncumento';
|
||||
$lang->cmd_download = 'Descargar';
|
||||
|
||||
$lang->msg_not_permitted_download = '다운로드 할 수 있는 권한이 없습니다';
|
||||
$lang->msg_cart_is_null = 'Seleccione el archivo a eliminar';
|
||||
$lang->msg_checked_file_is_deleted = 'Total de %d archivos eliminados';
|
||||
$lang->msg_exceeds_limit_size = 'Ha excedido el límite del tamaño total de los archivos adjuntos';
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
$lang->allowed_filesize = 'ファイルサイズ制限';
|
||||
$lang->allowed_attach_size = '書き込みへの添付制限';
|
||||
$lang->allowed_filetypes = '添付可能な拡張子';
|
||||
$lang->enable_download_group = '다운로드 가능 그룹';
|
||||
|
||||
$lang->about_allowed_filesize = '一つのファイルに対して、アップロードできるファイルの最大サイズを指定します(管理者除外)。';
|
||||
$lang->about_allowed_attach_size = '一つの書き込みに対して、添付できる最大サイズを指定します(管理者除外)。';
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
$lang->cmd_move_to_document = '書き込みに移動する';
|
||||
$lang->cmd_download = 'ダウンロード';
|
||||
|
||||
$lang->msg_not_permitted_download = '다운로드 할 수 있는 권한이 없습니다';
|
||||
$lang->msg_cart_is_null = '削除するファイルを選択してください';
|
||||
$lang->msg_checked_file_is_deleted = '%d個の添付ファイルを削除しました';
|
||||
$lang->msg_exceeds_limit_size = 'ファイルサイズの制限を超えたため、添付できません。';
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
$lang->allowed_filesize = '파일 제한 크기';
|
||||
$lang->allowed_attach_size = '문서 첨부 제한';
|
||||
$lang->allowed_filetypes = '허용 확장자';
|
||||
$lang->enable_download_group = '다운로드 가능 그룹';
|
||||
|
||||
$lang->about_allowed_filesize = '하나의 파일에 대해 최고 용량을 지정할 수 있습니다. (관리자는 제외)';
|
||||
$lang->about_allowed_attach_size = '하나의 문서에 첨부할 수 있는 최고 용량을 지정할 수 있습니다. (관리자는 제외)';
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
$lang->cmd_move_to_document = '문서로 이동';
|
||||
$lang->cmd_download = '다운로드';
|
||||
|
||||
$lang->msg_not_permitted_download = '다운로드 할 수 있는 권한이 없습니다';
|
||||
$lang->msg_cart_is_null = '삭제할 파일을 선택해주세요';
|
||||
$lang->msg_checked_file_is_deleted = '%d개의 첨부파일이 삭제되었습니다';
|
||||
$lang->msg_exceeds_limit_size = '허용된 용량을 초과하여 첨부가 되지 않았습니다';
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
$lang->allowed_filesize = '文件大小限制';
|
||||
$lang->allowed_attach_size = '上传限制';
|
||||
$lang->allowed_filetypes = '可用扩展名';
|
||||
$lang->enable_download_group = '다운로드 가능 그룹';
|
||||
|
||||
$lang->about_allowed_filesize = '最大单个上传文件大小(管理员不受此限制)。';
|
||||
$lang->about_allowed_attach_size = '每个主题最大上传文件大小(管理员不受此限制)。';
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
$lang->cmd_move_to_document = '查看源主题';
|
||||
$lang->cmd_download = '下载';
|
||||
|
||||
$lang->msg_not_permitted_download = '다운로드 할 수 있는 권한이 없습니다';
|
||||
$lang->msg_cart_is_null = ' 请选择要删除的文件。';
|
||||
$lang->msg_checked_file_is_deleted = '已删除%d个文件!';
|
||||
$lang->msg_exceeds_limit_size = '已超过系统指定的上传文件大小!';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
<!--%import("filter/insert_config.xml")-->
|
||||
|
||||
<form action="./" method="get" onsubmit="return procFilter(this, insert_config)">
|
||||
<table cellspacing="0" class="tableType2 gap1">
|
||||
<table cellspacing="0" class="adminTable">
|
||||
<col width="150" />
|
||||
<col />
|
||||
<tr>
|
||||
<th scope="col">{$lang->allowed_filesize}</th>
|
||||
<td>
|
||||
|
|
@ -25,10 +27,10 @@
|
|||
<p>{$lang->about_allowed_filetypes}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" colspan="2" class="button">
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 버튼 -->
|
||||
<div class="tRight gap1">
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -10,28 +10,29 @@
|
|||
<input type="hidden" name="page" value="{$page}" />
|
||||
|
||||
<!-- 목록 -->
|
||||
<table cellspacing="0" class="tableType1">
|
||||
<col width="60" />
|
||||
<table cellspacing="0" class="adminTable">
|
||||
<col width="50" />
|
||||
<col width="30" />
|
||||
<col />
|
||||
<col width="80" />
|
||||
<col width="60" />
|
||||
<col width="100" />
|
||||
<col width="80" />
|
||||
<col width="70" />
|
||||
<col width="40" />
|
||||
<col width="100" />
|
||||
<col width="70" />
|
||||
<col width="70" />
|
||||
<col width="70" />
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{$lang->no}</th>
|
||||
<th scope="col"><input type="checkbox" onclick="checkboxSelectAll(this.form, 'cart'); return false;" /></th>
|
||||
<th scope="col">
|
||||
<div class="nowrap">
|
||||
<select name="module_srl" class="mid_list" id="module_srl">
|
||||
<select name="module_srl" id="module_srl">
|
||||
<option value="">{$lang->module}</option>
|
||||
<!--@foreach($mid_list as $key => $val)-->
|
||||
<option value="{$val->module_srl}" <!--@if($module_srl == $val->module_srl)-->selected="selected"<!--@end-->>{$val->browser_title}</option>
|
||||
<!--@end-->
|
||||
</select><a href="#" onclick="location.href=current_url.setQuery('module_srl',xGetElementById('module_srl').options[xGetElementById('module_srl').selectedIndex].value);return false;" class="button"><span>GO</span></a>
|
||||
</select>
|
||||
<input type="button" name="go_button" id="go_button" value="GO" class="buttonTypeGo" onclick="location.href=current_url.setQuery('module_srl',xGetElementById('module_srl').options[xGetElementById('module_srl').selectedIndex].value);return false;"/>
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col">{$lang->file_size}</th>
|
||||
|
|
|
|||
53
modules/file/tpl/file_module_config.html
Normal file
53
modules/file/tpl/file_module_config.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<!--%import("filter/insert_file_module_config.xml")-->
|
||||
|
||||
<form action="./" method="get" onsubmit="return procFilter(this, insert_file_module_config)">
|
||||
<input type="hidden" name="target_module_srl" value="{$file_config->module_srl}" />
|
||||
|
||||
<table cellspacing="0" class="adminTable">
|
||||
<col width="150" />
|
||||
<col width="*" />
|
||||
<caption>{$lang->file}</caption>
|
||||
<tr>
|
||||
<th scope="col">{$lang->allowed_filesize}</th>
|
||||
<td>
|
||||
<input type="text" name="allowed_filesize" value="{$file_config->allowed_filesize}" class="inputTypeText" size="3" />MB
|
||||
<p>{$lang->about_allowed_filesize}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">{$lang->allowed_attach_size}</th>
|
||||
<td>
|
||||
<input type="text" name="allowed_attach_size" value="{$file_config->allowed_attach_size}" class="inputTypeText" size="3" />MB
|
||||
/ {ini_get('upload_max_filesize')}
|
||||
<p>{$lang->about_allowed_attach_size}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">{$lang->allowed_filetypes}</th>
|
||||
<td>
|
||||
<input type="text" name="allowed_filetypes" value="{$file_config->allowed_filetypes}" class="inputTypeText w100" />
|
||||
<p>{$lang->about_allowed_filetypes}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
{$lang->enable_download_group}<br />
|
||||
</th>
|
||||
<td>
|
||||
<!--@foreach($group_list as $k => $v)-->
|
||||
<input type="checkbox" class="checkbox" name="download_grant" value="{$v->group_srl}" id="grant_{$key}_{$v->group_srl}" <!--@if(in_array($v->group_srl, $file_config->download_grant))-->checked="checked"<!--@end-->/>
|
||||
<label for="grant_{$key}_{$v->group_srl}">{$v->title}</label>
|
||||
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2" class="button">
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_save}" /></span>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="gap1"></div>
|
||||
7
modules/file/tpl/filter/insert_file_module_config.xml
Normal file
7
modules/file/tpl/filter/insert_file_module_config.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<filter name="insert_file_module_config" module="file" act="procFileAdminInsertModuleConfig" confirm_msg_code="confirm_submit">
|
||||
<form />
|
||||
<response>
|
||||
<tag name="error" />
|
||||
<tag name="message" />
|
||||
</response>
|
||||
</filter>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<h3>{$lang->file} <span class="gray">{$lang->cmd_management}</span></h3>
|
||||
|
||||
<div class="header4">
|
||||
<div class="header4 gap1">
|
||||
<ul class="localNavigation">
|
||||
<li <!--@if($act=='dispFileAdminList')-->class="on"<!--@end-->><a href="{getUrl('act','dispFileAdminList')}">{$lang->file_list}</a></li>
|
||||
<li <!--@if($act=='dispFileAdminConfig')-->class="on"<!--@end-->><a href="{getUrl('act','dispFileAdminConfig')}">{$lang->cmd_module_config}</a></li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue