mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@741 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6848735a30
commit
e71e466612
6 changed files with 66 additions and 3 deletions
|
|
@ -52,7 +52,6 @@
|
|||
} else {
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
debugPrint($args);
|
||||
|
||||
// 일단 이전 저장본 삭제
|
||||
$oDB = &DB::getInstance();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
/**
|
||||
* @brief 자동저장되어 있는 정보를 가져옴
|
||||
**/
|
||||
function getSavedDoc() {
|
||||
function getSavedDoc($upload_target_srl) {
|
||||
// 로그인 회원이면 member_srl, 아니면 ipaddress로 저장되어 있는 문서를 찾음
|
||||
if(Context::get('is_logged')) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
|
@ -28,6 +28,11 @@
|
|||
$oEditorController = &getController('editor');
|
||||
$oEditorController->deleteSavedDoc();
|
||||
|
||||
// 첨부된 파일이 있으면 현재 글 번호로 옮김
|
||||
$module_srl = Context::get('module_srl');
|
||||
$oFileController = &getController('file');
|
||||
$oFileController->moveFile($saved_doc->document_srl, $module_srl, $upload_target_srl);
|
||||
|
||||
return $saved_doc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
// 저장된 임시본이 있는지 검사
|
||||
if($enable_autosave) {
|
||||
$saved_doc = $oEditorModel->getSavedDoc();
|
||||
$saved_doc = $oEditorModel->getSavedDoc($upload_target_srl);
|
||||
Context::set('saved_doc', $saved_doc);
|
||||
}
|
||||
Context::set('enable_autosave', $enable_autosave);
|
||||
|
|
|
|||
|
|
@ -132,6 +132,49 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 글의 첨부파일을 다른 글로 이동
|
||||
**/
|
||||
function moveFile($source_srl, $target_module_srl, $target_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
$file_list = $oFileModel->getFiles($source_srl);
|
||||
if(!$file_list) return;
|
||||
|
||||
$file_count = count($file_list);
|
||||
|
||||
for($i=0;$i<$file_count;$i++) {
|
||||
|
||||
unset($file_info);
|
||||
$file_info = $file_list[$i];
|
||||
$old_file = $file_info->uploaded_filename;
|
||||
|
||||
// 이미지인지 기타 파일인지 체크하여 이동할 위치 정함
|
||||
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info->source_filename)) {
|
||||
$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl);
|
||||
$new_file = $path.$file_info->source_filename;
|
||||
} else {
|
||||
$path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl);
|
||||
$new_file = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
|
||||
}
|
||||
|
||||
// 디렉토리 생성
|
||||
FileHandler::makeDir($path);
|
||||
|
||||
// 파일 이동
|
||||
@rename($old_file, $new_file);
|
||||
|
||||
// DB 정보도 수정
|
||||
unset($args);
|
||||
$args->file_srl = $file_info->file_srl;
|
||||
$args->uploaded_filename = $new_file;
|
||||
$args->module_srl = $file_info->module_srl;
|
||||
$args->upload_target_srl = $target_srl;
|
||||
$oDB->executeQuery('file.updateFile', $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->sort_index = 'file_srl';
|
||||
$output = $oDB->executeQuery('file.getFiles', $args);
|
||||
if(!$output->data) return;
|
||||
|
||||
$file_list = $output->data;
|
||||
|
||||
|
|
|
|||
15
modules/file/queries/updateFile.xml
Normal file
15
modules/file/queries/updateFile.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<query id="updateFile" action="update">
|
||||
<tables>
|
||||
<table name="files" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="upload_target_srl" var="upload_target_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="uploaded_filename" var="uploaded_filename" notnull="notnull" minlength="1" maxlength="250" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue