From: Vincent Vanwaelscappel Date: Mon, 3 Jul 2023 16:58:57 +0000 (+0200) Subject: fix #5638 @0:10 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f92f34c67aca8d37010ede52e205cefe8f863ac6;p=fluidbook-toolbox.git fix #5638 @0:10 --- diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/LinksOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/LinksOperation.php index 8c6000e07..c497075af 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/LinksOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/LinksOperation.php @@ -88,12 +88,16 @@ trait LinksOperation $rlinks = array(); foreach ($links as $k => $link) { - if (!$isOnePage && $link['page'] % 2 == 0 && $link['left'] > $width) { + $numericPage = is_numeric($link['page']); + if ($numericPage) { + $link['page'] = (int)$link['page']; + } + if ($numericPage && !$isOnePage && $link['page'] % 2 == 0 && $link['left'] > $width) { $link['page']++; $link['left'] -= $width; } - if ($link['page'] >= $from) { + if ($numericPage && $link['page'] >= $from) { $link['page'] += $offset; } if ($internal && $link['type'] == 5) { @@ -119,16 +123,20 @@ trait LinksOperation $rrulers = array(); foreach ($rulers as $k => $ruler) { - if (!$isOnePage && $ruler['type'] == 'x' && $ruler['page'] % 2 == 0 && $ruler['pos'] > $width) { + $numericRuler = is_numeric($ruler['page']); + if ($numericRuler) { + $ruler['page'] = (int)$ruler['page']; + } + if ($numericRuler && !$isOnePage && $ruler['type'] == 'x' && $ruler['page'] % 2 == 0 && $ruler['pos'] > $width) { $ruler['page']++; $ruler['pos'] -= $width; } - if ($ruler['page'] > $from) { + if ($numericRuler && $ruler['page'] > $from) { $ruler['page'] += $offset; } - if (!$isOnePage && $ruler['page'] % 2 == 1 && $ruler['type'] == 'x') { + if ($numericRuler && !$isOnePage && $ruler['page'] % 2 == 1 && $ruler['type'] == 'x') { $ruler['page']--; $ruler['pos'] += $width; }