]> _ Git - cubeextranet.git/commitdiff
fix #1108 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jan 2017 11:09:41 +0000 (11:09 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jan 2017 11:09:41 +0000 (11:09 +0000)
inc/postconfig.inc.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/class.ws.tools.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php
inc/ws/Util/packager/class.ws.packager.html5.php
inc/ws/Util/packager/html5/class.ws.packager.html5.php

index b44927717979f13ed7348a95e9ed23cb13cf32ca..73ff303f2377d266db332fc76b4a61abc833383f 100644 (file)
@@ -17,16 +17,10 @@ define('DEV', $dev);
 // Définition des variables dans l'environnement de production\r
 //define('DB_HOST', ':/var/run/mysqld/mysqld.sock');\r
 \r
-$amacord = false;\r
-if ($_SERVER['SERVER_ADDR'] == '91.121.74.76') {\r
-       $amacord = true;\r
-       define('DB_HOST', '127.0.0.1');\r
-} else {\r
-       define('DB_HOST', 'amarcord.cubedesigners.com');\r
-}\r
-define('AMARCORD', $amacord);\r
-define('SERVER', 'avanger');\r
 \r
+define('AMARCORD', true);\r
+define('SERVER', 'avanger');\r
+define('DB_HOST', 'localhost');\r
 define('DB_NAME', 'extranet');\r
 define('DB_USER', 'extranet');\r
 define('DB_PASSWORD', 'WvcAeYBDnrB93RXa');\r
