From: vincent@cubedesigners.com Date: Tue, 26 May 2020 16:17:24 +0000 (+0000) Subject: wip #3655 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fce95f197936e056daac898d60091baede1918e4;p=cubeextranet.git wip #3655 @1 --- diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index c3c84afad..a22f1ad60 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -544,12 +544,11 @@ class wsLinks $pages = $daoBook->getPagesOfBook($book_id); $booleans = array('video_loop', 'video_auto_start', 'video_controls', 'video_sound_on'); + $numbers = ['left', 'top', 'width', 'height']; $links = []; foreach ($pages as $page => $info) { - $links[$page] = []; - $csv = wsDocument::getDir($info['document_id']) . '/p' . $info['document_page'] . '.csv'; if (!file_exists($csv) && file_exists($csv . '.gz')) { $csv = 'compress.zlib://' . $csv . '.gz'; @@ -571,16 +570,20 @@ class wsLinks if (substr($line[0], 0, 1) == '#' || is_null($line[0])) { continue; } - $link = array(); + $link = []; if ($newformat) { $cols = array('page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical'); } else { $cols = array('page' => '', 'type' => '', 'to' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical'); } + + $k = 0; foreach ($cols as $col => $default) { if (isset($line[$k])) { - if (in_array($k, $booleans)) { + if (in_array($k, $numbers)) { + $link[$col] = (float)str_replace(',', '.', $line[$k]); + } else if (in_array($k, $booleans)) { $link[$col] = ($line[$k] == '1'); } else { $link[$col] = utf8_encode($line[$k]); @@ -591,7 +594,7 @@ class wsLinks $k++; } $link['page'] = $page; - $links[$page][] = $link; + $links[] = $link; } }