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@460 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
fc5fbe3cc4
commit
ed7391e775
11 changed files with 39 additions and 33 deletions
|
|
@ -26,11 +26,11 @@
|
|||
if(__DEBUG__) $start = getMicroTime();
|
||||
|
||||
// 변수 체크
|
||||
if(substr($tpl_path,-1)!='/') $tpl_path .= '/';
|
||||
$this->tpl_path = ereg_replace('(\/+)$', '', $this->tpl_path).'/';
|
||||
if(substr($tpl_filename,-5)!='.html') $tpl_filename .= '.html';
|
||||
|
||||
// tpl_file 변수 생성
|
||||
$tpl_file = $tpl_path.$tpl_filename;
|
||||
$tpl_file = $this->tpl_path.$tpl_filename;
|
||||
|
||||
// tpl_file이 비어 있거나 해당 파일이 없으면 return
|
||||
if(!$tpl_file || !file_exists($tpl_file)) return;
|
||||
|
|
@ -75,12 +75,12 @@
|
|||
$buff = FileHandler::readFile($tpl_file);
|
||||
if(!$buff) return;
|
||||
|
||||
// 이미지 태그 img의 src의 값이 http:// 나 / 로 시작하지 않으면 제로보드의 root경로부터 시작하도록 변경
|
||||
$buff = preg_replace_callback('!img([^>]*)src=[\'"]{1}(.*?)[\'"]{1}!is', array($this, '_compileImgPath'), $buff);
|
||||
|
||||
// 변수를 변경
|
||||
$buff = preg_replace_callback('/\{[^@^ ]([^\}]+)\}/i', array($this, '_compileVarToContext'), $buff);
|
||||
|
||||
// 이미지 태그 img의 src의 값이 ./ 로 시작하면 {$tpl_path}로 변경
|
||||
$buff = preg_replace_callback('!src=[\'"]{1}(.*?)[\'"]{1}!is', array($this, '_compileImgPath'), $buff);
|
||||
|
||||
// 결과를 출력하지 않는 구문 변경
|
||||
$buff = preg_replace_callback('/\{\@([^\}]+)\}/i', array($this, '_compileVarToSilenceExecute'), $buff);
|
||||
|
||||
|
|
@ -118,11 +118,13 @@
|
|||
**/
|
||||
function _compileImgPath($matches) {
|
||||
$str1 = $matches[0];
|
||||
$str2 = $matches[1];
|
||||
$str2 = $matches[2];
|
||||
$path = $str2;
|
||||
if(!eregi("^\.\/(images|img)",$path)) return $str1;
|
||||
|
||||
$path = '<?=$this->tpl_path?>'.substr($path,2);
|
||||
if(substr($path,0,1)=='/' || eregi(":\/\/",$path)) return $str1;
|
||||
|
||||
$path = preg_replace('/^([\.\/]+)/','',$path);
|
||||
$path = '<?=$this->tpl_path?>'.$path;
|
||||
return str_replace($str2, $path, $str1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,11 @@
|
|||
<!--@end-->
|
||||
<tr>
|
||||
<th>{$lang->content}</th>
|
||||
<td><!--#include("$editor_path/editor.html")--></td>
|
||||
<td>
|
||||
{@$upload_target_srl = $document_srl}
|
||||
<!--#include("$editor_path/editor.html")-->
|
||||
<!--#include("$editor_path/editor_uploader.html")-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
|
|
|||
|
|
@ -68,10 +68,9 @@
|
|||
<tr>
|
||||
<th>{$lang->content}</th>
|
||||
<td>
|
||||
{@$upload_target_srl = $document_srl}
|
||||
<!--#include("$editor_path/editor.html")-->
|
||||
<!--@if($grant->fileupload)-->
|
||||
<!--#include("$editor_path/editor_uploader.html")-->
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
/**
|
||||
* @brief 첨부파일 추가
|
||||
**/
|
||||
function insertFile($module_srl, $document_srl) {
|
||||
function insertFile($module_srl, $upload_target_srl) {
|
||||
$file_info = Context::get('file');
|
||||
|
||||
// 정상적으로 업로드된 파일이 아니면 오류 출력
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
// 이미지인지 기타 파일인지 체크하여 upload path 지정
|
||||
if(eregi("\.(jpg|jpeg|gif|png|wmv|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) {
|
||||
$path = sprintf("./files/attach/images/%s/%s/", $module_srl,$document_srl);
|
||||
$path = sprintf("./files/attach/images/%s/%s/", $module_srl,$upload_target_srl);
|
||||
$filename = $path.$file_info['name'];
|
||||
$direct_download = 'Y';
|
||||
} else {
|
||||
$path = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
|
||||
$path = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $upload_target_srl);
|
||||
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
|
||||
$direct_download = 'N';
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
// 파일 정보를 정리
|
||||
$args->file_srl = $oDB->getNextSequence();
|
||||
$args->document_srl = $document_srl;
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->module_srl = $module_srl;
|
||||
$args->direct_download = $direct_download;
|
||||
$args->source_filename = $file_info['name'];
|
||||
|
|
@ -96,16 +96,16 @@
|
|||
/**
|
||||
* @brief 특정 문서의 첨부파일을 모두 삭제
|
||||
**/
|
||||
function deleteFiles($module_srl, $document_srl) {
|
||||
function deleteFiles($module_srl, $upload_target_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$args->document_srl = $document_srl;
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$output = $oDB->executeQuery('file.deleteFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// 실제 파일 삭제
|
||||
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $document_srl);
|
||||
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $document_srl);
|
||||
$path[0] = sprintf("./files/attach/images/%s/%s/", $module_srl, $upload_target_srl);
|
||||
$path[1] = sprintf("./files/attach/binaries/%s/%s/", $module_srl, $upload_target_srl);
|
||||
|
||||
FileHandler::removeDir($path[0]);
|
||||
FileHandler::removeDir($path[1]);
|
||||
|
|
@ -133,14 +133,14 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief document_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
||||
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
|
||||
**/
|
||||
function printUploadedFileList($document_srl) {
|
||||
function printUploadedFileList($upload_target_srl) {
|
||||
// file의 Model객체 생성
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
// 첨부파일 목록을 구함
|
||||
$file_list = $oFileModel->getFiles($document_srl);
|
||||
$file_list = $oFileModel->getFiles($upload_target_srl);
|
||||
$file_count = count($file_list);
|
||||
|
||||
// 루프를 돌면서 $buff 변수에 java script 코드를 생성
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
$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("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $upload_target_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);
|
||||
}
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
$buff = sprintf("<script type=\"text/javascript\">\nparent.editor_upload_clear_list(\"%s\");\n%s</script>", $document_srl, $buff);
|
||||
$buff = sprintf("<script type=\"text/javascript\">\nparent.editor_upload_clear_list(\"%s\");\n%s</script>", $upload_target_srl, $buff);
|
||||
print $buff;
|
||||
exit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
/**
|
||||
* @brief 특정 문서에 속한 첨부파일의 개수를 return
|
||||
**/
|
||||
function getFilesCount($document_srl) {
|
||||
function getFilesCount($upload_target_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$args->document_srl = $document_srl;
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$output = $oDB->executeQuery('file.getFilesCount', $args);
|
||||
return (int)$output->data->count;
|
||||
}
|
||||
|
|
@ -38,10 +38,10 @@
|
|||
/**
|
||||
* @brief 특정 문서에 속한 파일을 모두 return
|
||||
**/
|
||||
function getFiles($document_srl) {
|
||||
function getFiles($upload_target_srl) {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
$args->document_srl = $document_srl;
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->sort_index = 'file_srl';
|
||||
$output = $oDB->executeQuery('file.getFiles', $args);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
<table name="files" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<table name="files" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" order="asc" />
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
</tables>
|
||||
<columns>
|
||||
<column name="file_srl" var="file_srl" notnull="notnull" />
|
||||
<column name="document_srl" var="document_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="upload_target_srl" var="upload_target_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="sid" var="sid" />
|
||||
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="source_filename" var="source_filename" notnull="notnull" minlength="1" maxlength="250" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<table name="files">
|
||||
<column name="file_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="upload_target_srl" type="number" size="11" default="0" notnull="notnull" index="idx_upload_target_srl" />
|
||||
<column name="sid" type="varchar" size="60" />
|
||||
<column name="document_srl" type="number" size="11" default="0" notnull="notnull" index="idx_document_srl" />
|
||||
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
|
||||
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
|
||||
<column name="download_count" type="number" size="11" notnull="notnull" default="0" index="idx_download_count" />
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
<tr>
|
||||
<th>{$lang->content}</th>
|
||||
<td>
|
||||
{@upload_target_srl = $document_srl}
|
||||
<!--#include("$editor_path/editor.html")-->
|
||||
<!--#include("$editor_path/editor_uploader.html")-->
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue