mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 12:02:24 +09:00
english comments added
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
693e215bc1
commit
4d272994dd
219 changed files with 6407 additions and 8705 deletions
|
|
@ -2,37 +2,34 @@
|
|||
/**
|
||||
* @class fileAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 admin controller 클래스
|
||||
* @brief admin controller class of the file module
|
||||
**/
|
||||
|
||||
class fileAdminController extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 모듈의 첨부파일 모두 삭제
|
||||
* @brief Delete the attachment of a particular module
|
||||
**/
|
||||
function deleteModuleFiles($module_srl) {
|
||||
// 전체 첨부파일 목록을 구함
|
||||
// Get a full list of attachments
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQueryArray('file.getModuleFiles',$args);
|
||||
if(!$output) return $output;
|
||||
$files = $output->data;
|
||||
|
||||
// DB에서 삭제
|
||||
// Remove from the DB
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('file.deleteModuleFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
|
||||
// Remove the file
|
||||
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
||||
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
||||
|
||||
// DB에서 구한 파일 목록을 삭제
|
||||
// Remove the file list obtained from the DB
|
||||
$path = array();
|
||||
$cnt = count($files);
|
||||
for($i=0;$i<$cnt;$i++) {
|
||||
|
|
@ -42,18 +39,17 @@
|
|||
$path_info = pathinfo($uploaded_filename);
|
||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
||||
}
|
||||
|
||||
// 해당 글의 첨부파일 디렉토리 삭제
|
||||
// Remove a file directory of the document
|
||||
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 관리자 페이지에서 선택된 파일들을 삭제
|
||||
* @brief Delete selected files from the administrator page
|
||||
**/
|
||||
function procFileAdminDeleteChecked() {
|
||||
// 선택된 글이 없으면 오류 표시
|
||||
// An error appears if no document is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||
$file_srl_list= explode('|@|', $cart);
|
||||
|
|
@ -61,8 +57,7 @@
|
|||
if(!$file_count) return $this->stop('msg_cart_is_null');
|
||||
|
||||
$oFileController = &getController('file');
|
||||
|
||||
// 글삭제
|
||||
// Delete the post
|
||||
for($i=0;$i<$file_count;$i++) {
|
||||
$file_srl = trim($file_srl_list[$i]);
|
||||
if(!$file_srl) continue;
|
||||
|
|
@ -74,31 +69,29 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 파일 기본 정보의 추가
|
||||
* @brief Add file information
|
||||
**/
|
||||
function procFileAdminInsertConfig() {
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
// Get configurations (using module model object)
|
||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
$config->allow_outlink = Context::get('allow_outlink');
|
||||
$config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||
$config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||
|
||||
// module Controller 객체 생성하여 입력
|
||||
// Create module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈별 파일 기본 정보의 추가
|
||||
* @brief Add file information for each module
|
||||
**/
|
||||
function procFileAdminInsertModuleConfig() {
|
||||
// 필요한 변수를 받아옴
|
||||
// Get variables
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
|
||||
// 여러개의 모듈 일괄 설정일 경우
|
||||
// In order to configure multiple modules at once
|
||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||
else $module_srl = array($module_srl);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,22 +2,22 @@
|
|||
/**
|
||||
* @class fileAdminModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 admin model 클래스
|
||||
* @brief admin model class of the file module
|
||||
**/
|
||||
|
||||
class fileAdminModel extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모든 첨부파일을 시간 역순으로 가져옴 (관리자용)
|
||||
* @brief Get all the attachments in order by time descending (for administrators)
|
||||
**/
|
||||
function getFileList($obj) {
|
||||
// 검색 옵션 정리
|
||||
// Search options
|
||||
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
||||
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
||||
|
||||
|
|
@ -59,27 +59,22 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 유효/대기 상태 설정
|
||||
// Set valid/invalid state
|
||||
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
|
||||
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
|
||||
|
||||
// 멀티미디어/ 일반 상태 설정
|
||||
// Set multimedia/common file
|
||||
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
|
||||
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
|
||||
|
||||
// 변수 설정
|
||||
// Set variables
|
||||
$args->sort_index = $obj->sort_index;
|
||||
$args->page = $obj->page?$obj->page:1;
|
||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||
$args->s_module_srl = $obj->module_srl;
|
||||
$args->exclude_module_srl = $obj->exclude_module_srl;
|
||||
|
||||
// file.getFileList쿼리 실행
|
||||
// Execute the file.getFileList query
|
||||
$output = executeQuery('file.getFileList', $args);
|
||||
|
||||
// 결과가 없거나 오류 발생시 그냥 return
|
||||
// Return if no result or an error occurs
|
||||
if(!$output->toBool()||!count($output->data)) return $output;
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
|
|
|
|||
|
|
@ -2,35 +2,33 @@
|
|||
/**
|
||||
* @class fileAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 admin view 클래스
|
||||
* @brief admin view of the module class file
|
||||
**/
|
||||
|
||||
class fileAdminView extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 목록 출력 (관리자용)
|
||||
* @brief Display output list (for administrator)
|
||||
**/
|
||||
function dispFileAdminList() {
|
||||
// 목록을 구하기 위한 옵션
|
||||
$args->page = Context::get('page'); ///< 페이지
|
||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
||||
// Options to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< Number of documents that appear on a single page
|
||||
$args->page_count = 10; // /< Number of pages that appear in the page navigation
|
||||
|
||||
$args->sort_index = 'file_srl'; ///< 소팅 값
|
||||
$args->sort_index = 'file_srl'; // /< Sorting values
|
||||
$args->isvalid = Context::get('isvalid');
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
|
||||
// 목록 구함
|
||||
// Get a list
|
||||
$oFileModel = &getAdminModel('file');
|
||||
$output = $oFileModel->getFileList($args);
|
||||
|
||||
// 목록의 loop를 돌면서 document를 구하기
|
||||
// Get the document for looping a list
|
||||
if($output->data) {
|
||||
$oCommentModel = &getModel('comment');
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
|
@ -50,10 +48,9 @@
|
|||
$target_srl = $file->upload_target_srl;
|
||||
$file_update_args = null;
|
||||
$file_update_args->file_srl = $file_srl;
|
||||
|
||||
// upload_target_type이 없으면 찾아서 업데이트
|
||||
// Find and update if upload_target_type doesn't exist
|
||||
if(!$file->upload_target_type) {
|
||||
// 찾아둔게 있으면 패스
|
||||
// Pass if upload_target_type is already found
|
||||
if($document_list[$target_srl]) {
|
||||
$file->upload_target_type = 'doc';
|
||||
} else if($comment_list[$target_srl]) {
|
||||
|
|
@ -79,7 +76,7 @@
|
|||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// module (페이지인 경우)
|
||||
// module (for a page)
|
||||
if(!$file->upload_target_type) {
|
||||
$module = $oModuleModel->getModulesInfo($target_srl);
|
||||
if($module) {
|
||||
|
|
@ -92,8 +89,7 @@
|
|||
executeQuery('file.updateFileTargetType', $file_update_args);
|
||||
}
|
||||
}
|
||||
|
||||
// 이미 구해진 데이터가 있는 확인
|
||||
// Check if data is already obtained
|
||||
for($i = 0; $i < $com_srls_count; ++$i) {
|
||||
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
||||
}
|
||||
|
|
@ -114,13 +110,11 @@
|
|||
$file_list[$file_srl] = $file;
|
||||
$mod_srls[] = $file->module_srl;
|
||||
}
|
||||
|
||||
// 중복 제거
|
||||
// Remove duplication
|
||||
$doc_srls = array_unique($doc_srls);
|
||||
$com_srls = array_unique($com_srls);
|
||||
$mod_srls = array_unique($mod_srls);
|
||||
|
||||
// 댓글 목록
|
||||
// Comment list
|
||||
$com_srls_count = count($com_srls);
|
||||
if($com_srls_count) {
|
||||
$comment_output = $oCommentModel->getComments($com_srls);
|
||||
|
|
@ -129,8 +123,7 @@
|
|||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
|
||||
// 문서 목록
|
||||
// Document list
|
||||
$doc_srls_count = count($doc_srls);
|
||||
if($doc_srls_count) {
|
||||
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
||||
|
|
@ -138,8 +131,7 @@
|
|||
$document_list[$document->document_srl] = $document;
|
||||
}
|
||||
}
|
||||
|
||||
// 모듈 목록
|
||||
// Module List
|
||||
$mod_srls_count = count($mod_srls);
|
||||
if($mod_srls_count) {
|
||||
$module_output = $oModuleModel->getModulesInfo($mod_srls);
|
||||
|
|
@ -164,21 +156,19 @@
|
|||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
// 템플릿 지정
|
||||
// Set a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('file_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 정보 설정 (관리자용)
|
||||
* @brief Set attachment information (for administrator)
|
||||
**/
|
||||
function dispFileAdminConfig() {
|
||||
$oFileModel = &getModel('file');
|
||||
$config = $oFileModel->getFileConfig();
|
||||
Context::set('config',$config);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
// Set a template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('file_config');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,29 +2,26 @@
|
|||
/**
|
||||
* @class file
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 high 클래스
|
||||
* @brief high class of the file module
|
||||
**/
|
||||
|
||||
class file extends ModuleObject {
|
||||
|
||||
/**
|
||||
* @brief 설치시 추가 작업이 필요할시 구현
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// action forward에 등록 (관리자 모드에서 사용하기 위함)
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 첨부파일의 기본 설정 저장
|
||||
// Save the default settings for attachments
|
||||
$config->allowed_filesize = '2';
|
||||
$config->allowed_attach_size = '2';
|
||||
$config->allowed_filetypes = '*.*';
|
||||
$oModuleController->insertModuleConfig('file', $config);
|
||||
|
||||
// file 모듈에서 사용할 디렉토리 생성
|
||||
// Generate a directory for the file module
|
||||
FileHandler::makeDir('./files/attach/images');
|
||||
FileHandler::makeDir('./files/attach/binaries');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
|
@ -35,27 +32,23 @@
|
|||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
|
||||
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 설치가 이상이 없는지 체크하는 method
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
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;
|
||||
|
|
@ -66,31 +59,26 @@
|
|||
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;
|
||||
|
||||
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true;
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true;
|
||||
|
||||
// 타겟 판별용 필드
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 업데이트 실행
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
||||
|
|
@ -120,27 +108,23 @@
|
|||
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
|
||||
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
|
||||
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
|
||||
// 타겟 판별용 필드
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3');
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 캐시 파일 재생성
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,44 +2,41 @@
|
|||
/**
|
||||
* @class fileController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 controller 클래스
|
||||
* @brief controller class of the file module
|
||||
**/
|
||||
|
||||
class fileController extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 에디터에서 첨부파일 업로드
|
||||
* editor_sequence, uploadTargetSrl 변수값을 받아서 이를 바탕으로 첨부 대상 srl을 결정함.
|
||||
* 만약 uploadTargetSrl이 없다면 새로 생성하고 return 하여 UI에서 이에 대한 값을 재설정하도록 하여
|
||||
* sync이상없도록 함
|
||||
* @brief Upload attachments in the editor
|
||||
* Determine the upload target srl from editor_sequence and uploadTargetSrl variables.
|
||||
* Create and return the UploadTargetSrl if not exists so that UI can use the value
|
||||
* for sync.
|
||||
**/
|
||||
function procFileUpload() {
|
||||
$file_info = Context::get('Filedata');
|
||||
|
||||
// 정상적으로 업로드된 파일이 아니면 오류 출력
|
||||
// An error appears if not a normally uploaded file
|
||||
if(!is_uploaded_file($file_info['tmp_name'])) exit();
|
||||
|
||||
// 기본적으로 필요한 변수 설정
|
||||
// Basic variables setting
|
||||
$oFileModel = &getModel('file');
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
|
||||
if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
|
||||
$module_srl = $this->module_srl;
|
||||
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
// Exit a session if there is neither upload permission nor information
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
|
||||
|
||||
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
|
||||
// Extract from session information if upload_target_srl is not specified
|
||||
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
||||
// 세션정보에도 정의되지 않았다면 새로 생성
|
||||
// Create if upload_target_srl is not defined in the session information
|
||||
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
|
||||
|
||||
|
|
@ -48,32 +45,28 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief iframe 첨부파일 업로드
|
||||
* @brief iframe upload attachments
|
||||
**/
|
||||
function procFileIframeUpload() {
|
||||
// 기본적으로 필요한 변수 설정
|
||||
// Basic variables setting
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$callback = Context::get('callback');
|
||||
$module_srl = $this->module_srl;
|
||||
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
|
||||
if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
|
||||
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
// Exit a session if there is neither upload permission nor information
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
|
||||
|
||||
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
|
||||
// Extract from session information if upload_target_srl is not specified
|
||||
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
||||
// 세션정보에도 정의되지 않았다면 새로 생성
|
||||
// Create if upload_target_srl is not defined in the session information
|
||||
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
|
||||
// file_srl이 요청되었을 경우 삭제 후 재업로드 시도
|
||||
// Delete and then attempt to re-upload if file_srl is requested
|
||||
$file_srl = Context::get('file_srl');
|
||||
if($file_srl) $this->deleteFile($file_srl);
|
||||
|
||||
$file_info = Context::get('Filedata');
|
||||
|
||||
// 정상적으로 업로드된 파일이 아니면 오류 출력
|
||||
// An error appears if not a normally uploaded file
|
||||
if(is_uploaded_file($file_info['tmp_name'])) {
|
||||
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||
Context::set('uploaded_fileinfo',$output);
|
||||
|
|
@ -116,10 +109,10 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 다운로드
|
||||
* 직접 요청을 받음
|
||||
* file_srl : 파일의 sequence
|
||||
* sid : db에 저장된 비교 값, 틀리면 다운로드 하지 않음
|
||||
* @brief Download Attachment
|
||||
* Receive a request directly
|
||||
* file_srl: File sequence
|
||||
* sid : value in DB for comparison, No download if not matched
|
||||
**/
|
||||
function procFileDownload() {
|
||||
$oFileModel = &getModel('file');
|
||||
|
|
@ -127,23 +120,18 @@
|
|||
$file_srl = Context::get('file_srl');
|
||||
$sid = Context::get('sid');
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// 파일의 정보를 DB에서 받아옴
|
||||
// Get file information from the DB
|
||||
$file_obj = $oFileModel->getFile($file_srl);
|
||||
|
||||
// 요청된 파일 정보가 잘못되었다면 파일을 찾을 수 없다는 오류 출력
|
||||
// If the requested file information is incorrect, an error that file cannot be found appears
|
||||
if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found');
|
||||
|
||||
// 대기 상태일 경우 파일 다운로드 권한이 없음을 알림 (최고관리자는 다운 로드 허용)
|
||||
// Notify that file download is not allowed when standing-by(Only a top-administrator is permitted)
|
||||
if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download');
|
||||
|
||||
// 파일 이름
|
||||
// File name
|
||||
$filename = $file_obj->source_filename;
|
||||
$file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);
|
||||
|
||||
// 파일 외부링크 차단
|
||||
// Not allow the file outlink
|
||||
if($file_module_config->allow_outlink == 'N') {
|
||||
//외부링크 허용 확장자 처리
|
||||
// Handles extension to allow outlink
|
||||
if($file_module_config->allow_outlink_format) {
|
||||
$allow_outlink_format_array = array();
|
||||
$allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format);
|
||||
|
|
@ -157,7 +145,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
//외부링크 허용 사이트 처리
|
||||
// Sites that outlink is allowed
|
||||
if($file_module_config->allow_outlink != 'Y') {
|
||||
$referer = parse_url($_SERVER["HTTP_REFERER"]);
|
||||
if($referer['host'] != $_SERVER['HTTP_HOST']) {
|
||||
|
|
@ -179,8 +167,7 @@
|
|||
}
|
||||
if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink');
|
||||
}
|
||||
|
||||
// 파일 다운로드 권한이 있는지 확인
|
||||
// Check if a permission for file download is granted
|
||||
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');
|
||||
|
|
@ -206,12 +193,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// trigger 호출 (before)
|
||||
// Call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
|
||||
if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');
|
||||
|
||||
// 파일 출력
|
||||
// File Output
|
||||
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
|
||||
$filename = rawurlencode($filename);
|
||||
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
|
||||
|
|
@ -240,11 +225,10 @@
|
|||
fpassthru($fp);
|
||||
}
|
||||
|
||||
// 이상이 없으면 download_count 증가
|
||||
// Increase download_count
|
||||
$args->file_srl = $file_srl;
|
||||
executeQuery('file.updateFileDownloadCount', $args);
|
||||
|
||||
// trigger 호출 (after)
|
||||
// Call a trigger (after)
|
||||
$output = ModuleHandler::triggerCall('file.downloadFile', 'after', $file_obj);
|
||||
|
||||
Context::close();
|
||||
|
|
@ -253,16 +237,15 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 에디터에서 첨부 파일 삭제
|
||||
* @brief Delete an attachment from the editor
|
||||
**/
|
||||
function procFileDelete() {
|
||||
// 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정
|
||||
// Basic variable setting(upload_target_srl and module_srl set)
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$file_srl = Context::get('file_srl');
|
||||
$file_srls = Context::get('file_srls');
|
||||
if($file_srls) $file_srl = $file_srls;
|
||||
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
// Exit a session if there is neither upload permission nor information
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
|
||||
|
||||
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
|
@ -270,13 +253,12 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일의 갯수를 return하는 trigger
|
||||
* @brief A trigger to return numbers of attachments in the upload_target_srl (document_srl)
|
||||
**/
|
||||
function triggerCheckAttached(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
if(!$document_srl) return new Object();
|
||||
|
||||
// 첨부 파일의 갯수를 구함
|
||||
// Get numbers of attachments
|
||||
$oFileModel = &getModel('file');
|
||||
$obj->uploaded_count = $oFileModel->getFilesCount($document_srl);
|
||||
|
||||
|
|
@ -284,7 +266,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 연결하는 trigger
|
||||
* @brief A trigger to link the attachment with the upload_target_srl (document_srl)
|
||||
**/
|
||||
function triggerAttachFiles(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
|
|
@ -297,7 +279,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 삭제하는 trigger
|
||||
* @brief A trigger to delete the attachment in the upload_target_srl (document_srl)
|
||||
**/
|
||||
function triggerDeleteAttached(&$obj) {
|
||||
$document_srl = $obj->document_srl;
|
||||
|
|
@ -308,13 +290,12 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일의 갯수를 return하는 trigger
|
||||
* @brief A trigger to return numbers of attachments in the upload_target_srl (comment_srl)
|
||||
**/
|
||||
function triggerCommentCheckAttached(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
if(!$comment_srl) return new Object();
|
||||
|
||||
// 첨부 파일의 갯수를 구함
|
||||
// Get numbers of attachments
|
||||
$oFileModel = &getModel('file');
|
||||
$obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);
|
||||
|
||||
|
|
@ -322,7 +303,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 연결하는 trigger
|
||||
* @brief A trigger to link the attachment with the upload_target_srl (comment_srl)
|
||||
**/
|
||||
function triggerCommentAttachFiles(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
|
|
@ -336,7 +317,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 삭제하는 trigger
|
||||
* @brief A trigger to delete the attachment in the upload_target_srl (comment_srl)
|
||||
**/
|
||||
function triggerCommentDeleteAttached(&$obj) {
|
||||
$comment_srl = $obj->comment_srl;
|
||||
|
|
@ -347,7 +328,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief module 삭제시 해당 첨부파일 모두 삭제하는 trigger
|
||||
* @brief A trigger to delete all the attachements when deleting the module
|
||||
**/
|
||||
function triggerDeleteModuleFiles(&$obj) {
|
||||
$module_srl = $obj->module_srl;
|
||||
|
|
@ -358,7 +339,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 업로드 가능하다고 세팅
|
||||
* @brief Upload enabled
|
||||
**/
|
||||
function setUploadInfo($editor_sequence, $upload_target_srl=0) {
|
||||
$_SESSION['upload_info'][$editor_sequence]->enabled = true;
|
||||
|
|
@ -366,8 +347,8 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경
|
||||
* 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록 함
|
||||
* @brief Set the attachements of the upload_target_srl to be valid
|
||||
* By changing its state to valid when a document is inserted, it prevents from being considered as a unnecessary file
|
||||
**/
|
||||
function setFilesValid($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
|
|
@ -375,10 +356,10 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 추가
|
||||
* @brief Add an attachement
|
||||
**/
|
||||
function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false) {
|
||||
// trigger 호출 (before)
|
||||
// Call a trigger (before)
|
||||
$trigger_obj->module_srl = $module_srl;
|
||||
$trigger_obj->upload_target_srl = $upload_target_srl;
|
||||
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
|
||||
|
|
@ -390,19 +371,16 @@
|
|||
}
|
||||
|
||||
if(!$manual_insert) {
|
||||
// 첨부파일 설정 가져옴
|
||||
// Get the file configurations
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y') {
|
||||
$oFileModel = &getModel('file');
|
||||
$config = $oFileModel->getFileConfig($module_srl);
|
||||
$allowed_filesize = $config->allowed_filesize * 1024 * 1024;
|
||||
$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
|
||||
|
||||
// 한 파일당 허용 용량 초과시 오류 출력
|
||||
// An error appears if file size exceeds a limit
|
||||
if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size');
|
||||
|
||||
|
||||
// 해당 문서에 첨부된 모든 파일의 용량을 가져옴 (DB에서 가져옴)
|
||||
// Get total file size of all attachements (from DB)
|
||||
$size_args->upload_target_srl = $upload_target_srl;
|
||||
$output = executeQuery('file.getAttachedFileSize', $size_args);
|
||||
$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
|
||||
|
|
@ -410,9 +388,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 이미지인지 기타 파일인지 체크하여 upload path 지정
|
||||
// Set upload path by checking if the attachement is an image or other kinds of file
|
||||
if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) {
|
||||
// direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함
|
||||
// Immediately remove the direct file if it has any kind of extensions for hacking
|
||||
$file_info['name'] = preg_replace('/\.(php|phtm|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']);
|
||||
$file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']);
|
||||
|
||||
|
|
@ -435,11 +413,9 @@
|
|||
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
|
||||
$direct_download = 'N';
|
||||
}
|
||||
|
||||
// 디렉토리 생성
|
||||
// Create a directory
|
||||
if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create');
|
||||
|
||||
// 파일 이동
|
||||
// Move the file
|
||||
if($manual_insert) {
|
||||
@copy($file_info['tmp_name'], $filename);
|
||||
if(!file_exists($filename)) {
|
||||
|
|
@ -452,12 +428,10 @@
|
|||
if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error');
|
||||
}
|
||||
}
|
||||
|
||||
// 사용자 정보를 구함
|
||||
// Get member information
|
||||
$oMemberModel = &getModel('member');
|
||||
$member_srl = $oMemberModel->getLoggedMemberSrl();
|
||||
|
||||
// 파일 정보를 정리
|
||||
// List file information
|
||||
$args->file_srl = getNextSequence();
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->module_srl = $module_srl;
|
||||
|
|
@ -472,8 +446,7 @@
|
|||
|
||||
$output = executeQuery('file.insertFile', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// trigger 호출 (after)
|
||||
// Call a trigger (after)
|
||||
$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
|
|
@ -488,7 +461,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 삭제
|
||||
* @brief Delete the attachment
|
||||
**/
|
||||
function deleteFile($file_srl) {
|
||||
if(!$file_srl) return;
|
||||
|
|
@ -510,21 +483,17 @@
|
|||
|
||||
$source_filename = $output->data->source_filename;
|
||||
$uploaded_filename = $output->data->uploaded_filename;
|
||||
|
||||
// trigger 호출 (before)
|
||||
// Call a trigger (before)
|
||||
$trigger_obj = $output->data;
|
||||
$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// DB에서 삭제
|
||||
// Remove from the DB
|
||||
$output = executeQuery('file.deleteFile', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// trigger 호출 (after)
|
||||
// Call a trigger (after)
|
||||
$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
// 삭제 성공하면 파일 삭제
|
||||
// If successfully deleted, remove the file
|
||||
FileHandler::removeFile($uploaded_filename);
|
||||
}
|
||||
|
||||
|
|
@ -532,22 +501,19 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 문서의 첨부파일을 모두 삭제
|
||||
* @brief Delete all attachments of a particular document
|
||||
**/
|
||||
function deleteFiles($upload_target_srl) {
|
||||
// 첨부파일 목록을 받음
|
||||
// Get a list of attachements
|
||||
$oFileModel = &getModel('file');
|
||||
$file_list = $oFileModel->getFiles($upload_target_srl);
|
||||
|
||||
// 첨부파일이 없으면 성공 return
|
||||
// Success returned if no attachement exists
|
||||
if(!is_array($file_list)||!count($file_list)) return new Object();
|
||||
|
||||
// DB에서 삭제
|
||||
// Remove from the DB
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$output = executeQuery('file.deleteFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// 실제 파일 삭제
|
||||
// Delete the file
|
||||
$path = array();
|
||||
$file_count = count($file_list);
|
||||
for($i=0;$i<$file_count;$i++) {
|
||||
|
|
@ -558,15 +524,14 @@
|
|||
$path_info = pathinfo($uploaded_filename);
|
||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
||||
}
|
||||
|
||||
// 해당 글의 첨부파일 디렉토리 삭제
|
||||
// Remove a file directory of the document
|
||||
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 글의 첨부파일을 다른 글로 이동
|
||||
* @brief Move an attachement to the other document
|
||||
**/
|
||||
function moveFile($source_srl, $target_module_srl, $target_srl) {
|
||||
if($source_srl == $target_srl) return;
|
||||
|
|
@ -582,8 +547,7 @@
|
|||
unset($file_info);
|
||||
$file_info = $file_list[$i];
|
||||
$old_file = $file_info->uploaded_filename;
|
||||
|
||||
// 이미지인지 기타 파일인지 체크하여 이동할 위치 정함
|
||||
// Determine the file path by checking if the file is an image or other kinds
|
||||
if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) {
|
||||
$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl);
|
||||
$new_file = $path.$file_info->source_filename;
|
||||
|
|
@ -591,17 +555,13 @@
|
|||
$path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl);
|
||||
$new_file = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
|
||||
}
|
||||
|
||||
// 이전 대상이 동일하면 그냥 패스
|
||||
// Pass if a target document to move is same
|
||||
if($old_file == $new_file) continue;
|
||||
|
||||
// 디렉토리 생성
|
||||
// Create a directory
|
||||
FileHandler::makeDir($path);
|
||||
|
||||
// 파일 이동
|
||||
// Move the file
|
||||
FileHandler::rename($old_file, $new_file);
|
||||
|
||||
// DB 정보도 수정
|
||||
// Update DB information
|
||||
unset($args);
|
||||
$args->file_srl = $file_info->file_srl;
|
||||
$args->uploaded_filename = $new_file;
|
||||
|
|
@ -612,7 +572,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
||||
* @brief Find the attachment where a key is upload_target_srl and then return java script code
|
||||
**/
|
||||
function printUploadedFileList($editor_sequence, $upload_target_srl) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
/**
|
||||
* @class fileModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file 모듈의 model 클래스
|
||||
* @brief model class of the file module
|
||||
**/
|
||||
|
||||
class fileModel extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 문서에 속한 첨부파일 목록을 return
|
||||
* 문서 생성/ 수정시 ajax로 특정 upload_target_srl에 대해서 파일 목록을 요청받을 때 사용됨.
|
||||
* upload_target_srl이 정해지지 않은 경우 서버측 session의 값으로 대체 시도
|
||||
* @brief Return a file list attached in the document
|
||||
* It is used when a file list of the upload_target_srl is requested for creating/updating a document.
|
||||
* Attempt to replace with sever-side session if upload_target_srl is not yet determined
|
||||
**/
|
||||
function getFileList() {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -50,16 +50,13 @@
|
|||
$attached_size = 0;
|
||||
$files = array();
|
||||
}
|
||||
|
||||
// 업로드 상태 표시 작성
|
||||
// Display upload status
|
||||
$upload_status = $this->getUploadStatus($attached_size);
|
||||
|
||||
// 남은 용량 체크
|
||||
// Check remained file size until upload complete
|
||||
$config = $oModuleModel->getModuleInfoByMid($mid);
|
||||
$file_config = $this->getUploadConfig();
|
||||
$left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size;
|
||||
|
||||
// 필요한 정보들 세팅
|
||||
// Settings of required information
|
||||
$this->add("files",$files);
|
||||
$this->add("editor_sequence",$editor_sequence);
|
||||
$this->add("upload_target_srl",$upload_target_srl);
|
||||
|
|
@ -68,7 +65,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 문서에 속한 첨부파일의 개수를 return
|
||||
* @brief Return number of attachments which belongs to a specific document
|
||||
**/
|
||||
function getFilesCount($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
|
|
@ -77,17 +74,17 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 다운로드 경로를 구함
|
||||
* @brief Get a download path
|
||||
**/
|
||||
function getDownloadUrl($file_srl, $sid) {
|
||||
return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 파일 설정 정보를 구함
|
||||
* @brief Get file cinfigurations
|
||||
**/
|
||||
function getFileConfig($module_srl = null) {
|
||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$file_module_config = $oModuleModel->getModuleConfig('file');
|
||||
|
|
@ -104,8 +101,7 @@
|
|||
$config->allow_outlink_site = $file_config->allow_outlink_site;
|
||||
$config->allow_outlink_format = $file_config->allow_outlink_format;
|
||||
}
|
||||
|
||||
// 전체 파일첨부 속성을 먼저 따른다
|
||||
// Property for all files comes first than each property
|
||||
if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize;
|
||||
if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size;
|
||||
if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes;
|
||||
|
|
@ -113,8 +109,7 @@
|
|||
if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site;
|
||||
if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format;
|
||||
if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant;
|
||||
|
||||
// 그래도 없으면 default로
|
||||
// Default setting if not exists
|
||||
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 = '*.*';
|
||||
|
|
@ -125,7 +120,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 파일 정보를 구함
|
||||
* @brief Get file information
|
||||
**/
|
||||
function getFile($file_srl) {
|
||||
$args->file_srl = $file_srl;
|
||||
|
|
@ -139,7 +134,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 문서에 속한 파일을 모두 return
|
||||
* @brief Return all files which belong to a specific document
|
||||
**/
|
||||
function getFiles($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
|
|
@ -163,7 +158,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일에 대한 설정을 return (관리자/비관리자 자동 구분)
|
||||
* @brief Return configurations of the attachement (it automatically checks if an administrator is)
|
||||
**/
|
||||
function getUploadConfig() {
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
|
@ -173,7 +168,7 @@
|
|||
$file_config->allowed_filetypes = '*.*';
|
||||
} else {
|
||||
$module_srl = Context::get('module_srl');
|
||||
// module_srl이 없으면 현재 모듈
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$module_srl) {
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$module_srl = $current_module_info->module_srl;
|
||||
|
|
@ -184,12 +179,11 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 파일 업로드를 위한 관리자/비관리자에 따른 안내문구 return
|
||||
* @brief Return messages for file upload and it depends whether an admin is or not
|
||||
**/
|
||||
function getUploadStatus($attached_size = 0) {
|
||||
$file_config = $this->getUploadConfig();
|
||||
|
||||
// 업로드 상태 표시 작성
|
||||
// Display upload status
|
||||
$upload_status = sprintf(
|
||||
'%s : %s/ %s<br /> %s : %s (%s : %s)',
|
||||
Context::getLang('allowed_attach_size'),
|
||||
|
|
@ -204,7 +198,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 모듈의 file 설정을 return
|
||||
* @brief Return file configuration of the module
|
||||
**/
|
||||
function getFileModuleConfig($module_srl) {
|
||||
return $this->getFileConfig($module_srl);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* @class fileView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief file module의 view class
|
||||
* @brief The view class file module
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
@ -11,38 +11,35 @@
|
|||
class fileView extends file {
|
||||
|
||||
/**
|
||||
* @brief 초기화
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 서비스형 모듈의 추가 설정을 위한 부분
|
||||
* file의 사용 형태에 대한 설정만 받음
|
||||
* @brief This is for additional configuration for service module
|
||||
* It only receives file configurations
|
||||
**/
|
||||
function triggerDispFileAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls) {
|
||||
// 선택된 모듈의 정보를 가져옴
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new Object();
|
||||
}
|
||||
|
||||
// 선택된 모듈의 file설정을 가져옴
|
||||
// Get file configurations of the module
|
||||
$oFileModel = &getModel('file');
|
||||
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
|
||||
Context::set('file_config', $file_config);
|
||||
|
||||
// 그룹의 설정을 위한 권한 가져오기
|
||||
// Get a permission for group setting
|
||||
$oMemberModel = &getModel('member');
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||
Context::set('group_list', $group_list);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
// Set a template file
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config');
|
||||
$obj .= $tpl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue