]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 23 May 2011 16:25:50 +0000 (16:25 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 23 May 2011 16:25:50 +0000 (16:25 +0000)
inc/ws/DAO/class.ws.dao.document.php

index af39e9976212940df4c7218791d16217ba948c5c..73059882b297a145564a7df83774599787ad2cbd 100644 (file)
@@ -169,8 +169,6 @@ class wsDAODocument extends commonDAO {
                $sql = 'REPLACE INTO document_links_versions (`document_id`,`links`,`rulers`,`update`) '\r
                                . 'SELECT \'' . $to . '\',`links`,`rulers`,`update` FROM document_links_versions WHERE document_id=\'' . $from . '\'';\r
 \r
-               fb($sql);\r
-\r
                $this->con->execute($sql);\r
        }\r
 \r
@@ -179,7 +177,7 @@ class wsDAODocument extends commonDAO {
                $pages = $daoBook->getPagesOfBook($book_id);\r
                $book = $daoBook->selectById($book_id);\r
                $width = $book->parametres->width;\r
-\r
+               \r
                $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/data/links.xml');\r
                $links = $xml->xpath('//oneLink');\r
 \r
@@ -222,9 +220,10 @@ class wsDAODocument extends commonDAO {
                        $link['video_controls'] = ((string) $l->playerActive == '1');\r
                        $link['video_sound_on'] = ((string) $l->soundOn == '1');\r
 \r
+                       $dir = WS_BOOKS . '/working/' . $book_id . '/';\r
+\r
                        if ($link['type'] == '4' || $link['type'] == '6') {\r
                                if (!stristr($link['to'], ':/')) {\r
-                                       $dir = WS_BOOKS . '/working/' . $book_id . '/';\r
                                        if (!file_exists($dir)) {\r
                                                mkdir($dir, 0755, true);\r
                                        }\r
@@ -238,6 +237,7 @@ class wsDAODocument extends commonDAO {
                        $lpages[$page][] = $link;\r
                }\r
 \r
+\r
                $links = array();\r
                foreach ($pages as $p => $infos) {\r
                        if (!isset($links[$infos['document_id']])) {\r
@@ -251,11 +251,12 @@ class wsDAODocument extends commonDAO {
 \r
                $c = $this->con->openCursor('document_links_versions');\r
                $c->update = TIME;\r
+               \r
+               krsort($links);\r
 \r
                foreach ($links as $document_id => $l) {\r
-                       $c->document_id = $infos['document_id'];\r
+                       $c->document_id = $document_id;\r
                        $c->links = json_encode($l);\r
-\r
                        $c->rulers = json_encode(array());\r
                        $c->insert();\r
                }\r