mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 2662 file
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12246 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a35ff711c4
commit
41d7eb8384
7 changed files with 1876 additions and 1744 deletions
|
|
@ -1,187 +1,196 @@
|
|||
<?php
|
||||
/**
|
||||
* admin controller class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class fileAdminController extends file {
|
||||
/**
|
||||
* admin controller class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class fileAdminController extends file
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the attachment of a particular module
|
||||
*
|
||||
* @param int $module_srl Sequence of module to delete files
|
||||
* @return Object
|
||||
**/
|
||||
function deleteModuleFiles($module_srl) {
|
||||
// Get a full list of attachments
|
||||
$args->module_srl = $module_srl;
|
||||
$columnList = array('file_srl', 'uploaded_filename');
|
||||
$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
|
||||
if(!$output) return $output;
|
||||
$files = $output->data;
|
||||
// Remove from the DB
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('file.deleteModuleFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
// Remove the file
|
||||
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
||||
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
||||
// Remove the file list obtained from the DB
|
||||
$path = array();
|
||||
$cnt = count($files);
|
||||
for($i=0;$i<$cnt;$i++) {
|
||||
$uploaded_filename = $files[$i]->uploaded_filename;
|
||||
FileHandler::removeFile($uploaded_filename);
|
||||
|
||||
$path_info = pathinfo($uploaded_filename);
|
||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
||||
}
|
||||
// Remove a file directory of the document
|
||||
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected files from the administrator page
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procFileAdminDeleteChecked() {
|
||||
// An error appears if no document is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||
if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
|
||||
else $file_srl_list = $cart;
|
||||
$file_count = count($file_srl_list);
|
||||
if(!$file_count) return $this->stop('msg_cart_is_null');
|
||||
|
||||
$oFileController = &getController('file');
|
||||
// Delete the post
|
||||
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) );
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add file information
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procFileAdminInsertConfig() {
|
||||
// Get configurations (using module model object)
|
||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
|
||||
$config->allow_outlink = Context::get('allow_outlink');
|
||||
$config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||
$config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||
// Create module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add file information for each module
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function procFileAdminInsertModuleConfig() {
|
||||
// Get variables
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
// In order to configure multiple modules at once
|
||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||
else $module_srl = array($module_srl);
|
||||
|
||||
$download_grant = Context::get('download_grant');
|
||||
|
||||
$file_config->allow_outlink = Context::get('allow_outlink');
|
||||
$file_config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||
$file_config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||
$file_config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
|
||||
|
||||
if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
|
||||
else $file_config->download_grant = $download_grant;
|
||||
|
||||
//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
|
||||
$userFileAllowSize = $this->_changeBytes($file_config->allowed_filesize.'M');
|
||||
$userAttachAllowSize = $this->_changeBytes($file_config->allowed_attach_size.'M');
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
|
||||
|
||||
if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
|
||||
return new Object(-1, 'input size over than config in php.ini');
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
for($i=0;$i<count($module_srl);$i++) {
|
||||
$srl = trim($module_srl[$i]);
|
||||
if(!$srl) continue;
|
||||
$oModuleController->insertModulePartConfig('file',$srl,$file_config);
|
||||
}
|
||||
|
||||
$this->setError(-1);
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to SESSION file srl
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procFileAdminAddCart()
|
||||
/**
|
||||
* Delete the attachment of a particular module
|
||||
*
|
||||
* @param int $module_srl Sequence of module to delete files
|
||||
* @return Object
|
||||
*/
|
||||
function deleteModuleFiles($module_srl)
|
||||
{
|
||||
// Get a full list of attachments
|
||||
$args->module_srl = $module_srl;
|
||||
$columnList = array('file_srl', 'uploaded_filename');
|
||||
$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
|
||||
if(!$output) return $output;
|
||||
$files = $output->data;
|
||||
// Remove from the DB
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('file.deleteModuleFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
// Remove the file
|
||||
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
||||
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
||||
// Remove the file list obtained from the DB
|
||||
$path = array();
|
||||
$cnt = count($files);
|
||||
for($i=0;$i<$cnt;$i++)
|
||||
{
|
||||
$file_srl = (int)Context::get('file_srl');
|
||||
//$fileSrlList = array(500, 502);
|
||||
$uploaded_filename = $files[$i]->uploaded_filename;
|
||||
FileHandler::removeFile($uploaded_filename);
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
$output = $oFileModel->getFile($file_srl);
|
||||
//$output = $oFileModel->getFile($fileSrlList);
|
||||
$path_info = pathinfo($uploaded_filename);
|
||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
||||
}
|
||||
// Remove a file directory of the document
|
||||
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||
|
||||
if($output->file_srl)
|
||||
{
|
||||
if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
|
||||
else $_SESSION['file_management'][$output->file_srl] = true;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected files from the administrator page
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procFileAdminDeleteChecked()
|
||||
{
|
||||
// An error appears if no document is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||
if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
|
||||
else $file_srl_list = $cart;
|
||||
$file_count = count($file_srl_list);
|
||||
if(!$file_count) return $this->stop('msg_cart_is_null');
|
||||
|
||||
$oFileController = &getController('file');
|
||||
// Delete the post
|
||||
for($i=0;$i<$file_count;$i++)
|
||||
{
|
||||
$file_srl = trim($file_srl_list[$i]);
|
||||
if(!$file_srl) continue;
|
||||
|
||||
$oFileController->deleteFile($file_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value from human readable to byte unit
|
||||
*
|
||||
* @param string $size_str Size string
|
||||
* @return int The byte value for input
|
||||
**/
|
||||
function _changeBytes($size_str)
|
||||
$this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) );
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add file information
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procFileAdminInsertConfig()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
|
||||
$config->allow_outlink = Context::get('allow_outlink');
|
||||
$config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||
$config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||
// Create module Controller object
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add file information for each module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function procFileAdminInsertModuleConfig()
|
||||
{
|
||||
// Get variables
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
// In order to configure multiple modules at once
|
||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||
else $module_srl = array($module_srl);
|
||||
|
||||
$download_grant = Context::get('download_grant');
|
||||
|
||||
$file_config->allow_outlink = Context::get('allow_outlink');
|
||||
$file_config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||
$file_config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||
$file_config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
|
||||
|
||||
if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
|
||||
else $file_config->download_grant = $download_grant;
|
||||
|
||||
//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
|
||||
$userFileAllowSize = $this->_changeBytes($file_config->allowed_filesize.'M');
|
||||
$userAttachAllowSize = $this->_changeBytes($file_config->allowed_attach_size.'M');
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
|
||||
|
||||
if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
|
||||
return new Object(-1, 'input size over than config in php.ini');
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
for($i=0;$i<count($module_srl);$i++)
|
||||
{
|
||||
switch (substr ($size_str, -1))
|
||||
{
|
||||
case 'M': case 'm': return (int)$size_str * 1048576;
|
||||
case 'K': case 'k': return (int)$size_str * 1024;
|
||||
case 'G': case 'g': return (int)$size_str * 1073741824;
|
||||
default: return $size_str;
|
||||
}
|
||||
$srl = trim($module_srl[$i]);
|
||||
if(!$srl) continue;
|
||||
$oModuleController->insertModulePartConfig('file',$srl,$file_config);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
$this->setError(-1);
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to SESSION file srl
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procFileAdminAddCart()
|
||||
{
|
||||
$file_srl = (int)Context::get('file_srl');
|
||||
//$fileSrlList = array(500, 502);
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
$output = $oFileModel->getFile($file_srl);
|
||||
//$output = $oFileModel->getFile($fileSrlList);
|
||||
|
||||
if($output->file_srl)
|
||||
{
|
||||
if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
|
||||
else $_SESSION['file_management'][$output->file_srl] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value from human readable to byte unit
|
||||
*
|
||||
* @param string $size_str Size string
|
||||
* @return int The byte value for input
|
||||
*/
|
||||
function _changeBytes($size_str)
|
||||
{
|
||||
switch (substr ($size_str, -1))
|
||||
{
|
||||
case 'M': case 'm': return (int)$size_str * 1048576;
|
||||
case 'K': case 'k': return (int)$size_str * 1024;
|
||||
case 'G': case 'g': return (int)$size_str * 1073741824;
|
||||
default: return $size_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file file.admin.controller.php */
|
||||
/* Location: ./modules/file/file.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,192 +1,200 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin model class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class fileAdminModel extends file {
|
||||
/**
|
||||
* Admin model class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class fileAdminModel extends file
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Get all the attachments in order by time descending (for administrators)
|
||||
*
|
||||
* <pre>
|
||||
* Search options:
|
||||
* - s_module_srl: int[] or int, search module_srl
|
||||
* - exclude_module_srl: int[] or int, exclude module_srl
|
||||
* - isvalid: Y or N
|
||||
* - direct_download: Y or N
|
||||
* - s_filename: string, like operation
|
||||
* - s_filesize_more: int, more operation, byte unit
|
||||
* - s_filesize_mega_more: int, more operation, mega unit
|
||||
* - s_filesize_less: int, less operation, byte unit
|
||||
* - s_filesize_mega_less: int, less operation, mega unit
|
||||
* - s_download_count: int, more operation
|
||||
* - s_regdate: string(YYYYMMDDHHMMSS), like prefix operation(STRING%)
|
||||
* - s_ipaddress: string, like prefix operation
|
||||
* - s_user_id: string
|
||||
* - s_user_name: string
|
||||
* - s_nick_name: string
|
||||
* - sort_index: string. default: files.file_srl
|
||||
* - page : int
|
||||
* - list_count: int. default: 20
|
||||
* - page_count: int. default: 10
|
||||
*
|
||||
* Result data:
|
||||
* - file_srl
|
||||
* - upload_target_srl
|
||||
* - upload_target_type
|
||||
* - sid
|
||||
* - module_srl
|
||||
* - member_srl
|
||||
* - download_count
|
||||
* - direct_download
|
||||
* - source_filename
|
||||
* - uploaded_filename
|
||||
* - file_size
|
||||
* - comment
|
||||
* - isvaild
|
||||
* - regdate
|
||||
* - ipaddress
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @param object $obj Search options
|
||||
* @param array $columnList Column list to get from DB
|
||||
* @return Object Object contains query result
|
||||
*/
|
||||
function getFileList($obj, $columnList = array())
|
||||
{
|
||||
$this->_makeSearchParam($obj, $args);
|
||||
|
||||
/**
|
||||
* Get all the attachments in order by time descending (for administrators)
|
||||
*
|
||||
* <pre>
|
||||
* Search options:
|
||||
* - s_module_srl: int[] or int, search module_srl
|
||||
* - exclude_module_srl: int[] or int, exclude module_srl
|
||||
* - isvalid: Y or N
|
||||
* - direct_download: Y or N
|
||||
* - s_filename: string, like operation
|
||||
* - s_filesize_more: int, more operation, byte unit
|
||||
* - s_filesize_mega_more: int, more operation, mega unit
|
||||
* - s_filesize_less: int, less operation, byte unit
|
||||
* - s_filesize_mega_less: int, less operation, mega unit
|
||||
* - s_download_count: int, more operation
|
||||
* - s_regdate: string(YYYYMMDDHHMMSS), like prefix operation(STRING%)
|
||||
* - s_ipaddress: string, like prefix operation
|
||||
* - s_user_id: string
|
||||
* - s_user_name: string
|
||||
* - s_nick_name: string
|
||||
* - sort_index: string. default: files.file_srl
|
||||
* - page : int
|
||||
* - list_count: int. default: 20
|
||||
* - page_count: int. default: 10
|
||||
*
|
||||
* Result data:
|
||||
* - file_srl
|
||||
* - upload_target_srl
|
||||
* - upload_target_type
|
||||
* - sid
|
||||
* - module_srl
|
||||
* - member_srl
|
||||
* - download_count
|
||||
* - direct_download
|
||||
* - source_filename
|
||||
* - uploaded_filename
|
||||
* - file_size
|
||||
* - comment
|
||||
* - isvaild
|
||||
* - regdate
|
||||
* - ipaddress
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @param object $obj Search options
|
||||
* @param array $columnList Column list to get from DB
|
||||
* @return Object Object contains query result
|
||||
**/
|
||||
function getFileList($obj, $columnList = array()) {
|
||||
$this->_makeSearchParam($obj, $args);
|
||||
// Set valid/invalid state
|
||||
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
|
||||
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
|
||||
// Set multimedia/common file
|
||||
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
|
||||
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
|
||||
// Set variables
|
||||
$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;
|
||||
$args->exclude_module_srl = $obj->exclude_module_srl;
|
||||
// Execute the file.getFileList query
|
||||
$output = executeQuery('file.getFileList', $args, $columnList);
|
||||
// Return if no result or an error occurs
|
||||
if(!$output->toBool()||!count($output->data)) return $output;
|
||||
|
||||
// Set valid/invalid state
|
||||
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
|
||||
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
|
||||
// Set multimedia/common file
|
||||
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
|
||||
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
|
||||
// Set variables
|
||||
$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;
|
||||
$args->exclude_module_srl = $obj->exclude_module_srl;
|
||||
// Execute the file.getFileList query
|
||||
$output = executeQuery('file.getFileList', $args, $columnList);
|
||||
// Return if no result or an error occurs
|
||||
if(!$output->toBool()||!count($output->data)) return $output;
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
foreach($output->data as $key => $file) {
|
||||
if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
|
||||
else $file->isCarted = false;
|
||||
|
||||
$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid);
|
||||
$output->data[$key] = $file;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific document
|
||||
*
|
||||
* <pre>
|
||||
* Result data:
|
||||
* +---------+-------+
|
||||
* | isvalid | count |
|
||||
* +---------+-------+
|
||||
* | Y | 00 |
|
||||
* +---------+-------+
|
||||
* | N | 00 |
|
||||
* +---------+-------+
|
||||
* </pre>
|
||||
*
|
||||
* @param object $obj Search options (not used...)
|
||||
* @return array
|
||||
**/
|
||||
function getFilesCountByGroupValid($obj = '') {
|
||||
//$this->_makeSearchParam($obj, $args);
|
||||
|
||||
$output = executeQueryArray('file.getFilesCountByGroupValid', $args);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific date
|
||||
*
|
||||
* @param string $date Date string
|
||||
* @return int
|
||||
**/
|
||||
function getFilesCountByDate($date = '') {
|
||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||
|
||||
$output = executeQuery('file.getFilesCount', $args);
|
||||
if(!$output->toBool()) return 0;
|
||||
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make search parameters from object(private)
|
||||
*
|
||||
* @param object $obj Original searach options
|
||||
* @param object $args Result searach options
|
||||
* @return void
|
||||
*/
|
||||
function _makeSearchParam(&$obj, &$args)
|
||||
foreach($output->data as $key => $file)
|
||||
{
|
||||
// Search options
|
||||
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
||||
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
||||
if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
|
||||
else $file->isCarted = false;
|
||||
|
||||
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_more' :
|
||||
$args->s_filesize_more = (int)$search_keyword;
|
||||
break;
|
||||
case 'filesize_mega_more' :
|
||||
$args->s_filesize_more = (int)$search_keyword * 1024 * 1024;
|
||||
break;
|
||||
case 'filesize_less' :
|
||||
$args->s_filesize_less = (int)$search_keyword;
|
||||
break;
|
||||
case 'filesize_mega_less' :
|
||||
$args->s_filesize_less = (int)$search_keyword * 1024 * 1024;
|
||||
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;
|
||||
case 'user_id' :
|
||||
$args->s_user_id = $search_keyword;
|
||||
break;
|
||||
case 'user_name' :
|
||||
$args->s_user_name = $search_keyword;
|
||||
break;
|
||||
case 'nick_name' :
|
||||
$args->s_nick_name = $search_keyword;
|
||||
break;
|
||||
case 'isvalid' :
|
||||
$args->isvalid = $search_keyword;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid);
|
||||
$output->data[$key] = $file;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific document
|
||||
*
|
||||
* <pre>
|
||||
* Result data:
|
||||
* +---------+-------+
|
||||
* | isvalid | count |
|
||||
* +---------+-------+
|
||||
* | Y | 00 |
|
||||
* +---------+-------+
|
||||
* | N | 00 |
|
||||
* +---------+-------+
|
||||
* </pre>
|
||||
*
|
||||
* @param object $obj Search options (not used...)
|
||||
* @return array
|
||||
*/
|
||||
function getFilesCountByGroupValid($obj = '')
|
||||
{
|
||||
//$this->_makeSearchParam($obj, $args);
|
||||
|
||||
$output = executeQueryArray('file.getFilesCountByGroupValid', $args);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific date
|
||||
*
|
||||
* @param string $date Date string
|
||||
* @return int
|
||||
*/
|
||||
function getFilesCountByDate($date = '')
|
||||
{
|
||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||
|
||||
$output = executeQuery('file.getFilesCount', $args);
|
||||
if(!$output->toBool()) return 0;
|
||||
|
||||
return $output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make search parameters from object(private)
|
||||
*
|
||||
* @param object $obj Original searach options
|
||||
* @param object $args Result searach options
|
||||
* @return void
|
||||
*/
|
||||
function _makeSearchParam(&$obj, &$args)
|
||||
{
|
||||
// Search options
|
||||
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
||||
$search_keyword = $obj->search_keyword?$obj->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_more' :
|
||||
$args->s_filesize_more = (int)$search_keyword;
|
||||
break;
|
||||
case 'filesize_mega_more' :
|
||||
$args->s_filesize_more = (int)$search_keyword * 1024 * 1024;
|
||||
break;
|
||||
case 'filesize_less' :
|
||||
$args->s_filesize_less = (int)$search_keyword;
|
||||
break;
|
||||
case 'filesize_mega_less' :
|
||||
$args->s_filesize_less = (int)$search_keyword * 1024 * 1024;
|
||||
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;
|
||||
case 'user_id' :
|
||||
$args->s_user_id = $search_keyword;
|
||||
break;
|
||||
case 'user_name' :
|
||||
$args->s_user_name = $search_keyword;
|
||||
break;
|
||||
case 'nick_name' :
|
||||
$args->s_nick_name = $search_keyword;
|
||||
break;
|
||||
case 'isvalid' :
|
||||
$args->isvalid = $search_keyword;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file file.admin.model.php */
|
||||
/* Location: ./modules/file/file.admin.model.php */
|
||||
|
|
|
|||
|
|
@ -1,192 +1,224 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin view of the module class file
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class fileAdminView extends file {
|
||||
/**
|
||||
* Admin view of the module class file
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class fileAdminView extends file
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Display output list (for administrator)
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispFileAdminList()
|
||||
{
|
||||
// Options to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< Number of documents that appear on a single page
|
||||
$args->page_count = 10; // /< Number of pages that appear in the page navigation
|
||||
|
||||
/**
|
||||
* Display output list (for administrator)
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function dispFileAdminList() {
|
||||
// Options to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< Number of documents that appear on a single page
|
||||
$args->page_count = 10; // /< Number of pages that appear in the page navigation
|
||||
$args->sort_index = 'file_srl'; // /< Sorting values
|
||||
$args->isvalid = Context::get('isvalid');
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
// Get a list
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$columnList = array('file_srl', 'upload_target_srl', 'upload_target_type', 'sid', 'module_srl'
|
||||
, 'source_filename', 'isvalid', 'file_size', 'download_count', 'files.regdate', 'ipaddress');
|
||||
$output = $oFileAdminModel->getFileList($args, $columnList);
|
||||
// Get the document for looping a list
|
||||
if($output->data)
|
||||
{
|
||||
$oCommentModel = &getModel('comment');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$args->sort_index = 'file_srl'; // /< Sorting values
|
||||
$args->isvalid = Context::get('isvalid');
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
// Get a list
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$columnList = array('file_srl', 'upload_target_srl', 'upload_target_type', 'sid', 'module_srl'
|
||||
, 'source_filename', 'isvalid', 'file_size', 'download_count', 'files.regdate', 'ipaddress');
|
||||
$output = $oFileAdminModel->getFileList($args, $columnList);
|
||||
// Get the document for looping a list
|
||||
if($output->data) {
|
||||
$oCommentModel = &getModel('comment');
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oModuleModel = &getModel('module');
|
||||
$file_list = array();
|
||||
$document_list = array();
|
||||
$comment_list = array();
|
||||
$module_list= array();
|
||||
|
||||
$file_list = array();
|
||||
$document_list = array();
|
||||
$comment_list = array();
|
||||
$module_list= array();
|
||||
$doc_srls = array();
|
||||
$com_srls = array();
|
||||
$mod_srls= array();
|
||||
|
||||
$doc_srls = array();
|
||||
$com_srls = array();
|
||||
$mod_srls= array();
|
||||
|
||||
foreach($output->data as $file) {
|
||||
$file_srl = $file->file_srl;
|
||||
$target_srl = $file->upload_target_srl;
|
||||
$file_update_args = null;
|
||||
$file_update_args->file_srl = $file_srl;
|
||||
// Find and update if upload_target_type doesn't exist
|
||||
if(!$file->upload_target_type) {
|
||||
// Pass if upload_target_type is already found
|
||||
if($document_list[$target_srl]) {
|
||||
$file->upload_target_type = 'doc';
|
||||
} else if($comment_list[$target_srl]) {
|
||||
$file->upload_target_type = 'com';
|
||||
} else if($module_list[$target_srl]) {
|
||||
$file->upload_target_type = 'mod';
|
||||
} else {
|
||||
// document
|
||||
$document = $oDocumentModel->getDocument($target_srl);
|
||||
if($document->isExists()) {
|
||||
$file->upload_target_type = 'doc';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$document_list[$target_srl] = $document;
|
||||
}
|
||||
// comment
|
||||
if(!$file->upload_target_type) {
|
||||
$comment = $oCommentModel->getComment($target_srl);
|
||||
if($comment->isExists()) {
|
||||
$file->upload_target_type = 'com';
|
||||
$file->target_document_srl = $comment->document_srl;
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$comment_list[$target_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// module (for a page)
|
||||
if(!$file->upload_target_type) {
|
||||
$module = $oModuleModel->getModulesInfo($target_srl);
|
||||
if($module) {
|
||||
$file->upload_target_type = 'mod';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$module_list[$module->comment_srl] = $module;
|
||||
}
|
||||
}
|
||||
if($file_update_args->upload_target_type) {
|
||||
executeQuery('file.updateFileTargetType', $file_update_args);
|
||||
}
|
||||
}
|
||||
// Check if data is already obtained
|
||||
for($i = 0; $i < $com_srls_count; ++$i) {
|
||||
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
||||
}
|
||||
for($i = 0; $i < $doc_srls_count; ++$i) {
|
||||
if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
|
||||
}
|
||||
for($i = 0; $i < $mod_srls_count; ++$i) {
|
||||
if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
if($file->upload_target_type) {
|
||||
if(!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'})) {
|
||||
${$file->upload_target_type.'_srls'}[] = $target_srl;
|
||||
}
|
||||
}
|
||||
|
||||
$file_list[$file_srl] = $file;
|
||||
$mod_srls[] = $file->module_srl;
|
||||
}
|
||||
// Remove duplication
|
||||
$doc_srls = array_unique($doc_srls);
|
||||
$com_srls = array_unique($com_srls);
|
||||
$mod_srls = array_unique($mod_srls);
|
||||
// Comment list
|
||||
$com_srls_count = count($com_srls);
|
||||
if($com_srls_count) {
|
||||
$comment_output = $oCommentModel->getComments($com_srls);
|
||||
foreach($comment_output as $comment) {
|
||||
$comment_list[$comment->comment_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// Document list
|
||||
$doc_srls_count = count($doc_srls);
|
||||
if($doc_srls_count) {
|
||||
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
||||
if(is_array($document_output))
|
||||
foreach($output->data as $file)
|
||||
{
|
||||
$file_srl = $file->file_srl;
|
||||
$target_srl = $file->upload_target_srl;
|
||||
$file_update_args = null;
|
||||
$file_update_args->file_srl = $file_srl;
|
||||
// Find and update if upload_target_type doesn't exist
|
||||
if(!$file->upload_target_type)
|
||||
{
|
||||
// Pass if upload_target_type is already found
|
||||
if($document_list[$target_srl])
|
||||
{
|
||||
foreach($document_output as $document) {
|
||||
$document_list[$document->document_srl] = $document;
|
||||
$file->upload_target_type = 'doc';
|
||||
}
|
||||
else if($comment_list[$target_srl])
|
||||
{
|
||||
$file->upload_target_type = 'com';
|
||||
}
|
||||
else if($module_list[$target_srl])
|
||||
{
|
||||
$file->upload_target_type = 'mod';
|
||||
}
|
||||
else
|
||||
{
|
||||
// document
|
||||
$document = $oDocumentModel->getDocument($target_srl);
|
||||
if($document->isExists())
|
||||
{
|
||||
$file->upload_target_type = 'doc';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$document_list[$target_srl] = $document;
|
||||
}
|
||||
// comment
|
||||
if(!$file->upload_target_type)
|
||||
{
|
||||
$comment = $oCommentModel->getComment($target_srl);
|
||||
if($comment->isExists())
|
||||
{
|
||||
$file->upload_target_type = 'com';
|
||||
$file->target_document_srl = $comment->document_srl;
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$comment_list[$target_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// module (for a page)
|
||||
if(!$file->upload_target_type)
|
||||
{
|
||||
$module = $oModuleModel->getModulesInfo($target_srl);
|
||||
if($module)
|
||||
{
|
||||
$file->upload_target_type = 'mod';
|
||||
$file_update_args->upload_target_type = $file->upload_target_type;
|
||||
$module_list[$module->comment_srl] = $module;
|
||||
}
|
||||
}
|
||||
if($file_update_args->upload_target_type)
|
||||
{
|
||||
executeQuery('file.updateFileTargetType', $file_update_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Module List
|
||||
$mod_srls_count = count($mod_srls);
|
||||
if($mod_srls_count) {
|
||||
$columnList = array('module_srl', 'mid', 'browser_title');
|
||||
$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
|
||||
if($module_output && is_array($module_output)){
|
||||
foreach($module_output as $module) {
|
||||
$module_list[$module->module_srl] = $module;
|
||||
}
|
||||
// Check if data is already obtained
|
||||
for($i = 0; $i < $com_srls_count; ++$i)
|
||||
{
|
||||
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
||||
}
|
||||
}
|
||||
for($i = 0; $i < $doc_srls_count; ++$i)
|
||||
{
|
||||
if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
|
||||
}
|
||||
for($i = 0; $i < $mod_srls_count; ++$i)
|
||||
{
|
||||
if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($file_list as $srl => $file) {
|
||||
if($file->upload_target_type == 'com') {
|
||||
$file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($file->upload_target_type)
|
||||
{
|
||||
if(!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'}))
|
||||
{
|
||||
${$file->upload_target_type.'_srls'}[] = $target_srl;
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('file_list', $file_list);
|
||||
Context::set('document_list', $document_list);
|
||||
Context::set('comment_list', $comment_list);
|
||||
Context::set('module_list', $module_list);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
// Set a template
|
||||
$security = new Security();
|
||||
$security->encodeHTML('file_list..source_filename','file_list..ipaddress');
|
||||
$security->encodeHTML('module_list..browser_title','module_list..mid');
|
||||
$file_list[$file_srl] = $file;
|
||||
$mod_srls[] = $file->module_srl;
|
||||
}
|
||||
// Remove duplication
|
||||
$doc_srls = array_unique($doc_srls);
|
||||
$com_srls = array_unique($com_srls);
|
||||
$mod_srls = array_unique($mod_srls);
|
||||
// Comment list
|
||||
$com_srls_count = count($com_srls);
|
||||
if($com_srls_count)
|
||||
{
|
||||
$comment_output = $oCommentModel->getComments($com_srls);
|
||||
foreach($comment_output as $comment)
|
||||
{
|
||||
$comment_list[$comment->comment_srl] = $comment;
|
||||
$doc_srls[] = $comment->document_srl;
|
||||
}
|
||||
}
|
||||
// Document list
|
||||
$doc_srls_count = count($doc_srls);
|
||||
if($doc_srls_count)
|
||||
{
|
||||
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
||||
if(is_array($document_output))
|
||||
{
|
||||
foreach($document_output as $document)
|
||||
{
|
||||
$document_list[$document->document_srl] = $document;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Module List
|
||||
$mod_srls_count = count($mod_srls);
|
||||
if($mod_srls_count)
|
||||
{
|
||||
$columnList = array('module_srl', 'mid', 'browser_title');
|
||||
$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
|
||||
if($module_output && is_array($module_output))
|
||||
{
|
||||
foreach($module_output as $module)
|
||||
{
|
||||
$module_list[$module->module_srl] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('file_list');
|
||||
foreach($file_list as $srl => $file)
|
||||
{
|
||||
if($file->upload_target_type == 'com')
|
||||
{
|
||||
$file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Context::set('file_list', $file_list);
|
||||
Context::set('document_list', $document_list);
|
||||
Context::set('comment_list', $comment_list);
|
||||
Context::set('module_list', $module_list);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
// Set a template
|
||||
$security = new Security();
|
||||
$security->encodeHTML('file_list..source_filename','file_list..ipaddress');
|
||||
$security->encodeHTML('module_list..browser_title','module_list..mid');
|
||||
|
||||
/**
|
||||
* Set attachment information (for administrator)
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function dispFileAdminConfig() {
|
||||
$oFileModel = &getModel('file');
|
||||
$config = $oFileModel->getFileConfig();
|
||||
Context::set('config',$config);
|
||||
// Set a template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('adminConfig');
|
||||
}
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('file_list');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Set attachment information (for administrator)
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispFileAdminConfig()
|
||||
{
|
||||
$oFileModel = &getModel('file');
|
||||
$config = $oFileModel->getFileConfig();
|
||||
Context::set('config',$config);
|
||||
// Set a template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('adminConfig');
|
||||
}
|
||||
}
|
||||
/* End of file file.admin.view.php */
|
||||
/* Location: ./modules/file/file.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,148 +1,152 @@
|
|||
<?php
|
||||
/**
|
||||
* High class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class file extends ModuleObject {
|
||||
/**
|
||||
* High class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class file extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// Save the default settings for attachments
|
||||
$config->allowed_filesize = '2';
|
||||
$config->allowed_attach_size = '2';
|
||||
$config->allowed_filetypes = '*.*';
|
||||
$oModuleController->insertModuleConfig('file', $config);
|
||||
// Generate a directory for the file module
|
||||
FileHandler::makeDir('./files/attach/images');
|
||||
FileHandler::makeDir('./files/attach/binaries');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// Save the default settings for attachments
|
||||
$config->allowed_filesize = '2';
|
||||
$config->allowed_attach_size = '2';
|
||||
$config->allowed_filetypes = '*.*';
|
||||
$oModuleController->insertModuleConfig('file', $config);
|
||||
// Generate a directory for the file module
|
||||
FileHandler::makeDir('./files/attach/images');
|
||||
FileHandler::makeDir('./files/attach/binaries');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
return new Object();
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* A method to check if successfully installed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true;
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true;
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
|
||||
|
||||
/**
|
||||
* A method to check if successfully installed
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true;
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true;
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
|
||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||
|
||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
|
||||
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3');
|
||||
|
||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
|
||||
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
|
||||
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
|
||||
// A column to determine a target type
|
||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3');
|
||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after');
|
||||
}
|
||||
|
||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after');
|
||||
}
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file file.class.php */
|
||||
/* Location: ./modules/file/file.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,283 +1,306 @@
|
|||
<?php
|
||||
/**
|
||||
* Model class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class fileModel extends file {
|
||||
/**
|
||||
* Model class of the file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class fileModel extends file
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Return a file list attached in the document
|
||||
*
|
||||
* It is used when a file list of the upload_target_srl is requested for creating/updating a document.
|
||||
* Attempt to replace with sever-side session if upload_target_srl is not yet determined
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function getFileList()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
/**
|
||||
* Return a file list attached in the document
|
||||
*
|
||||
* It is used when a file list of the upload_target_srl is requested for creating/updating a document.
|
||||
* Attempt to replace with sever-side session if upload_target_srl is not yet determined
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function getFileList() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$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;
|
||||
|
||||
$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);
|
||||
|
||||
if($upload_target_srl) {
|
||||
$tmp_files = $this->getFiles($upload_target_srl);
|
||||
$file_count = count($tmp_files);
|
||||
|
||||
for($i=0;$i<$file_count;$i++) {
|
||||
$file_info = $tmp_files[$i];
|
||||
if(!$file_info->file_srl) continue;
|
||||
|
||||
$obj = null;
|
||||
$obj->file_srl = $file_info->file_srl;
|
||||
$obj->source_filename = $file_info->source_filename;
|
||||
$obj->file_size = $file_info->file_size;
|
||||
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
||||
if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid);
|
||||
else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename);
|
||||
$obj->direct_download = $file_info->direct_download;
|
||||
$files[] = $obj;
|
||||
$attached_size += $file_info->file_size;
|
||||
}
|
||||
} else {
|
||||
$upload_target_srl = 0;
|
||||
$attached_size = 0;
|
||||
$files = array();
|
||||
}
|
||||
// Display upload status
|
||||
$upload_status = $this->getUploadStatus($attached_size);
|
||||
// Check remained file size until upload complete
|
||||
//$config = $oModuleModel->getModuleInfoByMid($mid); //perhaps config varialbles not used
|
||||
|
||||
$file_config = $this->getUploadConfig();
|
||||
$left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size;
|
||||
// Settings of required information
|
||||
$this->add("files",$files);
|
||||
$this->add("editor_sequence",$editor_sequence);
|
||||
$this->add("upload_target_srl",$upload_target_srl);
|
||||
$this->add("upload_status",$upload_status);
|
||||
$this->add("left_size",$left_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific document
|
||||
*
|
||||
* @param int $upload_target_srl The sequence to get a number of files
|
||||
* @return int Returns a number of files
|
||||
**/
|
||||
function getFilesCount($upload_target_srl) {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$output = executeQuery('file.getFilesCount', $args);
|
||||
return (int)$output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a download path
|
||||
*
|
||||
* @param int $file_srl The sequence of file to get url
|
||||
* @param string $sid
|
||||
* @return string Returns a url
|
||||
**/
|
||||
function getDownloadUrl($file_srl, $sid) {
|
||||
return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file configurations
|
||||
*
|
||||
* @param int $module_srl If set this, returns specific module's configuration. Otherwise returns global configuration.
|
||||
* @return object Returns configuration.
|
||||
**/
|
||||
function getFileConfig($module_srl = null) {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$file_module_config = $oModuleModel->getModuleConfig('file');
|
||||
|
||||
if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl);
|
||||
if(!$file_config) $file_config = $file_module_config;
|
||||
|
||||
if($file_config) {
|
||||
$config->allowed_filesize = $file_config->allowed_filesize;
|
||||
$config->allowed_attach_size = $file_config->allowed_attach_size;
|
||||
$config->allowed_filetypes = $file_config->allowed_filetypes;
|
||||
$config->download_grant = $file_config->download_grant;
|
||||
$config->allow_outlink = $file_config->allow_outlink;
|
||||
$config->allow_outlink_site = $file_config->allow_outlink_site;
|
||||
$config->allow_outlink_format = $file_config->allow_outlink_format;
|
||||
}
|
||||
// Property for all files comes first than each property
|
||||
if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize;
|
||||
if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size;
|
||||
if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes;
|
||||
if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink;
|
||||
if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site;
|
||||
if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format;
|
||||
if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant;
|
||||
// Default setting if not exists
|
||||
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 = '*.*';
|
||||
if(!$config->allow_outlink) $config->allow_outlink = 'Y';
|
||||
if(!$config->download_grant) $config->download_grant = array();
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file information
|
||||
*
|
||||
* @param int $file_srl The sequence of file to get information
|
||||
* @param array $columnList The list of columns to get from DB
|
||||
* @return Object|object|array If error returns an instance of Object. If result set is one returns a object that contins file information. If result set is more than one returns array of object.
|
||||
**/
|
||||
function getFile($file_srl, $columnList = array()) {
|
||||
$args->file_srl = $file_srl;
|
||||
$output = executeQueryArray('file.getFile', $args, $columnList);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// old version compatibility
|
||||
if(count($output->data) == 1)
|
||||
for($i=0;$i<$file_count;$i++)
|
||||
{
|
||||
$file = $output->data[0];
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
$file_info = $tmp_files[$i];
|
||||
if(!$file_info->file_srl) continue;
|
||||
|
||||
return $file;
|
||||
$obj = null;
|
||||
$obj->file_srl = $file_info->file_srl;
|
||||
$obj->source_filename = $file_info->source_filename;
|
||||
$obj->file_size = $file_info->file_size;
|
||||
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
||||
if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid);
|
||||
else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename);
|
||||
$obj->direct_download = $file_info->direct_download;
|
||||
$files[] = $obj;
|
||||
$attached_size += $file_info->file_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileList = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_target_srl = 0;
|
||||
$attached_size = 0;
|
||||
$files = array();
|
||||
}
|
||||
// Display upload status
|
||||
$upload_status = $this->getUploadStatus($attached_size);
|
||||
// Check remained file size until upload complete
|
||||
//$config = $oModuleModel->getModuleInfoByMid($mid); //perhaps config varialbles not used
|
||||
|
||||
if(is_array($output->data))
|
||||
$file_config = $this->getUploadConfig();
|
||||
$left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size;
|
||||
// Settings of required information
|
||||
$this->add("files",$files);
|
||||
$this->add("editor_sequence",$editor_sequence);
|
||||
$this->add("upload_target_srl",$upload_target_srl);
|
||||
$this->add("upload_status",$upload_status);
|
||||
$this->add("left_size",$left_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of attachments which belongs to a specific document
|
||||
*
|
||||
* @param int $upload_target_srl The sequence to get a number of files
|
||||
* @return int Returns a number of files
|
||||
*/
|
||||
function getFilesCount($upload_target_srl)
|
||||
{
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$output = executeQuery('file.getFilesCount', $args);
|
||||
return (int)$output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a download path
|
||||
*
|
||||
* @param int $file_srl The sequence of file to get url
|
||||
* @param string $sid
|
||||
* @return string Returns a url
|
||||
*/
|
||||
function getDownloadUrl($file_srl, $sid)
|
||||
{
|
||||
return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file configurations
|
||||
*
|
||||
* @param int $module_srl If set this, returns specific module's configuration. Otherwise returns global configuration.
|
||||
* @return object Returns configuration.
|
||||
*/
|
||||
function getFileConfig($module_srl = null)
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$file_module_config = $oModuleModel->getModuleConfig('file');
|
||||
|
||||
if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl);
|
||||
if(!$file_config) $file_config = $file_module_config;
|
||||
|
||||
if($file_config)
|
||||
{
|
||||
$config->allowed_filesize = $file_config->allowed_filesize;
|
||||
$config->allowed_attach_size = $file_config->allowed_attach_size;
|
||||
$config->allowed_filetypes = $file_config->allowed_filetypes;
|
||||
$config->download_grant = $file_config->download_grant;
|
||||
$config->allow_outlink = $file_config->allow_outlink;
|
||||
$config->allow_outlink_site = $file_config->allow_outlink_site;
|
||||
$config->allow_outlink_format = $file_config->allow_outlink_format;
|
||||
}
|
||||
// Property for all files comes first than each property
|
||||
if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize;
|
||||
if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size;
|
||||
if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes;
|
||||
if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink;
|
||||
if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site;
|
||||
if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format;
|
||||
if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant;
|
||||
// Default setting if not exists
|
||||
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 = '*.*';
|
||||
if(!$config->allow_outlink) $config->allow_outlink = 'Y';
|
||||
if(!$config->download_grant) $config->download_grant = array();
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file information
|
||||
*
|
||||
* @param int $file_srl The sequence of file to get information
|
||||
* @param array $columnList The list of columns to get from DB
|
||||
* @return Object|object|array If error returns an instance of Object. If result set is one returns a object that contins file information. If result set is more than one returns array of object.
|
||||
*/
|
||||
function getFile($file_srl, $columnList = array())
|
||||
{
|
||||
$args->file_srl = $file_srl;
|
||||
$output = executeQueryArray('file.getFile', $args, $columnList);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// old version compatibility
|
||||
if(count($output->data) == 1)
|
||||
{
|
||||
$file = $output->data[0];
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
|
||||
return $file;
|
||||
}
|
||||
else
|
||||
{
|
||||
$fileList = array();
|
||||
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data as $key=>$value)
|
||||
{
|
||||
foreach($output->data as $key=>$value)
|
||||
{
|
||||
$file = $value;
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
array_push($fileList, $file);
|
||||
}
|
||||
$file = $value;
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
array_push($fileList, $file);
|
||||
}
|
||||
return $fileList;
|
||||
}
|
||||
}
|
||||
return $fileList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all files which belong to a specific document
|
||||
*
|
||||
* @param int $upload_target_srl The sequence of target to get file list
|
||||
* @param array $columnList The list of columns to get from DB
|
||||
* @param string $sortIndex The column that used as sort index
|
||||
* @return array Returns array of object that contains file information. If no result returns null.
|
||||
**/
|
||||
function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl') {
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->sort_index = $sortIndex;
|
||||
$output = executeQuery('file.getFiles', $args, $columnList);
|
||||
if(!$output->data) return;
|
||||
/**
|
||||
* Return all files which belong to a specific document
|
||||
*
|
||||
* @param int $upload_target_srl The sequence of target to get file list
|
||||
* @param array $columnList The list of columns to get from DB
|
||||
* @param string $sortIndex The column that used as sort index
|
||||
* @return array Returns array of object that contains file information. If no result returns null.
|
||||
*/
|
||||
function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl')
|
||||
{
|
||||
$args->upload_target_srl = $upload_target_srl;
|
||||
$args->sort_index = $sortIndex;
|
||||
$output = executeQuery('file.getFiles', $args, $columnList);
|
||||
if(!$output->data) return;
|
||||
|
||||
$file_list = $output->data;
|
||||
$file_list = $output->data;
|
||||
|
||||
if($file_list && !is_array($file_list)) $file_list = array($file_list);
|
||||
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->source_filename = stripslashes($file->source_filename);
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
$file_list[$i] = $file;
|
||||
}
|
||||
$file_count = count($file_list);
|
||||
for($i=0;$i<$file_count;$i++)
|
||||
{
|
||||
$file = $file_list[$i];
|
||||
$file->source_filename = stripslashes($file->source_filename);
|
||||
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
|
||||
$file_list[$i] = $file;
|
||||
}
|
||||
|
||||
return $file_list;
|
||||
}
|
||||
return $file_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return configurations of the attachement (it automatically checks if an administrator is)
|
||||
*
|
||||
* @return object Returns a file configuration of current module. If user is admin, returns PHP's max file size and allow all file types.
|
||||
**/
|
||||
function getUploadConfig() {
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin == 'Y') {
|
||||
$file_config->allowed_filesize = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
|
||||
$file_config->allowed_attach_size = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
} else {
|
||||
$module_srl = Context::get('module_srl');
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$module_srl) {
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
$file_config = $this->getFileConfig($module_srl);
|
||||
}
|
||||
return $file_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return messages for file upload and it depends whether an admin is or not
|
||||
*
|
||||
* @param int $attached_size
|
||||
* @return string
|
||||
**/
|
||||
function getUploadStatus($attached_size = 0) {
|
||||
$file_config = $this->getUploadConfig();
|
||||
// Display upload status
|
||||
$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
|
||||
);
|
||||
return $upload_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return file configuration of the module
|
||||
*
|
||||
* @param int $module_srl The sequence of module to get configuration
|
||||
* @return object
|
||||
**/
|
||||
function getFileModuleConfig($module_srl) {
|
||||
return $this->getFileConfig($module_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a grant of file
|
||||
*
|
||||
* @param object $file_info The file information to get grant
|
||||
* @param object $member_info The member information to get grant
|
||||
* @return object Returns a grant of file
|
||||
*/
|
||||
function getFileGrant($file_info, $member_info){
|
||||
if (!$file_info) return null;
|
||||
|
||||
if ($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) {
|
||||
$file_grant->is_deletable = true;
|
||||
return $file_grant;
|
||||
/**
|
||||
* Return configurations of the attachement (it automatically checks if an administrator is)
|
||||
*
|
||||
* @return object Returns a file configuration of current module. If user is admin, returns PHP's max file size and allow all file types.
|
||||
*/
|
||||
function getUploadConfig()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin == 'Y')
|
||||
{
|
||||
$file_config->allowed_filesize = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
|
||||
$file_config->allowed_attach_size = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
}
|
||||
else
|
||||
{
|
||||
$module_srl = Context::get('module_srl');
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$module_srl)
|
||||
{
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
$file_config = $this->getFileConfig($module_srl);
|
||||
}
|
||||
return $file_config;
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($file_info->module_srl), $member_info);
|
||||
/**
|
||||
* Return messages for file upload and it depends whether an admin is or not
|
||||
*
|
||||
* @param int $attached_size
|
||||
* @return string
|
||||
*/
|
||||
function getUploadStatus($attached_size = 0)
|
||||
{
|
||||
$file_config = $this->getUploadConfig();
|
||||
// Display upload status
|
||||
$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
|
||||
);
|
||||
return $upload_status;
|
||||
}
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl);
|
||||
if ($oDocument->isExists()) $document_grant = $oDocument->isGranted();
|
||||
/**
|
||||
* Return file configuration of the module
|
||||
*
|
||||
* @param int $module_srl The sequence of module to get configuration
|
||||
* @return object
|
||||
*/
|
||||
function getFileModuleConfig($module_srl)
|
||||
{
|
||||
return $this->getFileConfig($module_srl);
|
||||
}
|
||||
|
||||
$file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager);
|
||||
/**
|
||||
* Returns a grant of file
|
||||
*
|
||||
* @param object $file_info The file information to get grant
|
||||
* @param object $member_info The member information to get grant
|
||||
* @return object Returns a grant of file
|
||||
*/
|
||||
function getFileGrant($file_info, $member_info)
|
||||
{
|
||||
if(!$file_info) return null;
|
||||
|
||||
if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl])
|
||||
{
|
||||
$file_grant->is_deletable = true;
|
||||
return $file_grant;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($file_info->module_srl), $member_info);
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl);
|
||||
if($oDocument->isExists()) $document_grant = $oDocument->isGranted();
|
||||
|
||||
$file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager);
|
||||
|
||||
return $file_grant;
|
||||
}
|
||||
}
|
||||
/* End of file file.model.php */
|
||||
/* Location: ./modules/file/file.model.php */
|
||||
|
|
|
|||
|
|
@ -1,49 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* The view class file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class fileView extends file {
|
||||
/**
|
||||
* The view class file module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class fileView extends file
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* This is for additional configuration for service module
|
||||
* It only receives file configurations
|
||||
*
|
||||
* @param string $obj The html string of page of addition setup of module
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispFileAdditionSetup(&$obj)
|
||||
{
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
/**
|
||||
* This is for additional configuration for service module
|
||||
* It only receives file configurations
|
||||
*
|
||||
* @param string $obj The html string of page of addition setup of module
|
||||
* @return Object
|
||||
**/
|
||||
function triggerDispFileAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
if(!$current_module_srl && !$current_module_srls)
|
||||
{
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new Object();
|
||||
}
|
||||
// Get file configurations of the module
|
||||
$oFileModel = &getModel('file');
|
||||
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
|
||||
Context::set('file_config', $file_config);
|
||||
// Get a permission for group setting
|
||||
$oMemberModel = &getModel('member');
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||
Context::set('group_list', $group_list);
|
||||
// Set a template file
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls) {
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new Object();
|
||||
}
|
||||
// Get file configurations of the module
|
||||
$oFileModel = &getModel('file');
|
||||
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
|
||||
Context::set('file_config', $file_config);
|
||||
// Get a permission for group setting
|
||||
$oMemberModel = &getModel('member');
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||
Context::set('group_list', $group_list);
|
||||
// Set a template file
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
?>
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
/* End of file file.view.php */
|
||||
/* Location: ./modules/file/file.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue