From 9226527088227a493655241b6766b9447bde7b21 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 23 May 2011 16:25:50 +0000 Subject: [PATCH] --- inc/ws/DAO/class.ws.dao.document.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index af39e9976..73059882b 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -169,8 +169,6 @@ class wsDAODocument extends commonDAO { $sql = 'REPLACE INTO document_links_versions (`document_id`,`links`,`rulers`,`update`) ' . 'SELECT \'' . $to . '\',`links`,`rulers`,`update` FROM document_links_versions WHERE document_id=\'' . $from . '\''; - fb($sql); - $this->con->execute($sql); } @@ -179,7 +177,7 @@ class wsDAODocument extends commonDAO { $pages = $daoBook->getPagesOfBook($book_id); $book = $daoBook->selectById($book_id); $width = $book->parametres->width; - + $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/data/links.xml'); $links = $xml->xpath('//oneLink'); @@ -222,9 +220,10 @@ class wsDAODocument extends commonDAO { $link['video_controls'] = ((string) $l->playerActive == '1'); $link['video_sound_on'] = ((string) $l->soundOn == '1'); + $dir = WS_BOOKS . '/working/' . $book_id . '/'; + if ($link['type'] == '4' || $link['type'] == '6') { if (!stristr($link['to'], ':/')) { - $dir = WS_BOOKS . '/working/' . $book_id . '/'; if (!file_exists($dir)) { mkdir($dir, 0755, true); } @@ -238,6 +237,7 @@ class wsDAODocument extends commonDAO { $lpages[$page][] = $link; } + $links = array(); foreach ($pages as $p => $infos) { if (!isset($links[$infos['document_id']])) { @@ -251,11 +251,12 @@ class wsDAODocument extends commonDAO { $c = $this->con->openCursor('document_links_versions'); $c->update = TIME; + + krsort($links); foreach ($links as $document_id => $l) { - $c->document_id = $infos['document_id']; + $c->document_id = $document_id; $c->links = json_encode($l); - $c->rulers = json_encode(array()); $c->insert(); } -- 2.39.5