From 09870af02a531b7d056c53a6c58638533e206dde Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 21 Jun 2011 09:44:54 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.url.php | 4 +- inc/ws/DAO/class.ws.dao.book.php | 66 ++++++++++++++--------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 975326533..2caeb2ef6 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -806,9 +806,11 @@ html{height:100%}' . "\n"; } self::checkDocumentVersionOfBook($args[1]); wsSecureSWF::checkProtectedSWF(); - // cubePHP::neverStop(); + cubePHP::neverStop(); $dao = new wsDAOBook($core->con); + header('Content-type: text/plain'); + ob_end_clean(); echo $dao->compile($args[1], 3, isset($args[2])); exit; } diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index c23780386..f529c4258 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -36,7 +36,7 @@ class wsDAOBook extends commonDAO { $book->facturable_id = $r->facturable_id; $book->tache = $r->tache; $book->projet = $r->projet; - $book->version=$r->version; + $book->version = $r->version; return $book; } @@ -58,7 +58,7 @@ class wsDAOBook extends commonDAO { $book->parametres = new wsBookParametres(); $book->tache = 0; $book->pages = array(); - $book->version=2; + $book->version = 2; return $book; } @@ -139,7 +139,7 @@ class wsDAOBook extends commonDAO { $c->theme = $r->theme; $c->changedate = TIME; $c->compiledate = 0; - $c->version=2; + $c->version = 2; $book_id = $c->book_id = $this->getNextId(); $c->insert(); @@ -165,7 +165,7 @@ class wsDAOBook extends commonDAO { $c->lang = $lang; $c->changedate = TIME; $c->compiledate = TIME; - $c->version=2; + $c->version = 2; $book_id = $c->book_id = $this->getNextId(); $c->insert(); return $this->selectById($book_id); @@ -440,12 +440,11 @@ class wsDAOBook extends commonDAO { $c->status = 2; $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } - - public function setVersion($book_id,$version){ - $c=$this->con->openCursor('books'); - $c->version=$version; - $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); - + + public function setVersion($book_id, $version) { + $c = $this->con->openCursor('books'); + $c->version = $version; + $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } public function touch($book_id) { @@ -703,7 +702,6 @@ class wsDAOBook extends commonDAO { if ($theme->parametres->logo != '') { $flex->addBitmap($themeRoot . $theme->parametres->logo, 'logo'); } - if ($theme->parametres->afterSearch != '') { $flex->addBitmap($themeRoot . $theme->parametres->afterSearch, 'aftersearch'); } @@ -713,39 +711,38 @@ class wsDAOBook extends commonDAO { foreach (wsIcone::$files as $file) { $flex->addBitmap($iconsRoot . 'nav-' . $file . '.png', 'nav_' . $file); } - // Fonts - $flex->addFont(FONT_PATH . '/' . $lang->font, 'GeneralFont', $lang->charset); - $flex->addFont(FONT_PATH . '/FluidbookCredits.ttf', 'CreditsFont', 'ASCII'); - $flexLight->addFont(FONT_PATH . '/FluidbookLoader.ttf', 'LoaderFont', 'Numerals'); - $flexLight->addVariable('checksum', $hash, false, true, 'String'); - $res .= $flex->compile() . "\n\n-------------------\n\n"; - $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf')); - $res .= $flexLight->compile(); + // Basket if ($book->parametres->basket) { $formats = array('jpg', 'png', 'jpeg'); - $referencesFile = $workingDir . '/' . $book->parametres->basketReferences; - $references = array(); + $referencesFile = $workingDir . 'commerce/' . $book->parametres->basketReferences; + if (file_exists($referencesFile)) { - $fp = fopen($reference_file, "rb"); + $xml = simplexml_load_file($referencesFile); $i = 0; - while ($line = fgetcsv($fp)) { - $references[] = $line; - if ($i > 0) { - $refid = trim($line[0]); - foreach ($formats as $f) { - $refimage = $workingDir . '/' . $refid . '.' . $f; - if (file_exists($refimage)) { - $flex->addBitmap($refimage, "basket_image_" + ($i - 1)); - break; - } + foreach ($xml->item as $item) { + $ref = (string) $item['reference']; + foreach ($formats as $f) { + $refimage = $workingDir . 'commerce/' . $ref . '.' . $f; + if (file_exists($refimage)) { + $flex->addBitmap($refimage, "basket_image_" + $ref); + break; } } $i++; } } - $flex->addVariable('basketReferences', $references, "JSONObject"); + $flex->addVariable('basketReferences', $xml->asXML(),false,true, "XML"); } + // Fonts + $flex->addFont(FONT_PATH . '/' . $lang->font, 'GeneralFont', $lang->charset); + $flex->addFont(FONT_PATH . '/FluidbookCredits.ttf', 'CreditsFont', 'ASCII'); + $flexLight->addFont(FONT_PATH . '/FluidbookLoader.ttf', 'LoaderFont', 'Numerals'); + $flexLight->addVariable('checksum', $hash, false, true, 'String'); + $res .= $flex->compile() . "\n\n-------------------\n\n"; + $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf')); + $res .= $flexLight->compile(); + $filesToCopy['FluidbookDatas.swf'] = $compilerDir . '/FluidbookDatas.swf'; $filesToCopy['FluidbookDatasLight.swf'] = $compilerDir . '/FluidbookDatasLight.swf'; @@ -768,6 +765,9 @@ class wsDAOBook extends commonDAO { foreach ($filesToCopy as $local => $source) { $localPath = $finalDir . $local; // if (!file_exists($localPath) || filemtime($localPath) < filemtime($source) || filesize($localPath) != filesize($source)) { + if (is_dir($source)) { + continue; + } copy($source, $localPath); // } } -- 2.39.5