From 14ba2ffc37a1a6b9d63b7e15aae87583bdf9e96b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 9 Mar 2016 10:57:12 +0000 Subject: [PATCH] #fluidbook-workshop : fix problem with mail and https redirect (add an exception to permit to old fluidbook continue to use the http service) Redirect calls to archived docs files (back & front) Begin to integrate new theme --- .htaccess | 8 + .../icones/interface/interface-previous.svg | 1 - inc/ws/Controlleur/class.ws.services.php | 5 +- inc/ws/Controlleur/class.ws.url.php | 5 + inc/ws/DAO/class.ws.dao.book.php | 31 ++- inc/ws/DAO/class.ws.dao.document.php | 2 +- inc/ws/Metier/class.ws.document.php | 37 ++- inc/ws/Metier/class.ws.theme.parametres.php | 256 +++++++++--------- inc/ws/Util/html5/class.ws.html5.compiler.php | 12 +- inc/ws/Util/html5/class.ws.html5.links.php | 4 +- .../Util/packager/class.ws.packager.html.php | 2 +- .../Util/packager/class.ws.packager.html5.php | 8 +- inc/ws/Util/packager/class.ws.packager.v1.php | 60 ++-- .../html5/class.ws.packager.html5.php | 176 ++++++------ 14 files changed, 332 insertions(+), 275 deletions(-) diff --git a/.htaccess b/.htaccess index dd559d2bc..c76967de8 100644 --- a/.htaccess +++ b/.htaccess @@ -38,12 +38,20 @@ AddCharset UTF-8 log RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} workshop.fluidbook.com + RewriteCond %{REQUEST_URI} !^/s/ + RewriteCond %{REQUEST_URI} !^/services/ + RewriteCond %{REQUEST_URI} !^/crossdomain.xml RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} extranet.cubedesigners.com RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + # Docs + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^fluidbook/docs/(.*)$ /fluidbook/docs1/$1 [L] + # Favicon RewriteCond %{HTTP_HOST} cubedesigners RewriteRule ^favicon.ico$ images/extranet/favicon.ico [L] diff --git a/fluidbook/icones/interface/interface-previous.svg b/fluidbook/icones/interface/interface-previous.svg index d68cb27d1..a7025781d 100644 --- a/fluidbook/icones/interface/interface-previous.svg +++ b/fluidbook/icones/interface/interface-previous.svg @@ -1,5 +1,4 @@ - diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 2ecd8bf81..14773ef15 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -832,7 +832,10 @@ class wsServices extends cubeFlashGateway { $traductions[$r->lang_id] = json_decode($r->traductions); } - $d = array('id' => $id, 'res' => $resolution, 'ns' => $ns, 'langs' => $langs, 'langnames' => $langsnames, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures, 'traductions' => $traductions, 'contents' => $contents); + $theme = $collection->theme; + $settings = $collection->settings; + + $d = array('id' => $id, 'res' => $resolution, 'ns' => $ns, 'langs' => $langs, 'langnames' => $langsnames, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures, 'traductions' => $traductions, 'contents' => $contents, 'theme' => $theme, 'settings' => $settings); if (!$collection->settings['offline']) { $d = array_merge($d, $this->_getManifest($publications, '/fluidbook/collections/versions/' . $id . '/' . $version . '/' . $os, $books, $resolution)); } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index b7aa458b4..56fc76ed6 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -323,6 +323,10 @@ class wsUrl { $res .= '
' . __("Synchronisations supplémentaires") . '' . form::textarea(array('settings[offline_syncs]', 'offline_syncs'), 30, 3, $collection->settings['offline_syncs']) . '
'; $res .= ''; + + if (!isset($collection->settings['perline']) || !$collection->settings['perline']) { + $collection->settings['perline'] = 3; + } $res .= '

' . __('Thème') . '

