<?php
-class wsMaintenance {
+class wsMaintenance
+{
- public static function in($args) {
+ public static function in($args)
+ {
$args = cubePage::getArgs($args);
$f = array_shift($args);
$callback = array('wsMaintenance', $f);
}
}
- public static function cleanOriginauxPDF() {
+ public static function cleanOriginauxPDF()
+ {
global $core;
cubePHP::neverStop();
$r = $core->con->select('SELECT document_id FROM documents');
}
}
- public static function initCompositionVersions($args) {
+ public static function initCompositionVersions($args)
+ {
global $core;
$dao = new wsDAOBook($core->con);
}
}
- public static function setCID() {
+ public static function setCID()
+ {
global $core;
$dao = new wsDAOBook($core->con);
}
}
- public static function compactLinks() {
+ public static function compactLinks()
+ {
global $core;
$r = $core->con->select('SELECT * FROM `document_links_versions` GROUP BY document_id,links,rulers');
$keep = array();
}
}
- public static function checkSerializeLinks() {
+ public static function checkSerializeLinks()
+ {
global $core;
$r = $core->con->select('SELECT * FROM document_links_versions');
while ($r->fetch()) {
}
}
- public static function moveLinksToVersionDB() {
+ public static function moveLinksToVersionDB()
+ {
global $core;
$r = $core->con->select('SELECT * FROM document_links');
$d = array();
}
}
- public static function importFromOldWS($args) {
+ public static function importFromOldWS($args)
+ {
global $core;
// Import des fluidbooks
// Donc le dernier importé est le max dont le numéro est inférieur à 10000
$core->refreshWSUsersTree();
}
- public static function importLangs($oldBooks) {
+ public static function importLangs($oldBooks)
+ {
global $core, $allTrads, $trads;
// On regarde d'abord les langues que nous avons déjÃ
$r = $core->con->select('SELECT lang_id FROM langues');
}
}
- public static function importThemes($oldBooks) {
+ public static function importThemes($oldBooks)
+ {
global $core, $signatures;
$r = $core->con->select('SELECT tid,sigid FROM ws.theme');
}
}
- public static function importDocs($oldBooks) {
+ public static function importDocs($oldBooks)
+ {
global $core;
// On cherche maintenant à savoir si l'on doit importer de nouveaux documents associés
$oldDocuments = array();
}
}
- public static function copyLinks($args) {
+ public static function copyLinks($args)
+ {
list($from, $to) = $args;
global $core;
$dao->setLinksAndRulers($to, $tolinks, $torulers, 'Copy links from #' . $from . ' to #' . $to, $core->user->utilisateur_id);
}
- public static function importBooks($oldBooks) {
+ public static function importBooks($oldBooks)
+ {
global $core, $allTrads, $signatures;
// Importe les fluidbooks
$r = $core->con->select('SELECT * FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ' ORDER BY bid');
}
}
- protected static function _oldIconesToColor($iid, &$parametres) {
+ protected static function _oldIconesToColor($iid, &$parametres)
+ {
global $oldIconesColors;
if (!isset($oldIconesColors)) {
$oldIconesColors = array();
}
}
- protected static function _getWsUser($oldid) {
+ protected static function _getWsUser($oldid)
+ {
global $ws2ext;
if (!isset($ws2ext)) {
self::_getAllUsers();
return $ws2ext[$oldid];
}
- protected static function _getAllUsers() {
+ protected static function _getAllUsers()
+ {
global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs;
$grades = array(0 => 1, 0.4 => 1, '0.4' => 1, 0.5 => 1, '0.5' => 1, 1 => 1, 2 => 2, 3 => 3, 4 => 5);
// Contrôle des entreprises déjà dans la base extranet
}
}
- protected static function _importOldUser($oldid) {
+ protected static function _importOldUser($oldid)
+ {
global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs;
// Get user from old
$r = $core->con->select('SELECT * FROM ws.user WHERE uid=\'' . $core->con->escape($oldid) . '\'');
}
}
- protected static function _sqlIn($tab) {
+ protected static function _sqlIn($tab)
+ {
return ' IN(\'' . implode('\',\'', $tab) . '\') ';
}
- protected static function _getLangCode($lang) {
+ protected static function _getLangCode($lang)
+ {
$lang = strtolower($lang);
if ($lang == 'cz') {
$lang = 'cs';
return $lang;
}
- public static function dumpDatabase() {
+ public static function dumpDatabase()
+ {
cubeDb::mysqlDump(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, ROOT . '/backups/dump-' . date('Y-m-d-H-i-s') . '.sql', true, 8);
}
- public static function cleanPackages() {
+ public static function cleanPackages()
+ {
$limit = TIME - (2 * 3600); // 2 heures avant maintenant*
//
$dirs = array(
}
}
- public static function cleanConversionSessions() {
+ public static function cleanConversionSessions()
+ {
$limit = TIME - (4 * 3600); // 4 heures avant maintenant*
$dir = ROOT . '/cache/conversionSessions/';
}
}
- public static function cleanUnusedDocs() {
+ public static function cleanUnusedDocs()
+ {
global $core;
cubePHP::neverStop();
$r = $core->con->select('SELECT document_id FROM documents WHERE document_id NOT IN (SELECT document_id FROM book_pages)');
}
}
+ self::_moveDocs(WS_DOCS, '/data/extranet/www/fluidbook/docs1', 750);
+ self::_moveDocs('/data/extranet/www/fluidbook/docs1', '/data/extranet/www/fluidbook/docs2', 2000);
+ }
+
+ protected static function _moveDocs($from, $to, $keep, $batch = 250)
+ {
$docs = array();
- $dr = opendir(WS_DOCS);
+ $dr = opendir($from);
while ($d = readdir($dr)) {
if ($d == '.' || $d == '..') {
continue;
}
sort($docs);
- $docs = array_splice($docs, 0, count($docs) - 750);
+ $docs = array_splice($docs, 0, count($docs) - $keep);
if (count($docs)) {
- $toMove = array_slice($docs, 0, 250);
+ $toMove = array_slice($docs, 0, $batch);
foreach ($toMove as $d) {
if (trim($d) == '') {
continue;
}
- $source = WS_DOCS . '/' . $d . '/';
- $dest = '/data/extranet/www/fluidbook/docs1/' . $d . '/';
+ $source = $from . '/' . $d . '/';
+ $dest = $to . '/' . $d . '/';
if (!file_exists($dest)) {
mkdir($dest, 0777, true);
}
}
}
- public static function moveFluidbookDatas() {
+ public static function moveFluidbookDatas()
+ {
$dir = WS_BOOKS . '/final/';
$dr = opendir($dir);
while ($d = readdir($dr)) {
}
}
- public static function mergeEntreprise($args) {
+ public static function mergeEntreprise($args)
+ {
global $core;
$from = $args[0];
$core->refreshWSUsersTree();
}
- public static function updateLuceneTime() {
+ public static function updateLuceneTime()
+ {
global $core;
$dao = new wsDAOBook($core->con);
$books = $dao->selectLuceneTimeNotSet();
}
}
- public static function makeLuceneIndexes() {
+ public static function makeLuceneIndexes()
+ {
global $core;
cubePHP::neverStop();
}
}
- public static function exportSommaire($args) {
+ public static function exportSommaire($args)
+ {
global $core;
$book_id = $args[0];
$dao = new wsDAOBook($core->con);
exit;
}
- public static function copySommaire($args) {
+ public static function copySommaire($args)
+ {
global $core;
$from = $args[0];
$to = $args[1];
$dao->setChapters($to, json_encode($fbook->chapters));
}
- public static function copyComposition($args) {
+ public static function copyComposition($args)
+ {
global $core;
$from = $args[0];
}
}
- protected static function _duplicateLines($table, $key, $currentKey, $newKey) {
+ protected static function _duplicateLines($table, $key, $currentKey, $newKey)
+ {
global $core;
$tmptable = 'tmptable_' . $table . '_' . $newKey;
$core->con->execute('DROP TEMPORARY TABLE IF EXISTS ' . $tmptable);
}
- public static function restoreComposition($args) {
+ public static function restoreComposition($args)
+ {
global $core;
$book_id = $args[0];
if (isset($args[1])) {
}
}
- public static function getV1Translations() {
+ public static function getV1Translations()
+ {
wsLang::getV1Translations();
}
- public static function appendDocument($args) {
+ public static function appendDocument($args)
+ {
global $core;
$book_id = $args[0];
$document_id = $args[1];
$dao->appendDocument($book_id, $document_id);
}
- public static function reprocessVideos($args) {
+ public static function reprocessVideos($args)
+ {
global $core;
$book_id = $args[0];
}
}
- public static function syncLDAP() {
+ public static function syncLDAP()
+ {
global $core;
cubePHP::neverStop();
return $res;
}
- public static function createBranch($args) {
+ public static function createBranch($args)
+ {
commonDroits::min(5);
$branch = $args[0];
echo $git->executeCmd('checkout master');
}
- public static function deleteBranch($args) {
+ public static function deleteBranch($args)
+ {
commonDroits::min(5);
$branch = trim($args[0]);
if ($branch == 'master' || !$branch) {
self::updateHTML5Sources();
}
- public static function updateHTML5Sources($args = array(), $externals = true) {
+ public static function updateHTML5Sources($args = array(), $externals = true)
+ {
$playerDir = WS_COMPILE_ASSETS . '/player/';
$branchesDir = $playerDir . 'branches/';
$localDir = $playerDir . 'local/';
file_put_contents(WS_CACHE . '/activebranches', json_encode($branches));
}
- public static function cleanDownload($args) {
+ public static function cleanDownload($args)
+ {
$dirs = [ROOT . '/cache/download/', WS_FILES . '/packager/download'];
foreach ($dirs as $dir) {
cubeFiles::scanRecursiveDir($dir, $files);
}
}
- public static function deleteOldFilesFromFTP($args) {
+ public static function deleteOldFilesFromFTP($args)
+ {
global $core;
cubePHP::neverStop();
cubeFiles::deleteFilesOlderThan('/home/ws/www/getpdf', 60);
}
- public static function reencodeVideos($args) {
+ public static function reencodeVideos($args)
+ {
cubePHP::neverStop();
}
}
- public static function correctAutoBookmarkLinks($args) {
+ public static function correctAutoBookmarkLinks($args)
+ {
global $core;
$book_id = $args[0];
wsLinks::getLinksAndRulers($book_id, $links, $rulers);
$dao->setLinksAndRulers($book_id, json_encode($newlinks), json_encode($rulers), 'Autobookmark links correction', $core->user->utilisateur_id);
}
- public static function compress() {
+ public static function compress()
+ {
`gzip /home/extranet/www/fluidbook/docs/*/p*.csv`;
`gzip /home/extranet/www/fluidbook/docs/*/*.txt`;
}
- public static function restoreChapters($args) {
+ public static function restoreChapters($args)
+ {
global $core;
$book_id = $args[0];
echo $r->chapters;
}
- public static function offsetLinksPos($args) {
+ public static function offsetLinksPos($args)
+ {
global $core;
$book_id = $args[0];
$direction = $args[1];
$dao->setLinksAndRulers($book_id, json_encode($newlinks), json_encode($rulers), 'Offset links positions (' . $direction . ' :: ' . $value . ')', $core->user->utilisateur_id);
}
- public static function extractTexts($args) {
+ public static function extractTexts($args)
+ {
global $core;
$book_id = $args[0];
$dao = new wsDAOBook($core->con);
die('<pre>' . $res . '</pre>');
}
- public static function _reencodeVideos($book_id, $format) {
+ public static function _reencodeVideos($book_id, $format)
+ {
wsLinks::getLinksAndRulers($book_id, $links, $rulers);
foreach ($links as $l) {
if ($l['type'] == 10) {
}
}
- public static function syncKadreoMailchimp() {
+ public static function syncKadreoMailchimp()
+ {
global $core;
set_time_limit(0);
}
- public static function syncCubedesignersMailchimp() {
+ public static function syncCubedesignersMailchimp()
+ {
global $core;
set_time_limit(0);
echo '<pre>' . print_r($runs, true) . '</pre>';
}
- public static function resetPlayerVersion() {
+ public static function resetPlayerVersion()
+ {
global $core;
$dev = [10000, 10003, 1540, 15571, 15837];
$r = $core->con->select('SELECT book_id, parametres FROM books WHERE book_id NOT IN(' . implode(',', $dev) . ')');
}
- public static function getSVGPage($args) {
+ public static function getSVGPage($args)
+ {
global $core;
$fluidbook = $args[0];
exit;
}
- public static function testSVG() {
+ 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 static function svgToFlash() {
+ public static function svgToFlash()
+ {
$iconSets = array(15);
$names = array('nav-share' => 'nav-friend',
- 'nav-bookmarks' => 'nav-bookmark',
- 'nav-chapters' => 'nav-sommaire',
- 'nav-download' => 'nav-save',
- 'nav-fullscreen' => 'nav-fullscreen',
- 'nav-fullscreen-exit' => 'nav-normalscreen',
- 'nav-sound-off' => 'nav-soundoff',
- 'nav-sound-on' => 'nav-soundon',
+ 'nav-bookmarks' => 'nav-bookmark',
+ 'nav-chapters' => 'nav-sommaire',
+ 'nav-download' => 'nav-save',
+ 'nav-fullscreen' => 'nav-fullscreen',
+ 'nav-fullscreen-exit' => 'nav-normalscreen',
+ 'nav-sound-off' => 'nav-soundoff',
+ 'nav-sound-on' => 'nav-soundon',
);
}
}
- public static function iconSetToInterface() {
+ public static function iconSetToInterface()
+ {
$iconSets = array(1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
$names = array('nav-share' => 'nav-friend',
- 'nav-bookmarks' => 'nav-bookmark',
- 'nav-chapters' => 'nav-sommaire',
- 'nav-download' => 'nav-save',
- 'nav-fullscreen' => 'nav-fullscreen',
- 'nav-fullscreen-exit' => 'nav-normalscreen',
- 'nav-sound-off' => 'nav-soundoff',
- 'nav-sound-on' => 'nav-soundon',
+ 'nav-bookmarks' => 'nav-bookmark',
+ 'nav-chapters' => 'nav-sommaire',
+ 'nav-download' => 'nav-save',
+ 'nav-fullscreen' => 'nav-fullscreen',
+ 'nav-fullscreen-exit' => 'nav-normalscreen',
+ 'nav-sound-off' => 'nav-soundoff',
+ 'nav-sound-on' => 'nav-soundon',
);
$shares = array('email', 'facebook', 'twitter', 'googleplus', 'linkedin', 'viadeo');
}
}
- public static function installAtlanticCommunicationBook() {
+ public static function installAtlanticCommunicationBook()
+ {
$exporter = new wsExporter();
$exporter->export(15316, $x, 'install_ftp', 'online', "atlanticki-01:Tjz3N85h@ftp.cluster023.hosting.ovh.net/www/", '');
header('Location: http://www.atlantic-international-book-com.com/');
exit;
}
- public static function installWescoVentes() {
+ public static function installWescoVentes()
+ {
$exporter = new wsExporter();
$exporter->export(16328, $x, 'install_ftp', 'online', "wescogrolj-catalogca:b9uA7U72eW@ftp.cluster023.hosting.ovh.net", '');
header('Location: https://wesco-group.com/download/Catalogues/2018/Wesco_Rapport_ventes_0-12-ans');
exit;
}
- public static function fixStats($args) {
+ public static function fixStats($args)
+ {
commonDroits::min(5);
$book = trim($args[0], ' .');
if (!$book) {
`rm -rf /home/stats/www/objects/$book*;/home/stats/www/FWStats.sh /home/stats/www redobook=$book`;
}
- public static function processInbox() {
+ public static function processInbox()
+ {
$base = WS_FILES . '/INBOX/';
}
- public static function _processPDF($publication) {
+ public static function _processPDF($publication)
+ {
$fluidbook = new CubeIT_Services_Fluidbook();
// Login
$fluidbook->login($publication['user'], 'Jvia*qpkMydh6tZ#euGa');
unlink($publication['spl']->getPathname());
}
- public static function nwbuild($args) {
+ public static function nwbuild($args)
+ {
wsPackager::package(16200, 'win-exe-html');
}
}
* @version $Id$
* @access public
*/
-class wsDocument extends cubeMetier {
+class wsDocument extends cubeMetier
+{
protected $document_id;
protected $file;
// Number section styles
protected static
$numberStyles = array('NoNumber' => 'no', 'DecimalArabicNumerals' => 'decimal',
- 'UppercaseRomanNumerals' => 'roman_up', 'LowercaseRomanNumerals' => 'roman_low',
- 'UppercaseLetters' => 'letters_up', 'LowercaseLetters' => 'letters_low');
+ 'UppercaseRomanNumerals' => 'roman_up', 'LowercaseRomanNumerals' => 'roman_low',
+ 'UppercaseLetters' => 'letters_up', 'LowercaseLetters' => 'letters_low');
- public function init() {
+ public function init()
+ {
$this->out = wsDocument::getDir($this->document_id);
$this->log = $this->out . '/logs/';
$this->html = $this->out . '/html/';
}
}
- public function copyOriginalFromUpload($tmp_file) {
+ public function copyOriginalFromUpload($tmp_file)
+ {
move_uploaded_file($tmp_file, $this->in);
}
- public function copyOriginalFromOlderVersion() {
+ public function copyOriginalFromOlderVersion()
+ {
if (!file_exists($this->in)) {
copy('https://ws.fluidbook.com/docs/' . $this->document_id . '/original.pdf', $this->in);
}
}
- public function extractFonts() {
+ public function extractFonts()
+ {
$extractor = new wsPDFFontExtractor($this->out, $this);
$extractor->extract();
}
- public function getInfos($in = null, $force = false) {
+ public function getInfos($in = null, $force = false)
+ {
if (is_null($in)) {
$in = $this->in;
}
$this->findCutDisposition();
}
- public function findCutDisposition() {
+ public function findCutDisposition()
+ {
$this->detectSpreads();
$this->detectPageDifferences();
}
- protected function detectPageDifferences() {
+ protected function detectPageDifferences()
+ {
$this->addToLog('Detect page differences');
// Vérifie si la cropbox et la trimbox sont identiques pour toutes les pages
$difference = false;
}
}
- protected function detectSpreads() {
+ protected function detectSpreads()
+ {
$this->addToLog('Detect spreads');
// Détection des spreads
$this->addToLog('Detect Spreads : Manual cut ' . $this->manualcut . ' ; Auto cut : ' . $this->autocut);
}
- public static function compareSizes($x, $y, $tolerance = 0.9) {
+ public static function compareSizes($x, $y, $tolerance = 0.9)
+ {
return cubeMath::compare($x[0], $y[0], $tolerance) && cubeMath::compare($x[1], $y[1], $tolerance);
}
- public function lnCrop() {
+ public function lnCrop()
+ {
$root = dirname($this->cropped);
`cd $root;ln -s original.pdf crop.pdf`;
}
- public function parseInfos($data) {
+ public function parseInfos($data)
+ {
cubePHP::set_memory('4G');
// This function get general infos (pages sizes, boxes, number sections and
// bookmarks
return $res;
}
- public function getPagesNumber() {
+ public function getPagesNumber()
+ {
$this->getInfos();
return $this->generalInfos['pages'];
}
- public function globalOperations() {
+ public function globalOperations()
+ {
$this->addToLog('Get infos');
$this->getInfos();
if ($this->CropAndCut()) {
$this->splitDoc();
}
- public function splitDoc() {
+ public function splitDoc()
+ {
$this->addToLog('Split document');
mkdir($this->out . '/pdf');
$pdftk = new cubeCommandLine('pdftk');
$this->addToLog($pdftk);
}
- public function CropAndCut() {
+ public function CropAndCut()
+ {
$this->addToLog('Crop And Cut');
if (!$this->isCropped()) {
$this->lnCrop();
return false;
}
- public function cutDocument($mode) {
+ public function cutDocument($mode)
+ {
$fwstk = new cubeCommandLine('fwstk.sh');
$fwstk->setPath(CONVERTER_PATH);
$fwstk->setArg('--input ' . $this->in);
$this->addToLog($fwstk);
}
- public function trimDocument() {
+ public function trimDocument()
+ {
$fwstk = new cubeCommandLine('fwstk.sh');
$fwstk->setPath(CONVERTER_PATH);
$fwstk->setArg('--input ' . $this->in);
$this->addToLog($fwstk);
}
- public function processOnePage($page, $force = true) {
+ public function processOnePage($page, $force = true)
+ {
if ($force) {
$this->addToLog('Processing page #' . $page);
$this->makeMiniShot($page);
}
}
- public function processAllPages() {
+ public function processAllPages()
+ {
for ($i = 1; $i <= $this->generalInfos['pages']; $i++) {
$this->processOnePage($i);
}
}
- public function processRange($pages) {
+ public function processRange($pages)
+ {
foreach ($pages as $i) {
$this->processOnePage($i);
}
}
- public function getLinks() {
+ public function getLinks()
+ {
$fwstk = new cubeCommandLine('fwstk.sh');
$fwstk->setPath(CONVERTER_PATH);
$fwstk->setArg('--input ' . $this->cropped);
$this->addToLog($fwstk);
}
- public function getHighlightTextsData() {
+ public function getHighlightTextsData()
+ {
$fwstk = new cubeCommandLine('fwstk.sh');
$fwstk->setPath(CONVERTER_PATH);
$fwstk->setArg('--input ' . $this->cropped);
$this->addToLog($fwstk);
}
- public function getResolutionRatio() {
+ public function getResolutionRatio()
+ {
$a4surface = 500990; // en pt²
$docSurface = $this->generalInfos['size'][0] * $this->generalInfos['size'][1]; // en pt²
// to have the same surface resulting in px, we have to sqrt the ratio between the two surfaces defined above
return sqrt($a4surface / $docSurface);
}
- public function makeMiniShot($page) {
+ public function makeMiniShot($page)
+ {
$this->makeShotFixedWidth($page, 'p', 100, 90, 4, 'PNM');
}
- public function makeShotFixedWidth($page, $prefix = '', $w = 100, $quality = 90, $antialiasing = 4, $method = 'PNM') {
+ public function makeShotFixedWidth($page, $prefix = '', $w = 100, $quality = 90, $antialiasing = 4, $method = 'PNM')
+ {
// Make thumbs of $w width
// resolution 72 make 1pt=1px
$width = $this->generalInfos['size'][0];
$this->makeShot($page, $prefix, round(72 / $ratio, 2), $quality, $antialiasing, $method);
}
- public function makeShotFixedHeight($page, $prefix = '', $h = '', $quality = 90, $antialiasing = 4, $method = 'PNM') {
+ public function makeShotFixedHeight($page, $prefix = '', $h = '', $quality = 90, $antialiasing = 4, $method = 'PNM')
+ {
// Make thumbs of $w height
// resolution 72 make 1pt=1px
$height = $this->generalInfos['size'][1];
$this->makeShot($page, $prefix, round(72 / $ratio, 2), $quality, $antialiasing, $method);
}
- public function makeShot($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $method = 'PNM', $in = null) {
+ public function makeShot($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $method = 'PNM', $in = null)
+ {
$error = false;
if (is_null($in)) {
$in = $this->cropped;
}
}
- protected function makeShotGS($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $in = null) {
+ protected function makeShotGS($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $in = null)
+ {
if (is_null($in)) {
$in = $this->cropped;
}
$this->addToLog($gs, true, $page);
}
- protected function makeShotPNM($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $in = null, $texts = true) {
+ protected function makeShotPNM($page, $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $in = null, $texts = true)
+ {
if (is_null($in)) {
$in = $this->cropped;
}
}
}
- protected function isCropped() {
+ protected function isCropped()
+ {
return $this->autocrop || $this->manualcrop || $this->autocut || $this->manualcut;
}
- public function makeSWFFiles($page, $resolution = null, $quality = null, $storeAllChars = null, $maxObjects = null, $method = null, $version = null) {
+ public function makeSWFFiles($page, $resolution = null, $quality = null, $storeAllChars = null, $maxObjects = null, $method = null, $version = null)
+ {
$conversionSettings = $this->conversionInfos->pages[$page];
if (is_null($storeAllChars)) {
$storeAllChars = true;
}
}
- public function makeHTML5Files($page) {
+ public function makeHTML5Files($page)
+ {
// Then make HD background shots
$resolutions = array(300 => 85, 150 => 85, 36 => 85);
$rratio = $this->getResolutionRatio();
$this->makeSVGFile($page);
}
- public function makeSVGFile($page) {
+ public function makeSVGFile($page)
+ {
$svgFile = $this->out . '/html/fp' . $page . '.svg';
$pdftocairo = new cubeCommandLine('pdftocairo');
$this->addToLog($pdftocairo, true, $page);
}
- public static function extractTexts($svgFile, $textFile, $force = false) {
+ public static function extractTexts($svgFile, $textFile, $force = false)
+ {
$do = $force || !file_exists($textFile) || filemtime($svgFile) > filemtime($textFile) || filemtime($textFile) < filemtime(__FILE__);
if (!$do) {
return;
$xpath->registerNamespace("php", "http://php.net/xpath");
$xpath->registerPhpFunctions('has_not_text');
$toDelete = array('//svg:defs/svg:clipPath',
- '//svg:defs/svg:image',
- '//svg:defs/svg:path',
- '//svg:defs/svg:pattern',
- '//svg:defs/svg:g[starts-with(@id, "surface")]//svg:path',
- '/svg:svg/svg:g//svg:path',
- '/svg:svg/svg:g//svg:rect',
- '//svg:use[starts-with(@xlink:href, "#image")]'
+ '//svg:defs/svg:image',
+ '//svg:defs/svg:path',
+ '//svg:defs/svg:pattern',
+ '//svg:defs/svg:g[starts-with(@id, "surface")]//svg:path',
+ '/svg:svg/svg:g//svg:path',
+ '/svg:svg/svg:g//svg:rect',
+ '//svg:use[starts-with(@xlink:href, "#image")]'
);
//global $svglog;
//return $svglog;
}
- protected function _cleanSVG($svgFile, $page) {
+ protected function _cleanSVG($svgFile, $page)
+ {
$svglog = self::cleanSVG($svgFile);
$this->addToLog(implode("\n", $svglog), false, $page);
}
- protected function checkObjectsNumber($file, $maxObjects, $page) {
+ protected function checkObjectsNumber($file, $maxObjects, $page)
+ {
$swfdump = new cubeCommandLine('swfdump', null, true);
$swfdump->setPath(CONVERTER_PATH);
$swfdump->setArg(null, $file);
return false;
}
- protected function dumpSWF($page, $prefix = 'p') {
+ protected function dumpSWF($page, $prefix = 'p')
+ {
$swfdump = new cubeCommandLine('/usr/local/swftools/special-swfdump/bin/swfdump', null, true);
$swfdump->setPath(CONVERTER_PATH);
$swfdump->setArg('t');
* @param integer $method
* @return
*/
- protected function pdf2swf($page, $resolution = 150, $quality = 90, $storeAllChars = true, $method = 0, $prefix = 'p', $version = 'stable') {
+ protected function pdf2swf($page, $resolution = 150, $quality = 90, $storeAllChars = true, $method = 0, $prefix = 'p', $version = 'stable')
+ {
/*
-h , --help Print short help message and exit
-V , --version Print version info and exit
}
}
- protected function _findMultiply($resolution) {
+ protected function _findMultiply($resolution)
+ {
$resolution /= $this->getResolutionRatio();
return self::$resolution2multiply[$resolution];
}
- protected function makeAS3($page) {
+ protected function makeAS3($page)
+ {
$swffile = $this->out . 'p' . $page . '.swf';
$swfcombine = new cubeCommandLine('swfcombine');
$this->addToLog($swfcombine, true, $page);
}
- protected function pdf2swfBarbare($page, $resolution = 150, $quality = 85, $method = 4) {
+ protected function pdf2swfBarbare($page, $resolution = 150, $quality = 85, $method = 4)
+ {
// Fabrique les images
$this->addToLog('Making barbare swf', true, $page);
return '';
}
- public function resetLog() {
+ public function resetLog()
+ {
unlink($this->log . '/commons.log.gz');
}
- public function addToLog($cl, $output = true, $page = null) {
+ public function addToLog($cl, $output = true, $page = null)
+ {
if ($cl instanceof cubeCommandLine) {
$c = '--- Exécuté en ' . $cl->execTime . " s\n" . $cl->commande . "\n\n";
if ($output) {
$fclose($pointer);
}
- public function __destruct() {
+ public function __destruct()
+ {
}
- public static function getDir($id) {
+ public static function getDir($id)
+ {
if (!is_array(self::$_docsDir)) {
self::$_docsDir = array();
$new = WS_DOCS . '/' . $id . '/';
$old = WS_FILES . '/docs1/' . $id . '/';
+ $veryold = WS_FILES . '/docs2/' . $id . '/';
if (file_exists($new . 'p1.swf')) {
self::$_docsDir[$id] = $new;
} elseif (file_exists($old . 'p1.swf')) {
self::$_docsDir[$id] = $old;
return $old;
+ } else if (file_exists($veryold . 'p1.swf')) {
+ self::$_docsDir[$id] = $veryold;
+ return $veryold;
}
if (!file_exists($new)) {
mkdir($new, 0777, true);