From: vincent@cubedesigners.com Date: Wed, 19 Jan 2011 17:53:20 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=532eef37700b09de79d9061a9eeb0431c0b031b8;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index bd1c2f143..f4e8d6020 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -424,7 +424,7 @@ class wsFlash extends cubeFlashGateway { global $core; $dao = new wsDAOBook($core->con); $book = $dao->selectById($this->args['book_id']); - $this->xml->addChild('chapters', json_encode($book->chapters)); + $this->xml->addChild('chapters', html::escapeHTML(json_encode($book->chapters))); } public function getLinks() diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index a2ee69deb..71856ab5e 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -406,6 +406,13 @@ html{height:100%}' . "\n"; } } + public static function testOldLink($args) + { + global $core; + $daoDoc = new wsDAODocument($core->con); + $daoDoc->setLinksFromOldFluidbook($args[1]); + } + protected static function updateDocument($document_id) { global $core; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 80450b3bd..f35d5774f 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -319,7 +319,7 @@ class wsDAOBook extends commonDAO { public function setChaptersFromOldFluidbook($book_id) { - $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/links.xml'); + $xml = simplexml_load_file('http://ws.fluidbook.com/books/' . $book_id . '/data/links.xml'); $res = array(); $chapters = $xml->xpath('//chapters'); foreach($chapters as $ch) { diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 3793f6275..d9dd18f8f 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -31,6 +31,9 @@ class wsDAODocument extends commonDAO { for($page = 1;$page <= $document->generalInfos['pages'];$page++) { $csv = WS_DOCS . '/' . $document->document_id . '/p' . $page . '.csv'; + if(!file_exists($csv)){ + continue; + } $c->update = filemtime($csv); $fp = fopen($csv, 'rb'); $links = array(); @@ -106,6 +109,10 @@ class wsDAODocument extends commonDAO { } $c->insert(); } + + $c = $this->con->openCursor('books'); + $c->changedate = TIME; + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } public function setLinksFromOldFluidbook($book_id) @@ -144,26 +151,40 @@ class wsDAODocument extends commonDAO { $res = array(); $lpages = array(); foreach($links as $l) { + if ((string)$l->page == '') { + continue; + } + $link = array(); - $link['page'] = (string)$l['page']; + $link['page'] = (string)$l->page; $link['numerotation'] = false; - $link['left'] = intval((string)$l['startX']); - $link['width'] = intval((string)$l['endX']) - $link['left']; + $link['left'] = intval((string)$l->startX); + $link['width'] = intval((string)$l->endX) - $link['left']; if ($link['left'] > $width) { $link['page']++; $link['left'] -= $width; } $page = $link['page']; - $link['top'] = intval((string)$l['startY']); - $link['height'] = intval((string)$l['endY']) - $link['top']; + $link['top'] = intval((string)$l->startY); + $link['height'] = intval((string)$l->endY) - $link['top']; $link['infobulle'] = ''; $link['target'] = '_blank'; - $link['to'] = (string)$l['linkTo']; - $link['type'] = intval((string)$l['linkType']); - $link['video_loop'] = ((string)$l['loopFlag'] == '1'); + $link['to'] = (string)$l->linkTo; + $link['type'] = intval((string)$l->linkType); + $link['video_loop'] = ((string)$l->loopFlag == '1'); $link['video_auto_start'] = true; - $link['video_controls'] = ((string)$l['playerActive'] == '1'); - $link['video_sound_on'] = ((string)$l['soundOn'] == '1'); + $link['video_controls'] = ((string)$l->playerActive == '1'); + $link['video_sound_on'] = ((string)$l->soundOn == '1'); + + 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); + } + copy('http://ws.fluidbook.com/books/' . $book_id . '/data/' . $link['to'], $dir . '/' . $link['to']); + } + } if (!isset($lpages[$page])) { $lpages[$page] = array(); @@ -184,6 +205,10 @@ class wsDAODocument extends commonDAO { $c->rulers = json_encode(array()); $c->insert(); } + + $c = $this->con->openCursor('books'); + $c->changedate = TIME; + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } public function getLinksAndRulers($book_id, &$links, &$rulers) @@ -202,6 +227,7 @@ class wsDAODocument extends commonDAO { $rulers = array(); $sql = 'SELECT *,CONCAT(document_id,\',\',document_page) AS doc_page FROM document_links WHERE (document_id,document_page) IN(' . implode(',', $couples) . ') ORDER BY `update` DESC, FIELD(doc_page,' . implode(',', $couples_order) . ') LIMIT ' . count($pages); + fb($sql); $r = $this->con->select($sql); $i = 1; while ($r->fetch()) {