From: vincent@cubedesigners.com Date: Mon, 27 Feb 2017 13:42:10 +0000 (+0000) Subject: fix #1167 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f24bd7060662748c3dea37d6f540c65e933f3e64;p=cubeextranet.git fix #1167 @1.5 --- diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index a16cec5af..b498cc57f 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1224,28 +1224,30 @@ class wsDAOBook extends commonDAO { $ignoreLinks = array(); foreach ($links as $id => $link) { $links[$id]['id'] = $id; + $skipCopyAsset = false; if (isset($link['image']) && $link['image']) { $workingFile = $workingDir . '/' . $link['image']; $assetId = 'link_datas_i_' . md5($link['image']); if (isset($imagesassets[$assetId])) { - continue; - } - if (file_exists($workingFile)) { - if ($link['page'] <= 1) { - $flexLight->addBitmap($workingFile, $assetId); - } else { - $flex->addBitmap($workingFile, $assetId); + + } else { + if (file_exists($workingFile)) { + if ($link['page'] <= 1) { + $flexLight->addBitmap($workingFile, $assetId); + } else { + $flex->addBitmap($workingFile, $assetId); + } } + $imagesassets[$assetId] = true; } - $imagesassets[$assetId] = true; } if ($link['type'] == 16 && $book->parametres->linkFilePrefix) { if (!CubeIT_Util_Url::isDistant($link['to'])) { - $link['to'] = $book->parametres->linkFilePrefix . $link['to']; - $links[$id] = $link; + $skipCopyAsset = true; + $links[$id]['to'] = $book->parametres->linkFilePrefix . $link['to']; } } @@ -1260,21 +1262,23 @@ class wsDAOBook extends commonDAO { } $imagesassets[$id] = true; } else if (in_array($link['type'], array(4, 6, 7, 9, 16, 17, 25))) { - $workingFile = $workingDir . '/' . $link['to']; - if (file_exists($workingFile)) { - $filesToCopy['data/' . $link['to']] = $workingFile; - } + if (!$skipCopyAsset) { + $workingFile = $workingDir . '/' . $link['to']; + if (file_exists($workingFile)) { + $filesToCopy['data/' . $link['to']] = $workingFile; + } - if ($link['type'] == 4) { - $poster = $link['to']; - $e = explode('.', $poster); - array_pop($e); - array_push($e, 'jpg'); - $poster = implode('.', $e); + if ($link['type'] == 4) { + $poster = $link['to']; + $e = explode('.', $poster); + array_pop($e); + array_push($e, 'jpg'); + $poster = implode('.', $e); - $workingFile = $workingDir . '/' . $poster; - if (file_exists($workingFile)) { - $filesToCopy['data/' . $poster] = $workingFile; + $workingFile = $workingDir . '/' . $poster; + if (file_exists($workingFile)) { + $filesToCopy['data/' . $poster] = $workingFile; + } } } }