Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Kijin Sung 2020-12-25 23:18:12 +09:00
commit 99f60cc16e
8 changed files with 57 additions and 35 deletions

View file

@ -1651,8 +1651,8 @@ class documentController extends document
*/
function declaredDocument($document_srl, $declare_message = '')
{
// Fail if session information already has a reported document
if($_SESSION['declared_document'][$document_srl])
// Fail if session already tried to report the document
if(isset($_SESSION['declared_document'][$document_srl]))
{
return new BaseObject(-1, 'failed_declared');
}
@ -1687,7 +1687,7 @@ class documentController extends document
// Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == \RX_CLIENT_IP)
{
$_SESSION['declared_document'][$document_srl] = true;
$_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
@ -1700,7 +1700,7 @@ class documentController extends document
// Pass after registering a session if author's information is same as the currently logged-in user's.
if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
{
$_SESSION['declared_document'][$document_srl] = true;
$_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
}
@ -1719,7 +1719,7 @@ class documentController extends document
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
if($output->data->count)
{
$_SESSION['declared_document'][$document_srl] = true;
$_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
@ -1835,7 +1835,7 @@ class documentController extends document
if($output->data->count <= 0 || !isset($output->data->count))
{
$_SESSION['declared_document'][$document_srl] = false;
unset($_SESSION['declared_document'][$document_srl]);
return new BaseObject(-1, 'failed_declared_cancel');
}
@ -1911,7 +1911,7 @@ class documentController extends document
$trigger_obj->declared_count = $declared_count - 1;
ModuleHandler::triggerCall('document.declaredDocumentCancel', 'after', $trigger_obj);
$_SESSION['declared_document'][$document_srl] = false;
unset($_SESSION['declared_document'][$document_srl]);
$this->setMessage('success_declared_cancel');
}

View file

@ -558,7 +558,7 @@ class documentItem extends BaseObject
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
}
return $_SESSION['declared_document'][$this->document_srl] = false;
return false;
}
function getTitle($cut_size = 0, $tail = '...')

View file

@ -304,7 +304,26 @@ class documentModel extends document
$args = new stdClass();
$args->module_srl = $obj->module_srl;
$args->category_srl = $obj->category_srl ?? null;
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
// Call trigger (before)
// This trigger can be used to set an alternative output using a different search method
unset($args->use_alternate_output);
$output = ModuleHandler::triggerCall('document.getNoticeList', 'before', $args);
if ($output instanceof BaseObject && !$output->toBool())
{
return $output;
}
// 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)
{
$output = $args->use_alternate_output;
}
else
{
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
}
if(!$output->toBool() || !$result = $output->data)
{
return;
@ -322,7 +341,10 @@ class documentModel extends document
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
self::setToAllDocumentExtraVars();
// Call trigger (after)
// This trigger can be used to modify search results
ModuleHandler::triggerCall('document.getNoticeList', 'after', $output);
return $output;
}

View file

@ -10,7 +10,7 @@ class fileAdminModel extends file
* Initialization
* @return void
*/
function init()
public function init()
{
}
@ -62,7 +62,7 @@ class fileAdminModel extends file
* @param array $columnList Column list to get from DB
* @return Object Object contains query result
*/
function getFileList($obj, $columnList = array())
public function getFileList($obj, $columnList = array())
{
$args = new stdClass();
$this->_makeSearchParam($obj, $args);
@ -75,9 +75,9 @@ class fileAdminModel extends file
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
// Set variables
$args->sort_index = $obj->sort_index;
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->page = isset($obj->page) ? ($obj->page ? $obj->page : 1) : 1;
$args->list_count = isset($obj->list_count) ? ($obj->list_count? $obj->list_count : 20) : 20;
$args->page_count = isset($obj->page_count) ? ($obj->page_count? $obj->page_count : 10) : 10;
$args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl;
if(toBool($obj->exclude_secret))
@ -124,7 +124,7 @@ class fileAdminModel extends file
* @param object $obj Search options (not used...)
* @return array
*/
function getFilesCountByGroupValid($obj = '')
public function getFilesCountByGroupValid($obj = '')
{
//$this->_makeSearchParam($obj, $args);
@ -138,7 +138,7 @@ class fileAdminModel extends file
* @param string $date Date string
* @return int
*/
function getFilesCountByDate($date = '')
public function getFilesCountByDate($date = '')
{
$args = new stdClass();
if($date)
@ -162,18 +162,17 @@ class fileAdminModel extends file
* @param object $args Result searach options
* @return void
*/
function _makeSearchParam(&$obj, &$args)
protected function _makeSearchParam(&$obj, &$args)
{
// Search options
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
$search_target = isset($obj->search_target)? ($obj->search_target? $obj->search_target : trim(Context::get('search_target'))) : trim(Context::get('search_target'));
$search_keyword = isset($obj->search_keyword)? ($obj->search_keyword? $obj->search_keyword : trim(Context::get('search_keyword'))) : trim(Context::get('search_keyword'));
if($search_target && $search_keyword)
{
switch($search_target)
{
case 'filename' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_filename = $search_keyword;
break;
case 'filesize_more' :

View file

@ -20,15 +20,15 @@
<condition operation="equal" column="files.direct_download" var="direct_download" pipe="and" />
<condition operation="below" column="files.regdate" var="regdate_before" pipe="and" />
<group pipe="and">
<condition operation="like" column="files.source_filename" var="s_filename" pipe="or" />
<condition operation="search" column="files.source_filename" var="s_filename" pipe="or" />
<condition operation="more" column="files.file_size" var="s_filesize_more" pipe="or" />
<condition operation="less" column="files.file_size" var="s_filesize_less" pipe="or" />
<condition operation="more" column="files.download_count" var="s_download_count" pipe="or" />
<condition operation="like_prefix" column="files.regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="files.ipaddress" var="s_ipaddress" pipe="or" />
<condition operation="like" column="member.user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="member.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="member.nick_name" var="s_nick_name" pipe="or" />
<condition operation="search" column="member.user_id" var="s_user_id" pipe="or" />
<condition operation="search" column="member.user_name" var="s_user_name" pipe="or" />
<condition operation="search" column="member.nick_name" var="s_nick_name" pipe="or" />
</group>
</conditions>
<navigation>

View file

@ -1,4 +1,4 @@
<query id="getFileList" action="select">
<query id="getFileListByTargetStatus" action="select">
<tables>
<table name="files" alias="files" />
<table name="member" type="left join">
@ -35,15 +35,15 @@
<condition operation="null" column="comments.is_secret" pipe="or" />
</group>
<group pipe="and">
<condition operation="like" column="files.source_filename" var="s_filename" pipe="or" />
<condition operation="search" column="files.source_filename" var="s_filename" pipe="or" />
<condition operation="more" column="files.file_size" var="s_filesize_more" pipe="or" />
<condition operation="less" column="files.file_size" var="s_filesize_less" pipe="or" />
<condition operation="more" column="files.download_count" var="s_download_count" pipe="or" />
<condition operation="like_prefix" column="files.regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="files.ipaddress" var="s_ipaddress" pipe="or" />
<condition operation="like" column="member.user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="member.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="member.nick_name" var="s_nick_name" pipe="or" />
<condition operation="search" column="member.user_id" var="s_user_id" pipe="or" />
<condition operation="search" column="member.user_name" var="s_user_name" pipe="or" />
<condition operation="search" column="member.nick_name" var="s_nick_name" pipe="or" />
</group>
</conditions>
<navigation>

View file

@ -1,4 +1,4 @@
<query id="getFilesCount" action="select">
<query id="getFilesCountByGroupValid" action="select">
<tables>
<table name="files" />
</tables>
@ -12,7 +12,7 @@
<condition operation="equal" column="isvalid" var="isvalid" pipe="and" />
<condition operation="equal" column="direct_download" var="direct_download" pipe="and" />
<group pipe="and">
<condition operation="like" column="source_filename" var="s_filename" pipe="or" />
<condition operation="search" column="source_filename" var="s_filename" pipe="or" />
<condition operation="more" column="file_size" var="s_filesize_more" pipe="or" />
<condition operation="less" column="file_size" var="s_filesize_less" pipe="or" />
<condition operation="more" column="download_count" var="s_download_count" pipe="or" />

View file

@ -23,7 +23,7 @@ class integration_searchView extends integration_search
*
* @return void
*/
function init()
public function init()
{
}
@ -32,7 +32,7 @@ class integration_searchView extends integration_search
*
* @return Object
*/
function IS()
public function IS()
{
$oFile = getClass('file');
$oModuleModel = getModel('module');
@ -114,7 +114,8 @@ class integration_searchView extends integration_search
// Set a variable for search keyword
$is_keyword = Context::get('is_keyword');
$is_keyword = escape(trim(utf8_normalize_spaces($is_keyword)));
// As the variables from GET or POST will be escaped by setRequestArguments method at Context class, the double_escape variable should be "FALSE", and also the escape function might be useful when this method was called from the other way (for not escaped keyword).
$is_keyword = escape(trim(utf8_normalize_spaces($is_keyword)), false);
if (mb_strlen($is_keyword, 'UTF-8') > 40)
{
$is_keyword = mb_substr($is_keyword, 0, 40);