mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Remove trailing whitespace
This commit is contained in:
parent
c881e73c1d
commit
c5267b42fd
26 changed files with 873 additions and 873 deletions
|
|
@ -43,7 +43,7 @@ class DocumentAdminController extends Document
|
|||
|
||||
$this->setMessage(sprintf(lang('msg_checked_document_is_deleted'), $document_count) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the default settings of the document module
|
||||
* @return object
|
||||
|
|
@ -56,7 +56,7 @@ class DocumentAdminController extends Document
|
|||
$config->view_count_option = Context::get('view_count_option');
|
||||
$config->icons = Context::get('icons');
|
||||
$config->micons = Context::get('micons');
|
||||
|
||||
|
||||
// Get icon skin type
|
||||
$config->icons_type = 'gif';
|
||||
$config->micons_type = 'gif';
|
||||
|
|
@ -364,7 +364,7 @@ class DocumentAdminController extends Document
|
|||
$oDocumentController->moveDocumentToTrash($args);
|
||||
|
||||
$returnUrl = Context::get('success_return_url');
|
||||
if(!$returnUrl)
|
||||
if(!$returnUrl)
|
||||
{
|
||||
$arrUrl = parse_url(Context::get('cur_url'));
|
||||
$query = "";
|
||||
|
|
@ -424,7 +424,7 @@ class DocumentAdminController extends Document
|
|||
$trash_srl = Context::get('trash_srl');
|
||||
$this->restoreTrash($trash_srl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move module of the documents
|
||||
* @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('intval', $document_srl_list);
|
||||
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->document_srls = $document_srl_list;
|
||||
$obj->list_count = count($document_srl_list);
|
||||
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
||||
$obj->module_srl = $target_module_srl;
|
||||
$obj->category_srl = $target_category_srl;
|
||||
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
// call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -461,10 +461,10 @@ class DocumentAdminController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$origin_category = array();
|
||||
$oDocumentController = getController('document');
|
||||
|
||||
|
||||
foreach($obj->document_list as $document)
|
||||
{
|
||||
// if the target module is different
|
||||
|
|
@ -472,16 +472,16 @@ class DocumentAdminController extends Document
|
|||
{
|
||||
$oDocumentController->deleteDocumentAliasByDocument($document->document_srl);
|
||||
}
|
||||
|
||||
|
||||
// if the target category is different
|
||||
if($document->category_srl != $obj->category_srl && $document->category_srl)
|
||||
{
|
||||
$origin_category[$document->category_srl] = $document->module_srl;
|
||||
}
|
||||
|
||||
|
||||
$oDocumentController->insertDocumentUpdateLog($document);
|
||||
}
|
||||
|
||||
|
||||
// update documents
|
||||
$output = executeQuery('document.updateDocumentsModule', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -489,7 +489,7 @@ class DocumentAdminController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// update extra vars
|
||||
$output = executeQuery('document.updateDocumentExtraVarsModule', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -497,10 +497,10 @@ class DocumentAdminController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// call a trigger (after)
|
||||
ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $obj);
|
||||
|
||||
|
||||
// update category count
|
||||
foreach($origin_category as $category_srl => $module_srl)
|
||||
{
|
||||
|
|
@ -510,15 +510,15 @@ class DocumentAdminController extends Document
|
|||
{
|
||||
$oDocumentController->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
||||
}
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
|
||||
// remove from cache
|
||||
foreach($obj->document_list as $document)
|
||||
{
|
||||
DocumentController::clearDocumentCache($document->document_srl);
|
||||
}
|
||||
|
||||
|
||||
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('intval', $document_srl_list);
|
||||
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->document_srls = $document_srl_list;
|
||||
$obj->list_count = count($document_srl_list);
|
||||
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
|
||||
$obj->module_srl = $target_module_srl;
|
||||
$obj->category_srl = $target_category_srl;
|
||||
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
// call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -558,10 +558,10 @@ class DocumentAdminController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$oDocumentController = getController('document');
|
||||
$extra_vars_list = getModel('document')->getDocumentExtraVarsFromDB($document_srl_list)->data;
|
||||
|
||||
|
||||
$extra_vars = array();
|
||||
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][] = $extra;
|
||||
}
|
||||
|
||||
|
||||
$copied_srls = array();
|
||||
foreach($obj->document_list as $document)
|
||||
{
|
||||
|
|
@ -583,13 +583,13 @@ class DocumentAdminController extends Document
|
|||
$copy->comment_count = 0;
|
||||
$copy->trackback_count = 0;
|
||||
$copy->password_is_hashed = true;
|
||||
|
||||
|
||||
// call a trigger (add)
|
||||
$args = new stdClass;
|
||||
$args->source = $document;
|
||||
$args->copied = $copy;
|
||||
ModuleHandler::triggerCall('document.copyDocumentModule', 'add', $args);
|
||||
|
||||
|
||||
// insert a copied document
|
||||
$output = $oDocumentController->insertDocument($copy, true, true);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -597,7 +597,7 @@ class DocumentAdminController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// insert copied extra vars of the document
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$copied_srls[$document->document_srl] = $copy->document_srl;
|
||||
}
|
||||
|
||||
|
||||
// call a trigger (after)
|
||||
$obj->copied_srls = $copied_srls;
|
||||
ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $obj);
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
|
||||
// return copied document_srls
|
||||
$output = new BaseObject();
|
||||
$output->add('copied_srls', $copied_srls);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all documents of the module
|
||||
* @param int $module_srl
|
||||
|
|
@ -633,23 +633,23 @@ class DocumentAdminController extends Document
|
|||
$args->list_count = 0;
|
||||
$args->module_srl = intval($module_srl);
|
||||
$document_list = executeQueryArray('document.getDocumentList', $args, array('document_srl'))->data;
|
||||
|
||||
|
||||
// delete documents
|
||||
$output = executeQuery('document.deleteModuleDocument', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// remove from cache
|
||||
foreach ($document_list as $document)
|
||||
{
|
||||
DocumentController::clearDocumentCache($document->document_srl);
|
||||
}
|
||||
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restore document from trash module, called by trash module
|
||||
* This method is passived
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DocumentAdminView extends Document
|
|||
$args->page = Context::get('page'); // /< 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->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
||||
if ($args->search_target === 'member_srl')
|
||||
|
|
@ -56,7 +56,7 @@ class DocumentAdminView extends Document
|
|||
$args->sort_index = 'list_order'; // /< sorting value
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
$args->statusList = array($this->getConfigStatus('public'), $this->getConfigStatus('secret'), $this->getConfigStatus('temp'));
|
||||
|
||||
|
||||
// get a list
|
||||
$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');
|
||||
|
|
@ -104,7 +104,7 @@ class DocumentAdminView extends Document
|
|||
}
|
||||
}
|
||||
Context::set('module_list', $module_list);
|
||||
|
||||
|
||||
// Get anonymous nicknames
|
||||
$anonymous_member_srls = 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->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
$args->order_type = strtolower(Context::get('order_type')) === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
|
||||
// select sort method
|
||||
$sort_index = Context::get('sort_index');
|
||||
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
|
||||
|
|
@ -184,7 +184,7 @@ class DocumentAdminView extends Document
|
|||
$sort_index = 'declared_latest';
|
||||
}
|
||||
Context::set('sort_index', $sort_index);
|
||||
|
||||
|
||||
// get latest declared list
|
||||
if ($sort_index === 'declared_latest')
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ class DocumentAdminView extends Document
|
|||
}
|
||||
else
|
||||
{
|
||||
$aliases = $output->data;
|
||||
$aliases = $output->data;
|
||||
}
|
||||
|
||||
Context::set('aliases', $aliases);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ class Document extends ModuleObject
|
|||
|
||||
/**
|
||||
* List of status texts supported by Rhymix.
|
||||
*
|
||||
*
|
||||
* Also see status constants in common/constants.php
|
||||
* and integer status codes used in the comment module.
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $statusList = array(
|
||||
|
|
@ -107,10 +107,10 @@ class Document extends ModuleObject
|
|||
// 2011. 10. 25 status index check
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 2016. 1. 27: Add a column(declare_message) for report
|
||||
|
|
@ -121,13 +121,13 @@ class Document extends ModuleObject
|
|||
|
||||
// 2019. 3. 07 #1146
|
||||
if(!$oDB->isColumnExists('document_update_log', 'reason_update')) return true;
|
||||
|
||||
|
||||
// 2017.12.21 Add an index for nick_name
|
||||
if(!$oDB->isIndexExists('documents', 'idx_nick_name')) return true;
|
||||
|
||||
|
||||
// 2018.01.24 Improve mass file deletion
|
||||
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after')) return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -217,13 +217,13 @@ class Document extends ModuleObject
|
|||
$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'))
|
||||
{
|
||||
$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'))
|
||||
{
|
||||
$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->addIndex('document_update_log', 'idx_is_admin', array('is_admin'));
|
||||
}
|
||||
|
||||
|
||||
// 2019. 3. 07 #1146
|
||||
if(!$oDB->isColumnExists('document_update_log', 'reason_update'))
|
||||
{
|
||||
$oDB->addColumn('document_update_log', 'reason_update', 'text', '', null, false, 'extra_vars');
|
||||
}
|
||||
|
||||
|
||||
// 2017.12.21 Add an index for nick_name
|
||||
if(!$oDB->isIndexExists('documents', 'idx_nick_name'))
|
||||
{
|
||||
$oDB->addIndex('documents', 'idx_nick_name', array('nick_name'));
|
||||
}
|
||||
|
||||
|
||||
// 2018.01.24 Improve mass file deletion
|
||||
if(!ModuleModel::getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$module_info = $this->module_info;
|
||||
if(!$module_info->module_srl)
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ class DocumentController extends Document
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
||||
if(!$oDocument->isExists())
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$module_info = $this->module_info;
|
||||
if(!$module_info->module_srl)
|
||||
{
|
||||
|
|
@ -106,7 +106,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exception('failed_voted_canceled');
|
||||
}
|
||||
|
||||
|
||||
$point = 1;
|
||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -171,7 +171,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
||||
}
|
||||
|
||||
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCount($document_srl, $point);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -214,7 +214,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exception('failed_blamed_canceled');
|
||||
}
|
||||
|
||||
|
||||
$point = -1;
|
||||
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -254,14 +254,14 @@ class DocumentController extends Document
|
|||
$args->ipaddress = \RX_CLIENT_IP;
|
||||
}
|
||||
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
|
||||
|
||||
|
||||
if(!$output->data->count)
|
||||
{
|
||||
return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled');
|
||||
}
|
||||
|
||||
$point = $output->data->point;
|
||||
|
||||
|
||||
// Call a trigger (before)
|
||||
$trigger_obj = new stdClass;
|
||||
$trigger_obj->member_srl = $oDocument->get('member_srl');
|
||||
|
|
@ -277,11 +277,11 @@ class DocumentController extends Document
|
|||
{
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
|
||||
// begin transaction
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
if($point != 0)
|
||||
{
|
||||
$args = new stdClass();
|
||||
|
|
@ -306,9 +306,9 @@ class DocumentController extends Document
|
|||
|
||||
// Call a trigger (after)
|
||||
ModuleHandler::triggerCall('document.updateVotedCountCancel', 'after', $trigger_obj);
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$oDocument = DocumentModel::getDocument($document_srl);
|
||||
if (!$oDocument || !$oDocument->isExists())
|
||||
{
|
||||
|
|
@ -413,14 +413,14 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
|
||||
|
||||
$output = $this->deleteDocument($document_srl);
|
||||
if ($output instanceof BaseObject && !$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete alias when module deleted
|
||||
* @param int $module_srl
|
||||
|
|
@ -521,13 +521,13 @@ class DocumentController extends Document
|
|||
// begin transaction
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
// List variables
|
||||
if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
|
||||
if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
|
||||
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
|
||||
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
||||
if($obj->homepage)
|
||||
if($obj->homepage)
|
||||
{
|
||||
$obj->homepage = escape($obj->homepage);
|
||||
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
|
||||
|
|
@ -535,17 +535,17 @@ class DocumentController extends Document
|
|||
$obj->homepage = 'http://'.$obj->homepage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
if(!$obj->email_address) $obj->email_address = '';
|
||||
if(!$isRestore) $obj->ipaddress = \RX_CLIENT_IP;
|
||||
$obj->isRestore = $isRestore ? true : false;
|
||||
|
||||
|
||||
// Sanitize variables
|
||||
$obj->document_srl = intval($obj->document_srl);
|
||||
$obj->category_srl = intval($obj->category_srl);
|
||||
$obj->module_srl = intval($obj->module_srl);
|
||||
|
||||
|
||||
// Default Status
|
||||
if($obj->status)
|
||||
{
|
||||
|
|
@ -558,14 +558,14 @@ class DocumentController extends Document
|
|||
{
|
||||
$this->_checkDocumentStatusForOldVersion($obj);
|
||||
}
|
||||
|
||||
|
||||
// can modify regdate only manager
|
||||
$grant = Context::get('grant');
|
||||
if(!$grant->manager)
|
||||
{
|
||||
unset($obj->regdate);
|
||||
}
|
||||
|
||||
|
||||
// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
|
||||
if (!isset($obj->extra_vars))
|
||||
{
|
||||
|
|
@ -586,7 +586,7 @@ class DocumentController extends Document
|
|||
unset($obj->manual_member_info);
|
||||
|
||||
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
||||
|
||||
|
||||
// Call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -665,7 +665,7 @@ class DocumentController extends Document
|
|||
{
|
||||
$obj->content = getModel('editor')->converter($obj, 'document');
|
||||
}
|
||||
|
||||
|
||||
// Remove iframe and script if not a top adminisrator in the session.
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
|
|
@ -680,7 +680,7 @@ class DocumentController extends Document
|
|||
$obj->content = utf8_mbencode($obj->content);
|
||||
|
||||
$obj->lang_code = Context::getLangType();
|
||||
|
||||
|
||||
// Insert data into the DB
|
||||
$output = executeQuery('document.insertDocument', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -718,10 +718,10 @@ class DocumentController extends Document
|
|||
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update the category if the category_srl exists.
|
||||
if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
|
||||
|
||||
|
||||
// Call a trigger (after)
|
||||
if($obj->update_log_setting === 'Y')
|
||||
{
|
||||
|
|
@ -741,7 +741,7 @@ class DocumentController extends Document
|
|||
$oDB->rollback();
|
||||
return $attachOutput;
|
||||
}
|
||||
|
||||
|
||||
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
||||
ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
|
||||
|
||||
|
|
@ -772,17 +772,17 @@ class DocumentController extends Document
|
|||
{
|
||||
return new BaseObject(-1, 'msg_security_violation');
|
||||
}
|
||||
|
||||
|
||||
if(!$source_obj->document_srl || !$obj->document_srl)
|
||||
{
|
||||
return new BaseObject(-1, 'msg_invalied_request');
|
||||
}
|
||||
|
||||
|
||||
// Sanitize variables
|
||||
$obj->document_srl = intval($obj->document_srl);
|
||||
$obj->category_srl = intval($obj->category_srl);
|
||||
$obj->module_srl = intval($obj->module_srl);
|
||||
|
||||
|
||||
// Default Status
|
||||
if($obj->status)
|
||||
{
|
||||
|
|
@ -790,7 +790,7 @@ class DocumentController extends Document
|
|||
{
|
||||
$obj->status = $this->getDefaultStatus();
|
||||
}
|
||||
|
||||
|
||||
// Do not update to temp document (point problem)
|
||||
if($obj->status == $this->getConfigStatus('temp'))
|
||||
{
|
||||
|
|
@ -801,12 +801,12 @@ class DocumentController extends Document
|
|||
{
|
||||
$this->_checkDocumentStatusForOldVersion($obj);
|
||||
}
|
||||
|
||||
|
||||
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
|
||||
unset($obj->manual_member_info);
|
||||
|
||||
$obj->uploaded_count = FileModel::getFilesCount($obj->document_srl);
|
||||
|
||||
|
||||
// Call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -817,9 +817,9 @@ class DocumentController extends Document
|
|||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
|
||||
|
||||
|
||||
$document_config = ModuleModel::getModulePartConfig('document', $obj->module_srl);
|
||||
if(!$document_config)
|
||||
{
|
||||
|
|
@ -829,7 +829,7 @@ class DocumentController extends Document
|
|||
$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
|
||||
if($bUseHistory)
|
||||
{
|
||||
$args = new stdClass;
|
||||
|
|
@ -861,16 +861,16 @@ class DocumentController extends Document
|
|||
$obj->homepage = 'http://'.$obj->homepage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
|
||||
|
||||
// can modify regdate only manager
|
||||
$grant = Context::get('grant');
|
||||
if(!$grant->manager)
|
||||
{
|
||||
unset($obj->regdate);
|
||||
}
|
||||
|
||||
|
||||
// Serialize the $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');
|
||||
}
|
||||
|
||||
|
||||
// Remove iframe and script if not a top adminisrator in the session.
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
|
|
@ -1069,7 +1069,7 @@ class DocumentController extends Document
|
|||
return $attachOutput;
|
||||
}
|
||||
$obj->updated_file_count = $attachOutput->get('updated_file_count');
|
||||
|
||||
|
||||
// Call a trigger (after)
|
||||
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)));
|
||||
|
||||
$output->add('document_srl',$obj->document_srl);
|
||||
|
||||
|
||||
//remove from cache
|
||||
self::clearDocumentCache($obj->document_srl);
|
||||
return $output;
|
||||
|
|
@ -1195,7 +1195,7 @@ class DocumentController extends Document
|
|||
$trigger_obj = $oDocument->getObjectVars();
|
||||
$trigger_obj->isEmptyTrash = $isEmptyTrash ? true : false;
|
||||
ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
|
||||
|
||||
|
||||
// declared document, log delete
|
||||
$this->_deleteDeclaredDocuments($args);
|
||||
$this->_deleteDocumentReadedLog($args);
|
||||
|
|
@ -1356,7 +1356,7 @@ class DocumentController extends Document
|
|||
$args->isvalid = 'N';
|
||||
executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
|
||||
// Call a trigger (after)
|
||||
$obj->module_srl = $oDocument->get('module_srl');
|
||||
$obj->member_srl = $oDocument->get('member_srl');
|
||||
|
|
@ -1384,7 +1384,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Get the view count option, and use the default if the value is empty or invalid.
|
||||
$valid_options = array(
|
||||
'all' => true,
|
||||
|
|
@ -1392,7 +1392,7 @@ class DocumentController extends Document
|
|||
'once' => true,
|
||||
'none' => true,
|
||||
);
|
||||
|
||||
|
||||
$config = DocumentModel::getDocumentConfig();
|
||||
if (!isset($config->view_count_option) || !isset($valid_options[$config->view_count_option]))
|
||||
{
|
||||
|
|
@ -1404,12 +1404,12 @@ class DocumentController extends Document
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Get document and user information.
|
||||
$document_srl = $oDocument->document_srl;
|
||||
$member_srl = $oDocument->get('member_srl');
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
|
||||
// Option 'some': only count once per session.
|
||||
if ($config->view_count_option != 'all' && isset($_SESSION['readed_document'][$document_srl]))
|
||||
{
|
||||
|
|
@ -1428,7 +1428,7 @@ class DocumentController extends Document
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -1440,7 +1440,7 @@ class DocumentController extends Document
|
|||
// Call a trigger when the read count is updated (before)
|
||||
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
|
||||
// Update read counts
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -1453,7 +1453,7 @@ class DocumentController extends Document
|
|||
$oDB->commit();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
@ -1577,7 +1577,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return new BaseObject(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
|
||||
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
||||
{
|
||||
if (!$eid)
|
||||
|
|
@ -1598,7 +1598,7 @@ class DocumentController extends Document
|
|||
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->module_srl = $module_srl;
|
||||
$obj->document_srl = $document_srl;
|
||||
|
|
@ -1626,7 +1626,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return new BaseObject(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
|
||||
if (is_int($idx_or_eid) || ctype_digit($idx_or_eid))
|
||||
{
|
||||
if (!$eid)
|
||||
|
|
@ -1647,7 +1647,7 @@ class DocumentController extends Document
|
|||
return new BaseObject(-1, 'Invalid eid: ' . $eid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->module_srl = $module_srl;
|
||||
$obj->document_srl = $document_srl;
|
||||
|
|
@ -1658,21 +1658,21 @@ class DocumentController extends Document
|
|||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
||||
$output = self::deleteDocumentExtraVars($module_srl, $document_srl, $idx_or_eid, $lang_code, $eid);
|
||||
if (!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$output = self::insertDocumentExtraVar($module_srl, $document_srl, $idx_or_eid, $value, $eid, $lang_code);
|
||||
if (!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -1782,7 +1782,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
|
||||
// begin transaction
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -1806,7 +1806,7 @@ class DocumentController extends Document
|
|||
|
||||
// Leave in the session information
|
||||
$_SESSION['voted_document'][$document_srl] = $trigger_obj->point;
|
||||
|
||||
|
||||
// Leave logs
|
||||
$args->point = $trigger_obj->point;
|
||||
$output = executeQuery('document.insertDocumentVotedLog', $args);
|
||||
|
|
@ -1815,7 +1815,7 @@ class DocumentController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// Call a trigger (after)
|
||||
ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj);
|
||||
|
||||
|
|
@ -1836,7 +1836,7 @@ class DocumentController extends Document
|
|||
$output->setMessage('success_blamed');
|
||||
$output->add('blamed_count', $trigger_obj->after_point);
|
||||
}
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -1862,10 +1862,10 @@ class DocumentController extends Document
|
|||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||
$declare_message = trim(htmlspecialchars($declare_message));
|
||||
|
||||
|
||||
$trigger_obj = new stdClass();
|
||||
$trigger_obj->document_srl = $document_srl;
|
||||
$trigger_obj->declared_count = $declared_count;
|
||||
|
|
@ -1890,7 +1890,7 @@ class DocumentController extends Document
|
|||
|
||||
// Get currently logged in user.
|
||||
$member_srl = $this->user->member_srl;
|
||||
|
||||
|
||||
// Check if document's author is a member.
|
||||
if($oDocument->get('member_srl'))
|
||||
{
|
||||
|
|
@ -1919,12 +1919,12 @@ class DocumentController extends Document
|
|||
$_SESSION['declared_document'][$document_srl] = false;
|
||||
return new BaseObject(-1, 'failed_declared');
|
||||
}
|
||||
|
||||
|
||||
// Fill in remaining information for logging.
|
||||
$args->member_srl = $member_srl;
|
||||
$args->ipaddress = \RX_CLIENT_IP;
|
||||
$args->declare_message = $declare_message;
|
||||
|
||||
|
||||
// begin transaction
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -1954,7 +1954,7 @@ class DocumentController extends Document
|
|||
}
|
||||
|
||||
$this->add('declared_count', $declared_count + 1);
|
||||
|
||||
|
||||
// Send message to admin
|
||||
$message_targets = array();
|
||||
$module_srl = $oDocument->get('module_srl');
|
||||
|
|
@ -2011,7 +2011,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return new BaseObject(-1, 'failed_declared_cancel');
|
||||
}
|
||||
|
||||
|
||||
// Get the original document
|
||||
$oDocument = DocumentModel::getDocument($document_srl, false, false);
|
||||
|
||||
|
|
@ -2034,7 +2034,7 @@ class DocumentController extends Document
|
|||
unset($_SESSION['declared_document'][$document_srl]);
|
||||
return new BaseObject(-1, 'failed_declared_cancel');
|
||||
}
|
||||
|
||||
|
||||
// Get current declared count
|
||||
$args = new stdClass();
|
||||
$args->document_srl = $document_srl;
|
||||
|
|
@ -2050,7 +2050,7 @@ class DocumentController extends Document
|
|||
{
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
|
||||
if($declared_count > 1)
|
||||
{
|
||||
$output = executeQuery('document.updateDeclaredDocumentCancel', $args);
|
||||
|
|
@ -2064,14 +2064,14 @@ class DocumentController extends Document
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$output = executeQuery('document.deleteDeclaredDocumentLog', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$message_targets = array();
|
||||
$module_srl = $oDocument->get('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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$trigger_obj->declared_count = $declared_count - 1;
|
||||
|
|
@ -2258,7 +2258,7 @@ class DocumentController extends Document
|
|||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->makeCategoryFile($category_info->module_srl);
|
||||
|
||||
|
||||
// remove cache
|
||||
$page = 0;
|
||||
while(true)
|
||||
|
|
@ -3022,7 +3022,7 @@ class DocumentController extends Document
|
|||
{
|
||||
@set_time_limit(0);
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
|
||||
$obj = new stdClass;
|
||||
$obj->type = Context::get('type');
|
||||
$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->send_message = $obj->manager_message || Context::get('send_default_message') == 'Y';
|
||||
$obj->return_message = '';
|
||||
|
||||
|
||||
// Check permission of target module
|
||||
if($obj->target_module_srl)
|
||||
{
|
||||
|
|
@ -3047,7 +3047,7 @@ class DocumentController extends Document
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set Cart
|
||||
$cart = Context::get('cart');
|
||||
if(!is_array($cart))
|
||||
|
|
@ -3055,21 +3055,21 @@ class DocumentController extends Document
|
|||
$cart = explode('|@|', $cart);
|
||||
}
|
||||
$obj->document_srl_list = array_unique(array_map('intval', $cart));
|
||||
|
||||
|
||||
// Set document list
|
||||
$obj->document_list = DocumentModel::getDocuments($obj->document_srl_list, false, false);
|
||||
if(empty($obj->document_list))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
// Call a trigger (before)
|
||||
$output = ModuleHandler::triggerCall('document.manage', 'before', $obj);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$oController = getAdminController('document');
|
||||
if($obj->type == 'move')
|
||||
{
|
||||
|
|
@ -3077,13 +3077,13 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||
}
|
||||
|
||||
|
||||
$output = $oController->moveDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$obj->return_message = 'success_moved';
|
||||
}
|
||||
else if($obj->type == 'copy')
|
||||
|
|
@ -3092,13 +3092,13 @@ class DocumentController extends Document
|
|||
{
|
||||
throw new Rhymix\Framework\Exception('fail_to_move');
|
||||
}
|
||||
|
||||
|
||||
$output = $oController->copyDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$obj->return_message = 'success_copied';
|
||||
}
|
||||
else if($obj->type == 'delete')
|
||||
|
|
@ -3112,14 +3112,14 @@ class DocumentController extends Document
|
|||
$obj->return_message = $output->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$obj->return_message = $obj->return_message ?: 'success_deleted';
|
||||
}
|
||||
else if($obj->type == 'trash')
|
||||
{
|
||||
$args = new stdClass;
|
||||
$args->description = $obj->manager_message;
|
||||
|
||||
|
||||
foreach ($obj->document_list as $document_srl => $oDocument)
|
||||
{
|
||||
$args->document_srl = $document_srl;
|
||||
|
|
@ -3130,7 +3130,7 @@ class DocumentController extends Document
|
|||
$obj->return_message = $output->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$obj->return_message = $obj->return_message ?: 'success_trashed';
|
||||
}
|
||||
else if($obj->type == 'cancelDeclare')
|
||||
|
|
@ -3142,17 +3142,17 @@ class DocumentController extends Document
|
|||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$obj->return_message = 'success_declare_canceled';
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
// Call a trigger (after)
|
||||
ModuleHandler::triggerCall('document.manage', 'after', $obj);
|
||||
|
||||
|
||||
// Send a message
|
||||
$actions = lang('default_message_verbs');
|
||||
if(isset($actions[$obj->type]) && $obj->send_message)
|
||||
|
|
@ -3166,7 +3166,7 @@ class DocumentController extends Document
|
|||
<ul>%1\$s</ul>
|
||||
Content;
|
||||
$document_item = '<li><a href="%1$s">%2$s</a></li>';
|
||||
|
||||
|
||||
// Set recipient
|
||||
$recipients = array();
|
||||
foreach ($obj->document_list as $document_srl => $oDocument)
|
||||
|
|
@ -3175,15 +3175,15 @@ Content;
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(!isset($recipients[$member_srl]))
|
||||
{
|
||||
$recipients[$member_srl] = array();
|
||||
}
|
||||
|
||||
|
||||
$recipients[$member_srl][] = sprintf($document_item, $oDocument->getPermanentUrl(), $oDocument->getTitleText());
|
||||
}
|
||||
|
||||
|
||||
// Send
|
||||
$oCommunicationController = getController('communication');
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$_SESSION['document_management'] = array();
|
||||
|
||||
|
||||
$this->setMessage($obj->return_message);
|
||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList'));
|
||||
}
|
||||
|
|
@ -3211,19 +3211,19 @@ Content;
|
|||
foreach ($target_module_srl as $srl)
|
||||
{
|
||||
if (!$srl) continue;
|
||||
|
||||
|
||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($srl);
|
||||
if (!$module_info->module_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$module_grant = ModuleModel::getGrant($module_info, $logged_info);
|
||||
if (!$module_grant->manager)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
|
||||
$module_srl[] = $srl;
|
||||
}
|
||||
|
||||
|
|
@ -3246,7 +3246,7 @@ Content;
|
|||
{
|
||||
$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
|
||||
}
|
||||
|
||||
|
||||
$this->setError(-1);
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
|
|
@ -3264,11 +3264,11 @@ Content;
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$obj = Context::getRequestVars();
|
||||
$obj->module_srl = $this->module_srl;
|
||||
$obj->status = $this->getConfigStatus('temp');
|
||||
|
||||
|
||||
// unset document style if not manager
|
||||
if(!$this->grant->manager)
|
||||
{
|
||||
|
|
@ -3276,9 +3276,9 @@ Content;
|
|||
unset($obj->title_color);
|
||||
unset($obj->title_bold);
|
||||
}
|
||||
|
||||
|
||||
$oDocument = DocumentModel::getDocument($obj->document_srl);
|
||||
|
||||
|
||||
// Update if already exists
|
||||
if($oDocument->isExists())
|
||||
{
|
||||
|
|
@ -3286,22 +3286,22 @@ Content;
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
|
||||
if($oDocument->get('status') != $this->getConfigStatus('temp'))
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
|
||||
$output = $this->updateDocument($oDocument, $obj);
|
||||
}
|
||||
// Otherwise, get a new
|
||||
else
|
||||
{
|
||||
$output = $this->insertDocument($obj);
|
||||
|
||||
|
||||
$oDocument = DocumentModel::getDocument($output->get('document_srl'));
|
||||
}
|
||||
|
||||
|
||||
// Set the attachment to be invalid state
|
||||
if($oDocument->hasUploadedFiles())
|
||||
{
|
||||
|
|
@ -3310,7 +3310,7 @@ Content;
|
|||
$args->upload_target_srl = $oDocument->document_srl;
|
||||
executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
|
||||
$this->setMessage('success_saved');
|
||||
$this->add('document_srl', $output->get('document_srl'));
|
||||
}
|
||||
|
|
@ -3325,7 +3325,7 @@ Content;
|
|||
{
|
||||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
|
||||
$documentSrls = Context::get('document_srls');
|
||||
if($documentSrls) $documentSrlList = explode(',', $documentSrls);
|
||||
|
||||
|
|
@ -3346,7 +3346,7 @@ Content;
|
|||
|
||||
/**
|
||||
* Clear document cache
|
||||
*
|
||||
*
|
||||
* @param int $document_srl
|
||||
* @param string $type
|
||||
*/
|
||||
|
|
@ -3365,7 +3365,7 @@ Content;
|
|||
unset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For old version, comment allow status check.
|
||||
* @param object $obj
|
||||
|
|
@ -3399,35 +3399,35 @@ Content;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateUploaedCount($document_srl_list)
|
||||
{
|
||||
if(!is_array($document_srl_list))
|
||||
{
|
||||
$document_srl_list = array($document_srl_list);
|
||||
}
|
||||
|
||||
|
||||
if(empty($document_srl_list))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$document_srl_list = array_unique($document_srl_list);
|
||||
|
||||
|
||||
foreach($document_srl_list as $document_srl)
|
||||
{
|
||||
if(!$document_srl = (int) $document_srl)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$args = new stdClass;
|
||||
$args->document_srl = $document_srl;
|
||||
$args->uploaded_count = FileModel::getFilesCount($document_srl);
|
||||
executeQuery('document.updateUploadedCount', $args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function triggerAfterDeleteFile($file)
|
||||
{
|
||||
$oDocument = DocumentModel::getDocument($file->upload_target_srl, false, false);
|
||||
|
|
@ -3435,10 +3435,10 @@ Content;
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->updateUploaedCount($file->upload_target_srl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy extra keys when module copied
|
||||
* @param object $obj
|
||||
|
|
|
|||
|
|
@ -92,11 +92,11 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$document_item = false;
|
||||
$columnList = array();
|
||||
$reload_counts = true;
|
||||
|
||||
|
||||
if ($this->columnList === false)
|
||||
{
|
||||
$reload_counts = false;
|
||||
|
|
@ -145,7 +145,7 @@ class DocumentItem extends BaseObject
|
|||
$this->document_srl = null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->document_srl = $attribute->document_srl;
|
||||
$this->lang_code = $attribute->lang_code ?? null;
|
||||
$this->adds($attribute);
|
||||
|
|
@ -154,22 +154,22 @@ class DocumentItem extends BaseObject
|
|||
$this->add('apparent_module_srl', $attribute->module_srl);
|
||||
$this->add('origin_module_srl', $attribute->module_srl);
|
||||
}
|
||||
|
||||
|
||||
// set XE_DOCUMENT_LIST
|
||||
$GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl] = $this;
|
||||
|
||||
|
||||
// set tags
|
||||
if($this->get('tags'))
|
||||
{
|
||||
$this->add('tag_list', $this->getTags());
|
||||
}
|
||||
|
||||
|
||||
// set extra vars
|
||||
if($load_extra_vars)
|
||||
{
|
||||
DocumentModel::setToAllDocumentExtraVars();
|
||||
}
|
||||
|
||||
|
||||
// set content in user language
|
||||
if(isset($GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['title']))
|
||||
{
|
||||
|
|
@ -185,24 +185,24 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return (bool) ($this->document_srl);
|
||||
}
|
||||
|
||||
|
||||
function isGranted()
|
||||
{
|
||||
if(!$this->isExists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (isset($_SESSION['granted_document'][$this->document_srl]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if ($this->grant_cache !== null)
|
||||
{
|
||||
return $this->grant_cache;
|
||||
}
|
||||
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if (!$logged_info || !$logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -216,34 +216,34 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return $this->grant_cache = true;
|
||||
}
|
||||
|
||||
|
||||
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
||||
if ($grant->manager)
|
||||
{
|
||||
return $this->grant_cache = true;
|
||||
}
|
||||
|
||||
|
||||
return $this->grant_cache = false;
|
||||
}
|
||||
|
||||
|
||||
function setGrant()
|
||||
{
|
||||
$this->grant_cache = true;
|
||||
}
|
||||
|
||||
|
||||
function setGrantForSession()
|
||||
{
|
||||
$_SESSION['granted_document'][$this->document_srl] = true;
|
||||
$this->setGrant();
|
||||
}
|
||||
|
||||
|
||||
function isAccessible($strict = false)
|
||||
{
|
||||
if(!$this->isExists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($strict)
|
||||
{
|
||||
$module_info = ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||
|
|
@ -257,28 +257,28 @@ class DocumentItem extends BaseObject
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_SESSION['accessible'][$this->document_srl]) && $_SESSION['accessible'][$this->document_srl] === $this->get('last_update'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$status_list = DocumentModel::getStatusList();
|
||||
if ($this->get('status') === $status_list['public'])
|
||||
{
|
||||
$this->setAccessible();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if ($this->isGranted())
|
||||
{
|
||||
$this->setAccessible();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function setAccessible()
|
||||
{
|
||||
if(Context::getSessionStatus())
|
||||
|
|
@ -286,7 +286,7 @@ class DocumentItem extends BaseObject
|
|||
$_SESSION['accessible'][$this->document_srl] = $this->get('last_update');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function allowComment()
|
||||
{
|
||||
// init write, document is not exists. so allow comment status is true
|
||||
|
|
@ -294,7 +294,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return (bool) ($this->get('comment_status') == 'ALLOW');
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ class DocumentItem extends BaseObject
|
|||
static $allow_trackback_status = null;
|
||||
if(is_null($allow_trackback_status))
|
||||
{
|
||||
|
||||
|
||||
// Check the tarckback module exist
|
||||
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.
|
||||
$trackback_config = ModuleModel::getModuleConfig('trackback');
|
||||
|
||||
|
||||
if(!$trackback_config)
|
||||
{
|
||||
$trackback_config = new stdClass();
|
||||
}
|
||||
|
||||
|
||||
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
|
||||
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
|
||||
else
|
||||
|
|
@ -340,7 +340,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return (bool) ($this->get('comment_status') != 'ALLOW');
|
||||
}
|
||||
|
||||
|
|
@ -348,29 +348,29 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return (bool) (!$this->get('member_srl') || $this->isGranted());
|
||||
}
|
||||
|
||||
|
||||
function isSecret()
|
||||
{
|
||||
return (bool) ($this->get('status') == DocumentModel::getConfigStatus('secret'));
|
||||
}
|
||||
|
||||
|
||||
function isNotice()
|
||||
{
|
||||
return (bool) ($this->get('is_notice') === 'Y' || $this->get('is_notice') === 'A');
|
||||
}
|
||||
|
||||
|
||||
function useNotify()
|
||||
{
|
||||
return (bool) ($this->get('notify_message') == 'Y');
|
||||
}
|
||||
|
||||
|
||||
function doCart()
|
||||
{
|
||||
if(!$this->isExists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$this->isCarted() ? $this->removeCart() : $this->addCart();
|
||||
}
|
||||
|
||||
|
|
@ -411,18 +411,18 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Return if the currently logged-in user is an author
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->member_srl == $this->get('member_srl'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// List variables
|
||||
$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));
|
||||
|
||||
|
||||
// Send a message
|
||||
$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);
|
||||
|
|
@ -439,7 +439,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return $this->get('ipaddress');
|
||||
}
|
||||
|
||||
|
||||
return '*' . strstr($this->get('ipaddress') ?? '', '.');
|
||||
}
|
||||
|
||||
|
|
@ -454,12 +454,12 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!preg_match('@^[a-z]+://@i', $url))
|
||||
{
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
|
||||
|
||||
return escape($url, false);
|
||||
}
|
||||
|
||||
|
|
@ -494,7 +494,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -554,7 +554,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -565,7 +565,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return $_SESSION['declared_document'][$this->document_srl];
|
||||
}
|
||||
|
||||
|
||||
$args = new stdClass();
|
||||
if($logged_info->member_srl)
|
||||
{
|
||||
|
|
@ -582,7 +582,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -592,10 +592,10 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$title = escape($this->getTitleText($cut_size, $tail), false);
|
||||
$this->add('title_color', trim($this->get('title_color') ?? ''));
|
||||
|
||||
|
||||
$attrs = array();
|
||||
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 $title;
|
||||
}
|
||||
|
||||
|
|
@ -619,19 +619,19 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return lang('msg_is_secret');
|
||||
}
|
||||
|
||||
|
||||
$content = $this->get('content');
|
||||
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
|
||||
if($strlen)
|
||||
{
|
||||
$content = cut_str($content, $strlen, '...');
|
||||
}
|
||||
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
|
|
@ -641,12 +641,12 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return lang('msg_is_secret');
|
||||
}
|
||||
|
||||
|
||||
$content = $this->get('content');
|
||||
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $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 = cut_str($content, $strlen, '...');
|
||||
}
|
||||
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
|
|
@ -708,18 +708,18 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return lang('msg_is_secret');
|
||||
}
|
||||
|
||||
|
||||
$content = $this->get('content');
|
||||
if(!$stripEmbedTagException)
|
||||
{
|
||||
stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
||||
}
|
||||
|
||||
|
||||
// Define a link if using a rewrite module
|
||||
if(Context::isAllowRewrite())
|
||||
{
|
||||
|
|
@ -761,7 +761,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
|
||||
}
|
||||
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
|
@ -779,31 +779,31 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$content = $this->getContent($add_popup_menu, $add_content_info, $resource_realpath, $add_xe_content_class);
|
||||
$content = getController('editor')->transComponent($content);
|
||||
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
function getSummary($str_size = 50, $tail = '...')
|
||||
{
|
||||
// Remove tags
|
||||
$content = $this->getContent(false, false);
|
||||
$content = strip_tags(preg_replace('!<(style|script)\b.+?</\\1>!is', '', $content));
|
||||
|
||||
|
||||
// Convert temporarily html entity for truncate
|
||||
$content = html_entity_decode($content, ENT_QUOTES);
|
||||
|
||||
|
||||
// Replace all whitespaces to single space
|
||||
$content = utf8_trim(utf8_normalize_spaces($content));
|
||||
|
||||
|
||||
// Truncate string
|
||||
$content = cut_str($content, $str_size, $tail);
|
||||
|
||||
|
||||
return escape($content);
|
||||
}
|
||||
|
||||
|
||||
function getRegdate($format = 'Y.m.d H:i:s', $conversion = true)
|
||||
{
|
||||
return zdate($this->get('regdate'), $format, $conversion);
|
||||
|
|
@ -854,9 +854,9 @@ class DocumentItem extends BaseObject
|
|||
*/
|
||||
public function getTrackbackUrl()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
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 !== ''; });
|
||||
return array_unique($tag_list);
|
||||
}
|
||||
|
||||
|
||||
public function getHashtags()
|
||||
{
|
||||
preg_match_all('/(?<!&)#([\pL\pN_]+)/u', strip_tags($this->get('content')), $hashtags);
|
||||
$hashtags[1] = array_map(function($str) { return escape($str, false); }, $hashtags[1]);
|
||||
return array_unique($hashtags[1]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update readed count
|
||||
* @return void
|
||||
|
|
@ -911,35 +911,35 @@ class DocumentItem extends BaseObject
|
|||
|
||||
return DocumentModel::getExtraVars($module_srl, $this->document_srl);
|
||||
}
|
||||
|
||||
|
||||
function getExtraEids()
|
||||
{
|
||||
if($this->extra_eids)
|
||||
{
|
||||
return $this->extra_eids;
|
||||
}
|
||||
|
||||
|
||||
$extra_vars = $this->getExtraVars();
|
||||
foreach($extra_vars as $idx => $key)
|
||||
{
|
||||
$this->extra_eids[$key->eid] = $key;
|
||||
}
|
||||
|
||||
|
||||
return $this->extra_eids;
|
||||
}
|
||||
|
||||
|
||||
function getExtraValue($idx)
|
||||
{
|
||||
$extra_vars = $this->getExtraVars();
|
||||
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValue() : '';
|
||||
}
|
||||
|
||||
|
||||
function getExtraValueHTML($idx)
|
||||
{
|
||||
$extra_vars = $this->getExtraVars();
|
||||
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValueHTML() : '';
|
||||
}
|
||||
|
||||
|
||||
function getExtraEidValue($eid)
|
||||
{
|
||||
$extra_eids = $this->getExtraEids();
|
||||
|
|
@ -951,7 +951,7 @@ class DocumentItem extends BaseObject
|
|||
$extra_eids = $this->getExtraEids();
|
||||
return isset($extra_eids[$eid]) ? $extra_eids[$eid]->getValueHTML() : '';
|
||||
}
|
||||
|
||||
|
||||
function getExtraVarsValue($key)
|
||||
{
|
||||
$extra_vals = unserialize($this->get('extra_vars'));
|
||||
|
|
@ -969,12 +969,12 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// cpage is a number of comment pages
|
||||
$cpageStr = sprintf('%d_cpage', $this->document_srl);
|
||||
$cpage = Context::get($cpageStr);
|
||||
|
|
@ -994,7 +994,7 @@ class DocumentItem extends BaseObject
|
|||
// Get a list of comments
|
||||
$output = CommentModel::getCommentList($this->document_srl, $cpage);
|
||||
if(!$output->toBool() || !count($output->data)) return;
|
||||
|
||||
|
||||
// Create commentItem object from a comment list
|
||||
// If admin priviledge is granted on parent posts, you can read its child posts.
|
||||
$accessible = array();
|
||||
|
|
@ -1016,7 +1016,7 @@ class DocumentItem extends BaseObject
|
|||
}
|
||||
$comment_list[$val->comment_srl] = $oCommentItem;
|
||||
}
|
||||
|
||||
|
||||
// Cache the vote log for all comments.
|
||||
$logged_info = Context::get('logged_info');
|
||||
if ($logged_info->member_srl)
|
||||
|
|
@ -1048,12 +1048,12 @@ class DocumentItem extends BaseObject
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Variable setting to be displayed on the skin
|
||||
Context::set($cpageStr, $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;
|
||||
|
||||
|
||||
// Call trigger (after)
|
||||
$output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list);
|
||||
|
||||
|
|
@ -1107,7 +1107,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
$config->thumbnail_quality = 75;
|
||||
}
|
||||
|
||||
|
||||
// If not specify its height, create a square
|
||||
if(!is_int($width))
|
||||
{
|
||||
|
|
@ -1117,7 +1117,7 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
$height = $width;
|
||||
}
|
||||
|
||||
|
||||
// Define thumbnail information
|
||||
$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);
|
||||
|
|
@ -1137,7 +1137,7 @@ class DocumentItem extends BaseObject
|
|||
return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Call trigger for custom thumbnails.
|
||||
$trigger_obj = (object)[
|
||||
'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));
|
||||
}
|
||||
|
||||
|
||||
// Get content if it does not exist.
|
||||
if($this->get('content'))
|
||||
{
|
||||
|
|
@ -1163,7 +1163,7 @@ class DocumentItem extends BaseObject
|
|||
$output = executeQuery('document.getDocument', $args);
|
||||
$content = $output->data->content;
|
||||
}
|
||||
|
||||
|
||||
// Return false if neither attachement nor image files in the document
|
||||
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $content)) return;
|
||||
|
||||
|
|
@ -1262,7 +1262,7 @@ class DocumentItem extends BaseObject
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
|
@ -1343,7 +1343,7 @@ class DocumentItem extends BaseObject
|
|||
|
||||
/**
|
||||
* Return the status code.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getStatus()
|
||||
|
|
@ -1354,7 +1354,7 @@ class DocumentItem extends BaseObject
|
|||
|
||||
/**
|
||||
* Return the status in human-readable text.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getStatusText()
|
||||
|
|
@ -1406,7 +1406,7 @@ class DocumentItem extends BaseObject
|
|||
$iconSkin = 'default';
|
||||
$iconType = 'gif';
|
||||
}
|
||||
|
||||
|
||||
$path = sprintf('%s%s', \RX_BASEURL, "modules/document/tpl/icons/$iconSkin/");
|
||||
$buff = array();
|
||||
foreach($icons as $icon)
|
||||
|
|
@ -1422,12 +1422,12 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return $this->get('uploaded_count')? true : false;
|
||||
}
|
||||
|
||||
|
|
@ -1437,22 +1437,22 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->get('uploaded_count'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!isset($this->uploadedFiles[$sortIndex]))
|
||||
{
|
||||
$this->uploadedFiles[$sortIndex] = FileModel::getFiles($this->document_srl, array(), $sortIndex, true);
|
||||
}
|
||||
|
||||
|
||||
return $this->uploadedFiles[$sortIndex];
|
||||
}
|
||||
|
||||
|
|
@ -1478,12 +1478,12 @@ class DocumentItem extends BaseObject
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->isAccessible())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1577,7 +1577,7 @@ class DocumentItem extends BaseObject
|
|||
|
||||
/**
|
||||
* Returns the apparent mid.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getApparentMid()
|
||||
|
|
@ -1587,7 +1587,7 @@ class DocumentItem extends BaseObject
|
|||
|
||||
/**
|
||||
* Returns the true mid.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getDocumentMid()
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class DocumentModel extends Document
|
|||
{
|
||||
return $_SESSION['granted_document'][$document_srl];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return document extra information from database
|
||||
* @param array $document_srls
|
||||
|
|
@ -41,7 +41,7 @@ class DocumentModel extends Document
|
|||
$args->document_srl = $document_srls;
|
||||
return executeQueryArray('document.getDocumentExtraVars', $args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extra variables for each article will not be processed bulk select and apply the macro city
|
||||
* @return void
|
||||
|
|
@ -54,10 +54,10 @@ class DocumentModel extends Document
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static $checked = array();
|
||||
static $module_extra_keys = array();
|
||||
|
||||
|
||||
// check documents
|
||||
$document_srls = array();
|
||||
foreach($_document_list as $document_srl => $oDocument)
|
||||
|
|
@ -66,16 +66,16 @@ class DocumentModel extends Document
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$checked[$document_srl] = true;
|
||||
$document_srls[] = $document_srl;
|
||||
}
|
||||
|
||||
|
||||
if(!$document_srls)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// get extra values of documents
|
||||
$extra_values = array();
|
||||
$output = self::getDocumentExtraVarsFromDB($document_srls);
|
||||
|
|
@ -85,10 +85,10 @@ class DocumentModel extends Document
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$extra_values[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
|
||||
}
|
||||
|
||||
|
||||
// set extra variables and document language
|
||||
$user_lang_code = Context::getLangType();
|
||||
foreach($document_srls as $document_srl)
|
||||
|
|
@ -97,7 +97,7 @@ class DocumentModel extends Document
|
|||
$module_srl = $oDocument->get('module_srl');
|
||||
$document_lang_code = $oDocument->get('lang_code');
|
||||
$document_extra_values = $extra_values[$document_srl] ?? [];
|
||||
|
||||
|
||||
// set XE_EXTRA_VARS
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// set extra variables of the document
|
||||
if($module_extra_keys[$module_srl])
|
||||
{
|
||||
|
|
@ -114,7 +114,7 @@ class DocumentModel extends Document
|
|||
foreach($module_extra_keys[$module_srl] as $idx => $key)
|
||||
{
|
||||
$document_extra_vars[$idx] = clone($key);
|
||||
|
||||
|
||||
// set variable value in user language
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$GLOBALS['XE_EXTRA_VARS'][$document_srl] = $document_extra_vars;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set RX_DOCUMENT_LANG
|
||||
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);
|
||||
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
|
||||
}
|
||||
|
||||
|
||||
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->order_type = 'asc';
|
||||
$output = executeQueryArray('document.getDocuments', $args, $columnList);
|
||||
|
||||
|
||||
$documents = array();
|
||||
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);
|
||||
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]->setGrant();
|
||||
}
|
||||
|
||||
|
||||
$documents[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||
}
|
||||
|
||||
|
||||
if($load_extra_vars)
|
||||
{
|
||||
self::setToAllDocumentExtraVars();
|
||||
}
|
||||
|
||||
|
||||
return $documents;
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class DocumentModel extends Document
|
|||
$obj->isExtraVars = $sort_check->isExtraVars;
|
||||
$obj->except_notice = $except_notice;
|
||||
$obj->columnList = $columnList;
|
||||
|
||||
|
||||
// Call trigger (before)
|
||||
// This trigger can be used to set an alternative output using a different search method
|
||||
unset($obj->use_alternate_output);
|
||||
|
|
@ -252,7 +252,7 @@ class DocumentModel extends Document
|
|||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -264,13 +264,13 @@ class DocumentModel extends Document
|
|||
self::_setSearchOption($obj, $args, $query_id, $use_division);
|
||||
$output = executeQueryArray($query_id, $args, $args->columnList);
|
||||
}
|
||||
|
||||
|
||||
// Return if no result or an error occurs
|
||||
if(!$output->toBool() || !$result = $output->data)
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$output->data = array();
|
||||
foreach($result as $key => $attribute)
|
||||
{
|
||||
|
|
@ -281,12 +281,12 @@ class DocumentModel extends Document
|
|||
}
|
||||
$output->data[$key] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||
}
|
||||
|
||||
|
||||
if($load_extra_vars)
|
||||
{
|
||||
self::setToAllDocumentExtraVars();
|
||||
}
|
||||
|
||||
|
||||
// Call trigger (after)
|
||||
// This trigger can be used to modify search results
|
||||
ModuleHandler::triggerCall('document.getDocumentList', 'after', $output);
|
||||
|
|
@ -324,12 +324,12 @@ class DocumentModel extends Document
|
|||
{
|
||||
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
|
||||
}
|
||||
|
||||
|
||||
if(!$output->toBool() || !$result = $output->data)
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
$output->data = array();
|
||||
foreach($result as $attribute)
|
||||
{
|
||||
|
|
@ -338,10 +338,10 @@ class DocumentModel extends Document
|
|||
$oDocument = new documentItem();
|
||||
$oDocument->setAttribute($attribute, false);
|
||||
}
|
||||
|
||||
|
||||
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
|
||||
}
|
||||
|
||||
|
||||
self::setToAllDocumentExtraVars();
|
||||
|
||||
// Call trigger (after)
|
||||
|
|
@ -446,15 +446,15 @@ class DocumentModel extends Document
|
|||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
|
||||
|
||||
|
||||
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get var_idx of extra variable from its eid
|
||||
*
|
||||
*
|
||||
* @param int $module_srl
|
||||
* @param string $eid
|
||||
* @return int|false
|
||||
|
|
@ -475,7 +475,7 @@ class DocumentModel extends Document
|
|||
|
||||
/**
|
||||
* Get eid of extra variable from its var_idx
|
||||
*
|
||||
*
|
||||
* @param int $module_srl
|
||||
* @param int $idx
|
||||
* @return string|false
|
||||
|
|
@ -493,7 +493,7 @@ class DocumentModel extends Document
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show pop-up menu of the selected posts
|
||||
* Printing, scrap, recommendations and negative, reported the Add Features
|
||||
|
|
@ -1281,7 +1281,7 @@ class DocumentModel extends Document
|
|||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting sort index
|
||||
* @param object $obj
|
||||
|
|
@ -1293,34 +1293,34 @@ class DocumentModel extends Document
|
|||
$args = new stdClass;
|
||||
$args->sort_index = $obj->sort_index ?? null;
|
||||
$args->isExtraVars = false;
|
||||
|
||||
|
||||
// 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');
|
||||
if(in_array($args->sort_index, $default_sort))
|
||||
{
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
// check it can use extra variable
|
||||
if(!$load_extra_vars || !$extra_keys = self::getExtraKeys($obj->module_srl ?? 0))
|
||||
{
|
||||
$args->sort_index = 'list_order';
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
$eids = array();
|
||||
foreach($extra_keys as $idx => $key)
|
||||
{
|
||||
$eids[] = $key->eid;
|
||||
}
|
||||
|
||||
|
||||
// check it exists in extra keys of the module
|
||||
if(!in_array($args->sort_index, $eids))
|
||||
{
|
||||
$args->sort_index = 'list_order';
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
$args->isExtraVars = true;
|
||||
return $args;
|
||||
}
|
||||
|
|
@ -1361,13 +1361,13 @@ class DocumentModel extends Document
|
|||
$args->s_is_notice = ($searchOpt->except_notice ?? false) ? 'N' : null;
|
||||
$args->statusList = $searchOpt->statusList ?? array(self::getConfigStatus('public'), self::getConfigStatus('secret'));
|
||||
$args->columnList = $searchOpt->columnList ?? array();
|
||||
|
||||
|
||||
// get directly module_srl by mid
|
||||
if(isset($searchOpt->mid) && $searchOpt->mid)
|
||||
{
|
||||
$args->module_srl = ModuleModel::getModuleSrlByMid($searchOpt->mid);
|
||||
}
|
||||
|
||||
|
||||
// add subcategories
|
||||
if(isset($args->category_srl) && $args->category_srl)
|
||||
{
|
||||
|
|
@ -1379,13 +1379,13 @@ class DocumentModel extends Document
|
|||
$args->category_srl = $categories;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// default
|
||||
$query_id = null;
|
||||
$use_division = false;
|
||||
$search_target = $searchOpt->search_target ?? null;
|
||||
$search_keyword = trim($searchOpt->search_keyword ?? '') ?: null;
|
||||
|
||||
|
||||
// search
|
||||
if($search_target && $search_keyword)
|
||||
{
|
||||
|
|
@ -1463,7 +1463,7 @@ class DocumentModel extends Document
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -1475,7 +1475,7 @@ class DocumentModel extends Document
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set query
|
||||
if(!$query_id)
|
||||
{
|
||||
|
|
@ -1499,12 +1499,12 @@ class DocumentModel extends Document
|
|||
$query_id = 'document.getDocumentList';
|
||||
}
|
||||
}
|
||||
// other queries not support to sort extra variable
|
||||
// other queries not support to sort extra variable
|
||||
elseif($searchOpt->isExtraVars)
|
||||
{
|
||||
$args->sort_index = 'list_order';
|
||||
}
|
||||
|
||||
|
||||
// division search by 5,000
|
||||
if($use_division)
|
||||
{
|
||||
|
|
@ -1512,18 +1512,18 @@ class DocumentModel extends Document
|
|||
$args->sort_index = 'list_order';
|
||||
$args->division = (int)Context::get('division');
|
||||
$args->last_division = (int)Context::get('last_division');
|
||||
|
||||
|
||||
$division_args = new stdClass;
|
||||
$division_args->module_srl = $args->module_srl;
|
||||
$division_args->exclude_module_srl = $args->exclude_module_srl;
|
||||
|
||||
|
||||
// get start point of first division
|
||||
if(Context::get('division') === null)
|
||||
{
|
||||
$division_output = executeQuery('document.getDocumentDivision', $division_args)->data;
|
||||
$args->division = $division_output ? $division_output->list_order : 0;
|
||||
}
|
||||
|
||||
|
||||
// get end point of the 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;
|
||||
$args->last_division = $division_output ? $division_output->list_order : 0;
|
||||
}
|
||||
|
||||
|
||||
Context::set('division', $args->division);
|
||||
Context::set('last_division', $args->last_division);
|
||||
}
|
||||
|
||||
|
||||
// add default prefix
|
||||
if($args->sort_index && strpos($args->sort_index, '.') === false)
|
||||
{
|
||||
|
|
@ -1581,11 +1581,11 @@ class DocumentModel extends Document
|
|||
$args->list_count = $count;
|
||||
$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
|
||||
$document_list = $output->data;
|
||||
|
||||
|
||||
if(!$document_list) return array();
|
||||
if(!is_array($document_list)) $document_list = array($document_list);
|
||||
|
||||
return $document_list;
|
||||
return $document_list;
|
||||
}
|
||||
|
||||
public static function getDocumentUpdateLog($document_srl)
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@ class DocumentView extends Document
|
|||
if(!checkCSRF())
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\SecurityViolation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$content = Context::get('content');
|
||||
|
||||
|
||||
if(Context::get('logged_info')->is_admin != 'Y')
|
||||
{
|
||||
$content = removeHackTag($content);
|
||||
}
|
||||
|
||||
|
||||
// Editor converter
|
||||
$obj = new stdClass;
|
||||
$obj->content = $content;
|
||||
|
|
@ -69,7 +69,7 @@ class DocumentView extends 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);
|
||||
Context::set('content', $content);
|
||||
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('preview_page');
|
||||
Context::set('layout', 'none');
|
||||
|
|
@ -107,7 +107,7 @@ class DocumentView extends Document
|
|||
// Set target module info
|
||||
$target_mid = Context::getRequestVars()->mid ?? '';
|
||||
$module_srl = intval(Context::get('module_srl'));
|
||||
|
||||
|
||||
// if target mid is provided
|
||||
if($target_mid && $target_mid === Context::get('mid'))
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ class DocumentView extends Document
|
|||
$module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
|
||||
$module_srl = $module_info ? $module_info->module_srl : 0;
|
||||
}
|
||||
|
||||
|
||||
Context::set('module_srl', $module_srl);
|
||||
Context::set('mid', $module_info ? $module_info->mid : '');
|
||||
Context::set('browser_title', $module_info ? $module_info->browser_title : '');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue