From 086ddbdaa0500d473622db520f386dedc90a21fa Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 5 Mar 2015 17:23:03 +0000 Subject: [PATCH] Make a Fluidbook version compatible when opened in a local browser window --- fluidbook/compile/_protect/folders.ini | 4 +- fluidbook/compile/_protect/settings.xml | 36 ++++--- fluidbook/compile/index.html | 93 +++++++++++-------- inc/ws/Controlleur/class.ws.ajax.php | 89 +++++++++--------- inc/ws/Controlleur/class.ws.url.php | 1 + inc/ws/Util/class.ws.secure.swf.php | 44 ++++----- inc/ws/Util/packager/_common.php | 2 +- .../Util/packager/class.ws.packager.html.php | 29 +++--- inc/ws/Util/packager/class.ws.packager.php | 2 + .../packager/class.ws.packager.win.html.php | 12 +++ 10 files changed, 171 insertions(+), 141 deletions(-) create mode 100644 inc/ws/Util/packager/class.ws.packager.win.html.php diff --git a/fluidbook/compile/_protect/folders.ini b/fluidbook/compile/_protect/folders.ini index 417d91ea7..1955d6da5 100644 --- a/fluidbook/compile/_protect/folders.ini +++ b/fluidbook/compile/_protect/folders.ini @@ -1,8 +1,8 @@ [Settings] -LastUsedSwfDir = C:\Users\Vincent +LastUsedSwfDir = H:\Works\fluidbook3d LastUsedOutputDir = C:\Users\Vincent LastUsedDeobfuscationDir = C:\Users\Vincent LastUsedLoaderDir = C:\Users\Vincent LastUsedProjectDir = H:\Works\cubeExtranet\fluidbook\compile\_protect LastUsedLibraryDir = C:\Users\Vincent -RecentProjects = H:\Works\cubeExtranet\fluidbook\compile\_protect\fluidbook.sspj \ No newline at end of file +RecentProjects = H:\Works\cubeExtranet\fluidbook\compile\_protect\offline.sspj;H:\Works\cubeExtranet\fluidbook\compile\_protect\fluidbook.sspj \ No newline at end of file diff --git a/fluidbook/compile/_protect/settings.xml b/fluidbook/compile/_protect/settings.xml index ded9a1a6f..5388241a0 100644 --- a/fluidbook/compile/_protect/settings.xml +++ b/fluidbook/compile/_protect/settings.xml @@ -1,5 +1,5 @@ - + @@ -57,15 +57,14 @@ x - - - y - - - -8 - - - + + -8 + + + + y + + -8 @@ -76,18 +75,17 @@ width - - - height - - - 1036 - - - + 1696 + + height + + + 1036 + + diff --git a/fluidbook/compile/index.html b/fluidbook/compile/index.html index 450d8a6fb..47953161d 100644 --- a/fluidbook/compile/index.html +++ b/fluidbook/compile/index.html @@ -1,44 +1,57 @@ - - - - - - - - - - $favicon - $robots - $facebook - $description - $keywords - $title - - - - - $ga - $redirectScript - - -
-
-
$alt
-
- + } + + + $ga + $redirectScript + + +
+
+
$alt
+
+ \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 0fb3ae2da..3c607d7e9 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -24,7 +24,7 @@ class wsAjax extends cubeAjax { public static function saveClient($args, &$x) { global $core; $dao = new commonDAOEntreprise($core->con); -// Creation de l'entreprise + // Creation de l'entreprise if ($_POST['entreprise_id'] == 'new') { if (!isset($_POST['ws_admin']) || !$_POST['ws_admin']) { $_POST['ws_admin'] = $core->user->utilisateur_id; @@ -35,7 +35,7 @@ class wsAjax extends cubeAjax { $_POST['ws_admin'] = $core->user->utilisateur_id; } $entreprise = $dao->sauve($_POST); -// Si c'est une nouvelle entreprise, on crée également le contact + // Si c'est une nouvelle entreprise, on crée également le contact if ($_POST['entreprise_id'] == 'new') { $data = $_POST['contact']; $data['entreprise'] = $entreprise->entreprise_id; @@ -450,13 +450,13 @@ class wsAjax extends cubeAjax { if (!self::valideDemandeDevis($x)) { return; } -// L'utilisateur est-il déjà dans la base ? + // L'utilisateur est-il déjà dans la base ? $daoUtilisateur = new commonDAOUtilisateur($core->con); $utilisateur = $daoUtilisateur->selectByEmail($_POST['email']); if ($utilisateur != null) { $utilisateur_id = $utilisateur->utilisateur_id; } else { -// Création de l'entreprise + // Création de l'entreprise $daoEntreprise = new commonDAOEntreprise($core->con); $datas = array(); $datas['entreprise_id'] = 'new'; @@ -474,7 +474,7 @@ class wsAjax extends cubeAjax { $datas['ws_grade'] = 1; $datas['ws_admin'] = 1; $entreprise = $daoEntreprise->sauve($datas); -// Création de l'utilisateur + // Création de l'utilisateur $datas = array(); $datas['utilisateur_id'] = 'new'; $datas['prenom'] = $_POST['prenom']; @@ -509,21 +509,21 @@ class wsAjax extends cubeAjax { $daoDemande->sauve($datas); $fields = array('prenom' => 'Prenom', - 'nom' => 'Nom', - 'email' => 'E-mail', - 'telephone' => 'Telephone', - 'rs' => 'Société', - 'site' => 'Site web', - 'adresse' => 'Adresse', - 'code_postal' => 'Code postal', - 'ville' => 'Ville', - 'pays' => 'Pays', - 'produits' => 'Type', - 'lang' => 'Langue du visiteur', - 'nombre_liens' => 'Liens', - 'nombre_pages' => 'Pages', - 'nombre_langues' => 'Langues', - 'detail' => 'Commentaires'); + 'nom' => 'Nom', + 'email' => 'E-mail', + 'telephone' => 'Telephone', + 'rs' => 'Société', + 'site' => 'Site web', + 'adresse' => 'Adresse', + 'code_postal' => 'Code postal', + 'ville' => 'Ville', + 'pays' => 'Pays', + 'produits' => 'Type', + 'lang' => 'Langue du visiteur', + 'nombre_liens' => 'Liens', + 'nombre_pages' => 'Pages', + 'nombre_langues' => 'Langues', + 'detail' => 'Commentaires'); $mail = new cubeMail(); $mail->charset = 'UTF-8'; $mail->from = $_POST['prenom'] . ' ' . $_POST['nom'] . '<' . $_POST['email'] . '>'; @@ -574,7 +574,7 @@ class wsAjax extends cubeAjax { $_POST['site'] = $_POST['site_internet']; } file_put_contents(ROOT . '/cache/demandeDevis.txt', print_r($_POST, true)); -// Validation des champs de formulaires + // Validation des champs de formulaires $ok = true; return $ok; } @@ -643,14 +643,14 @@ class wsAjax extends cubeAjax { } elseif ($demande->status > 1) { $res = __("Cette demande est actuellement en cours de traitement"); } else { -// On place la demande comme en cours d'édition + // On place la demande comme en cours d'édition $dao->setAdministrateur($demande->demande_id, $core->user->utilisateur_id); -// On vérifie que l'utilisateur n'est pas déjà géré par un revendeur + // On vérifie que l'utilisateur n'est pas déjà géré par un revendeur $demandeur = $daoUtilisateur->selectById($demande->utilisateur, 'utilisateurs_entreprise'); $administrateurs = $daoUtilisateur->selectWSAdministrateursId(); if (!is_null($demandeur->ws_admin) && !in_array($demandeur->ws_admin, $administrateurs)) { -// Si déjà géré par un revendeur + // Si déjà géré par un revendeur $revendeur = $daoUtilisateur->selectById($demandeur->ws_admin, 'utilisateurs_entreprise'); $actions[__('Je confie la demande à') . ' ' . $revendeur->rs . ' (' . $revendeur->prenom . ' ' . $revendeur->nom . ')'] = $demandeur->ws_admin; } else { @@ -832,17 +832,17 @@ class wsAjax extends cubeAjax { $rlinks = array(); foreach ($links as $k => $link) { if ($link['page'] >= $from) { - $link['page']+=$offset; + $link['page'] += $offset; } if ($internal && $link['type'] == 5) { if ($link['numerotation'] == 'physical') { if ($link['to'] >= $from) { - $link['to']+=$offset; + $link['to'] += $offset; } } else { $ph = array_search($link['to'], $numerotation) + 1; if ($ph >= $from) { - $ph+=$offset; + $ph += $offset; $vi = $numerotation[($ph - 1)]; $link['to'] = $vi; } @@ -855,7 +855,7 @@ class wsAjax extends cubeAjax { $rrulers = array(); foreach ($rulers as $k => $ruler) { if ($ruler['page'] > $from) { - $ruler['page']+=$offset; + $ruler['page'] += $offset; } $rrulers[$k] = $ruler; } @@ -889,22 +889,23 @@ class wsAjax extends cubeAjax { public static function formExportBook($book_id) { global $core; $choices = array(__('Télécharger') => 'download', - __("Installer sur le serveur d'hébergement") => 'install_hosting', - __("Installer sur l'espace de références") => 'install_references', - __('Installer sur un serveur distant') => 'install_ftp', - __('Envoyer vers un projet Phonegap Android') => 'phonegap_android', - __('Envoyer vers un projet Phonegap iOS') => 'phonegap_ios' + __("Installer sur le serveur d'hébergement") => 'install_hosting', + __("Installer sur l'espace de références") => 'install_references', + __('Installer sur un serveur distant') => 'install_ftp', + __('Envoyer vers un projet Phonegap Android') => 'phonegap_android', + __('Envoyer vers un projet Phonegap iOS') => 'phonegap_ios' ); $formatInstall = array('online' => false, - 'v1' => false, - 'html' => false, - 'v2' => false, - 'win-exe' => 'zip', - 'win-ins' => 'exe', - 'mac-exe' => 'zip', - 'win-cd' => 'zip', - 'phonegap' => 'zip'); + 'v1' => false, + 'html' => false, + 'v2' => false, + 'win-exe' => 'zip', + 'win-ins' => 'exe', + 'win-html' => 'zip', + 'mac-exe' => 'zip', + 'win-cd' => 'zip', + 'phonegap' => 'zip'); $defaultVersion = isset($_POST['version']) ? $_POST['version'] : 'online'; $version = '' . __('Version') . '' . form::combo('version', wsUrl::getFluidbookVersions(true), $defaultVersion) . ''; @@ -933,7 +934,7 @@ class wsAjax extends cubeAjax { $datas = json_decode($book->exportdatas, true); } - $res.=$version; + $res .= $version; if (!isset($datas[$defaultAction][$defaultVersion])) { $datas[$defaultAction][$defaultVersion] = array('dir' => '', 'file' => ''); @@ -979,7 +980,7 @@ class wsAjax extends cubeAjax { $res .= '' . $s . '' . form::field(array('destination[dir]', 'destination'), 50, 128, $defaultDestination['dir']) . ' / ' . $destinationFile . ''; } else { - $res.=$version; + $res .= $version; } $res .= '' . form::hidden('changed', '') . '' . $core->typo->BoutonOK(__('Exporter')) . ''; @@ -1001,7 +1002,7 @@ class wsAjax extends cubeAjax { $env = Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI; -// Notifications + // Notifications $apns = new Zend_Mobile_Push_Apns(); if ($env == Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI) { diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index fa9c637e0..5db03571d 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -490,6 +490,7 @@ class wsUrl { $versions['win-ins'] = array('title' => __('Version offline') . ' - ' . __('Installeur Auto-executable Windows'), 'icon' => cubeMedia::silk('application_view_tile.png')); $versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png')); $versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png')); + $versions['win-html'] = array('title' => __('Version offline') . ' - ' . __('HTML'), 'icon' => cubeMedia::silk('cd.png')); if ($droits->admin) { $versions['phonegap'] = array('title' => __('Version offline') . ' - ' . __('Application mobile'), 'icon' => cubeMedia::image(IMG . '/phonegap.png')); } diff --git a/inc/ws/Util/class.ws.secure.swf.php b/inc/ws/Util/class.ws.secure.swf.php index b94227ce7..8c9a9be0e 100644 --- a/inc/ws/Util/class.ws.secure.swf.php +++ b/inc/ws/Util/class.ws.secure.swf.php @@ -1,4 +1,5 @@ filemtime(self::$configLocal)) { self::updateConfigFile(); } } - protected static function updateConfigFile() - { + protected static function updateConfigFile() { $x = simplexml_load_file(self::$configOriginal); // Remplace les chemins par les chemins des fichiers sur le serveur self::replacePathFiles($x, 'inputFiles', self::$unprotected); self::replacePathFiles($x, 'outputFiles', self::$protected); - foreach($x->xpath("//void[@property='fileFullName']") as $f) { + foreach ($x->xpath("//void[@property='fileFullName']") as $f) { $fname = trim((string)$f->string); $fname = str_replace('\\', '/', $fname); @@ -63,15 +69,14 @@ class wsSecureSWF { file_put_contents(self::$configLocal, $x->asXML()); } - protected static function replacePathFiles($x, $property, $dir) - { + protected static function replacePathFiles($x, $property, $dir) { $o1 = $x->xpath("//void[@property='$property']"); $o = array_pop($o1); $l = simplexml_load_string(''); $a = $l->addChild('array'); $a->addAttribute('class', 'java.lang.String'); $a->addAttribute('length', count(self::$files)); - foreach(self::$files as $k => $f) { + foreach (self::$files as $k => $f) { $v = $a->addChild('void'); $v->addAttribute('index', $k); $s = $v->addChild('string', $dir . $f); @@ -79,8 +84,7 @@ class wsSecureSWF { cubeXML::replace($o, $l); } - protected static function protectFiles() - { + protected static function protectFiles($type) { $secureSWF = new cubeCommandLine('secureSWF', null, true); $secureSWF->setSudo(); $secureSWF->setPath(CONVERTER_PATH); @@ -88,8 +92,6 @@ class wsSecureSWF { $secureSWF->setManualArg(self::$protected); $secureSWF->execute(); - file_put_contents(WS_COMPILE_ASSETS . '/_protect/secure.log', $secureSWF->commande . "\n\n\n" . $secureSWF->output); + file_put_contents(WS_COMPILE_ASSETS . '/_protect/secure_' . $type . '.log', $secureSWF->commande . "\n\n\n" . $secureSWF->output); } } - -?> \ No newline at end of file diff --git a/inc/ws/Util/packager/_common.php b/inc/ws/Util/packager/_common.php index bf7d8836b..db43ba1bc 100644 --- a/inc/ws/Util/packager/_common.php +++ b/inc/ws/Util/packager/_common.php @@ -5,8 +5,8 @@ $__autoload['wsPackagerHTML'] = dirname(__FILE__) . '/class.ws.packager.html.php $__autoload['wsPackagerWinEXE'] = dirname(__FILE__) . '/class.ws.packager.win.exe.php'; $__autoload['wsPackagerWinINST'] = dirname(__FILE__) . '/class.ws.packager.win.inst.php'; $__autoload['wsPackagerWinCD'] = dirname(__FILE__) . '/class.ws.packager.win.cd.php'; +$__autoload['wsPackagerWinHTML'] = dirname(__FILE__) . '/class.ws.packager.win.html.php'; $__autoload['wsPackagerMacEXE'] = dirname(__FILE__) . '/class.ws.packager.mac.exe.php'; $__autoload['wsPackagerAIR'] = dirname(__FILE__) . '/class.ws.packager.air.php'; $__autoload['wsPackagerV1'] = dirname(__FILE__) . '/class.ws.packager.v1.php'; $__autoload['wsPackagerPhonegap'] = dirname(__FILE__) . '/class.ws.packager.phonegap.php'; -?> \ No newline at end of file diff --git a/inc/ws/Util/packager/class.ws.packager.html.php b/inc/ws/Util/packager/class.ws.packager.html.php index 06e28fb60..3b24de56b 100644 --- a/inc/ws/Util/packager/class.ws.packager.html.php +++ b/inc/ws/Util/packager/class.ws.packager.html.php @@ -4,6 +4,7 @@ class wsPackagerHTML extends wsPackager { protected $origHTML; protected $_labels = array(); + protected $_allowNeworking = 'all'; public function __construct($book_id, $vdir = null, $whole = true) { parent::__construct($book_id, $vdir, $whole); @@ -107,20 +108,20 @@ class wsPackagerHTML extends wsPackager { // Stuffs to replace in html $toReplace = array('lang' => strtolower($this->book->lang), - 'ga' => $ga, - 'facebook' => $facebook, - 'bgcolor' => $this->theme->parametres->loadingBackColor, - 'redirectMobile' => $redirectMobile, - 'redirectPDF' => $redirectPDF, - 'junk' => TIME, - 'description' => $description, - 'robots' => $robots, - 'favicon' => $favicon, - 'flashversion' => $this->getMinFlashVersion(), - 'fv' => json_encode($this->getFlashvars()), - 'alwaysHTML5' => $alwaysHTML5, - 'keywords' => $keywords); - + 'ga' => $ga, + 'facebook' => $facebook, + 'bgcolor' => $this->theme->parametres->loadingBackColor, + 'redirectMobile' => $redirectMobile, + 'redirectPDF' => $redirectPDF, + 'junk' => TIME, + 'description' => $description, + 'robots' => $robots, + 'favicon' => $favicon, + 'flashversion' => $this->getMinFlashVersion(), + 'fv' => json_encode($this->getFlashvars()), + 'alwaysHTML5' => $alwaysHTML5, + 'keywords' => $keywords, + 'allowNetworking' => $this->_allowNeworking); $this->origHTML = file_get_contents($this->vdir . '/index.html'); diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index 473917563..38df7af16 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -33,6 +33,8 @@ class wsPackager { $packager = new wsPackagerMacEXE($book_id); } elseif ($version == 'v1') { $packager = new wsPackagerV1($book_id); + } elseif ($version == 'win-html') { + $packager = new wsPackagerWinHTML($book_id); } else if ($version == 'phonegap') { $packager = new wsPackagerPhonegap($book_id); } diff --git a/inc/ws/Util/packager/class.ws.packager.win.html.php b/inc/ws/Util/packager/class.ws.packager.win.html.php new file mode 100644 index 000000000..affa76393 --- /dev/null +++ b/inc/ws/Util/packager/class.ws.packager.win.html.php @@ -0,0 +1,12 @@ +vdir . '/index.swf'); + unlink($this->vdir . '/player.swf'); + copy(WS_COMPILE_ASSETS . '/offline.swf', $this->vdir . '/index.swf'); + } +} \ No newline at end of file -- 2.39.5