getComment($comment_srl); // comment_srl이 없으면 문서가 대상 } else { // 문서번호에 해당하는 글이 있는지 확인 $oDocument = getModule('document'); $data = $oDocument->getDocument($document_srl); } // 글이 없을 경우 에러 if(!$data) return $this->doError('msg_invalid_request'); // 문서의 비밀번호와 입력한 비밀번호의 비교 if($data->password != $password) return $this->doError('msg_invalid_password'); // 해당 글에 대한 권한 부여 if($comment_srl) $_SESSION['own_comment'][$comment_srl] = true; else $_SESSION['own_document'][$document_srl] = true; } /** * @brief document_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return **/ function getUploadedFileList($document_srl) { // document의 Model객체 생성 $oDocumentModel = getModule('document','model'); // 첨부파일 목록을 구함 $file_list = $oDocumentModel->getFiles($document_srl); $file_count = count($file_list); // 루프를 돌면서 $buff 변수에 java script 코드를 생성 $buff = ""; for($i=0;$i<$file_count;$i++) { $file_info = $file_list[$i]; if(!$file_info->file_srl) continue; $buff .= sprintf("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $document_srl, $file_info->file_srl, $file_info->source_filename, $file_info->file_size, FileHandler::filesize($file_info->file_size), $file_info->direct_download=='Y'?$file_info->uploaded_filename:'', $file_info->sid); } $buff = sprintf("", $document_srl, $buff); return $buff; } } ?>