From: vincent@cubedesigners.com Date: Tue, 13 Dec 2016 12:47:13 +0000 (+0000) Subject: fix #1029 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=427610f4cc17fa598cca24498a077bedb992ba5e;p=cubeextranet.git fix #1029 @1 --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index bbe2d94df..a03b15a5c 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -582,7 +582,7 @@ class wsAjax extends cubeAjax { $d = unserialize($d64); } if (!$d) { - mail('tech@fluidbook.com', '[Fluidbook Workshop] Erreur envoi demande de devis', $_GET['devis_form']."\n\n".utf8_decode($d64), 'From: tech@fluidbook.com'); + mail('tech@fluidbook.com', '[Fluidbook Workshop] Erreur envoi demande de devis', $_GET['devis_form'] . "\n\n" . utf8_decode($d64), 'From: tech@fluidbook.com'); return false; } @@ -827,10 +827,8 @@ class wsAjax extends cubeAjax { return; } - wsLinks::getLinksAndRulers($book_id, $links, $rulers, $time); - $dao = new wsDAODocument($core->con); - $dao->setLinksAndRulers($book_id, json_encode($links), json_encode($rulers), 'Restore links from ' . date('Y-m-d H:i:s', $time), $core->user->utilisateur_id); + $dao->restoreLinksVersion($book_id, $time, $core->user->utilisateur_id); } public static function importLinksAsExcel($args) { diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 175ef62ef..15b9a8309 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -49,12 +49,11 @@ class wsDAODocument extends commonDAO { wsLinks::setDocumentLinks($r->document_id, $r->links, $r->rulers, $user, 'Links restored from ' . date('Y-m-d H:i:s', $update) . ' version', TIME); } + $r = $this->con->select('SELECT * FROM special_links_versions WHERE `update`=' . $update . ' AND book_id=\'' . $this->con->escape($book_id) . '\''); if ($r->count()) { - $c = $this->con->openCursor('books'); - $c->specialLinks = $r->links; - $c->specialRulers = $r->rulers; - $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + $dao = new wsDAOBook($this->con); + $dao->setSpecialLinksAndRulers($book_id, $r->links, $r->rulers); } } @@ -215,7 +214,7 @@ class wsDAODocument extends commonDAO { public function copyLinks($from, $to) { $sql = 'REPLACE INTO document_links_versions (`document_id`,`links`,`rulers`,`update`) ' - . 'SELECT \'' . $to . '\',`links`,`rulers`,`update` FROM document_links_versions WHERE document_id=\'' . $from . '\''; + . 'SELECT \'' . $to . '\',`links`,`rulers`,`update` FROM document_links_versions WHERE document_id=\'' . $from . '\''; $this->con->execute($sql); } @@ -234,14 +233,14 @@ class wsDAODocument extends commonDAO { $res = array(); $lpages = array(); foreach ($links as $l) { - if ((string) $l->page == '') { + if ((string)$l->page == '') { continue; } - $left = floatval((string) $l->startX); - $right = floatval((string) $l->endX); - $top = floatval((string) $l->startY); - $bottom = floatval((string) $l->endY); + $left = floatval((string)$l->startX); + $right = floatval((string)$l->endX); + $top = floatval((string)$l->startY); + $bottom = floatval((string)$l->endY); $lwidth = abs($right - $left); $lheight = abs($bottom - $top); @@ -250,12 +249,12 @@ class wsDAODocument extends commonDAO { $top = min($top, $bottom); $link = array(); - $link['page'] = (string) $l->page; + $link['page'] = (string)$l->page; $link['numerotation'] = false; $link['left'] = $left; $link['width'] = $lwidth; if ($link['left'] > $width) { - $link['page'] ++; + $link['page']++; $link['left'] -= $width; } $page = $link['page']; @@ -263,12 +262,12 @@ class wsDAODocument extends commonDAO { $link['height'] = $lheight; $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'); $dir = WS_BOOKS . '/working/' . $book_id . '/';