'; $res .= ''; $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"), 'icon' => __("Icône de l'application") . ' (1024x1024px)'); @@ -334,6 +338,7 @@ class wsUrl { $res .= ''; $res .= ''; $res .= ''; + $res .= ''; $res .= '
' . __('Couleur des textes') . '#' . form::field(array('settings[couleurC]', 'couleurC'), 6, 6, $collection->settings['couleurC']) . '
' . __('Couleur des titres de publication') . '#' . form::field(array('settings[couleurE]', 'couleurC'), 6, 6, $collection->settings['couleurE']) . '
' . __('Couleur de fond') . '#' . form::field(array('settings[couleurD]', 'couleurD'), 6, 6, $collection->settings['couleurD']) . '
' . __('Nombre de publication par ligne') . '' . form::field(array('settings[perline]', 'perline'), 1, 1, $collection->settings['perline']) . '
'; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index d641e86b3..fc74f946c 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -115,7 +115,16 @@ class wsDAOBook extends commonDAO { } else { $table = 'books_vue'; } - $sql = 'SELECT * FROM ' . $table . ' WHERE book_id IN (' . implode(',', $book_ids) . ')'; + + $ids = array(); + foreach ($book_ids as $bid) { + fb($bid); + if (intval($bid) > 0) { + $ids[] = $bid; + } + } + + $sql = 'SELECT * FROM ' . $table . ' WHERE book_id IN (' . implode(',', $ids) . ')'; $books = $this->factory($this->con->select($sql)); $res = array(); foreach ($books as $book) { @@ -835,7 +844,7 @@ class wsDAOBook extends commonDAO { $docs = array_unique($docs); foreach ($docs as $doc) { - $out = WS_DOCS . '/' . $doc . '/'; + $out = wsDocument::getDir($doc); $fwstk = new cubeCommandLine('fwstk'); $fwstk->setPath(CONVERTER_PATH); @@ -850,8 +859,8 @@ class wsDAOBook extends commonDAO { $index = array(); $textes = array(); foreach ($pages as $book_page => $infos) { - $tfile = WS_DOCS . '/' . $infos['document_id'] . '/' . $prefix . 'p' . $infos['document_page'] . '.txt'; - $ifile = WS_DOCS . '/' . $infos['document_id'] . '/' . $prefix . 'i' . $infos['document_page'] . '.txt'; + $tfile = wsDocument::getDir($infos['document_id']) . $prefix . 'p' . $infos['document_page'] . '.txt'; + $ifile = wsDocument::getDir($infos['document_id']) . $prefix . 'i' . $infos['document_page'] . '.txt'; CubeIT_Util_Gzip::compressIfNotCompressed($tfile); CubeIT_Util_Gzip::compressIfNotCompressed($ifile); $text = CubeIT_Util_Gzip::file_get_contents($tfile); @@ -1252,8 +1261,8 @@ class wsDAOBook extends commonDAO { $sizes = array(); foreach ($pages as $i => $infos) { - $base = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page']; - $baset = WS_DOCS . '/' . $infos['document_id'] . '/t' . $infos['document_page']; + $base = wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page']; + $baset = wsDocument::getDir($infos['document_id']) . 't' . $infos['document_page']; $swffile = $base . '.swf'; if (file_exists($swffile)) { $fsize = filesize($swffile); @@ -1480,7 +1489,7 @@ class wsDAOBook extends commonDAO { $tempswf[$i] = cubeFiles::tempnam(); $it = new imageTools(); - $image = WS_DOCS . '/' . $page['document_id'] . '/html/t150-' . $page['document_page'] . '.jpg'; + $image = wsDocument::getDir($page['document_id']) . '/html/t150-' . $page['document_page'] . '.jpg'; try { $it->loadImage($image); @@ -1528,7 +1537,7 @@ class wsDAOBook extends commonDAO { foreach ($pages as $i => $infos) { $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::Text('url', '#' . $i)); - $doc->addField(Zend_Search_Lucene_Field::UnStored('contents', file_get_contents(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt'))); + $doc->addField(Zend_Search_Lucene_Field::UnStored('contents', file_get_contents(wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.txt'))); $index->addDocument($doc); } @@ -1559,7 +1568,7 @@ class wsDAOBook extends commonDAO { if ($fmtime >= $book->composition_update) { $invalid = false; foreach ($pages as $i => $infos) { - $doc = WS_DOCS . '/' . $infos['document_id'] . '/crop.pdf'; + $doc = wsDocument::getDir($infos['document_id']) . 'crop.pdf'; if (filemtime($doc) > $fmtime) { $invalid = true; } @@ -1585,7 +1594,7 @@ class wsDAOBook extends commonDAO { $firstDoc = $infos['document_id']; } - $doc = WS_DOCS . '/' . $infos['document_id'] . '/crop.pdf'; + $doc = wsDocument::getDir($infos['document_id']) . 'crop.pdf'; if (!isset($pdfList[$doc])) { $pdfList[$doc] = $j; $nb_pages[$doc] = $infos['nb_pages']; @@ -1603,7 +1612,7 @@ class wsDAOBook extends commonDAO { if ($original) { - $this->copy(WS_DOCS . '/' . $firstDoc . '/crop.pdf', $originalPDF); + $this->copy(wsDocument::getDir($firstDoc) . 'crop.pdf', $originalPDF); } else { $args = ''; foreach ($pdfList as $doc => $index) { diff --git a/inc/ws/DAO/class.ws.dao.document.php b/inc/ws/DAO/class.ws.dao.document.php index 5f029984a..a0e235af0 100644 --- a/inc/ws/DAO/class.ws.dao.document.php +++ b/inc/ws/DAO/class.ws.dao.document.php @@ -69,7 +69,7 @@ class wsDAODocument extends commonDAO { for ($page = 1; $page <= $document->generalInfos['pages']; $page++) { $links[$page] = array(); - $csv = WS_DOCS . '/' . $document->document_id . '/p' . $page . '.csv'; + $csv = wsDocument::getDir($document->document_id) . '/p' . $page . '.csv'; if (!file_exists($csv) && file_exists($csv . '.gz')) { $csv = 'compress.zlib://' . $csv . '.gz'; } elseif (!file_exists($csv)) { diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 0ff93efe8..e35bff118 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -41,6 +41,8 @@ class wsDocument extends cubeMetier { protected $cropped; protected $rgb; + protected static $_docsDir; + const NORMAL = 0; const FLATTEN = 1; const POLY2BITMAP = 2; @@ -58,7 +60,7 @@ class wsDocument extends cubeMetier { 'UppercaseLetters' => 'letters_up', 'LowercaseLetters' => 'letters_low'); public function init() { - $this->out = WS_DOCS . '/' . $this->document_id . '/'; + $this->out = wsDocument::getDir($this->document_id); $this->log = $this->out . '/logs/'; $this->html = $this->out . '/html/'; $this->in = $this->out . 'original.pdf'; @@ -764,13 +766,14 @@ class wsDocument extends cubeMetier { $pdf2swf->setPath(CONVERTER_PATH); $pdf2swf->setArg('p', $page); + $flashversion = 10; if ($method == self::NORMAL) { // Default $multiply = 1; } elseif ($method == self::FLATTEN) { - $pdf2swf->setArg('flatten'); $multiply = 1; + $pdf2swf->setArg('flatten'); } elseif ($method == self::POLY2BITMAP) { // Raster graphics, keep texts $pdf2swf->setArg('set poly2bitmap'); @@ -783,7 +786,7 @@ class wsDocument extends cubeMetier { $pdf2swf->setArg('set multiply', $multiply); } // $pdf2swf->setManualArg('-v'); - $pdf2swf->setArg('T', 10); + $pdf2swf->setArg('T', $flashversion); $pdf2swf->setArg('set reordertags', '0'); if ($storeAllChars) { $pdf2swf->setArg('fonts'); @@ -923,6 +926,34 @@ class wsDocument extends cubeMetier { } + public static function getDir($id) { + + if(!is_array(self::$_docsDir)){ + self::$_docsDir=array(); + } + + if(isset(self::$_docsDir[$id])){ + return self::$_docsDir[$id]; + } + + $new = WS_DOCS . '/' . $id . '/'; + $old = '/mnt/sshfs/batman/home/extranet/www/fluidbook/docs/' . $id . '/'; + + if (file_exists($new . '/p1.swf')) { + self::$_docsDir[$id]=$new; + return $new; + } elseif (file_exists($old . 'p1.swf')) { + self::$_docsDir[$id]=$old; + return $old; + } + if (!file_exists($new)) { + mkdir($new, 0777, true); + self::$_docsDir[$id]=$new; + return $new; + } + } + + } ?> \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.theme.parametres.php b/inc/ws/Metier/class.ws.theme.parametres.php index 913b15b36..038fd5660 100644 --- a/inc/ws/Metier/class.ws.theme.parametres.php +++ b/inc/ws/Metier/class.ws.theme.parametres.php @@ -15,27 +15,29 @@ class wsThemeParametres extends wsParametres { parent::initFields(); /* Navigation */ + $this->fields['arrowsTheme'] = array('type' => 'boolean', "default" => false, "editable" => true, "label" => __('Nouveau thème')); $this->fields['couleurA'] = array('type' => 'couleurAlpha', 'default' => 'ff000000', 'editable' => true, - 'label' => __("Couleur de fond")); + 'label' => __("Couleur de fond")); $this->fields['arrowsColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __('Couleur des flèches')); + 'label' => __('Couleur des flèches')); $this->fields['shadeOnArrows'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Ombre portée sous les flèches')); + $this->forms['bouton'] = array('label' => __('Personnalisation des boutons'), - 'fieldsnames' => array('couleurA', 'arrowsColor', 'shadeOnArrows')); + 'fieldsnames' => array('couleurA', 'arrowsColor', 'shadeOnArrows', 'arrowsTheme')); /* Submenus */ $this->fields['couleurB'] = array('type' => 'couleurAlpha', 'default' => 'ff000000', 'editable' => true, - 'label' => __("Couleur de fond")); + 'label' => __("Couleur de fond")); $this->fields['subTextColor'] = array('type' => 'couleur', 'default' => 'ffffffff', 'editable' => true, - 'label' => __("Couleur du texte")); + 'label' => __("Couleur du texte")); $this->fields['subSelectColor'] = array('type' => 'couleurAlpha', 'default' => 'ffffffff', 'editable' => true, - 'label' => __("Couleur des zones de sélection")); + 'label' => __("Couleur des zones de sélection")); $this->fields['subTextSelectColor'] = array('type' => 'couleur', 'default' => '000000', 'editable' => true, - 'label' => __("Couleur des textes des zones de sélection")); + 'label' => __("Couleur des textes des zones de sélection")); $this->fields['subTextFieldColor'] = array('type' => 'couleur', 'default' => '000000', 'editable' => true, - 'label' => __("Couleur des textes des champs d'édition")); + 'label' => __("Couleur des textes des champs d'édition")); $this->fields['subFieldColor'] = array('type' => 'couleurAlpha', 'default' => 'ffffffff', 'editable' => true, - 'label' => __("Couleur des champs d'édition")); + 'label' => __("Couleur des champs d'édition")); $this->fields['subStrokeWidth'] = array('type' => 'integer', 'default' => 0, "editable" => true, 'label' => __('Largeur du contour')); $this->fields['subStrokeColor'] = array('type' => 'couleur', 'default' => 'ffffff', "editable" => true, 'label' => __('Couleur du contour')); $this->fields['subShade'] = array('type' => 'couleurAlpha', 'default' => '00000000', "editable" => true, 'label' => __('Ombre sous le sous-menu')); @@ -46,161 +48,161 @@ class wsThemeParametres extends wsParametres { $this->fields['subButtonDecoration'] = array('type' => 'couleur', 'default' => '797979', 'editable' => true, 'label' => __('Couleur des décorations')); $this->forms['menu'] = array('label' => __('Personnalisation des menus'), - 'fieldsnames' => array('couleurB', 'subTextColor', '|', 'subSelectColor', 'subTextSelectColor', '|', 'subTextFieldColor', 'subFieldColor', - '|', 'subStrokeWidth', 'subStrokeColor', 'subShade', 'subRound', - '|', 'subButtonCustom', 'subButtonBackground', 'subButtonColor', 'subButtonDecoration')); + 'fieldsnames' => array('couleurB', 'subTextColor', '|', 'subSelectColor', 'subTextSelectColor', '|', 'subTextFieldColor', 'subFieldColor', + '|', 'subStrokeWidth', 'subStrokeColor', 'subShade', 'subRound', + '|', 'subButtonCustom', 'subButtonBackground', 'subButtonColor', 'subButtonDecoration')); /* Search */ $this->fields['couleurS'] = array('type' => 'couleur', 'default' => '000000', 'editable' => true, - 'label' => __("Couleur du texte")); + 'label' => __("Couleur du texte")); $this->fields['searchFieldColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur du champs de saisie")); + 'label' => __("Couleur du champs de saisie")); $this->fields['searchShadeAlpha'] = array('type' => 'integer', 'default' => 0, 'editable' => true, - 'label' => __("Intensité de l'ombre dans le champ de saisie"), - 'min' => 0, 'max' => 100); + 'label' => __("Intensité de l'ombre dans le champ de saisie"), + 'min' => 0, 'max' => 100); $this->fields['highlightColor'] = array('type' => 'couleur', 'default' => '00ff00', 'editable' => true, - 'label' => __("Couleur du surlignage des résultats")); + 'label' => __("Couleur du surlignage des résultats")); $this->fields['searchFieldWidth'] = array('type' => 'integer', 'default' => 230, 'editable' => true, - 'label' => __("Largeur du champ de recherche")); + 'label' => __("Largeur du champ de recherche")); $this->fields['searchIndexNoResultColor'] = array('type' => 'couleurAlpha', 'default' => 'CC000000', 'editable' => true, - 'label' => __("Couleur de l'overlay (aucun résultat)"), - 'grade' => 5); + 'label' => __("Couleur de l'overlay (aucun résultat)"), + 'grade' => 5); $this->forms['search'] = array('label' => __('Personnalisation de la recherche'), - 'fieldsnames' => array('couleurS', 'searchFieldColor', 'searchShadeAlpha', 'searchFieldWidth', '|', 'highlightColor', '|', 'searchIndexNoResultColor')); + 'fieldsnames' => array('couleurS', 'searchFieldColor', 'searchShadeAlpha', 'searchFieldWidth', '|', 'highlightColor', '|', 'searchIndexNoResultColor')); /* Icones */ $this->fields['iconSet'] = array('type' => 'icones', 'default' => 1, 'editable' => true, - 'label' => __("Jeu d'icônes")); + 'label' => __("Jeu d'icônes")); $this->fields['colorizeIcons'] = array('type' => 'boolean', 'default' => false, 'editable' => true, - 'label' => __('Colorier les icônes')); + 'label' => __('Colorier les icônes')); $this->fields['couleurI'] = array('type' => 'couleur', 'default' => '$couleurA', 'editable' => true, - 'label' => __("Couleur des icônes")); + 'label' => __("Couleur des icônes")); $this->fields['iconShadeColor'] = array('type' => 'couleurAlpha', 'default' => '00000000', 'editable' => true, - 'label' => __("Couleur de l'effet de rollover")); + 'label' => __("Couleur de l'effet de rollover")); $this->fields['iconsHMargin'] = array('type' => 'integer', 'default' => 15, 'editable' => true, - 'label' => __('Espace entre les icônes'), 'min' => 0, 'max' => 50); + 'label' => __('Espace entre les icônes'), 'min' => 0, 'max' => 50); $this->fields['fontKit'] = array('type' => 'combo', 'default' => 'auto', 'editable' => true, - 'label' => __('Police de caractères'), 'datas' => array(__('Automatique') => 'auto', - 'VAG Rounded' => 'vagrounded', - 'Gill'=>'gill')); + 'label' => __('Police de caractères'), 'datas' => array(__('Automatique') => 'auto', + 'VAG Rounded' => 'vagrounded', + 'Gill' => 'gill')); $this->forms['icones'] = array('label' => __('Personnalisation des icônes'), - 'fieldsnames' => array('iconSet', 'iconShadeColor', '|', 'iconsHMargin', '|', 'colorizeIcons', 'couleurI', '|', 'fontKit')); + 'fieldsnames' => array('iconSet', 'iconShadeColor', '|', 'iconsHMargin', '|', 'colorizeIcons', 'couleurI', '|', 'fontKit')); /* Book */ $this->fields['bookShadeColor'] = array('type' => 'couleurAlpha', 'default' => '66000000', 'editable' => true, - 'label' => __("Couleur de l'ombre sous la publication")); + 'label' => __("Couleur de l'ombre sous la publication")); $this->fields['shadeAlpha'] = array('type' => 'integer', 'default' => 100, 'editable' => true, - 'label' => __('Transparence des ombres et reflets sur les pages'), - 'min' => 0, 'max' => 100); + 'label' => __('Transparence des ombres et reflets sur les pages'), + 'min' => 0, 'max' => 100); $this->fields['pageReflection'] = array('type' => 'boolean', 'default' => false, 'editable' => true, - 'label' => __("Afficher le reflet sur la page")); + 'label' => __("Afficher le reflet sur la page")); $this->fields['usePageEdges'] = array('type' => 'boolean', 'default' => true, 'editable' => true, - 'label' => __("Afficher la bordure des pages")); + 'label' => __("Afficher la bordure des pages")); $this->fields['displayPageNumber'] = array('type' => 'boolean', 'default' => true, 'editable' => true, - 'label' => __('Afficher les numéros de page')); + 'label' => __('Afficher les numéros de page')); $this->fields['colorPageNumber'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __('Couleur des numéros de page')); + 'label' => __('Couleur des numéros de page')); $this->fields['linksColor'] = array('type' => 'couleur', 'default' => '$couleurA', 'editable' => true, - 'label' => __('Couleur des liens')); + 'label' => __('Couleur des liens')); $this->fields['videoBackgroundColor'] = array('type' => 'couleur', 'default' => '000000', 'editable' => true, - 'label' => __('Couleur de fond des videos')); + 'label' => __('Couleur de fond des videos')); $this->fields['popupVideoOverlay'] = array('type' => 'couleurAlpha', 'default' => '00000000', 'editable' => true, - 'label' => __('Overlay placé sous les vidéos en popup')); + 'label' => __('Overlay placé sous les vidéos en popup')); $this->fields['pageEdgeColor'] = array('type' => 'couleur', 'default' => 'dddddd', 'editable' => true, - 'label' => __('Couleur de la bordure')); + 'label' => __('Couleur de la bordure')); $this->fields['pageEdgeThickness'] = array('type' => 'integer', 'default' => 100, 'editable' => true, - 'label' => __('Epaisseur de la bordure')); + 'label' => __('Epaisseur de la bordure')); $this->fields['tooltipBackColor'] = array('type' => 'couleurAlpha', 'default' => 'CC000000', 'editable' => true, - 'label' => __("Couleur de fond des infobulles")); + 'label' => __("Couleur de fond des infobulles")); $this->fields['tooltipTextColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur du texte des infobulles")); + 'label' => __("Couleur du texte des infobulles")); $this->fields['bookmarkBackgroundColor'] = array('type' => 'couleurAlpha', 'default' => 'ffadadad', 'editable' => true, - 'label' => __("Couleur de fond des marques-pages")); + 'label' => __("Couleur de fond des marques-pages")); $this->fields['bookmarkStarDisabledColor'] = array('type' => 'couleurAlpha', 'default' => '00ffffff', 'editable' => true, - 'label' => __("Couleur de l'étoile désactivée")); + 'label' => __("Couleur de l'étoile désactivée")); $this->fields['bookmarkStarEnabledColor'] = array('type' => 'couleur', 'default' => 'ff7700', 'editable' => true, - 'label' => __("Couleur de l'étoile activée")); + 'label' => __("Couleur de l'étoile activée")); $this->forms['book'] = array('label' => __('Personnalisation de la publication'), - 'fieldsnames' => array('pageReflection', 'shadeAlpha', - '|', 'usePageEdges', 'pageEdgeColor', 'pageEdgeThickness', - '|', 'bookShadeColor', - '|', 'displayPageNumber', 'colorPageNumber', - '|', 'linksColor', 'videoBackgroundColor', 'popupVideoOverlay', - '|', 'tooltipBackColor', 'tooltipTextColor', - '|', 'bookmarkBackgroundColor', 'bookmarkStarDisabledColor', 'bookmarkStarEnabledColor')); + 'fieldsnames' => array('pageReflection', 'shadeAlpha', + '|', 'usePageEdges', 'pageEdgeColor', 'pageEdgeThickness', + '|', 'bookShadeColor', + '|', 'displayPageNumber', 'colorPageNumber', + '|', 'linksColor', 'videoBackgroundColor', 'popupVideoOverlay', + '|', 'tooltipBackColor', 'tooltipTextColor', + '|', 'bookmarkBackgroundColor', 'bookmarkStarDisabledColor', 'bookmarkStarEnabledColor')); /* Credits */ $this->fields['creditsColor'] = array('type' => 'couleurAlpha', 'default' => '80ffffff', 'editable' => true, - 'label' => __("Couleur du texte")); + 'label' => __("Couleur du texte")); $this->forms['credits'] = array('label' => __('Personnalisation des crédits'), - 'fieldsnames' => array('creditsColor')); + 'fieldsnames' => array('creditsColor')); /* Background */ $this->fields['transparentBackground'] = array('type' => 'boolean', 'default' => false, 'editable' => true, - 'label' => __('Fond transparent'), 'hint' => __("Si cette option est cochée, aucun fond ne sera pris en compte (ni l'image, ni la couleur)")); + 'label' => __('Fond transparent'), 'hint' => __("Si cette option est cochée, aucun fond ne sera pris en compte (ni l'image, ni la couleur)")); $this->fields['backgroundColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur du fond")); + 'label' => __("Couleur du fond")); $this->fields['backgroundImage'] = array('type' => 'file', 'default' => 'backgroundImg.jpg', 'editable' => true, - 'label' => __('Image de fond'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); + 'label' => __('Image de fond'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); $this->fields['repeat'] = array('type' => 'combo', - 'datas' => array(__('Etirer') => wsTheme::STRETCH, - __('Etirer le fond en conservant les proportions') => wsTheme::RATIO, - __("Répéter") => wsTheme::REPEAT, - __('Ne pas répéter ni étirer') => wsTheme::NONE), - 'default' => 0, 'editable' => true, 'label' => __('Affichage du fond')); + 'datas' => array(__('Etirer') => wsTheme::STRETCH, + __('Etirer le fond en conservant les proportions') => wsTheme::RATIO, + __("Répéter") => wsTheme::REPEAT, + __('Ne pas répéter ni étirer') => wsTheme::NONE), + 'default' => 0, 'editable' => true, 'label' => __('Affichage du fond')); $this->fields['backgroundHAlign'] = array('type' => 'combo', - 'datas' => array(__('Centré') => wsTheme::CENTER, - __('Gauche') => wsTheme::LEFT, - __("Droite") => wsTheme::RIGHT), - 'default' => wsTheme::CENTER, 'editable' => true, 'label' => __('Alignement Horizontal')); + 'datas' => array(__('Centré') => wsTheme::CENTER, + __('Gauche') => wsTheme::LEFT, + __("Droite") => wsTheme::RIGHT), + 'default' => wsTheme::CENTER, 'editable' => true, 'label' => __('Alignement Horizontal')); $this->fields['backgroundVAlign'] = array('type' => 'combo', - 'datas' => array(__('Milieu') => wsTheme::MIDDLE, - __('Haut') => wsTheme::TOP, - __("Bas") => wsTheme::BOTTOM), - 'default' => wsTheme::MIDDLE, 'editable' => true, 'label' => __('Alignement Vertical')); + 'datas' => array(__('Milieu') => wsTheme::MIDDLE, + __('Haut') => wsTheme::TOP, + __("Bas") => wsTheme::BOTTOM), + 'default' => wsTheme::MIDDLE, 'editable' => true, 'label' => __('Alignement Vertical')); $this->fields['displayBackgroundDuringLoading'] = array('type' => 'boolean', 'default' => true, 'editable' => true, - 'label' => __('Afficher le fond pendant le chargement'), 'hint' => __("Si cette option est désactivée, le fond ne sera affiché qu'à la fin du chargement")); + 'label' => __('Afficher le fond pendant le chargement'), 'hint' => __("Si cette option est désactivée, le fond ne sera affiché qu'à la fin du chargement")); $this->forms['background'] = array('label' => __('Personnalisation du fond'), - 'fieldsnames' => array('transparentBackground', '|', 'backgroundColor', '|', 'backgroundImage', - 'repeat', 'backgroundHAlign', 'backgroundVAlign', '|', 'displayBackgroundDuringLoading')); + 'fieldsnames' => array('transparentBackground', '|', 'backgroundColor', '|', 'backgroundImage', + 'repeat', 'backgroundHAlign', 'backgroundVAlign', '|', 'displayBackgroundDuringLoading')); /* Menu bar */ $this->fields['menuHeight'] = array('type' => 'integer', 'default' => 39, 'editable' => true, - 'label' => __('Hauteur (en pixels)')); + 'label' => __('Hauteur (en pixels)')); $this->fields['menuColor'] = array('type' => 'couleurAlpha', 'default' => 'ffffffff', 'editable' => true, - 'label' => __("Couleur du fond")); + 'label' => __("Couleur du fond")); $this->fields['shadeOnMenu'] = array('type' => 'boolean', 'default' => true, 'editable' => true, - 'label' => __('Ombre portée sous la barre du menu')); + 'label' => __('Ombre portée sous la barre du menu')); $this->fields['menuImage'] = array('type' => 'file', 'default' => 'menu_back.png', 'editable' => true, - 'label' => __('Image de fond'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); + 'label' => __('Image de fond'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); $this->fields['invertMenuPosition'] = array('type' => 'boolean', 'default' => false, 'editable' => true, - 'label' => __("Intervertir le menu et le logo")); + 'label' => __("Intervertir le menu et le logo")); $this->fields['topBar'] = array('type' => 'file', 'default' => '', 'editable' => true, - 'label' => __('Top Bar'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); + 'label' => __('Top Bar'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); $this->fields['topBarAlign'] = array('type' => 'combo', - 'datas' => array(__('Centré') => wsTheme::CENTER, - __('Gauche') => wsTheme::LEFT, - __("Droite") => wsTheme::RIGHT), - 'default' => wsTheme::LEFT, 'editable' => true, 'label' => __('Alignement Horizontal de la Top Bar')); + 'datas' => array(__('Centré') => wsTheme::CENTER, + __('Gauche') => wsTheme::LEFT, + __("Droite") => wsTheme::RIGHT), + 'default' => wsTheme::LEFT, 'editable' => true, 'label' => __('Alignement Horizontal de la Top Bar')); $this->fields['afterSearch'] = array('type' => 'file', 'default' => '', 'editable' => true, - 'label' => __('Image supplémentaire'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id, - 'hint' => __('Image disposée à droite du champ de recherche') + 'label' => __('Image supplémentaire'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id, + 'hint' => __('Image disposée à droite du champ de recherche') ); $this->forms['menubar'] = array('label' => __('Personnalisation de la barre de menu'), - 'fieldsnames' => array('menuHeight', '|', 'menuColor', '|', 'menuImage', '|', 'shadeOnMenu', '|', 'invertMenuPosition', '|', 'topBar', 'topBarAlign', '|', 'afterSearch')); + 'fieldsnames' => array('menuHeight', '|', 'menuColor', '|', 'menuImage', '|', 'shadeOnMenu', '|', 'invertMenuPosition', '|', 'topBar', 'topBarAlign', '|', 'afterSearch')); /* Menu bar logo */ $imageFilter = new stdClass(); @@ -208,56 +210,56 @@ class wsThemeParametres extends wsParametres { $imageFilter->extensions = '*.png'; $this->fields['logo'] = array('type' => 'file', 'default' => 'menu_clientLogo.png', 'editable' => true, - 'label' => __('Logo'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); + 'label' => __('Logo'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); $this->fields['favicon'] = array('type' => 'file', 'default' => '', 'editable' => true, - 'label' => __('Icone (pour favicon et CD-ROM)'), - 'path' => $themeRoot, - 'fileFilter' => $imageFilter, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=favicon', - 'hint' => __('Image PNG de 256x256')); + 'label' => __('Icone (pour favicon et CD-ROM)'), + 'path' => $themeRoot, + 'fileFilter' => $imageFilter, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=favicon', + 'hint' => __('Image PNG de 256x256')); $this->fields['iosicon'] = array('type' => 'file', 'default' => '', 'editable' => true, - 'label' => __('Icone (pour application iOS)'), - 'path' => $themeRoot, - 'fileFilter' => $imageFilter, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=iosicon', - 'hint' => __('Image PNG de 1024x1024')); + 'label' => __('Icone (pour application iOS)'), + 'path' => $themeRoot, + 'fileFilter' => $imageFilter, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=iosicon', + 'hint' => __('Image PNG de 1024x1024')); $this->fields['androidicon'] = array('type' => 'file', 'default' => '', 'editable' => true, - 'label' => __('Icone (pour application Android)'), - 'path' => $themeRoot, - 'fileFilter' => $imageFilter, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=androidicon', - 'hint' => __('Image PNG de 1024x1024')); + 'label' => __('Icone (pour application Android)'), + 'path' => $themeRoot, + 'fileFilter' => $imageFilter, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=androidicon', + 'hint' => __('Image PNG de 1024x1024')); $this->forms['logo'] = array('label' => __('Personnalisation du logo'), - 'fieldsnames' => array('logo', '|', 'favicon', 'iosicon', 'androidicon')); + 'fieldsnames' => array('logo', '|', 'favicon', 'iosicon', 'androidicon')); /* Loader */ $this->fields['logoLoader'] = array('type' => 'file', 'default' => 'logoLoader.png', 'editable' => true, - 'label' => __('Logo affiché au chargement'), - 'path' => $themeRoot, - 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); + 'label' => __('Logo affiché au chargement'), + 'path' => $themeRoot, + 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id); $this->fields['couleurL'] = array('type' => 'couleur', 'default' => '', 'editable' => true, - 'label' => __("Couleur principale de la barre de chargement")); + 'label' => __("Couleur principale de la barre de chargement")); $this->fields['loadingSecColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur secondaire de la barre de chargement")); + 'label' => __("Couleur secondaire de la barre de chargement")); $this->fields['loadingBackColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur du fond affichée avant l'affichage de l'image de fond")); + 'label' => __("Couleur du fond affichée avant l'affichage de l'image de fond")); $this->fields['loaderPosition'] = array('type' => 'boolean', 'default' => false, 'editable' => true, - 'label' => __('Placer le logo à gauche et le loader à droite'), 'grade' => 3); + 'label' => __('Placer le logo à gauche et le loader à droite'), 'grade' => 3); $this->forms['loader'] = array('label' => __('Personnalisation du loader'), - 'fieldsnames' => array('loadingBackColor', '|', 'couleurL', 'loadingSecColor', 'logoLoader', 'loaderPosition')); + 'fieldsnames' => array('loadingBackColor', '|', 'couleurL', 'loadingSecColor', 'logoLoader', 'loaderPosition')); /* Pages bar */ $this->fields['pagesBar'] = array('type' => 'boolean', 'default' => true, 'editable' => true, - 'label' => __("Afficher la barre d'accès rapide aux pages")); + 'label' => __("Afficher la barre d'accès rapide aux pages")); $this->fields['pageBarThumbBack'] = array('type' => 'couleurAlpha', 'default' => '80000000', 'editable' => true, - 'label' => __("Couleur de fond de la boîte")); + 'label' => __("Couleur de fond de la boîte")); $this->fields['bookmarkColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, - 'label' => __("Couleur des marques-pages")); + 'label' => __("Couleur des marques-pages")); $this->forms['pagesbar'] = array('label' => __('Personnalisation de la barre des pages'), - 'fieldsnames' => array('pagesBar', 'pageBarThumbBack', '|', 'bookmarkColor')); + 'fieldsnames' => array('pagesBar', 'pageBarThumbBack', '|', 'bookmarkColor')); /* Paramètres non implémentés */ /* $this->fields['extraXSpace'] = array('type' => 'integer', 'default' => '0', 'editable' => true, diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index ff8bf2cc1..59be1e929 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -212,7 +212,7 @@ class wsHTML5Compiler { $this->width = round($size[0], 3); $this->height = round($size[1], 3); - $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h150-' . $this->pages[1]['document_page'] . '.jpg'); + $imagesize = getimagesize(wsDocument::getDir($this->pages[1]['document_id']) . 'html/h150-' . $this->pages[1]['document_page'] . '.jpg'); $this->pdf2htmlRatio = round(($imagesize[0] * 0.48) / $this->width, 3); $this->cssScale = min($this->optimalWidth / $this->width, $this->optimalHeight / $this->height); @@ -925,8 +925,8 @@ class wsHTML5Compiler { } foreach ($this->pages as $page => $infos) { if ($this->svg) { - $orig = WS_DOCS . '/' . $infos['document_id'] . '/html/p' . $infos['document_page'] . '.svg'; - $opt = WS_DOCS . '/' . $infos['document_id'] . '/html/o' . $infos['document_page'] . '.svg'; + $orig = wsDocument::getDir($infos['document_id']) . 'html/p' . $infos['document_page'] . '.svg'; + $opt = wsDocument::getDir($infos['document_id']) . 'html/o' . $infos['document_page'] . '.svg'; $svg = $orig; if (file_exists($opt) && filesize($opt) > 0) { @@ -937,15 +937,15 @@ class wsHTML5Compiler { } foreach ($this->getResolutions() as $r) { - $ok = $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/' . $this->backgroundsPrefix . $page . '.jpg'); + $ok = $this->copy(wsDocument::getDir($infos['document_id']) . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/' . $this->backgroundsPrefix . $page . '.jpg'); if (!$ok && $r = 300) { $this->maxRes = 150; } } - $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); + $this->copy(wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); if ($page == 1) { - $this->_makeCover(WS_DOCS . '/' . $infos['document_id'] . '/html/t36-' . $infos['document_page'] . '.jpg'); + $this->_makeCover(wsDocument::getDir($infos['document_id']) . 'html/t36-' . $infos['document_page'] . '.jpg'); } } } diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index a0a4fe05f..5750e8ae8 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -111,7 +111,7 @@ class wsHTML5Link { return new statsTagLink($id, $init, $compiler); break; case - 24: + 24: return new phoneLink($id, $init, $compiler); default: return null; @@ -292,7 +292,7 @@ class normalLink extends wsHTML5Link { if ($t !== false) { $tooltip = ' data-tooltip="' . $t . '"'; } - return 'getAdditionnalContent() . $this->getTrack() . '>'; + return 'getAdditionnalContent() . $this->getTrack() . '>'; } public function getTrack() { diff --git a/inc/ws/Util/packager/class.ws.packager.html.php b/inc/ws/Util/packager/class.ws.packager.html.php index 4ef86c1b3..45627de33 100644 --- a/inc/ws/Util/packager/class.ws.packager.html.php +++ b/inc/ws/Util/packager/class.ws.packager.html.php @@ -161,7 +161,7 @@ class wsPackagerHTML extends wsPackager { } $alt = ''; - $htmlfile = WS_DOCS . '/' . $infos['document_id'] . '/h' . $infos['document_page'] . '.txt'; + $htmlfile = wsDocument::getDir($infos['document_id']) . 'h' . $infos['document_page'] . '.txt'; if ($seoVersion && CubeIT_Util_Gzip::file_exists($htmlfile)) { $html = CubeIT_Util_Gzip::file_get_contents($htmlfile); diff --git a/inc/ws/Util/packager/class.ws.packager.html5.php b/inc/ws/Util/packager/class.ws.packager.html5.php index 0b7389f8b..da05fa44e 100644 --- a/inc/ws/Util/packager/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/class.ws.packager.html5.php @@ -29,13 +29,13 @@ class wsPackagerHTML5 extends wsPackager { parent::preparePackage(); foreach ($this->pages as $page => $infos) { - $file = WS_DOCS . '/' . $infos['document_id'] . '/html/p' . $infos['document_page'] . '.layout'; + $file = wsDocument::getDir($infos['document_id']) . 'html/p' . $infos['document_page'] . '.layout'; if (file_exists($file)) { $this->layouts[$page] = simplexml_load_file($file, null, LIBXML_ERR_WARNING); } } - $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h72-' . $this->pages[1]['document_page'] . '.jpg'); + $imagesize = getimagesize(wsDocument::getDir($this->pages[1]['document_id']) . 'html/h72-' . $this->pages[1]['document_page'] . '.jpg'); $this->pdf2htmlRatio = $imagesize[0] / $this->layouts[1]['width']; $this->scale = 4; $this->multiply = $this->pdf2htmlRatio * $this->scale; @@ -93,7 +93,7 @@ class wsPackagerHTML5 extends wsPackager { foreach ($this->cssFont as $font => $index) { list($font, $document_id) = explode('//', $font); foreach ($fext as $ext) { - copy(WS_DOCS . '/' . $document_id . "/fonts/web/" . $font . '.' . $ext, $this->vdir . '/data/style/F' . $index . '.' . $ext); + copy(wsDocument::getDir($document_id) . "fonts/web/" . $font . '.' . $ext, $this->vdir . '/data/style/F' . $index . '.' . $ext); } } } @@ -125,7 +125,7 @@ class wsPackagerHTML5 extends wsPackager { } foreach ($this->pages as $page => $infos) { foreach (self::$resolutions as $r) { - copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); + copy(wsDocument::getDir($infos['document_id']) . 'html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); } } } diff --git a/inc/ws/Util/packager/class.ws.packager.v1.php b/inc/ws/Util/packager/class.ws.packager.v1.php index 39af64c92..a88a9aaad 100644 --- a/inc/ws/Util/packager/class.ws.packager.v1.php +++ b/inc/ws/Util/packager/class.ws.packager.v1.php @@ -42,7 +42,7 @@ class wsPackagerV1 extends wsPackagerHTML { protected function copyThumbnails() { foreach ($this->pages as $book_page => $infos) { - $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg'); + $this->copy(wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg'); } } @@ -50,7 +50,7 @@ class wsPackagerV1 extends wsPackagerHTML { $xml = simplexml_load_string(''); foreach ($this->pages as $book_page => $infos) { - $ftext = WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt'; + $ftext = wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.txt'; if (file_exists($ftext)) { $xml->addChild('pageText', htmlspecialchars(CubeIT_Util_Gzip::file_get_contents($ftext))); } else { @@ -63,9 +63,9 @@ class wsPackagerV1 extends wsPackagerHTML { protected function getFlashvars() { return array('id' => $this->book_id, - 'mail' => '0', - 'onlineFlag' => '1', - 'loaderColor' => $this->theme->parametres->loadingBackColor); + 'mail' => '0', + 'onlineFlag' => '1', + 'loaderColor' => $this->theme->parametres->loadingBackColor); } protected function copyLinks() { @@ -90,13 +90,13 @@ class wsPackagerV1 extends wsPackagerHTML { $link['type'] = intval($link['type']); if ($link['page'] % 2 == 1) { - $link['page'] --; + $link['page']--; $link['left'] = $link['left'] + $this->size[0]; } if ($link['type'] == 4 && !$link['inline']) { $link['type'] = 1; - $link['to'].='$' . $link['video_width'] . '$' . $link['video_height']; + $link['to'] .= '$' . $link['video_width'] . '$' . $link['video_height']; } if ($link['type'] > 6) { @@ -144,25 +144,25 @@ class wsPackagerV1 extends wsPackagerHTML { global $core; $mapping = array('width' => 'sizeX', - 'height' => 'sizeY', - 'repeat' => 'patternFlag', - 'zoom' => 'maxZoom', - 'zoomw' => 'maxZoomScroll', - 'url_link' => 'logoLink', - 'pdf' => 'pdfFlag', - 'search' => 'searchFlag', - 'friend' => 'sendfriendFlag', - 'print' => 'printFlag', - 'bookmark' => 'bookmarkFlag', - 'email_title' => 'emailTitle', - 'email_body' => 'emailBody', - 'email_editable' => 'emailEditable' + 'height' => 'sizeY', + 'repeat' => 'patternFlag', + 'zoom' => 'maxZoom', + 'zoomw' => 'maxZoomScroll', + 'url_link' => 'logoLink', + 'pdf' => 'pdfFlag', + 'search' => 'searchFlag', + 'friend' => 'sendfriendFlag', + 'print' => 'printFlag', + 'bookmark' => 'bookmarkFlag', + 'email_title' => 'emailTitle', + 'email_body' => 'emailBody', + 'email_editable' => 'emailEditable' ); $more = array('id' => $this->book_id, - 'pagesSplit' => 1, - 'readingDir' => 'ltr', - 'ws' => '2'); + 'pagesSplit' => 1, + 'readingDir' => 'ltr', + 'ws' => '2'); $booleans = array('pdfFlag', 'printFlag', 'searchFlag', 'sendfriendFlag', 'bookmarkFlag', 'emailEditable'); @@ -187,9 +187,9 @@ class wsPackagerV1 extends wsPackagerHTML { $daoSignature = new wsDAOSignature($core->con); $s = $daoSignature->selectById($this->book->parametres->signature); $signature = array('fbCredit' => $s->main, - 'fbLink' => $s->mainLink, - 'partnerCredit' => $s->partner, - 'partnerLink' => $s->partnerLink); + 'fbLink' => $s->mainLink, + 'partnerCredit' => $s->partner, + 'partnerLink' => $s->partnerLink); $allParams = array_merge($allParams, $signature); @@ -198,7 +198,7 @@ class wsPackagerV1 extends wsPackagerHTML { $xtra = simplexml_load_string('' . $this->book->parametres->extras . ''); foreach ($xtra as $xt) { $k = $xt->getName(); - $v = (string) $xt; + $v = (string)$xt; $allParams[$k] = $v; } @@ -242,9 +242,9 @@ class wsPackagerV1 extends wsPackagerHTML { public function copyTheme() { $files = array('logoLoader' => 'logoLoader.png', - 'backgroundImage' => 'backgroundImg.jpg', - 'logo' => 'menu_clientLogo.png', - 'menuImage' => 'menu_back.png'); + 'backgroundImage' => 'backgroundImg.jpg', + 'logo' => 'menu_clientLogo.png', + 'menuImage' => 'menu_back.png'); $images = $this->vdir . '/images'; if (!file_exists($images)) { diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.php index ac21e910d..3666dc46c 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.php @@ -30,13 +30,13 @@ class wsPackagerHTML5 extends wsPackager { parent::preparePackage(); foreach ($this->pages as $page => $infos) { - $file = WS_DOCS . '/' . $infos['document_id'] . '/html/p' . $infos['document_page'] . '.layout'; + $file = wsDocument::getDir($infos['document_id']) . 'html/p' . $infos['document_page'] . '.layout'; if (file_exists($file)) { $this->layouts[$page] = simplexml_load_file($file, null, LIBXML_ERR_WARNING); } } - $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h72-' . $this->pages[1]['document_page'] . '.jpg'); + $imagesize = getimagesize(wsDocument::getDir($this->pages[1]['document_id']) . 'html/h72-' . $this->pages[1]['document_page'] . '.jpg'); $this->pdf2htmlRatio = round($imagesize[0] / $this->layouts[1]['width'], 2); $this->scale = 4; $this->multiply = $this->pdf2htmlRatio * $this->scale; @@ -59,7 +59,7 @@ class wsPackagerHTML5 extends wsPackager { } protected function compareLines($a, $b) { - if ((float) $a['y'] > (float) $b['y']) { + if ((float)$a['y'] > (float)$b['y']) { return 1; } else { return -1; @@ -188,21 +188,21 @@ class wsPackagerHTML5 extends wsPackager { protected function writeJs() { $files = array('js/libs/modernizr.js', - 'js/libs/jquery/jquery.js', - 'js/libs/jquery/jquery.transform.js', - 'js/libs/jquery/jquery.mousewheel.js', - 'js/libs/jquery/jquery.hashchange.js', - 'js/libs/fluidbook/fluidbook.utils.js', - 'js/libs/fluidbook/fluidbook.cache.js', - 'js/libs/fluidbook/fluidbook.support.js', - 'js/libs/fluidbook/fluidbook.viewport.js', - 'js/libs/fluidbook/fluidbook.desktop.js', - 'js/libs/fluidbook/fluidbook.service.js', - 'js/libs/fluidbook/fluidbook.loader.js', - 'js/libs/fluidbook/fluidbook.l10n.js', - 'js/libs/fluidbook/fluidbook.nav.js', - 'js/libs/fluidbook/fluidbook.js', - 'js/main.js'); + 'js/libs/jquery/jquery.js', + 'js/libs/jquery/jquery.transform.js', + 'js/libs/jquery/jquery.mousewheel.js', + 'js/libs/jquery/jquery.hashchange.js', + 'js/libs/fluidbook/fluidbook.utils.js', + 'js/libs/fluidbook/fluidbook.cache.js', + 'js/libs/fluidbook/fluidbook.support.js', + 'js/libs/fluidbook/fluidbook.viewport.js', + 'js/libs/fluidbook/fluidbook.desktop.js', + 'js/libs/fluidbook/fluidbook.service.js', + 'js/libs/fluidbook/fluidbook.loader.js', + 'js/libs/fluidbook/fluidbook.l10n.js', + 'js/libs/fluidbook/fluidbook.nav.js', + 'js/libs/fluidbook/fluidbook.js', + 'js/main.js'); $mintime = 0; $minimized = WS_COMPILE_ASSETS . '/_html5/js/min.js'; @@ -220,8 +220,8 @@ class wsPackagerHTML5 extends wsPackager { if ($reminimize) { $js = ''; foreach ($files as $file) { - $js.=file_get_contents(WS_COMPILE_ASSETS . '/_html5/' . $file); - $js.="\n\n"; + $js .= file_get_contents(WS_COMPILE_ASSETS . '/_html5/' . $file); + $js .= "\n\n"; } $tmp = cubeFiles::tempnam(); file_put_contents($tmp, $js); @@ -237,7 +237,7 @@ class wsPackagerHTML5 extends wsPackager { } $js = $this->writeConfig(); - $js.=file_get_contents($minimized); + $js .= file_get_contents($minimized); file_put_contents($this->vdir . '/data/fluidbook.js', $js); } @@ -258,7 +258,7 @@ class wsPackagerHTML5 extends wsPackager { $fontforge = new cubeCommandLine('convert.pe'); $fontforge->setPath(CONVERTER_PATH); foreach ($this->fontDocs[$font] as $document_id => $dummy) { - $fontforge->setArg(null, WS_DOCS . '/' . $document_id . '/fonts/web/' . $font . '.ttf'); + $fontforge->setArg(null, wsDocument::getDir($document_id) . 'fonts/web/' . $font . '.ttf'); } $fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format); $fontforge->execute(); @@ -277,8 +277,8 @@ class wsPackagerHTML5 extends wsPackager { $arrowsColor = '#' . $this->theme->parametres->arrowsColor; // Set the icon list with the color $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI, - 'next' => $arrowsColor, 'previous' => $arrowsColor, 'search' => $couleurI, 'nav-facebook' => $couleurI, 'nav-twitter' => $couleurI, - 'help-fingers' => $couleurI, 'help-mouse' => $couleurI); + 'next' => $arrowsColor, 'previous' => $arrowsColor, 'search' => $couleurI, 'nav-facebook' => $couleurI, 'nav-twitter' => $couleurI, + 'help-fingers' => $couleurI, 'help-mouse' => $couleurI); foreach ($icons as $icon => $color) { wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', 4, $w, $h); @@ -293,9 +293,9 @@ class wsPackagerHTML5 extends wsPackager { } foreach ($this->pages as $page => $infos) { foreach (self::$resolutions as $r) { - copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); + copy(wsDocument::getDir($infos['document_id']) . 'html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); } - copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); + copy(wsDocument::getDir($infos['document_id']) . 'p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); } } @@ -310,7 +310,7 @@ class wsPackagerHTML5 extends wsPackager { protected function writeLine($line) { $res = ''; foreach ($line['groups'] as $group) { - $res.=$this->writeGroup($group, $line); + $res .= $this->writeGroup($group, $line); } return $res; } @@ -352,9 +352,9 @@ class wsPackagerHTML5 extends wsPackager { $res = '
'; foreach ($group['spans'] as $span) { - $res.=$this->writeSpan($span); + $res .= $this->writeSpan($span); } - $res.='
'; + $res .= ''; return $res; } @@ -391,9 +391,9 @@ class wsPackagerHTML5 extends wsPackager { $br = '.background.r' . $r . '{'; if ($ratio != 1) { - $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; + $br .= $this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; } - $br.='width:' . $wr . 'px;height:' . $hr . 'px;}'; + $br .= 'width:' . $wr . 'px;height:' . $hr . 'px;}'; $res[] = $br; } $res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; @@ -407,77 +407,77 @@ class wsPackagerHTML5 extends wsPackager { } $texts = '.texts{' . $this->writeCSSUA('transform-origin', 'top left') . ';'; - $texts.=$this->writeCSSUA('transform', 'scale(' . round(1 / $this->multiply, 2) . ')') . ';'; - $texts.='width:' . $wm . '; max-width:' . $wm . ';'; - $texts.='height:' . $hm . '; max-height:' . $hm . ';'; - $texts.='}'; + $texts .= $this->writeCSSUA('transform', 'scale(' . round(1 / $this->multiply, 2) . ')') . ';'; + $texts .= 'width:' . $wm . '; max-width:' . $wm . ';'; + $texts .= 'height:' . $hm . '; max-height:' . $hm . ';'; + $texts .= '}'; $res[] = $texts; // Theme // Background $body = '#deviceView{'; - $body.='background-color:#' . $this->theme->parametres->backgroundColor . ';'; + $body .= 'background-color:#' . $this->theme->parametres->backgroundColor . ';'; switch ($this->theme->parametres->repeat) { case wsTheme::REPEAT: - $body.='background-repeat:repeat;'; + $body .= 'background-repeat:repeat;'; break; case wsTheme::NONE: - $body.='background-repeat:no-repeat;'; + $body .= 'background-repeat:no-repeat;'; break; case wsTheme::RATIO: - $body.='background-repeat:no-repeat;'; + $body .= 'background-repeat:no-repeat;'; break; case wsTheme::STRETCH: - $body.='background-repeat:no-repeat;'; - $body.='background-size:100% 100%;'; + $body .= 'background-repeat:no-repeat;'; + $body .= 'background-size:100% 100%;'; break; } if ($this->theme->parametres->backgroundImage != '') { copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage); - $body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');'; - $body.='background-position:'; + $body .= 'background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');'; + $body .= 'background-position:'; switch ($this->theme->parametres->backgroundVAlign) { case wsTheme::TOP: - $body.='top'; + $body .= 'top'; break; case wsTheme::MIDDLE: - $body.='center'; + $body .= 'center'; break; case wsTheme::BOTTOM: - $body.='bottom'; + $body .= 'bottom'; break; } - $body.=' '; + $body .= ' '; switch ($this->theme->parametres->backgroundHAlign) { case wsTheme::LEFT: - $body.='left'; + $body .= 'left'; break; case wsTheme::CENTER: - $body.='center'; + $body .= 'center'; break; case wsTheme::RIGHT: - $body.='right'; + $body .= 'right'; break; } - $body.=';'; + $body .= ';'; } - $body.='}'; + $body .= '}'; $res[] = $body; // Header $header = '#header{'; - $header.='height:' . $this->theme->parametres->menuHeight . 'px;'; - $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';'; + $header .= 'height:' . $this->theme->parametres->menuHeight . 'px;'; + $header .= 'background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';'; if ($this->theme->parametres->menuImage != '') { copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage); - $header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');'; - $header.='background-repeat:no-repeat;'; - $header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;'; + $header .= 'background-image:url(../images/' . $this->theme->parametres->menuImage . ');'; + $header .= 'background-repeat:no-repeat;'; + $header .= 'background-size:100% ' . $this->theme->parametres->menuHeight . 'px;'; } - $header.='}'; + $header .= '}'; $res[] = $header; //Icons @@ -488,9 +488,9 @@ class wsPackagerHTML5 extends wsPackager { if ($this->theme->parametres->logo) { copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo); $dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo); - $logo.='background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;'; + $logo .= 'background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;'; } - $logo.='}'; + $logo .= '}'; $res[] = $logo; // Credits @@ -547,17 +547,17 @@ class wsPackagerHTML5 extends wsPackager { } foreach ($this->cssRotation as $rotation => $index) { - $rotation*= - 1; + $rotation *= -1; $to = 'transform-origin:left top;'; $css = '.r' . $index . '{'; - $css.=self::writeCSSUA('transform', 'rotate(' . $rotation . 'deg)') . ';'; - $css.=self::writeCSSUA('transform-origin', 'left top') . ';'; - $css.='margin-top:' . round(cos(deg2rad($rotation)) * -1, 2) . 'em !important;'; - $css.='margin-left:' . round(sin(deg2rad($rotation)), 2) . 'em !important;'; - $css.='}'; + $css .= self::writeCSSUA('transform', 'rotate(' . $rotation . 'deg)') . ';'; + $css .= self::writeCSSUA('transform-origin', 'left top') . ';'; + $css .= 'margin-top:' . round(cos(deg2rad($rotation)) * -1, 2) . 'em !important;'; + $css .= 'margin-left:' . round(sin(deg2rad($rotation)), 2) . 'em !important;'; + $css .= '}'; $res[] = $css; } @@ -608,15 +608,15 @@ class wsPackagerHTML5 extends wsPackager { $spans = array(); foreach ($group->s as $span) { - if ($first && trim((string) $span) == '') { + if ($first && trim((string)$span) == '') { continue; } if ($first) { $pos = $x = $span['x']; - $pos+=$span['width']; + $pos += $span['width']; $first = false; } else { - if ((float) $span['x'] < (float) $newSpan['x']) { + if ((float)$span['x'] < (float)$newSpan['x']) { // On change de groupe $ls = $ws = 0; if ($letterCount > 0) { @@ -629,7 +629,7 @@ class wsPackagerHTML5 extends wsPackager { $res[] = array( 'color' => $this->getCSSColor($group['color']), 'size' => $this->getCSSSize($group['size']), - 'font' => $this->getCSSFont((string) $group['font'], $document_id), + 'font' => $this->getCSSFont((string)$group['font'], $document_id), 'letterspacing' => $this->getCSSLetterSpacing($ls), 'wordspacing' => $this->getCSSLetterSpacing($ws), 'y' => 0, @@ -638,7 +638,7 @@ class wsPackagerHTML5 extends wsPackager { $spans = array(); $pos = $x = $span['x']; - $pos+=$span['width']; + $pos += $span['width']; } else { $diff = $span['x'] - $pos; @@ -665,7 +665,7 @@ class wsPackagerHTML5 extends wsPackager { $spans = array(); $pos = $x = $span['x']; - $pos+=$span['width']; + $pos += $span['width']; } else { $newSpan = $this->addSpan(' ', true); @@ -680,16 +680,16 @@ class wsPackagerHTML5 extends wsPackager { $pos = $span['x'] + $span['width']; array_push($spans, $newSpan); - $copy = (string) $span; + $copy = (string)$span; $len = mb_strlen($copy); str_replace(' ', '-', $copy, $w); $l = $len - $w; - $letterCount+=$l; - $wordCount+=$w; + $letterCount += $l; + $wordCount += $w; - $letterSpacing+=$l * (float) $span['letterspacing']; - $wordSpacing+=$w * (float) $span['wordspacing']; + $letterSpacing += $l * (float)$span['letterspacing']; + $wordSpacing += $w * (float)$span['wordspacing']; } if (count($spans)) { @@ -715,19 +715,19 @@ class wsPackagerHTML5 extends wsPackager { return $res; } - protected function addSpan($span, $space=false) { - $text = (string) $span; + protected function addSpan($span, $space = false) { + $text = (string)$span; return array('text' => $text, 'space' => $space, 'x' => $span['x']); } protected function getCSSSize($size) { $size = $this->normalizeFloatValue($size); - $size*=$this->multiply; + $size *= $this->multiply; return $this->getIndex($size, $this->cssSize); } protected function getCSSFont($font, $document_id) { - $font = (string) $font; + $font = (string)$font; if (!isset($this->fontDocs[$font])) { $this->fontDocs[$font] = array(); } @@ -791,7 +791,7 @@ class wsPackagerHTML5 extends wsPackager { } protected function getIndex($value, &$tab) { - $value = (string) $value; + $value = (string)$value; if (isset($tab[$value])) { return $tab[$value]; } @@ -800,9 +800,9 @@ class wsPackagerHTML5 extends wsPackager { return $res; } - protected function normalizeFloatValue($value, $round=3) { + protected function normalizeFloatValue($value, $round = 3) { $value = str_replace(',', '.', $value); - $value = (float) $value; + $value = (float)$value; $value = round($value, $round); return $value; } @@ -819,7 +819,7 @@ class wsPackagerHTML5 extends wsPackager { return $str; } - public function copyLinkFile($source, $dest, $video=false) { + public function copyLinkFile($source, $dest, $video = false) { // TODO delete that return; //return; $origDir = WS_BOOKS . '/working/' . $this->book_id . '/'; @@ -860,10 +860,10 @@ class wsPackagerHTML5 extends wsPackager { } public function __destruct() { - + } - public static function colorToCSS($color, $forceAlpha=null) { + public static function colorToCSS($color, $forceAlpha = null) { if (!is_null($forceAlpha)) { $a = $forceAlpha * 255; @@ -888,7 +888,7 @@ class wsPackagerHTML5 extends wsPackager { $hex = substr($color, $k * 2, 2); $$name = intval($hex, 16); } - $alpha/=255; + $alpha /= 255; if ($alpha == 0) { return 'transparent'; } elseif ($alpha == 1) { -- 2.39.5