mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 00:18:25 +01:00
fix PHP 8.x TypeError: string & int
This commit is contained in:
parent
d92c5a94a6
commit
128b6b06df
@ -570,7 +570,7 @@ class Select extends Etemplate\Widget
|
|||||||
$decr = $type > 0 ? $type : 10;
|
$decr = $type > 0 ? $type : 10;
|
||||||
for ($i=0; $i <= 100; $i += $decr)
|
for ($i=0; $i <= 100; $i += $decr)
|
||||||
{
|
{
|
||||||
$options[intval($i)] = intval($i).'%';
|
$options[(int)$i] = (int)$i.'%';
|
||||||
}
|
}
|
||||||
$options[100] = '100%';
|
$options[100] = '100%';
|
||||||
if (!$rows || !empty($value))
|
if (!$rows || !empty($value))
|
||||||
@ -669,8 +669,14 @@ class Select extends Etemplate\Widget
|
|||||||
if ($type <= 0) $type = 3;
|
if ($type <= 0) $type = 3;
|
||||||
if ($type2 <= 0) $type2 = 2;
|
if ($type2 <= 0) $type2 = 2;
|
||||||
if ($type > 100 && $type2 > 100 && $type > $type) { $y = $type; $type=$type2; $type2=$y; }
|
if ($type > 100 && $type2 > 100 && $type > $type) { $y = $type; $type=$type2; $type2=$y; }
|
||||||
$y = date('Y')-$type;
|
if ($value && $value-$type < $y || $type > 100)
|
||||||
if ($value && $value-$type < $y || $type > 100) $y = $type > 100 ? $type : $value-$type;
|
{
|
||||||
|
$y = $type > 100 ? $type : $value-$type;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$y = (int)date('Y')-$type;
|
||||||
|
}
|
||||||
$to = date('Y')+$type2;
|
$to = date('Y')+$type2;
|
||||||
if ($value && $value+$type2 > $to || $type2 > 100) $to = $type2 > 100 ? $type2 : $value+$type2;
|
if ($value && $value+$type2 > $to || $type2 > 100) $to = $type2 > 100 ? $type2 : $value+$type2;
|
||||||
for ($n = 0; $y <= $to && $n < 200; ++$n)
|
for ($n = 0; $y <= $to && $n < 200; ++$n)
|
||||||
@ -682,7 +688,7 @@ class Select extends Etemplate\Widget
|
|||||||
|
|
||||||
case 'select-month':
|
case 'select-month':
|
||||||
$options = self::$monthnames;
|
$options = self::$monthnames;
|
||||||
$value = intval($value);
|
$value = (int)$value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries[,extraStyleMultiselect]]
|
case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries[,extraStyleMultiselect]]
|
||||||
@ -731,7 +737,7 @@ class Select extends Etemplate\Widget
|
|||||||
}
|
}
|
||||||
if (!is_array($value))
|
if (!is_array($value))
|
||||||
{
|
{
|
||||||
$value_in = $value;
|
$value_in = (int)$value;
|
||||||
$value = array();
|
$value = array();
|
||||||
foreach (array_keys($options) as $val)
|
foreach (array_keys($options) as $val)
|
||||||
{
|
{
|
||||||
@ -757,14 +763,14 @@ class Select extends Etemplate\Widget
|
|||||||
// fall-through
|
// fall-through
|
||||||
|
|
||||||
case 'select-number': // options: rows,min,max,decrement,suffix
|
case 'select-number': // options: rows,min,max,decrement,suffix
|
||||||
$type = $type === '' ? 1 : intval($type); // min
|
$type = $type === '' ? 1 : (int)$type; // min
|
||||||
$type2 = $type2 === '' ? 10 : intval($type2); // max
|
$type2 = $type2 === '' ? 10 : (int)$type2; // max
|
||||||
$format = '%d';
|
$format = '%d';
|
||||||
if (!empty($type3) && $type3[0] == '0') // leading zero
|
if (!empty($type3) && $type3[0] == '0') // leading zero
|
||||||
{
|
{
|
||||||
$format = '%0'.strlen($type3).'d';
|
$format = '%0'.strlen($type3).'d';
|
||||||
}
|
}
|
||||||
$type3 = !$type3 ? 1 : intval($type3); // decrement
|
$type3 = !$type3 ? 1 : (int)$type3; // decrement
|
||||||
if (($type <= $type2) != ($type3 > 0))
|
if (($type <= $type2) != ($type3 > 0))
|
||||||
{
|
{
|
||||||
$type3 = -$type3; // void infinite loop
|
$type3 = -$type3; // void infinite loop
|
||||||
@ -980,4 +986,4 @@ class Select extends Etemplate\Widget
|
|||||||
$response->data($options);
|
$response->data($options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Select', array('selectbox', 'listbox', 'select', 'menupopup'));
|
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Select', array('selectbox', 'listbox', 'select', 'menupopup'));
|
Loading…
Reference in New Issue
Block a user