From: vincent@cubedesigners.com Date: Thu, 3 Feb 2011 16:49:50 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c4778c9e05ecbf7dd1b4d2b019e70305d5e86124;p=cubeextranet.git --- diff --git a/.htaccess b/.htaccess index 690dc17c8..7deb29f2a 100644 --- a/.htaccess +++ b/.htaccess @@ -30,3 +30,8 @@ RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3 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] + +RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ vieweru/$1_$2_$3/index [L] +RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_unprotected/index.swf [L] +RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/_unprotected/player.swf [L] +RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L] \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 5bd8b8ab7..d12eeb57f 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -255,18 +255,28 @@ html{height:100%}' . "\n"; return wsStats::display($bid, $annee, $mois); } - public static function viewer($args) + public static function vieweru($args) { - global $core; - global $css; - global $js; - global $standard; - global $meta; + commonDroits::min(5); - define('MINIMIZE_JS', false); - define('MINIMIZE_CSS', false); - define('JQUERY', false); + $args = cubePage::getArgs($args); + $e = explode('_', $args[0]); + if (count($e) == 2 || $e[2] < TIME-10) { + $e[2] = TIME; + http::redirect(SITE_PATH . 'vieweru/' . implode('_', $e) . '/'); + exit; + } + + $book_id = $e[0]; + + self::checkDocumentVersionOfBook($book_id); + + echo self::commonViewer($book_id,$e[1]); + } + + public static function viewer($args) + { $args = cubePage::getArgs($args); $e = explode('_', $args[0]); @@ -276,14 +286,36 @@ html{height:100%}' . "\n"; exit; } - $dao = new wsDAOBook($core->con); $book_id = $e[0]; self::checkDocumentVersionOfBook($book_id); wsSecureSWF::checkProtectedSWF(); + echo self::commonViewer($book_id,$e[1]); + } + + public static function commonViewer($book_id,$hash) + { + if (!defined('MINIMIZE_JS')) { + define('MINIMIZE_JS', false); + } + if (!defined('MINIMIZE_CSS')) { + define('MINIMIZE_CSS', false); + } + if (!defined('JQUERY')) { + define('JQUERY', false); + } + + global $core; + global $css; + global $js; + global $standard; + global $meta; + + $dao = new wsDAOBook($core->con); + $book = $dao->selectById($book_id); - if ($book->hash != $e[1]) { + if ($book->hash != $hash) { commonDroits::error(); } @@ -332,7 +364,7 @@ html{height:100%}' . "\n"; $res .= ''; $res .= ''; - echo $res; + return $res; } public static function statsxls($args) @@ -381,7 +413,6 @@ html{height:100%}' . "\n"; exit; } - protected static function checkDocumentVersionOfBook($book_id) { global $core; diff --git a/inc/ws/_common.php b/inc/ws/_common.php index f87e3052a..391841f95 100644 --- a/inc/ws/_common.php +++ b/inc/ws/_common.php @@ -10,6 +10,7 @@ $core->url->register('flash', 'flash', '^flash(.*)$', array('wsFlash', 'in')); $core->url->register('services', 'services', '^services(.*)$', array('wsServices', 'in')); $core->url->register('editor', 'editor', '^editor/(.*)$', array('wsUrl', 'editor')); $core->url->register('viewer', 'viewer', '^viewer/(.*)$', array('wsUrl', 'viewer')); +$core->url->register('vieweru', 'vieweru', '^vieweru/(.*)$', array('wsUrl', 'vieweru')); if (DEV) { $tools = ROOT . '/../inc/tools/';