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:
ovclas 2012-11-16 09:36:17 +00:00
parent a35ff711c4
commit 41d7eb8384
7 changed files with 1876 additions and 1744 deletions

View file

@ -1,187 +1,196 @@
<?php <?php
/** /**
* admin controller class of the file module * admin controller class of the file module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class fileAdminController extends file { class fileAdminController extends file
{
/**
* Initialization
* @return void
*/
function init()
{
}
/** /**
* Initialization * Delete the attachment of a particular module
* @return void *
**/ * @param int $module_srl Sequence of module to delete files
function init() { * @return Object
} */
function deleteModuleFiles($module_srl)
/** {
* Delete the attachment of a particular module // Get a full list of attachments
* $args->module_srl = $module_srl;
* @param int $module_srl Sequence of module to delete files $columnList = array('file_srl', 'uploaded_filename');
* @return Object $output = executeQueryArray('file.getModuleFiles',$args, $columnList);
**/ if(!$output) return $output;
function deleteModuleFiles($module_srl) { $files = $output->data;
// Get a full list of attachments // Remove from the DB
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
$columnList = array('file_srl', 'uploaded_filename'); $output = executeQuery('file.deleteModuleFiles', $args);
$output = executeQueryArray('file.getModuleFiles',$args, $columnList); if(!$output->toBool()) return $output;
if(!$output) return $output; // Remove the file
$files = $output->data; FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
// Remove from the DB FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
$args->module_srl = $module_srl; // Remove the file list obtained from the DB
$output = executeQuery('file.deleteModuleFiles', $args); $path = array();
if(!$output->toBool()) return $output; $cnt = count($files);
// Remove the file for($i=0;$i<$cnt;$i++)
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()
{ {
$file_srl = (int)Context::get('file_srl'); $uploaded_filename = $files[$i]->uploaded_filename;
//$fileSrlList = array(500, 502); FileHandler::removeFile($uploaded_filename);
$oFileModel = &getModel('file'); $path_info = pathinfo($uploaded_filename);
$output = $oFileModel->getFile($file_srl); if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
//$output = $oFileModel->getFile($fileSrlList); }
// Remove a file directory of the document
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
if($output->file_srl) return $output;
{ }
if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
else $_SESSION['file_management'][$output->file_srl] = true; /**
} * 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) );
* Change value from human readable to byte unit
* $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
* @param string $size_str Size string $this->setRedirectUrl($returnUrl);
* @return int The byte value for input }
**/
function _changeBytes($size_str) /**
* 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)) $srl = trim($module_srl[$i]);
{ if(!$srl) continue;
case 'M': case 'm': return (int)$size_str * 1048576; $oModuleController->insertModulePartConfig('file',$srl,$file_config);
case 'K': case 'k': return (int)$size_str * 1024;
case 'G': case 'g': return (int)$size_str * 1073741824;
default: return $size_str;
}
} }
}
?> $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 */

View file

@ -1,192 +1,200 @@
<?php <?php
/** /**
* Admin model class of the file module * Admin model class of the file module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class fileAdminModel extends file { class fileAdminModel extends file
{
/**
* Initialization
* @return void
*/
function init()
{
}
/** /**
* Initialization * Get all the attachments in order by time descending (for administrators)
* @return void *
**/ * <pre>
function init() { * 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
* Get all the attachments in order by time descending (for administrators) if($obj->isvalid == 'Y') $args->isvalid = 'Y';
* elseif($obj->isvalid == 'N') $args->isvalid = 'N';
* <pre> // Set multimedia/common file
* Search options: if($obj->direct_download == 'Y') $args->direct_download = 'Y';
* - s_module_srl: int[] or int, search module_srl elseif($obj->direct_download == 'N') $args->direct_download= 'N';
* - exclude_module_srl: int[] or int, exclude module_srl // Set variables
* - isvalid: Y or N $args->sort_index = $obj->sort_index;
* - direct_download: Y or N $args->page = $obj->page?$obj->page:1;
* - s_filename: string, like operation $args->list_count = $obj->list_count?$obj->list_count:20;
* - s_filesize_more: int, more operation, byte unit $args->page_count = $obj->page_count?$obj->page_count:10;
* - s_filesize_mega_more: int, more operation, mega unit $args->s_module_srl = $obj->module_srl;
* - s_filesize_less: int, less operation, byte unit $args->exclude_module_srl = $obj->exclude_module_srl;
* - s_filesize_mega_less: int, less operation, mega unit // Execute the file.getFileList query
* - s_download_count: int, more operation $output = executeQuery('file.getFileList', $args, $columnList);
* - s_regdate: string(YYYYMMDDHHMMSS), like prefix operation(STRING%) // Return if no result or an error occurs
* - s_ipaddress: string, like prefix operation if(!$output->toBool()||!count($output->data)) return $output;
* - 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 $oFileModel = &getModel('file');
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'); foreach($output->data as $key => $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)
{ {
// Search options if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target')); else $file->isCarted = false;
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
if($search_target && $search_keyword) { $file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid);
switch($search_target) { $output->data[$key] = $file;
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;
}
}
} }
}
?> 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 */

View file

@ -1,192 +1,224 @@
<?php <?php
/** /**
* Admin view of the module class file * Admin view of the module class file
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class fileAdminView extends file { class fileAdminView extends file
{
/**
* Initialization
* @return void
*/
function init()
{
}
/** /**
* Initialization * Display output list (for administrator)
* @return void *
**/ * @return Object
function init() { */
} 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
* Display output list (for administrator) $args->isvalid = Context::get('isvalid');
* $args->module_srl = Context::get('module_srl');
* @return Object // Get a list
**/ $oFileAdminModel = &getAdminModel('file');
function dispFileAdminList() { $columnList = array('file_srl', 'upload_target_srl', 'upload_target_type', 'sid', 'module_srl'
// Options to get a list , 'source_filename', 'isvalid', 'file_size', 'download_count', 'files.regdate', 'ipaddress');
$args->page = Context::get('page'); // /< Page $output = $oFileAdminModel->getFileList($args, $columnList);
$args->list_count = 30; // /< Number of documents that appear on a single page // Get the document for looping a list
$args->page_count = 10; // /< Number of pages that appear in the page navigation if($output->data)
{
$oCommentModel = &getModel('comment');
$oDocumentModel = &getModel('document');
$oModuleModel = &getModel('module');
$args->sort_index = 'file_srl'; // /< Sorting values $file_list = array();
$args->isvalid = Context::get('isvalid'); $document_list = array();
$args->module_srl = Context::get('module_srl'); $comment_list = array();
// Get a list $module_list= array();
$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(); $doc_srls = array();
$document_list = array(); $com_srls = array();
$comment_list = array(); $mod_srls= array();
$module_list= array();
$doc_srls = array(); foreach($output->data as $file)
$com_srls = array(); {
$mod_srls= array(); $file_srl = $file->file_srl;
$target_srl = $file->upload_target_srl;
foreach($output->data as $file) { $file_update_args = null;
$file_srl = $file->file_srl; $file_update_args->file_srl = $file_srl;
$target_srl = $file->upload_target_srl; // Find and update if upload_target_type doesn't exist
$file_update_args = null; if(!$file->upload_target_type)
$file_update_args->file_srl = $file_srl; {
// Find and update if upload_target_type doesn't exist // Pass if upload_target_type is already found
if(!$file->upload_target_type) { if($document_list[$target_srl])
// 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($document_output as $document) { $file->upload_target_type = 'doc';
$document_list[$document->document_srl] = $document; }
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
// Module List for($i = 0; $i < $com_srls_count; ++$i)
$mod_srls_count = count($mod_srls); {
if($mod_srls_count) { if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
$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;
}
} }
} 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)
if($file->upload_target_type == 'com') { {
$file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl; 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); $file_list[$file_srl] = $file;
Context::set('document_list', $document_list); $mod_srls[] = $file->module_srl;
Context::set('comment_list', $comment_list); }
Context::set('module_list', $module_list); // Remove duplication
Context::set('total_count', $output->total_count); $doc_srls = array_unique($doc_srls);
Context::set('total_page', $output->total_page); $com_srls = array_unique($com_srls);
Context::set('page', $output->page); $mod_srls = array_unique($mod_srls);
Context::set('page_navigation', $output->page_navigation); // Comment list
// Set a template $com_srls_count = count($com_srls);
$security = new Security(); if($com_srls_count)
$security->encodeHTML('file_list..source_filename','file_list..ipaddress'); {
$security->encodeHTML('module_list..browser_title','module_list..mid'); $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'); foreach($file_list as $srl => $file)
$this->setTemplateFile('file_list'); {
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');
/** $this->setTemplatePath($this->module_path.'tpl');
* Set attachment information (for administrator) $this->setTemplateFile('file_list');
* }
* @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');
}
} /**
?> * 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 */

View file

@ -1,148 +1,152 @@
<?php <?php
/** /**
* High class of the file module * High class of the file module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class file extends ModuleObject { 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');
/** return new Object();
* 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(); /**
} * 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
* A method to check if successfully installed if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true;
*
* @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 return false;
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true; }
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');
/** if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
* Execute update $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
*
* @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')) if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'))
$oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'))
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
$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
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')) // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', '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('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', '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 return new Object(0, 'success_updated');
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) }
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after');
}
return new Object(0, 'success_updated'); /**
} * Re-generate the cache file
*
/** * @return Object
* Re-generate the cache file */
* function recompileCache()
* @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

View file

@ -1,283 +1,306 @@
<?php <?php
/** /**
* Model class of the file module * Model class of the file module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class fileModel extends file { class fileModel extends file
{
/**
* Initialization
* @return void
*/
function init()
{
}
/** /**
* Initialization * Return a file list attached in the document
* @return void *
**/ * It is used when a file list of the upload_target_srl is requested for creating/updating a document.
function init() { * 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');
* Return a file list attached in the document $editor_sequence = Context::get('editor_sequence');
* $upload_target_srl = Context::get('upload_target_srl');
* It is used when a file list of the upload_target_srl is requested for creating/updating a document. if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
* 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'); if($upload_target_srl)
$editor_sequence = Context::get('editor_sequence'); {
$upload_target_srl = Context::get('upload_target_srl'); $tmp_files = $this->getFiles($upload_target_srl);
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; $file_count = count($tmp_files);
if($upload_target_srl) { for($i=0;$i<$file_count;$i++)
$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&amp;act=%s&amp;file_srl=%s&amp;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_info = $tmp_files[$i];
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid); 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 }
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&amp;act=%s&amp;file_srl=%s&amp;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))
{ {
$fileList = array(); foreach($output->data as $key=>$value)
if(is_array($output->data))
{ {
foreach($output->data as $key=>$value) $file = $value;
{ $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
$file = $value; array_push($fileList, $file);
$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 * Return all files which belong to a specific document
* *
* @param int $upload_target_srl The sequence of target to get file list * @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 array $columnList The list of columns to get from DB
* @param string $sortIndex The column that used as sort index * @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. * @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') { function getFiles($upload_target_srl, $columnList = array(), $sortIndex = 'file_srl')
$args->upload_target_srl = $upload_target_srl; {
$args->sort_index = $sortIndex; $args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.getFiles', $args, $columnList); $args->sort_index = $sortIndex;
if(!$output->data) return; $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); $file_count = count($file_list);
for($i=0;$i<$file_count;$i++) { for($i=0;$i<$file_count;$i++)
$file = $file_list[$i]; {
$file->source_filename = stripslashes($file->source_filename); $file = $file_list[$i];
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid); $file->source_filename = stripslashes($file->source_filename);
$file_list[$i] = $file; $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 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. * @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() { function getUploadConfig()
$logged_info = Context::get('logged_info'); {
if($logged_info->is_admin == 'Y') { $logged_info = Context::get('logged_info');
$file_config->allowed_filesize = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize')); if($logged_info->is_admin == 'Y')
$file_config->allowed_attach_size = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize')); {
$file_config->allowed_filetypes = '*.*'; $file_config->allowed_filesize = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
} else { $file_config->allowed_attach_size = preg_replace("/[a-z]/is","",ini_get('upload_max_filesize'));
$module_srl = Context::get('module_srl'); $file_config->allowed_filetypes = '*.*';
// Get the current module if module_srl doesn't exist }
if(!$module_srl) { else
$current_module_info = Context::get('current_module_info'); {
$module_srl = $current_module_info->module_srl; $module_srl = Context::get('module_srl');
} // Get the current module if module_srl doesn't exist
$file_config = $this->getFileConfig($module_srl); if(!$module_srl)
} {
return $file_config; $current_module_info = Context::get('current_module_info');
} $module_srl = $current_module_info->module_srl;
/**
* 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;
} }
$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); * Return file configuration of the module
if ($oDocument->isExists()) $document_grant = $oDocument->isGranted(); *
* @param int $module_srl The sequence of module to get configuration
$file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); * @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 $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 */

View file

@ -1,49 +1,53 @@
<?php <?php
/** /**
* The view class file module * The view class file module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
**/ */
class fileView extends file { class fileView extends file
{
/**
* Initialization
* @return void
*/
function init()
{
}
/** /**
* Initialization * This is for additional configuration for service module
* @return void * It only receives file configurations
**/ *
function init() { * @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)
* This is for additional configuration for service module {
* It only receives file configurations // Get information of the current module
* $current_module_info = Context::get('current_module_info');
* @param string $obj The html string of page of addition setup of module $current_module_srl = $current_module_info->module_srl;
* @return Object if(!$current_module_srl) return new Object();
**/ }
function triggerDispFileAdditionSetup(&$obj) { // Get file configurations of the module
$current_module_srl = Context::get('module_srl'); $oFileModel = &getModel('file');
$current_module_srls = Context::get('module_srls'); $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) { return new Object();
// Get information of the current module }
$current_module_info = Context::get('current_module_info'); }
$current_module_srl = $current_module_info->module_srl; /* End of file file.view.php */
if(!$current_module_srl) return new Object(); /* Location: ./modules/file/file.view.php */
}
// 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();
}
}
?>