mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
1. fileModel::getIsPermitted() 함수 제거 (내부 구현코드가 미완성이라 이 함수를 제거하고 editor_sequence, uploadTargetSrl 을 이용하여 파일 업로드 점검하도록 수정)
2. 관리자 페이지에서 비로그인 회원이 업로드한 것을 제대로 보여주도록 file.getFileList.xml 쿼리문에 대해서 file, member간의 left outer join 을 정의 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6598 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
85c5bba127
commit
6222a6aef8
6 changed files with 43 additions and 106 deletions
|
|
@ -26,4 +26,4 @@
|
|||
<navigation>
|
||||
<index var="sort_index" default="extra_keys.var_idx" order="asc" />
|
||||
</navigation>
|
||||
</query>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@
|
|||
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
|
||||
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
||||
|
||||
// 2009. 06. 13 자동 저장된 SRL 체크
|
||||
$oModuleController->insertTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
@ -71,8 +68,8 @@
|
|||
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
|
||||
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
|
||||
|
||||
// 2009. 06. 13 자동 저장된 SRL 체크
|
||||
if(!$oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
|
||||
// 2009. 06. 19 사용하지 않는 트리거 제거
|
||||
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -109,9 +106,9 @@
|
|||
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
|
||||
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
||||
|
||||
// 2009. 06. 13 자동 저장된 SRL 체크
|
||||
if(!$oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
|
||||
$oModuleController->insertTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
|
||||
// 2009. 06. 19 사용하지 않는 트리거 제거
|
||||
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
|
||||
$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,18 +242,6 @@
|
|||
return executeQuery('editor.insertSavedDoc', $args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 자동 저장글 Srl 로드 (자기글인지 확인)
|
||||
**/
|
||||
function triggerSrlSetting(&$obj) {
|
||||
$oEditorModel = &getModel('editor');
|
||||
$saved_doc = $oEditorModel->getSavedDoc(null);
|
||||
if($obj->uploadTargetSrl == $saved_doc->document_srl) Context::set("getIsPermitted",$saved_doc->document_srl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 자동 저장글 Srl 로드 - XE 이전 버전 사용자를 위함.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -16,45 +16,30 @@
|
|||
|
||||
/**
|
||||
* @brief 에디터에서 첨부파일 업로드
|
||||
* editor_sequence, uploadTargetSrl 변수값을 받아서 이를 바탕으로 첨부 대상 srl을 결정함.
|
||||
* 만약 uploadTargetSrl이 없다면 새로 생성하고 return 하여 UI에서 이에 대한 값을 재설정하도록 하여
|
||||
* sync이상없도록 함
|
||||
**/
|
||||
function procFileUpload() {
|
||||
// 기본적으로 필요한 변수 설정
|
||||
$oFileModel = &getModel('file');
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$upload_target_srl = Context::get('uploadTargetSrl');
|
||||
$module_srl = $this->module_srl;
|
||||
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
|
||||
|
||||
// upload_target_srl 구함
|
||||
$tmp_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
if(!$tmp_target_srl) {
|
||||
if($oFileModel->getIsPermitted(Context::get('uploadTargetSrl'))) {
|
||||
$tmp_target_srl = Context::get('uploadTargetSrl');
|
||||
}
|
||||
}
|
||||
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
|
||||
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
||||
$tmp_files = $oFileModel->getFiles($tmp_target_srl);
|
||||
if(is_array($tmp_files)) $tmp_file = $tmp_files[0];
|
||||
|
||||
// 첨부될 target_srl이 이전에 쓰인 target_srl인지 확인, 쓰였다면 이 모듈에서 쓰인게 맞는지 확인
|
||||
if(!$tmp_file || !$tmp_file->file_srl || $tmp_file->module_srl == $module_srl) {
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = $tmp_target_srl;
|
||||
}
|
||||
else {
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = '';
|
||||
}
|
||||
unset($tmp_files);
|
||||
unset($tmp_file);
|
||||
|
||||
if(!$upload_target_srl) {
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
}
|
||||
// 세션정보에도 정의되지 않았다면 새로 생성
|
||||
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
|
||||
$file_info = Context::get('Filedata');
|
||||
|
||||
// 정상적으로 업로드된 파일이 아니면 오류 출력
|
||||
if(!is_uploaded_file($file_info['tmp_name'])) return false;
|
||||
if(!is_uploaded_file($file_info['tmp_name'])) exit();
|
||||
|
||||
return $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||
}
|
||||
|
|
@ -68,33 +53,31 @@
|
|||
$editor_sequence = Context::get('editor_sequence');
|
||||
$callback = Context::get('callback');
|
||||
$module_srl = $this->module_srl;
|
||||
$upload_target_srl = Context::get('uploadTargetSrl');
|
||||
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
|
||||
|
||||
$file_srl = Context::get('file_srl');
|
||||
if($file_srl){
|
||||
$this->deleteFile($file_srl);
|
||||
}
|
||||
|
||||
// upload_target_srl 구함
|
||||
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
if(!$upload_target_srl) {
|
||||
$oFileModel = &getModel('file');
|
||||
if($oFileModel->getIsPermitted(Context::get('uploadTargetSrl'))) {
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = Context::get('uploadTargetSrl');
|
||||
}
|
||||
}
|
||||
if(!$upload_target_srl) {
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
}
|
||||
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
|
||||
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
||||
// 세션정보에도 정의되지 않았다면 새로 생성
|
||||
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||
|
||||
// file_srl이 요청되었을 경우 삭제 후 재업로드 시도
|
||||
$file_srl = Context::get('file_srl');
|
||||
if($file_srl) $this->deleteFile($file_srl);
|
||||
|
||||
$file_info = Context::get('Filedata');
|
||||
|
||||
// 정상적으로 업로드된 파일이 아니면 오류 출력
|
||||
if(is_uploaded_file($file_info['tmp_name'])){
|
||||
if(is_uploaded_file($file_info['tmp_name'])) {
|
||||
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||
Context::set('uploaded_fileinfo',$output);
|
||||
}
|
||||
|
||||
Context::set('layout','none');
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('iframe');
|
||||
|
||||
|
|
|
|||
|
|
@ -15,20 +15,17 @@
|
|||
|
||||
/**
|
||||
* @brief 특정 문서에 속한 첨부파일 목록을 return
|
||||
* 문서 생성/ 수정시 ajax로 특정 upload_target_srl에 대해서 파일 목록을 요청받을 때 사용됨.
|
||||
* upload_target_srl이 정해지지 않은 경우 서버측 session의 값으로 대체 시도
|
||||
**/
|
||||
function getFileList() {
|
||||
|
||||
$mid = Context::get("mid");
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleInfoByMid($mid);
|
||||
Context::set("module_srl",$config->module_srl);
|
||||
|
||||
$editor_sequence = Context::get("editor_sequence");
|
||||
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
if(!$upload_target_srl) {
|
||||
if($this->getIsPermitted(Context::get('upload_target_srl')))
|
||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = Context::get('upload_target_srl');
|
||||
}
|
||||
$mid = Context::get('mid');
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$upload_target_srl = Context::get('upload_target_srl');
|
||||
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
|
||||
if($upload_target_srl) {
|
||||
$tmp_files = $this->getFiles($upload_target_srl);
|
||||
$file_count = count($tmp_files);
|
||||
|
|
@ -58,6 +55,7 @@
|
|||
$upload_status = $this->getUploadStatus($attached_size);
|
||||
|
||||
// 남은 용량 체크
|
||||
$config = $oModuleModel->getModuleInfoByMid($mid);
|
||||
$file_config = $this->getUploadConfig();
|
||||
$left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size;
|
||||
|
||||
|
|
@ -211,37 +209,5 @@
|
|||
function getFileModuleConfig($module_srl) {
|
||||
return $this->getFileConfig($module_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 사용자가 해당 SRL에 첨부된 파일 수정 권한이 있는지 확인 - 트리거를 통해 반환되는 정보를 이용.
|
||||
**/
|
||||
function getIsPermitted($checking_target) {
|
||||
Context::set("getIsPermitted", '');
|
||||
|
||||
// 문서가 있는지 확인
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($checking_target);
|
||||
if($oDocument->isExists() && $oDocument->document_srl == $document_srl) {
|
||||
if($oDocument->isGranted()) {
|
||||
Context::set("getIsPermitted", $checking_target);
|
||||
return $checking_target;
|
||||
}
|
||||
}
|
||||
|
||||
// 댓글이 있는지 확인
|
||||
$oCommentModel = &getModel('comment');
|
||||
$oComment = $oCommentModel->getComment($checking_target);
|
||||
if($comment->comment_srl == $comment_srl) {
|
||||
if($oComment->isGranted()) {
|
||||
Context::set("getIsPermitted", $checking_target);
|
||||
return $checking_target;
|
||||
}
|
||||
}
|
||||
|
||||
// 그 외 모듈에 있는지 확인 (eg. 자동저장 문서)
|
||||
$obj->uploadTargetSrl = $checking_target;
|
||||
$output = ModuleHandler::triggerCall('file.getIsPermitted', 'before', $obj);
|
||||
return Context::get("getIsPermitted");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
<query id="getFileList" action="select">
|
||||
<tables>
|
||||
<table name="files" alias="files" />
|
||||
<table name="member" alias="member" />
|
||||
<table name="member" alias="member" type="left join">
|
||||
<conditions>
|
||||
<condition operation="equal" column="files.member_srl" default="member.member_srl" />
|
||||
</conditions>
|
||||
</table>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="files.*" />
|
||||
|
|
@ -10,7 +14,6 @@
|
|||
<condition operation="in" column="files.module_srl" var="s_module_srl" />
|
||||
<condition operation="equal" column="files.isvalid" var="isvalid" pipe="and" />
|
||||
<condition operation="equal" column="files.direct_download" var="direct_download" pipe="and" />
|
||||
<condition operation="equal" column="files.member_srl" default="member.member_srl" pipe="and" />
|
||||
<group pipe="and">
|
||||
<condition operation="like" column="files.source_filename" var="s_filename" pipe="or" />
|
||||
<condition operation="more" column="files.file_size" var="s_filesize_more" pipe="or" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue