AddDefaultCharset UTF-8\r
AddCharset UTF-8 log\r
\r
+\r
+\r
# Static\r
<IfModule mod_expires.c>\r
# ExpiresActive On\r
RewriteCond %{HTTP_HOST} fluidbook\r
RewriteRule ^favicon.ico$ images/ws/favicon.ico [L]\r
\r
+ RewriteRule ^index.php/(.*)$ - [L]\r
+\r
RewriteRule ^voir_book/(.*)$ viewer1/$1 [L,R=301]\r
\r
RewriteRule ^ajax/supprimeFichier/([0-9]+)/(.*)$ index.php/ajax/supprimeFichier/$1/$2 [L]\r
//define('DB_HOST', ':/var/run/mysqld/mysqld.sock');\r
\r
\r
-define('AMARCORD', true);\r
-define('SERVER', 'avanger');\r
-define('DB_HOST', 'alien.cubedesigners.com');\r
+\r
+if ($_SERVER['SERVER_ADDR'] == '147.135.136.182') {\r
+ define('SERVER', 'alien');\r
+ define('DB_HOST', 'localhost');\r
+ define('AMARCORD', false);\r
+} else {\r
+ define('AMARCORD', true);\r
+ define('SERVER', 'amarcord');\r
+ define('DB_HOST', 'alien.cubedesigners.com');\r
+}\r
define('DB_NAME', 'extranet');\r
define('DB_USER', 'extranet');\r
define('DB_PASSWORD', 'WvcAeYBDnrB93RXa');\r
$this->currentDoc = unserialize($doc_serialized);\r
\r
$core->reloadDBConnection();\r
+ $dao = new wsDAODocument($core->con);\r
+ $daoBook = new wsDAOBook($core->con);\r
+\r
if (!$this->reload) {\r
// On n'ajoute les fichiers à la fin du fluidbook que si l'on\r
// n'est pas en train de recharger le fluidbook\r
}\r
$this->processedDoc++;\r
\r
+\r
ob_flush();\r
}\r
\r
\r
public function getProgress() {\r
$res = array("progress" => $this->progress,\r
- 'totalDoc' => $this->totalDoc,\r
- 'currentDocPage' => $this->currentDocPage,\r
- 'totalDocPage' => $this->totalDocPage,\r
- 'totalPages' => $this->totalPages,\r
- 'processedPages' => $this->processedPages,\r
- 'processedDoc' => max($this->processedDoc + 1, $this->totalDoc));\r
+ 'totalDoc' => $this->totalDoc,\r
+ 'currentDocPage' => $this->currentDocPage,\r
+ 'totalDocPage' => $this->totalDocPage,\r
+ 'totalPages' => $this->totalPages,\r
+ 'processedPages' => $this->processedPages,\r
+ 'processedDoc' => max($this->processedDoc + 1, $this->totalDoc));\r
if ($this->currentDoc) {\r
$res['currentDoc'] = $this->currentDoc->file;\r
}\r
}\r
\r
public function __destruct() {\r
- \r
+\r
}\r
\r
public static function openFromGUID($guid) {\r
return CACHE . '/conversionSessions/' . $guid . '.obj';\r
}\r
\r
-}\r
-\r
-?>
\ No newline at end of file
+}
\ No newline at end of file
\r
protected static function gradeIn($list, $error = false) {\r
global $core;\r
- if (!in_array($core->user->ws_grade, $list)) {\r
+\r
+ if (null === $core->user || !isset($core->user->ws_grade) || !in_array($core->user->ws_grade, $list)) {\r
if ($error) {\r
commonDroits::error();\r
}\r
if (!$admin && !in_array($signature->signature_id, $mySignatures)) {\r
continue;\r
}\r
- if(!$signature->active){\r
+ if (!$signature->active) {\r
continue;\r
}\r
$res[$signature->nom] = $signature->signature_id;\r
$php = new cubeCommandLine($executable);
$php->setPath(CONVERTER_PATH);
$php->setArg('f', ROOT . '/index.php');
+ $php->setArg('d', 'memory_limit=4G');
$php->setManualArg('--');
$php->setArg('user_email', $_SESSION['user_email']);
$php->setArg('user_password', $_SESSION['user_password']);
$php->setArg('sessionConversionGUID', $sessionConversionGUID);
$php->setArg('PATH_INFO', '/flash/processConversionSessionAsync');
$php->setArg('HTTP_HOST', $_SERVER['HTTP_HOST']);
+ $php->setArg('SERVER_ADDR', $_SERVER['SERVER_ADDR']);
$php->setNohup(true);
$php->execute('exec');
$i->addAttribute('id', $icone->icone_id);
$i->addAttribute('nom', $icone->nom);
$i->addAttribute('path', ICONS . $icone->icone_id . '.png');
- $i->addAttribute('main', in_array($icone->icone_id,array(13, 15)));
+ $i->addAttribute('main', in_array($icone->icone_id, array(13, 15)));
}
}
$comp = unserialize($r->composition);
$core->con->execute('DELETE FROM book_pages WHERE book_id=\'' . $core->con->escape($book_id) . '\'');
-
$c = $core->con->openCursor('book_pages');
$c->book_id = $book_id;
foreach ($comp as $book_page => $infos) {
$fwstk->setPath(CONVERTER_PATH);
$fwstk->setArg('--input ' . $out . '/crop.pdf');
$fwstk->setArg('--extractTexts ' . $out . '%s%d.txt');
- $fwstk->setArg('--extractTextsMethod ' . $book->parametres->textExtraction);
+ $fwstk->setArg('--extractTextsMethod ' . $book->parametres->textExtraction);
if ($book->parametres->ignoreSearchSeparators != '') {
$fwstk->setArg('--ignoreSeparators ' . $book->parametres->ignoreSearchSeparators);
}
echo 'error : ' . implode(', ', $error) . '<br />';
}
+
public static function getSVGPage($args) {
global $core;
exit;
}
- public function testSVG() {
- $test = '/home/extranet/www/fluidbook/docs/115864/html/test.svg';
- copy('/home/extranet/www/fluidbook/docs/115864/html/tp1.svg', $test);
- wsDocument::cleanSVG($test, true);
+ public static function testSVG() {
+ $test = '/home/extranet/www/fluidbook/docs/117077/html/zz%s.svg';
+ echo wsTools::optimizeSVG('/home/extranet/www/fluidbook/docs/117077/html/fp11.svg', $test, [150, 300], true);
}
// public function addSearch() {
\r
self::forceComputation($bid);\r
\r
- cubePHP::set_memory('512M');\r
+ cubePHP::set_memory('4G');\r
\r
self::$xls = new PHPExcel();\r
self::$xls->removeSheetByIndex(0);\r
\r
+\r
$global = self::load_stats($bid);\r
\r
+\r
$exporturl = SITE_PATH . 'statsxls/' . $bid;\r
if (!is_null($annee)) {\r
$exporturl .= '/' . $annee;\r
\r
$listeShortcuts = array();\r
\r
+\r
$listeMois = null;\r
foreach ($years as $y) {\r
$selectedYear = __('Toutes');\r
}\r
$annees[(string)$y['year']] = SITE_PATH . 'stats/' . $bid . '/' . (string)$y['year'];\r
}\r
+\r
$listeAnnees = new commonShortcuts(__('Année'), $annees, $selectedYear);\r
$listeShortcuts[] = $listeAnnees;\r
if (!is_null($listeMois)) {\r
self::$xls->setActiveSheetIndex(0);\r
$writer = new PHPExcel_Writer_Excel2007();\r
$writer->setPHPExcel(self::$xls);\r
- $writer->save(self::_getXLSFile($bid, $annee, $mois));\r
+ $xlsfile = self::_getXLSFile($bid, $annee, $mois);\r
+ cubePHP::set_memory('4G');\r
+ $writer->save($xlsfile);\r
} catch (Exception $e) {\r
+ die($e->getMessage());\r
}\r
\r
return $res;\r
\r
class wsBox extends cubeMetier {\r
\r
- protected $top;\r
- protected $left;\r
- protected $right;\r
- protected $bottom;\r
- protected $width;\r
- protected $height;\r
+ protected $top;\r
+ protected $left;\r
+ protected $right;\r
+ protected $bottom;\r
+ protected $width;\r
+ protected $height;\r
\r
- public function __construct($top, $left, $right, $bottom) {\r
- $this->top = $top;\r
- $this->left = $left;\r
- $this->right = $right;\r
- $this->bottom = $bottom;\r
+ public function __construct($top, $left, $right, $bottom) {\r
+ $this->top = $top;\r
+ $this->left = $left;\r
+ $this->right = $right;\r
+ $this->bottom = $bottom;\r
\r
- $this->width = $this->right - $this->left;\r
- $this->height = $this->bottom - $this->top;\r
- }\r
+ $this->width = floatval($this->right) - floatval($this->left);\r
+ $this->height = floatval($this->bottom) - floatval($this->top);\r
+ }\r
\r
}\r
-\r
-?>
\ No newline at end of file
$out .= "\n";
$out .= $pdfinfo->output;
+ $this->addToLog('Parse infos');
$this->parseInfos($out);
+ $this->addToLog('Set Page Infos');
$this->conversionInfos->setPageNumber($this->generalInfos['pages']);
+ $this->addToLog('Write infos');
file_put_contents($this->infos, $out);
+
+ $this->addToLog('Find cut disposition');
+
$this->findCutDisposition();
}
}
protected function detectPageDifferences() {
+ $this->addToLog('Detect page differences');
// Vérifie si la cropbox et la trimbox sont identiques pour toutes les pages
$difference = false;
foreach ($this->generalInfos['page'] as $page => $infos) {
}
protected function detectSpreads() {
+ $this->addToLog('Detect spreads');
// Détection des spreads
$this->autocut = false;
}
public function parseInfos($data) {
+ cubePHP::set_memory('4G');
// This function get general infos (pages sizes, boxes, number sections and
// bookmarks
// Init arrays
$this->numberSections = $v;
}
}
-
-
return $res;
}
}
public function globalOperations() {
+ $this->addToLog('Get infos');
$this->getInfos();
if ($this->CropAndCut()) {
+ $this->addToLog('Get infos after crop');
$this->getInfos($this->cropped, true);
}
+ $this->addToLog('Get links');
$this->getLinks();
+ $this->addToLog('End of global ops');
+ $this->splitDoc();
+ }
+
+ public function splitDoc() {
+ $this->addToLog('Split document');
+ mkdir($this->out . '/pdf');
+ $pdftk = new cubeCommandLine('pdftk');
+ $pdftk->setPath(CONVERTER_PATH);
+ $pdftk->setArg(null, $this->cropped);
+ $pdftk->setArg(null, 'burst');
+ $pdftk->setArg(null, 'output');
+ $pdftk->setArg(null, $this->out . 'pdf/p%d.pdf');
+ $pdftk->execute();
+ $this->addToLog($pdftk);
}
public function CropAndCut() {
+ $this->addToLog('Crop And Cut');
if (!$this->isCropped()) {
$this->lnCrop();
return false;
$pdf2swf = new cubeCommandLine($program, null, true);
$pdf2swf->setPath(CONVERTER_PATH);
- $pdf2swf->setArg('p', $page);
+ $pdf2swf->setArg('p', 1);
$flashversion = 10;
if ($method == self::NORMAL) {
$pdf2swf->setArg(null, '-T7');
$pdf2swf->setArg('set alignfonts');
}
- $pdf2swf->setArg(null, $this->cropped);
- $pdf2swf->setArg('output', $this->out . $prefix . '%.swf');
+ $pdf2swf->setArg(null, $this->out . 'pdf/p' . $page . '.pdf');
+ $pdf2swf->setArg('output', $this->out . $prefix . $page . '.swf');
$pdf2swf->execute();
if ($version == 'git') {
$pdf2swf = new cubeCommandLine('pdf2swf', null, true);
$pdf2swf->setPath(CONVERTER_PATH);
$pdf2swf->setArg('set poly2bitmap');
- $pdf2swf->setArg('p', $page);
+ $pdf2swf->setArg('p', 1);
$pdf2swf->setArg('stop');
$pdf2swf->setArg('T', 10);
$pdf2swf->setArg('set reordertags', '0');
$pdf2swf->setArg('set subpixels', '0.01');
$pdf2swf->setArg('set jpegquality', '1');
$pdf2swf->setArg('set disablelinks');
- $pdf2swf->setArg(null, $this->cropped);
+ $pdf2swf->setArg(null, $this->out . 'pdf/p' . $page . '.pdf');
$pdf2swf->setArg('output', $this->out . 't' . $page . '.swf');
$pdf2swf->execute();
$this->addToLog($pdf2swf, true, $page);
}
$new = WS_DOCS . '/' . $id . '/';
- $old = '/mnt/sshfs/batman/home/extranet/www/fluidbook/docs/' . $id . '/';
+ $old = WS_FILES . '/docs1/' . $id . '/';
if (file_exists($new . 'p1.swf')) {
self::$_docsDir[$id] = $new;
class wsTools {
+ protected static $_r;
+
public static function encodeWebVideos($file, $dir = null, $async = true, $force = false, $format = 'all') {
if (is_null($dir)) {
$dir = dirname($file);
}
}
- public static function optimizeSVG($original, $optimized, $force = false) {
+ public static function optimizeSVG($original, $optimized, $resolutions = [], $force = false) {
+
if (!file_exists($original)) {
- return;
+ return 'doesnt exists';
}
$optimize = $force ||
$cmd = "/usr/local/bin/svgcleaner --allow-bigger-file --paths-coordinates-precision 3 --copy-on-error --stdout $original";
$svg = `$cmd`;
$svg = substr_replace($svg, 'preserveAspectRatio="none" ', 5, 0);
- file_put_contents($optimized, $svg);
+ $fname = str_replace('%s', '', $optimized);
+ file_put_contents($fname, $svg);
+
+ if (count($resolutions) > 0) {
+ foreach ($resolutions as $resolution) {
+ self::$_r = $resolution;
+ $osvg = preg_replace_callback('|\<image([^>]*)\>|', 'wsTools::optimizeRaster', $svg);
+ file_put_contents(sprintf($optimized, '-' . $resolution), $osvg);
+ }
+ }
return true;
}
return false;
}
+ public static function optimizeRaster($matches) {
+
+ return '<image />';
+ }
+
public static function copy($source, $dest) {
if (!file_exists($source)) {
return;
$lessVariables['z'] = $this->z;
$lessVariables['book-page-width'] = $w;
$lessVariables['book-page-height'] = $h;
+ $lessVariables['book-page-ratio'] = $w / $h;
$lessVariables['shadow-opacity'] = wsHTML5::colorToArray($this->theme->parametres->bookShadeColor)['opacity'] * 1.2;
$lessVariables['edges-display'] = $this->_lessBoolean($this->theme->parametres->usePageEdges);
<?php
-
-require_once 'inc/ZendFramework/ChromeLogger/ChromePhp.php';
-ChromePhp::getInstance()->setEnabled();
-
require_once(dirname(__FILE__) . '/inc/prepend.php');
-
-//ChromePhp::log($_SERVER);
ob_start();
header('Access-Control-Allow-Origin: *');
echo $core->url->getDocument();
$buffer = ob_get_contents();
+cubePHP::set_memory('4G');
+
ob_clean();
echo cubePage::page($buffer, $js, $jsvar, $css, array(), 9, false, $meta, array(), $standard);
--- /dev/null
+<?php\r
+trigger_error('test');\r
+phpinfo();\r
+?>
\ No newline at end of file
<!-- Executed before build -->\r
<preBuildCommand />\r
<!-- Executed after build -->\r
- <postBuildCommand alwaysRun="False">"H:\Applications\PortableApps\PuTTYPortable\App\PuTTY\pscp.exe" -agent -batch "$(OutputDir)\$(OutputName)" extranet@extranet.cubedesigners.com:/home/extranet/www/swf</postBuildCommand>\r
+ <postBuildCommand alwaysRun="False">"C:\ProgramData\chocolatey\lib\kitty\tools\kscp.exe" -agent -batch "$(OutputDir)\$(OutputName)" extranet@extranet.cubedesigners.com:/home/extranet/www/swf</postBuildCommand>\r
<!-- Other project options -->\r
<options>\r
<option showHiddenPaths="False" />\r