]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 21 Jun 2011 09:44:54 +0000 (09:44 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 21 Jun 2011 09:44:54 +0000 (09:44 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php

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