public function uploadLinkContent()
{
+ global $core;
+ $daoBook=new wsDAOBook($core->con);
+ $book=$daoBook->selectById($this->args['book_id'] );
+
foreach ($_FILES as $varname => $infos) {
if ($infos['error']) {
continue;
}
$fname = cubeFiles::tidyName($infos['name']);
- $dir = WS_BOOKS . '/working/' . $this->args['book_id'] . '/' . $dir;
+ $dir = $book->getAssetDir($dir);
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
$dim = CubeIT_Image::getimagesize($themeRoot . $p->$param);
$url = 'https://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/themes/' . $theme->theme_id . '/' . $p->$param;
} else {
- $bookRoot = WS_BOOKS . '/working/' . $book->book_id . '/';
+ $bookRoot = $book->getAssetDir();
$dim = CubeIT_Image::getimagesize($bookRoot . $p->$param);
- $url = 'https://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/books/working/' . $book->book_id . '/' . $p->$param;
+ $url = 'https://' . $_SERVER['HTTP_HOST'] . WEBROOT . '/fluidbook/books/working/' . $book->getAssetDirId() . '/' . $p->$param;
}
if ($this->json) {
}
$id = $book->book_id;
+ $wid=$book->getAssetDir();
if (isset($this->args['image'])) {
- $cover = WS_BOOKS . '/working/' . $id . '/' . $this->args['image'];
+ $cover = $wid . $this->args['image'];
} else {
if (isset($book->parametres->facebook_image) && $book->parametres->facebook_image != '') {
- $c = WS_BOOKS . '/working/' . $id . '/' . $book->parametres->facebook_image;
+ $c =$wid. $book->parametres->facebook_image;
if (file_exists($c)) {
$cover = $c;
}
{
global $core;
$mode = $force ? $force : $book->parametres->bookmarkUsePDF;
+ $wid=$book->getAssetDir();
switch ($mode) {
case 'download':
- $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace;
+ $res = $wid . $book->parametres->pdfReplace;
break;
case 'thumbnails':
- $res = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfThumbnails;
+ $res = $wid . $book->parametres->pdfThumbnails;
break;
case 'pages':
default:
$mail->send();
}
- public function grdfCoupon2015()
- {
- $id = $this->args['id'];
-
- $this->outputXML = false;
- $couponsRoot = WS_BOOKS . '/working/' . $id . '/commerce/';
-
- $xml = simplexml_load_file($couponsRoot . 'references.xml');
- // Check hash
- $hash = md5('ae' . $_GET['nom'] . '25' . $_GET['ref']);
- if ($hash != $_GET['h']) {
- exit;
- }
- $refs = explode(',', $_GET['ref']);
-
- $tmp = cubeFiles::tempnam();
- $pdftk = new CubeIT_CommandLine('pdftk');
- $pdftk->setPath(CONVERTER_PATH);
- foreach ($refs as $ref) {
- $file = $couponsRoot . $ref . '.pdf';
- $pdftk->setArg(null, $file);
- }
- $pdftk->setArg(null, 'output');
- $pdftk->setArg(null, $tmp);
- $pdftk->execute();
-
- header('Content-Type: application/pdf');
- header('Content-Disposition: inline; filename="CouponChequier.pdf"');
-
- readfile($tmp);
- unlink($tmp);
- exit;
- }
-
- public function grdfCoupon()
- {
-
- $id = $this->args['id'];
-
- if ($id == 13372) {
- return $this->grdfCoupon2015();
- }
-
- $this->outputXML = false;
- $couponsRoot = WS_BOOKS . '/working/' . $id . '/commerce/';
-
- $xml = simplexml_load_file($couponsRoot . 'references.xml');
- // Check hash
- $hash = md5('ae' . $_GET['nom'] . '25' . $_GET['ref']);
- if ($hash != $_GET['h']) {
- exit;
- }
- $refs = explode(',', $_GET['ref']);
- $pdf = new FPDI();
- foreach ($refs as $ref) {
-
- foreach ($xml->xpath('//item[@reference=\'' . $ref . '\']') as $item) {
- $code = (string)$item['code'];
- }
-
- $file = $couponsRoot . $ref . '.pdf';
-
- $pdf->setSourceFile($file);
- $idx = $pdf->importPage(1);
- $pdf->AddPage();
- $pdf->useTemplate($idx);
- $pdf->SetXY(11, 12);
- $pdf->SetFont('Helvetica', '', 12);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(180, 10, utf8_decode(trim($_GET['civilite'] . ' ' . $_GET['prenom'] . ' ' . $_GET['nom']) . ','));
- $pdf->SetXY(135, 203);
- $pdf->SetFont('Helvetica', 'B', 16);
- $pdf->Cell(50, 15, $code, 0, 1, "C");
- }
- $pdf->Output('coupon.pdf', 'I');
- }
-
- public function grdfExcel12568()
- {
- global $core;
- $this->outputXML = false;
-
- if (!isset($_GET['annee'])) {
- $_GET['annee'] = 2014;
- }
- $annee = $_GET['annee'];
-
- if ($annee == 2013) {
- $id = 11222;
- } elseif ($annee == 2014) {
- $id = 12779;
- }
-
-
- $couponsRoot = WS_BOOKS . '/working/' . $id . '/commerce/';
-
- $xml = simplexml_load_file($couponsRoot . 'references.xml');
-
- $cols = array('Date' => 'date', 'Civilité' => 'civilite', 'Prénom' => 'prenom', 'Nom' => 'nom',
- 'E-mail' => 'email', 'Adresse' => 'adresse', 'Code postal' => 'codepostal', 'Ville' => 'ville',
- 'Téléphone' => 'telephone', 'Connu par' => 'connu', 'Energie' => 'energie', 'Type de logement' => 'logement',
- 'Echéance travaux' => 'echeance',
- 'Optin' => 'optin', 'Optin partenaires' => 'optin_partenaires');
- $refs = array();
- foreach ($xml->xpath('//item') as $i) {
- $refs[(string)$i['reference']] = $i['name'];
- }
-
- //
- $h = '<table>';
- $h .= '<tr>';
- foreach ($cols as $l => $k) {
- $h .= '<th>' . utf8_decode($l) . '</th>';
- }
- foreach ($refs as $k => $l) {
- $h .= '<th>' . utf8_decode($l) . '</th>';
- }
- $h .= '</tr>';
-
- $r = $core->con->select('SELECT * FROM grdf' . $annee);
- while ($r->fetch()) {
- $d = json_decode($r->datas);
- $rl = explode(',', $d->reflist);
- $h .= '<tr>';
- foreach ($cols as $l => $k) {
- $v = $d->$k;
- if ($k == 'date') {
- $v = date('Y-m-d H:i', $v);
- }
- $h .= '<td>' . utf8_decode($v) . '</td>';
- }
- foreach ($refs as $k => $l) {
- $v = in_array($k, $rl) ? '1' : '0';
- $h .= '<td>' . utf8_decode($v) . '</td>';
- }
- $h .= '</tr>';
- }
-
- $h .= '</table>';
-
- if (!file_exists(ROOT . '/cache/12568/')) {
- mkdir(ROOT . '/cache/12568/', 0777, true);
- }
- file_put_contents(ROOT . '/cache/12568/chequieravantage.xls', $h);
- http::redirect('/cache/12568/chequieravantage.xls');
- exit;
- }
-
public function proxy()
{
ob_end_clean();
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');
}
+ /**
+ * @param $book wsBook
+ * @param $version
+ * @return bool
+ */
public function isUpToDate($book, $version)
{
$version = (string)$version;
} else if ($version == 'html5') {
return false;
// HTML5
- $checks = array($book->changedate, cubeFiles::filemtimeRecursive(WS_BOOKS . '/working/' . $book->book_id), cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));
+ $checks = array($book->changedate, cubeFiles::filemtimeRecursive($book->getAssetDir()), cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'), cubeFiles::filemtimeRecursive(ROOT . '/inc/ws/Util/html5'));
foreach ($checks as $check) {
if ($check > $book->compilehtml5date) {
return false;
return $path;
}
- $workingDir = WS_BOOKS . '/working/' . $book_id . '/';
- return $workingDir . trim($dir, '/') . '/' . $path;
+ return wsBook::getAssetDirOfBook($book_id, $dir) . $path;
}
public function compileHTML5($book_id, $book, $dev = false, $delete = true)
);
// Deprecated
+ $this->fields['version'] = array('type' => 'combo', 'default' => '2', 'editable' => true, 'label' => __('Version'), 'datas' => array('1' => '1', '2' => '2'), 'grade' => 3);
$this->fields['email_editable'] = array('type' => 'boolean', 'default' => true, 'editable' => false, 'label' => __("Permettre au lecteur de modifier le corps de l'email"));
$this->fields['askAcknowledge'] = array('type' => 'boolean', 'default' => false, 'editable' => false, 'label' => __("Demander au destinataire un accusé de réception"), 'grade' => 3);
$this->fields['sendasfluidbook'] = array('type' => 'boolean', 'default' => false, 'editable' => false, 'label' => __("Envoyer le mail comme Fluidbook"), 'grade' => 3, 'hint' => __("L'expéditeur apparaîtra en reply-to"));
__('PDF') => 'pdf'));
/** **/
- $this->fields['version'] = array('type' => 'combo', 'default' => '2', 'editable' => true, 'label' => __('Version'), 'datas' => array('1' => '1', '2' => '2'), 'grade' => 3);
+
$this->fields['title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de la publication"), 'embed' => false);
$this->fields['url_link'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du lien de retour au site"));
$this->fields['signature'] = array('type' => 'combo', 'default' => '1', 'editable' => true, 'label' => __('Signature'), 'grade' => 3, 'datas' => wsDroits::getSignatures());
$this->forms['important'] = array('label' => __('Description de la publication'),
- 'fieldsnames' => array('version', 'mobileLVersion', 'mobileVersion', 'title', 'url_link', 'signature'));
+ 'fieldsnames' => array('mobileLVersion', 'mobileVersion', 'title', 'url_link', 'signature'));
// .
// .
+ $this->fields['assetsDir'] = ['type' => 'text', 'label' => __('Utiliser le dossier d\'assets du fluidbook'), 'default' => '', 'editable' => true, 'grade' => 5];
+ $this->fields['linksAssets'] = ['type' => 'freefile', 'label' => __('Charger ou remplacer des fichiers de liens'), 'default' => '', 'editable' => true, 'grade' => 3, 'multiple' => true];
+
+ $this->forms['assets'] = [
+ 'label' => __('Assets'),
+ 'fieldsnames' => ['assetsDir', 'linksAssets']
+ ];
+ /** * */
+
$this->fields['email_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"', 'hint' => __('Laisser vide pour utiliser la valeur par défaut'));
$this->fields['email_body'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Corps de l'email") . ' "' . __('Envoyer à un ami') . '"', 'hint' => __('Laisser vide pour utiliser la valeur par défaut'));
'fieldsnames' => ['tabsHTML5', 'tabsPages', 'tabsSections', 'tabsPagesNumbers', '|', 'tabsSide', 'tabsMargin', '|', 'tabsHideOnPages', 'tabsHideOnCover', 'tabsHideOnLastPage', 'tabsHideEdges', '|', 'tabsPriority', 'tabsLinkWidth', 'tabsHideWhenOverlapingArrows', 'tabsHideOnPortrait', 'tabsHideOnZoom']];
/*** **/
- $this->fields['linksAssets'] = ['type' => 'freefile', 'label' => __('Charger ou remplacer des fichiers de liens'), 'default' => '', 'editable' => true, 'grade' => 3, 'multiple' => true];
+
$this->fields['customLinkClass'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Classe pour les liens personnalisés'), 'grade' => 5);
$this->fields['ignoreLinksTypes'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Ignorer les liens de type'), 'hint' => __('Liste des numéros séparés par des virgules'), 'grade' => 5);
$this->fields['mobileLinksRevealAnim'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Animer les liens après un changement de page"), 'grade' => 3);
$this->fields['mobileIgnoreBackgroundLinks'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Ignorer les liens de background'));
$this->forms['links'] = array('label' => __('Liens'),
- 'fieldsnames' => array('linksAssets', '|', 'permanentLinks', 'mobileLinksRevealAnim', 'linkBlinkTime', 'linkBlinkRepetition', '|', 'openLinkAtStartup', '|', 'customLinkClass', 'ignoreLinksTypes', 'mobileIgnoreBackgroundLinks', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix'));
+ 'fieldsnames' => array('permanentLinks', 'mobileLinksRevealAnim', 'linkBlinkTime', 'linkBlinkRepetition', '|', 'openLinkAtStartup', '|', 'customLinkClass', 'ignoreLinksTypes', 'mobileIgnoreBackgroundLinks', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix'));
//.
$this->fields['textPopupStylesheet'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Feuille de style des popups de texte'), 'fileFilter' => $cssFilter];
return $this->$varname;\r
}\r
\r
- public function getFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html',$force=false)\r
+ public function getFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $force = false)\r
{\r
$p = wsDAOBook::getDocumentPage($this->book_id, $page);\r
if (!isset($this->_docs[$p['document_id']])) {\r
$this->_docs[$p['document_id']] = $dao->selectById($p['document_id']);\r
}\r
$doc = $this->_docs[$p['document_id']];\r
- return $doc->getFile($p['document_page'], $format, $resolution, $withText, $withGraphics, $version,$force);\r
+ return $doc->getFile($p['document_page'], $format, $resolution, $withText, $withGraphics, $version, $force);\r
}\r
\r
public function getThumbFile($page, $format)\r
{\r
- $thumbpdf = WS_BOOKS . '/working/' . $this->book_id . '/' . $this->parametres->pdfThumbnails;\r
+ $thumbpdf = $this->getAssetDir(). $this->parametres->pdfThumbnails;\r
if ($this->parametres->pdfThumbnails && file_exists($thumbpdf)) {\r
return wsPDFConvert::getThumbFromPDF($thumbpdf, $page, $format);\r
}\r
return $this->getFile($page, $format, 'thumb');\r
}\r
+\r
+ public function getAssetDir($sub = '')\r
+ {\r
+ return rtrim(WS_BOOKS . '/working/' . $this->getAssetDirId() . '/' . trim($sub, '/'), '/') . '/';\r
+ }\r
+\r
+ public function getAssetDirId()\r
+ {\r
+ return $this->parametres->assetsDir === '' ? $this->book_id : trim($this->parametres->assetsDir);\r
+ }\r
+\r
+ public static function getAssetDirOfBook($book_id, $sub = '')\r
+ {\r
+ global $core;\r
+ $dao = new wsDAOBook($core->con);\r
+ $book = $dao->selectById($book_id);\r
+\r
+ return $book->getAssetDir($sub);\r
+ }\r
}
\ No newline at end of file
$this->dir = $dir;
}
$this->vdir = new CubeIT_Files_VirtualDirectory($this->dir);
- $this->wdir = WS_BOOKS . '/working/' . $this->book_id . '/';
+
$this->daoBook = new wsDAOBook($core->con);
if (null === $book) {
$this->book = $book;
}
+ $this->wdir = $this->book->getAssetDir();
+
$this->widget = !$this->phonegap && $this->book->parametres->widget;
$this->pages = $this->daoBook->getPagesOfBook($book_id);
if ($this->target == '') {
$this->target = '_blank';
}
- $this->wdir = WS_BOOKS . '/working/' . $compiler->book_id . '/';
+ $this->wdir = $this->compiler->wdir;
$this->id = $id;
$this->compiler = $compiler;
$this->init();
public function getHTMLContainer()
{
+ $this->to = self::normalizeAnchor($this->to);
$this->compiler->addPageLabel($this->page, $this->to);
return '<div aria-hidden="false" data-anchor="' . trim($this->to, '# ') . '" class="anchor ' . $this->getHTMLContainerClass() . '" data-hidden="' . $this->hidden . '" data-scorm="' . $this->scorm . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $this->getAdditionnalContent() . '>' . $this->getHTMLContent() . '</div>';
}
{
return '';
}
+
+ public static function normalizeAnchor($anchor)
+ {
+ return mb_strtolower(CubeIT_Text::str2URL($anchor));
+ }
}
class triggerLink extends normalLink
$anchor = trim($e[1], '# ');
}
if ($anchor) {
- $res = $anchor;
+ $res = anchorLink::normalizeAnchor($anchor);
} else if ($this->numerotation === 'physical') {
$res = $p;
} else {
$attr['height'] = $h;
} else if (!is_null($compiler) && CubeIT_Util_Url::isLocal($data->to)) {
// Get video dimensions from thumbnail if possible (locally uploaded files)
-// $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $basename . '.jpg';
-// $dim = getimagesize($path);
-// $attr['width'] = $dim[0];
-// $attr['height'] = $dim[1];
- $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $data->to;
+ $path = $compiler->wdir . '/' . $data->to;
$e = explode(',', `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`);
$attr['width'] = $e[0];
$attr['height'] = $e[1];
$this->theme = $daoTheme->getThemeOfBook($book_id, true);
$this->themeRoot = WS_THEMES . '/' . $this->theme->theme_id . '/';
- $this->workingDir = WS_BOOKS . '/working/' . $book_id . '/';
+ $this->workingDir = $this->book->getAssetDir();
$this->compile();
}