fix for PHP-8.4 Поле Изображения Мега
This commit is contained in:
@@ -175,6 +175,11 @@
|
||||
$this->registerPlugin('modifier', 'stripcslashes', 'stripcslashes');
|
||||
}
|
||||
|
||||
if (function_exists('html_entity_decode')) {
|
||||
// Регистрируем как модификатор, если функция существует
|
||||
$this->registerPlugin('modifier', 'html_entity_decode', 'html_entity_decode');
|
||||
}
|
||||
|
||||
|
||||
// плагин позволяющий поставить метки шаблонов
|
||||
// для быстрого поиска шаблона отвечающего за вывод
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
$items = array();
|
||||
$image_items = array();
|
||||
|
||||
if ($_REQUEST['action'] != 'new')
|
||||
if ($_REQUEST['action'] != 'new' && trim($field_value) !== '')
|
||||
{
|
||||
$items = unserialize($field_value);
|
||||
$items = @unserialize($field_value);
|
||||
|
||||
if ($items != false)
|
||||
{
|
||||
@@ -143,8 +143,8 @@
|
||||
|
||||
case 'doc':
|
||||
|
||||
$items = (isset($field_value))
|
||||
? unserialize($field_value)
|
||||
$items = (isset($field_value) && trim($field_value) !== '')
|
||||
? @unserialize($field_value)
|
||||
: [];
|
||||
|
||||
$res = [];
|
||||
@@ -177,18 +177,18 @@
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
function($data) use($field_data)
|
||||
{
|
||||
return $field_data[(int)$data[1]];
|
||||
return isset($field_data[(int)$data[1]]) ? $field_data[(int)$data[1]] : '';
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
function($m) {
|
||||
return watermarks($m[1], $m[2], $m[3]);
|
||||
},
|
||||
$image_item
|
||||
);
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
function($m) {
|
||||
return watermarks($m[1], $m[2], $m[3]);
|
||||
},
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
}
|
||||
@@ -218,7 +218,10 @@
|
||||
break;
|
||||
|
||||
case 'req':
|
||||
$items = unserialize($field_value);
|
||||
|
||||
$items = (trim($field_value) !== '')
|
||||
? @unserialize($field_value)
|
||||
: [];
|
||||
|
||||
$res = array();
|
||||
|
||||
@@ -235,9 +238,9 @@
|
||||
$image_item = array();
|
||||
|
||||
$image_item['url'] = $field_data[0];
|
||||
$image_item['title'] = $field_data[1] ? $field_data[1] : '';
|
||||
$image_item['description'] = $field_data[2] ? $field_data[2] : '';
|
||||
$image_item['link'] = $field_data[3] ? $field_data[3] : '';
|
||||
$image_item['title'] = isset($field_data[1]) ? $field_data[1] : '';
|
||||
$image_item['description'] = isset($field_data[2]) ? $field_data[2] : '';
|
||||
$image_item['link'] = isset($field_data[3]) ? $field_data[3] : '';
|
||||
|
||||
if (! empty($image_item['link']))
|
||||
$image_item['http'] = (preg_match('/^(http|https)/', $image_item['link']) ? true : false);
|
||||
@@ -250,17 +253,17 @@
|
||||
'/\[tag:parametr:(\d+)\]/i',
|
||||
static function($data) use($field_data)
|
||||
{
|
||||
return $field_data[(int)$data[1]];
|
||||
return isset($field_data[(int)$data[1]]) ? $field_data[(int)$data[1]] : '';
|
||||
},
|
||||
$tpl
|
||||
);
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
function($m) {
|
||||
return watermarks($m[1], $m[2], $m[3]);
|
||||
},
|
||||
$image_item
|
||||
);
|
||||
$image_item = preg_replace_callback(
|
||||
'/\[tag:watermark:(.+?):([a-zA-Z]+):([0-9]+)\]/',
|
||||
function($m) {
|
||||
return watermarks($m[1], $m[2], $m[3]);
|
||||
},
|
||||
$image_item
|
||||
);
|
||||
|
||||
$image_item = preg_replace_callback('/\[tag:([r|c|f|t|s]\d+x\d+r*):(.+?)]/', 'callback_make_thumbnail', $image_item);
|
||||
}
|
||||
@@ -320,7 +323,7 @@
|
||||
|
||||
if (! empty($field_value))
|
||||
{
|
||||
$images = unserialize($field_value);
|
||||
$images = @unserialize($field_value); // Добавлено @
|
||||
|
||||
if (! $images)
|
||||
return false;
|
||||
@@ -362,7 +365,11 @@
|
||||
|
||||
$default = explode('|', $default);
|
||||
|
||||
list($path_upload, $watermark, $position, $transparency) = $default;
|
||||
// извлечение элементов массива $default
|
||||
$path_upload = $default[0] ?? '';
|
||||
$watermark = $default[1] ?? false;
|
||||
$position = $default[2] ?? null;
|
||||
$transparency = $default[3] ?? null;
|
||||
|
||||
if (! empty($path_upload))
|
||||
$path_upload = str_replace($search, $replace, $path_upload);
|
||||
@@ -472,5 +479,4 @@
|
||||
}
|
||||
|
||||
return $res ?: $field_value;
|
||||
}
|
||||
?>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{if $mega_new != 'load'}
|
||||
{assign var=mega_new value='' scope="global"}
|
||||
{if $smarty.request.outside}
|
||||
{if isset($smarty.request.outside) && $smarty.request.outside}
|
||||
<script src="{$ABS_PATH}fields/{$field_dir}/js/outside.js" type="text/javascript"></script>
|
||||
{else}
|
||||
<script src="{$ABS_PATH}fields/{$field_dir}/js/field.js" type="text/javascript"></script>
|
||||
|
||||
Reference in New Issue
Block a user