From: vincent@cubedesigners.com Date: Wed, 2 Feb 2011 19:28:07 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=41ebf19beea4eda971dbb0d3185647e11f6f1f70;p=cubeextranet.git --- diff --git a/.htaccess b/.htaccess index 183878b3d..690dc17c8 100644 --- a/.htaccess +++ b/.htaccess @@ -27,6 +27,6 @@ RewriteRule ^telecharger/([0-9]+)/(.*)$ index.php/telecharger/$1/$2 [L] RewriteRule ^([-_a-zA-Z0-9/]+)$ index.php/$1 [L] RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L] -RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_unprotected/index.swf [L] -RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/_unprotected/player.swf [L] +RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/index.swf [L] +RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L] RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L] diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 74def33fd..612dd0a6c 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -597,6 +597,7 @@ class wsFlash extends cubeFlashGateway { public function compile() { global $core; + wsSecureSWF::checkProtectedSWF(); $dao = new wsDAOBook($core->con); if (!$dao->isUpToDate($this->args['book_id'])) { $dao->compile($this->args['book_id'], 3); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 4db180fa3..5bd8b8ab7 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -93,7 +93,7 @@ class wsUrl { $res .= '' . $core->books_status[$book->status] . ''; } $res .= '' . $btVoir . ''; - $res .= '' . $btEdit . ''; + $res .= '' . $btEdit . ''; $res .= '' . $btStats . ''; $res .= '' . $btDownload . ''; if ($droits->creation) { @@ -280,7 +280,7 @@ html{height:100%}' . "\n"; $book_id = $e[0]; self::checkDocumentVersionOfBook($book_id); - //wsSecureSWF::checkProtectedSWF(); + wsSecureSWF::checkProtectedSWF(); $book = $dao->selectById($book_id); if ($book->hash != $e[1]) { diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 3e3fb2556..5c5a3a1d4 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -45,7 +45,7 @@ class wsDocument extends cubeMetier { const BARBARE_PNM = 4; const BARBARE_GS = 5; - const PNM_FILL = 6; + const PNM_FILL = 2; protected static $resolution2multiply = array(72 => 2, 100 => 2, 150 => 3, 200 => 3, 300 => 3, 450 => 4, 600 => 5); // Number section styles @@ -369,7 +369,7 @@ class wsDocument extends cubeMetier { $this->makeShot($page, 'te', 150, 60, 4, 'GS', $this->uncropped); } - public function makeShotFixedWidth($page , $prefix = '', $w = 100, $quality = 90, $antialiasing = 4, $method = 'GS') + public function makeShotFixedWidth($page , $prefix = '', $w = 100, $quality = 90, $antialiasing = 4, $method = 'PNM') { // Make thumbs of $w width // resolution 72 make 1pt=1px @@ -378,7 +378,7 @@ class wsDocument extends cubeMetier { $this->makeShot($page, $prefix, round(72 / $ratio, 2), $quality, $antialiasing, $method); } - public function makeShotFixedHeight($page , $prefix = '', $h = '', $quality = 90, $antialiasing = 4, $method = 'GS') + public function makeShotFixedHeight($page , $prefix = '', $h = '', $quality = 90, $antialiasing = 4, $method = 'PNM') { // Make thumbs of $w height // resolution 72 make 1pt=1px @@ -387,20 +387,25 @@ class wsDocument extends cubeMetier { $this->makeShot($page, $prefix, round(72 / $ratio, 2), $quality, $antialiasing, $method); } - public function makeShot($page , $prefix = '', $resolution = 72, $quality = 90, $antialiasing = 4, $method = 'GS', $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; } // Delete all old files + $res = $this->out . $prefix . $page . '.jpg'; + if (file_exists($res)) { + @unlink($res); + } + if ($method == 'GS') { $this->makeShotGS($page, $prefix, $resolution, $quality, $antialiasing, $in); } elseif ($method == 'PNM') { $this->makeShotPNM($page, $prefix, $resolution, $quality, $antialiasing, $in); } // Test the result by checking all files - if (!file_exists($this->out . $prefix . $page . '.jpg')) { + if (!file_exists($res)) { $error = true; } // If error, we try to make thumbs with other method @@ -467,6 +472,7 @@ class wsDocument extends cubeMetier { $pdftoppm->setArg('-cropbox'); $pdftoppm->setArg('-freetype yes'); + $pdftoppm->setArg('-jpeg'); $pdftoppm->setArg('-aa ' . $antialiasing); $pdftoppm->setArg('-aaVector ' . $antialiasing); $pdftoppm->setArg('r', $resolution); @@ -475,23 +481,13 @@ class wsDocument extends cubeMetier { $pdftoppm->execute(); $this->addToLog($pdftoppm, true, $page); - $startpage = is_null($page)?1:$page; + $ppmfile = $this->out . 'ppm-' . cubeMath::fill($page, self::PNM_FILL) . '.ppm'; + $ppmjpgfile = $this->out . 'ppm-' . cubeMath::fill($page, self::PNM_FILL) . '.jpg'; + $jpegfile = $this->out . $prefix . $page . '.jpg'; - for($i = $startpage;true;$i++) { - $ppmfile = $this->out . 'ppm-' . cubeMath::fill($i, PNM_FILL) . '.ppm'; - $jpegfile = $this->out . $prefix . $i . '.jpg'; - if (!file_exists($ppmfile)) { - break; - } - $pnmtojpeg = new cubeCommandLine('pnmtojpeg', $jpegfile, false); - $pnmtojpeg->setPath(CONVERTER_PATH); - $pnmtojpeg->setArg('-quality=' . $quality); - $pnmtojpeg->setArg('-density=' . $resolution . 'x' . $resolution . 'dpi'); - $pnmtojpeg->setManualArg($ppmfile); - $pnmtojpeg->execute(); - - $this->addToLog($pnmtojpeg, false, $i); - unlink($ppmfile); + if (file_exists($ppmjpgfile)) { + rename($ppmjpgfile, $jpegfile); + $this->addToLog('Move ' . $ppmjpgfile . ' to ' . $jpegfile, true, $page); } } diff --git a/swf/_src/WSComposer.as3proj b/swf/_src/WSComposer.as3proj index 0b4dcd43f..990f80d16 100644 --- a/swf/_src/WSComposer.as3proj +++ b/swf/_src/WSComposer.as3proj @@ -5,7 +5,7 @@ - +