]> _ Git - cubeextranet.git/commitdiff
wait #4673 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 8 Sep 2021 09:40:38 +0000 (09:40 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 8 Sep 2021 09:40:38 +0000 (09:40 +0000)
inc/ws/Util/packager/class.ws.packager.win.inst.html.php

index 05e0a10b8e02c36f422d511ba88ee275bbacd2f4..0cf67ef8fa652c5cde08c8382841db784064709c 100644 (file)
@@ -1,74 +1,98 @@
 <?php\r
 \r
-class wsPackagerWinINSTHTML extends wsPackagerWinEXEHTML {\r
-\r
-       protected $nsi;\r
-       protected $nsifile = 'html';\r
-\r
-       public function __construct($book_id) {\r
-               parent::__construct($book_id);\r
-               $this->version = 'win-ins-html';\r
-       }\r
-\r
-       protected function preparePackage() {\r
-               parent::preparePackage();\r
-\r
-               $this->makeNSI();\r
-       }\r
-\r
-       protected function makeNSI() {\r
-               global $core;\r
-\r
-               $winvdir = $this->getFinalPackageDir();\r
-\r
-               $daoLang = new wsDAOLang($core->con);\r
-               $lang = $daoLang->selectById($this->book->lang);\r
-\r
-               if ($lang->nsis == 'Arabic') {\r
-                       $lang->nsis = 'English';\r
-               }\r
-\r
-               if (!file_exists(WS_FILES . '/packager/download')) {\r
-                       mkdir(WS_FILES . '/packager/download', 0777, true);\r
-               }\r
-\r
-               $fname = $this->exeName;\r
-               $title = $this->appName;\r
-\r
-               $nsi = file_get_contents(WS_COMPILE_ASSETS . '/' . $this->nsifile . '.nsi');\r
-               $nsi = str_replace('$name', $title, $nsi);\r
-               $nsi = str_replace('$htmldir', WS_COMPILE_ASSETS, $nsi);\r
-               $nsi = str_replace('$fname', $fname, $nsi);\r
-               $nsi = str_replace('$fdir', $winvdir, $nsi);\r
-               $nsi = str_replace('$titre', $title, $nsi);\r
-               $nsi = str_replace('$lang', $lang->nsis, $nsi);\r
-               $nsi = str_replace('$nwplatform', $this->nwplatform, $nsi);\r
-               $nsi = str_replace('$nsisdir', '/usr/share/nsis', $nsi);\r
-               $nsi = str_replace('$output', $this->getPathBase('exe'), $nsi);\r
-               $favicon = $this->vdir . 'data/favicon.ico';\r
-               if ($this->theme->parametres->favicon == '') {\r
-                       $this->copy(WS_COMPILE_ASSETS . '/fluidbook.ico', $favicon);\r
-               }\r
-               $nsi = str_replace('$favicon', $favicon, $nsi);\r
-\r
-               $this->nsi = $nsi;\r
-       }\r
-\r
-       public function makePackage($zip) {\r
-               $this->preparePackage();\r
-\r
-               $tmp = cubeFiles::tempnam() . '.nsi';\r
-               file_put_contents($tmp, $this->nsi);\r
-               $makensis = new CubeIT_CommandLine('/usr/local/bin/makensis');\r
-               $makensis->setArg(null, $tmp);\r
-               $makensis->execute();\r
-               $makensis->debug();\r
-\r
-               return $this->getURLBase('exe');\r
-       }\r
-\r
-       public function __destruct() {\r
-\r
-       }\r
+class wsPackagerWinINSTHTML extends wsPackagerWinEXEHTML\r
+{\r
+\r
+    protected $nsi;\r
+    protected $nsifile = 'html';\r
+\r
+    public function __construct($book_id)\r
+    {\r
+        parent::__construct($book_id);\r
+        $this->version = 'win-ins-html';\r
+    }\r
+\r
+    protected function preparePackage()\r
+    {\r
+        parent::preparePackage();\r
+\r
+        $this->makeNSI();\r
+    }\r
+\r
+    protected function makeNSI()\r
+    {\r
+        global $core;\r
+\r
+        $winvdir = $this->getFinalPackageDir();\r
+\r
+        $daoLang = new wsDAOLang($core->con);\r
+        $lang = $daoLang->selectById($this->book->lang);\r
+\r
+        if ($lang->nsis == 'Arabic') {\r
+            $lang->nsis = 'English';\r
+        }\r
+\r
+        if (!file_exists(WS_FILES . '/packager/download')) {\r
+            mkdir(WS_FILES . '/packager/download', 0777, true);\r
+        }\r
+\r
+        $fname = $this->exeName;\r
+        $title = $this->appName;\r
+\r
+        $nsi = file_get_contents(WS_COMPILE_ASSETS . '/' . $this->nsifile . '.nsi');\r
+        $nsi = str_replace('$name', $title, $nsi);\r
+        $nsi = str_replace('$htmldir', WS_COMPILE_ASSETS, $nsi);\r
+        $nsi = str_replace('$fname', $fname, $nsi);\r
+        $nsi = str_replace('$fdir', $winvdir, $nsi);\r
+        $nsi = str_replace('$titre', $title, $nsi);\r
+        $nsi = str_replace('$lang', $lang->nsis, $nsi);\r
+        $nsi = str_replace('$nwplatform', $this->nwplatform, $nsi);\r
+        $nsi = str_replace('$nsisdir', '/usr/share/nsis', $nsi);\r
+        $nsi = str_replace('$output', $this->getPathBase('exe'), $nsi);\r
+        $favicon = $this->vdir . 'data/favicon.ico';\r
+        if ($this->theme->parametres->favicon == '') {\r
+            $this->copy(WS_COMPILE_ASSETS . '/fluidbook.ico', $favicon);\r
+        } else if (!file_exists($favicon)) {\r
+            $pngFile = WS_THEMES . '/' . $this->theme->theme_id . '/' . $this->theme->parametres->favicon;\r
+            $icoFile = WS_THEMES . '/' . $this->theme->theme_id . '/favicon.ico';\r
+            if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {\r
+                $tmp = CubeIT_Files::tempnam() . '.png';\r
+                $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";\r
+                `$convert`;\r
+\r
+                $icotool = new CubeIT_CommandLine('icotool');\r
+                $icotool->setArg('c');\r
+                $icotool->setArg('o', $icoFile);\r
+                $icotool->setArg(null, $tmp);\r
+                $icotool->execute();\r
+\r
+                unlink($tmp);\r
+            }\r
+            $this->copy($icoFile, $favicon);\r
+\r
+        }\r
+        $nsi = str_replace('$favicon', $favicon, $nsi);\r
+\r
+        $this->nsi = $nsi;\r
+    }\r
+\r
+    public function makePackage($zip)\r
+    {\r
+        $this->preparePackage();\r
+\r
+        $tmp = cubeFiles::tempnam() . '.nsi';\r
+        file_put_contents($tmp, $this->nsi);\r
+        $makensis = new CubeIT_CommandLine('/usr/local/bin/makensis');\r
+        $makensis->setArg(null, $tmp);\r
+        $makensis->execute();\r
+        $makensis->debug();\r
+\r
+        return $this->getURLBase('exe');\r
+    }\r
+\r
+    public function __destruct()\r
+    {\r
+\r
+    }\r
 \r
 }
\ No newline at end of file