From 7b097135edd7bf6f2306e4d56772bbcf8775a820 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 4 Jan 2013 09:18:28 +0000 Subject: [PATCH] --- .htaccess | 1 + inc/commons/class.common.url.php | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.htaccess b/.htaccess index 3e459f656..cdd2680f3 100644 --- a/.htaccess +++ b/.htaccess @@ -36,6 +36,7 @@ AddCharset UTF-8 log RewriteRule ^ajax/supprimeFichier/([0-9]+)/(.*)$ index.php/ajax/supprimeFichier/$1/$2 [L] 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 ^([-_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] diff --git a/inc/commons/class.common.url.php b/inc/commons/class.common.url.php index 71e96f112..694ebfbc6 100644 --- a/inc/commons/class.common.url.php +++ b/inc/commons/class.common.url.php @@ -7,7 +7,10 @@ class commonUrl { $args = cubePage::getArgs($args); // Si l'utilisateur n'est pas connecté, on affiche le formulaire // de login - if ((!isset($args[0]) || $args[0] != 'stats') && (is_null($core->user) || !$core->user)) { + + $bypass=array('stats','telecharger','telechargerr'); + + if ((!isset($args[0]) || !in_array($args[0],$bypass)) && (is_null($core->user) || !$core->user)) { $args = array('login'); } else { if (isset($args[0]) && $args[0] == 'login') { @@ -455,7 +458,7 @@ class commonUrl { $bundle = $infos['CFBundleIdentifier']; $appName = $infos['CFBundleDisplayName']; $version = $infos['CFBundleVersion']; - $ipaURL = 'http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath; + $ipaURL = 'http://' . $_SERVER['HTTP_HOST'] . '/telechargerr/' . self::hashFile($fichier->relPath . '//') . '/' . $fichier->relPath; $xml = ' @@ -502,9 +505,11 @@ class commonUrl { return sha1('!!//' . $path . '||--'); } - public static function telecharger($args) { - + public static function telechargerr($args) { + return self::telecharger($args, true); + } + public static function telecharger($args, $relay = false) { array_shift($args); $hash = array_shift($args); $path = implode('/', $args); @@ -518,10 +523,15 @@ class commonUrl { $dir = md5($path . (rand(1, 235548684) * 50.5)); - @mkdir(ROOT . '/cache/download/' . $dir, 0755, true); - copy(FTPROOT . $path, ROOT . '/cache/download/' . $dir . '/' . $nom); + if ($relay) { + files::$mimeType['ipa'] = 'application/octet-stream'; - http::redirect(WEBROOT . '/cache/download/' . $dir . '/' . $nom); + cubeHTTP::relayFile(FTPROOT . $path); + } else { + @mkdir(ROOT . '/cache/download/' . $dir, 0755, true); + copy(FTPROOT . $path, ROOT . '/cache/download/' . $dir . '/' . $nom); + http::redirect('/cache/download/' . $dir . '/' . $nom); + } } public static function upload($args) { -- 2.39.5