index 5008d2e40490bc43edb2350f217478bea5db693e..e28618f6aa817b8b851078da6b83d01ee042ff92 100644 (file)
@@ -20,7 +20,6 @@ class wsExporter {
                global $core;
 
 
-
                $ctrl = isset($_GET['ctrl']) && $_GET['ctrl'] == 'true';
                $alt = isset($_GET['alt']) && $_GET['alt'] == 'true';
 
@@ -261,6 +260,7 @@ class wsExporter {
 
        public function export($book_id, &$x, $action = 'download', $version = 'online', $destinationDir = null, $destinationFile = null) {
                global $core;
+               set_time_limit(0);
 
                if (is_null($destinationDir)) {
                        $destinationDir = '';
@@ -318,7 +318,7 @@ class wsExporter {
        }
 
        protected function _install() {
-               $p = wsPackager::package($this->book_id, $this->version, $this->_haveToZip(),false);
+               $p = wsPackager::package($this->book_id, $this->version, $this->_haveToZip(), false);
 
                if (strpos($p, '/fluidbook') == 0) {
                        $p = ROOT . $p;
@@ -381,6 +381,7 @@ class wsExporter {
        }
 
        protected function _lftp($src, $dest, $passive = false, $erase = false) {
+               set_time_limit(0);
                $u = parse_url($dest);
 
                $file = is_file($src);
@@ -424,6 +425,7 @@ class wsExporter {
        }
 
        protected function _rsync($src, $dest, $erase = false, $chown = null) {
+               set_time_limit(0);
                /*if (is_file($src)) {
                        $dir = dirname($dest);
                        if (!file_exists($dir)) {
index 3e0f47e60d061b925bce97d28961446a121fba63..da540dc65b8caddc75c5e93b8b13dc033d9747ac 100644 (file)
@@ -50,7 +50,7 @@ class wsTools {
                $webvideo->execute();
        }
 
-       public static function colorizeAndRasterizeIcon($iconSet, $icon, $colors, $dest, $scale, &$w, &$h, $makepng = true) {
+       public static function colorizeAndRasterizeIcon($iconSet, $icon, $colors, $dest, &$w, &$h) {
                // Init directory
                if (is_string($colors)) {
                        $colors = array('colorize' => $colors);
@@ -88,14 +88,14 @@ class wsTools {
                        foreach ($colors as $k => $v) {
                                $replace = "#" . $v['hex'];
                                if ($v['opacity'] < 1) {
-                                       $replace.='" stroke-opacity="' . $v['opacity'];
+                                       $replace .= '" stroke-opacity="' . $v['opacity'];
                                }
                                $svg = str_replace('$s' . $k, $replace, $svg);
 
 
                                $replace = "#" . $v['hex'];
                                if ($v['opacity'] < 1) {
-                                       $replace.='" fill-opacity="' . $v['opacity'];
+                                       $replace .= '" fill-opacity="' . $v['opacity'];
                                }
                                $svg = str_replace('$' . $k, $replace, $svg);
                        }
@@ -103,33 +103,11 @@ class wsTools {
                }
                self::copy($svgColorized, $dest . '/' . $icon . '.svg');
 
-               // PNG
-               $png = $dirColorized . '/' . $icon . '.png';
-               if (!file_exists($png) || filemtime($png) <= filemtime($svgColorized)) {
-                       $svg = simplexml_load_file($svgColorized);
-                       $w = (string) $svg['width'];
-                       $h = (string) $svg['height'];
-                       $w = rtrim($w, 'px');
-                       $h = rtrim($h, 'px');
-                       // Finally rasterize it
-                       $batik = new cubeCommandLine('batik-rasterizer');
-                       $batik->setArg('d', $dirColorized);
-                       $batik->setArg('m', 'image/png');
-                       if ($scale != 1) {
-                               $batik->setArg('w', $w * $scale);
-                               $batik->setArg('h', $h * $scale);
-                       }
-                       $batik->setManualArg($svgColorized);
-                       $batik->execute();
-               }
-
-               $dim = getimagesize($png);
-               $w = $dim[0] / $scale;
-               $h = $dim[1] / $scale;
-
-               if ($makepng) {
-                       self::copy($png, $dest . '/' . $icon . '.png');
-               }
+               $svg = simplexml_load_file($svgColorized);
+               $w = (string)$svg['width'];
+               $h = (string)$svg['height'];
+               $w = rtrim($w, 'px');
+               $h = rtrim($h, 'px');
        }
 
        public static function copy($source, $dest) {
@@ -141,7 +119,7 @@ class wsTools {
        }
 
        public function chiffres() {
-               
+
        }
 
 }
index 01a6f88bf1ee4b927bffb0e05acf502fd3d6cfb2..3cabf6fe4e64e73e7b236fba03fed7d051376e8f 100644 (file)
@@ -21,7 +21,7 @@ class wsHTML5AppCompiler {
 
                foreach ($this->collection->datas as $group) {
                        foreach ($group['publications'] as $p) {
-                               if($p['id']) {
+                               if ($p['id']) {
                                        $this->books[] = $p['id'];
                                }
                        }
@@ -223,7 +223,7 @@ class wsHTML5AppCompiler {
 
                $svg = array('interface-back-arrow');
                foreach ($svg as $icon) {
-                       wsTools::colorizeAndRasterizeIcon(1, $icon, $text, $this->vdir . '/images/', 4, $w, $h, true);
+                       wsTools::colorizeAndRasterizeIcon(1, $icon, $text, $this->vdir . '/images/', $w, $h);
                }
 
 
index da05fa44e508414b2ebc572d4f640356c7772b88..a2d62d711372e97794e01eb1f29b7a125ac37c56 100644 (file)
@@ -112,7 +112,7 @@ class wsPackagerHTML5 extends wsPackager {
                               'next' => $arrowsColor, 'previous' => $arrowsColor, 'search' => $couleurI);\r
 \r
                foreach ($icons as $icon => $color) {\r
-                       wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', 4, $w, $h);\r
+                       wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', $w, $h);\r
                        $res[] = '#icon-' . $icon . '{width:' . $w . 'px;height:' . $h . 'px;background-image:url(data/images/' . $icon . '.svg), url(data/images/' . $icon . '.png);background-repeat:no-repeat;background-size:' . $w . 'px ' . $h . 'px}';\r
                }\r
                return $res;\r
index 3666dc46c22facef4852b4a3b21115d35f1d95c8..c0de0aafe684368b4f62baa2692e23bc4e07e3a2 100644 (file)
@@ -281,7 +281,7 @@ class wsPackagerHTML5 extends wsPackager {
                               'help-fingers' => $couleurI, 'help-mouse' => $couleurI);\r
 \r
                foreach ($icons as $icon => $color) {\r
-                       wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', 4, $w, $h);\r
+                       wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', $w, $h);\r
                }\r
                return $res;\r
        }\r