]> _ Git - cubeextranet.git/commitdiff
fix #1167 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 27 Feb 2017 13:42:10 +0000 (13:42 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 27 Feb 2017 13:42:10 +0000 (13:42 +0000)
inc/ws/DAO/class.ws.dao.book.php

index a16cec5aff88e1e8f7ce70f9ceb8180a290d7e53..b498cc57fdbf151bf803a1a7c24c5d802c0aba5c 100644 (file)
@@ -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;
+                                               }
                                        }
                                }
                        }