From f92f34c67aca8d37010ede52e205cefe8f863ac6 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 3 Jul 2023 18:58:57 +0200 Subject: [PATCH] fix #5638 @0:10 --- .../FluidbookPublication/LinksOperation.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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; } -- 2.39.5