mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Remove trailing whitespace
This commit is contained in:
parent
c881e73c1d
commit
c5267b42fd
26 changed files with 873 additions and 873 deletions
|
|
@ -14,7 +14,7 @@ class boardAdminController extends board {
|
||||||
**/
|
**/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,7 +37,7 @@ class boardAdminController extends board {
|
||||||
{
|
{
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($args->module_srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($args->module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup extra_order_target
|
// setup extra_order_target
|
||||||
$extra_order_target = array();
|
$extra_order_target = array();
|
||||||
if($args->module_srl)
|
if($args->module_srl)
|
||||||
|
|
@ -77,10 +77,10 @@ class boardAdminController extends board {
|
||||||
$args->protect_admin_content_delete = 'N';
|
$args->protect_admin_content_delete = 'N';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_array($args->order_target,$this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order';
|
if(!in_array($args->order_target,$this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order';
|
||||||
if(!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
|
if(!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
|
||||||
|
|
||||||
$args->skip_bottom_list_days = max(0, intval($args->skip_bottom_list_days));
|
$args->skip_bottom_list_days = max(0, intval($args->skip_bottom_list_days));
|
||||||
$args->browser_title = trim(utf8_normalize_spaces($args->browser_title));
|
$args->browser_title = trim(utf8_normalize_spaces($args->browser_title));
|
||||||
$args->meta_keywords = $args->meta_keywords ? implode(', ', array_map('trim', explode(',', $args->meta_keywords))) : '';
|
$args->meta_keywords = $args->meta_keywords ? implode(', ', array_map('trim', explode(',', $args->meta_keywords))) : '';
|
||||||
|
|
@ -91,7 +91,7 @@ class boardAdminController extends board {
|
||||||
{
|
{
|
||||||
unset($args->module_srl);
|
unset($args->module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// preserve existing config
|
// preserve existing config
|
||||||
if ($args->module_srl)
|
if ($args->module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -209,25 +209,25 @@ class boardAdminController extends board {
|
||||||
$include_modules = array_map('intval', $vars->include_modules ?: []);
|
$include_modules = array_map('intval', $vars->include_modules ?: []);
|
||||||
$include_days = max(0, floatval($vars->include_days));
|
$include_days = max(0, floatval($vars->include_days));
|
||||||
$include_notice = $vars->include_notice === 'Y' ? 'Y' : 'N';
|
$include_notice = $vars->include_notice === 'Y' ? 'Y' : 'N';
|
||||||
|
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
|
||||||
if (!$module_info)
|
if (!$module_info)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_info->include_modules = implode(',', array_filter($include_modules, function($item) {
|
$module_info->include_modules = implode(',', array_filter($include_modules, function($item) {
|
||||||
return $item > 0;
|
return $item > 0;
|
||||||
}));
|
}));
|
||||||
$module_info->include_days = floatval(number_format($include_days, 2, '.', ''));
|
$module_info->include_days = floatval(number_format($include_days, 2, '.', ''));
|
||||||
$module_info->include_notice = $include_notice;
|
$module_info->include_notice = $include_notice;
|
||||||
|
|
||||||
$output = getController('module')->updateModule($module_info);
|
$output = getController('module')->updateModule($module_info);
|
||||||
if (!$output->toBool())
|
if (!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
if (Context::get('success_return_url'))
|
if (Context::get('success_return_url'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ class boardAdminView extends board {
|
||||||
$args->list_count = 1000;
|
$args->list_count = 1000;
|
||||||
$output = executeQueryArray('board.getBoardList', $args, ['module_srl', 'mid', 'browser_title']);
|
$output = executeQueryArray('board.getBoardList', $args, ['module_srl', 'mid', 'browser_title']);
|
||||||
Context::set('board_list', $output->data);
|
Context::set('board_list', $output->data);
|
||||||
|
|
||||||
// setup the template file
|
// setup the template file
|
||||||
$this->setTemplateFile('addition_setup');
|
$this->setTemplateFile('addition_setup');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class boardAPI extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply _arrangeContent to a list of documents.
|
* Apply _arrangeContent to a list of documents.
|
||||||
*
|
*
|
||||||
* @param array $content_list
|
* @param array $content_list
|
||||||
* @param object $grant
|
* @param object $grant
|
||||||
* @return array
|
* @return array
|
||||||
|
|
@ -120,7 +120,7 @@ class boardAPI extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up document info so that only some fields are exposed.
|
* Clean up document info so that only some fields are exposed.
|
||||||
*
|
*
|
||||||
* @param object $content
|
* @param object $content
|
||||||
* @param object $grant
|
* @param object $grant
|
||||||
* @return stdClass
|
* @return stdClass
|
||||||
|
|
@ -162,7 +162,7 @@ class boardAPI extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up comment info so that only some fields are exposed.
|
* Clean up comment info so that only some fields are exposed.
|
||||||
*
|
*
|
||||||
* @param array $comment_list
|
* @param array $comment_list
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -190,7 +190,7 @@ class boardAPI extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up file info so that only some fields are exposed.
|
* Clean up file info so that only some fields are exposed.
|
||||||
*
|
*
|
||||||
* @param array $file_list
|
* @param array $file_list
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -211,7 +211,7 @@ class boardAPI extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up extra vars so that only some fields are exposed.
|
* Clean up extra vars so that only some fields are exposed.
|
||||||
*
|
*
|
||||||
* @param array $extra_var_list
|
* @param array $extra_var_list
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class boardController extends board
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insert document
|
* @brief insert document
|
||||||
**/
|
**/
|
||||||
|
|
@ -26,12 +26,12 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup variables
|
// setup variables
|
||||||
$obj = Context::getRequestVars();
|
$obj = Context::getRequestVars();
|
||||||
$obj->module_srl = $this->module_srl;
|
$obj->module_srl = $this->module_srl;
|
||||||
$obj->commentStatus = $obj->comment_status;
|
$obj->commentStatus = $obj->comment_status;
|
||||||
|
|
||||||
// Remove disallowed Unicode symbols.
|
// Remove disallowed Unicode symbols.
|
||||||
if ($this->module_info->filter_specialchars !== 'N')
|
if ($this->module_info->filter_specialchars !== 'N')
|
||||||
{
|
{
|
||||||
|
|
@ -48,20 +48,20 @@ class boardController extends board
|
||||||
$obj->tags = utf8_clean($obj->tags);
|
$obj->tags = utf8_clean($obj->tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return error if content is empty.
|
// Return error if content is empty.
|
||||||
if (is_empty_html_content($obj->content))
|
if (is_empty_html_content($obj->content))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_empty_content');
|
throw new Rhymix\Framework\Exception('msg_empty_content');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return error if content is too large.
|
// Return error if content is too large.
|
||||||
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
|
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
|
||||||
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
|
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_content_too_long');
|
throw new Rhymix\Framework\Exception('msg_content_too_long');
|
||||||
}
|
}
|
||||||
|
|
||||||
// unset document style if not manager
|
// unset document style if not manager
|
||||||
if(!$this->grant->manager)
|
if(!$this->grant->manager)
|
||||||
{
|
{
|
||||||
|
|
@ -73,12 +73,12 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
$obj->is_admin = 'Y';
|
$obj->is_admin = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
|
|
||||||
$secret_status = DocumentModel::getConfigStatus('secret');
|
$secret_status = DocumentModel::getConfigStatus('secret');
|
||||||
$use_status = explode('|@|', $this->module_info->use_status);
|
$use_status = explode('|@|', $this->module_info->use_status);
|
||||||
|
|
||||||
// Set status
|
// Set status
|
||||||
if(($obj->is_secret == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status))
|
if(($obj->is_secret == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status))
|
||||||
{
|
{
|
||||||
|
|
@ -89,16 +89,16 @@ class boardController extends board
|
||||||
unset($obj->is_secret);
|
unset($obj->is_secret);
|
||||||
$obj->status = DocumentModel::getConfigStatus('public');
|
$obj->status = DocumentModel::getConfigStatus('public');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set update log
|
// Set update log
|
||||||
if($this->module_info->update_log == 'Y')
|
if($this->module_info->update_log == 'Y')
|
||||||
{
|
{
|
||||||
$obj->update_log_setting = 'Y';
|
$obj->update_log_setting = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
$manual = false;
|
$manual = false;
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
||||||
|
|
||||||
// Set anonymous information when insert mode or status is temp
|
// Set anonymous information when insert mode or status is temp
|
||||||
|
|
@ -108,17 +108,17 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
$obj->document_srl = getNextSequence();
|
$obj->document_srl = getNextSequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
$manual = true;
|
$manual = true;
|
||||||
$anonymous_name = $this->module_info->anonymous_name ?: 'anonymous';
|
$anonymous_name = $this->module_info->anonymous_name ?: 'anonymous';
|
||||||
$anonymous_name = $this->createAnonymousName($anonymous_name, $logged_info->member_srl, $obj->document_srl);
|
$anonymous_name = $this->createAnonymousName($anonymous_name, $logged_info->member_srl, $obj->document_srl);
|
||||||
$this->module_info->admin_mail = '';
|
$this->module_info->admin_mail = '';
|
||||||
|
|
||||||
$obj->notify_message = 'N';
|
$obj->notify_message = 'N';
|
||||||
$obj->email_address = $obj->homepage = $obj->user_id = '';
|
$obj->email_address = $obj->homepage = $obj->user_id = '';
|
||||||
$obj->user_name = $obj->nick_name = $anonymous_name;
|
$obj->user_name = $obj->nick_name = $anonymous_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update if the document already exists.
|
// Update if the document already exists.
|
||||||
if($oDocument->isExists())
|
if($oDocument->isExists())
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +126,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protect admin document
|
// Protect admin document
|
||||||
if ($this->module_info->protect_admin_content_update !== 'N')
|
if ($this->module_info->protect_admin_content_update !== 'N')
|
||||||
{
|
{
|
||||||
|
|
@ -136,7 +136,7 @@ class boardController extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
|
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if document status is temp
|
// if document status is temp
|
||||||
if($oDocument->get('status') == DocumentModel::getConfigStatus('temp'))
|
if($oDocument->get('status') == DocumentModel::getConfigStatus('temp'))
|
||||||
{
|
{
|
||||||
|
|
@ -146,7 +146,7 @@ class boardController extends board
|
||||||
$obj->member_srl = abs($oDocument->get('member_srl')) * -1;
|
$obj->member_srl = abs($oDocument->get('member_srl')) * -1;
|
||||||
$oDocument->add('member_srl', $obj->member_srl);
|
$oDocument->add('member_srl', $obj->member_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update list order, date
|
// Update list order, date
|
||||||
$obj->last_update = $obj->regdate = date('YmdHis');
|
$obj->last_update = $obj->regdate = date('YmdHis');
|
||||||
$obj->update_order = $obj->list_order = (getNextSequence() * -1);
|
$obj->update_order = $obj->list_order = (getNextSequence() * -1);
|
||||||
|
|
@ -161,7 +161,7 @@ class boardController extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_protect_update_content');
|
throw new Rhymix\Framework\Exception('msg_protect_update_content');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protect document by date
|
// Protect document by date
|
||||||
if($this->module_info->protect_document_regdate > 0 && !$this->grant->manager)
|
if($this->module_info->protect_document_regdate > 0 && !$this->grant->manager)
|
||||||
{
|
{
|
||||||
|
|
@ -170,7 +170,7 @@ class boardController extends board
|
||||||
throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate));
|
throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preserve module_srl if the document belongs to a module that is included in this board
|
// Preserve module_srl if the document belongs to a module that is included in this board
|
||||||
if ($oDocument->get('module_srl') != $obj->module_srl && in_array($oDocument->get('module_srl'), explode(',', $this->module_info->include_modules ?: '')))
|
if ($oDocument->get('module_srl') != $obj->module_srl && in_array($oDocument->get('module_srl'), explode(',', $this->module_info->include_modules ?: '')))
|
||||||
{
|
{
|
||||||
|
|
@ -181,7 +181,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
$obj->module_srl = $oDocument->get('module_srl');
|
$obj->module_srl = $oDocument->get('module_srl');
|
||||||
}
|
}
|
||||||
|
|
||||||
// notice & document style same as before if not manager
|
// notice & document style same as before if not manager
|
||||||
if(!$this->grant->manager)
|
if(!$this->grant->manager)
|
||||||
{
|
{
|
||||||
|
|
@ -189,13 +189,13 @@ class boardController extends board
|
||||||
$obj->title_color = $oDocument->get('title_color');
|
$obj->title_color = $oDocument->get('title_color');
|
||||||
$obj->title_bold = $oDocument->get('title_bold');
|
$obj->title_bold = $oDocument->get('title_bold');
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->reason_update = escape($obj->reason_update);
|
$obj->reason_update = escape($obj->reason_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
$output = $oDocumentController->updateDocument($oDocument, $obj, $manual);
|
$output = $oDocumentController->updateDocument($oDocument, $obj, $manual);
|
||||||
|
|
||||||
$msg_code = 'success_updated';
|
$msg_code = 'success_updated';
|
||||||
}
|
}
|
||||||
// Insert a new document.
|
// Insert a new document.
|
||||||
|
|
@ -206,29 +206,29 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
$obj->member_srl = $logged_info->member_srl * -1;
|
$obj->member_srl = $logged_info->member_srl * -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update list order if document_srl is already assigned
|
// Update list order if document_srl is already assigned
|
||||||
if ($obj->document_srl)
|
if ($obj->document_srl)
|
||||||
{
|
{
|
||||||
$obj->update_order = $obj->list_order = (getNextSequence() * -1);
|
$obj->update_order = $obj->list_order = (getNextSequence() * -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
$output = $oDocumentController->insertDocument($obj, $manual, false, $obj->document_srl ? false : true);
|
$output = $oDocumentController->insertDocument($obj, $manual, false, $obj->document_srl ? false : true);
|
||||||
|
|
||||||
if ($output->toBool())
|
if ($output->toBool())
|
||||||
{
|
{
|
||||||
// Set grant for the new document.
|
// Set grant for the new document.
|
||||||
$oDocument = DocumentModel::getDocument($output->get('document_srl'));
|
$oDocument = DocumentModel::getDocument($output->get('document_srl'));
|
||||||
$oDocument->setGrantForSession();
|
$oDocument->setGrantForSession();
|
||||||
|
|
||||||
// send an email to admin user
|
// send an email to admin user
|
||||||
if ($this->module_info->admin_mail && config('mail.default_from'))
|
if ($this->module_info->admin_mail && config('mail.default_from'))
|
||||||
{
|
{
|
||||||
$browser_title = Context::replaceUserLang($this->module_info->browser_title);
|
$browser_title = Context::replaceUserLang($this->module_info->browser_title);
|
||||||
$mail_title = sprintf(lang('msg_document_notify_mail'), $browser_title, cut_str($obj->title, 20, '...'));
|
$mail_title = sprintf(lang('msg_document_notify_mail'), $browser_title, cut_str($obj->title, 20, '...'));
|
||||||
$mail_content = sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $output->get('document_srl')), getFullUrl('', 'document_srl', $output->get('document_srl')), $obj->content);
|
$mail_content = sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $output->get('document_srl')), getFullUrl('', 'document_srl', $output->get('document_srl')), $obj->content);
|
||||||
|
|
||||||
$oMail = new \Rhymix\Framework\Mail();
|
$oMail = new \Rhymix\Framework\Mail();
|
||||||
$oMail->setSubject($mail_title);
|
$oMail->setSubject($mail_title);
|
||||||
$oMail->setBody($mail_content);
|
$oMail->setBody($mail_content);
|
||||||
|
|
@ -242,21 +242,21 @@ class boardController extends board
|
||||||
$oMail->send();
|
$oMail->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg_code = 'success_registed';
|
$msg_code = 'success_registed';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is an error
|
// if there is an error
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the results
|
// return the results
|
||||||
$this->add('mid', Context::get('mid'));
|
$this->add('mid', Context::get('mid'));
|
||||||
$this->add('document_srl', $output->get('document_srl'));
|
$this->add('document_srl', $output->get('document_srl'));
|
||||||
$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'document_srl', $output->get('document_srl')));
|
$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'document_srl', $output->get('document_srl')));
|
||||||
|
|
||||||
// alert a message
|
// alert a message
|
||||||
$this->setMessage($msg_code);
|
$this->setMessage($msg_code);
|
||||||
}
|
}
|
||||||
|
|
@ -325,7 +325,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check protect content
|
// check protect content
|
||||||
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
|
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -415,7 +415,7 @@ class boardController extends board
|
||||||
$obj->content = utf8_clean($obj->content);
|
$obj->content = utf8_clean($obj->content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return error if content is empty.
|
// Return error if content is empty.
|
||||||
if (is_empty_html_content($obj->content))
|
if (is_empty_html_content($obj->content))
|
||||||
{
|
{
|
||||||
|
|
@ -428,7 +428,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_content_too_long');
|
throw new Rhymix\Framework\Exception('msg_content_too_long');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
|
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
|
||||||
if(!is_array($this->module_info->use_status))
|
if(!is_array($this->module_info->use_status))
|
||||||
{
|
{
|
||||||
|
|
@ -453,7 +453,7 @@ class boardController extends board
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->module_srl = $oDocument->get('module_srl');
|
$obj->module_srl = $oDocument->get('module_srl');
|
||||||
|
|
||||||
// For anonymous use, remove writer's information and notifying information
|
// For anonymous use, remove writer's information and notifying information
|
||||||
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y'))
|
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y'))
|
||||||
{
|
{
|
||||||
|
|
@ -505,7 +505,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
// Update document last_update info?
|
// Update document last_update info?
|
||||||
$update_document = $this->module_info->update_order_on_comment === 'N' ? false : true;
|
$update_document = $this->module_info->update_order_on_comment === 'N' ? false : true;
|
||||||
|
|
||||||
// Parent exists.
|
// Parent exists.
|
||||||
if($obj->parent_srl)
|
if($obj->parent_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -592,7 +592,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$childs = null;
|
$childs = null;
|
||||||
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
|
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
|
||||||
{
|
{
|
||||||
|
|
@ -602,7 +602,7 @@ class boardController extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
|
throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
|
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
|
||||||
{
|
{
|
||||||
$member_info = MemberModel::getMemberInfo($comment->get('member_srl'));
|
$member_info = MemberModel::getMemberInfo($comment->get('member_srl'));
|
||||||
|
|
@ -760,7 +760,7 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the module information
|
// get the module information
|
||||||
$module_info = ModuleModel::getModuleInfoByMid($mid);
|
$module_info = ModuleModel::getModuleInfoByMid($mid);
|
||||||
if (!$module_info || !isset($module_info->module) || $module_info->module !== 'board')
|
if (!$module_info || !isset($module_info->module) || $module_info->module !== 'board')
|
||||||
|
|
@ -774,14 +774,14 @@ class boardController extends board
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = getUrl('', 'mid', $mid, 'member_srl', $obj->member_srl);
|
$url = getUrl('', 'mid', $mid, 'member_srl', $obj->member_srl);
|
||||||
getController('member')->addMemberPopupMenu($url, 'cmd_view_own_document', '', 'self', 'board_own_document');
|
getController('member')->addMemberPopupMenu($url, 'cmd_view_own_document', '', 'self', 'board_own_document');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an anonymous nickname.
|
* Create an anonymous nickname.
|
||||||
*
|
*
|
||||||
* @param string $format
|
* @param string $format
|
||||||
* @param int $member_srl
|
* @param int $member_srl
|
||||||
* @param int $document_srl
|
* @param int $document_srl
|
||||||
|
|
@ -800,10 +800,10 @@ class boardController extends board
|
||||||
}
|
}
|
||||||
}, $format);
|
}, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subroutine for hashing anonymous nickname.
|
* Subroutine for hashing anonymous nickname.
|
||||||
*
|
*
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param int $digits
|
* @param int $digits
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ class boardView extends board
|
||||||
// Check if a permission for file download is granted
|
// Check if a permission for file download is granted
|
||||||
// Get configurations (using module model object)
|
// Get configurations (using module model object)
|
||||||
$file_module_config = ModuleModel::getModulePartConfig('file',$this->module_srl);
|
$file_module_config = ModuleModel::getModulePartConfig('file',$this->module_srl);
|
||||||
|
|
||||||
$downloadGrantCount = 0;
|
$downloadGrantCount = 0;
|
||||||
if(is_array($file_module_config->download_grant))
|
if(is_array($file_module_config->download_grant))
|
||||||
{
|
{
|
||||||
|
|
@ -384,7 +384,7 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download');
|
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download');
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin != 'Y')
|
if($logged_info->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -470,7 +470,7 @@ class boardView extends board
|
||||||
}
|
}
|
||||||
$output = DocumentModel::getNoticeList($args, $this->columnList);
|
$output = DocumentModel::getNoticeList($args, $this->columnList);
|
||||||
$notice_list = $output->data ?? [];
|
$notice_list = $output->data ?? [];
|
||||||
|
|
||||||
$this->_fillModuleTitles($notice_list);
|
$this->_fillModuleTitles($notice_list);
|
||||||
Context::set('notice_list', $notice_list);
|
Context::set('notice_list', $notice_list);
|
||||||
}
|
}
|
||||||
|
|
@ -507,7 +507,7 @@ class boardView extends board
|
||||||
$args->search_target = Context::get('search_target');
|
$args->search_target = Context::get('search_target');
|
||||||
$args->search_keyword = Context::get('search_keyword');
|
$args->search_keyword = Context::get('search_keyword');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$search_option = Context::get('search_option'))
|
if(!$search_option = Context::get('search_option'))
|
||||||
{
|
{
|
||||||
$search_option = $this->search_option;
|
$search_option = $this->search_option;
|
||||||
|
|
@ -516,13 +516,13 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
$args->search_target = '';
|
$args->search_target = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// set member_srl for view particular member's document
|
// set member_srl for view particular member's document
|
||||||
if($this->module_info->use_anonymous !== 'Y')
|
if($this->module_info->use_anonymous !== 'Y')
|
||||||
{
|
{
|
||||||
$args->member_srl = abs(Context::get('member_srl') ?? 0) ?: null;
|
$args->member_srl = abs(Context::get('member_srl') ?? 0) ?: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the category is enabled, then get the category
|
// if the category is enabled, then get the category
|
||||||
if($this->module_info->use_category=='Y')
|
if($this->module_info->use_category=='Y')
|
||||||
{
|
{
|
||||||
|
|
@ -603,12 +603,12 @@ class boardView extends board
|
||||||
public function _fillModuleTitles(&$document_list)
|
public function _fillModuleTitles(&$document_list)
|
||||||
{
|
{
|
||||||
static $map = null;
|
static $map = null;
|
||||||
|
|
||||||
if (!$document_list)
|
if (!$document_list)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->include_modules)
|
if ($this->include_modules)
|
||||||
{
|
{
|
||||||
if ($map === null)
|
if ($map === null)
|
||||||
|
|
@ -655,17 +655,17 @@ class boardView extends board
|
||||||
'regdate', 'last_update', 'last_updater', 'ipaddress', 'list_order', 'update_order',
|
'regdate', 'last_update', 'last_updater', 'ipaddress', 'list_order', 'update_order',
|
||||||
'allow_trackback', 'notify_message', 'status', 'comment_status',
|
'allow_trackback', 'notify_message', 'status', 'comment_status',
|
||||||
);
|
);
|
||||||
|
|
||||||
// List of columns that should always be selected
|
// List of columns that should always be selected
|
||||||
$defaultColumnList = array(
|
$defaultColumnList = array(
|
||||||
'document_srl', 'module_srl', 'category_srl', 'lang_code', 'is_notice',
|
'document_srl', 'module_srl', 'category_srl', 'lang_code', 'is_notice',
|
||||||
'title', 'title_bold', 'title_color', 'member_srl', 'nick_name', 'tags', 'extra_vars',
|
'title', 'title_bold', 'title_color', 'member_srl', 'nick_name', 'tags', 'extra_vars',
|
||||||
'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'last_update',
|
'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'last_update',
|
||||||
);
|
);
|
||||||
|
|
||||||
// List of columns selected by the user
|
// List of columns selected by the user
|
||||||
$selectedColumnList = array_keys($this->listConfig);
|
$selectedColumnList = array_keys($this->listConfig);
|
||||||
|
|
||||||
// Return all columns for some legacy skins
|
// Return all columns for some legacy skins
|
||||||
if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
|
if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog')
|
||||||
{
|
{
|
||||||
|
|
@ -682,12 +682,12 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
$selectedColumnList[] = 'last_updater';
|
$selectedColumnList[] = 'last_updater';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicates and/or invalid column names
|
// Remove duplicates and/or invalid column names
|
||||||
$selectedColumnList = array_intersect($selectedColumnList, $allColumnList);
|
$selectedColumnList = array_intersect($selectedColumnList, $allColumnList);
|
||||||
$this->columnList = array_unique(array_merge($defaultColumnList, $selectedColumnList));
|
$this->columnList = array_unique(array_merge($defaultColumnList, $selectedColumnList));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add table name
|
// add table name
|
||||||
foreach($this->columnList as $no => $value)
|
foreach($this->columnList as $no => $value)
|
||||||
{
|
{
|
||||||
|
|
@ -756,19 +756,19 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
|
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($document_srl);
|
$oDocument = DocumentModel::getDocument($document_srl);
|
||||||
if(!$oDocument->isExists())
|
if(!$oDocument->isExists())
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||||
}
|
}
|
||||||
Context::set('oDocument', $oDocument);
|
Context::set('oDocument', $oDocument);
|
||||||
|
|
||||||
$this->setLayoutPath('./common/tpl');
|
$this->setLayoutPath('./common/tpl');
|
||||||
$this->setLayoutFile('default_layout');
|
$this->setLayoutFile('default_layout');
|
||||||
$this->setTemplateFile('comment.html');
|
$this->setTemplateFile('comment.html');
|
||||||
|
|
@ -819,7 +819,7 @@ class boardView extends board
|
||||||
if($is_granted) $category_list[$category_srl] = $category;
|
if($is_granted) $category_list[$category_srl] = $category;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if at least one category is granted
|
// check if at least one category is granted
|
||||||
$grant_exists = false;
|
$grant_exists = false;
|
||||||
foreach ($category_list as $category)
|
foreach ($category_list as $category)
|
||||||
|
|
@ -866,7 +866,7 @@ class boardView extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_protect_update_content');
|
throw new Rhymix\Framework\Exception('msg_protect_update_content');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->module_info->protect_admin_content_update !== 'N')
|
if ($this->module_info->protect_admin_content_update !== 'N')
|
||||||
{
|
{
|
||||||
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
|
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
|
||||||
|
|
@ -894,7 +894,7 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
$pointForInsert = 0;
|
$pointForInsert = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pointForInsert < 0)
|
if($pointForInsert < 0)
|
||||||
{
|
{
|
||||||
if(!$this->user->isMember())
|
if(!$this->user->isMember())
|
||||||
|
|
@ -1195,7 +1195,7 @@ class boardView extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
|
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the comment variables on context
|
// setup the comment variables on context
|
||||||
Context::set('oSourceComment', CommentModel::getComment());
|
Context::set('oSourceComment', CommentModel::getComment());
|
||||||
Context::set('oComment', $oComment);
|
Context::set('oComment', $oComment);
|
||||||
|
|
@ -1256,7 +1256,7 @@ class boardView extends board
|
||||||
throw new Rhymix\Framework\Exception('msg_admin_comment_no_delete');
|
throw new Rhymix\Framework\Exception('msg_admin_comment_no_delete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the comment is not existed, then back to the board content page
|
// if the comment is not existed, then back to the board content page
|
||||||
if(!$oComment->isExists() )
|
if(!$oComment->isExists() )
|
||||||
{
|
{
|
||||||
|
|
@ -1321,7 +1321,7 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$document_srl = Context::get('document_srl');
|
$document_srl = Context::get('document_srl');
|
||||||
if(!$document_srl)
|
if(!$document_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -1333,7 +1333,7 @@ class boardView extends board
|
||||||
{
|
{
|
||||||
return $updatelog;
|
return $updatelog;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('total_count', $updatelog->page_navigation->total_count);
|
Context::set('total_count', $updatelog->page_navigation->total_count);
|
||||||
Context::set('total_page', $updatelog->page_navigation->total_page);
|
Context::set('total_page', $updatelog->page_navigation->total_page);
|
||||||
Context::set('page', $updatelog->page);
|
Context::set('page', $updatelog->page);
|
||||||
|
|
@ -1440,7 +1440,7 @@ class boardView extends board
|
||||||
Context::set('blame_member_info', $blame_member_infos);
|
Context::set('blame_member_info', $blame_member_infos);
|
||||||
$this->setTemplateFile('vote_log');
|
$this->setTemplateFile('vote_log');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default 404 Handler.
|
* Default 404 Handler.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1451,7 +1451,7 @@ class boardView extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an error page.
|
* Display an error page.
|
||||||
*
|
*
|
||||||
* @param string $msg_code
|
* @param string $msg_code
|
||||||
* @param int $http_code
|
* @param int $http_code
|
||||||
* @return void
|
* @return void
|
||||||
|
|
@ -1470,9 +1470,9 @@ class boardView extends board
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an alert window on top of the page.
|
* Display an alert window on top of the page.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @param string $msg_code
|
* @param string $msg_code
|
||||||
* @param int $http_code
|
* @param int $http_code
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
||||||
|
|
@ -1,138 +1,138 @@
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class boardWAP
|
* @class boardWAP
|
||||||
* @author NAVER (developers@xpressengine.com)
|
* @author NAVER (developers@xpressengine.com)
|
||||||
* @brief board module WAP class
|
* @brief board module WAP class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class boardWAP extends board
|
class boardWAP extends board
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief wap procedure method
|
* @brief wap procedure method
|
||||||
**/
|
**/
|
||||||
function procWAP(&$oMobile)
|
function procWAP(&$oMobile)
|
||||||
{
|
{
|
||||||
// check grant
|
// check grant
|
||||||
if(!$this->grant->list || $this->module_info->consultation == 'Y')
|
if(!$this->grant->list || $this->module_info->consultation == 'Y')
|
||||||
{
|
{
|
||||||
return $oMobile->setContent(lang('msg_not_permitted'));
|
return $oMobile->setContent(lang('msg_not_permitted'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate document model object
|
// generate document model object
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
|
|
||||||
// if the doument is existed
|
// if the doument is existed
|
||||||
$document_srl = Context::get('document_srl');
|
$document_srl = Context::get('document_srl');
|
||||||
if($document_srl)
|
if($document_srl)
|
||||||
{
|
{
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if($oDocument->isExists())
|
if($oDocument->isExists())
|
||||||
{
|
{
|
||||||
// check the grant
|
// check the grant
|
||||||
if(!$this->grant->view)
|
if(!$this->grant->view)
|
||||||
{
|
{
|
||||||
return $oMobile->setContent(lang('msg_not_permitted'));
|
return $oMobile->setContent(lang('msg_not_permitted'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the browser title
|
// setup the browser title
|
||||||
Context::setBrowserTitle($oDocument->getTitleText());
|
Context::setBrowserTitle($oDocument->getTitleText());
|
||||||
|
|
||||||
// if the act is display comment list
|
// if the act is display comment list
|
||||||
if($this->act=='dispBoardContentCommentList')
|
if($this->act=='dispBoardContentCommentList')
|
||||||
{
|
{
|
||||||
|
|
||||||
$oCommentModel = getModel('comment');
|
$oCommentModel = getModel('comment');
|
||||||
$output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
|
$output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
if(count($output->data))
|
if(count($output->data))
|
||||||
{
|
{
|
||||||
foreach($output->data as $key => $val)
|
foreach($output->data as $key => $val)
|
||||||
{
|
{
|
||||||
$oComment = new commentItem();
|
$oComment = new commentItem();
|
||||||
$oComment->setAttribute($val);
|
$oComment->setAttribute($val);
|
||||||
|
|
||||||
if(!$oComment->isAccessible()) continue;
|
if(!$oComment->isAccessible()) continue;
|
||||||
|
|
||||||
$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n";
|
$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup mobile contents
|
// setup mobile contents
|
||||||
$oMobile->setContent( $content );
|
$oMobile->setContent( $content );
|
||||||
|
|
||||||
// setup upper URL
|
// setup upper URL
|
||||||
$oMobile->setUpperUrl( getUrl('act',''), lang('cmd_go_upper') );
|
$oMobile->setUpperUrl( getUrl('act',''), lang('cmd_go_upper') );
|
||||||
|
|
||||||
// display the document if the act is not display the comment list
|
// display the document if the act is not display the comment list
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// setup contents (strip all html tags)
|
// setup contents (strip all html tags)
|
||||||
$content = strip_tags(str_replace('<p>','<br> ',$oDocument->getContent(false,false,false)),'<br><b><i><u><em><small><strong><big>');
|
$content = strip_tags(str_replace('<p>','<br> ',$oDocument->getContent(false,false,false)),'<br><b><i><u><em><small><strong><big>');
|
||||||
|
|
||||||
|
|
||||||
// setup content information(include the comments link)
|
// setup content information(include the comments link)
|
||||||
$content = lang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content;
|
$content = lang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content;
|
||||||
$content = '<b>'.$oDocument->getNickName().'</b> ('.$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content;
|
$content = '<b>'.$oDocument->getNickName().'</b> ('.$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content;
|
||||||
|
|
||||||
// setup mobile contents
|
// setup mobile contents
|
||||||
$oMobile->setContent( $content );
|
$oMobile->setContent( $content );
|
||||||
|
|
||||||
// setup upper URL
|
// setup upper URL
|
||||||
$oMobile->setUpperUrl( getUrl('document_srl',''), lang('cmd_list') );
|
$oMobile->setUpperUrl( getUrl('document_srl',''), lang('cmd_list') );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// board index
|
// board index
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->module_srl = $this->module_srl;
|
$args->module_srl = $this->module_srl;
|
||||||
$args->page = Context::get('page');;
|
$args->page = Context::get('page');;
|
||||||
$args->list_count = 9;
|
$args->list_count = 9;
|
||||||
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
|
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
|
||||||
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
|
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
|
||||||
$output = $oDocumentModel->getDocumentList($args, $this->except_notice);
|
$output = $oDocumentModel->getDocumentList($args, $this->except_notice);
|
||||||
$document_list = $output->data;
|
$document_list = $output->data;
|
||||||
$page_navigation = $output->page_navigation;
|
$page_navigation = $output->page_navigation;
|
||||||
|
|
||||||
$childs = array();
|
$childs = array();
|
||||||
if($document_list && count($document_list))
|
if($document_list && count($document_list))
|
||||||
{
|
{
|
||||||
foreach($document_list as $key => $val)
|
foreach($document_list as $key => $val)
|
||||||
{
|
{
|
||||||
$href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl);
|
$href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl);
|
||||||
$obj = null;
|
$obj = null;
|
||||||
$obj['href'] = $val->getPermanentUrl();
|
$obj['href'] = $val->getPermanentUrl();
|
||||||
|
|
||||||
$title = htmlspecialchars($val->getTitleText());
|
$title = htmlspecialchars($val->getTitleText());
|
||||||
if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';
|
if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';
|
||||||
$obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title;
|
$obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title;
|
||||||
$childs[] = $obj;
|
$childs[] = $obj;
|
||||||
}
|
}
|
||||||
$oMobile->setChilds($childs);
|
$oMobile->setChilds($childs);
|
||||||
}
|
}
|
||||||
|
|
||||||
$totalPage = $page_navigation->last_page;
|
$totalPage = $page_navigation->last_page;
|
||||||
$page = (int)Context::get('page');
|
$page = (int)Context::get('page');
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
|
||||||
// next/prevUrl specification
|
// next/prevUrl specification
|
||||||
if($page > 1)
|
if($page > 1)
|
||||||
{
|
{
|
||||||
$oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', lang('cmd_prev'), $page-1, $totalPage));
|
$oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', lang('cmd_prev'), $page-1, $totalPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($page < $totalPage)
|
if($page < $totalPage)
|
||||||
{
|
{
|
||||||
$oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', lang('cmd_next'), $page+1, $totalPage));
|
$oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', lang('cmd_next'), $page+1, $totalPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMobile->mobilePage = $page;
|
$oMobile->mobilePage = $page;
|
||||||
$oMobile->totalPage = $totalPage;
|
$oMobile->totalPage = $totalPage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ class CommentAdminController extends Comment
|
||||||
|
|
||||||
$deleted_count = 0;
|
$deleted_count = 0;
|
||||||
$module_infos = [];
|
$module_infos = [];
|
||||||
|
|
||||||
// Delete the comment posting
|
// Delete the comment posting
|
||||||
for($i = 0; $i < $comment_count; $i++)
|
for($i = 0; $i < $comment_count; $i++)
|
||||||
{
|
{
|
||||||
|
|
@ -230,13 +230,13 @@ class CommentAdminController extends Comment
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_srl = $comment->get('module_srl');
|
$module_srl = $comment->get('module_srl');
|
||||||
if (!isset($module_infos[$module_srl]))
|
if (!isset($module_infos[$module_srl]))
|
||||||
{
|
{
|
||||||
$module_infos[$module_srl] = ModuleModel::getModuleInfoByModuleSrl($module_srl)->comment_delete_message ?? '';
|
$module_infos[$module_srl] = ModuleModel::getModuleInfoByModuleSrl($module_srl)->comment_delete_message ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($module_infos[$module_srl] === 'yes')
|
if($module_infos[$module_srl] === 'yes')
|
||||||
{
|
{
|
||||||
$output = $oCommentController->updateCommentByDelete($comment, true);
|
$output = $oCommentController->updateCommentByDelete($comment, true);
|
||||||
|
|
@ -257,7 +257,7 @@ class CommentAdminController extends Comment
|
||||||
{
|
{
|
||||||
$output = $oCommentController->deleteComment($comment_srl, true, toBool($isTrash));
|
$output = $oCommentController->deleteComment($comment_srl, true, toBool($isTrash));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$output->toBool() && $output->error !== -2)
|
if(!$output->toBool() && $output->error !== -2)
|
||||||
{
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
|
|
@ -276,7 +276,7 @@ class CommentAdminController extends Comment
|
||||||
|
|
||||||
$deleted_count++;
|
$deleted_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
$msgCode = '';
|
$msgCode = '';
|
||||||
|
|
@ -357,7 +357,7 @@ class CommentAdminController extends Comment
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->comment_srl = $oComment->get('comment_srl');
|
$obj->comment_srl = $oComment->get('comment_srl');
|
||||||
$obj->module_srl = $oComment->get('module_srl');
|
$obj->module_srl = $oComment->get('module_srl');
|
||||||
|
|
@ -482,7 +482,7 @@ class CommentAdminController extends Comment
|
||||||
{
|
{
|
||||||
$originObject = (object) $originObject;
|
$originObject = (object) $originObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCommentController = getController('comment');
|
$oCommentController = getController('comment');
|
||||||
$oCommentModel = getModel('comment');
|
$oCommentModel = getModel('comment');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class CommentAdminView extends Comment
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// get a list by using comment->getCommentList.
|
// get a list by using comment->getCommentList.
|
||||||
$oCommentModel = getModel('comment');
|
$oCommentModel = getModel('comment');
|
||||||
$secretNameList = $oCommentModel->getSecretNameList();
|
$secretNameList = $oCommentModel->getSecretNameList();
|
||||||
$output = $oCommentModel->getTotalCommentList($args);
|
$output = $oCommentModel->getTotalCommentList($args);
|
||||||
|
|
@ -89,7 +89,7 @@ class CommentAdminView extends Comment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::set('module_list', $module_list);
|
Context::set('module_list', $module_list);
|
||||||
|
|
||||||
// Get anonymous nicknames
|
// Get anonymous nicknames
|
||||||
$anonymous_member_srls = array();
|
$anonymous_member_srls = array();
|
||||||
foreach($output->data as $val)
|
foreach($output->data as $val)
|
||||||
|
|
@ -114,11 +114,11 @@ class CommentAdminView extends Comment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::set('member_nick_name', $member_nick_neme);
|
Context::set('member_nick_name', $member_nick_neme);
|
||||||
|
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
$security->encodeHTML('search_target', 'search_keyword');
|
$security->encodeHTML('search_target', 'search_keyword');
|
||||||
|
|
||||||
// set the template
|
// set the template
|
||||||
$this->setTemplatePath($this->module_path . 'tpl');
|
$this->setTemplatePath($this->module_path . 'tpl');
|
||||||
$this->setTemplateFile('comment_list');
|
$this->setTemplateFile('comment_list');
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ class CommentAdminView extends Comment
|
||||||
$args->list_count = 30; // /< the number of comment postings to appear on a single page
|
$args->list_count = 30; // /< the number of comment postings to appear on a single page
|
||||||
$args->page_count = 10; // /< the number of pages to appear on the page navigation
|
$args->page_count = 10; // /< the number of pages to appear on the page navigation
|
||||||
$args->order_type = 'desc'; // /< sorted value
|
$args->order_type = 'desc'; // /< sorted value
|
||||||
|
|
||||||
// select sort method
|
// select sort method
|
||||||
$sort_index = Context::get('sort_index');
|
$sort_index = Context::get('sort_index');
|
||||||
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
||||||
|
|
@ -143,7 +143,7 @@ class CommentAdminView extends Comment
|
||||||
$sort_index = 'declared_latest';
|
$sort_index = 'declared_latest';
|
||||||
}
|
}
|
||||||
Context::set('sort_index', $sort_index);
|
Context::set('sort_index', $sort_index);
|
||||||
|
|
||||||
// get latest declared list
|
// get latest declared list
|
||||||
if ($sort_index === 'declared_latest')
|
if ($sort_index === 'declared_latest')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class Comment extends ModuleObject
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -85,7 +85,7 @@ class Comment extends ModuleObject
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018.01.24 Improve mass file deletion
|
// 2018.01.24 Improve mass file deletion
|
||||||
if(!ModuleModel::getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
if(!ModuleModel::getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
||||||
{
|
{
|
||||||
|
|
@ -95,7 +95,7 @@ class Comment extends ModuleObject
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ class Comment extends ModuleObject
|
||||||
{
|
{
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
|
|
||||||
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
|
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
|
||||||
if(!ModuleModel::getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
|
if(!ModuleModel::getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
|
||||||
{
|
{
|
||||||
|
|
@ -128,7 +128,7 @@ class Comment extends ModuleObject
|
||||||
$oDB->addIndex("comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE);
|
$oDB->addIndex("comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
|
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
|
||||||
|
|
@ -144,13 +144,13 @@ class Comment extends ModuleObject
|
||||||
{
|
{
|
||||||
$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
|
$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2017.12.21 Add an index for nick_name
|
// 2017.12.21 Add an index for nick_name
|
||||||
if(!$oDB->isIndexExists('comments', 'idx_nick_name'))
|
if(!$oDB->isIndexExists('comments', 'idx_nick_name'))
|
||||||
{
|
{
|
||||||
$oDB->addIndex('comments', 'idx_nick_name', array('nick_name'));
|
$oDB->addIndex('comments', 'idx_nick_name', array('nick_name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018.01.24 Improve mass file deletion
|
// 2018.01.24 Improve mass file deletion
|
||||||
if(!ModuleModel::getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
if(!ModuleModel::getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
||||||
{
|
{
|
||||||
|
|
@ -168,7 +168,7 @@ class Comment extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function recompileCache()
|
function recompileCache()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = 1;
|
$point = 1;
|
||||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||||
|
|
||||||
|
|
@ -167,7 +167,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = -1;
|
$point = -1;
|
||||||
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the current user has voted previously.
|
// Check if the current user has voted previously.
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
|
|
@ -243,10 +243,10 @@ class CommentController extends Comment
|
||||||
|
|
||||||
//session reset
|
//session reset
|
||||||
unset($_SESSION['voted_comment'][$comment_srl]);
|
unset($_SESSION['voted_comment'][$comment_srl]);
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('comment.updateVotedCountCancel', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('comment.updateVotedCountCancel', 'after', $trigger_obj);
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -276,7 +276,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if an user select message from options, message would be the option.
|
// if an user select message from options, message would be the option.
|
||||||
$message_option = strval(Context::get('message_option'));
|
$message_option = strval(Context::get('message_option'));
|
||||||
$improper_comment_reasons = lang('improper_comment_reasons');
|
$improper_comment_reasons = lang('improper_comment_reasons');
|
||||||
|
|
@ -460,7 +460,7 @@ class CommentController extends Comment
|
||||||
|
|
||||||
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
||||||
unset($obj->manual_member_info);
|
unset($obj->manual_member_info);
|
||||||
|
|
||||||
// Sanitize variables
|
// Sanitize variables
|
||||||
$obj->comment_srl = intval($obj->comment_srl);
|
$obj->comment_srl = intval($obj->comment_srl);
|
||||||
$obj->module_srl = intval($obj->module_srl);
|
$obj->module_srl = intval($obj->module_srl);
|
||||||
|
|
@ -468,7 +468,7 @@ class CommentController extends Comment
|
||||||
$obj->parent_srl = intval($obj->parent_srl);
|
$obj->parent_srl = intval($obj->parent_srl);
|
||||||
|
|
||||||
$obj->uploaded_count = FileModel::getFilesCount($obj->comment_srl);
|
$obj->uploaded_count = FileModel::getFilesCount($obj->comment_srl);
|
||||||
|
|
||||||
// call a trigger (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
|
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -537,7 +537,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
$obj->comment_srl = getNextSequence();
|
$obj->comment_srl = getNextSequence();
|
||||||
}
|
}
|
||||||
elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl))
|
elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl))
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_not_permitted');
|
return new BaseObject(-1, 'msg_not_permitted');
|
||||||
}
|
}
|
||||||
|
|
@ -553,13 +553,13 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_empty_content');
|
return new BaseObject(-1, 'msg_empty_content');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if use editor of nohtml, Remove HTML tags from the contents.
|
// if use editor of nohtml, Remove HTML tags from the contents.
|
||||||
if(!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
|
if(!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
|
||||||
{
|
{
|
||||||
$obj->content = getModel('editor')->converter($obj, 'comment');
|
$obj->content = getModel('editor')->converter($obj, 'comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$obj->regdate)
|
if(!$obj->regdate)
|
||||||
{
|
{
|
||||||
$obj->regdate = date("YmdHis");
|
$obj->regdate = date("YmdHis");
|
||||||
|
|
@ -659,7 +659,7 @@ class CommentController extends Comment
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the controller object of the document
|
// create the controller object of the document
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
|
|
||||||
|
|
@ -684,7 +684,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
$obj->updated_file_count = 0;
|
$obj->updated_file_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a trigger(after)
|
// call a trigger(after)
|
||||||
ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
||||||
|
|
||||||
|
|
@ -722,8 +722,8 @@ class CommentController extends Comment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send email to module's admins after a new comment was interted successfully
|
* Send email to module's admins after a new comment was interted successfully
|
||||||
* if Comments Approval System is used
|
* if Comments Approval System is used
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function sendEmailToAdminAfterInsertComment($obj)
|
function sendEmailToAdminAfterInsertComment($obj)
|
||||||
|
|
@ -836,7 +836,7 @@ class CommentController extends Comment
|
||||||
|
|
||||||
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
||||||
unset($obj->manual_member_info);
|
unset($obj->manual_member_info);
|
||||||
|
|
||||||
// Sanitize variables
|
// Sanitize variables
|
||||||
$obj->comment_srl = intval($obj->comment_srl);
|
$obj->comment_srl = intval($obj->comment_srl);
|
||||||
$obj->module_srl = intval($obj->module_srl);
|
$obj->module_srl = intval($obj->module_srl);
|
||||||
|
|
@ -844,7 +844,7 @@ class CommentController extends Comment
|
||||||
$obj->parent_srl = intval($obj->parent_srl);
|
$obj->parent_srl = intval($obj->parent_srl);
|
||||||
|
|
||||||
$obj->uploaded_count = FileModel::getFilesCount($obj->comment_srl);
|
$obj->uploaded_count = FileModel::getFilesCount($obj->comment_srl);
|
||||||
|
|
||||||
// call a trigger (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
|
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -874,7 +874,7 @@ class CommentController extends Comment
|
||||||
$obj->password = MemberModel::hashPassword($obj->password);
|
$obj->password = MemberModel::hashPassword($obj->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($obj->homepage)
|
if($obj->homepage)
|
||||||
{
|
{
|
||||||
$obj->homepage = escape($obj->homepage);
|
$obj->homepage = escape($obj->homepage);
|
||||||
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
|
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
|
||||||
|
|
@ -919,13 +919,13 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_empty_content');
|
return new BaseObject(-1, 'msg_empty_content');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if use editor of nohtml, Remove HTML tags from the contents.
|
// if use editor of nohtml, Remove HTML tags from the contents.
|
||||||
if(!$manual_updated || isset($obj->allow_html) || isset($obj->use_html))
|
if(!$manual_updated || isset($obj->allow_html) || isset($obj->use_html))
|
||||||
{
|
{
|
||||||
$obj->content = getModel('editor')->converter($obj, 'comment');
|
$obj->content = getModel('editor')->converter($obj, 'comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove iframe and script if not a top administrator on the session
|
// remove iframe and script if not a top administrator on the session
|
||||||
if($logged_info->is_admin != 'Y')
|
if($logged_info->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -983,7 +983,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_invalid_request');
|
return new BaseObject(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if comment exists and permission is granted
|
// check if comment exists and permission is granted
|
||||||
$comment = CommentModel::getComment($obj->comment_srl);
|
$comment = CommentModel::getComment($obj->comment_srl);
|
||||||
if(!$comment->isExists())
|
if(!$comment->isExists())
|
||||||
|
|
@ -994,7 +994,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_not_permitted');
|
return new BaseObject(-1, 'msg_not_permitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a trigger (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -1017,7 +1017,7 @@ class CommentController extends Comment
|
||||||
// Begin transaction
|
// Begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
$obj->member_srl = 0;
|
$obj->member_srl = 0;
|
||||||
unset($obj->last_update);
|
unset($obj->last_update);
|
||||||
|
|
@ -1109,7 +1109,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
// check if comment already exists
|
// check if comment already exists
|
||||||
$comment = CommentModel::getComment($comment_srl);
|
$comment = CommentModel::getComment($comment_srl);
|
||||||
|
|
||||||
if(!$comment->isExists())
|
if(!$comment->isExists())
|
||||||
{
|
{
|
||||||
return new BaseObject(-2, 'msg_not_founded');
|
return new BaseObject(-2, 'msg_not_founded');
|
||||||
|
|
@ -1231,8 +1231,8 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
$this->_deleteDeclaredComments($args);
|
$this->_deleteDeclaredComments($args);
|
||||||
$this->_deleteVotedComments($args);
|
$this->_deleteVotedComments($args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->upload_target_srl = $comment_srl;
|
$args->upload_target_srl = $comment_srl;
|
||||||
|
|
@ -1268,10 +1268,10 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_not_permitted');
|
return new BaseObject(-1, 'msg_not_permitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$module_info = ModuleModel::getModuleInfo($oComment->get('module_srl'));
|
$module_info = ModuleModel::getModuleInfo($oComment->get('module_srl'));
|
||||||
|
|
||||||
if ($module_info->protect_admin_content_delete !== 'N' && $logged_info->is_admin !== 'Y')
|
if ($module_info->protect_admin_content_delete !== 'N' && $logged_info->is_admin !== 'Y')
|
||||||
{
|
{
|
||||||
$member_info = MemberModel::getMemberInfo($oComment->get('member_srl'));
|
$member_info = MemberModel::getMemberInfo($oComment->get('member_srl'));
|
||||||
|
|
@ -1608,15 +1608,15 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||||
$declare_message = trim(htmlspecialchars($declare_message));
|
$declare_message = trim(htmlspecialchars($declare_message));
|
||||||
|
|
||||||
$trigger_obj = new stdClass();
|
$trigger_obj = new stdClass();
|
||||||
$trigger_obj->comment_srl = $comment_srl;
|
$trigger_obj->comment_srl = $comment_srl;
|
||||||
$trigger_obj->declared_count = $declared_count;
|
$trigger_obj->declared_count = $declared_count;
|
||||||
$trigger_obj->declare_message = $declare_message;
|
$trigger_obj->declare_message = $declare_message;
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj);
|
$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj);
|
||||||
if(!$trigger_output->toBool())
|
if(!$trigger_output->toBool())
|
||||||
|
|
@ -1636,7 +1636,7 @@ class CommentController extends Comment
|
||||||
|
|
||||||
// Get currently logged in user.
|
// Get currently logged in user.
|
||||||
$member_srl = intval($this->user->member_srl);
|
$member_srl = intval($this->user->member_srl);
|
||||||
|
|
||||||
// if the comment author is a member
|
// if the comment author is a member
|
||||||
if($oComment->get('member_srl'))
|
if($oComment->get('member_srl'))
|
||||||
{
|
{
|
||||||
|
|
@ -1665,12 +1665,12 @@ class CommentController extends Comment
|
||||||
$_SESSION['declared_comment'][$comment_srl] = FALSE;
|
$_SESSION['declared_comment'][$comment_srl] = FALSE;
|
||||||
return new BaseObject(-1, 'failed_declared');
|
return new BaseObject(-1, 'failed_declared');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in remaining information for logging.
|
// Fill in remaining information for logging.
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$args->ipaddress = \RX_CLIENT_IP;
|
$args->ipaddress = \RX_CLIENT_IP;
|
||||||
$args->declare_message = $declare_message;
|
$args->declare_message = $declare_message;
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
@ -1757,7 +1757,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'failed_declared_cancel');
|
return new BaseObject(-1, 'failed_declared_cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original document
|
// Get the original document
|
||||||
$oComment = CommentModel::getComment($comment_srl);
|
$oComment = CommentModel::getComment($comment_srl);
|
||||||
|
|
||||||
|
|
@ -1796,7 +1796,7 @@ class CommentController extends Comment
|
||||||
{
|
{
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($declared_count > 1)
|
if ($declared_count > 1)
|
||||||
{
|
{
|
||||||
$output = executeQuery('comment.updateDeclaredCommentCancel', $args);
|
$output = executeQuery('comment.updateDeclaredCommentCancel', $args);
|
||||||
|
|
@ -1810,14 +1810,14 @@ class CommentController extends Comment
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('comment.deleteDeclaredCommentLog', $args);
|
$output = executeQuery('comment.deleteDeclaredCommentLog', $args);
|
||||||
if (!$output->toBool())
|
if (!$output->toBool())
|
||||||
{
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_targets = array();
|
$message_targets = array();
|
||||||
$module_srl = $oComment->get('module_srl');
|
$module_srl = $oComment->get('module_srl');
|
||||||
$comment_config = ModuleModel::getModulePartConfig('comment', $module_srl);
|
$comment_config = ModuleModel::getModulePartConfig('comment', $module_srl);
|
||||||
|
|
@ -1897,19 +1897,19 @@ class CommentController extends Comment
|
||||||
foreach ($target_module_srl as $srl)
|
foreach ($target_module_srl as $srl)
|
||||||
{
|
{
|
||||||
if (!$srl) continue;
|
if (!$srl) continue;
|
||||||
|
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($srl);
|
||||||
if (!$module_info->module_srl)
|
if (!$module_info->module_srl)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_grant = ModuleModel::getGrant($module_info, $logged_info);
|
$module_grant = ModuleModel::getGrant($module_info, $logged_info);
|
||||||
if (!$module_grant->manager)
|
if (!$module_grant->manager)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_srl[] = $srl;
|
$module_srl[] = $srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2019,19 +2019,19 @@ class CommentController extends Comment
|
||||||
|
|
||||||
$this->add('comment_list', $commentList);
|
$this->add('comment_list', $commentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerMoveDocument($obj)
|
function triggerMoveDocument($obj)
|
||||||
{
|
{
|
||||||
executeQuery('comment.updateCommentModule', $obj);
|
executeQuery('comment.updateCommentModule', $obj);
|
||||||
executeQuery('comment.updateCommentListModule', $obj);
|
executeQuery('comment.updateCommentListModule', $obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerAddCopyDocument(&$obj)
|
function triggerAddCopyDocument(&$obj)
|
||||||
{
|
{
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->document_srls = $obj->source->document_srl;
|
$args->document_srls = $obj->source->document_srl;
|
||||||
$comment_list = executeQueryArray('comment.getCommentsByDocumentSrls', $args)->data;
|
$comment_list = executeQueryArray('comment.getCommentsByDocumentSrls', $args)->data;
|
||||||
|
|
||||||
$copied_comments = array();
|
$copied_comments = array();
|
||||||
foreach($comment_list as $comment)
|
foreach($comment_list as $comment)
|
||||||
{
|
{
|
||||||
|
|
@ -2040,24 +2040,24 @@ class CommentController extends Comment
|
||||||
$copy->module_srl = $obj->copied->module_srl;
|
$copy->module_srl = $obj->copied->module_srl;
|
||||||
$copy->document_srl = $obj->copied->document_srl;
|
$copy->document_srl = $obj->copied->document_srl;
|
||||||
$copy->parent_srl = $comment->parent_srl ? $copied_comments[$comment->parent_srl] : 0;
|
$copy->parent_srl = $comment->parent_srl ? $copied_comments[$comment->parent_srl] : 0;
|
||||||
|
|
||||||
// call a trigger (add)
|
// call a trigger (add)
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->source = $comment;
|
$args->source = $comment;
|
||||||
$args->copied = $copy;
|
$args->copied = $copy;
|
||||||
ModuleHandler::triggerCall('comment.copyCommentByDocument', 'add', $args);
|
ModuleHandler::triggerCall('comment.copyCommentByDocument', 'add', $args);
|
||||||
|
|
||||||
// insert a copied comment
|
// insert a copied comment
|
||||||
$this->insertComment($copy, true);
|
$this->insertComment($copy, true);
|
||||||
|
|
||||||
$copied_comments[$comment->comment_srl] = $copy->comment_srl;
|
$copied_comments[$comment->comment_srl] = $copy->comment_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update
|
// update
|
||||||
$obj->copied->last_updater = $copy->nick_name;
|
$obj->copied->last_updater = $copy->nick_name;
|
||||||
$obj->copied->comment_count = count($copied_comments);
|
$obj->copied->comment_count = count($copied_comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerCopyModule(&$obj)
|
function triggerCopyModule(&$obj)
|
||||||
{
|
{
|
||||||
$commentConfig = ModuleModel::getModulePartConfig('comment', $obj->originModuleSrl);
|
$commentConfig = ModuleModel::getModulePartConfig('comment', $obj->originModuleSrl);
|
||||||
|
|
|
||||||
|
|
@ -93,24 +93,24 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return (bool) ($this->comment_srl);
|
return (bool) ($this->comment_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isGranted()
|
function isGranted()
|
||||||
{
|
{
|
||||||
if(!$this->isExists())
|
if(!$this->isExists())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['granted_comment'][$this->comment_srl]))
|
if (isset($_SESSION['granted_comment'][$this->comment_srl]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->grant_cache !== null)
|
if ($this->grant_cache !== null)
|
||||||
{
|
{
|
||||||
return $this->grant_cache;
|
return $this->grant_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if (!$logged_info->member_srl)
|
if (!$logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -124,30 +124,30 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $this->grant_cache = true;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
||||||
if ($grant->manager)
|
if ($grant->manager)
|
||||||
{
|
{
|
||||||
return $this->grant_cache = true;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->grant_cache = false;
|
return $this->grant_cache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrant()
|
function setGrant()
|
||||||
{
|
{
|
||||||
$this->grant_cache = true;
|
$this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrantForSession()
|
function setGrantForSession()
|
||||||
{
|
{
|
||||||
$_SESSION['granted_comment'][$this->comment_srl] = true;
|
$_SESSION['granted_comment'][$this->comment_srl] = true;
|
||||||
$this->setGrant();
|
$this->setGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the status code.
|
* Return the status code.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStatus()
|
public function getStatus()
|
||||||
|
|
@ -170,7 +170,7 @@ class CommentItem extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the status in human-readable text.
|
* Return the status in human-readable text.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStatusText()
|
public function getStatusText()
|
||||||
|
|
@ -193,7 +193,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($strict)
|
if ($strict)
|
||||||
{
|
{
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'));
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||||
|
|
@ -207,34 +207,34 @@ class CommentItem extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
|
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->get('status') == RX_STATUS_PUBLIC && $this->get('is_secret') !== 'Y')
|
if ($this->get('status') == RX_STATUS_PUBLIC && $this->get('is_secret') !== 'Y')
|
||||||
{
|
{
|
||||||
$this->setAccessible();
|
$this->setAccessible();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isGranted())
|
if ($this->isGranted())
|
||||||
{
|
{
|
||||||
$this->setAccessible();
|
$this->setAccessible();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($this->get('document_srl'));
|
$oDocument = DocumentModel::getDocument($this->get('document_srl'));
|
||||||
if ($oDocument->isGranted())
|
if ($oDocument->isGranted())
|
||||||
{
|
{
|
||||||
$this->setAccessible();
|
$this->setAccessible();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAccessible()
|
function setAccessible()
|
||||||
{
|
{
|
||||||
if(Context::getSessionStatus())
|
if(Context::getSessionStatus())
|
||||||
|
|
@ -242,27 +242,27 @@ class CommentItem extends BaseObject
|
||||||
$_SESSION['accessible'][$this->comment_srl] = $this->get('last_update');
|
$_SESSION['accessible'][$this->comment_srl] = $this->get('last_update');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEditable()
|
function isEditable()
|
||||||
{
|
{
|
||||||
return !$this->get('member_srl') || $this->isGranted();
|
return !$this->get('member_srl') || $this->isGranted();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSecret()
|
function isSecret()
|
||||||
{
|
{
|
||||||
return $this->get('status') == RX_STATUS_SECRET || $this->get('is_secret') == 'Y';
|
return $this->get('status') == RX_STATUS_SECRET || $this->get('is_secret') == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDeleted()
|
function isDeleted()
|
||||||
{
|
{
|
||||||
return $this->get('status') == RX_STATUS_DELETED || $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
return $this->get('status') == RX_STATUS_DELETED || $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDeletedByAdmin()
|
function isDeletedByAdmin()
|
||||||
{
|
{
|
||||||
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
function useNotify()
|
function useNotify()
|
||||||
{
|
{
|
||||||
return $this->get('notify_message') == 'Y';
|
return $this->get('notify_message') == 'Y';
|
||||||
|
|
@ -280,7 +280,7 @@ class CommentItem extends BaseObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass if the author is not logged-in user
|
// pass if the author is not logged-in user
|
||||||
if(!$this->get('member_srl'))
|
if(!$this->get('member_srl'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -293,7 +293,7 @@ class CommentItem extends BaseObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get where the comment belongs to
|
// get where the comment belongs to
|
||||||
$oDocument = DocumentModel::getDocument($this->get('document_srl'));
|
$oDocument = DocumentModel::getDocument($this->get('document_srl'));
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
|
@ -422,7 +422,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $_SESSION['declared_comment'][$this->comment_srl];
|
return $_SESSION['declared_comment'][$this->comment_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
if ($logged_info->member_srl)
|
if ($logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -439,7 +439,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $_SESSION['declared_comment'][$this->comment_srl] = $declared_count;
|
return $_SESSION['declared_comment'][$this->comment_srl] = $declared_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,7 +461,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
||||||
if($strlen)
|
if($strlen)
|
||||||
{
|
{
|
||||||
|
|
@ -492,7 +492,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($strlen)
|
if($strlen)
|
||||||
{
|
{
|
||||||
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
||||||
|
|
@ -568,16 +568,16 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
// Remove tags
|
// Remove tags
|
||||||
$content = strip_tags($this->getContent(false, false));
|
$content = strip_tags($this->getContent(false, false));
|
||||||
|
|
||||||
// Convert temporarily html entity for truncate
|
// Convert temporarily html entity for truncate
|
||||||
$content = html_entity_decode($content, ENT_QUOTES);
|
$content = html_entity_decode($content, ENT_QUOTES);
|
||||||
|
|
||||||
// Replace all whitespaces to single space
|
// Replace all whitespaces to single space
|
||||||
$content = utf8_trim(utf8_normalize_spaces($content));
|
$content = utf8_trim(utf8_normalize_spaces($content));
|
||||||
|
|
||||||
// Truncate string
|
// Truncate string
|
||||||
$content = cut_str($content, $str_size, $tail);
|
$content = cut_str($content, $str_size, $tail);
|
||||||
|
|
||||||
return escape($content);
|
return escape($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -633,7 +633,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->get('uploaded_count') ? TRUE : FALSE;
|
return $this->get('uploaded_count') ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -643,12 +643,12 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->get('uploaded_count'))
|
if(!$this->get('uploaded_count'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list = FileModel::getFiles($this->comment_srl, array(), 'file_srl', TRUE);
|
$file_list = FileModel::getFiles($this->comment_srl, array(), 'file_srl', TRUE);
|
||||||
return $file_list;
|
return $file_list;
|
||||||
}
|
}
|
||||||
|
|
@ -755,7 +755,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$config->thumbnail_quality = 75;
|
$config->thumbnail_quality = 75;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If signiture height setting is omitted, create a square
|
// If signiture height setting is omitted, create a square
|
||||||
if(!is_int($width))
|
if(!is_int($width))
|
||||||
{
|
{
|
||||||
|
|
@ -799,7 +799,7 @@ class CommentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// return false if neigher attached file nor image;
|
// return false if neigher attached file nor image;
|
||||||
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content')))
|
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content')))
|
||||||
{
|
{
|
||||||
|
|
@ -846,7 +846,7 @@ class CommentItem extends BaseObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get an image file from the doc content if no file attached.
|
// get an image file from the doc content if no file attached.
|
||||||
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
||||||
{
|
{
|
||||||
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
|
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
|
||||||
|
|
|
||||||
|
|
@ -375,9 +375,9 @@ class CommentModel extends Comment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the module info without duplication
|
* Get the module info without duplication
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getDistinctModules()
|
public static function getDistinctModules()
|
||||||
|
|
@ -573,7 +573,7 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an alternate output is set, use it instead of running the default queries
|
// If an alternate output is set, use it instead of running the default queries
|
||||||
if (isset($args->use_alternate_output) && $args->use_alternate_output instanceof BaseObject)
|
if (isset($args->use_alternate_output) && $args->use_alternate_output instanceof BaseObject)
|
||||||
{
|
{
|
||||||
|
|
@ -587,7 +587,7 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert data into CommentPageList table if the number of results is different from stored comments
|
// insert data into CommentPageList table if the number of results is different from stored comments
|
||||||
if(!$output->data)
|
if(!$output->data)
|
||||||
{
|
{
|
||||||
|
|
@ -605,7 +605,7 @@ class CommentModel extends Comment
|
||||||
ModuleHandler::triggerCall('comment.getCommentList', 'after', $output);
|
ModuleHandler::triggerCall('comment.getCommentList', 'after', $output);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out which page a comment is on
|
* Find out which page a comment is on
|
||||||
* @param int $document_srl
|
* @param int $document_srl
|
||||||
|
|
@ -623,14 +623,14 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return if no comment exists
|
// return if no comment exists
|
||||||
$document_comment_count = $oDocument->getCommentCount();
|
$document_comment_count = $oDocument->getCommentCount();
|
||||||
if($document_comment_count < 1)
|
if($document_comment_count < 1)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the comment count per page
|
// Get the comment count per page
|
||||||
if(!$count)
|
if(!$count)
|
||||||
{
|
{
|
||||||
|
|
@ -642,14 +642,14 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
$comment_count = $count;
|
$comment_count = $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the number of pages
|
// Get the number of pages
|
||||||
$total_pages = max(1, ceil($document_comment_count / $comment_count));
|
$total_pages = max(1, ceil($document_comment_count / $comment_count));
|
||||||
if ($total_pages == 1)
|
if ($total_pages == 1)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find out which page the comment is on
|
// Find out which page the comment is on
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
@ -961,7 +961,7 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an alternate output is set, use it instead of running the default queries
|
// If an alternate output is set, use it instead of running the default queries
|
||||||
if (isset($args->use_alternate_output) && $args->use_alternate_output instanceof BaseObject)
|
if (isset($args->use_alternate_output) && $args->use_alternate_output instanceof BaseObject)
|
||||||
{
|
{
|
||||||
|
|
@ -972,7 +972,7 @@ class CommentModel extends Comment
|
||||||
{
|
{
|
||||||
$output = executeQueryArray($query_id, $args, $columnList);
|
$output = executeQueryArray($query_id, $args, $columnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return when no result or error occurance
|
// return when no result or error occurance
|
||||||
if(!$output->toBool() || !count($output->data))
|
if(!$output->toBool() || !count($output->data))
|
||||||
{
|
{
|
||||||
|
|
@ -1132,7 +1132,7 @@ class CommentModel extends Comment
|
||||||
|
|
||||||
return $comment_config;
|
return $comment_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of voting member
|
* Return a list of voting member
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class DocumentAdminController extends Document
|
||||||
|
|
||||||
$this->setMessage(sprintf(lang('msg_checked_document_is_deleted'), $document_count) );
|
$this->setMessage(sprintf(lang('msg_checked_document_is_deleted'), $document_count) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the default settings of the document module
|
* Save the default settings of the document module
|
||||||
* @return object
|
* @return object
|
||||||
|
|
@ -56,7 +56,7 @@ class DocumentAdminController extends Document
|
||||||
$config->view_count_option = Context::get('view_count_option');
|
$config->view_count_option = Context::get('view_count_option');
|
||||||
$config->icons = Context::get('icons');
|
$config->icons = Context::get('icons');
|
||||||
$config->micons = Context::get('micons');
|
$config->micons = Context::get('micons');
|
||||||
|
|
||||||
// Get icon skin type
|
// Get icon skin type
|
||||||
$config->icons_type = 'gif';
|
$config->icons_type = 'gif';
|
||||||
$config->micons_type = 'gif';
|
$config->micons_type = 'gif';
|
||||||
|
|
@ -364,7 +364,7 @@ class DocumentAdminController extends Document
|
||||||
$oDocumentController->moveDocumentToTrash($args);
|
$oDocumentController->moveDocumentToTrash($args);
|
||||||
|
|
||||||
$returnUrl = Context::get('success_return_url');
|
$returnUrl = Context::get('success_return_url');
|
||||||
if(!$returnUrl)
|
if(!$returnUrl)
|
||||||
{
|
{
|
||||||
$arrUrl = parse_url(Context::get('cur_url'));
|
$arrUrl = parse_url(Context::get('cur_url'));
|
||||||
$query = "";
|
$query = "";
|
||||||
|
|
@ -424,7 +424,7 @@ class DocumentAdminController extends Document
|
||||||
$trash_srl = Context::get('trash_srl');
|
$trash_srl = Context::get('trash_srl');
|
||||||
$this->restoreTrash($trash_srl);
|
$this->restoreTrash($trash_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move module of the documents
|
* Move module of the documents
|
||||||
* @param array $document_srl_list
|
* @param array $document_srl_list
|
||||||
|
|
@ -443,17 +443,17 @@ class DocumentAdminController extends Document
|
||||||
$document_srl_list = array_map('trim', explode(',', $document_srl_list));
|
$document_srl_list = array_map('trim', explode(',', $document_srl_list));
|
||||||
}
|
}
|
||||||
$document_srl_list = array_map('intval', $document_srl_list);
|
$document_srl_list = array_map('intval', $document_srl_list);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->document_srls = $document_srl_list;
|
$obj->document_srls = $document_srl_list;
|
||||||
$obj->list_count = count($document_srl_list);
|
$obj->list_count = count($document_srl_list);
|
||||||
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
||||||
$obj->module_srl = $target_module_srl;
|
$obj->module_srl = $target_module_srl;
|
||||||
$obj->category_srl = $target_category_srl;
|
$obj->category_srl = $target_category_srl;
|
||||||
|
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// call a trigger (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $obj);
|
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -461,10 +461,10 @@ class DocumentAdminController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$origin_category = array();
|
$origin_category = array();
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
|
|
||||||
foreach($obj->document_list as $document)
|
foreach($obj->document_list as $document)
|
||||||
{
|
{
|
||||||
// if the target module is different
|
// if the target module is different
|
||||||
|
|
@ -472,16 +472,16 @@ class DocumentAdminController extends Document
|
||||||
{
|
{
|
||||||
$oDocumentController->deleteDocumentAliasByDocument($document->document_srl);
|
$oDocumentController->deleteDocumentAliasByDocument($document->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the target category is different
|
// if the target category is different
|
||||||
if($document->category_srl != $obj->category_srl && $document->category_srl)
|
if($document->category_srl != $obj->category_srl && $document->category_srl)
|
||||||
{
|
{
|
||||||
$origin_category[$document->category_srl] = $document->module_srl;
|
$origin_category[$document->category_srl] = $document->module_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocumentController->insertDocumentUpdateLog($document);
|
$oDocumentController->insertDocumentUpdateLog($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update documents
|
// update documents
|
||||||
$output = executeQuery('document.updateDocumentsModule', $obj);
|
$output = executeQuery('document.updateDocumentsModule', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -489,7 +489,7 @@ class DocumentAdminController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update extra vars
|
// update extra vars
|
||||||
$output = executeQuery('document.updateDocumentExtraVarsModule', $obj);
|
$output = executeQuery('document.updateDocumentExtraVarsModule', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -497,10 +497,10 @@ class DocumentAdminController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a trigger (after)
|
// call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $obj);
|
ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $obj);
|
||||||
|
|
||||||
// update category count
|
// update category count
|
||||||
foreach($origin_category as $category_srl => $module_srl)
|
foreach($origin_category as $category_srl => $module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -510,15 +510,15 @@ class DocumentAdminController extends Document
|
||||||
{
|
{
|
||||||
$oDocumentController->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
$oDocumentController->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// remove from cache
|
// remove from cache
|
||||||
foreach($obj->document_list as $document)
|
foreach($obj->document_list as $document)
|
||||||
{
|
{
|
||||||
DocumentController::clearDocumentCache($document->document_srl);
|
DocumentController::clearDocumentCache($document->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -540,17 +540,17 @@ class DocumentAdminController extends Document
|
||||||
$document_srl_list = array_map('trim', explode(',', $document_srl_list));
|
$document_srl_list = array_map('trim', explode(',', $document_srl_list));
|
||||||
}
|
}
|
||||||
$document_srl_list = array_map('intval', $document_srl_list);
|
$document_srl_list = array_map('intval', $document_srl_list);
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->document_srls = $document_srl_list;
|
$obj->document_srls = $document_srl_list;
|
||||||
$obj->list_count = count($document_srl_list);
|
$obj->list_count = count($document_srl_list);
|
||||||
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
||||||
$obj->module_srl = $target_module_srl;
|
$obj->module_srl = $target_module_srl;
|
||||||
$obj->category_srl = $target_category_srl;
|
$obj->category_srl = $target_category_srl;
|
||||||
|
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// call a trigger (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $obj);
|
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -558,10 +558,10 @@ class DocumentAdminController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
$extra_vars_list = getModel('document')->getDocumentExtraVarsFromDB($document_srl_list)->data;
|
$extra_vars_list = getModel('document')->getDocumentExtraVarsFromDB($document_srl_list)->data;
|
||||||
|
|
||||||
$extra_vars = array();
|
$extra_vars = array();
|
||||||
foreach($extra_vars_list as $extra)
|
foreach($extra_vars_list as $extra)
|
||||||
{
|
{
|
||||||
|
|
@ -569,10 +569,10 @@ class DocumentAdminController extends Document
|
||||||
{
|
{
|
||||||
$extra_vars[$extra->document_srl] = array();
|
$extra_vars[$extra->document_srl] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_vars[$extra->document_srl][] = $extra;
|
$extra_vars[$extra->document_srl][] = $extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
$copied_srls = array();
|
$copied_srls = array();
|
||||||
foreach($obj->document_list as $document)
|
foreach($obj->document_list as $document)
|
||||||
{
|
{
|
||||||
|
|
@ -583,13 +583,13 @@ class DocumentAdminController extends Document
|
||||||
$copy->comment_count = 0;
|
$copy->comment_count = 0;
|
||||||
$copy->trackback_count = 0;
|
$copy->trackback_count = 0;
|
||||||
$copy->password_is_hashed = true;
|
$copy->password_is_hashed = true;
|
||||||
|
|
||||||
// call a trigger (add)
|
// call a trigger (add)
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->source = $document;
|
$args->source = $document;
|
||||||
$args->copied = $copy;
|
$args->copied = $copy;
|
||||||
ModuleHandler::triggerCall('document.copyDocumentModule', 'add', $args);
|
ModuleHandler::triggerCall('document.copyDocumentModule', 'add', $args);
|
||||||
|
|
||||||
// insert a copied document
|
// insert a copied document
|
||||||
$output = $oDocumentController->insertDocument($copy, true, true);
|
$output = $oDocumentController->insertDocument($copy, true, true);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -597,7 +597,7 @@ class DocumentAdminController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert copied extra vars of the document
|
// insert copied extra vars of the document
|
||||||
if(isset($extra_vars[$document->document_srl]))
|
if(isset($extra_vars[$document->document_srl]))
|
||||||
{
|
{
|
||||||
|
|
@ -606,22 +606,22 @@ class DocumentAdminController extends Document
|
||||||
$oDocumentController->insertDocumentExtraVar($copy->module_srl, $copy->document_srl, $extra->var_idx, $extra->value, $extra->eid, $extra->lang_code);
|
$oDocumentController->insertDocumentExtraVar($copy->module_srl, $copy->document_srl, $extra->var_idx, $extra->value, $extra->eid, $extra->lang_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$copied_srls[$document->document_srl] = $copy->document_srl;
|
$copied_srls[$document->document_srl] = $copy->document_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a trigger (after)
|
// call a trigger (after)
|
||||||
$obj->copied_srls = $copied_srls;
|
$obj->copied_srls = $copied_srls;
|
||||||
ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $obj);
|
ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $obj);
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// return copied document_srls
|
// return copied document_srls
|
||||||
$output = new BaseObject();
|
$output = new BaseObject();
|
||||||
$output->add('copied_srls', $copied_srls);
|
$output->add('copied_srls', $copied_srls);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all documents of the module
|
* Delete all documents of the module
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
|
|
@ -633,23 +633,23 @@ class DocumentAdminController extends Document
|
||||||
$args->list_count = 0;
|
$args->list_count = 0;
|
||||||
$args->module_srl = intval($module_srl);
|
$args->module_srl = intval($module_srl);
|
||||||
$document_list = executeQueryArray('document.getDocumentList', $args, array('document_srl'))->data;
|
$document_list = executeQueryArray('document.getDocumentList', $args, array('document_srl'))->data;
|
||||||
|
|
||||||
// delete documents
|
// delete documents
|
||||||
$output = executeQuery('document.deleteModuleDocument', $args);
|
$output = executeQuery('document.deleteModuleDocument', $args);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove from cache
|
// remove from cache
|
||||||
foreach ($document_list as $document)
|
foreach ($document_list as $document)
|
||||||
{
|
{
|
||||||
DocumentController::clearDocumentCache($document->document_srl);
|
DocumentController::clearDocumentCache($document->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore document from trash module, called by trash module
|
* Restore document from trash module, called by trash module
|
||||||
* This method is passived
|
* This method is passived
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class DocumentAdminView extends Document
|
||||||
$args->page = Context::get('page'); // /< Page
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
||||||
|
|
||||||
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||||
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
||||||
if ($args->search_target === 'member_srl')
|
if ($args->search_target === 'member_srl')
|
||||||
|
|
@ -56,7 +56,7 @@ class DocumentAdminView extends Document
|
||||||
$args->sort_index = 'list_order'; // /< sorting value
|
$args->sort_index = 'list_order'; // /< sorting value
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
$args->statusList = array($this->getConfigStatus('public'), $this->getConfigStatus('secret'), $this->getConfigStatus('temp'));
|
$args->statusList = array($this->getConfigStatus('public'), $this->getConfigStatus('secret'), $this->getConfigStatus('temp'));
|
||||||
|
|
||||||
// get a list
|
// get a list
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$columnList = array('document_srl', 'module_srl', 'category_srl', 'member_srl', 'title', 'nick_name', 'comment_count', 'trackback_count', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
|
$columnList = array('document_srl', 'module_srl', 'category_srl', 'member_srl', 'title', 'nick_name', 'comment_count', 'trackback_count', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
|
||||||
|
|
@ -104,7 +104,7 @@ class DocumentAdminView extends Document
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::set('module_list', $module_list);
|
Context::set('module_list', $module_list);
|
||||||
|
|
||||||
// Get anonymous nicknames
|
// Get anonymous nicknames
|
||||||
$anonymous_member_srls = array();
|
$anonymous_member_srls = array();
|
||||||
$member_nick_name = array();
|
$member_nick_name = array();
|
||||||
|
|
@ -176,7 +176,7 @@ class DocumentAdminView extends Document
|
||||||
$args->list_count = 20; // /< the number of posts to display on a single page
|
$args->list_count = 20; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||||
$args->order_type = strtolower(Context::get('order_type')) === 'asc' ? 'asc' : 'desc';
|
$args->order_type = strtolower(Context::get('order_type')) === 'asc' ? 'asc' : 'desc';
|
||||||
|
|
||||||
// select sort method
|
// select sort method
|
||||||
$sort_index = Context::get('sort_index');
|
$sort_index = Context::get('sort_index');
|
||||||
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
||||||
|
|
@ -184,7 +184,7 @@ class DocumentAdminView extends Document
|
||||||
$sort_index = 'declared_latest';
|
$sort_index = 'declared_latest';
|
||||||
}
|
}
|
||||||
Context::set('sort_index', $sort_index);
|
Context::set('sort_index', $sort_index);
|
||||||
|
|
||||||
// get latest declared list
|
// get latest declared list
|
||||||
if ($sort_index === 'declared_latest')
|
if ($sort_index === 'declared_latest')
|
||||||
{
|
{
|
||||||
|
|
@ -325,7 +325,7 @@ class DocumentAdminView extends Document
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$aliases = $output->data;
|
$aliases = $output->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('aliases', $aliases);
|
Context::set('aliases', $aliases);
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ class Document extends ModuleObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of status texts supported by Rhymix.
|
* List of status texts supported by Rhymix.
|
||||||
*
|
*
|
||||||
* Also see status constants in common/constants.php
|
* Also see status constants in common/constants.php
|
||||||
* and integer status codes used in the comment module.
|
* and integer status codes used in the comment module.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $statusList = array(
|
public static $statusList = array(
|
||||||
|
|
@ -107,10 +107,10 @@ class Document extends ModuleObject
|
||||||
// 2011. 10. 25 status index check
|
// 2011. 10. 25 status index check
|
||||||
if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
|
if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
|
||||||
|
|
||||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||||
|
|
||||||
// 2016. 1. 27: Add a column(declare_message) for report
|
// 2016. 1. 27: Add a column(declare_message) for report
|
||||||
|
|
@ -121,13 +121,13 @@ class Document extends ModuleObject
|
||||||
|
|
||||||
// 2019. 3. 07 #1146
|
// 2019. 3. 07 #1146
|
||||||
if(!$oDB->isColumnExists('document_update_log', 'reason_update')) return true;
|
if(!$oDB->isColumnExists('document_update_log', 'reason_update')) return true;
|
||||||
|
|
||||||
// 2017.12.21 Add an index for nick_name
|
// 2017.12.21 Add an index for nick_name
|
||||||
if(!$oDB->isIndexExists('documents', 'idx_nick_name')) return true;
|
if(!$oDB->isIndexExists('documents', 'idx_nick_name')) return true;
|
||||||
|
|
||||||
// 2018.01.24 Improve mass file deletion
|
// 2018.01.24 Improve mass file deletion
|
||||||
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after')) return true;
|
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after')) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,13 +217,13 @@ class Document extends ModuleObject
|
||||||
$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
|
$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
|
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
|
if(!ModuleModel::getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
|
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
|
||||||
|
|
@ -241,19 +241,19 @@ class Document extends ModuleObject
|
||||||
$oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1);
|
$oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1);
|
||||||
$oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin'));
|
$oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2019. 3. 07 #1146
|
// 2019. 3. 07 #1146
|
||||||
if(!$oDB->isColumnExists('document_update_log', 'reason_update'))
|
if(!$oDB->isColumnExists('document_update_log', 'reason_update'))
|
||||||
{
|
{
|
||||||
$oDB->addColumn('document_update_log', 'reason_update', 'text', '', null, false, 'extra_vars');
|
$oDB->addColumn('document_update_log', 'reason_update', 'text', '', null, false, 'extra_vars');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2017.12.21 Add an index for nick_name
|
// 2017.12.21 Add an index for nick_name
|
||||||
if(!$oDB->isIndexExists('documents', 'idx_nick_name'))
|
if(!$oDB->isIndexExists('documents', 'idx_nick_name'))
|
||||||
{
|
{
|
||||||
$oDB->addIndex('documents', 'idx_nick_name', array('nick_name'));
|
$oDB->addIndex('documents', 'idx_nick_name', array('nick_name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2018.01.24 Improve mass file deletion
|
// 2018.01.24 Improve mass file deletion
|
||||||
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after'))
|
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_info = $this->module_info;
|
$module_info = $this->module_info;
|
||||||
if(!$module_info->module_srl)
|
if(!$module_info->module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -42,7 +42,7 @@ class DocumentController extends Document
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
||||||
if(!$oDocument->isExists())
|
if(!$oDocument->isExists())
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +75,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_info = $this->module_info;
|
$module_info = $this->module_info;
|
||||||
if(!$module_info->module_srl)
|
if(!$module_info->module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -106,7 +106,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = 1;
|
$point = 1;
|
||||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -171,7 +171,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = -1;
|
$point = -1;
|
||||||
$output = $this->updateVotedCount($document_srl, $point);
|
$output = $this->updateVotedCount($document_srl, $point);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -214,7 +214,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = -1;
|
$point = -1;
|
||||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -254,14 +254,14 @@ class DocumentController extends Document
|
||||||
$args->ipaddress = \RX_CLIENT_IP;
|
$args->ipaddress = \RX_CLIENT_IP;
|
||||||
}
|
}
|
||||||
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
|
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
|
||||||
|
|
||||||
if(!$output->data->count)
|
if(!$output->data->count)
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$point = $output->data->point;
|
$point = $output->data->point;
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$trigger_obj = new stdClass;
|
$trigger_obj = new stdClass;
|
||||||
$trigger_obj->member_srl = $oDocument->get('member_srl');
|
$trigger_obj->member_srl = $oDocument->get('member_srl');
|
||||||
|
|
@ -277,11 +277,11 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
if($point != 0)
|
if($point != 0)
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
|
|
@ -306,9 +306,9 @@ class DocumentController extends Document
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.updateVotedCountCancel', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('document.updateVotedCountCancel', 'after', $trigger_obj);
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,7 +403,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($document_srl);
|
$oDocument = DocumentModel::getDocument($document_srl);
|
||||||
if (!$oDocument || !$oDocument->isExists())
|
if (!$oDocument || !$oDocument->isExists())
|
||||||
{
|
{
|
||||||
|
|
@ -413,14 +413,14 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->deleteDocument($document_srl);
|
$output = $this->deleteDocument($document_srl);
|
||||||
if ($output instanceof BaseObject && !$output->toBool())
|
if ($output instanceof BaseObject && !$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete alias when module deleted
|
* Delete alias when module deleted
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
|
|
@ -521,13 +521,13 @@ class DocumentController extends Document
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// List variables
|
// List variables
|
||||||
if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
|
if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
|
||||||
if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
|
if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
|
||||||
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
|
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
|
||||||
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
||||||
if($obj->homepage)
|
if($obj->homepage)
|
||||||
{
|
{
|
||||||
$obj->homepage = escape($obj->homepage);
|
$obj->homepage = escape($obj->homepage);
|
||||||
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
|
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
|
||||||
|
|
@ -535,17 +535,17 @@ class DocumentController extends Document
|
||||||
$obj->homepage = 'http://'.$obj->homepage;
|
$obj->homepage = 'http://'.$obj->homepage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||||
if(!$obj->email_address) $obj->email_address = '';
|
if(!$obj->email_address) $obj->email_address = '';
|
||||||
if(!$isRestore) $obj->ipaddress = \RX_CLIENT_IP;
|
if(!$isRestore) $obj->ipaddress = \RX_CLIENT_IP;
|
||||||
$obj->isRestore = $isRestore ? true : false;
|
$obj->isRestore = $isRestore ? true : false;
|
||||||
|
|
||||||
// Sanitize variables
|
// Sanitize variables
|
||||||
$obj->document_srl = intval($obj->document_srl);
|
$obj->document_srl = intval($obj->document_srl);
|
||||||
$obj->category_srl = intval($obj->category_srl);
|
$obj->category_srl = intval($obj->category_srl);
|
||||||
$obj->module_srl = intval($obj->module_srl);
|
$obj->module_srl = intval($obj->module_srl);
|
||||||
|
|
||||||
// Default Status
|
// Default Status
|
||||||
if($obj->status)
|
if($obj->status)
|
||||||
{
|
{
|
||||||
|
|
@ -558,14 +558,14 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
$this->_checkDocumentStatusForOldVersion($obj);
|
$this->_checkDocumentStatusForOldVersion($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// can modify regdate only manager
|
// can modify regdate only manager
|
||||||
$grant = Context::get('grant');
|
$grant = Context::get('grant');
|
||||||
if(!$grant->manager)
|
if(!$grant->manager)
|
||||||
{
|
{
|
||||||
unset($obj->regdate);
|
unset($obj->regdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
|
// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
|
||||||
if (!isset($obj->extra_vars))
|
if (!isset($obj->extra_vars))
|
||||||
{
|
{
|
||||||
|
|
@ -586,7 +586,7 @@ class DocumentController extends Document
|
||||||
unset($obj->manual_member_info);
|
unset($obj->manual_member_info);
|
||||||
|
|
||||||
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
|
$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -665,7 +665,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
$obj->content = getModel('editor')->converter($obj, 'document');
|
$obj->content = getModel('editor')->converter($obj, 'document');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove iframe and script if not a top adminisrator in the session.
|
// Remove iframe and script if not a top adminisrator in the session.
|
||||||
if($logged_info->is_admin != 'Y')
|
if($logged_info->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -680,7 +680,7 @@ class DocumentController extends Document
|
||||||
$obj->content = utf8_mbencode($obj->content);
|
$obj->content = utf8_mbencode($obj->content);
|
||||||
|
|
||||||
$obj->lang_code = Context::getLangType();
|
$obj->lang_code = Context::getLangType();
|
||||||
|
|
||||||
// Insert data into the DB
|
// Insert data into the DB
|
||||||
$output = executeQuery('document.insertDocument', $obj);
|
$output = executeQuery('document.insertDocument', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -718,10 +718,10 @@ class DocumentController extends Document
|
||||||
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
|
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the category if the category_srl exists.
|
// Update the category if the category_srl exists.
|
||||||
if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
if($obj->update_log_setting === 'Y')
|
if($obj->update_log_setting === 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -741,7 +741,7 @@ class DocumentController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $attachOutput;
|
return $attachOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
||||||
ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
|
ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
|
||||||
|
|
||||||
|
|
@ -772,17 +772,17 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_security_violation');
|
return new BaseObject(-1, 'msg_security_violation');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$source_obj->document_srl || !$obj->document_srl)
|
if(!$source_obj->document_srl || !$obj->document_srl)
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_invalied_request');
|
return new BaseObject(-1, 'msg_invalied_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize variables
|
// Sanitize variables
|
||||||
$obj->document_srl = intval($obj->document_srl);
|
$obj->document_srl = intval($obj->document_srl);
|
||||||
$obj->category_srl = intval($obj->category_srl);
|
$obj->category_srl = intval($obj->category_srl);
|
||||||
$obj->module_srl = intval($obj->module_srl);
|
$obj->module_srl = intval($obj->module_srl);
|
||||||
|
|
||||||
// Default Status
|
// Default Status
|
||||||
if($obj->status)
|
if($obj->status)
|
||||||
{
|
{
|
||||||
|
|
@ -790,7 +790,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
$obj->status = $this->getDefaultStatus();
|
$obj->status = $this->getDefaultStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not update to temp document (point problem)
|
// Do not update to temp document (point problem)
|
||||||
if($obj->status == $this->getConfigStatus('temp'))
|
if($obj->status == $this->getConfigStatus('temp'))
|
||||||
{
|
{
|
||||||
|
|
@ -801,12 +801,12 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
$this->_checkDocumentStatusForOldVersion($obj);
|
$this->_checkDocumentStatusForOldVersion($obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
||||||
unset($obj->manual_member_info);
|
unset($obj->manual_member_info);
|
||||||
|
|
||||||
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
|
$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -817,9 +817,9 @@ class DocumentController extends Document
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
|
if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
|
||||||
|
|
||||||
$document_config = ModuleModel::getModulePartConfig('document', $obj->module_srl);
|
$document_config = ModuleModel::getModulePartConfig('document', $obj->module_srl);
|
||||||
if(!$document_config)
|
if(!$document_config)
|
||||||
{
|
{
|
||||||
|
|
@ -829,7 +829,7 @@ class DocumentController extends Document
|
||||||
$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
|
$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
if($bUseHistory)
|
if($bUseHistory)
|
||||||
{
|
{
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
|
|
@ -861,16 +861,16 @@ class DocumentController extends Document
|
||||||
$obj->homepage = 'http://'.$obj->homepage;
|
$obj->homepage = 'http://'.$obj->homepage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||||
|
|
||||||
// can modify regdate only manager
|
// can modify regdate only manager
|
||||||
$grant = Context::get('grant');
|
$grant = Context::get('grant');
|
||||||
if(!$grant->manager)
|
if(!$grant->manager)
|
||||||
{
|
{
|
||||||
unset($obj->regdate);
|
unset($obj->regdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serialize the $extra_vars
|
// Serialize the $extra_vars
|
||||||
if (isset($obj->extra_vars) && !is_string($obj->extra_vars))
|
if (isset($obj->extra_vars) && !is_string($obj->extra_vars))
|
||||||
{
|
{
|
||||||
|
|
@ -952,7 +952,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
$obj->content = getModel('editor')->converter($obj, 'document');
|
$obj->content = getModel('editor')->converter($obj, 'document');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove iframe and script if not a top adminisrator in the session.
|
// Remove iframe and script if not a top adminisrator in the session.
|
||||||
if($logged_info->is_admin != 'Y')
|
if($logged_info->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -1069,7 +1069,7 @@ class DocumentController extends Document
|
||||||
return $attachOutput;
|
return $attachOutput;
|
||||||
}
|
}
|
||||||
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.updateDocument', 'after', $obj);
|
ModuleHandler::triggerCall('document.updateDocument', 'after', $obj);
|
||||||
|
|
||||||
|
|
@ -1080,7 +1080,7 @@ class DocumentController extends Document
|
||||||
Rhymix\Framework\Storage::deleteDirectory(RX_BASEDIR . sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
|
Rhymix\Framework\Storage::deleteDirectory(RX_BASEDIR . sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
|
||||||
|
|
||||||
$output->add('document_srl',$obj->document_srl);
|
$output->add('document_srl',$obj->document_srl);
|
||||||
|
|
||||||
//remove from cache
|
//remove from cache
|
||||||
self::clearDocumentCache($obj->document_srl);
|
self::clearDocumentCache($obj->document_srl);
|
||||||
return $output;
|
return $output;
|
||||||
|
|
@ -1195,7 +1195,7 @@ class DocumentController extends Document
|
||||||
$trigger_obj = $oDocument->getObjectVars();
|
$trigger_obj = $oDocument->getObjectVars();
|
||||||
$trigger_obj->isEmptyTrash = $isEmptyTrash ? true : false;
|
$trigger_obj->isEmptyTrash = $isEmptyTrash ? true : false;
|
||||||
ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
|
||||||
|
|
||||||
// declared document, log delete
|
// declared document, log delete
|
||||||
$this->_deleteDeclaredDocuments($args);
|
$this->_deleteDeclaredDocuments($args);
|
||||||
$this->_deleteDocumentReadedLog($args);
|
$this->_deleteDocumentReadedLog($args);
|
||||||
|
|
@ -1356,7 +1356,7 @@ class DocumentController extends Document
|
||||||
$args->isvalid = 'N';
|
$args->isvalid = 'N';
|
||||||
executeQuery('file.updateFileValid', $args);
|
executeQuery('file.updateFileValid', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
$obj->module_srl = $oDocument->get('module_srl');
|
$obj->module_srl = $oDocument->get('module_srl');
|
||||||
$obj->member_srl = $oDocument->get('member_srl');
|
$obj->member_srl = $oDocument->get('member_srl');
|
||||||
|
|
@ -1384,7 +1384,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the view count option, and use the default if the value is empty or invalid.
|
// Get the view count option, and use the default if the value is empty or invalid.
|
||||||
$valid_options = array(
|
$valid_options = array(
|
||||||
'all' => true,
|
'all' => true,
|
||||||
|
|
@ -1392,7 +1392,7 @@ class DocumentController extends Document
|
||||||
'once' => true,
|
'once' => true,
|
||||||
'none' => true,
|
'none' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
$config = DocumentModel::getDocumentConfig();
|
$config = DocumentModel::getDocumentConfig();
|
||||||
if (!isset($config->view_count_option) || !isset($valid_options[$config->view_count_option]))
|
if (!isset($config->view_count_option) || !isset($valid_options[$config->view_count_option]))
|
||||||
{
|
{
|
||||||
|
|
@ -1404,12 +1404,12 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get document and user information.
|
// Get document and user information.
|
||||||
$document_srl = $oDocument->document_srl;
|
$document_srl = $oDocument->document_srl;
|
||||||
$member_srl = $oDocument->get('member_srl');
|
$member_srl = $oDocument->get('member_srl');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
// Option 'some': only count once per session.
|
// Option 'some': only count once per session.
|
||||||
if ($config->view_count_option != 'all' && isset($_SESSION['readed_document'][$document_srl]))
|
if ($config->view_count_option != 'all' && isset($_SESSION['readed_document'][$document_srl]))
|
||||||
{
|
{
|
||||||
|
|
@ -1428,7 +1428,7 @@ class DocumentController extends Document
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass if the author's member_srl is the same as the visitor's.
|
// Pass if the author's member_srl is the same as the visitor's.
|
||||||
if($member_srl && $logged_info && $logged_info->member_srl && $logged_info->member_srl == $member_srl)
|
if($member_srl && $logged_info && $logged_info->member_srl && $logged_info->member_srl == $member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -1440,7 +1440,7 @@ class DocumentController extends Document
|
||||||
// Call a trigger when the read count is updated (before)
|
// Call a trigger when the read count is updated (before)
|
||||||
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
|
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
|
||||||
if(!$trigger_output->toBool()) return $trigger_output;
|
if(!$trigger_output->toBool()) return $trigger_output;
|
||||||
|
|
||||||
// Update read counts
|
// Update read counts
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
@ -1453,7 +1453,7 @@ class DocumentController extends Document
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// Register session
|
// Register session
|
||||||
if(!isset($_SESSION['readed_document'][$document_srl]) && Context::getSessionStatus())
|
if(!isset($_SESSION['readed_document'][$document_srl]) && Context::getSessionStatus())
|
||||||
{
|
{
|
||||||
$_SESSION['readed_document'][$document_srl] = true;
|
$_SESSION['readed_document'][$document_srl] = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1577,7 +1577,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_invalid_request');
|
return new BaseObject(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
||||||
{
|
{
|
||||||
if (!$eid)
|
if (!$eid)
|
||||||
|
|
@ -1598,7 +1598,7 @@ class DocumentController extends Document
|
||||||
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->module_srl = $module_srl;
|
$obj->module_srl = $module_srl;
|
||||||
$obj->document_srl = $document_srl;
|
$obj->document_srl = $document_srl;
|
||||||
|
|
@ -1626,7 +1626,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'msg_invalid_request');
|
return new BaseObject(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
||||||
{
|
{
|
||||||
if (!$eid)
|
if (!$eid)
|
||||||
|
|
@ -1647,7 +1647,7 @@ class DocumentController extends Document
|
||||||
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->module_srl = $module_srl;
|
$obj->module_srl = $module_srl;
|
||||||
$obj->document_srl = $document_srl;
|
$obj->document_srl = $document_srl;
|
||||||
|
|
@ -1658,21 +1658,21 @@ class DocumentController extends Document
|
||||||
|
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
$output = self::deleteDocumentExtraVars($module_srl, $document_srl, $idx_or_eid, $lang_code, $eid);
|
$output = self::deleteDocumentExtraVars($module_srl, $document_srl, $idx_or_eid, $lang_code, $eid);
|
||||||
if (!$output->toBool())
|
if (!$output->toBool())
|
||||||
{
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = self::insertDocumentExtraVar($module_srl, $document_srl, $idx_or_eid, $value, $eid, $lang_code);
|
$output = self::insertDocumentExtraVar($module_srl, $document_srl, $idx_or_eid, $value, $eid, $lang_code);
|
||||||
if (!$output->toBool())
|
if (!$output->toBool())
|
||||||
{
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -1782,7 +1782,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
@ -1806,7 +1806,7 @@ class DocumentController extends Document
|
||||||
|
|
||||||
// Leave in the session information
|
// Leave in the session information
|
||||||
$_SESSION['voted_document'][$document_srl] = $trigger_obj->point;
|
$_SESSION['voted_document'][$document_srl] = $trigger_obj->point;
|
||||||
|
|
||||||
// Leave logs
|
// Leave logs
|
||||||
$args->point = $trigger_obj->point;
|
$args->point = $trigger_obj->point;
|
||||||
$output = executeQuery('document.insertDocumentVotedLog', $args);
|
$output = executeQuery('document.insertDocumentVotedLog', $args);
|
||||||
|
|
@ -1815,7 +1815,7 @@ class DocumentController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj);
|
ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj);
|
||||||
|
|
||||||
|
|
@ -1836,7 +1836,7 @@ class DocumentController extends Document
|
||||||
$output->setMessage('success_blamed');
|
$output->setMessage('success_blamed');
|
||||||
$output->add('blamed_count', $trigger_obj->after_point);
|
$output->add('blamed_count', $trigger_obj->after_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1862,10 +1862,10 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||||
$declare_message = trim(htmlspecialchars($declare_message));
|
$declare_message = trim(htmlspecialchars($declare_message));
|
||||||
|
|
||||||
$trigger_obj = new stdClass();
|
$trigger_obj = new stdClass();
|
||||||
$trigger_obj->document_srl = $document_srl;
|
$trigger_obj->document_srl = $document_srl;
|
||||||
$trigger_obj->declared_count = $declared_count;
|
$trigger_obj->declared_count = $declared_count;
|
||||||
|
|
@ -1890,7 +1890,7 @@ class DocumentController extends Document
|
||||||
|
|
||||||
// Get currently logged in user.
|
// Get currently logged in user.
|
||||||
$member_srl = $this->user->member_srl;
|
$member_srl = $this->user->member_srl;
|
||||||
|
|
||||||
// Check if document's author is a member.
|
// Check if document's author is a member.
|
||||||
if($oDocument->get('member_srl'))
|
if($oDocument->get('member_srl'))
|
||||||
{
|
{
|
||||||
|
|
@ -1919,12 +1919,12 @@ class DocumentController extends Document
|
||||||
$_SESSION['declared_document'][$document_srl] = false;
|
$_SESSION['declared_document'][$document_srl] = false;
|
||||||
return new BaseObject(-1, 'failed_declared');
|
return new BaseObject(-1, 'failed_declared');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in remaining information for logging.
|
// Fill in remaining information for logging.
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$args->ipaddress = \RX_CLIENT_IP;
|
$args->ipaddress = \RX_CLIENT_IP;
|
||||||
$args->declare_message = $declare_message;
|
$args->declare_message = $declare_message;
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
@ -1954,7 +1954,7 @@ class DocumentController extends Document
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->add('declared_count', $declared_count + 1);
|
$this->add('declared_count', $declared_count + 1);
|
||||||
|
|
||||||
// Send message to admin
|
// Send message to admin
|
||||||
$message_targets = array();
|
$message_targets = array();
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
|
|
@ -2011,7 +2011,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return new BaseObject(-1, 'failed_declared_cancel');
|
return new BaseObject(-1, 'failed_declared_cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original document
|
// Get the original document
|
||||||
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
||||||
|
|
||||||
|
|
@ -2034,7 +2034,7 @@ class DocumentController extends Document
|
||||||
unset($_SESSION['declared_document'][$document_srl]);
|
unset($_SESSION['declared_document'][$document_srl]);
|
||||||
return new BaseObject(-1, 'failed_declared_cancel');
|
return new BaseObject(-1, 'failed_declared_cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current declared count
|
// Get current declared count
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
@ -2050,7 +2050,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($declared_count > 1)
|
if($declared_count > 1)
|
||||||
{
|
{
|
||||||
$output = executeQuery('document.updateDeclaredDocumentCancel', $args);
|
$output = executeQuery('document.updateDeclaredDocumentCancel', $args);
|
||||||
|
|
@ -2064,14 +2064,14 @@ class DocumentController extends Document
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('document.deleteDeclaredDocumentLog', $args);
|
$output = executeQuery('document.deleteDeclaredDocumentLog', $args);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_targets = array();
|
$message_targets = array();
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
$document_config = ModuleModel::getModulePartConfig('document', $module_srl);
|
$document_config = ModuleModel::getModulePartConfig('document', $module_srl);
|
||||||
|
|
@ -2101,7 +2101,7 @@ class DocumentController extends Document
|
||||||
$oCommunicationController->sendMessage($this->user->member_srl, $target_member_srl, $message_title, $message_content, false. null, false);
|
$oCommunicationController->sendMessage($this->user->member_srl, $target_member_srl, $message_title, $message_content, false. null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
$trigger_obj->declared_count = $declared_count - 1;
|
$trigger_obj->declared_count = $declared_count - 1;
|
||||||
|
|
@ -2258,7 +2258,7 @@ class DocumentController extends Document
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
$this->makeCategoryFile($category_info->module_srl);
|
$this->makeCategoryFile($category_info->module_srl);
|
||||||
|
|
||||||
// remove cache
|
// remove cache
|
||||||
$page = 0;
|
$page = 0;
|
||||||
while(true)
|
while(true)
|
||||||
|
|
@ -3022,7 +3022,7 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->type = Context::get('type');
|
$obj->type = Context::get('type');
|
||||||
$obj->document_list = array();
|
$obj->document_list = array();
|
||||||
|
|
@ -3032,7 +3032,7 @@ class DocumentController extends Document
|
||||||
$obj->manager_message = Context::get('message_content') ? nl2br(escape(strip_tags(Context::get('message_content')))) : '';
|
$obj->manager_message = Context::get('message_content') ? nl2br(escape(strip_tags(Context::get('message_content')))) : '';
|
||||||
$obj->send_message = $obj->manager_message || Context::get('send_default_message') == 'Y';
|
$obj->send_message = $obj->manager_message || Context::get('send_default_message') == 'Y';
|
||||||
$obj->return_message = '';
|
$obj->return_message = '';
|
||||||
|
|
||||||
// Check permission of target module
|
// Check permission of target module
|
||||||
if($obj->target_module_srl)
|
if($obj->target_module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -3047,7 +3047,7 @@ class DocumentController extends Document
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Cart
|
// Set Cart
|
||||||
$cart = Context::get('cart');
|
$cart = Context::get('cart');
|
||||||
if(!is_array($cart))
|
if(!is_array($cart))
|
||||||
|
|
@ -3055,21 +3055,21 @@ class DocumentController extends Document
|
||||||
$cart = explode('|@|', $cart);
|
$cart = explode('|@|', $cart);
|
||||||
}
|
}
|
||||||
$obj->document_srl_list = array_unique(array_map('intval', $cart));
|
$obj->document_srl_list = array_unique(array_map('intval', $cart));
|
||||||
|
|
||||||
// Set document list
|
// Set document list
|
||||||
$obj->document_list = DocumentModel::getDocuments($obj->document_srl_list, false, false);
|
$obj->document_list = DocumentModel::getDocuments($obj->document_srl_list, false, false);
|
||||||
if(empty($obj->document_list))
|
if(empty($obj->document_list))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('document.manage', 'before', $obj);
|
$output = ModuleHandler::triggerCall('document.manage', 'before', $obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oController = getAdminController('document');
|
$oController = getAdminController('document');
|
||||||
if($obj->type == 'move')
|
if($obj->type == 'move')
|
||||||
{
|
{
|
||||||
|
|
@ -3077,13 +3077,13 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $oController->moveDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
$output = $oController->moveDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->return_message = 'success_moved';
|
$obj->return_message = 'success_moved';
|
||||||
}
|
}
|
||||||
else if($obj->type == 'copy')
|
else if($obj->type == 'copy')
|
||||||
|
|
@ -3092,13 +3092,13 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $oController->copyDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
$output = $oController->copyDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->return_message = 'success_copied';
|
$obj->return_message = 'success_copied';
|
||||||
}
|
}
|
||||||
else if($obj->type == 'delete')
|
else if($obj->type == 'delete')
|
||||||
|
|
@ -3112,14 +3112,14 @@ class DocumentController extends Document
|
||||||
$obj->return_message = $output->getMessage();
|
$obj->return_message = $output->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->return_message = $obj->return_message ?: 'success_deleted';
|
$obj->return_message = $obj->return_message ?: 'success_deleted';
|
||||||
}
|
}
|
||||||
else if($obj->type == 'trash')
|
else if($obj->type == 'trash')
|
||||||
{
|
{
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->description = $obj->manager_message;
|
$args->description = $obj->manager_message;
|
||||||
|
|
||||||
foreach ($obj->document_list as $document_srl => $oDocument)
|
foreach ($obj->document_list as $document_srl => $oDocument)
|
||||||
{
|
{
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
@ -3130,7 +3130,7 @@ class DocumentController extends Document
|
||||||
$obj->return_message = $output->getMessage();
|
$obj->return_message = $output->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->return_message = $obj->return_message ?: 'success_trashed';
|
$obj->return_message = $obj->return_message ?: 'success_trashed';
|
||||||
}
|
}
|
||||||
else if($obj->type == 'cancelDeclare')
|
else if($obj->type == 'cancelDeclare')
|
||||||
|
|
@ -3142,17 +3142,17 @@ class DocumentController extends Document
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->return_message = 'success_declare_canceled';
|
$obj->return_message = 'success_declare_canceled';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('document.manage', 'after', $obj);
|
ModuleHandler::triggerCall('document.manage', 'after', $obj);
|
||||||
|
|
||||||
// Send a message
|
// Send a message
|
||||||
$actions = lang('default_message_verbs');
|
$actions = lang('default_message_verbs');
|
||||||
if(isset($actions[$obj->type]) && $obj->send_message)
|
if(isset($actions[$obj->type]) && $obj->send_message)
|
||||||
|
|
@ -3166,7 +3166,7 @@ class DocumentController extends Document
|
||||||
<ul>%1\$s</ul>
|
<ul>%1\$s</ul>
|
||||||
Content;
|
Content;
|
||||||
$document_item = '<li><a href="%1$s">%2$s</a></li>';
|
$document_item = '<li><a href="%1$s">%2$s</a></li>';
|
||||||
|
|
||||||
// Set recipient
|
// Set recipient
|
||||||
$recipients = array();
|
$recipients = array();
|
||||||
foreach ($obj->document_list as $document_srl => $oDocument)
|
foreach ($obj->document_list as $document_srl => $oDocument)
|
||||||
|
|
@ -3175,15 +3175,15 @@ Content;
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($recipients[$member_srl]))
|
if(!isset($recipients[$member_srl]))
|
||||||
{
|
{
|
||||||
$recipients[$member_srl] = array();
|
$recipients[$member_srl] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$recipients[$member_srl][] = sprintf($document_item, $oDocument->getPermanentUrl(), $oDocument->getTitleText());
|
$recipients[$member_srl][] = sprintf($document_item, $oDocument->getPermanentUrl(), $oDocument->getTitleText());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
$oCommunicationController = getController('communication');
|
$oCommunicationController = getController('communication');
|
||||||
foreach ($recipients as $member_srl => $items)
|
foreach ($recipients as $member_srl => $items)
|
||||||
|
|
@ -3191,9 +3191,9 @@ Content;
|
||||||
$oCommunicationController->sendMessage($this->user->member_srl, $member_srl, $title, sprintf($content, implode('', $items)), true, null, false);
|
$oCommunicationController->sendMessage($this->user->member_srl, $member_srl, $title, sprintf($content, implode('', $items)), true, null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['document_management'] = array();
|
$_SESSION['document_management'] = array();
|
||||||
|
|
||||||
$this->setMessage($obj->return_message);
|
$this->setMessage($obj->return_message);
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList'));
|
||||||
}
|
}
|
||||||
|
|
@ -3211,19 +3211,19 @@ Content;
|
||||||
foreach ($target_module_srl as $srl)
|
foreach ($target_module_srl as $srl)
|
||||||
{
|
{
|
||||||
if (!$srl) continue;
|
if (!$srl) continue;
|
||||||
|
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($srl);
|
||||||
if (!$module_info->module_srl)
|
if (!$module_info->module_srl)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_grant = ModuleModel::getGrant($module_info, $logged_info);
|
$module_grant = ModuleModel::getGrant($module_info, $logged_info);
|
||||||
if (!$module_grant->manager)
|
if (!$module_grant->manager)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_srl[] = $srl;
|
$module_srl[] = $srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3246,7 +3246,7 @@ Content;
|
||||||
{
|
{
|
||||||
$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
|
$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setError(-1);
|
$this->setError(-1);
|
||||||
$this->setMessage('success_updated', 'info');
|
$this->setMessage('success_updated', 'info');
|
||||||
|
|
||||||
|
|
@ -3264,11 +3264,11 @@ Content;
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = Context::getRequestVars();
|
$obj = Context::getRequestVars();
|
||||||
$obj->module_srl = $this->module_srl;
|
$obj->module_srl = $this->module_srl;
|
||||||
$obj->status = $this->getConfigStatus('temp');
|
$obj->status = $this->getConfigStatus('temp');
|
||||||
|
|
||||||
// unset document style if not manager
|
// unset document style if not manager
|
||||||
if(!$this->grant->manager)
|
if(!$this->grant->manager)
|
||||||
{
|
{
|
||||||
|
|
@ -3276,9 +3276,9 @@ Content;
|
||||||
unset($obj->title_color);
|
unset($obj->title_color);
|
||||||
unset($obj->title_bold);
|
unset($obj->title_bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
||||||
|
|
||||||
// Update if already exists
|
// Update if already exists
|
||||||
if($oDocument->isExists())
|
if($oDocument->isExists())
|
||||||
{
|
{
|
||||||
|
|
@ -3286,22 +3286,22 @@ Content;
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($oDocument->get('status') != $this->getConfigStatus('temp'))
|
if($oDocument->get('status') != $this->getConfigStatus('temp'))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->updateDocument($oDocument, $obj);
|
$output = $this->updateDocument($oDocument, $obj);
|
||||||
}
|
}
|
||||||
// Otherwise, get a new
|
// Otherwise, get a new
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$output = $this->insertDocument($obj);
|
$output = $this->insertDocument($obj);
|
||||||
|
|
||||||
$oDocument = DocumentModel::getDocument($output->get('document_srl'));
|
$oDocument = DocumentModel::getDocument($output->get('document_srl'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the attachment to be invalid state
|
// Set the attachment to be invalid state
|
||||||
if($oDocument->hasUploadedFiles())
|
if($oDocument->hasUploadedFiles())
|
||||||
{
|
{
|
||||||
|
|
@ -3310,7 +3310,7 @@ Content;
|
||||||
$args->upload_target_srl = $oDocument->document_srl;
|
$args->upload_target_srl = $oDocument->document_srl;
|
||||||
executeQuery('file.updateFileValid', $args);
|
executeQuery('file.updateFileValid', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_saved');
|
$this->setMessage('success_saved');
|
||||||
$this->add('document_srl', $output->get('document_srl'));
|
$this->add('document_srl', $output->get('document_srl'));
|
||||||
}
|
}
|
||||||
|
|
@ -3325,7 +3325,7 @@ Content;
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentSrls = Context::get('document_srls');
|
$documentSrls = Context::get('document_srls');
|
||||||
if($documentSrls) $documentSrlList = explode(',', $documentSrls);
|
if($documentSrls) $documentSrlList = explode(',', $documentSrls);
|
||||||
|
|
||||||
|
|
@ -3346,7 +3346,7 @@ Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear document cache
|
* Clear document cache
|
||||||
*
|
*
|
||||||
* @param int $document_srl
|
* @param int $document_srl
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*/
|
*/
|
||||||
|
|
@ -3365,7 +3365,7 @@ Content;
|
||||||
unset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]);
|
unset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For old version, comment allow status check.
|
* For old version, comment allow status check.
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
|
|
@ -3399,35 +3399,35 @@ Content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateUploaedCount($document_srl_list)
|
public function updateUploaedCount($document_srl_list)
|
||||||
{
|
{
|
||||||
if(!is_array($document_srl_list))
|
if(!is_array($document_srl_list))
|
||||||
{
|
{
|
||||||
$document_srl_list = array($document_srl_list);
|
$document_srl_list = array($document_srl_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($document_srl_list))
|
if(empty($document_srl_list))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$document_srl_list = array_unique($document_srl_list);
|
$document_srl_list = array_unique($document_srl_list);
|
||||||
|
|
||||||
foreach($document_srl_list as $document_srl)
|
foreach($document_srl_list as $document_srl)
|
||||||
{
|
{
|
||||||
if(!$document_srl = (int) $document_srl)
|
if(!$document_srl = (int) $document_srl)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
$args->uploaded_count = FileModel::getFilesCount($document_srl);
|
$args->uploaded_count = FileModel::getFilesCount($document_srl);
|
||||||
executeQuery('document.updateUploadedCount', $args);
|
executeQuery('document.updateUploadedCount', $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerAfterDeleteFile($file)
|
function triggerAfterDeleteFile($file)
|
||||||
{
|
{
|
||||||
$oDocument = DocumentModel::getDocument($file->upload_target_srl, false, false);
|
$oDocument = DocumentModel::getDocument($file->upload_target_srl, false, false);
|
||||||
|
|
@ -3435,10 +3435,10 @@ Content;
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->updateUploaedCount($file->upload_target_srl);
|
$this->updateUploaedCount($file->upload_target_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy extra keys when module copied
|
* Copy extra keys when module copied
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
|
|
|
||||||
|
|
@ -92,11 +92,11 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$document_item = false;
|
$document_item = false;
|
||||||
$columnList = array();
|
$columnList = array();
|
||||||
$reload_counts = true;
|
$reload_counts = true;
|
||||||
|
|
||||||
if ($this->columnList === false)
|
if ($this->columnList === false)
|
||||||
{
|
{
|
||||||
$reload_counts = false;
|
$reload_counts = false;
|
||||||
|
|
@ -145,7 +145,7 @@ class DocumentItem extends BaseObject
|
||||||
$this->document_srl = null;
|
$this->document_srl = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->document_srl = $attribute->document_srl;
|
$this->document_srl = $attribute->document_srl;
|
||||||
$this->lang_code = $attribute->lang_code ?? null;
|
$this->lang_code = $attribute->lang_code ?? null;
|
||||||
$this->adds($attribute);
|
$this->adds($attribute);
|
||||||
|
|
@ -154,22 +154,22 @@ class DocumentItem extends BaseObject
|
||||||
$this->add('apparent_module_srl', $attribute->module_srl);
|
$this->add('apparent_module_srl', $attribute->module_srl);
|
||||||
$this->add('origin_module_srl', $attribute->module_srl);
|
$this->add('origin_module_srl', $attribute->module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set XE_DOCUMENT_LIST
|
// set XE_DOCUMENT_LIST
|
||||||
$GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl] = $this;
|
$GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl] = $this;
|
||||||
|
|
||||||
// set tags
|
// set tags
|
||||||
if($this->get('tags'))
|
if($this->get('tags'))
|
||||||
{
|
{
|
||||||
$this->add('tag_list', $this->getTags());
|
$this->add('tag_list', $this->getTags());
|
||||||
}
|
}
|
||||||
|
|
||||||
// set extra vars
|
// set extra vars
|
||||||
if($load_extra_vars)
|
if($load_extra_vars)
|
||||||
{
|
{
|
||||||
DocumentModel::setToAllDocumentExtraVars();
|
DocumentModel::setToAllDocumentExtraVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set content in user language
|
// set content in user language
|
||||||
if(isset($GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['title']))
|
if(isset($GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['title']))
|
||||||
{
|
{
|
||||||
|
|
@ -185,24 +185,24 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return (bool) ($this->document_srl);
|
return (bool) ($this->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isGranted()
|
function isGranted()
|
||||||
{
|
{
|
||||||
if(!$this->isExists())
|
if(!$this->isExists())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['granted_document'][$this->document_srl]))
|
if (isset($_SESSION['granted_document'][$this->document_srl]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->grant_cache !== null)
|
if ($this->grant_cache !== null)
|
||||||
{
|
{
|
||||||
return $this->grant_cache;
|
return $this->grant_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if (!$logged_info || !$logged_info->member_srl)
|
if (!$logged_info || !$logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -216,34 +216,34 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $this->grant_cache = true;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
||||||
if ($grant->manager)
|
if ($grant->manager)
|
||||||
{
|
{
|
||||||
return $this->grant_cache = true;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->grant_cache = false;
|
return $this->grant_cache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrant()
|
function setGrant()
|
||||||
{
|
{
|
||||||
$this->grant_cache = true;
|
$this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrantForSession()
|
function setGrantForSession()
|
||||||
{
|
{
|
||||||
$_SESSION['granted_document'][$this->document_srl] = true;
|
$_SESSION['granted_document'][$this->document_srl] = true;
|
||||||
$this->setGrant();
|
$this->setGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAccessible($strict = false)
|
function isAccessible($strict = false)
|
||||||
{
|
{
|
||||||
if(!$this->isExists())
|
if(!$this->isExists())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($strict)
|
if ($strict)
|
||||||
{
|
{
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'));
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||||
|
|
@ -257,28 +257,28 @@ class DocumentItem extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['accessible'][$this->document_srl]) && $_SESSION['accessible'][$this->document_srl] === $this->get('last_update'))
|
if (isset($_SESSION['accessible'][$this->document_srl]) && $_SESSION['accessible'][$this->document_srl] === $this->get('last_update'))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_list = DocumentModel::getStatusList();
|
$status_list = DocumentModel::getStatusList();
|
||||||
if ($this->get('status') === $status_list['public'])
|
if ($this->get('status') === $status_list['public'])
|
||||||
{
|
{
|
||||||
$this->setAccessible();
|
$this->setAccessible();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isGranted())
|
if ($this->isGranted())
|
||||||
{
|
{
|
||||||
$this->setAccessible();
|
$this->setAccessible();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAccessible()
|
function setAccessible()
|
||||||
{
|
{
|
||||||
if(Context::getSessionStatus())
|
if(Context::getSessionStatus())
|
||||||
|
|
@ -286,7 +286,7 @@ class DocumentItem extends BaseObject
|
||||||
$_SESSION['accessible'][$this->document_srl] = $this->get('last_update');
|
$_SESSION['accessible'][$this->document_srl] = $this->get('last_update');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowComment()
|
function allowComment()
|
||||||
{
|
{
|
||||||
// init write, document is not exists. so allow comment status is true
|
// init write, document is not exists. so allow comment status is true
|
||||||
|
|
@ -294,7 +294,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool) ($this->get('comment_status') == 'ALLOW');
|
return (bool) ($this->get('comment_status') == 'ALLOW');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,7 +303,7 @@ class DocumentItem extends BaseObject
|
||||||
static $allow_trackback_status = null;
|
static $allow_trackback_status = null;
|
||||||
if(is_null($allow_trackback_status))
|
if(is_null($allow_trackback_status))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Check the tarckback module exist
|
// Check the tarckback module exist
|
||||||
if(!getClass('trackback'))
|
if(!getClass('trackback'))
|
||||||
{
|
{
|
||||||
|
|
@ -313,12 +313,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
|
// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
|
||||||
$trackback_config = ModuleModel::getModuleConfig('trackback');
|
$trackback_config = ModuleModel::getModuleConfig('trackback');
|
||||||
|
|
||||||
if(!$trackback_config)
|
if(!$trackback_config)
|
||||||
{
|
{
|
||||||
$trackback_config = new stdClass();
|
$trackback_config = new stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
|
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
|
||||||
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
|
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
|
||||||
else
|
else
|
||||||
|
|
@ -340,7 +340,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool) ($this->get('comment_status') != 'ALLOW');
|
return (bool) ($this->get('comment_status') != 'ALLOW');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,29 +348,29 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return (bool) (!$this->get('member_srl') || $this->isGranted());
|
return (bool) (!$this->get('member_srl') || $this->isGranted());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSecret()
|
function isSecret()
|
||||||
{
|
{
|
||||||
return (bool) ($this->get('status') == DocumentModel::getConfigStatus('secret'));
|
return (bool) ($this->get('status') == DocumentModel::getConfigStatus('secret'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNotice()
|
function isNotice()
|
||||||
{
|
{
|
||||||
return (bool) ($this->get('is_notice') === 'Y' || $this->get('is_notice') === 'A');
|
return (bool) ($this->get('is_notice') === 'Y' || $this->get('is_notice') === 'A');
|
||||||
}
|
}
|
||||||
|
|
||||||
function useNotify()
|
function useNotify()
|
||||||
{
|
{
|
||||||
return (bool) ($this->get('notify_message') == 'Y');
|
return (bool) ($this->get('notify_message') == 'Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
function doCart()
|
function doCart()
|
||||||
{
|
{
|
||||||
if(!$this->isExists())
|
if(!$this->isExists())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->isCarted() ? $this->removeCart() : $this->addCart();
|
$this->isCarted() ? $this->removeCart() : $this->addCart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,18 +411,18 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return if the currently logged-in user is an author
|
// Return if the currently logged-in user is an author
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->member_srl == $this->get('member_srl'))
|
if($logged_info->member_srl == $this->get('member_srl'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List variables
|
// List variables
|
||||||
$title = ($type ? sprintf('[%s] ', $type) : '') . cut_str(strip_tags($content), 10, '...');
|
$title = ($type ? sprintf('[%s] ', $type) : '') . cut_str(strip_tags($content), 10, '...');
|
||||||
$content = sprintf('%s<br><br>from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
|
$content = sprintf('%s<br><br>from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
|
||||||
|
|
||||||
// Send a message
|
// Send a message
|
||||||
$sender_member_srl = $logged_info->member_srl ?: $this->get('member_srl');
|
$sender_member_srl = $logged_info->member_srl ?: $this->get('member_srl');
|
||||||
getController('communication')->sendMessage($sender_member_srl, $this->get('member_srl'), $title, $content, false, null, false);
|
getController('communication')->sendMessage($sender_member_srl, $this->get('member_srl'), $title, $content, false, null, false);
|
||||||
|
|
@ -439,7 +439,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $this->get('ipaddress');
|
return $this->get('ipaddress');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '*' . strstr($this->get('ipaddress') ?? '', '.');
|
return '*' . strstr($this->get('ipaddress') ?? '', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -454,12 +454,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!preg_match('@^[a-z]+://@i', $url))
|
if(!preg_match('@^[a-z]+://@i', $url))
|
||||||
{
|
{
|
||||||
$url = 'http://' . $url;
|
$url = 'http://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return escape($url, false);
|
return escape($url, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -494,7 +494,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cut_size ? cut_str($this->get('title'), $cut_size, $tail) : $this->get('title');
|
return $cut_size ? cut_str($this->get('title'), $cut_size, $tail) : $this->get('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -514,7 +514,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $_SESSION['voted_document'][$this->document_srl];
|
return $_SESSION['voted_document'][$this->document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info->member_srl)
|
if(!$logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -554,7 +554,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info->member_srl)
|
if(!$logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -565,7 +565,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $_SESSION['declared_document'][$this->document_srl];
|
return $_SESSION['declared_document'][$this->document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
if($logged_info->member_srl)
|
if($logged_info->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -582,7 +582,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
|
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -592,10 +592,10 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = escape($this->getTitleText($cut_size, $tail), false);
|
$title = escape($this->getTitleText($cut_size, $tail), false);
|
||||||
$this->add('title_color', trim($this->get('title_color') ?? ''));
|
$this->add('title_color', trim($this->get('title_color') ?? ''));
|
||||||
|
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
if($this->get('title_bold') == 'Y')
|
if($this->get('title_bold') == 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -609,7 +609,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return sprintf('<span style="%s">%s</span>', implode(';', $attrs), $title);
|
return sprintf('<span style="%s">%s</span>', implode(';', $attrs), $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -619,19 +619,19 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return lang('msg_is_secret');
|
return lang('msg_is_secret');
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
||||||
if($strlen)
|
if($strlen)
|
||||||
{
|
{
|
||||||
$content = cut_str($content, $strlen, '...');
|
$content = cut_str($content, $strlen, '...');
|
||||||
}
|
}
|
||||||
|
|
||||||
return escape($content);
|
return escape($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -641,12 +641,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return lang('msg_is_secret');
|
return lang('msg_is_secret');
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
|
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
|
||||||
$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
|
$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
|
||||||
|
|
@ -655,7 +655,7 @@ class DocumentItem extends BaseObject
|
||||||
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
||||||
$content = cut_str($content, $strlen, '...');
|
$content = cut_str($content, $strlen, '...');
|
||||||
}
|
}
|
||||||
|
|
||||||
return escape($content);
|
return escape($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -708,18 +708,18 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return lang('msg_is_secret');
|
return lang('msg_is_secret');
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
if(!$stripEmbedTagException)
|
if(!$stripEmbedTagException)
|
||||||
{
|
{
|
||||||
stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define a link if using a rewrite module
|
// Define a link if using a rewrite module
|
||||||
if(Context::isAllowRewrite())
|
if(Context::isAllowRewrite())
|
||||||
{
|
{
|
||||||
|
|
@ -761,7 +761,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
|
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -779,31 +779,31 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $this->getContent($add_popup_menu, $add_content_info, $resource_realpath, $add_xe_content_class);
|
$content = $this->getContent($add_popup_menu, $add_content_info, $resource_realpath, $add_xe_content_class);
|
||||||
$content = getController('editor')->transComponent($content);
|
$content = getController('editor')->transComponent($content);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSummary($str_size = 50, $tail = '...')
|
function getSummary($str_size = 50, $tail = '...')
|
||||||
{
|
{
|
||||||
// Remove tags
|
// Remove tags
|
||||||
$content = $this->getContent(false, false);
|
$content = $this->getContent(false, false);
|
||||||
$content = strip_tags(preg_replace('!<(style|script)\b.+?</\\1>!is', '', $content));
|
$content = strip_tags(preg_replace('!<(style|script)\b.+?</\\1>!is', '', $content));
|
||||||
|
|
||||||
// Convert temporarily html entity for truncate
|
// Convert temporarily html entity for truncate
|
||||||
$content = html_entity_decode($content, ENT_QUOTES);
|
$content = html_entity_decode($content, ENT_QUOTES);
|
||||||
|
|
||||||
// Replace all whitespaces to single space
|
// Replace all whitespaces to single space
|
||||||
$content = utf8_trim(utf8_normalize_spaces($content));
|
$content = utf8_trim(utf8_normalize_spaces($content));
|
||||||
|
|
||||||
// Truncate string
|
// Truncate string
|
||||||
$content = cut_str($content, $str_size, $tail);
|
$content = cut_str($content, $str_size, $tail);
|
||||||
|
|
||||||
return escape($content);
|
return escape($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRegdate($format = 'Y.m.d H:i:s', $conversion = true)
|
function getRegdate($format = 'Y.m.d H:i:s', $conversion = true)
|
||||||
{
|
{
|
||||||
return zdate($this->get('regdate'), $format, $conversion);
|
return zdate($this->get('regdate'), $format, $conversion);
|
||||||
|
|
@ -854,9 +854,9 @@ class DocumentItem extends BaseObject
|
||||||
*/
|
*/
|
||||||
public function getTrackbackUrl()
|
public function getTrackbackUrl()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUrl()
|
public function getUrl()
|
||||||
{
|
{
|
||||||
return getFullUrl('', 'mid', $this->getApparentMid(), 'document_srl', $this->get('document_srl'));
|
return getFullUrl('', 'mid', $this->getApparentMid(), 'document_srl', $this->get('document_srl'));
|
||||||
|
|
@ -868,14 +868,14 @@ class DocumentItem extends BaseObject
|
||||||
$tag_list = array_filter($tag_list, function($str) { return $str !== ''; });
|
$tag_list = array_filter($tag_list, function($str) { return $str !== ''; });
|
||||||
return array_unique($tag_list);
|
return array_unique($tag_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHashtags()
|
public function getHashtags()
|
||||||
{
|
{
|
||||||
preg_match_all('/(?<!&)#([\pL\pN_]+)/u', strip_tags($this->get('content')), $hashtags);
|
preg_match_all('/(?<!&)#([\pL\pN_]+)/u', strip_tags($this->get('content')), $hashtags);
|
||||||
$hashtags[1] = array_map(function($str) { return escape($str, false); }, $hashtags[1]);
|
$hashtags[1] = array_map(function($str) { return escape($str, false); }, $hashtags[1]);
|
||||||
return array_unique($hashtags[1]);
|
return array_unique($hashtags[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update readed count
|
* Update readed count
|
||||||
* @return void
|
* @return void
|
||||||
|
|
@ -911,35 +911,35 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
return DocumentModel::getExtraVars($module_srl, $this->document_srl);
|
return DocumentModel::getExtraVars($module_srl, $this->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExtraEids()
|
function getExtraEids()
|
||||||
{
|
{
|
||||||
if($this->extra_eids)
|
if($this->extra_eids)
|
||||||
{
|
{
|
||||||
return $this->extra_eids;
|
return $this->extra_eids;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_vars = $this->getExtraVars();
|
$extra_vars = $this->getExtraVars();
|
||||||
foreach($extra_vars as $idx => $key)
|
foreach($extra_vars as $idx => $key)
|
||||||
{
|
{
|
||||||
$this->extra_eids[$key->eid] = $key;
|
$this->extra_eids[$key->eid] = $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->extra_eids;
|
return $this->extra_eids;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExtraValue($idx)
|
function getExtraValue($idx)
|
||||||
{
|
{
|
||||||
$extra_vars = $this->getExtraVars();
|
$extra_vars = $this->getExtraVars();
|
||||||
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValue() : '';
|
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValue() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExtraValueHTML($idx)
|
function getExtraValueHTML($idx)
|
||||||
{
|
{
|
||||||
$extra_vars = $this->getExtraVars();
|
$extra_vars = $this->getExtraVars();
|
||||||
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValueHTML() : '';
|
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValueHTML() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExtraEidValue($eid)
|
function getExtraEidValue($eid)
|
||||||
{
|
{
|
||||||
$extra_eids = $this->getExtraEids();
|
$extra_eids = $this->getExtraEids();
|
||||||
|
|
@ -951,7 +951,7 @@ class DocumentItem extends BaseObject
|
||||||
$extra_eids = $this->getExtraEids();
|
$extra_eids = $this->getExtraEids();
|
||||||
return isset($extra_eids[$eid]) ? $extra_eids[$eid]->getValueHTML() : '';
|
return isset($extra_eids[$eid]) ? $extra_eids[$eid]->getValueHTML() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExtraVarsValue($key)
|
function getExtraVarsValue($key)
|
||||||
{
|
{
|
||||||
$extra_vals = unserialize($this->get('extra_vars'));
|
$extra_vals = unserialize($this->get('extra_vars'));
|
||||||
|
|
@ -969,12 +969,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cpage is a number of comment pages
|
// cpage is a number of comment pages
|
||||||
$cpageStr = sprintf('%d_cpage', $this->document_srl);
|
$cpageStr = sprintf('%d_cpage', $this->document_srl);
|
||||||
$cpage = Context::get($cpageStr);
|
$cpage = Context::get($cpageStr);
|
||||||
|
|
@ -994,7 +994,7 @@ class DocumentItem extends BaseObject
|
||||||
// Get a list of comments
|
// Get a list of comments
|
||||||
$output = CommentModel::getCommentList($this->document_srl, $cpage);
|
$output = CommentModel::getCommentList($this->document_srl, $cpage);
|
||||||
if(!$output->toBool() || !count($output->data)) return;
|
if(!$output->toBool() || !count($output->data)) return;
|
||||||
|
|
||||||
// Create commentItem object from a comment list
|
// Create commentItem object from a comment list
|
||||||
// If admin priviledge is granted on parent posts, you can read its child posts.
|
// If admin priviledge is granted on parent posts, you can read its child posts.
|
||||||
$accessible = array();
|
$accessible = array();
|
||||||
|
|
@ -1016,7 +1016,7 @@ class DocumentItem extends BaseObject
|
||||||
}
|
}
|
||||||
$comment_list[$val->comment_srl] = $oCommentItem;
|
$comment_list[$val->comment_srl] = $oCommentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the vote log for all comments.
|
// Cache the vote log for all comments.
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if ($logged_info->member_srl)
|
if ($logged_info->member_srl)
|
||||||
|
|
@ -1048,12 +1048,12 @@ class DocumentItem extends BaseObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variable setting to be displayed on the skin
|
// Variable setting to be displayed on the skin
|
||||||
Context::set($cpageStr, $output->page_navigation->cur_page);
|
Context::set($cpageStr, $output->page_navigation->cur_page);
|
||||||
Context::set('cpage', $output->page_navigation->cur_page);
|
Context::set('cpage', $output->page_navigation->cur_page);
|
||||||
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
|
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
|
||||||
|
|
||||||
// Call trigger (after)
|
// Call trigger (after)
|
||||||
$output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list);
|
$output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list);
|
||||||
|
|
||||||
|
|
@ -1107,7 +1107,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$config->thumbnail_quality = 75;
|
$config->thumbnail_quality = 75;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not specify its height, create a square
|
// If not specify its height, create a square
|
||||||
if(!is_int($width))
|
if(!is_int($width))
|
||||||
{
|
{
|
||||||
|
|
@ -1117,7 +1117,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$height = $width;
|
$height = $width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define thumbnail information
|
// Define thumbnail information
|
||||||
$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
|
$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
|
||||||
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
|
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
|
||||||
|
|
@ -1137,7 +1137,7 @@ class DocumentItem extends BaseObject
|
||||||
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call trigger for custom thumbnails.
|
// Call trigger for custom thumbnails.
|
||||||
$trigger_obj = (object)[
|
$trigger_obj = (object)[
|
||||||
'document_srl' => $this->document_srl, 'width' => $width, 'height' => $height,
|
'document_srl' => $this->document_srl, 'width' => $width, 'height' => $height,
|
||||||
|
|
@ -1150,7 +1150,7 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get content if it does not exist.
|
// Get content if it does not exist.
|
||||||
if($this->get('content'))
|
if($this->get('content'))
|
||||||
{
|
{
|
||||||
|
|
@ -1163,7 +1163,7 @@ class DocumentItem extends BaseObject
|
||||||
$output = executeQuery('document.getDocument', $args);
|
$output = executeQuery('document.getDocument', $args);
|
||||||
$content = $output->data->content;
|
$content = $output->data->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return false if neither attachement nor image files in the document
|
// Return false if neither attachement nor image files in the document
|
||||||
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $content)) return;
|
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $content)) return;
|
||||||
|
|
||||||
|
|
@ -1262,7 +1262,7 @@ class DocumentItem extends BaseObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($source_file)
|
if($source_file)
|
||||||
{
|
{
|
||||||
$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $trigger_obj->width, $trigger_obj->height, $trigger_obj->image_type, $trigger_obj->type, $trigger_obj->quality);
|
$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $trigger_obj->width, $trigger_obj->height, $trigger_obj->image_type, $trigger_obj->type, $trigger_obj->quality);
|
||||||
|
|
@ -1343,7 +1343,7 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the status code.
|
* Return the status code.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getStatus()
|
function getStatus()
|
||||||
|
|
@ -1354,7 +1354,7 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the status in human-readable text.
|
* Return the status in human-readable text.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getStatusText()
|
function getStatusText()
|
||||||
|
|
@ -1406,7 +1406,7 @@ class DocumentItem extends BaseObject
|
||||||
$iconSkin = 'default';
|
$iconSkin = 'default';
|
||||||
$iconType = 'gif';
|
$iconType = 'gif';
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = sprintf('%s%s', \RX_BASEURL, "modules/document/tpl/icons/$iconSkin/");
|
$path = sprintf('%s%s', \RX_BASEURL, "modules/document/tpl/icons/$iconSkin/");
|
||||||
$buff = array();
|
$buff = array();
|
||||||
foreach($icons as $icon)
|
foreach($icons as $icon)
|
||||||
|
|
@ -1422,12 +1422,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->get('uploaded_count')? true : false;
|
return $this->get('uploaded_count')? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1437,22 +1437,22 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->get('uploaded_count'))
|
if(!$this->get('uploaded_count'))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($this->uploadedFiles[$sortIndex]))
|
if(!isset($this->uploadedFiles[$sortIndex]))
|
||||||
{
|
{
|
||||||
$this->uploadedFiles[$sortIndex] = FileModel::getFiles($this->document_srl, array(), $sortIndex, true);
|
$this->uploadedFiles[$sortIndex] = FileModel::getFiles($this->document_srl, array(), $sortIndex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->uploadedFiles[$sortIndex];
|
return $this->uploadedFiles[$sortIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1478,12 +1478,12 @@ class DocumentItem extends BaseObject
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1577,7 +1577,7 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the apparent mid.
|
* Returns the apparent mid.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getApparentMid()
|
function getApparentMid()
|
||||||
|
|
@ -1587,7 +1587,7 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the true mid.
|
* Returns the true mid.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getDocumentMid()
|
function getDocumentMid()
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
return $_SESSION['granted_document'][$document_srl];
|
return $_SESSION['granted_document'][$document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return document extra information from database
|
* Return document extra information from database
|
||||||
* @param array $document_srls
|
* @param array $document_srls
|
||||||
|
|
@ -41,7 +41,7 @@ class DocumentModel extends Document
|
||||||
$args->document_srl = $document_srls;
|
$args->document_srl = $document_srls;
|
||||||
return executeQueryArray('document.getDocumentExtraVars', $args);
|
return executeQueryArray('document.getDocumentExtraVars', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra variables for each article will not be processed bulk select and apply the macro city
|
* Extra variables for each article will not be processed bulk select and apply the macro city
|
||||||
* @return void
|
* @return void
|
||||||
|
|
@ -54,10 +54,10 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static $checked = array();
|
static $checked = array();
|
||||||
static $module_extra_keys = array();
|
static $module_extra_keys = array();
|
||||||
|
|
||||||
// check documents
|
// check documents
|
||||||
$document_srls = array();
|
$document_srls = array();
|
||||||
foreach($_document_list as $document_srl => $oDocument)
|
foreach($_document_list as $document_srl => $oDocument)
|
||||||
|
|
@ -66,16 +66,16 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$checked[$document_srl] = true;
|
$checked[$document_srl] = true;
|
||||||
$document_srls[] = $document_srl;
|
$document_srls[] = $document_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$document_srls)
|
if(!$document_srls)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get extra values of documents
|
// get extra values of documents
|
||||||
$extra_values = array();
|
$extra_values = array();
|
||||||
$output = self::getDocumentExtraVarsFromDB($document_srls);
|
$output = self::getDocumentExtraVarsFromDB($document_srls);
|
||||||
|
|
@ -85,10 +85,10 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_values[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
|
$extra_values[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set extra variables and document language
|
// set extra variables and document language
|
||||||
$user_lang_code = Context::getLangType();
|
$user_lang_code = Context::getLangType();
|
||||||
foreach($document_srls as $document_srl)
|
foreach($document_srls as $document_srl)
|
||||||
|
|
@ -97,7 +97,7 @@ class DocumentModel extends Document
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
$document_lang_code = $oDocument->get('lang_code');
|
$document_lang_code = $oDocument->get('lang_code');
|
||||||
$document_extra_values = $extra_values[$document_srl] ?? [];
|
$document_extra_values = $extra_values[$document_srl] ?? [];
|
||||||
|
|
||||||
// set XE_EXTRA_VARS
|
// set XE_EXTRA_VARS
|
||||||
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
|
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
|
||||||
{
|
{
|
||||||
|
|
@ -106,7 +106,7 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
$module_extra_keys[$module_srl] = self::getExtraKeys($module_srl);
|
$module_extra_keys[$module_srl] = self::getExtraKeys($module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set extra variables of the document
|
// set extra variables of the document
|
||||||
if($module_extra_keys[$module_srl])
|
if($module_extra_keys[$module_srl])
|
||||||
{
|
{
|
||||||
|
|
@ -114,7 +114,7 @@ class DocumentModel extends Document
|
||||||
foreach($module_extra_keys[$module_srl] as $idx => $key)
|
foreach($module_extra_keys[$module_srl] as $idx => $key)
|
||||||
{
|
{
|
||||||
$document_extra_vars[$idx] = clone($key);
|
$document_extra_vars[$idx] = clone($key);
|
||||||
|
|
||||||
// set variable value in user language
|
// set variable value in user language
|
||||||
if(isset($document_extra_values[$idx][$user_lang_code]))
|
if(isset($document_extra_values[$idx][$user_lang_code]))
|
||||||
{
|
{
|
||||||
|
|
@ -125,11 +125,11 @@ class DocumentModel extends Document
|
||||||
$document_extra_vars[$idx]->setValue($document_extra_values[$idx][$document_lang_code]);
|
$document_extra_vars[$idx]->setValue($document_extra_values[$idx][$document_lang_code]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['XE_EXTRA_VARS'][$document_srl] = $document_extra_vars;
|
$GLOBALS['XE_EXTRA_VARS'][$document_srl] = $document_extra_vars;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set RX_DOCUMENT_LANG
|
// set RX_DOCUMENT_LANG
|
||||||
if(!isset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]) && $document_lang_code !== $user_lang_code)
|
if(!isset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]) && $document_lang_code !== $user_lang_code)
|
||||||
{
|
{
|
||||||
|
|
@ -174,7 +174,7 @@ class DocumentModel extends Document
|
||||||
trigger_error('Called DocumentModel::getDocument() with $is_admin = true', \E_USER_WARNING);
|
trigger_error('Called DocumentModel::getDocument() with $is_admin = true', \E_USER_WARNING);
|
||||||
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
|
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
|
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ class DocumentModel extends Document
|
||||||
$args->list_count = is_array($document_srls) ? count($document_srls) : 1;
|
$args->list_count = is_array($document_srls) ? count($document_srls) : 1;
|
||||||
$args->order_type = 'asc';
|
$args->order_type = 'asc';
|
||||||
$output = executeQueryArray('document.getDocuments', $args, $columnList);
|
$output = executeQueryArray('document.getDocuments', $args, $columnList);
|
||||||
|
|
||||||
$documents = array();
|
$documents = array();
|
||||||
foreach($output->data as $attribute)
|
foreach($output->data as $attribute)
|
||||||
{
|
{
|
||||||
|
|
@ -216,15 +216,15 @@ class DocumentModel extends Document
|
||||||
trigger_error('Called DocumentModel::getDocuments() with $is_admin = true', \E_USER_WARNING);
|
trigger_error('Called DocumentModel::getDocuments() with $is_admin = true', \E_USER_WARNING);
|
||||||
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]->setGrant();
|
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]->setGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
$documents[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
$documents[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($load_extra_vars)
|
if($load_extra_vars)
|
||||||
{
|
{
|
||||||
self::setToAllDocumentExtraVars();
|
self::setToAllDocumentExtraVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $documents;
|
return $documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ class DocumentModel extends Document
|
||||||
$obj->isExtraVars = $sort_check->isExtraVars;
|
$obj->isExtraVars = $sort_check->isExtraVars;
|
||||||
$obj->except_notice = $except_notice;
|
$obj->except_notice = $except_notice;
|
||||||
$obj->columnList = $columnList;
|
$obj->columnList = $columnList;
|
||||||
|
|
||||||
// Call trigger (before)
|
// Call trigger (before)
|
||||||
// This trigger can be used to set an alternative output using a different search method
|
// This trigger can be used to set an alternative output using a different search method
|
||||||
unset($obj->use_alternate_output);
|
unset($obj->use_alternate_output);
|
||||||
|
|
@ -252,7 +252,7 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an alternate output is set, use it instead of running the default queries
|
// If an alternate output is set, use it instead of running the default queries
|
||||||
if (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject)
|
if (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject)
|
||||||
{
|
{
|
||||||
|
|
@ -264,13 +264,13 @@ class DocumentModel extends Document
|
||||||
self::_setSearchOption($obj, $args, $query_id, $use_division);
|
self::_setSearchOption($obj, $args, $query_id, $use_division);
|
||||||
$output = executeQueryArray($query_id, $args, $args->columnList);
|
$output = executeQueryArray($query_id, $args, $args->columnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return if no result or an error occurs
|
// Return if no result or an error occurs
|
||||||
if(!$output->toBool() || !$result = $output->data)
|
if(!$output->toBool() || !$result = $output->data)
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->data = array();
|
$output->data = array();
|
||||||
foreach($result as $key => $attribute)
|
foreach($result as $key => $attribute)
|
||||||
{
|
{
|
||||||
|
|
@ -281,12 +281,12 @@ class DocumentModel extends Document
|
||||||
}
|
}
|
||||||
$output->data[$key] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
$output->data[$key] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($load_extra_vars)
|
if($load_extra_vars)
|
||||||
{
|
{
|
||||||
self::setToAllDocumentExtraVars();
|
self::setToAllDocumentExtraVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call trigger (after)
|
// Call trigger (after)
|
||||||
// This trigger can be used to modify search results
|
// This trigger can be used to modify search results
|
||||||
ModuleHandler::triggerCall('document.getDocumentList', 'after', $output);
|
ModuleHandler::triggerCall('document.getDocumentList', 'after', $output);
|
||||||
|
|
@ -324,12 +324,12 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
|
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$output->toBool() || !$result = $output->data)
|
if(!$output->toBool() || !$result = $output->data)
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->data = array();
|
$output->data = array();
|
||||||
foreach($result as $attribute)
|
foreach($result as $attribute)
|
||||||
{
|
{
|
||||||
|
|
@ -338,10 +338,10 @@ class DocumentModel extends Document
|
||||||
$oDocument = new documentItem();
|
$oDocument = new documentItem();
|
||||||
$oDocument->setAttribute($attribute, false);
|
$oDocument->setAttribute($attribute, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
self::setToAllDocumentExtraVars();
|
self::setToAllDocumentExtraVars();
|
||||||
|
|
||||||
// Call trigger (after)
|
// Call trigger (after)
|
||||||
|
|
@ -446,15 +446,15 @@ class DocumentModel extends Document
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
|
ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
|
||||||
|
|
||||||
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
|
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get var_idx of extra variable from its eid
|
* Get var_idx of extra variable from its eid
|
||||||
*
|
*
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
* @param string $eid
|
* @param string $eid
|
||||||
* @return int|false
|
* @return int|false
|
||||||
|
|
@ -475,7 +475,7 @@ class DocumentModel extends Document
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get eid of extra variable from its var_idx
|
* Get eid of extra variable from its var_idx
|
||||||
*
|
*
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
* @param int $idx
|
* @param int $idx
|
||||||
* @return string|false
|
* @return string|false
|
||||||
|
|
@ -493,7 +493,7 @@ class DocumentModel extends Document
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show pop-up menu of the selected posts
|
* Show pop-up menu of the selected posts
|
||||||
* Printing, scrap, recommendations and negative, reported the Add Features
|
* Printing, scrap, recommendations and negative, reported the Add Features
|
||||||
|
|
@ -1281,7 +1281,7 @@ class DocumentModel extends Document
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting sort index
|
* Setting sort index
|
||||||
* @param object $obj
|
* @param object $obj
|
||||||
|
|
@ -1293,34 +1293,34 @@ class DocumentModel extends Document
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->sort_index = $obj->sort_index ?? null;
|
$args->sort_index = $obj->sort_index ?? null;
|
||||||
$args->isExtraVars = false;
|
$args->isExtraVars = false;
|
||||||
|
|
||||||
// check it's default sort
|
// check it's default sort
|
||||||
$default_sort = array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl');
|
$default_sort = array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl');
|
||||||
if(in_array($args->sort_index, $default_sort))
|
if(in_array($args->sort_index, $default_sort))
|
||||||
{
|
{
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check it can use extra variable
|
// check it can use extra variable
|
||||||
if(!$load_extra_vars || !$extra_keys = self::getExtraKeys($obj->module_srl ?? 0))
|
if(!$load_extra_vars || !$extra_keys = self::getExtraKeys($obj->module_srl ?? 0))
|
||||||
{
|
{
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
$eids = array();
|
$eids = array();
|
||||||
foreach($extra_keys as $idx => $key)
|
foreach($extra_keys as $idx => $key)
|
||||||
{
|
{
|
||||||
$eids[] = $key->eid;
|
$eids[] = $key->eid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check it exists in extra keys of the module
|
// check it exists in extra keys of the module
|
||||||
if(!in_array($args->sort_index, $eids))
|
if(!in_array($args->sort_index, $eids))
|
||||||
{
|
{
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
$args->isExtraVars = true;
|
$args->isExtraVars = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
@ -1361,13 +1361,13 @@ class DocumentModel extends Document
|
||||||
$args->s_is_notice = ($searchOpt->except_notice ?? false) ? 'N' : null;
|
$args->s_is_notice = ($searchOpt->except_notice ?? false) ? 'N' : null;
|
||||||
$args->statusList = $searchOpt->statusList ?? array(self::getConfigStatus('public'), self::getConfigStatus('secret'));
|
$args->statusList = $searchOpt->statusList ?? array(self::getConfigStatus('public'), self::getConfigStatus('secret'));
|
||||||
$args->columnList = $searchOpt->columnList ?? array();
|
$args->columnList = $searchOpt->columnList ?? array();
|
||||||
|
|
||||||
// get directly module_srl by mid
|
// get directly module_srl by mid
|
||||||
if(isset($searchOpt->mid) && $searchOpt->mid)
|
if(isset($searchOpt->mid) && $searchOpt->mid)
|
||||||
{
|
{
|
||||||
$args->module_srl = ModuleModel::getModuleSrlByMid($searchOpt->mid);
|
$args->module_srl = ModuleModel::getModuleSrlByMid($searchOpt->mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add subcategories
|
// add subcategories
|
||||||
if(isset($args->category_srl) && $args->category_srl)
|
if(isset($args->category_srl) && $args->category_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -1379,13 +1379,13 @@ class DocumentModel extends Document
|
||||||
$args->category_srl = $categories;
|
$args->category_srl = $categories;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// default
|
// default
|
||||||
$query_id = null;
|
$query_id = null;
|
||||||
$use_division = false;
|
$use_division = false;
|
||||||
$search_target = $searchOpt->search_target ?? null;
|
$search_target = $searchOpt->search_target ?? null;
|
||||||
$search_keyword = trim($searchOpt->search_keyword ?? '') ?: null;
|
$search_keyword = trim($searchOpt->search_keyword ?? '') ?: null;
|
||||||
|
|
||||||
// search
|
// search
|
||||||
if($search_target && $search_keyword)
|
if($search_target && $search_keyword)
|
||||||
{
|
{
|
||||||
|
|
@ -1463,7 +1463,7 @@ class DocumentModel extends Document
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// exclude secret documents in searching if current user does not have privilege
|
// exclude secret documents in searching if current user does not have privilege
|
||||||
if(!isset($args->member_srl) || !$args->member_srl || !Context::get('is_logged') || $args->member_srl !== Context::get('logged_info')->member_srl)
|
if(!isset($args->member_srl) || !$args->member_srl || !Context::get('is_logged') || $args->member_srl !== Context::get('logged_info')->member_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -1475,7 +1475,7 @@ class DocumentModel extends Document
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set query
|
// set query
|
||||||
if(!$query_id)
|
if(!$query_id)
|
||||||
{
|
{
|
||||||
|
|
@ -1499,12 +1499,12 @@ class DocumentModel extends Document
|
||||||
$query_id = 'document.getDocumentList';
|
$query_id = 'document.getDocumentList';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// other queries not support to sort extra variable
|
// other queries not support to sort extra variable
|
||||||
elseif($searchOpt->isExtraVars)
|
elseif($searchOpt->isExtraVars)
|
||||||
{
|
{
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
}
|
}
|
||||||
|
|
||||||
// division search by 5,000
|
// division search by 5,000
|
||||||
if($use_division)
|
if($use_division)
|
||||||
{
|
{
|
||||||
|
|
@ -1512,18 +1512,18 @@ class DocumentModel extends Document
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
$args->division = (int)Context::get('division');
|
$args->division = (int)Context::get('division');
|
||||||
$args->last_division = (int)Context::get('last_division');
|
$args->last_division = (int)Context::get('last_division');
|
||||||
|
|
||||||
$division_args = new stdClass;
|
$division_args = new stdClass;
|
||||||
$division_args->module_srl = $args->module_srl;
|
$division_args->module_srl = $args->module_srl;
|
||||||
$division_args->exclude_module_srl = $args->exclude_module_srl;
|
$division_args->exclude_module_srl = $args->exclude_module_srl;
|
||||||
|
|
||||||
// get start point of first division
|
// get start point of first division
|
||||||
if(Context::get('division') === null)
|
if(Context::get('division') === null)
|
||||||
{
|
{
|
||||||
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
|
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
|
||||||
$args->division = $division_output ? $division_output->list_order : 0;
|
$args->division = $division_output ? $division_output->list_order : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get end point of the division
|
// get end point of the division
|
||||||
if(Context::get('last_division') === null && $args->division)
|
if(Context::get('last_division') === null && $args->division)
|
||||||
{
|
{
|
||||||
|
|
@ -1532,11 +1532,11 @@ class DocumentModel extends Document
|
||||||
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
|
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
|
||||||
$args->last_division = $division_output ? $division_output->list_order : 0;
|
$args->last_division = $division_output ? $division_output->list_order : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('division', $args->division);
|
Context::set('division', $args->division);
|
||||||
Context::set('last_division', $args->last_division);
|
Context::set('last_division', $args->last_division);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default prefix
|
// add default prefix
|
||||||
if($args->sort_index && strpos($args->sort_index, '.') === false)
|
if($args->sort_index && strpos($args->sort_index, '.') === false)
|
||||||
{
|
{
|
||||||
|
|
@ -1581,11 +1581,11 @@ class DocumentModel extends Document
|
||||||
$args->list_count = $count;
|
$args->list_count = $count;
|
||||||
$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
|
$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
|
||||||
$document_list = $output->data;
|
$document_list = $output->data;
|
||||||
|
|
||||||
if(!$document_list) return array();
|
if(!$document_list) return array();
|
||||||
if(!is_array($document_list)) $document_list = array($document_list);
|
if(!is_array($document_list)) $document_list = array($document_list);
|
||||||
|
|
||||||
return $document_list;
|
return $document_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDocumentUpdateLog($document_srl)
|
public static function getDocumentUpdateLog($document_srl)
|
||||||
|
|
|
||||||
|
|
@ -53,15 +53,15 @@ class DocumentView extends Document
|
||||||
if(!checkCSRF())
|
if(!checkCSRF())
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\SecurityViolation;
|
throw new Rhymix\Framework\Exceptions\SecurityViolation;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = Context::get('content');
|
$content = Context::get('content');
|
||||||
|
|
||||||
if(Context::get('logged_info')->is_admin != 'Y')
|
if(Context::get('logged_info')->is_admin != 'Y')
|
||||||
{
|
{
|
||||||
$content = removeHackTag($content);
|
$content = removeHackTag($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor converter
|
// Editor converter
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->content = $content;
|
$obj->content = $content;
|
||||||
|
|
@ -69,7 +69,7 @@ class DocumentView extends Document
|
||||||
$content = getModel('editor')->converter($obj, 'document');
|
$content = getModel('editor')->converter($obj, 'document');
|
||||||
$content = sprintf('<div class="document_0_%d rhymix_content xe_content">%s</div>', Context::get('logged_info')->member_srl, $content);
|
$content = sprintf('<div class="document_0_%d rhymix_content xe_content">%s</div>', Context::get('logged_info')->member_srl, $content);
|
||||||
Context::set('content', $content);
|
Context::set('content', $content);
|
||||||
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('preview_page');
|
$this->setTemplateFile('preview_page');
|
||||||
Context::set('layout', 'none');
|
Context::set('layout', 'none');
|
||||||
|
|
@ -107,7 +107,7 @@ class DocumentView extends Document
|
||||||
// Set target module info
|
// Set target module info
|
||||||
$target_mid = Context::getRequestVars()->mid ?? '';
|
$target_mid = Context::getRequestVars()->mid ?? '';
|
||||||
$module_srl = intval(Context::get('module_srl'));
|
$module_srl = intval(Context::get('module_srl'));
|
||||||
|
|
||||||
// if target mid is provided
|
// if target mid is provided
|
||||||
if($target_mid && $target_mid === Context::get('mid'))
|
if($target_mid && $target_mid === Context::get('mid'))
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +134,7 @@ class DocumentView extends Document
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
|
||||||
$module_srl = $module_info ? $module_info->module_srl : 0;
|
$module_srl = $module_info ? $module_info->module_srl : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('module_srl', $module_srl);
|
Context::set('module_srl', $module_srl);
|
||||||
Context::set('mid', $module_info ? $module_info->mid : '');
|
Context::set('mid', $module_info ? $module_info->mid : '');
|
||||||
Context::set('browser_title', $module_info ? $module_info->browser_title : '');
|
Context::set('browser_title', $module_info ? $module_info->browser_title : '');
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ class FileAdminController extends File
|
||||||
|
|
||||||
$oFileController->deleteFile($file_srl);
|
$oFileController->deleteFile($file_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage(sprintf(lang('msg_checked_file_is_deleted'), $file_count));
|
$this->setMessage(sprintf(lang('msg_checked_file_is_deleted'), $file_count));
|
||||||
|
|
||||||
$redirect_url = $_SERVER['HTTP_REFERER'] ?? '';
|
$redirect_url = $_SERVER['HTTP_REFERER'] ?? '';
|
||||||
if (!$redirect_url || !Rhymix\Framework\URL::isInternalURL($redirect_url))
|
if (!$redirect_url || !Rhymix\Framework\URL::isInternalURL($redirect_url))
|
||||||
{
|
{
|
||||||
|
|
@ -94,7 +94,7 @@ class FileAdminController extends File
|
||||||
$config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg';
|
$config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg';
|
||||||
$config->ffprobe_command = escape(utf8_trim(Context::get('ffprobe_command'))) ?: '/usr/bin/ffprobe';
|
$config->ffprobe_command = escape(utf8_trim(Context::get('ffprobe_command'))) ?: '/usr/bin/ffprobe';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check maximum file size
|
// Check maximum file size
|
||||||
if (PHP_INT_SIZE < 8)
|
if (PHP_INT_SIZE < 8)
|
||||||
{
|
{
|
||||||
|
|
@ -103,7 +103,7 @@ class FileAdminController extends File
|
||||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simplify allowed_filetypes
|
// Simplify allowed_filetypes
|
||||||
$config->allowed_extensions = strtr(strtolower(trim($config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
$config->allowed_extensions = strtr(strtolower(trim($config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
||||||
if ($config->allowed_extensions)
|
if ($config->allowed_extensions)
|
||||||
|
|
@ -120,7 +120,7 @@ class FileAdminController extends File
|
||||||
$config->allowed_extensions = array();
|
$config->allowed_extensions = array();
|
||||||
$config->allowed_filetypes = '*.*';
|
$config->allowed_filetypes = '*.*';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save and redirect
|
// Save and redirect
|
||||||
$output = getController('module')->insertModuleConfig('file', $config);
|
$output = getController('module')->insertModuleConfig('file', $config);
|
||||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminUploadConfig');
|
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminUploadConfig');
|
||||||
|
|
@ -142,7 +142,7 @@ class FileAdminController extends File
|
||||||
$config->allow_multimedia_direct_download = Context::get('allow_multimedia_direct_download') === 'Y' ? 'Y' : 'N';
|
$config->allow_multimedia_direct_download = Context::get('allow_multimedia_direct_download') === 'Y' ? 'Y' : 'N';
|
||||||
$config->download_short_url = Context::get('download_short_url') === 'Y' ? 'Y' : 'N';
|
$config->download_short_url = Context::get('download_short_url') === 'Y' ? 'Y' : 'N';
|
||||||
$config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format') ?: []);
|
$config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format') ?: []);
|
||||||
|
|
||||||
// Save and redirect
|
// Save and redirect
|
||||||
$output = getController('module')->insertModuleConfig('file', $config);
|
$output = getController('module')->insertModuleConfig('file', $config);
|
||||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig');
|
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig');
|
||||||
|
|
@ -159,7 +159,7 @@ class FileAdminController extends File
|
||||||
// Update configuration
|
// Update configuration
|
||||||
$config = getModel('module')->getModuleConfig('file') ?: new stdClass;
|
$config = getModel('module')->getModuleConfig('file') ?: new stdClass;
|
||||||
$config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N';
|
$config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N';
|
||||||
|
|
||||||
// Save and redirect
|
// Save and redirect
|
||||||
$output = getController('module')->insertModuleConfig('file', $config);
|
$output = getController('module')->insertModuleConfig('file', $config);
|
||||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminOtherConfig');
|
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminOtherConfig');
|
||||||
|
|
@ -174,7 +174,7 @@ class FileAdminController extends File
|
||||||
function procFileAdminInsertModuleConfig()
|
function procFileAdminInsertModuleConfig()
|
||||||
{
|
{
|
||||||
$config = new stdClass;
|
$config = new stdClass;
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
if(!Context::get('use_default_file_config'))
|
if(!Context::get('use_default_file_config'))
|
||||||
{
|
{
|
||||||
|
|
@ -182,7 +182,7 @@ class FileAdminController extends File
|
||||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||||
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||||
|
|
||||||
// Check maximum file size
|
// Check maximum file size
|
||||||
if (PHP_INT_SIZE < 8)
|
if (PHP_INT_SIZE < 8)
|
||||||
{
|
{
|
||||||
|
|
@ -191,7 +191,7 @@ class FileAdminController extends File
|
||||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simplify allowed_filetypes
|
// Simplify allowed_filetypes
|
||||||
$config->allowed_extensions = strtr(strtolower(trim($config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
$config->allowed_extensions = strtr(strtolower(trim($config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
||||||
if ($config->allowed_extensions)
|
if ($config->allowed_extensions)
|
||||||
|
|
@ -209,7 +209,7 @@ class FileAdminController extends File
|
||||||
$config->allowed_filetypes = '*.*';
|
$config->allowed_filetypes = '*.*';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
if(!Context::get('use_image_default_file_config'))
|
if(!Context::get('use_image_default_file_config'))
|
||||||
{
|
{
|
||||||
|
|
@ -227,7 +227,7 @@ class FileAdminController extends File
|
||||||
$config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
|
$config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
|
||||||
$config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false;
|
$config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video
|
// Video
|
||||||
if(!Context::get('use_video_default_file_config'))
|
if(!Context::get('use_video_default_file_config'))
|
||||||
{
|
{
|
||||||
|
|
@ -235,11 +235,11 @@ class FileAdminController extends File
|
||||||
$config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
$config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
||||||
$config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
$config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set download groups
|
// Set download groups
|
||||||
$download_grant = Context::get('download_grant');
|
$download_grant = Context::get('download_grant');
|
||||||
$config->download_grant = is_array($download_grant) ? array_values($download_grant) : array($download_grant);
|
$config->download_grant = is_array($download_grant) ? array_values($download_grant) : array($download_grant);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
foreach(explode(',', Context::get('target_module_srl')) as $module_srl)
|
foreach(explode(',', Context::get('target_module_srl')) as $module_srl)
|
||||||
|
|
@ -250,7 +250,7 @@ class FileAdminController extends File
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setError(-1);
|
$this->setError(-1);
|
||||||
$this->setMessage('success_updated', 'info');
|
$this->setMessage('success_updated', 'info');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent'));
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class FileAdminModel extends File
|
||||||
* - isvaild
|
* - isvaild
|
||||||
* - regdate
|
* - regdate
|
||||||
* - ipaddress
|
* - ipaddress
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param object $obj Search options
|
* @param object $obj Search options
|
||||||
|
|
@ -72,13 +72,13 @@ class FileAdminModel extends File
|
||||||
{
|
{
|
||||||
$args->isvalid = $obj->isvalid;
|
$args->isvalid = $obj->isvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set multimedia/common file
|
// Set multimedia/common file
|
||||||
if(isset($obj->direct_download) && in_array($obj->direct_download, ['Y', 'N']))
|
if(isset($obj->direct_download) && in_array($obj->direct_download, ['Y', 'N']))
|
||||||
{
|
{
|
||||||
$args->direct_download = $obj->direct_download;
|
$args->direct_download = $obj->direct_download;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set variables
|
// Set variables
|
||||||
$args->sort_index = $obj->sort_index ?? null;
|
$args->sort_index = $obj->sort_index ?? null;
|
||||||
$args->order_type = $obj->order_type ?? 'desc';
|
$args->order_type = $obj->order_type ?? 'desc';
|
||||||
|
|
@ -97,7 +97,7 @@ class FileAdminModel extends File
|
||||||
{
|
{
|
||||||
$output = executeQueryArray('file.getFileList', $args, $columnList);
|
$output = executeQueryArray('file.getFileList', $args, $columnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return if no result or an error occurs
|
// Return if no result or an error occurs
|
||||||
if(!$output->toBool() || !count($output->data))
|
if(!$output->toBool() || !count($output->data))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class FileAdminView extends File
|
||||||
// Get a list
|
// Get a list
|
||||||
$oFileAdminModel = getAdminModel('file');
|
$oFileAdminModel = getAdminModel('file');
|
||||||
$output = $oFileAdminModel->getFileList($args);
|
$output = $oFileAdminModel->getFileList($args);
|
||||||
|
|
||||||
// Get the document for looping a list
|
// Get the document for looping a list
|
||||||
if($output->data)
|
if($output->data)
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +60,7 @@ class FileAdminView extends File
|
||||||
// Find and update if upload_target_type doesn't exist
|
// Find and update if upload_target_type doesn't exist
|
||||||
if(!$file->upload_target_type)
|
if(!$file->upload_target_type)
|
||||||
{
|
{
|
||||||
// Pass if upload_target_type is already found
|
// Pass if upload_target_type is already found
|
||||||
if(isset($document_list[$target_srl]))
|
if(isset($document_list[$target_srl]))
|
||||||
{
|
{
|
||||||
$file->upload_target_type = 'doc';
|
$file->upload_target_type = 'doc';
|
||||||
|
|
@ -223,7 +223,7 @@ class FileAdminView extends File
|
||||||
$config = $oFileModel->getFileConfig();
|
$config = $oFileModel->getFileConfig();
|
||||||
Context::set('config', $config);
|
Context::set('config', $config);
|
||||||
Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command));
|
Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command));
|
||||||
|
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('upload_config');
|
$this->setTemplateFile('upload_config');
|
||||||
|
|
@ -239,7 +239,7 @@ class FileAdminView extends File
|
||||||
$oFileModel = getModel('file');
|
$oFileModel = getModel('file');
|
||||||
$config = $oFileModel->getFileConfig();
|
$config = $oFileModel->getFileConfig();
|
||||||
Context::set('config',$config);
|
Context::set('config',$config);
|
||||||
|
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('download_config');
|
$this->setTemplateFile('download_config');
|
||||||
|
|
@ -255,7 +255,7 @@ class FileAdminView extends File
|
||||||
$oFileModel = getModel('file');
|
$oFileModel = getModel('file');
|
||||||
$config = $oFileModel->getFileConfig();
|
$config = $oFileModel->getFileConfig();
|
||||||
Context::set('config',$config);
|
Context::set('config',$config);
|
||||||
|
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('other_config');
|
$this->setTemplateFile('other_config');
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ class File extends ModuleObject
|
||||||
{
|
{
|
||||||
// Register action forward (to use in administrator mode)
|
// Register action forward (to use in administrator mode)
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
|
|
||||||
// Generate a directory for the file module
|
// Generate a directory for the file module
|
||||||
FileHandler::makeDir('./files/attach/images');
|
FileHandler::makeDir('./files/attach/images');
|
||||||
FileHandler::makeDir('./files/attach/binaries');
|
FileHandler::makeDir('./files/attach/binaries');
|
||||||
|
|
||||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||||
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
|
||||||
|
|
@ -45,12 +45,12 @@ class File extends ModuleObject
|
||||||
if($oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) 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', 'triggerCheckAttached', 'before')) return true;
|
||||||
if($oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
if($oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
|
||||||
|
|
||||||
if($oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) 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.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', 'triggerCommentCheckAttached', 'before')) return true;
|
||||||
if($oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
if($oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
|
||||||
|
|
||||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
|
||||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
|
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
|
||||||
|
|
@ -63,11 +63,11 @@ class File extends ModuleObject
|
||||||
// A column to determine a target type
|
// A column to determine a target type
|
||||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
|
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
// 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;
|
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true;
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('files', 'cover_image')) return true;
|
if(!$oDB->isColumnExists('files', 'cover_image')) return true;
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
|
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -165,7 +165,7 @@ class File extends ModuleObject
|
||||||
{
|
{
|
||||||
$oModuleController->deleteTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
$oModuleController->deleteTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'))
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after');
|
||||||
|
|
@ -184,14 +184,14 @@ class File extends ModuleObject
|
||||||
// A column to determine a target type
|
// A column to determine a target type
|
||||||
if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3');
|
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
|
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
||||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'))
|
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after');
|
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N');
|
if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N');
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
|
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
|
||||||
{
|
{
|
||||||
$oModuleController->insertTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after');
|
$oModuleController->insertTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after');
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ class FileController extends File
|
||||||
// Basic variables setting
|
// Basic variables setting
|
||||||
$editor_sequence = Context::get('editor_sequence');
|
$editor_sequence = Context::get('editor_sequence');
|
||||||
$module_srl = $this->module_srl;
|
$module_srl = $this->module_srl;
|
||||||
|
|
||||||
// Exit a session if there is neither upload permission nor information
|
// Exit a session if there is neither upload permission nor information
|
||||||
if(!$_SESSION['upload_info'][$editor_sequence]->enabled)
|
if(!$_SESSION['upload_info'][$editor_sequence]->enabled)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get upload_target_srl
|
// Get upload_target_srl
|
||||||
$upload_target_srl = intval(Context::get('uploadTargetSrl')) ?: intval(Context::get('upload_target_srl'));
|
$upload_target_srl = intval(Context::get('uploadTargetSrl')) ?: intval(Context::get('upload_target_srl'));
|
||||||
if (!$upload_target_srl)
|
if (!$upload_target_srl)
|
||||||
|
|
@ -52,7 +52,7 @@ class FileController extends File
|
||||||
$upload_target_srl = getNextSequence();
|
$upload_target_srl = getNextSequence();
|
||||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl;
|
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle chunking
|
// Handle chunking
|
||||||
if (preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'], $matches))
|
if (preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'], $matches))
|
||||||
{
|
{
|
||||||
|
|
@ -66,7 +66,7 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
$this->add('chunk_current_size', $chunk_size);
|
$this->add('chunk_current_size', $chunk_size);
|
||||||
$this->add('chunk_uploaded_size', $chunk_start);
|
$this->add('chunk_uploaded_size', $chunk_start);
|
||||||
|
|
||||||
// Check existing chunks
|
// Check existing chunks
|
||||||
$temp_key = hash_hmac('sha1', sprintf('%d:%d:%d:%s:%s', $editor_sequence, $upload_target_srl, $module_srl, $file_info['name'], session_id()), config('crypto.authentication_key'));
|
$temp_key = hash_hmac('sha1', sprintf('%d:%d:%d:%s:%s', $editor_sequence, $upload_target_srl, $module_srl, $file_info['name'], session_id()), config('crypto.authentication_key'));
|
||||||
$temp_filename = RX_BASEDIR . 'files/attach/chunks/' . $temp_key;
|
$temp_filename = RX_BASEDIR . 'files/attach/chunks/' . $temp_key;
|
||||||
|
|
@ -82,7 +82,7 @@ class FileController extends File
|
||||||
$this->add('chunk_status', 12);
|
$this->add('chunk_status', 12);
|
||||||
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
throw new Rhymix\Framework\Exception('msg_upload_invalid_chunk');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check size limit
|
// Check size limit
|
||||||
$is_admin = (Context::get('logged_info')->is_admin === 'Y');
|
$is_admin = (Context::get('logged_info')->is_admin === 'Y');
|
||||||
if (!$is_admin)
|
if (!$is_admin)
|
||||||
|
|
@ -102,7 +102,7 @@ class FileController extends File
|
||||||
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append to chunk
|
// Append to chunk
|
||||||
$fp = fopen($file_info['tmp_name'], 'r');
|
$fp = fopen($file_info['tmp_name'], 'r');
|
||||||
$success = Rhymix\Framework\Storage::write($temp_filename, $fp, 'a');
|
$success = Rhymix\Framework\Storage::write($temp_filename, $fp, 'a');
|
||||||
|
|
@ -135,14 +135,14 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$this->add('chunk_status', -1);
|
$this->add('chunk_status', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the file
|
// Save the file
|
||||||
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||||
if($output->error != '0')
|
if($output->error != '0')
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception($output->message);
|
throw new Rhymix\Framework\Exception($output->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the response
|
// Create the response
|
||||||
Context::setResponseMethod('JSON');
|
Context::setResponseMethod('JSON');
|
||||||
$this->add('file_srl', $output->get('file_srl'));
|
$this->add('file_srl', $output->get('file_srl'));
|
||||||
|
|
@ -303,7 +303,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found');
|
throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not allow the file outlink
|
// Not allow the file outlink
|
||||||
$file_module_config = FileModel::getFileConfig($file_obj->module_srl);
|
$file_module_config = FileModel::getFileConfig($file_obj->module_srl);
|
||||||
if($file_module_config->allow_outlink == 'N' && $_SERVER["HTTP_REFERER"])
|
if($file_module_config->allow_outlink == 'N' && $_SERVER["HTTP_REFERER"])
|
||||||
|
|
@ -355,13 +355,13 @@ class FileController extends File
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_allowed_outlink');
|
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_allowed_outlink');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the file is downloadable
|
// Check if the file is downloadable
|
||||||
if(!FileModel::isDownloadable($file_obj))
|
if(!FileModel::isDownloadable($file_obj))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download');
|
throw new Rhymix\Framework\Exceptions\NotPermitted('msg_not_permitted_download');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
|
$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -389,7 +389,7 @@ class FileController extends File
|
||||||
$file_key_data = sprintf('%d:%d:%s:%s', $file_obj->file_srl, $file_key_timestamp, $file_obj->uploaded_filename, \RX_CLIENT_IP);
|
$file_key_data = sprintf('%d:%d:%s:%s', $file_obj->file_srl, $file_key_timestamp, $file_obj->uploaded_filename, \RX_CLIENT_IP);
|
||||||
$file_key_sig = \Rhymix\Framework\Security::createSignature($file_key_data);
|
$file_key_sig = \Rhymix\Framework\Security::createSignature($file_key_data);
|
||||||
$file_key = dechex($file_key_timestamp) . $file_key_sig;
|
$file_key = dechex($file_key_timestamp) . $file_key_sig;
|
||||||
|
|
||||||
// Use short URL or long URL
|
// Use short URL or long URL
|
||||||
if ($file_module_config->download_short_url === 'Y' && config('use_rewrite'))
|
if ($file_module_config->download_short_url === 'Y' && config('use_rewrite'))
|
||||||
{
|
{
|
||||||
|
|
@ -399,7 +399,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$url = getNotEncodedUrl('', 'module', 'file', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key, 'force_download', Context::get('force_download') === 'Y' ? 'Y' : null);
|
$url = getNotEncodedUrl('', 'module', 'file', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key, 'force_download', Context::get('force_download') === 'Y' ? 'Y' : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('X-Robots-Tag: noindex');
|
header('X-Robots-Tag: noindex');
|
||||||
header('Location: ' . $url);
|
header('Location: ' . $url);
|
||||||
Context::close();
|
Context::close();
|
||||||
|
|
@ -412,7 +412,7 @@ class FileController extends File
|
||||||
$file_srl = Context::get('file_srl');
|
$file_srl = Context::get('file_srl');
|
||||||
$file_key = Context::get('file_key');
|
$file_key = Context::get('file_key');
|
||||||
$filename_arg = Context::get('filename');
|
$filename_arg = Context::get('filename');
|
||||||
|
|
||||||
$columnList = array('source_filename', 'uploaded_filename', 'file_size');
|
$columnList = array('source_filename', 'uploaded_filename', 'file_size');
|
||||||
$file_obj = FileModel::getFile($file_srl, $columnList);
|
$file_obj = FileModel::getFile($file_srl, $columnList);
|
||||||
$file_config = FileModel::getFileConfig($file_obj->module_srl ?: null);
|
$file_config = FileModel::getFileConfig($file_obj->module_srl ?: null);
|
||||||
|
|
@ -435,13 +435,13 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check filename if given
|
// Check filename if given
|
||||||
if ($filename_arg !== null && $filename_arg !== $filename)
|
if ($filename_arg !== null && $filename_arg !== $filename)
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found');
|
throw new Rhymix\Framework\Exceptions\TargetNotFound('msg_file_not_found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
$uploaded_filename = $file_obj->uploaded_filename;
|
$uploaded_filename = $file_obj->uploaded_filename;
|
||||||
if(!file_exists($uploaded_filename))
|
if(!file_exists($uploaded_filename))
|
||||||
|
|
@ -453,7 +453,7 @@ class FileController extends File
|
||||||
if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim(trim($_SERVER['HTTP_IF_NONE_MATCH']), '\'"') === $etag)
|
if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim(trim($_SERVER['HTTP_IF_NONE_MATCH']), '\'"') === $etag)
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 304 Not Modified');
|
header('HTTP/1.1 304 Not Modified');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If client sent an If-Modified-Since header with a recent modification date, do not download again
|
// If client sent an If-Modified-Since header with a recent modification date, do not download again
|
||||||
|
|
@ -532,19 +532,19 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$download_type = 'attachment';
|
$download_type = 'attachment';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear buffer
|
// Clear buffer
|
||||||
while(ob_get_level()) ob_end_clean();
|
while(ob_get_level()) ob_end_clean();
|
||||||
|
|
||||||
// Set filename headers
|
// Set filename headers
|
||||||
header('Content-Type: ' . $mime_type);
|
header('Content-Type: ' . $mime_type);
|
||||||
header('Content-Disposition: ' . $download_type . $filename_param);
|
header('Content-Disposition: ' . $download_type . $filename_param);
|
||||||
|
|
||||||
// Set cache headers
|
// Set cache headers
|
||||||
header('Cache-Control: private; max-age=3600');
|
header('Cache-Control: private; max-age=3600');
|
||||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||||
header('Pragma: ');
|
header('Pragma: ');
|
||||||
|
|
||||||
// Set other headers
|
// Set other headers
|
||||||
header('Content-Length: ' . $range_length);
|
header('Content-Length: ' . $range_length);
|
||||||
header('Accept-Ranges: bytes');
|
header('Accept-Ranges: bytes');
|
||||||
|
|
@ -610,13 +610,13 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin !== 'Y' && !ModuleModel::isSiteAdmin($logged_info))
|
if($logged_info->is_admin !== 'Y' && !ModuleModel::isSiteAdmin($logged_info))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileSrls = Context::get('file_srls');
|
$fileSrls = Context::get('file_srls');
|
||||||
if($fileSrls) $fileSrlList = explode(',', $fileSrls);
|
if($fileSrls) $fileSrlList = explode(',', $fileSrls);
|
||||||
|
|
||||||
|
|
@ -692,7 +692,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
if(!$module_srl) return;
|
if(!$module_srl) return;
|
||||||
|
|
||||||
return $this->deleteModuleFiles($module_srl);
|
return $this->deleteModuleFiles($module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -723,7 +723,7 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
$_SESSION['upload_info'][$editor_sequence]->enabled = true;
|
$_SESSION['upload_info'][$editor_sequence]->enabled = true;
|
||||||
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl;
|
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl;
|
||||||
|
|
||||||
return $editor_sequence;
|
return $editor_sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -788,13 +788,13 @@ class FileController extends File
|
||||||
$trigger_obj->upload_target_srl = $upload_target_srl;
|
$trigger_obj->upload_target_srl = $upload_target_srl;
|
||||||
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
|
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
// A workaround for Firefox upload bug
|
// A workaround for Firefox upload bug
|
||||||
if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match))
|
if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match))
|
||||||
{
|
{
|
||||||
$file_info['name'] = base64_decode(strtr($match[1], ':', '/'));
|
$file_info['name'] = base64_decode(strtr($match[1], ':', '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set base information
|
// Set base information
|
||||||
$file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']);
|
$file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']);
|
||||||
$file_info['type'] = $file_info['original_type'] = Rhymix\Framework\MIME::getContentType($file_info['tmp_name']);
|
$file_info['type'] = $file_info['original_type'] = Rhymix\Framework\MIME::getContentType($file_info['tmp_name']);
|
||||||
|
|
@ -804,7 +804,7 @@ class FileController extends File
|
||||||
$file_info['duration'] = null;
|
$file_info['duration'] = null;
|
||||||
$file_info['thumbnail'] = null;
|
$file_info['thumbnail'] = null;
|
||||||
$file_info['converted'] = false;
|
$file_info['converted'] = false;
|
||||||
|
|
||||||
// Correct extension
|
// Correct extension
|
||||||
if($file_info['extension'])
|
if($file_info['extension'])
|
||||||
{
|
{
|
||||||
|
|
@ -818,10 +818,10 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get file module configuration
|
// Get file module configuration
|
||||||
$config = FileModel::getFileConfig($module_srl);
|
$config = FileModel::getFileConfig($module_srl);
|
||||||
|
|
||||||
// Check file extension
|
// Check file extension
|
||||||
if(!$manual_insert && !$this->user->isAdmin())
|
if(!$manual_insert && !$this->user->isAdmin())
|
||||||
{
|
{
|
||||||
|
|
@ -830,7 +830,7 @@ class FileController extends File
|
||||||
throw new Rhymix\Framework\Exception('msg_not_allowed_filetype');
|
throw new Rhymix\Framework\Exception('msg_not_allowed_filetype');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
if(!$manual_insert)
|
if(!$manual_insert)
|
||||||
{
|
{
|
||||||
|
|
@ -839,14 +839,14 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$file_info = $this->adjustUploadedImage($file_info, $config);
|
$file_info = $this->adjustUploadedImage($file_info, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// video
|
// video
|
||||||
if(in_array($file_info['extension'], ['mp4', 'webm', 'ogv']))
|
if(in_array($file_info['extension'], ['mp4', 'webm', 'ogv']))
|
||||||
{
|
{
|
||||||
$file_info = $this->adjustUploadedVideo($file_info, $config);
|
$file_info = $this->adjustUploadedVideo($file_info, $config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check file size
|
// Check file size
|
||||||
if(!$manual_insert && !$this->user->isAdmin())
|
if(!$manual_insert && !$this->user->isAdmin())
|
||||||
{
|
{
|
||||||
|
|
@ -857,7 +857,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||||
}
|
}
|
||||||
|
|
||||||
$size_args = new stdClass;
|
$size_args = new stdClass;
|
||||||
$size_args->upload_target_srl = $upload_target_srl;
|
$size_args->upload_target_srl = $upload_target_srl;
|
||||||
$output = executeQuery('file.getAttachedFileSize', $size_args);
|
$output = executeQuery('file.getAttachedFileSize', $size_args);
|
||||||
|
|
@ -866,7 +866,7 @@ class FileController extends File
|
||||||
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
throw new Rhymix\Framework\Exception('msg_exceeds_limit_size');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->file_srl = getNextSequence();
|
$args->file_srl = getNextSequence();
|
||||||
$args->regdate = date('YmdHis');
|
$args->regdate = date('YmdHis');
|
||||||
|
|
@ -880,20 +880,20 @@ class FileController extends File
|
||||||
$args->width = $file_info['width'];
|
$args->width = $file_info['width'];
|
||||||
$args->height = $file_info['height'];
|
$args->height = $file_info['height'];
|
||||||
$args->duration = $file_info['duration'];
|
$args->duration = $file_info['duration'];
|
||||||
|
|
||||||
// Set original type
|
// Set original type
|
||||||
$args->original_type = null;
|
$args->original_type = null;
|
||||||
if($file_info['type'] !== $file_info['original_type'])
|
if($file_info['type'] !== $file_info['original_type'])
|
||||||
{
|
{
|
||||||
$args->original_type = $file_info['original_type'];
|
$args->original_type = $file_info['original_type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add changed extension
|
// Add changed extension
|
||||||
if($file_info['extension'] && $file_info['extension'] !== $file_info['original_extension'])
|
if($file_info['extension'] && $file_info['extension'] !== $file_info['original_extension'])
|
||||||
{
|
{
|
||||||
$args->source_filename .= '.' . $file_info['extension'];
|
$args->source_filename .= '.' . $file_info['extension'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set storage path by checking if the attachement is an image or other kinds of file
|
// Set storage path by checking if the attachement is an image or other kinds of file
|
||||||
if($direct = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename))
|
if($direct = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename))
|
||||||
{
|
{
|
||||||
|
|
@ -903,7 +903,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$storage_path = $this->getStoragePath('binaries', $args->file_srl, $module_srl, $upload_target_srl, $args->regdate);
|
$storage_path = $this->getStoragePath('binaries', $args->file_srl, $module_srl, $upload_target_srl, $args->regdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config->allow_multimedia_direct_download !== 'N')
|
if($config->allow_multimedia_direct_download !== 'N')
|
||||||
{
|
{
|
||||||
$args->direct_download = $direct ? 'Y' : 'N';
|
$args->direct_download = $direct ? 'Y' : 'N';
|
||||||
|
|
@ -912,13 +912,13 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$args->direct_download = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename, false) ? 'Y' : 'N';
|
$args->direct_download = Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($args->source_filename, false) ? 'Y' : 'N';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a directory
|
// Create a directory
|
||||||
if(!Rhymix\Framework\Storage::isDirectory($storage_path) && !Rhymix\Framework\Storage::createDirectory($storage_path))
|
if(!Rhymix\Framework\Storage::isDirectory($storage_path) && !Rhymix\Framework\Storage::createDirectory($storage_path))
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exception('msg_not_permitted_create');
|
throw new Rhymix\Framework\Exception('msg_not_permitted_create');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set move type and uploaded filename
|
// Set move type and uploaded filename
|
||||||
$move_type = $manual_insert ? 'copy' : '';
|
$move_type = $manual_insert ? 'copy' : '';
|
||||||
if($file_info['converted'] || starts_with(RX_BASEDIR . 'files/attach/chunks/', $file_info['tmp_name']))
|
if($file_info['converted'] || starts_with(RX_BASEDIR . 'files/attach/chunks/', $file_info['tmp_name']))
|
||||||
|
|
@ -931,7 +931,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$uploaded_filename = $storage_path . Rhymix\Framework\Security::getRandom(32, 'hex') . $extension;
|
$uploaded_filename = $storage_path . Rhymix\Framework\Security::getRandom(32, 'hex') . $extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the uploaded file
|
// Move the uploaded file
|
||||||
if(!Rhymix\Framework\Storage::moveUploadedFile($file_info['tmp_name'], $uploaded_filename, $move_type))
|
if(!Rhymix\Framework\Storage::moveUploadedFile($file_info['tmp_name'], $uploaded_filename, $move_type))
|
||||||
{
|
{
|
||||||
|
|
@ -939,7 +939,7 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
$args->uploaded_filename = './' . substr($uploaded_filename, strlen(RX_BASEDIR));
|
$args->uploaded_filename = './' . substr($uploaded_filename, strlen(RX_BASEDIR));
|
||||||
$args->file_size = @filesize($uploaded_filename);
|
$args->file_size = @filesize($uploaded_filename);
|
||||||
|
|
||||||
// Move the generated thumbnail image
|
// Move the generated thumbnail image
|
||||||
if($file_info['thumbnail'])
|
if($file_info['thumbnail'])
|
||||||
{
|
{
|
||||||
|
|
@ -953,10 +953,10 @@ class FileController extends File
|
||||||
$args->thumbnail_filename = './' . substr($thumbnail_filename, strlen(RX_BASEDIR));
|
$args->thumbnail_filename = './' . substr($thumbnail_filename, strlen(RX_BASEDIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// Insert file information
|
// Insert file information
|
||||||
$output = executeQuery('file.insertFile', $args);
|
$output = executeQuery('file.insertFile', $args);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -965,7 +965,7 @@ class FileController extends File
|
||||||
$this->deleteFile(array($args));
|
$this->deleteFile(array($args));
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert changelog
|
// Insert changelog
|
||||||
if($config->save_changelog === 'Y')
|
if($config->save_changelog === 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -983,14 +983,14 @@ class FileController extends File
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('file.insertFile', 'after', $args);
|
ModuleHandler::triggerCall('file.insertFile', 'after', $args);
|
||||||
|
|
||||||
$_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true;
|
$_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true;
|
||||||
|
|
||||||
$output->add('file_srl', $args->file_srl);
|
$output->add('file_srl', $args->file_srl);
|
||||||
$output->add('file_size', $args->file_size);
|
$output->add('file_size', $args->file_size);
|
||||||
$output->add('sid', $args->sid);
|
$output->add('sid', $args->sid);
|
||||||
|
|
@ -1000,10 +1000,10 @@ class FileController extends File
|
||||||
$output->add('uploaded_filename', $args->uploaded_filename);
|
$output->add('uploaded_filename', $args->uploaded_filename);
|
||||||
$output->add('thumbnail_filename', $args->thumbnail_filename);
|
$output->add('thumbnail_filename', $args->thumbnail_filename);
|
||||||
$output->add('original_type', $args->original_type);
|
$output->add('original_type', $args->original_type);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust uploaded image
|
* Adjust uploaded image
|
||||||
*/
|
*/
|
||||||
|
|
@ -1014,11 +1014,11 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set image size
|
// Set image size
|
||||||
$file_info['width'] = $image_info['width'];
|
$file_info['width'] = $image_info['width'];
|
||||||
$file_info['height'] = $image_info['height'];
|
$file_info['height'] = $image_info['height'];
|
||||||
|
|
||||||
// Set base information
|
// Set base information
|
||||||
$force = false;
|
$force = false;
|
||||||
$adjusted = [
|
$adjusted = [
|
||||||
|
|
@ -1029,7 +1029,7 @@ class FileController extends File
|
||||||
'rotate' => 0,
|
'rotate' => 0,
|
||||||
];
|
];
|
||||||
$is_animated = Rhymix\Framework\Image::isAnimatedGIF($file_info['tmp_name']);
|
$is_animated = Rhymix\Framework\Image::isAnimatedGIF($file_info['tmp_name']);
|
||||||
|
|
||||||
// Adjust image type
|
// Adjust image type
|
||||||
if ($config->image_autoconv['gif2mp4'] && $is_animated && function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command))
|
if ($config->image_autoconv['gif2mp4'] && $is_animated && function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command))
|
||||||
{
|
{
|
||||||
|
|
@ -1047,7 +1047,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$adjusted['type'] = 'jpg';
|
$adjusted['type'] = 'jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust image rotation
|
// Adjust image rotation
|
||||||
if ($config->image_autorotate && $image_info['type'] === 'jpg')
|
if ($config->image_autorotate && $image_info['type'] === 'jpg')
|
||||||
{
|
{
|
||||||
|
|
@ -1062,7 +1062,7 @@ class FileController extends File
|
||||||
$adjusted['rotate'] = $rotate;
|
$adjusted['rotate'] = $rotate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust image size
|
// Adjust image size
|
||||||
if ($config->max_image_size_action && ($config->max_image_width || $config->max_image_height) && (!$this->user->isAdmin() || $config->max_image_size_admin === 'Y'))
|
if ($config->max_image_size_action && ($config->max_image_width || $config->max_image_height) && (!$this->user->isAdmin() || $config->max_image_size_admin === 'Y'))
|
||||||
{
|
{
|
||||||
|
|
@ -1081,7 +1081,7 @@ class FileController extends File
|
||||||
$resize_height = $config->max_image_height;
|
$resize_height = $config->max_image_height;
|
||||||
$exceeded++;
|
$exceeded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exceeded)
|
if ($exceeded)
|
||||||
{
|
{
|
||||||
// Block upload
|
// Block upload
|
||||||
|
|
@ -1101,7 +1101,7 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
throw new Rhymix\Framework\Exception($message);
|
throw new Rhymix\Framework\Exception($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$adjusted['width'] = (int)$resize_width;
|
$adjusted['width'] = (int)$resize_width;
|
||||||
$adjusted['height'] = (int)$resize_height;
|
$adjusted['height'] = (int)$resize_height;
|
||||||
if (!$is_animated && $adjusted['type'] === $image_info['type'] && $config->max_image_size_same_format !== 'Y')
|
if (!$is_animated && $adjusted['type'] === $image_info['type'] && $config->max_image_size_same_format !== 'Y')
|
||||||
|
|
@ -1110,7 +1110,7 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set force for remove EXIF data
|
// Set force for remove EXIF data
|
||||||
if($config->image_remove_exif_data && $image_info['type'] === 'jpg' && function_exists('exif_read_data'))
|
if($config->image_remove_exif_data && $image_info['type'] === 'jpg' && function_exists('exif_read_data'))
|
||||||
{
|
{
|
||||||
|
|
@ -1123,7 +1123,7 @@ class FileController extends File
|
||||||
$force = true;
|
$force = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert image if adjusted
|
// Convert image if adjusted
|
||||||
if (
|
if (
|
||||||
$force ||
|
$force ||
|
||||||
|
|
@ -1134,13 +1134,13 @@ class FileController extends File
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$output_name = $file_info['tmp_name'] . '.converted.' . $adjusted['type'];
|
$output_name = $file_info['tmp_name'] . '.converted.' . $adjusted['type'];
|
||||||
|
|
||||||
// Generate an output file
|
// Generate an output file
|
||||||
if ($adjusted['type'] === 'mp4')
|
if ($adjusted['type'] === 'mp4')
|
||||||
{
|
{
|
||||||
$adjusted['width'] -= $adjusted['width'] % 2;
|
$adjusted['width'] -= $adjusted['width'] % 2;
|
||||||
$adjusted['height'] -= $adjusted['height'] % 2;
|
$adjusted['height'] -= $adjusted['height'] % 2;
|
||||||
|
|
||||||
// Convert using ffmpeg
|
// Convert using ffmpeg
|
||||||
$command = \RX_WINDOWS ? escapeshellarg($config->ffmpeg_command) : $config->ffmpeg_command;
|
$command = \RX_WINDOWS ? escapeshellarg($config->ffmpeg_command) : $config->ffmpeg_command;
|
||||||
$command .= ' -nostdin -i ' . escapeshellarg($file_info['tmp_name']);
|
$command .= ' -nostdin -i ' . escapeshellarg($file_info['tmp_name']);
|
||||||
|
|
@ -1149,7 +1149,7 @@ class FileController extends File
|
||||||
$command .= ' ' . escapeshellarg($output_name);
|
$command .= ' ' . escapeshellarg($output_name);
|
||||||
@exec($command, $output, $return_var);
|
@exec($command, $output, $return_var);
|
||||||
$result = $return_var === 0 ? true : false;
|
$result = $return_var === 0 ? true : false;
|
||||||
|
|
||||||
// Generate a thumbnail image
|
// Generate a thumbnail image
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|
@ -1164,7 +1164,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$result = FileHandler::createImageFile($file_info['tmp_name'], $output_name, $adjusted['width'], $adjusted['height'], $adjusted['type'], 'fill', $adjusted['quality'], $adjusted['rotate']);
|
$result = FileHandler::createImageFile($file_info['tmp_name'], $output_name, $adjusted['width'], $adjusted['height'], $adjusted['type'], 'fill', $adjusted['quality'], $adjusted['rotate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change to information in the output file
|
// Change to information in the output file
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|
@ -1177,10 +1177,10 @@ class FileController extends File
|
||||||
$file_info['converted'] = true;
|
$file_info['converted'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust uploaded video
|
* Adjust uploaded video
|
||||||
*/
|
*/
|
||||||
|
|
@ -1190,7 +1190,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Analyze video file
|
// Analyze video file
|
||||||
$command = \RX_WINDOWS ? escapeshellarg($config->ffprobe_command) : $config->ffprobe_command;
|
$command = \RX_WINDOWS ? escapeshellarg($config->ffprobe_command) : $config->ffprobe_command;
|
||||||
$command .= ' -v quiet -print_format json -show_streams';
|
$command .= ' -v quiet -print_format json -show_streams';
|
||||||
|
|
@ -1200,7 +1200,7 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get stream information
|
// Get stream information
|
||||||
$stream_info = [];
|
$stream_info = [];
|
||||||
foreach ($output['streams'] as $info)
|
foreach ($output['streams'] as $info)
|
||||||
|
|
@ -1211,12 +1211,12 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set video size
|
// Set video size
|
||||||
$file_info['width'] = (int)$stream_info['video']['width'];
|
$file_info['width'] = (int)$stream_info['video']['width'];
|
||||||
$file_info['height'] = (int)$stream_info['video']['height'];
|
$file_info['height'] = (int)$stream_info['video']['height'];
|
||||||
$file_info['duration'] = (int)$stream_info['video']['duration'];
|
$file_info['duration'] = (int)$stream_info['video']['duration'];
|
||||||
|
|
||||||
// MP4
|
// MP4
|
||||||
if ($file_info['extension'] === 'mp4')
|
if ($file_info['extension'] === 'mp4')
|
||||||
{
|
{
|
||||||
|
|
@ -1226,7 +1226,7 @@ class FileController extends File
|
||||||
$file_info['original_type'] = 'image/gif';
|
$file_info['original_type'] = 'image/gif';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a thumbnail image
|
// Generate a thumbnail image
|
||||||
if ($config->video_thumbnail)
|
if ($config->video_thumbnail)
|
||||||
{
|
{
|
||||||
|
|
@ -1240,10 +1240,10 @@ class FileController extends File
|
||||||
$file_info['thumbnail'] = $thumbnail_name;
|
$file_info['thumbnail'] = $thumbnail_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the attachment
|
* Delete the attachment
|
||||||
*
|
*
|
||||||
|
|
@ -1277,16 +1277,16 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
$file_list = explode(',', $file_list);
|
$file_list = explode(',', $file_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($file_list))
|
if(empty($file_list))
|
||||||
{
|
{
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = FileModel::getFileConfig();
|
$config = FileModel::getFileConfig();
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
foreach($file_list as $file)
|
foreach($file_list as $file)
|
||||||
{
|
{
|
||||||
if(!is_object($file))
|
if(!is_object($file))
|
||||||
|
|
@ -1297,16 +1297,16 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
$file = FileModel::getFile($file_srl);
|
$file = FileModel::getFile($file_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($file->file_srl))
|
if(empty($file->file_srl))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger (before)
|
// Call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $file);
|
$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $file);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
// Remove from the DB
|
// Remove from the DB
|
||||||
$output = executeQuery('file.deleteFile', $file);
|
$output = executeQuery('file.deleteFile', $file);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -1314,7 +1314,7 @@ class FileController extends File
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config->save_changelog === 'Y')
|
if($config->save_changelog === 'Y')
|
||||||
{
|
{
|
||||||
$clargs = new stdClass;
|
$clargs = new stdClass;
|
||||||
|
|
@ -1329,16 +1329,16 @@ class FileController extends File
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If successfully deleted, remove the file
|
// If successfully deleted, remove the file
|
||||||
Rhymix\Framework\Storage::delete(FileHandler::getRealPath($file->uploaded_filename));
|
Rhymix\Framework\Storage::delete(FileHandler::getRealPath($file->uploaded_filename));
|
||||||
|
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
ModuleHandler::triggerCall('file.deleteFile', 'after', $file);
|
ModuleHandler::triggerCall('file.deleteFile', 'after', $file);
|
||||||
|
|
||||||
// Remove empty directories
|
// Remove empty directories
|
||||||
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->uploaded_filename)), true);
|
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->uploaded_filename)), true);
|
||||||
|
|
||||||
// Remove thumbnail
|
// Remove thumbnail
|
||||||
if ($file->thumbnail_filename)
|
if ($file->thumbnail_filename)
|
||||||
{
|
{
|
||||||
|
|
@ -1346,11 +1346,11 @@ class FileController extends File
|
||||||
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->thumbnail_filename)), true);
|
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($file->thumbnail_filename)), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all attachments of a particular document
|
* Delete all attachments of a particular document
|
||||||
*
|
*
|
||||||
|
|
@ -1361,17 +1361,17 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
// Get a list of attachements
|
// Get a list of attachements
|
||||||
$file_list = FileModel::getFiles($upload_target_srl);
|
$file_list = FileModel::getFiles($upload_target_srl);
|
||||||
|
|
||||||
// Success returned if no attachement exists
|
// Success returned if no attachement exists
|
||||||
if(empty($file_list))
|
if(empty($file_list))
|
||||||
{
|
{
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the file
|
// Delete the file
|
||||||
return $this->deleteFile($file_list);
|
return $this->deleteFile($file_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the attachment of a particular module
|
* Delete the attachment of a particular module
|
||||||
*
|
*
|
||||||
|
|
@ -1388,11 +1388,11 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the file
|
// Delete the file
|
||||||
return $this->deleteFile($file_list);
|
return $this->deleteFile($file_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move an attachement to the other document
|
* Move an attachement to the other document
|
||||||
*
|
*
|
||||||
|
|
@ -1413,11 +1413,11 @@ class FileController extends File
|
||||||
$config = FileModel::getFileConfig($module_srl);
|
$config = FileModel::getFileConfig($module_srl);
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
foreach($file_list as $i => $file_info)
|
foreach($file_list as $i => $file_info)
|
||||||
{
|
{
|
||||||
$old_file = $file_info->uploaded_filename;
|
$old_file = $file_info->uploaded_filename;
|
||||||
|
|
||||||
// Determine the file path by checking if the file is an image or other kinds
|
// Determine the file path by checking if the file is an image or other kinds
|
||||||
if (Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($file_info->source_filename))
|
if (Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($file_info->source_filename))
|
||||||
{
|
{
|
||||||
|
|
@ -1432,19 +1432,19 @@ class FileController extends File
|
||||||
$random_filename = basename($file_info->uploaded_filename) ?: Rhymix\Framework\Security::getRandom(32, 'hex');
|
$random_filename = basename($file_info->uploaded_filename) ?: Rhymix\Framework\Security::getRandom(32, 'hex');
|
||||||
$new_file = $path . $random_filename;
|
$new_file = $path . $random_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass if a target document to move is same
|
// Pass if a target document to move is same
|
||||||
if($old_file === $new_file) continue;
|
if($old_file === $new_file) continue;
|
||||||
|
|
||||||
// Create a directory
|
// Create a directory
|
||||||
FileHandler::makeDir($path);
|
FileHandler::makeDir($path);
|
||||||
|
|
||||||
// Move the file
|
// Move the file
|
||||||
FileHandler::rename($old_file, $new_file);
|
FileHandler::rename($old_file, $new_file);
|
||||||
|
|
||||||
// Delete old path
|
// Delete old path
|
||||||
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($old_file)), true);
|
Rhymix\Framework\Storage::deleteEmptyDirectory(dirname(FileHandler::getRealPath($old_file)), true);
|
||||||
|
|
||||||
// Update DB information
|
// Update DB information
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->file_srl = $file_info->file_srl;
|
$args->file_srl = $file_info->file_srl;
|
||||||
|
|
@ -1452,7 +1452,7 @@ class FileController extends File
|
||||||
$args->module_srl = $file_info->module_srl;
|
$args->module_srl = $file_info->module_srl;
|
||||||
$args->upload_target_srl = $target_srl;
|
$args->upload_target_srl = $target_srl;
|
||||||
$output = executeQuery('file.updateFile', $args);
|
$output = executeQuery('file.updateFile', $args);
|
||||||
|
|
||||||
if($config->save_changelog === 'Y')
|
if($config->save_changelog === 'Y')
|
||||||
{
|
{
|
||||||
$clargs = new stdClass;
|
$clargs = new stdClass;
|
||||||
|
|
@ -1469,18 +1469,18 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
return new BaseObject();
|
return new BaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyFile($source_file, $module_srl, $upload_target_srl, &$content = null)
|
function copyFile($source_file, $module_srl, $upload_target_srl, &$content = null)
|
||||||
{
|
{
|
||||||
$file_info = array();
|
$file_info = array();
|
||||||
$file_info['name'] = $source_file->source_filename;
|
$file_info['name'] = $source_file->source_filename;
|
||||||
$file_info['tmp_name'] = $source_file->uploaded_filename;
|
$file_info['tmp_name'] = $source_file->uploaded_filename;
|
||||||
$copied_file = $this->insertFile($file_info, $module_srl, $upload_target_srl, 0, true);
|
$copied_file = $this->insertFile($file_info, $module_srl, $upload_target_srl, 0, true);
|
||||||
|
|
||||||
if($content)
|
if($content)
|
||||||
{
|
{
|
||||||
// if image/video files
|
// if image/video files
|
||||||
|
|
@ -1497,23 +1497,23 @@ class FileController extends File
|
||||||
$content = str_replace('sid=' . $source_file->sid, 'sid=' . $copied_file->get('sid'), $content);
|
$content = str_replace('sid=' . $source_file->sid, 'sid=' . $copied_file->get('sid'), $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $copied_file;
|
return $copied_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyFiles($source_file_list, $module_srl, $upload_target_srl, &$content = null)
|
function copyFiles($source_file_list, $module_srl, $upload_target_srl, &$content = null)
|
||||||
{
|
{
|
||||||
if(!is_array($source_file_list))
|
if(!is_array($source_file_list))
|
||||||
{
|
{
|
||||||
$source_file_list = FileModel::getFiles($source_file_list, array(), 'file_srl', true);
|
$source_file_list = FileModel::getFiles($source_file_list, array(), 'file_srl', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($source_file_list as $source_file)
|
foreach($source_file_list as $source_file)
|
||||||
{
|
{
|
||||||
$this->copyFile($source_file, $module_srl, $upload_target_srl, $content);
|
$this->copyFile($source_file, $module_srl, $upload_target_srl, $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function procFileSetCoverImage()
|
public function procFileSetCoverImage()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
@ -1535,7 +1535,7 @@ class FileController extends File
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
$args->cover_image = 'N';
|
$args->cover_image = 'N';
|
||||||
$output = executeQuery('file.updateClearCoverImage', $args);
|
$output = executeQuery('file.updateClearCoverImage', $args);
|
||||||
if(!$output->toBool())
|
if(!$output->toBool())
|
||||||
|
|
@ -1565,10 +1565,10 @@ class FileController extends File
|
||||||
$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3));
|
$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3));
|
||||||
Filehandler::removeFilesInDir($thumbnail_path);
|
Filehandler::removeFilesInDir($thumbnail_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine storage path based on file.folder_structure configuration.
|
* Determine storage path based on file.folder_structure configuration.
|
||||||
*
|
*
|
||||||
* @param string $file_type images or binary
|
* @param string $file_type images or binary
|
||||||
* @param int $file_srl
|
* @param int $file_srl
|
||||||
* @param int $module_srl
|
* @param int $module_srl
|
||||||
|
|
@ -1584,13 +1584,13 @@ class FileController extends File
|
||||||
$module_srl = intval($module_srl);
|
$module_srl = intval($module_srl);
|
||||||
$upload_target_srl = $upload_target_srl ?: $file_srl;
|
$upload_target_srl = $upload_target_srl ?: $file_srl;
|
||||||
$regdate = $regdate ?: date('YmdHis');
|
$regdate = $regdate ?: date('YmdHis');
|
||||||
|
|
||||||
// 시스템 설정 참고 (기존 사용자는 1, 신규 설치시 2가 기본값임)
|
// 시스템 설정 참고 (기존 사용자는 1, 신규 설치시 2가 기본값임)
|
||||||
$folder_structure = config('file.folder_structure');
|
$folder_structure = config('file.folder_structure');
|
||||||
|
|
||||||
// 기본 경로 지정
|
// 기본 경로 지정
|
||||||
$prefix = $absolute_path ? \RX_BASEDIR : './';
|
$prefix = $absolute_path ? \RX_BASEDIR : './';
|
||||||
|
|
||||||
// 2: 년월일 단위로 정리
|
// 2: 년월일 단위로 정리
|
||||||
if ($folder_structure == 2)
|
if ($folder_structure == 2)
|
||||||
{
|
{
|
||||||
|
|
@ -1603,7 +1603,7 @@ class FileController extends File
|
||||||
return sprintf('%sfiles/attach/%s/%d/%s', $prefix, $file_type, $module_srl, $components);
|
return sprintf('%sfiles/attach/%s/%d/%s', $prefix, $file_type, $module_srl, $components);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the attachment where a key is upload_target_srl and then return java script code
|
* Find the attachment where a key is upload_target_srl and then return java script code
|
||||||
*
|
*
|
||||||
|
|
@ -1616,34 +1616,34 @@ class FileController extends File
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerMoveDocument($obj)
|
function triggerMoveDocument($obj)
|
||||||
{
|
{
|
||||||
$obj->upload_target_srls = $obj->document_srls;
|
$obj->upload_target_srls = $obj->document_srls;
|
||||||
executeQuery('file.updateFileModule', $obj);
|
executeQuery('file.updateFileModule', $obj);
|
||||||
executeQuery('file.updateFileModuleComment', $obj);
|
executeQuery('file.updateFileModuleComment', $obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerAddCopyDocument(&$obj)
|
function triggerAddCopyDocument(&$obj)
|
||||||
{
|
{
|
||||||
if(!$obj->source->uploaded_count)
|
if(!$obj->source->uploaded_count)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
|
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerAddCopyCommentByDocument(&$obj)
|
function triggerAddCopyCommentByDocument(&$obj)
|
||||||
{
|
{
|
||||||
if(!$obj->source->uploaded_count)
|
if(!$obj->source->uploaded_count)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
|
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerCopyModule(&$obj)
|
function triggerCopyModule(&$obj)
|
||||||
{
|
{
|
||||||
$fileConfig = ModuleModel::getModulePartConfig('file', $obj->originModuleSrl);
|
$fileConfig = ModuleModel::getModulePartConfig('file', $obj->originModuleSrl);
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get uploaded files
|
// Get uploaded files
|
||||||
if($upload_target_srl)
|
if($upload_target_srl)
|
||||||
{
|
{
|
||||||
$oDocument = DocumentModel::getDocument($upload_target_srl);
|
$oDocument = DocumentModel::getDocument($upload_target_srl);
|
||||||
|
|
||||||
// Check permissions of the comment
|
// Check permissions of the comment
|
||||||
if(!$oDocument->isExists())
|
if(!$oDocument->isExists())
|
||||||
{
|
{
|
||||||
|
|
@ -51,13 +51,13 @@ class FileModel extends File
|
||||||
$oDocument = DocumentModel::getDocument($oComment->get('document_srl'));
|
$oDocument = DocumentModel::getDocument($oComment->get('document_srl'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check permissions of the document
|
// Check permissions of the document
|
||||||
if($oDocument->isExists() && !$oDocument->isAccessible())
|
if($oDocument->isExists() && !$oDocument->isAccessible())
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check permissions of the module
|
// Check permissions of the module
|
||||||
if($module_srl = isset($oComment) ? $oComment->get('module_srl') : $oDocument->get('module_srl'))
|
if($module_srl = isset($oComment) ? $oComment->get('module_srl') : $oDocument->get('module_srl'))
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +72,7 @@ class FileModel extends File
|
||||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set file list
|
// Set file list
|
||||||
foreach(self::getFiles($upload_target_srl) as $file_info)
|
foreach(self::getFiles($upload_target_srl) as $file_info)
|
||||||
{
|
{
|
||||||
|
|
@ -94,18 +94,18 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
$obj->download_url = self::getDirectFileUrl($file_info->download_url);
|
$obj->download_url = self::getDirectFileUrl($file_info->download_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list[] = $obj;
|
$file_list[] = $obj;
|
||||||
$attached_size += $file_info->file_size;
|
$attached_size += $file_info->file_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set output
|
// Set output
|
||||||
$this->add('files', $file_list);
|
$this->add('files', $file_list);
|
||||||
$this->add('attached_size', FileHandler::filesize($attached_size));
|
$this->add('attached_size', FileHandler::filesize($attached_size));
|
||||||
$this->add('editor_sequence', $editor_sequence);
|
$this->add('editor_sequence', $editor_sequence);
|
||||||
$this->add('upload_target_srl', $upload_target_srl);
|
$this->add('upload_target_srl', $upload_target_srl);
|
||||||
|
|
||||||
// Set upload config
|
// Set upload config
|
||||||
$upload_config = self::getUploadConfig();
|
$upload_config = self::getUploadConfig();
|
||||||
if($this->user->isAdmin())
|
if($this->user->isAdmin())
|
||||||
|
|
@ -120,13 +120,13 @@ class FileModel extends File
|
||||||
$this->add('allowed_attach_size', FileHandler::filesize($upload_config->allowed_attach_size * 1024 * 1024));
|
$this->add('allowed_attach_size', FileHandler::filesize($upload_config->allowed_attach_size * 1024 * 1024));
|
||||||
$this->add('allowed_extensions', $upload_config->allowed_extensions);
|
$this->add('allowed_extensions', $upload_config->allowed_extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for compatibility
|
// for compatibility
|
||||||
$this->add('allowed_filetypes', $upload_config->allowed_filetypes);
|
$this->add('allowed_filetypes', $upload_config->allowed_filetypes);
|
||||||
$this->add('upload_status', self::getUploadStatus($attached_size));
|
$this->add('upload_status', self::getUploadStatus($attached_size));
|
||||||
$this->add('left_size', $upload_config->allowed_attach_size * 1024 * 1024 - $attached_size);
|
$this->add('left_size', $upload_config->allowed_attach_size * 1024 * 1024 - $attached_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the file is downloadable
|
* Check if the file is downloadable
|
||||||
*
|
*
|
||||||
|
|
@ -144,13 +144,13 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity
|
// Check the validity
|
||||||
if($file_info->isvalid !== 'Y')
|
if($file_info->isvalid !== 'Y')
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check download groups
|
// Check download groups
|
||||||
$config = self::getFileConfig($file_info->module_srl);
|
$config = self::getFileConfig($file_info->module_srl);
|
||||||
if($config->download_groups)
|
if($config->download_groups)
|
||||||
|
|
@ -177,10 +177,10 @@ class FileModel extends File
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the file is deletable
|
* Check if the file is deletable
|
||||||
*
|
*
|
||||||
|
|
@ -202,7 +202,7 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check permissions of the module
|
// Check permissions of the module
|
||||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($file_info->module_srl);
|
$module_info = ModuleModel::getModuleInfoByModuleSrl($file_info->module_srl);
|
||||||
if(empty($module_info->module_srl))
|
if(empty($module_info->module_srl))
|
||||||
|
|
@ -214,24 +214,24 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check permissions of the document
|
// Check permissions of the document
|
||||||
$oDocument = DocumentModel::getDocument($file_info->upload_target_srl);
|
$oDocument = DocumentModel::getDocument($file_info->upload_target_srl);
|
||||||
if($oDocument->isExists() && $oDocument->isGranted())
|
if($oDocument->isExists() && $oDocument->isGranted())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check permissions of the comment
|
// Check permissions of the comment
|
||||||
$oComment = CommentModel::getComment($file_info->upload_target_srl);
|
$oComment = CommentModel::getComment($file_info->upload_target_srl);
|
||||||
if($oComment->isExists() && $oComment->isGranted())
|
if($oComment->isExists() && $oComment->isGranted())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return number of attachments which belongs to a specific document
|
* Return number of attachments which belongs to a specific document
|
||||||
*
|
*
|
||||||
|
|
@ -266,7 +266,7 @@ class FileModel extends File
|
||||||
return sprintf('index.php?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
|
return sprintf('index.php?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return direct download file url
|
* Return direct download file url
|
||||||
*
|
*
|
||||||
|
|
@ -277,7 +277,7 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
return \RX_BASEURL . ltrim($path, './');
|
return \RX_BASEURL . ltrim($path, './');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file configurations
|
* Get file configurations
|
||||||
*
|
*
|
||||||
|
|
@ -296,7 +296,7 @@ class FileModel extends File
|
||||||
$config->$key = $value;
|
$config->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default setting if not exists
|
// Default setting if not exists
|
||||||
$config->allowed_filesize = $config->allowed_filesize ?? '2';
|
$config->allowed_filesize = $config->allowed_filesize ?? '2';
|
||||||
$config->allowed_attach_size = $config->allowed_attach_size ?? '3';
|
$config->allowed_attach_size = $config->allowed_attach_size ?? '3';
|
||||||
|
|
@ -310,7 +310,7 @@ class FileModel extends File
|
||||||
$config->video_mp4_gif_time = $config->video_mp4_gif_time ?? 0;
|
$config->video_mp4_gif_time = $config->video_mp4_gif_time ?? 0;
|
||||||
$config->ffmpeg_command = $config->ffmpeg_command ?? '/usr/bin/ffmpeg';
|
$config->ffmpeg_command = $config->ffmpeg_command ?? '/usr/bin/ffmpeg';
|
||||||
$config->ffprobe_command = $config->ffprobe_command ?? '/usr/bin/ffprobe';
|
$config->ffprobe_command = $config->ffprobe_command ?? '/usr/bin/ffprobe';
|
||||||
|
|
||||||
// Set allowed_extensions
|
// Set allowed_extensions
|
||||||
if(!isset($config->allowed_extensions))
|
if(!isset($config->allowed_extensions))
|
||||||
{
|
{
|
||||||
|
|
@ -323,10 +323,10 @@ class FileModel extends File
|
||||||
}, explode(';', $config->allowed_filetypes));
|
}, explode(';', $config->allowed_filetypes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set download_groups
|
// Set download_groups
|
||||||
$config->download_groups = is_array($config->download_grant) ? array_filter($config->download_grant) : [];
|
$config->download_groups = is_array($config->download_grant) ? array_filter($config->download_grant) : [];
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -388,7 +388,7 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileList = array();
|
$fileList = array();
|
||||||
foreach ($output->data as $file)
|
foreach ($output->data as $file)
|
||||||
{
|
{
|
||||||
|
|
@ -435,7 +435,7 @@ class FileModel extends File
|
||||||
{
|
{
|
||||||
$allowed_filesize = min($file_config->allowed_filesize * 1024 * 1024, FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')));
|
$allowed_filesize = min($file_config->allowed_filesize * 1024 * 1024, FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display upload status
|
// Display upload status
|
||||||
$upload_status = sprintf(
|
$upload_status = sprintf(
|
||||||
'%s : %s/ %s<br /> %s : %s (%s : %s)',
|
'%s : %s/ %s<br /> %s : %s (%s : %s)',
|
||||||
|
|
@ -452,7 +452,7 @@ class FileModel extends File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method for compatibility
|
* method for compatibility
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public static function getFileModuleConfig($module_srl)
|
public static function getFileModuleConfig($module_srl)
|
||||||
|
|
@ -462,7 +462,7 @@ class FileModel extends File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method for compatibility
|
* method for compatibility
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public static function getFileGrant($file_info, $member_info)
|
public static function getFileGrant($file_info, $member_info)
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,16 @@ class FileView extends File
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get file configurations of the module
|
// Get file configurations of the module
|
||||||
$config = FileModel::getFileConfig($current_module_srl);
|
$config = FileModel::getFileConfig($current_module_srl);
|
||||||
Context::set('config', $config);
|
Context::set('config', $config);
|
||||||
Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command));
|
Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command));
|
||||||
|
|
||||||
// Get a permission for group setting
|
// Get a permission for group setting
|
||||||
$group_list = MemberModel::getGroups();
|
$group_list = MemberModel::getGroups();
|
||||||
Context::set('group_list', $group_list);
|
Context::set('group_list', $group_list);
|
||||||
|
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$oTemplate = TemplateHandler::getInstance();
|
$oTemplate = TemplateHandler::getInstance();
|
||||||
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config');
|
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue