git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-12 03:59:52 +00:00
commit 8326004cb2
2773 changed files with 91485 additions and 0 deletions

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">첨부파일</title>
<title xml:lang="zh-CN">上传附件</title>
<title xml:lang="en">Attachment</title>
<title xml:lang="es">Ajuntar archivo</title>
<title xml:lang="jp">添付ファイル</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="zh-CN">zero</name>
<name xml:lang="en">Zero</name>
<name xml:lang="es">zero</name>
<name xml:lang="jp">Zero</name>
<description xml:lang="ko">첨부 파일 관리하는 모듈입니다.</description>
<description xml:lang="zh-CN">管理附件的模块。</description>
<description xml:lang="en">Module for managing attachments.</description>
<description xml:lang="es">Es el módulo maneja archivo ajuntado.</description>
<description xml:lang="jp">添付ファイルを管理するモジュールです。</description>
</author>
</module>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<actions>
<action name="dispFileAdminList" type="view" admin_index="true" standalone="true" />
<action name="dispFileAdminConfig" type="view" standalone="true" />
<action name="procFileUpload" type="controller" standalone="true" />
<action name="procFileDelete" type="controller" standalone="true" />
<action name="procFileDownload" type="controller" standalone="true" />
<action name="procFileAdminDeleteChecked" type="controller" standalone="true" />
<action name="procFileAdminInsertConfig" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,71 @@
<?php
/**
* @class fileAdminController
* @author zero (zero@nzeo.com)
* @brief file 모듈의 admin controller 클래스
**/
class fileAdminController extends file {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl) {
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$path[0] = sprintf("./files/attach/images/%s/", $module_srl);
$path[1] = sprintf("./files/attach/binaries/%s/", $module_srl);
FileHandler::removeDir($path[0]);
FileHandler::removeDir($path[1]);
return $output;
}
/**
* @brief 관리자 페이지에서 선택된 파일들을 삭제
**/
function procFileAdminDeleteChecked() {
// 선택된 글이 없으면 오류 표시
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$file_srl_list= explode('|@|', $cart);
$file_count = count($file_srl_list);
if(!$file_count) return $this->stop('msg_cart_is_null');
$oFileController = &getController('file');
// 글삭제
for($i=0;$i<$file_count;$i++) {
$file_srl = trim($file_srl_list[$i]);
if(!$file_srl) continue;
$oFileController->deleteFile($file_srl);
}
$this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) );
}
/**
* @brief 파일 기본 정보의 추가
**/
function procFileAdminInsertConfig() {
// 기본 정보를 받음
$args = Context::gets('allowed_filesize','allowed_attach_size','allowed_filetypes');
// module Controller 객체 생성하여 입력
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('file',$args);
return $output;
}
}
?>

View file

@ -0,0 +1,73 @@
<?php
/**
* @class fileAdminModel
* @author zero (zero@nzeo.com)
* @brief file 모듈의 admin model 클래스
**/
class fileAdminModel extends file {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 모든 첨부파일을 시간 역순으로 가져옴 (관리자용)
**/
function getFileList($obj) {
// 검색 옵션 정리
$search_target = trim(Context::get('search_target'));
$search_keyword = trim(Context::get('search_keyword'));
if($search_target && $search_keyword) {
switch($search_target) {
case 'filename' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_filename = $search_keyword;
break;
case 'filesize' :
$args->s_filesize = (int)$search_keyword;
break;
case 'download_count' :
$args->s_download_count = (int)$search_keyword;
break;
case 'regdate' :
$args->s_regdate = $search_keyword;
break;
case 'ipaddress' :
$args->s_ipaddress= $search_keyword;
break;
}
}
// 유효/대기 상태 설정
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
// 변수 설정
$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;
// file.getFileList쿼리 실행
$output = executeQuery('file.getFileList', $args);
// 결과가 없거나 오류 발생시 그냥 return
if(!$output->toBool()||!count($output->data)) return $output;
$oFileModel = &getModel('file');
foreach($output->data as $key => $file) {
$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid);
$output->data[$key] = $file;
}
return $output;
}
}
?>

View file

