Enforce types of commonly used variables in board

This commit is contained in:
Kijin Sung 2025-03-08 15:09:00 +09:00
parent 18d1ace121
commit ea1e0ef624
2 changed files with 8 additions and 9 deletions

View file

@ -281,8 +281,7 @@ class BoardView extends Board
public function dispBoardContentView() public function dispBoardContentView()
{ {
// get the variable value // get the variable value
$document_srl = Context::get('document_srl'); $document_srl = (int)Context::get('document_srl');
$page = Context::get('page');
/** /**
* if the document exists, then get the document information * if the document exists, then get the document information
@ -555,8 +554,8 @@ class BoardView extends Board
// get the search target and keyword // get the search target and keyword
if ($this->grant->view) if ($this->grant->view)
{ {
$args->search_target = Context::get('search_target'); $args->search_target = (string)Context::get('search_target');
$args->search_keyword = Context::get('search_keyword'); $args->search_keyword = (string)Context::get('search_keyword');
} }
if(!$search_option = Context::get('search_option')) if(!$search_option = Context::get('search_option'))
@ -577,12 +576,12 @@ class BoardView extends Board
// if the category is enabled, then get the category // if the category is enabled, then get the category
if($this->module_info->use_category=='Y') if($this->module_info->use_category=='Y')
{ {
$args->category_srl = Context::get('category'); $args->category_srl = (int)Context::get('category');
} }
// setup the sort index and order index // setup the sort index and order index
$args->sort_index = Context::get('sort_index'); $args->sort_index = (string)Context::get('sort_index');
$args->order_type = Context::get('order_type'); $args->order_type = (string)Context::get('order_type');
if(!in_array($args->sort_index, $this->order_target)) 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?$this->module_info->order_target:'list_order';
@ -593,7 +592,7 @@ class BoardView extends Board
} }
// set the current page of documents // set the current page of documents
$document_srl = Context::get('document_srl'); $document_srl = (int)Context::get('document_srl');
if($document_srl && $this->module_info->skip_bottom_list_for_robot !== 'N' && isCrawler()) if($document_srl && $this->module_info->skip_bottom_list_for_robot !== 'N' && isCrawler())
{ {
Context::set('page', $args->page = null); Context::set('page', $args->page = null);

View file

@ -1449,7 +1449,7 @@ class DocumentModel extends Document
$query_id = null; $query_id = null;
$use_division = false; $use_division = false;
$search_target = $searchOpt->search_target ?? null; $search_target = $searchOpt->search_target ?? null;
$search_keyword = trim($searchOpt->search_keyword ?? '') ?: null; $search_keyword = strval($searchOpt->search_keyword ?? '') ?: null;
// search // search
if($search_target && $search_keyword) if($search_target && $search_keyword)