mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Merge branch 'rhymix:master' into master
This commit is contained in:
commit
a40502885e
34 changed files with 259 additions and 140 deletions
|
|
@ -281,8 +281,7 @@ class BoardView extends Board
|
|||
public function dispBoardContentView()
|
||||
{
|
||||
// get the variable value
|
||||
$document_srl = Context::get('document_srl');
|
||||
$page = Context::get('page');
|
||||
$document_srl = (int)Context::get('document_srl');
|
||||
|
||||
/**
|
||||
* if the document exists, then get the document information
|
||||
|
|
@ -541,7 +540,7 @@ class BoardView extends Board
|
|||
return;
|
||||
}
|
||||
|
||||
// setup module_srl/page number/ list number/ page count
|
||||
// Setup basic parameters such as module and page.
|
||||
$args = new stdClass();
|
||||
$args->module_srl = $this->include_modules ?: $this->module_srl;
|
||||
$args->page = intval(Context::get('page')) ?: null;
|
||||
|
|
@ -553,48 +552,78 @@ class BoardView extends Board
|
|||
$args->start_regdate = date('YmdHis', time() - ($this->module_info->include_days * 86400));
|
||||
}
|
||||
|
||||
// get the search target and keyword
|
||||
// Filter by search target and keyword.
|
||||
if ($this->grant->view)
|
||||
{
|
||||
$args->search_target = Context::get('search_target');
|
||||
$args->search_keyword = Context::get('search_keyword');
|
||||
$args->search_target = (string)Context::get('search_target');
|
||||
$args->search_keyword = (string)Context::get('search_keyword');
|
||||
|
||||
// Remove unsupported search target
|
||||
$search_option = Context::get('search_option') ?: $this->search_option;
|
||||
if ($args->search_target !== '' && !isset($search_option[$args->search_target]))
|
||||
{
|
||||
$args->search_target = '';
|
||||
$args->search_keyword = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(!$search_option = Context::get('search_option'))
|
||||
// Filter by category.
|
||||
if ($this->module_info->use_category === 'Y')
|
||||
{
|
||||
$search_option = $this->search_option;
|
||||
}
|
||||
if(!isset($search_option[$args->search_target]))
|
||||
{
|
||||
$args->search_target = '';
|
||||
$args->category_srl = (string)Context::get('category') ?: null;
|
||||
|
||||
// Support comma-separated categories #2519
|
||||
if ($args->category_srl)
|
||||
{
|
||||
$args->category_srl = array_map('intval', explode(',', $args->category_srl));
|
||||
if (count($args->category_srl) === 1)
|
||||
{
|
||||
$args->category_srl = $args->category_srl[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set member_srl for view particular member's document
|
||||
if($this->module_info->use_anonymous !== 'Y')
|
||||
// Filter by consultation member_srl, or the member_srl parameter if given.
|
||||
if ($this->consultation)
|
||||
{
|
||||
$args->member_srl = abs(Context::get('member_srl') ?? 0) ?: null;
|
||||
if ($this->module_info->use_anonymous === 'Y')
|
||||
{
|
||||
$args->member_srl = [$this->user->member_srl, $this->user->member_srl * -1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->member_srl = $this->user->member_srl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->module_info->use_anonymous !== 'Y')
|
||||
{
|
||||
$args->member_srl = abs(intval(Context::get('member_srl'))) ?: null;
|
||||
}
|
||||
}
|
||||
|
||||
// if the category is enabled, then get the category
|
||||
if($this->module_info->use_category=='Y')
|
||||
// If we are filtering by category or search keyword, use search_list_count instead of list_count.
|
||||
if (!empty($args->category_srl) || !empty($args->search_keyword))
|
||||
{
|
||||
$args->category_srl = Context::get('category');
|
||||
$args->list_count = $this->search_list_count;
|
||||
}
|
||||
|
||||
// setup the sort index and order index
|
||||
$args->sort_index = Context::get('sort_index');
|
||||
$args->order_type = Context::get('order_type');
|
||||
if(!in_array($args->sort_index, $this->order_target))
|
||||
// Setup sorting.
|
||||
$args->sort_index = (string)Context::get('sort_index');
|
||||
$args->order_type = (string)Context::get('order_type');
|
||||
if (!in_array($args->sort_index, $this->order_target ?? []))
|
||||
{
|
||||
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
|
||||
$args->sort_index = $this->module_info->order_target ?: 'list_order';
|
||||
}
|
||||
if(!in_array($args->order_type, array('asc','desc')))
|
||||
if (!in_array($args->order_type, ['asc', 'desc']))
|
||||
{
|
||||
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
|
||||
$args->order_type = $this->module_info->order_type ?: 'asc';
|
||||
}
|
||||
|
||||
// set the current page of documents
|
||||
$document_srl = Context::get('document_srl');
|
||||
// Find the page on which the current document is located.
|
||||
// This is very resource-intensive, so we only do it when necessary.
|
||||
$document_srl = (int)Context::get('document_srl') ?: null;
|
||||
if($document_srl && $this->module_info->skip_bottom_list_for_robot !== 'N' && isCrawler())
|
||||
{
|
||||
Context::set('page', $args->page = null);
|
||||
|
|
@ -618,27 +647,6 @@ class BoardView extends Board
|
|||
}
|
||||
}
|
||||
|
||||
// setup the list count to be serach list count, if the category or search keyword has been set
|
||||
if($args->category_srl ?? null || $args->search_keyword ?? null)
|
||||
{
|
||||
$args->list_count = $this->search_list_count;
|
||||
}
|
||||
|
||||
// if the consultation function is enabled, the get the logged user information
|
||||
if($this->consultation)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
if($this->module_info->use_anonymous === 'Y')
|
||||
{
|
||||
$args->member_srl = array($logged_info->member_srl, $logged_info->member_srl * -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
}
|
||||
}
|
||||
|
||||
// setup the list config variable on context
|
||||
Context::set('list_config', $this->listConfig);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue