From 07b4770b11cf0042f1ca8748cb37908ed684534a Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 24 Sep 2015 12:12:10 +0000 Subject: [PATCH] Fix links depth in html5 Use xsendfile for download file feature --- .htaccess | 7 ++-- inc/commons/class.common.tools.php | 9 +++++ inc/commons/class.common.url.php | 41 +++++++++++++--------- inc/ws/Controlleur/class.ws.services.php | 3 ++ inc/ws/Util/html5/class.ws.html5.links.php | 5 +++ ua.php | 2 +- 6 files changed, 47 insertions(+), 20 deletions(-) diff --git a/.htaccess b/.htaccess index e6f61a842..fbc23f7a8 100644 --- a/.htaccess +++ b/.htaccess @@ -16,7 +16,7 @@ AddCharset UTF-8 log SetOutputFilter DEFLATE - SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|zip|exe|mp3|f4v|ogv|ogg|ogm|webm|mp4|flv|gz|pdf|swc)$ no-gzip dont-vary + SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|zip|exe|mp3|f4v|ogv|ogg|ogm|webm|mp4|flv|gz|pdf|swc|ipa|plist)$ no-gzip dont-vary Header append Vary User-Agent @@ -49,7 +49,6 @@ AddCharset UTF-8 log RewriteRule ^telecharger/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telecharger/$1/$2/$3 [L] RewriteRule ^telechargerr/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telechargerr/$1/$2/$3 [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/index.swf [L] RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L] @@ -90,4 +89,6 @@ AddCharset UTF-8 log RewriteRule ^.*$ - [NC,L] RewriteRule ^([-,_a-zA-Z0-9\./]+)$ index.php/$1 [L] - \ No newline at end of file + + +XSendFile On \ No newline at end of file diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 269bc03cd..033aa2010 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -834,6 +834,9 @@ class commonTools { $openssl->setArg('-outform', 'PEM'); $openssl->execute(); + fb($openssl->commande); + fb($openssl->output); + // Generate p12 file $openssl = new cubeCommandLine('openssl'); $openssl->setPath(CONVERTER_PATH); @@ -846,6 +849,9 @@ class commonTools { $openssl->setArg('-out', $p12); $openssl->execute(); + fb($openssl->commande); + fb($openssl->output); + // Generate pem bundle file $openssl = new cubeCommandLine('openssl'); $openssl->setPath(CONVERTER_PATH); @@ -858,6 +864,9 @@ class commonTools { $openssl->setArg('-clcerts'); $openssl->execute(); + fb($openssl->commande); + fb($openssl->output); + unlink($tmp . '/.rnd'); $tmpfile = cubeFiles::tempnam() . '.zip'; diff --git a/inc/commons/class.common.url.php b/inc/commons/class.common.url.php index 3a4b61707..37f7773d2 100644 --- a/inc/commons/class.common.url.php +++ b/inc/commons/class.common.url.php @@ -298,11 +298,12 @@ class commonUrl { commonDroits::min(array('extranet' => 0, 'ws' => 1)); $settings = $core->user->getSettings('fichiers'); - - if ($core->user->grade > 0 && isset($args[1])) { + if ($core->user->ws_grade > 0 && isset($args[1])) { $dao = new commonDAOClient($core->con); $client = $dao->selectById($args[1]); $_SESSION['entreprise_fichiers'] = $client->entreprise; + } else { + unset($_SESSION['entreprise_fichiers']); } $shortcuts = array(); @@ -370,12 +371,14 @@ class commonUrl { commonDroits::min(array('extranet' => 0, 'ws' => 1)); global $core; - if ($core->user->grade <= 0) { + if ($core->user->ws_grade <= 0) { $entreprise = $core->user->entreprise; } else { $entreprise = $_SESSION['entreprise_fichiers']; } + fb($entreprise); + $settings = is_null($settings) ? $core->user->getSettings('fichiers') : $settings; $dao = new commonDAOFichier($core->con); $change = 'Fichiers'; @@ -436,9 +439,16 @@ class commonUrl { } public static function manifestFromIpa($fichier) { - $manifest = sha1($fichier->relPath) . '.plist'; - $res = SCHEME . '://' . $_SERVER['HTTP_HOST'] . '/cache/iosotamanifest/' . $manifest; - $file = ROOT . '/cache/iosotamanifest/' . $manifest; + $path = '/cache/iosotamanifest/' . sha1($fichier->relPath) . '/'; + $webpath = SCHEME . '://' . $_SERVER['HTTP_HOST'] . $path; + $filepath = ROOT . $path; + + if (!file_exists($filepath)) { + mkdir($filepath, 0777, true); + } + + $res = $webpath . 'manifest.plist'; + $file = $filepath . 'manifest.plist'; $tmp = $file . '.info'; $ipa = $fichier->chemin; @@ -455,11 +465,12 @@ class commonUrl { $infos = $plist->toArray(); + $protocol = 'https'; $bundle = $infos['CFBundleIdentifier']; $appName = $infos['CFBundleDisplayName']; $version = $infos['CFBundleVersion']; - $ipaURL = 'https://' . $_SERVER['HTTP_HOST'] . '/telechargerr/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath; + $ipaURL = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/telechargerr/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath; $xml = ' @@ -482,7 +493,7 @@ class commonUrl { needs-shine url - https://workshop.fluidbook.com/images/ws/ios/512.png + ' . $protocol . '://workshop.fluidbook.com/images/ws/ios/512.png kind @@ -490,7 +501,7 @@ class commonUrl { needs-shine url - https://workshop.fluidbook.com/images/ws/ios/57.png + ' . $protocol . '://workshop.fluidbook.com/images/ws/ios/57.png metadata @@ -498,7 +509,7 @@ class commonUrl { bundle-identifier ' . $bundle . ' bundle-version - ' . $version . '.' . time() . ' + ' . $version . ' kind software title @@ -510,10 +521,9 @@ class commonUrl { '; file_put_contents($file, $xml); - unlink($tmp); } - return $res; + return str_replace('http://', 'https://', $res); } public static function hashFile($path) { @@ -537,11 +547,12 @@ class commonUrl { return; } + cubeHTTP::xsendFile(FTPROOT . $path, false, true); + $dir = md5($path . (rand(1, 235548684) * 50.5)); if ($relay) { files::$mimeType['ipa'] = 'application/octet-stream'; - cubeHTTP::relayFile(FTPROOT . $path); } else { @mkdir(ROOT . '/cache/download/' . $dir, 0755, true); @@ -666,6 +677,4 @@ class commonUrl { return $a; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 6ce7e54d3..e51a1b919 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -720,6 +720,9 @@ class wsServices extends cubeFlashGateway { header('Location: http://www.flf.fr' . $r->url . '?tkpub=ecatalogue-general-2016'); exit; } + $q = 'site:http://www.flf.fr/formation-professionnelle/ "Code stage : ' . $this->args['ref'] . '"'; + header('Location: https://www.google.fr/search?q=' . urlencode($q) . '&ie=utf-8&oe=utf-8&btnI'); + exit; } public function collection() { diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 0f4142404..7f061fc71 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -714,6 +714,11 @@ class htmlMultimediaLink extends wsHTML5Link { return $this->_content; } + public function getHTMLContainerClass() { + return 'link multimedia'; + } + + protected function _correctFiles($dir) { $files = CubeIT_Files::getRecursiveDirectoryIterator($dir); foreach ($files as $f) { diff --git a/ua.php b/ua.php index 3d1903a5c..e59f8862d 100644 --- a/ua.php +++ b/ua.php @@ -1,4 +1,4 @@ + -- 2.39.5