Merge branch 'rhymix:develop' into develop

This commit is contained in:
Lastorder 2024-10-12 16:08:02 +09:00 committed by GitHub
commit 88b5281094
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 2542 additions and 405 deletions

View file

@ -773,9 +773,10 @@ class Context
}
if (count($vars))
{
$title = trim(trim(preg_replace_callback('/\\$(\w+)/', function($matches) use($vars) {
$title = trim(preg_replace_callback('/\\$(\w+)/', function($matches) use($vars) {
return isset($vars[strtolower($matches[1])]) ? $vars[strtolower($matches[1])] : $matches[0];
}, $title), ' -'));
}, $title));
$title = preg_replace('/(-\s+)+-/', '-', trim($title, ' -'));
}
self::$_instance->browser_title = $title;
}
@ -1368,7 +1369,9 @@ class Context
$file['tmp_name'] = $val['tmp_name'][$i];
$file['error'] = $val['error'][$i];
$file['size'] = $val['size'][$i];
$files[] = $file;
$subkey = (is_int($i) || ctype_digit($i)) ? intval($i) : preg_replace('/[^a-z0-9:+=_-]/i', '', (string)$i);
$files[$subkey] = $file;
}
if(count($files))
{

View file

@ -573,19 +573,32 @@ class HTMLDisplayHandler
foreach ($document_files as $file)
{
if ($file->isvalid !== 'Y' || !preg_match('/\.(?:bmp|gif|jpe?g|png|webp)$/i', $file->uploaded_filename))
if ($file->isvalid !== 'Y' || !preg_match('/\.(?:bmp|gif|jpe?g|png|webp|mp4)$/i', $file->uploaded_filename))
{
continue;
}
list($width, $height) = @getimagesize($file->uploaded_filename);
if ($width < 100 && $height < 100)
if (str_starts_with($file->mime_type, 'video/'))
{
continue;
if ($file->thumbnail_filename)
{
list($width, $height) = @getimagesize($file->thumbnail_filename);
if ($width >= 100 || $height >= 100)
{
$document_images[] = array('filepath' => $file->thumbnail_filename, 'width' => $width, 'height' => $height);
break;
}
}
}
else
{
list($width, $height) = @getimagesize($file->uploaded_filename);
if ($width >= 100 || $height >= 100)
{
$document_images[] = array('filepath' => $file->uploaded_filename, 'width' => $width, 'height' => $height);
break;
}
}
$document_images[] = array('filepath' => $file->uploaded_filename, 'width' => $width, 'height' => $height);
break;
}
}
Rhymix\Framework\Cache::set("seo:document_images:$document_srl", $document_images);

View file

@ -15,7 +15,16 @@ class JSONDisplayHandler
$variables['message'] = $oModule->getMessage();
self::_convertCompat($variables, Context::getRequestMethod());
return json_encode($variables) . "\n";
$result = json_encode($variables) . "\n";
if (json_last_error() != \JSON_ERROR_NONE)
{
trigger_error('JSON encoding error: ' . json_last_error_msg(), E_USER_WARNING);
return json_encode([
'error' => -1,
'message' => 'JSON encoding error',
]) . "\n";
}
return $result;
}
/**

View file

@ -703,7 +703,7 @@ class ModuleHandler extends Handler
$procResult = $oModule->proc();
$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]) && !isset($_SERVER['HTTP_X_AJAX_TARGET']) && !isset($_POST['_rx_ajax_form']))
if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
{
$error = $oModule->getError();
$message = $oModule->getMessage();
@ -1014,28 +1014,6 @@ class ModuleHandler extends Handler
$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
if(!isset($methodList[Context::getRequestMethod()]))
{
// Handle iframe form submissions.
$ajax_form_target = strval($_SERVER['HTTP_X_AJAX_TARGET'] ?? ($_POST['_rx_ajax_form'] ?? ''));
if($ajax_form_target !== '' && starts_with('_rx_temp_iframe_', $ajax_form_target))
{
$data = [];
if ($this->error)
{
$data['error'] = -1;
$data['message'] = lang($this->error);
}
else
{
$data['error'] = $oModule->error;
$data['message'] = lang($oModule->message);
}
$data = array_merge($data, $oModule->getVariables());
ob_end_clean();
echo sprintf('<html><head></head><body><script>parent.XE.handleIframeResponse(%s, %s);</script></body></html>', json_encode($ajax_form_target), json_encode($data));
return;
}
// Handle redirects.
if($oModule->getRedirectUrl())
{
@ -1122,7 +1100,7 @@ class ModuleHandler extends Handler
if($layout_info)
{
// Input extra_vars into $layout_info
if($layout_info->extra_var_count)
if(isset($layout_info->extra_var_count) && $layout_info->extra_var_count)
{
foreach($layout_info->extra_var as $var_id => $val)
@ -1138,7 +1116,7 @@ class ModuleHandler extends Handler
}
}
// Set menus into context
if($layout_info->menu_count)
if(isset($layout_info->menu_count) && $layout_info->menu_count)
{
$oMenuAdminController = getAdminController('menu');
$homeMenuCacheFile = null;

View file

@ -210,8 +210,7 @@ class BaseObject
*/
public function add($key, $val)
{
$this->variables[$key] = $val;
return $this;
return $this->set($key, $val);
}
/**