From: vincent@cubedesigners.com Date: Fri, 28 Jan 2011 17:52:32 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2e7a505891e52289106fbb7aa5d06c2a378cf050;p=cubeextranet.git --- diff --git a/inc/config.inc.php b/inc/config.inc.php index 002432942..1ca69c338 100644 --- a/inc/config.inc.php +++ b/inc/config.inc.php @@ -13,7 +13,7 @@ define('FONT_PATH', ROOT . '/fluidbook/fonts/'); define('FTPROOT', '/home/extranet/ftp/'); define('DEV', false); define('WINDOWS', false); -define('CONVERTER_PATH', '/bin:/usr/bin:/usr/local/bin:/home/extranet/dev/fluidbook/tools:/usr/local/flex'); +define('CONVERTER_PATH', '/bin:/usr/bin:/usr/local/bin:/home/extranet/dev/fluidbook/tools:/usr/local/flex:/usr/local/secureSWF'); define('MXMLC_PATH', '/usr/local/flex/bin/mxmlc'); define('AS3_SOURCES', '/home/ws/sources/as3'); diff --git a/inc/ws/Controlleur/class.ws.secure.swf.php b/inc/ws/Controlleur/class.ws.secure.swf.php index e69de29bb..e01891ff5 100644 --- a/inc/ws/Controlleur/class.ws.secure.swf.php +++ b/inc/ws/Controlleur/class.ws.secure.swf.php @@ -0,0 +1,94 @@ + filemtime(self::$configLocal)) { + self::updateConfigFile(); + } + } + + protected static function updateConfigFile() + { + $x = simplexml_load_file(self::$configOriginal); + // Remplace les chemins par les chemins des fichiers sur le serveur + self::replacePathFiles($x, 'inputFiles', self::$unprotected); + self::replacePathFiles($x, 'outputFiles', self::$protected); + + foreach($x->xpath("//void[@property='fileFullName']") as $f) { + $fname = trim((string)$f->string); + $fname = str_replace('\\', '/', $fname); + + $e = explode('/', $fname); + $file = array_pop($e); + $r = simplexml_load_string('' . self::$unprotected . $file . ''); + cubeXML::replace($f, $r); + } + + file_put_contents(self::$configLocal, $x->asXML()); + } + + protected static function replacePathFiles($x, $property, $dir) + { + $o1 = $x->xpath("//void[@property='$property']"); + $o = array_pop($o1); + $l = simplexml_load_string(''); + $a = $l->addChild('array'); + $a->addAttribute('class', 'java.lang.String'); + $a->addAttribute('length', count(self::$files)); + foreach(self::$files as $k => $f) { + $v = $a->addChild('void'); + $v->addAttribute('index', $k); + $s = $v->addChild('string', $dir . $f); + } + cubeXML::replace($o, $l); + } + + protected static function protectFiles() + { + $secureSWF = new cubeCommandLine('secureSWF', null, true); + $secureSWF->setPath(CONVERTER_PATH); + $secureSWF->setManualArg(self::$configLocal); + $secureSWF->setManualArg(self::$protected); + $secureSWF->execute(); + + file_put_contents(WS_COMPILE_ASSETS . '/_protect/secure.log', $secureSWF->commande . "\n\n\n" . $secureSWF->output); + } +} + +?> \ 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 6805a0fcc..df597cdd4 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -280,7 +280,7 @@ html{height:100%}' . "\n"; $book_id = $e[0]; self::checkDocumentVersionOfBook($book_id); - self::checkProtectedSWF(); + wsSecureSWF::checkProtectedSWF(); $book = $dao->selectById($book_id); if ($book->hash != $e[1]) { @@ -372,7 +372,7 @@ html{height:100%}' . "\n"; $args[1] = 2964; } self::checkDocumentVersionOfBook($args[1]); - self::checkProtectedSWF(); + wsSecureSWF::checkProtectedSWF(); // cubePHP::neverStop(); $dao = new wsDAOBook($core->con); header('Content-type: text/plain');