From 786dace639eceae64bb16efd635f4f3c6441dd4e Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 20 Jun 2021 22:25:16 +0900 Subject: [PATCH] Fix various warnings in PHP 8.0 --- layouts/xedition/layout.html | 2 +- modules/board/board.view.php | 38 +++++++++---------- modules/comment/comment.model.php | 16 ++++---- modules/document/document.controller.php | 16 +++++--- .../member/skins/default/comment_list.html | 2 +- .../member/skins/default/common_header.html | 4 +- .../member/skins/default/document_list.html | 8 ++-- modules/widget/widget.controller.php | 2 +- 8 files changed, 47 insertions(+), 41 deletions(-) diff --git a/layouts/xedition/layout.html b/layouts/xedition/layout.html index 3206b373b..fc51325c5 100644 --- a/layouts/xedition/layout.html +++ b/layouts/xedition/layout.html @@ -15,7 +15,7 @@ {@ $_selected_menu = null} {@ $_magazine_header = false} {@ $_onepage_header = false} - {@ $sub_header_title = $module_info->browser_title} + {@ $sub_header_title = $module_info->browser_title ?? ''} {@ $_enable_slide = false} diff --git a/modules/board/board.view.php b/modules/board/board.view.php index e3d8f7229..2f6d23ead 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -839,8 +839,6 @@ class boardView extends board $oDocument = DocumentModel::getDocument(0, $this->grant->manager); $oDocument->setDocument($document_srl); - $member_info = MemberModel::getMemberInfo($oDocument->get('member_srl')); - $savedDoc = ($oDocument->get('module_srl') == $oDocument->get('member_srl')); $oDocument->add('module_srl', $this->module_srl); @@ -862,10 +860,12 @@ class boardView extends board throw new Rhymix\Framework\Exception('msg_protect_update_content'); } } - } - if($member_info->is_admin == 'Y' && $this->user->is_admin != 'Y') - { - throw new Rhymix\Framework\Exception('msg_admin_document_no_modify'); + + $member_info = MemberModel::getMemberInfo($oDocument->get('member_srl')); + if($member_info->is_admin == 'Y' && $this->user->is_admin != 'Y') + { + throw new Rhymix\Framework\Exception('msg_admin_document_no_modify'); + } } // if the document is not granted, then back to the password input form @@ -1138,7 +1138,18 @@ class boardView extends board // get comment information $oComment = CommentModel::getComment($comment_srl, $this->grant->manager); - $member_info = MemberModel::getMemberInfo($oComment->member_srl); + // if the comment is not exited, alert an error message + if(!$oComment->isExists()) + { + return $this->dispBoardMessage('msg_not_founded'); + } + + // if the comment is not granted, then back to the password input form + if(!$oComment->isGranted()) + { + return $this->setTemplateFile('input_password_form'); + } + if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false) { if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day'))) @@ -1157,23 +1168,12 @@ class boardView extends board } } + $member_info = MemberModel::getMemberInfo($oComment->member_srl); if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') { throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify'); } - // if the comment is not exited, alert an error message - if(!$oComment->isExists()) - { - return $this->dispBoardMessage('msg_not_founded'); - } - - // if the comment is not granted, then back to the password input form - if(!$oComment->isGranted()) - { - return $this->setTemplateFile('input_password_form'); - } - // setup the comment variables on context Context::set('oSourceComment', CommentModel::getComment()); Context::set('oComment', $oComment); diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 680e93bbb..c7460ca59 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -776,12 +776,12 @@ class commentModel extends comment $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->s_member_srl = $obj->member_srl; - $args->s_module_srl = $obj->module_srl; - $args->exclude_module_srl = $obj->exclude_module_srl; - $args->statusList = $obj->statusList; - $args->document_statusList = $obj->document_statusList; - if ($obj->is_secret) + $args->s_member_srl = $obj->member_srl ?? null; + $args->s_module_srl = $obj->module_srl ?? null; + $args->exclude_module_srl = $obj->exclude_module_srl ?? null; + $args->statusList = $obj->statusList ?? null; + $args->document_statusList = $obj->document_statusList ?? null; + if (isset($obj->is_secret) && $obj->is_secret) { $args->s_is_secret = $obj->is_secret; } @@ -795,8 +795,8 @@ class commentModel extends comment } // 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')); + $search_keyword = (isset($obj->search_keyword) && $obj->search_keyword) ? $obj->search_keyword : trim(Context::get('search_keyword')); if($search_target && $search_keyword) { switch($search_target) diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 978d2ab2d..339e918cd 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -2569,7 +2569,10 @@ class documentController extends document { $child_buff = ""; // Get data of the child nodes - if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); + if($category_srl && isset($tree[$category_srl]) && $tree[$category_srl]) + { + $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); + } // List variables $expand = ($node->expand) ? $node->expand : 'N'; $group_srls = ($node->group_srls) ? $node->group_srls : ''; @@ -2620,8 +2623,8 @@ class documentController extends document $node->document_count ); - if($child_buff) $buff .= sprintf('%s', $attribute, $child_buff); - else $buff .= sprintf('', $attribute); + if($child_buff) $buff = sprintf('%s', $attribute, $child_buff); + else $buff = sprintf('', $attribute); } return $buff; } @@ -2646,9 +2649,12 @@ class documentController extends document foreach($source_node as $category_srl => $node) { // Get data from child nodes first if exist. - if($category_srl && $tree[$category_srl]){ + if($category_srl && isset($tree[$category_srl]) && $tree[$category_srl]) + { $child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff); - } else { + } + else + { $child_output = array("buff"=>"", "category_srl_list"=>array()); } diff --git a/modules/member/skins/default/comment_list.html b/modules/member/skins/default/comment_list.html index 10123674e..eef3624b3 100644 --- a/modules/member/skins/default/comment_list.html +++ b/modules/member/skins/default/comment_list.html @@ -25,7 +25,7 @@
- +
    diff --git a/modules/member/skins/default/common_header.html b/modules/member/skins/default/common_header.html index 6d930eaf4..05f4452f0 100644 --- a/modules/member/skins/default/common_header.html +++ b/modules/member/skins/default/common_header.html @@ -2,8 +2,8 @@
    -