Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Lastorder 2025-12-24 03:07:48 +00:00
commit 881b0fbac1
58 changed files with 606 additions and 200 deletions

View file

@ -517,7 +517,7 @@ class CommentController extends Comment
*/
function insertComment($obj, $manual_inserted = FALSE, $update_document = TRUE)
{
if(!$manual_inserted && !checkCSRF())
if(!$manual_inserted && !Rhymix\Framework\Security::checkCSRF())
{
return new BaseObject(-1, 'msg_security_violation');
}
@ -677,23 +677,26 @@ class CommentController extends Comment
}
// if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
if (!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
{
$obj->content = EditorModel::converter($obj, 'comment');
}
// remove iframe and script if not a top administrator on the session.
if($logged_info->is_admin != 'Y')
if ($logged_info->is_admin !== 'Y')
{
$obj->content = removeHackTag($obj->content);
$obj->content = Rhymix\Framework\Filters\HTMLFilter::clean((string)$obj->content);
}
if (config('db.master.charset') !== 'utf8mb4')
{
$obj->content = utf8_mbencode($obj->content);
}
$obj->content = utf8_mbencode($obj->content);
// Set other flags.
if (isset($obj->notify_message) && $obj->notify_message !== 'Y')
{
$obj->notify_message = 'N';
}
if (isset($obj->is_secret) && $obj->is_secret !== 'Y')
{
$obj->is_secret = 'N';
@ -951,7 +954,7 @@ class CommentController extends Comment
*/
function updateComment($obj, $skip_grant_check = FALSE, $manual_updated = FALSE)
{
if(!$manual_updated && !checkCSRF())
if(!$manual_updated && !Rhymix\Framework\Security::checkCSRF())
{
return new BaseObject(-1, 'msg_security_violation');
}
@ -1042,11 +1045,14 @@ class CommentController extends Comment
// remove iframe and script if not a top administrator on the session
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y')
if ($logged_info->is_admin !== 'Y')
{
$obj->content = removeHackTag($obj->content);
$obj->content = Rhymix\Framework\Filters\HTMLFilter::clean((string)$obj->content);
}
if (config('db.master.charset') !== 'utf8mb4')
{
$obj->content = utf8_mbencode($obj->content);
}
$obj->content = utf8_mbencode($obj->content);
// begin transaction
$oDB = DB::getInstance();

View file

@ -308,7 +308,7 @@ class CommentModel extends Comment
}
/**
* Get the total number of comments in corresponding with document_srl.
* Get the total number of comments posted on the given date.
* @param string $date
* @param array $moduleList
* @param array $statusList
@ -1271,36 +1271,74 @@ class CommentModel extends Comment
return (int) $output->data->count;
}
/**
* Get comment list of the doc in corresponding woth member_srl.
* Get the total number of comments posted on the given document by the given member.
*
* @param int $document_srl
* @param int $member_srl
* @param array $columnList
* @param int $unused1 (Previously $page)
* @param int $unused2 (Previously $is_admin)
* @param int $count
* @param array $statusList
* @return object
* @return int
*/
public static function getCommentListByMemberSrl($member_srl, $columnList = [], $unused1 = 0, $unused2 = 0, $count = 0, $statusList = [])
public static function getCommentCountByDocumentSrlAndMemberSrl($document_srl, $member_srl, $statusList = [])
{
$args = new stdClass();
$args->document_srl = $document_srl;
$args->member_srl = $member_srl;
$args->list_count = $count;
if ($statusList)
{
$args->statusList = $statusList;
}
$output = executeQuery('comment.getCommentListByMemberSrl', $args, $columnList);
$comment_list = $output->data;
if(!$comment_list) return array();
if(!is_array($comment_list)) $comment_list = array($comment_list);
return $comment_list;
$output = executeQuery('comment.getCommentCountByMemberSrl', $args);
return (int) $output->data->count;
}
/**
* Get the list of comments posted by the given member.
*
* @param int $member_srl
* @param array $columnList
* @param int $unused1 (Previously $page)
* @param int $unused2 (Previously $is_admin)
* @param int $list_count
* @param array $statusList
* @return array
*/
public static function getCommentListByMemberSrl($member_srl, $columnList = [], $unused1 = 0, $unused2 = 0, $list_count = 0, $statusList = [])
{
$args = new stdClass();
$args->member_srl = $member_srl;
$args->list_count = $list_count;
if ($statusList)
{
$args->statusList = $statusList;
}
$output = executeQueryArray('comment.getCommentListByMemberSrl', $args, $columnList);
return $output->data ?? [];
}
/**
* Get the list of comments posted on the given document by the given member.
*
* @param int $document_srl
* @param int $member_srl
* @param int $list_count
* @param array $columnList
* @param array $statusList
* @return array
*/
public static function getCommentListByDocumentSrlAndMemberSrl($document_srl, $member_srl, $list_count = 0, $columnList = [], $statusList = [])
{
$args = new stdClass();
$args->document_srl = $document_srl;
$args->member_srl = $member_srl;
$args->list_count = $list_count;
if ($statusList)
{
$args->statusList = $statusList;
}
$output = executeQueryArray('comment.getCommentListByMemberSrl', $args, $columnList);
return $output->data ?? [];
}
}
/* End of file comment.model.php */
/* Location: ./modules/comment/comment.model.php */

View file

@ -7,6 +7,8 @@
</columns>
<conditions>
<condition operation="equal" column="member_srl" var="member_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="module_srl" var="module_srl" filter="number" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" />
<condition operation="equal" column="status" var="status" pipe="and" />
<condition operation="in" column="status" var="statusList" pipe="and" />
</conditions>

View file

@ -12,6 +12,9 @@
</columns>
<conditions>
<condition operation="equal" column="member_srl" var="member_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="module_srl" var="module_srl" filter="number" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" />
<condition operation="equal" column="status" var="status" pipe="and" />
<condition operation="in" column="status" var="statusList" pipe="and" />
</conditions>
<navigation>