@ -0,0 +1,83 @@
<?php
/**
* @class fileAdminView
* @author zero (zero@nzeo.com)
* @brief file 모듈의 admin view 클래스
**/
class fileAdminView extends file {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 목록 출력 (관리자용)
**/
function dispFileAdminList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 50; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
$args->sort_index = 'file_srl'; ///< 소팅 값
$args->isvalid = Context::get('isvalid');
$args->module_srl = Context::get('module_srl');
// 목록 구함
$oFileModel = &getAdminModel('file');
$output = $oFileModel->getFileList($args);
// mid목록을 구함
$oModuleModel = &getModel('module');
$mid_list = $oModuleModel->getMidList();
Context::set('mid_list', $mid_list);
// 목록의 loop를 돌면서 mid를 구하기 위한 module_srl값을 구함
$file_count = count($output->data);
if($file_count) {
$module_srl_list = array();
foreach($output->data as $key => $val) {
$module_srl = $val->module_srl;
if(!in_array($module_srl, $module_srl_list)) $module_srl_list[] = $module_srl;
}
if(count($module_srl_list)) {
$args->module_srls = implode(',',$module_srl_list);
$mid_output = executeQuery('module.getModuleInfoByModuleSrl', $args);
if($mid_output->data && !is_array($mid_output->data)) $mid_output->data = array($mid_output->data);
for($i=0;$i<count($mid_output->data);$i++) {
$mid_info = $mid_output->data[$i];
$module_list[$mid_info->module_srl] = $mid_info;
}
}
}
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('file_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('module_list', $module_list);
// 템플릿 지정
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('file_list');
}
/**
* @brief 첨부파일 정보 설정 (관리자용)
**/
function dispFileAdminConfig() {
$oFileModel = &getModel('file');
$config = $oFileModel->getFileConfig();
Context::set('config',$config);
// 템플릿 파일 지정
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('file_config');
}
}
?>

View file

@ -0,0 +1,49 @@
<?php
/**
* @class file
* @author zero (zero@nzeo.com)
* @brief file 모듈의 high 클래스
**/
class file extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController = &getController('module');
$oModuleController->insertActionForward('file', 'view', 'dispFileAdminList');
$oModuleController->insertActionForward('file', 'view', 'dispFileAdminConfig');
$oModuleController->insertActionForward('file', 'controller', 'procFileUpload');
$oModuleController->insertActionForward('file', 'controller', 'procFileDelete');
$oModuleController->insertActionForward('file', 'controller', 'procFileDownload');
// 첨부파일의 기본 설정 저장
$config->allowed_filesize = '2';
$config->allowed_attach_size = '2';
$config->allowed_filetypes = '*.*';
$oModuleController->insertModuleConfig('file', $config);
// file 모듈에서 사용할 디렉토리 생성
FileHandler::makeDir('./files/attach/images');
FileHandler::makeDir('./files/attach/binaries');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object();
}
}
?>

View file

@ -0,0 +1,330 @@
<?php
/**
* @class fileController
* @author zero (zero@nzeo.com)
* @brief file 모듈의 controller 클래스
**/
class fileController extends file {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 에디터에서 첨부파일 업로드
**/
function procFileUpload() {
// 기본적으로 필요한 변수 설정
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = $this->module_srl;
// 업로드 권한이 없거나 정보가 없을시 종료
if(!$_SESSION['upload_enable'][$upload_target_srl]) exit();
$file_info = Context::get('Filedata');
// 정상적으로 업로드된 파일이 아니면 오류 출력
if(!is_uploaded_file($file_info['tmp_name'])) return false;
return $this->insertFile($file_info, $module_srl, $upload_target_srl);
}
/**
* @brief 에디터에서 첨부 파일 삭제
**/
function procFileDelete() {
// 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정
$upload_target_srl = Context::get('upload_target_srl');
$file_srl = Context::get('file_srl');
// 업로드 권한이 없거나 정보가 없을시 종료
if(!$_SESSION['upload_enable'][$upload_target_srl]) exit();
if($file_srl) $output = $this->deleteFile($file_srl);
// 첨부파일의 목록을 java script로 출력
$this->printUploadedFileList($upload_target_srl);
}
/**
* @brief 업로드 가능하다고 세팅
**/
function setUploadEnable($upload_target_srl) {
$_SESSION['upload_enable'][$upload_target_srl] = true;
}
/**
* @brief 첨부파일 추가
**/
function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false) {
if(!$manual_insert) {
// 첨부파일 설정 가져옴
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') {
$oFileModel = &getModel('file');
$config = $oFileModel->getFileConfig();
$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
// 해당 문서에 첨부된 모든 파일의 용량을 가져옴 (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']);
if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size');
}
}
// 이미지인지 기타 파일인지 체크하여 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,$upload_target_srl);
$filename = $path.$file_info['name'];
$direct_download = 'Y';
} else {
$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';
}
// 디렉토리 생성
if(!FileHandler::makeDir($path)) return false;
// 파일 이동
if(!$manual_insert&&!move_uploaded_file($file_info['tmp_name'], $filename)) return false;
elseif($manual_insert) @rename($file_info['tmp_name'], $filename);
// 사용자 정보를 구함
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// 파일 정보를 정리
$args->file_srl = getNextSequence();
$args->upload_target_srl = $upload_target_srl;
$args->module_srl = $module_srl;
$args->direct_download = $direct_download;
$args->source_filename = $file_info['name'];
$args->uploaded_filename = $filename;
$args->download_count = $download_count;
$args->file_size = filesize($filename);
$args->comment = NULL;
$args->member_srl = $member_srl;
$args->sid = md5(rand(rand(1111111,4444444),rand(4444445,9999999)));
$output = executeQuery('file.insertFile', $args);
if(!$output->toBool()) return $output;
$output->add('file_srl', $args->file_srl);
$output->add('file_size', $args->file_size);
$output->add('source_filename', $args->source_filename);
return $output;
}
/**
* @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경
* 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록
**/
function setFilesValid($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
return executeQuery('file.updateFileValid', $args);
}
/**
* @brief 첨부파일 삭제
**/
function deleteFile($file_srl) {
// 파일 정보를 가져옴
$args->file_srl = $file_srl;
$output = executeQuery('file.getFile', $args);
if(!$output->toBool()) return $output;
$file_info = $output->data;
if(!$file_info) return new Object(-1, 'file_not_founded');
$source_filename = $output->data->source_filename;
$uploaded_filename = $output->data->uploaded_filename;
// DB에서 삭제
$output = executeQuery('file.deleteFile', $args);
if(!$output->toBool()) return $output;
// 삭제 성공하면 파일 삭제
unlink($uploaded_filename);
return $output;
}
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($upload_target_srl) {
// 첨부파일 목록을 받음
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($upload_target_srl);
// 첨부파일이 없으면 성공 return
if(!is_array($file_list)||!count($file_list)) return new Object();
// DB에서 삭제
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
$file_count = count($file_list);
for($i=0;$i<count($file_count);$i++) {
$module_srl = $file_list[$i]->module_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]);
}
return $output;
}
/**
* @brief 특정 글의 첨부파일을 다른 글로 이동
**/
function moveFile($source_srl, $target_module_srl, $target_srl) {
if($source_srl == $target_srl) return;
$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;
executeQuery('file.updateFile', $args);
}
}
/**
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
**/
function printUploadedFileList($upload_target_srl) {
// file의 Model객체 생성
$oFileModel = &getModel('file');
// 첨부파일 목록을 구함
$tmp_file_list = $oFileModel->getFiles($upload_target_srl);
$file_count = count($tmp_file_list);
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y') {
//$file_config->allowed_filesize = 1024;
//$file_config->allowed_attach_size = 1024;
$file_config->allowed_filesize = ini_get('upload_max_filesize');
$file_config->allowed_attach_size = ini_get('upload_max_filesize');
$file_config->allowed_filetypes = '*.*';
} else {
$file_config = $oFileModel->getFileConfig();
}
// 루프를 돌면서 $buff 변수에 java script 코드를 생성
$buff = "";
for($i=0;$i<$file_count;$i++) {
$file_info = $tmp_file_list[$i];
if(!$file_info->file_srl) continue;
if($file_info->direct_download == 'Y') $file_info->uploaded_filename = sprintf('%s%s', Context::getRequestUri(), str_replace('./', '', $file_info->uploaded_filename));
$file_list[] = $file_info;
$attached_size += $file_info->file_size;
}
// 업로드 상태 표시 작성
$upload_status = sprintf(
'%s : %s/ %s<br /> %s : %s (%s : %s)',
Context::getLang('allowed_attach_size'),
FileHandler::filesize($attached_size),
FileHandler::filesize($file_config->allowed_attach_size*1024*1024),
Context::getLang('allowed_filesize'),
FileHandler::filesize($file_config->allowed_filesize*1024*1024),
Context::getLang('allowed_filetypes'),
$file_config->allowed_filetypes
);
Context::set('upload_target_srl', $upload_target_srl);
Context::set('file_list', $file_list);
Context::set('upload_status', $upload_status);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('print_uploaded_file_list');
}
/**
* @brief 첨부파일 다운로드
* 직접 요청을 받음
* file_srl : 파일의 sequence
* sid : db에 저장된 비교 , 틀리면 다운로드 하지 낳음
**/
function procFileDownload() {
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// 파일의 정보를 DB에서 받아옴
$oFileModel = &getModel('file');
$file_obj = $oFileModel->getFile($file_srl);
if($file_obj->file_srl!=$file_srl||$file_obj->sid!=$sid) exit();
// 이상이 없으면 download_count 증가
$args->file_srl = $file_srl;
executeQuery('file.updateFileDownloadCount', $args);
// 파일 출력
$filename = $file_obj->source_filename;
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$filename = urlencode($filename);
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
}
$uploaded_filename = $file_obj->uploaded_filename;
if(!file_exists($uploaded_filename)) exit();
$fp = fopen($uploaded_filename, 'rb');
if(!$fp) exit();
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-Length: " .(string)($file_obj->file_size));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
fpassthru($fp);
exit();
}
}
?>

View file

@ -0,0 +1,83 @@
<?php
/**
* @class fileModel
* @author zero (zero@nzeo.com)
* @brief file 모듈의 model 클래스
**/
class fileModel extends file {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 특정 문서에 속한 첨부파일의 개수를 return
**/
function getFilesCount($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.getFilesCount', $args);
return (int)$output->data->count;
}
/**
* @brief 다운로드 경로를 구함
**/
function getDownloadUrl($file_srl, $sid) {
return getUrl('','module','file','act','procFileDownload','file_srl',$file_srl,'sid',$sid);
}
/**
* @brief 파일 설정 정보를 구함
**/
function getFileConfig() {
// 설정 정보를 받아옴 (module model 객체를 이용)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('file');
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 = '*.*';
return $config;
}
/**
* @brief 파일 정보를 구함
**/
function getFile($file_srl) {
$args->file_srl = $file_srl;
$output = executeQuery('file.getFile', $args);
if(!$output->toBool()) return $output;
$file = $output->data;
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
return $file;
}
/**
* @brief 특정 문서에 속한 파일을 모두 return
**/
function getFiles($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
$args->sort_index = 'file_srl';
$output = executeQuery('file.getFiles', $args);
if(!$output->data) return;
$file_list = $output->data;
if($file_list && !is_array($file_list)) $file_list = array($file_list);
$file_count = count($file_list);
for($i=0;$i<$file_count;$i++) {
$file = $file_list[$i];
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
$file_list[$i] = $file;
}
return $file_list;
}
}
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* @file modules/file/lang/en.lang.php
* @author zero <zero@nzeo.com>
* @brief Attachment module's basic language pack
**/
$lang->file = 'Attachment';
$lang->file_name = 'File name';
$lang->file_size = 'File size';
$lang->download_count = 'Number of downloads';
$lang->status = 'Status';
$lang->is_valid = 'Valid';
$lang->is_stand_by = 'Stand by';
$lang->file_list = 'Attachments list';
$lang->allowed_filesize = 'File size limit';
$lang->allowed_attach_size = 'Total size limit';
$lang->allowed_filetypes = 'Allowed extensions';
$lang->about_allowed_filesize = 'You can assign file size limit for each file. (Excluding administrators)';
$lang->about_allowed_attach_size = 'You can assign file size limit for each document. (Excluding administrators)';
$lang->about_allowed_filetypes = 'Only allowed extentsions can be attached. To allow an extention, use "*.extention". To allow multiple extentions, use ";" between each extentions.<br />ex) *.* or *.jpg;*.gif;<br />(Excludes Administrators)';
$lang->cmd_delete_checked_file = 'Delete Selected';
$lang->cmd_move_to_document = 'Move to document';
$lang->cmd_download = 'Download';
$lang->msg_cart_is_null = 'Select the file you wish to delete';
$lang->msg_checked_file_is_deleted = 'Total of %d attachments has been deleted';
$lang->msg_exceeds_limit_size = 'Attachment faild; exceeded the file size limit';
$lang->search_target_list = array(
'filename' => 'File name',
'filesize' => 'File size (byte, Above)',
'download_count' => 'Downloads (Above)',
'regdate' => 'Date',
'ipaddress' => 'IP Address',
);
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* @file modules/file/lang/es.lang.php
* @author zero <zero@nzeo.com>
* @brief Paquete lingual de archivo ajuntado
**/
$lang->file = 'Ajuntar Archivo';
$lang->file_name = 'Nombre de Archivo';
$lang->file_size = 'Tamaño';
$lang->download_count = 'Bajado';
$lang->status = 'Estado';
$lang->is_valid = 'Valido';
$lang->is_stand_by = 'Preparado';
$lang->file_list = 'Lista de archivo';
$lang->allowed_filesize = 'Tamaño maximo de archivo';
$lang->allowed_attach_size = 'Tamaño maximo en total por documento';
$lang->allowed_filetypes = 'Tipo de Archivos';
$lang->about_allowed_filesize = 'Puede especificar el limite de archivos incluidos. (excepto administrador)';
$lang->about_allowed_attach_size = 'Pueude especificar el limite de archivos incluidos en documento. (excepto administrador)';
$lang->about_allowed_filetypes = 'Puede subir archivo solo extenciónes definido. Puede definir en la forma como: "*.extensión", y puede usar ";" para muliples.<br />ej) *.* o *.jpg;*.gif;<br />(excepto administrador)';
$lang->cmd_delete_checked_file = 'eliminar la selección';
$lang->cmd_move_to_document = 'mover a documento';
$lang->cmd_download = 'bajar';
$lang->msg_cart_is_null = 'Por favor seleccióne archivo';
$lang->msg_checked_file_is_deleted = 'Ha eliminado %d archivos';
$lang->msg_exceeds_limit_size = 'Ha excedido del limite de incluidos';
$lang->search_target_list = array(
'filename' => 'Nombre',
'filesize' => 'Tamaño (byte)',
'download_count' => 'Bajado (más)',
'regdate' => 'Registrado',
'ipaddress' => 'Dirección IP',
);
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* @file modules/file/lang/jp.lang.php
* @author zero <zero@nzeo.com> 翻訳RisaPapa
* @brief 添付ファイルfileモジュールの基本言語パッケージ
**/
$lang->file = '添付ファイル';
$lang->file_name = 'ファイル名';
$lang->file_size = 'ファイルサイズ';
$lang->download_count = 'ダウンロード数';
$lang->status = '状態';
$lang->is_valid = '有効';
$lang->is_stand_by = '待機';
$lang->file_list = '添付ファイルリスト';
$lang->allowed_filesize = 'ファイルサイズ制限';
$lang->allowed_attach_size = '書き込みへの添付制限';
$lang->allowed_filetypes = '添付可能な拡張子';
$lang->about_allowed_filesize = '一つのファイルに対して、アップロードできるファイルの最大サイズを指定します(管理者除外)。';
$lang->about_allowed_attach_size = '一つの書き込みに対して、添付できる最大サイズを指定します(管理者除外)。';
$lang->about_allowed_filetypes = 'アップロードできるように設定されたファイルのみが添付できます。"*.拡張子"で指定し、 ";"で区切って任意の拡張子を追加して指定できます(管理者除外)。<br />ex) *.* or *.jpg;*.gif;<br />';
$lang->cmd_delete_checked_file = '選択リスト削除';
$lang->cmd_move_to_document = '書き込みに移動する';
$lang->cmd_download = 'ダウンロード';
$lang->msg_cart_is_null = '削除するファイルを選択してください';
$lang->msg_checked_file_is_deleted = '%d個の添付ファイルを削除しました';
$lang->msg_exceeds_limit_size = 'ファイルサイズの制限を超えたため、添付できません。';
$lang->search_target_list = array(
'filename' => 'ファイル名',
'filesize' => 'ファイルサイズ((Byte以上',
'download_count' => 'ダウンロード数(以上)',
'regdate' => '登録日',
'ipaddress' => 'IPアドレス',
);
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* @file modules/file/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 첨부파일(file) 모듈의 기본 언어팩
**/
$lang->file = '첨부파일';
$lang->file_name = '파일이름';
$lang->file_size = '파일크기';
$lang->download_count = '다운로드 받은 수';
$lang->status = '상태';
$lang->is_valid = '유효';
$lang->is_stand_by = '대기';
$lang->file_list = '첨부 파일 목록';
$lang->allowed_filesize = '파일 제한 크기';
$lang->allowed_attach_size = '문서 첨부 제한';
$lang->allowed_filetypes = '허용 확장자';
$lang->about_allowed_filesize = '하나의 파일에 대해 최고 용량을 지정할 수 있습니다. (관리자는 제외)';
$lang->about_allowed_attach_size = '하나의 문서에 첨부할 수 있는 최고 용량을 지정할 수 있습니다. (관리자는 제외)';
$lang->about_allowed_filetypes = '허용한 확장자만 첨부할 수 있습니다. "*.확장자"로 지정할 수 있고 ";" 으로 여러개 지정이 가능합니다.<br />ex) *.* or *.jpg;*.gif;<br />(관리자는 제외)';
$lang->cmd_delete_checked_file = '선택항목 삭제';
$lang->cmd_move_to_document = '문서로 이동';
$lang->cmd_download = '다운로드';
$lang->msg_cart_is_null = '삭제할 파일을 선택해주세요';
$lang->msg_checked_file_is_deleted = '%d개의 첨부파일이 삭제되었습니다';
$lang->msg_exceeds_limit_size = '허용된 용량을 초과하여 첨부가 되지 않았습니다';
$lang->search_target_list = array(
'filename' => '파일이름',
'filesize' => '파일크기 (byte, 이상)',
'download_count' => '다운로드 회수 (이상)',
'regdate' => '등록일',
'ipaddress' => 'IP 주소',
);
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* @file modules/file/lang/zh-CN.lang.php
* @author zero <zero@nzeo.com>
* @brief 附件(file) 模块语言包
**/
$lang->file = '附件';
$lang->file_name = '文件名';
$lang->file_size = '文件大小';
$lang->download_count = '下载次数';
$lang->status = '状态';
$lang->is_valid = '有效';
$lang->is_stand_by = '等待';
$lang->file_list = '附件目录';
$lang->allowed_filesize = '文件大小限制';
$lang->allowed_attach_size = '上传限制';
$lang->allowed_filetypes = '可用扩展名';
$lang->about_allowed_filesize = '最大单个上传文件大小(管理员不受此限制)。';
$lang->about_allowed_attach_size = '每个主题最大上传文件大小(管理员不受此限制)。';
$lang->about_allowed_filetypes = '只允许上传指定的扩展名。 可以用"*.扩展名"来指定或用 ";"来 区分多个扩展名<br />例) *.* or *.jpg;*.gif;<br />(管理员不受此限制)';
$lang->cmd_delete_checked_file = '删除所选项目';
$lang->cmd_move_to_document = '查看源主题';
$lang->cmd_download = '下载';
$lang->msg_cart_is_null = ' 请选择要删除的文件。';
$lang->msg_checked_file_is_deleted = '已删除%d个文件';
$lang->msg_exceeds_limit_size = '已超过系统指定的上传文件大小!';
$lang->search_target_list = array(
'filename' => '文件名',
'filesize' => '文件大小 (byte, 以上)',
'download_count' => '下载次数 (以上)',
'regdate' => '登录日期',
'ipaddress' => 'IP地址',
);
?>

View file

@ -0,0 +1,8 @@
<query id="deleteFile" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteFiles" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteModuleFiles" action="delete">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getAttachedFileSize" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="sum(file_size)" alias="attached_size" />
</columns>
<conditions>
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="getFile" action="select">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,25 @@
<query id="getFileList" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="s_module_srl" />
<condition operation="equal" column="isvalid" var="isvalid" pipe="and" />
<group pipe="and">
<condition operation="like" column="source_filename" var="s_filename" pipe="or" />
<condition operation="more" column="file_size" var="s_filesize" pipe="or" />
<condition operation="more" column="download_count" var="s_download_count" pipe="or" />
<condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="ipaddress" var="s_ipaddress" pipe="or" />
</group>
</conditions>
<navigation>
<index var="sort_index" default="file_srl" order="desc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,11 @@
<query id="getFiles" action="select">
<tables>
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" defualt="source_filename" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,11 @@
<query id="getFilesCount" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,20 @@
<query id="getOneFileInDocument" action="select">
<tables>
<table name="files" />
</tables>
<columns>
<column name="upload_target_srl" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srls" notnull="notnull" filter="number" />
<condition operation="equal" column="direct_download" var="direct_download" pipe="and" />
<condition operation="equal" column="isvalid" var="isvalid" pipe="and" />
</conditions>
<groups>
<group column="upload_target_srl" />
</groups>
<navigation>
<index var="file_srl" default="file_srl" order="desc" />
<list_count var="list_count" default="20" />
</navigation>
</query>

