RewriteRule ^telecharger/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telecharger/$1/$2/$3 [L]\r
RewriteRule ^telechargerr/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telechargerr/$1/$2/$3 [L]\r
\r
- RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L]\r
- RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/index.swf [L]\r
- RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L]\r
- RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/fluidbook.js$ fluidbook/compile/fluidbook.js [L]\r
- RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
-\r
- RewriteRule ^viewerh/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
- RewriteRule ^viewers/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
+ RewriteRule ^viewerh/([0-9\-]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
+ RewriteRule ^viewers/([0-9\-]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L]\r
\r
RewriteRule ^fluidbook - [L]\r
\r
global $core;
$nointerface = isset($_GET['nointerface']);
+
$args = cubePage::getArgs($args);
$e = explode('_', $args[0]);
$book_id = $e[0];
+ $ee = explode('-', $book_id);
+ if (count($ee) === 1) {
+ $forceTheme = false;
+ } else {
+ $forceTheme = $ee[1];
+ $book_id = $ee[0];
+ }
$hash = $e[1];
$dao = new wsDAOBook($core->con);
if (count($e) <= 2 || ($e[2] < $limit && !$nointerface)) {
$e[2] = $time;
$daoTheme = new wsDAOTheme($core->con);
- $theme = $daoTheme->getThemeOfBook($book_id, true);
+ if ($forceTheme) {
+ $theme = $daoTheme->selectById($forceTheme, 'themes');
+ } else {
+ $theme = $daoTheme->getThemeOfBook($book_id, true);
+ }
self::loadingCompile(SITE_PATH . 'viewerh/' . implode('_', $e) . '/' . $q, $book, $theme);
exit;
}
$CrawlerDetect = new Jaybizzle\CrawlerDetect\CrawlerDetect();
if (!isset($_GET['force']) && !$nointerface && !$CrawlerDetect->isCrawler()) {
$book->parametres->scorm_enable = false;
- $dao->compile($book_id, 'html5', false, false, false, $book, false);
+ $dao->compile($book_id, 'html5', false, false, false, $book, false, $forceTheme);
wsMaintenance::_socialImage($book->cid);
}
$book_id = $e[0];
$hash = $e[1];
- self::commonHTML5Viewer($book_id, $hash);
+ self::commonHTML5Viewer($book_id, $hash, '', [], $forceTheme);
}
echo $res;
}
- public static function commonHTML5Viewer($book_id, $hash, $version = '', $replace = [])
+ public static function commonHTML5Viewer($book_id, $hash, $version = '', $replace = [], $forceTheme = false)
{
global $core;
self::checkDocumentVersionOfBook($book_id);
}
}
+ $id = $book_id;
+ if ($forceTheme) {
+ $id .= '-' . $forceTheme;
+ }
+
self::logReferer($book_id);
- $htmlFile = WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html';
+ $htmlFile = WS_BOOKS . '/html5' . $dir . '/' . $id . '/index' . $version . '.html';
$html = '';
if (file_exists($htmlFile)) {
$html = file_get_contents($htmlFile);
} else {
- $dao->compile($book_id, 'html5', false, false, false, $book, false);
+ $dao->compile($book_id, 'html5', false, false, false, $book, false, $forceTheme);
$html = file_get_contents($htmlFile);
}
foreach ($replace as $from => $to) {
}
}
- public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null, $delete = true)
+ public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null, $delete = true, $forceTheme = false)
{
if (is_null($book_id) || !$book_id) {
$res = '';
try {
$this->compilePDF($book, $pages);
- $res .= $this->compileHTML5($book_id, $book, $dev, $delete);
+ $res .= $this->compileHTML5($book_id, $book, $dev, $delete, $forceTheme);
$this->touchCompile($book_id, 'html5');
} catch (Exception $e) {
return wsBook::getAssetDirOfBook($book_id, $dir) . $path;
}
- public function compileHTML5($book_id, $book, $dev = false, $delete = true)
+ public function compileHTML5($book_id, $book, $dev = false, $delete = true,$forceTheme=false)
{
$version = $book->parametres->mobileLVersion;
if ($dev) {
$version = 'dev';
}
- $htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book);
+ $htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book,$forceTheme);
$htmlCompiler->compile($delete);
self::$lastHTML5Compiler = $htmlCompiler;
* @param null $book\r
* @return wsHTML5Compiler\r
*/\r
- public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)\r
+ public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null,$forceTheme=false)\r
{\r
if (is_null($version)) {\r
global $core;\r
}\r
}\r
\r
- return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book);\r
+ return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book,$forceTheme);\r
}\r
\r
public static function getPhonegapVersion($v = 'latest')\r
public $seo = null;
- function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)
+ function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null,$forceTheme=false)
{
global $core;
public $seo = null;
- function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)
+ function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null, $forceTheme = false)
{
global $core;
$this->log('Start compilation');
if (is_null($dir)) {
- $this->dir = WS_BOOKS . '/html5/' . $book_id . '/';
+ $id = $book_id;
+ if ($forceTheme) {
+ $id .= '-' . $forceTheme;
+ }
+ $this->dir = WS_BOOKS . '/html5/' . $id . '/';
} else {
$this->dir = $dir;
}
$this->maxRes = min(300, $this->book->parametres->maxResolution);
$daoTheme = new wsDAOTheme($core->con);
- $this->theme = $daoTheme->getThemeOfBook($book_id, true);
+ if ($forceTheme) {
+ $this->theme = $daoTheme->selectById($forceTheme, 'themes');
+ } else {
+ $this->theme = $daoTheme->getThemeOfBook($book_id, true);
+ }
$this->themeRoot = WS_THEMES . '/' . $this->theme->theme_id . '/';
+
$daoDoc = new wsDAODocument($core->con);
$firstDoc = $daoDoc->selectById($this->pages[1]['document_id']);
$firstDoc->checkInfos();