Merge branch 'rhymix:master' into master

This commit is contained in:
Lastorder 2025-06-27 14:34:35 +09:00 committed by GitHub
commit b894362419
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 664 additions and 379 deletions

View file

@ -2002,6 +2002,41 @@ class CommentController extends Comment
$this->setMessage('success_declared_cancel');
}
/**
* Update the number of uploaded files in the comment
*
* @param int|array $comment_srl_list
* @return void
*/
public function updateUploadedCount($comment_srl_list)
{
if (!is_array($comment_srl_list))
{
$comment_srl_list = array($comment_srl_list);
}
if (!count($comment_srl_list))
{
return;
}
$comment_srl_list = array_unique($comment_srl_list);
foreach($comment_srl_list as $comment_srl)
{
$comment_srl = (int)$comment_srl;
if ($comment_srl <= 0)
{
continue;
}
$args = new stdClass;
$args->comment_srl = $comment_srl;
$args->uploaded_count = FileModel::getFilesCount($comment_srl);
executeQuery('comment.updateUploadedCount', $args);
}
}
/**
* Method to add a pop-up menu when clicking for displaying child comments
* @param string $url

View file

@ -816,10 +816,15 @@ class CommentItem extends BaseObject
// Call trigger for custom thumbnails.
$trigger_obj = (object)[
'document_srl' => $this->document_srl, 'comment_srl' => $this->comment_srl,
'width' => $width, 'height' => $height,
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
'document_srl' => $this->document_srl,
'comment_srl' => $this->comment_srl,
'width' => $width,
'height' => $height,
'image_type' => 'jpg',
'type' => $thumbnail_type,
'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file,
'url' => $thumbnail_url,
];
$output = ModuleHandler::triggerCall('comment.getThumbnail', 'before', $trigger_obj);
clearstatcache(true, $thumbnail_file);
@ -877,8 +882,16 @@ class CommentItem extends BaseObject
// get an image file from the doc content if no file attached.
if(!$source_file && $config->thumbnail_target !== 'attachment')
{
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
if($trigger_obj->height === 'auto')
{
$external_image_min_height = min(100, $external_image_min_width * 0.5);
}
else
{
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
}
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $this->get('content'), $matches, PREG_SET_ORDER);
foreach($matches as $match)
{

View file

@ -0,0 +1,11 @@
<query id="updateUploadedCount" action="update">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="uploaded_count" var="uploaded_count" default="0" filter="number" />
</columns>
<conditions>
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
</conditions>
</query>