View file

@ -0,0 +1,20 @@
<query id="insertFile" action="insert">
<tables>
<table name="files" />
</tables>
<columns>
<column name="file_srl" var="file_srl" 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" />
<column name="uploaded_filename" var="uploaded_filename" notnull="notnull" minlength="1" maxlength="250" />
<column name="file_size" var="file_size" notnull="notnull" default="0" />
<column name="direct_download" var="direct_download" notnull="notnull" default="N" />
<column name="comment" var="comment" />
<column name="download_count" var="download_count" default="0" />
<column name="member_srl" var="member_srl" default="0" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
</columns>
</query>

View 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>

View file

@ -0,0 +1,11 @@
<query id="updateDownloadCount" action="update">
<tables>
<table name="files" />
</tables>
<columns>
<column name="download_count" var="download_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateFileValid" action="update">
<tables>
<table name="files" />
</tables>
<columns>
<column name="isvalid" var="isvalid" default="Y" notnull="notnull" />
</columns>
<conditions>
<condition operation="equal" column="upload_target_srl" var="upload_target_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,16 @@
<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="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" />
<column name="direct_download" type="char" size="1" default="N" notnull="notnull" />
<column name="source_filename" type="varchar" size="250" />
<column name="uploaded_filename" type="varchar" size="250" />
<column name="file_size" type="number" size="11" default="0" notnull="notnull" index="idx_file_size" />
<column name="comment" type="varchar" size="250" />
<column name="isvalid" type="char" size="1" default="N" index="idx_is_valid" />
<column name="regdate" type="date" index="idx_regdate" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
</table>

