]> _ Git - cubeextranet.git/commitdiff
Fix links depth in html5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Sep 2015 12:12:10 +0000 (12:12 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Sep 2015 12:12:10 +0000 (12:12 +0000)
Use xsendfile for download file feature

.htaccess
inc/commons/class.common.tools.php
inc/commons/class.common.url.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Util/html5/class.ws.html5.links.php
ua.php

index e6f61a842845367d0e597d04d96b3c995e9fbec6..fbc23f7a83b73b7361bbe83f0c0f9164cccd39a0 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -16,7 +16,7 @@ AddCharset UTF-8 log
 \r
 <IfModule mod_deflate.c>\r
        SetOutputFilter DEFLATE\r
-       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\r
+       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\r
 \r
        <IfModule mod_headers.c>\r
                Header append Vary User-Agent\r
@@ -49,7 +49,6 @@ AddCharset UTF-8 log
        RewriteRule ^telecharger/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telecharger/$1/$2/$3 [L]\r
        RewriteRule ^telechargerr/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telechargerr/$1/$2/$3 [L]\r
 \r
-\r
        RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L]\r
        RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/index.swf [L]\r
        RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L]\r
@@ -90,4 +89,6 @@ AddCharset UTF-8 log
        RewriteRule ^.*$ - [NC,L]\r
 \r
        RewriteRule ^([-,_a-zA-Z0-9\./]+)$ index.php/$1 [L]\r
-</IfModule>
\ No newline at end of file
+</IfModule>\r
+\r
+XSendFile On
\ No newline at end of file
index 269bc03cd5b7feceab7c391ca1f6fc668e98d029..033aa201054a28330146c7f4eac88b324270b586 100644 (file)
@@ -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';
index 3a4b6170701bc817a45fecf05d1d4ea8622bf744..37f7773d2e1f1d4f8fe3b80bfddebb38e2c75816 100644 (file)
@@ -298,11 +298,12 @@ class commonUrl {
                commonDroits::min(array('extranet' => 0, 'ws' => 1));\r
 \r
                $settings = $core->user->getSettings('fichiers');\r
-\r
-               if ($core->user->grade > 0 && isset($args[1])) {\r
+               if ($core->user->ws_grade > 0 && isset($args[1])) {\r
                        $dao = new commonDAOClient($core->con);\r
                        $client = $dao->selectById($args[1]);\r
                        $_SESSION['entreprise_fichiers'] = $client->entreprise;\r
+               } else {\r
+                       unset($_SESSION['entreprise_fichiers']);\r
                }\r
 \r
                $shortcuts = array();\r
@@ -370,12 +371,14 @@ class commonUrl {
                commonDroits::min(array('extranet' => 0, 'ws' => 1));\r
 \r
                global $core;\r
-               if ($core->user->grade <= 0) {\r
+               if ($core->user->ws_grade <= 0) {\r
                        $entreprise = $core->user->entreprise;\r
                } else {\r
                        $entreprise = $_SESSION['entreprise_fichiers'];\r
                }\r
 \r
+               fb($entreprise);\r
+\r
                $settings = is_null($settings) ? $core->user->getSettings('fichiers') : $settings;\r
                $dao = new commonDAOFichier($core->con);\r
                $change = 'Fichiers';\r
@@ -436,9 +439,16 @@ class commonUrl {
        }\r
 \r
        public static function manifestFromIpa($fichier) {\r
-               $manifest = sha1($fichier->relPath) . '.plist';\r
-               $res = SCHEME . '://' . $_SERVER['HTTP_HOST'] . '/cache/iosotamanifest/' . $manifest;\r
-               $file = ROOT . '/cache/iosotamanifest/' . $manifest;\r
+               $path = '/cache/iosotamanifest/' . sha1($fichier->relPath) . '/';\r
+               $webpath = SCHEME . '://' . $_SERVER['HTTP_HOST'] . $path;\r
+               $filepath = ROOT . $path;\r
+\r
+               if (!file_exists($filepath)) {\r
+                       mkdir($filepath, 0777, true);\r
+               }\r
+\r
+               $res = $webpath . 'manifest.plist';\r
+               $file = $filepath . 'manifest.plist';\r
                $tmp = $file . '.info';\r
                $ipa = $fichier->chemin;\r
 \r
@@ -455,11 +465,12 @@ class commonUrl {
 \r
                        $infos = $plist->toArray();\r
 \r
+                       $protocol = 'https';\r
 \r
                        $bundle = $infos['CFBundleIdentifier'];\r
                        $appName = $infos['CFBundleDisplayName'];\r
                        $version = $infos['CFBundleVersion'];\r
-                       $ipaURL = 'https://' . $_SERVER['HTTP_HOST'] . '/telechargerr/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath;\r
+                       $ipaURL = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/telechargerr/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath;\r
 \r
                        $xml = '<?xml version="1.0" encoding="UTF-8"?>\r
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\r
@@ -482,7 +493,7 @@ class commonUrl {
                                        <key>needs-shine</key>\r
                                        <false/>\r
                                        <key>url</key>\r
-                                       <string>https://workshop.fluidbook.com/images/ws/ios/512.png</string>\r
+                                       <string>' . $protocol . '://workshop.fluidbook.com/images/ws/ios/512.png</string>\r
                                </dict>\r
                                <dict>\r
                                        <key>kind</key>\r
@@ -490,7 +501,7 @@ class commonUrl {
                                        <key>needs-shine</key>\r
                                        <false/>\r
                                        <key>url</key>\r
-                                       <string>https://workshop.fluidbook.com/images/ws/ios/57.png</string>\r
+                                       <string>' . $protocol . '://workshop.fluidbook.com/images/ws/ios/57.png</string>\r
                                </dict>\r
                        </array>\r
                        <key>metadata</key>\r
@@ -498,7 +509,7 @@ class commonUrl {
                                <key>bundle-identifier</key>\r
                                <string>' . $bundle . '</string>\r
                                <key>bundle-version</key>\r
-                               <string>' . $version . '.' . time() . '</string>\r
+                               <string>' . $version . '</string>\r
                                <key>kind</key>\r
                                <string>software</string>\r
                                <key>title</key>\r
@@ -510,10 +521,9 @@ class commonUrl {
 </plist>';\r
 \r
                        file_put_contents($file, $xml);\r
-\r
                        unlink($tmp);\r
                }\r
-               return $res;\r
+               return str_replace('http://', 'https://', $res);\r
        }\r
 \r
        public static function hashFile($path) {\r
@@ -537,11 +547,12 @@ class commonUrl {
                        return;\r
                }\r
 \r
+               cubeHTTP::xsendFile(FTPROOT . $path, false, true);\r
+\r
                $dir = md5($path . (rand(1, 235548684) * 50.5));\r
 \r
                if ($relay) {\r
                        files::$mimeType['ipa'] = 'application/octet-stream';\r
-\r
                        cubeHTTP::relayFile(FTPROOT . $path);\r
                } else {\r
                        @mkdir(ROOT . '/cache/download/' . $dir, 0755, true);\r
@@ -666,6 +677,4 @@ class commonUrl {
                return $a;\r
        }\r
 \r
-}\r
-\r
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 6ce7e54d3cdd1bad3b182a02343fad8e11a02dbb..e51a1b91987d499f079dc1e8b9427c702902728f 100644 (file)
@@ -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() {
index 0f41424041d4d29cd5fdaf94e97e639d3a611600..7f061fc71ca77134635da5d04f5556420153dc04 100644 (file)
@@ -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 3d1903a5c3cbcc59eb9f7cb01327db67f20f9de5..e59f8862dfe21e437411fe00559435b197856263 100644 (file)
--- a/ua.php
+++ b/ua.php
@@ -1,4 +1,4 @@
 <?php
 
 echo $_SERVER['HTTP_USER_AGENT'];
-?>
+