RUN apt -y --no-install-recommends install sshfs python3 python3-pip
RUN apt -y --no-install-recommends install openssh-server rsyslog
RUN apt -y --no-install-recommends install mariadb-client
+RUN apt -y --no-install-recommends install pdfposter rename
RUN cd /root;wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2;tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2;mv phantomjs-2.1.1-linux-x86_64 /usr/local/share;ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
RUN cd /root;wget https://github.com/nwutils/Web2Executable/releases/download/v0.7.1b/Web2ExeLinux-CMD.zip;unzip Web2ExeLinux-CMD.zip;mv Web2ExeLinux-CMD /usr/local/web2exe
<?php\r
\r
+use hollodotme\FastCGI\Client;\r
+use hollodotme\FastCGI\Requests\PostRequest;\r
+use hollodotme\FastCGI\SocketConnections\NetworkSocket;\r
+\r
class wsUtil\r
{\r
public static function excelToArray($excelFile, $assoc = false, $reader = 'Excel2007', $force = false)\r
}\r
}\r
}\r
+\r
+\r
+ /**\r
+ * @throws Throwable\r
+ * @throws \hollodotme\FastCGI\Exceptions\WriteFailedException\r
+ * @throws \hollodotme\FastCGI\Exceptions\ConnectException\r
+ * @throws \hollodotme\FastCGI\Exceptions\TimedoutException\r
+ */\r
+ public static function distantStorageOperation($operation, $args = [], $region = 'US')\r
+ {\r
+ $servers = ['US' => ['host' => 'kingkong.cubedesigners.com', 'port' => 9458]];\r
+ $params = array_merge($args, ['function' => $operation]);\r
+ $server = $servers[$region];\r
+\r
+ $timeout = 180;\r
+\r
+ $timeout *= 1000;\r
+ $socket = new NetworkSocket(\r
+ $server['host'],\r
+ $server['port'] ?? 9458,\r
+ $timeout * 1000,\r
+ $timeout * 1000\r
+ );\r
+\r
+ $client = new Client();\r
+ $q=http_build_query($params);\r
+ $response = $client->sendRequest($socket, new PostRequest('tools.php', $q));\r
+ return trim($response->getBody());\r
+ }\r
}
\ No newline at end of file
}
$this->vdir = new CubeIT_Files_VirtualDirectory($this->dir);
+
$this->daoBook = new wsDAOBook($core->con);
if (null === $book) {
$this->book = $this->daoBook->selectById($book_id);
} else {
$this->book = $book;
}
+ if ($this->book->region == 'US') {
+ $this->vdir->setHandler('copy', '/application/usstorage', function ($files) {
+ $nfiles = [];
+ foreach ($files as $from => $to) {
+ $from = str_replace('/application/usstorage/', '/storage/', $from);
+ $to = str_replace('/application/usstorage/', '/storage/', $to);
+ $nfiles[$from] = $to;
+ }
+ wsUtil::distantStorageOperation('copy', ['files' => $nfiles], 'US');
+ });
+ }
$this->wdir = $this->book->getAssetDir();
set_time_limit(0);
-
} else {
$this->config->statsMatomo = false;
}
}
wsLinks::getLinksAndRulersFromFile($this->book_id, $links, $rulers);
+ $this->log('Links 1');
if ($this->book->parametres->basketManager === 'Puma') {
foreach ($links as $k => $init) {
}
}
}
+ $this->log('Links 2');
$pagesOfCustomLinks = [];
$hiddenLinks = [];
$linksCopy = $links;
-
foreach ($linksCopy as $k => $linkData) {
if ($this->book->parametres->PDFRendererIframe === 'svg' && (($linkData['type'] == 31 && stristr($linkData['to'], '.pdf')) || ($linkData['type'] == 6 && stristr($linkData['alternative'], '.pdf')))) {
if ($linkData['type'] == 6) {
}
}
+ $this->log('Links 3');
+
if ($this->book->parametres->anchorsAliases && file_exists(commonTools::fixpath($this->book->parametres->anchorsAliases))) {
$aliases = [];
$anchors = [];
$allLinksData = [];
$gamifyCoins = [];
+
usort($links, array($this, '_sortLinks'));
+ $this->log('Links 3.5');
+
foreach ($links as $linkData) {
if (in_array($linkData['type'], $ignore)) {
continue;
if ($link->keep()) {
$this->hiddenContents[] = $link->getHTMLContainer();
}
+ $this->log('Links 4 :: ' . $link->to);
}
+ $this->log('Links 4');
+
$allpages = range(0, $this->book->parametres->pages + 1);
if ($this->book->parametres->themeEnableAfterSearch) {
protected $role = 'button';
+ protected $htmlContainer = null;
+ protected $cssContainer = null;
+
protected $_init;
/**
}
public function getHTMLContainer()
+ {
+ if (null === $this->htmlContainer) {
+ $this->htmlContainer = $this->_getHTMLContainer();
+ }
+ return $this->htmlContainer;
+ }
+
+ public function _getHTMLContainer()
{
$addContent = $this->getAdditionnalContent();
if ($this->relatedAnimation) {
}
public function getCSSContainer()
+ {
+ if (null === $this->cssContainer) {
+ $this->cssContainer = $this->_getCSSContainer();
+ }
+ return $this->cssContainer;
+ }
+
+
+ public function _getCSSContainer()
{
if ($this->moveOnEvenPage()) {
$this->page--;
{
protected $role = '';
- public function getHTMLContainer()
+ public function _getHTMLContainer()
{
$this->to = self::normalizeAnchor($this->to);
$this->compiler->addPageLabel($this->page, $this->to);
$i['height'] = $i['video_height'];
$l = self::getMultimediaInstance($this->id . '_content', $i, $this->compiler);
- $markup = $l->getHTMLContainer();
+ $markup = $l->_getHTMLContainer();
return ' data-multimedia="' . rawurlencode($markup) . '" ';
}
}
} else {
$path = $data->to;
}
- $e = explode(',', `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`);
+
+ $videoSize = $path . '.size';
+ if (!file_exists($videoSize) || filemtime($videoSize) < filemtime($path)) {
+ $probe = `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`;
+ file_put_contents($videoSize, $probe);
+ } else {
+ $probe = file_get_contents($videoSize);
+ }
+ $e = explode(',', $probe);
if (isset($e[0]) && is_numeric($e[0])) {
$attr['width'] = $e[0];
$attr['height'] = $e[1];
}
}
- public function getCSSContainer()
+ public function _getCSSContainer()
{
if ($this->moveOnEvenPage()) {
$this->page--;
return self::makeAudioTag($this, $w, $h, $this->compiler);
}
- public function getCSSContainer()
+ public function _getCSSContainer()
{
- $css = parent::getCSSContainer();
+ $css = parent::_getCSSContainer();
$css .= '#l_' . $this->id . ' audio{';
$css .= 'width:' . round($this->width * $this->getCssScale()) . 'px;';
$css .= 'height:' . round($this->height * $this->getCssScale()) . 'px;';
return '<a href="#" ' . $tooltip . $c . $this->getAdditionnalContent() . '></a>';
}
- public function getCSSContainer()
+ public function _getCSSContainer()
{
if ($this->moveOnEvenPage()) {
$this->page--;
return $res;
}
+ /**
+ * @throws \hollodotme\FastCGI\Exceptions\WriteFailedException
+ * @throws \hollodotme\FastCGI\Exceptions\ConnectException
+ * @throws Throwable
+ * @throws \hollodotme\FastCGI\Exceptions\TimedoutException
+ */
protected function zip($zipfile = null)
{
if (!$this->whole) {
}
$dir = $this->getFinalPackageDir();
- if (file_exists($dir)) {
- $zip = new CubeIT_CommandLine('zip');
- $zip->cd($dir);
- $zip->setArg(null, $zipfile);
- $zip->setArg('symlinks');
- $zip->setArg('0');
- $zip->setArg('r');
- $zip->setArg('u');
- $zip->setArg(null, '.');
- $zip->setManualArg('-x "*/\.*"');
- $zip->execute();
- $zip->debug();
+
+ if ($this->book->region !== 'UE') {
+ $dir = str_replace('/application/usstorage', '/storage', $dir);
+ $zipfile = str_replace('/application/usstorage', '/storage', $zipfile);
+ wsUtil::distantStorageOperation('zip', ['source' => $dir, 'dest' => $zipfile], $this->book->region);
+ } else {
+ if (file_exists($dir)) {
+ $zip = new CubeIT_CommandLine('zip');
+ $zip->cd($dir);
+ $zip->setArg(null, $zipfile);
+ $zip->setArg('symlinks');
+ $zip->setArg('0');
+ $zip->setArg('r');
+ $zip->setArg('u');
+ $zip->setArg(null, '.');
+ $zip->setManualArg('-x "*/\.*"');
+ $zip->execute();
+ $zip->debug();
+ }
}
if ($rename) {
if (!$this->_clean) {
return;
}
- if (file_exists($this->vdir)) {
- // Suppression du répertoire si il existe
- $rm = new cubeCommandLine('rm');
- $rm->setArg('r');
- $rm->setArg('f');
- $rm->setArg(null, $this->vdir);
- $rm->execute();
+ if ($this->book->region === 'UE') {
+ if (file_exists($this->vdir)) {
+ // Suppression du répertoire si il existe
+ $rm = new cubeCommandLine('rm');
+ $rm->setArg('r');
+ $rm->setArg('f');
+ $rm->setArg(null, $this->vdir);
+ $rm->execute();
+ }
}
}