View file

@ -0,0 +1,34 @@
<!--#include("header.html")-->
<!--%import("filter/insert_config.xml")-->
<form action="./" method="get" onsubmit="return procFilter(this, insert_config)">
<table cellspacing="0" class="tableType2 gap1">
<tr>
<th scope="col">{$lang->allowed_filesize}</th>
<td>
<input type="text" name="allowed_filesize" value="{$config->allowed_filesize}" class="inputTypeText" size="3" />MB
<p>{$lang->about_allowed_filesize}</p>
</td>
</tr>
<tr>
<th scope="col">{$lang->allowed_attach_size}</th>
<td>
<input type="text" name="allowed_attach_size" value="{$config->allowed_attach_size}" class="inputTypeText" size="3" />MB
/ {ini_get('upload_max_filesize')}
<p>{$lang->about_allowed_attach_size}</p>
</td>
</tr>
<tr>
<th scope="col">{$lang->allowed_filetypes}</th>
<td>
<input type="text" name="allowed_filetypes" value="{$config->allowed_filetypes}" class="inputTypeText w100" />
<p>{$lang->about_allowed_filetypes}</p>
</td>
</tr>
</table>
<!-- 버튼 -->
<div class="tRight gap1">
<span class="button"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
</div>
</form>

View file

@ -0,0 +1,104 @@
<!--%import("filter/delete_checked.xml")-->
<!--%import("js/file_admin.js")-->
<!--#include("header.html")-->
<div class="tableSummaryType1">
Total <strong>{number_format($total_count)}</strong>, Page <strong>{number_format($page)}</strong>/{number_format($total_page)}
</div>
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
<input type="hidden" name="page" value="{$page}" />
<!-- 목록 -->
<table cellspacing="0" class="tableType1">
<thead>
<tr>
<th scope="col">{$lang->no}</th>
<th scope="col"><input type="checkbox" onclick="doCheckAll(); return false;" /></th>
<th scope="col">
<div class="nowrap">
<select name="module_srl" class="mid_list" id="module_srl">
<option value="">{$lang->module}</option>
<!--@foreach($mid_list as $key => $val)-->
<option value="{$val->module_srl}" <!--@if($module_srl == $val->module_srl)-->selected="selected"<!--@end-->>{$val->browser_title}</option>
<!--@end-->
</select><a href="#" onclick="location.href=current_url.setQuery('module_srl',xGetElementById('module_srl').options[xGetElementById('module_srl').selectedIndex].value);return false;" class="button"><span>GO</span></a>
</div>
</th>
<th scope="col">{$lang->file_name}</th>
<th scope="col">{$lang->file_size}</th>
<th scope="col">{$lang->is_valid}</th>
<th scope="col">{$lang->download_count}</th>
<th scope="col">{$lang->date}</th>
<th scope="col">{$lang->ipaddress}</th>
<th scope="col">{$lang->cmd_move_to_document}</th>
</tr>
</thead>
<tbody>
<!--@foreach($file_list as $no => $val)-->
<tr>
<td class="tahoma">{$no}</td>
<td><input type="checkbox" name="cart" value="{$val->file_srl}" /></td>
<td class="blue"><a href="./?mid={$module_list[$val->module_srl]->mid}" onclick="window.open(this.href);return false;">{$module_list[$val->module_srl]->browser_title}</a></td>
<td class="red"><a href="{$val->download_url}">{htmlspecialchars($val->source_filename)}</a></td>
<td class="tahoma">{$val->file_size}</td>
<td>
<!--@if($val->isvalid=='Y')-->
<span class="blue">{$lang->is_valid}</span>
<!--@else-->
<span class="red">{$lang->is_stand_by}</span>
<!--@end-->
</td>
<td class="tahoma">{$val->download_count}</td>
<td class="tahoma">{zdate($val->regdate,"Y-m-d")}</td>
<td class="tahoma">{$val->ipaddress}</td>
<td class="blue"><a href="./?document_srl={$val->upload_target_srl}" onclick="window.open(this.href);return false;">{$lang->cmd_move}</a></td>
</tr>
<!--@end-->
</tbody>
</table>
<!-- 버튼 -->
<div class="fr gap1">
<span class="button"><input type="submit" value="{$lang->cmd_delete_checked_file}" /></span>
</div>
</form>
<!-- 페이지 네비게이션 -->
<div class="pageNavigation">
<a href="{getUrl('page','','module_srl','')}" class="goToFirst"><img src="../../admin/tpl/images/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<span class="current">{$page_no}</span>
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl','')}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="goToLast"><img src="../../admin/tpl/images/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
</div>
<!-- 검색 -->
<form action="./" method="get" class="adminSearch">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<fieldset>
<select name="isvalid">
<option value="">{$lang->status}</option>
<option value="Y" <!--@if($isvalid=="Y")-->selected="selected"<!--@end-->>{$lang->is_valid}</option>
<option value="N" <!--@if($isvalid=="N")-->selected="selected"<!--@end-->>{$lang->is_stand_by}</option>
</select>
<select name="search_target">
<option value="">{$lang->search_target}</option>
<!--@foreach($lang->search_target_list as $key => $val)-->
<option value="{$key}" <!--@if($search_target==$key)-->selected="selected"<!--@end-->>{$val}</option>
<!--@end-->
</select>
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="inputTypeText" />
<span class="button"><input type="submit" value="{$lang->cmd_search}" /></span>
<a href="{getUrl('','module',$module,'act',$act)}" class="button"><span>{$lang->cmd_cancel}</span></a>
</fieldset>
</form>

