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

@ -3307,16 +3307,23 @@ class DocumentController extends Document
}
// Get document_srl
$srls = explode(',',Context::get('srls'));
for($i = 0; $i < count($srls); $i++)
$srls = Context::get('srls');
if (is_array($srls))
{
$srl = trim($srls[$i]);
if(!$srl) continue;
$document_srls[] = $srl;
$document_srls = array_map('intval', $srls);
}
else
{
$document_srls = array_map('intval', explode(',', $srls));
}
$document_srls = array_unique(array_filter($document_srls, function($srl) {
return $srl > 0;
}));
if (!count($document_srls))
{
return;
}
if(!count($document_srls)) return;
// Get module_srl of the documents
$args = new stdClass;
@ -3787,7 +3794,17 @@ Content;
}
}
/**
* A typo of updateUploadedCount, maintained for backward compatibility.
*
* @deprecated
*/
public function updateUploaedCount($document_srl_list)
{
return $this->updateUploadedCount($document_srl_list);
}
public function updateUploadedCount($document_srl_list)
{
if(!is_array($document_srl_list))
{
@ -3803,7 +3820,8 @@ Content;
foreach($document_srl_list as $document_srl)
{
if(!$document_srl = (int) $document_srl)
$document_srl = (int)$document_srl;
if ($document_srl <= 0)
{
continue;
}
@ -3823,7 +3841,7 @@ Content;
return;
}
$this->updateUploaedCount($file->upload_target_srl);
$this->updateUploadedCount($file->upload_target_srl);
}
/**

View file

@ -1146,9 +1146,14 @@ class DocumentItem extends BaseObject
// Call trigger for custom thumbnails.
$trigger_obj = (object)[
'document_srl' => $this->document_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,
'width' => $width,
'height' => $height,
'image_type' => 'jpg',
'type' => $thumbnail_type,
'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file,
'url' => $thumbnail_url,
];
$output = ModuleHandler::triggerCall('document.getThumbnail', 'before', $trigger_obj);
clearstatcache(true, $thumbnail_file);
@ -1220,8 +1225,16 @@ class DocumentItem extends BaseObject
// If not exists, file an image file from the content
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", $content, $matches, PREG_SET_ORDER);
foreach($matches as $match)
{

View file

@ -61,7 +61,7 @@
<div class="x_control-group" data-invisible-types="file">
<label class="x_control-label" for="default">{$lang->default_value}</label>
<div class="x_controls">
<input type="text" name="default" id="default" value="{$selected_var->default}" />
<input type="text" name="default" id="default" value="{$selected_var ? $selected_var->getDefaultValue() : ''}" />
<p class="x_help-block">{$lang->about_extra_vars_default_value}</p>
</div>
</div>