View file

@ -0,0 +1,12 @@
<filter name="delete_checked" module="file" act="procFileAdminDeleteChecked" confirm_msg_code="confirm_delete">
<form>
<node target="cart" required="true" />
</form>
<parameter>
<param name="cart" target="cart" />
</parameter>
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -0,0 +1,7 @@
<filter name="insert_config" module="file" act="procFileAdminInsertConfig" confirm_msg_code="confirm_submit">
<form />
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -0,0 +1,10 @@
<!--%import("js/file_admin.js")-->
<h3>{$lang->file} <span class="gray">{$lang->cmd_management}</span></h3>
<div class="header4">
<ul class="localNavigation">
<li <!--@if($act=='dispFileAdminList')-->class="on"<!--@end-->><a href="{getUrl('act','dispFileAdminList')}">{$lang->file_list}</a></li>
<li <!--@if($act=='dispFileAdminConfig')-->class="on"<!--@end-->><a href="{getUrl('act','dispFileAdminConfig')}">{$lang->cmd_module_config}</a></li>
</ul>
</div>

View file

@ -0,0 +1,6 @@
function doCheckAll() {
var fo_obj = xGetElementById('fo_list');
for(var i=0;i<fo_obj.length;i++) {
if(fo_obj[i].name == 'cart') fo_obj[i].checked = true;
}
}

View file

@ -0,0 +1,9 @@
<script type="text/javascript">
parent.editor_upload_clear_list("{$upload_target_srl}");
<!--@foreach($file_list as $key => $file_info)-->
parent.editor_insert_uploaded_file({$upload_target_srl}, {$file_info->file_srl}, "{$file_info->source_filename}", "{$file_info->file_size}", "{FileHandler::filesize($file_info->file_size)}", "{$file_info->uploaded_filename}", "{$file_info->sid}");
<!--@end-->
parent.xInnerHtml("uploader_status_{$upload_target_srl}", '{$upload_status}');
</script>