#RewriteRule ^docs - [L]\r
\r
RewriteRule ^ajax/supprimeFichier/([0-9]+)/(.*)$ index.php/ajax/supprimeFichier/$1/$2 [L]\r
- RewriteRule ^telecharger/([0-9]+)/(.*)$ index.php/telecharger/$1/$2 [L]\r
+ RewriteRule ^telecharger/([0-9a-fA-F]+)/([0-9]+)/(.*)$ index.php/telecharger/$1/$2/$3 [L]\r
RewriteRule ^([-_a-zA-Z0-9/]+)$ index.php/$1 [L]\r
\r
RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L]\r
$icotool->setArg('c');
$icotool->setArg('o', $tmp . '/favicon.ico');
- $sizes = array(16, 32, 57, 64, 72, 114, 128, 256);
- $apple = array(114, 72, 57);
+ $sizes = array(16, 32, 57, 64, 72, 114, 128, 144, 256);
+ $apple = array(144, 114, 72, 57);
foreach ($sizes as $s) {
global $core;\r
$ext = files::getExtension($fichier->relPath);\r
\r
- if ($ext == 'ipa' && (stristr($_SERVER['HTTP_USER_AGENT'], 'iphone') || stristr($_SERVER['HTTP_USER_AGENT'], 'ipad') || stristr($_SERVER['HTTP_USER_AGENT'], 'ipod') )) {\r
- return '<a href="itms-services://?action=download-manifest&url=' . self::manifestFromIpa($fichier) . '">' . $core->typo->Telecharger('Installer') . '</a>';\r
- } else {\r
- return '<a href="' . SITE_PATH . 'telecharger/' . $fichier->relPath . '">' . $core->typo->Telecharger('Télécharger') . '</a>';\r
+ $res = '';\r
+ if ($ext == 'ipa') {\r
+ $res.='<a href="itms-services://?action=download-manifest&url=' . self::manifestFromIpa($fichier) . '">' . $core->typo->Telecharger('Installer') . '</a> ';\r
}\r
+ $res.= '<a href="' . SITE_PATH . 'telecharger/' . self::hashFile($fichier->relPath) . '/' . $fichier->relPath . '">' . $core->typo->Telecharger('Télécharger') . '</a>';\r
+ return $res;\r
}\r
\r
public static function manifestFromIpa($fichier) {\r
$plist = new CFPropertyList\CFPropertyList($tmp);\r
\r
$infos = $plist->toArray();\r
- fb($infos);\r
+\r
+\r
$bundle = $infos['CFBundleIdentifier'];\r
$appName = $infos['CFBundleDisplayName'];\r
$version = $infos['CFBundleVersion'];\r
- $ipaURL = 'http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . $fichier->relPath;\r
+ $ipaURL = 'http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . 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
return $res;\r
}\r
\r
+ public static function hashFile($path) {\r
+ $path = trim($path, '/');\r
+ fb($path);\r
+ return sha1('!!//' . $path . '||--');\r
+ }\r
+\r
public static function telecharger($args) {\r
- commonDroits::min(array('extranet' => 0, 'ws' => 1));\r
+\r
\r
array_shift($args);\r
+ $hash = array_shift($args);\r
$path = implode('/', $args);\r
$utilisateur_id = array_shift($args);\r
- commonDroits::telecharger($utilisateur_id);\r
- $dir = md5($path . (rand(1, 235548684) * 50.5));\r
$nom = array_pop($args);\r
+\r
+ $verihash = self::hashFile($path);\r
+ if ($hash != $verihash) {\r
+ return;\r
+ }\r
+\r
+ $dir = md5($path . (rand(1, 235548684) * 50.5));\r
+\r
@mkdir(ROOT . '/cache/download/' . $dir, 0755, true);\r
copy(FTPROOT . $path, ROOT . '/cache/download/' . $dir . '/' . $nom);\r
\r
$body = 'Tous les fichiers de ' . $client->prenom . ' ' . $client->nom . ' : http://' . $_SERVER['HTTP_HOST'] . '/fichiers/' . $client->utilisateur_id . "\n\n";\r
$body .= 'Fichiers chargés : ' . "\n";\r
foreach ($_SESSION['files_uploaded'] as $f) {\r
- $body .= ' - http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . $f . "\n";\r
+ $body .= ' - http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . commonUrl::hashFile($f) . '/' . $f . "\n";\r
}\r
$body .= "\n" . RAPPEL . " : \n";\r
$body .= ' - Adresse : http://' . $_SERVER['HTTP_HOST'] . '/' . "\n";\r
'fileFilter' => $imageFilter,\r
'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=ico',\r
'hint' => __('Image PNG de 256x256'));\r
+ $this->fields['iosicon'] = array('type' => 'file', 'default' => '', 'editable' => true,\r
+ 'label' => __('Icone (pour application iOS)'),\r
+ 'path' => $themeRoot,\r
+ 'fileFilter' => $imageFilter,\r
+ 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=ico',\r
+ 'hint' => __('Image PNG de 1024x1024'));\r
+ $this->fields['androidicon'] = array('type' => 'file', 'default' => '', 'editable' => true,\r
+ 'label' => __('Icone (pour application Android)'),\r
+ 'path' => $themeRoot,\r
+ 'fileFilter' => $imageFilter,\r
+ 'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id . '&type=ico',\r
+ 'hint' => __('Image PNG de 1024x1024'));\r
\r
$this->forms['logo'] = array('label' => __('Personnalisation du logo'),\r
- 'fieldsnames' => array('logo', 'favicon'));\r
+ 'fieldsnames' => array('logo', '|', 'favicon', 'iosicon', 'androidicon'));\r
/* Loader */\r
$this->fields['logoLoader'] = array('type' => 'file', 'default' => 'logoLoader.png', 'editable' => true,\r
'label' => __('Logo affiché au chargement'),\r
if ($this->makeResources) {
- if ($this->os == 'ios') {
- $this->resources = $vdir . '/Resources';
- $this->makeIOSResources();
- } elseif ($this->os == 'android') {
- $this->resources = $vdir . '/Resources';
- $this->makeAndroidResources();
+ if ($os == 'ios') {
+ $this->makeIOSResources($vdir . '/Resources');
+ } elseif ($os == 'android') {
+ $this->makeAndroidResources($vdir . '/Resources');
}
}
}
}
- protected function makeAndroidResources() {
+ protected function makeAndroidResources($resources) {
$icons = array('drawable' => 96,
'drawable-hdpi' => 72,
'drawable-ldpi' => 36,
'drawable-xhdpi' => '1280x1920');
foreach ($icons as $dir => $size) {
- $d = $this->resources . '/' . $dir;
+ $d = $resources . '/' . $dir;
if (!file_exists($d)) {
mkdir($d, 0777, true);
}
- $this->_makeIcon($size, 'icon', $d);
+ $this->_makeIcon($size, 'icon', $d, 'android');
}
foreach ($splashs as $dir => $size) {
- $d = $this->resources . '/' . $dir;
+ $d = $resources . '/' . $dir;
if (!file_exists($d)) {
mkdir($d, 0777, true);
}
}
}
- protected function makeIOSResources() {
+ protected function makeIOSResources($resources) {
$splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x748' => 'Default-Landscape~ipad', '768x1004' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x~iphone');
$icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
- if (!file_exists($this->resources . '/splash')) {
- mkdir($this->resources . '/splash', 0777, true);
+ if (!file_exists($resources . '/splash')) {
+ mkdir($resources . '/splash', 0777, true);
}
if (!file_exists($this->resources . '/icons')) {
- mkdir($this->resources . '/icons', 0777, true);
+ mkdir($resources . '/icons', 0777, true);
}
foreach ($splashs as $size => $name) {
list($width, $height) = explode('x', $size);
- $this->_makeSplash($width, $height, $name);
+ $this->_makeSplash($width, $height, $name, $resources . '/icons');
}
foreach ($icons as $size => $name) {
- $this->_makeIcon($size, $name);
+ $this->_makeIcon($size, $name, $resources . '/icons', 'ios');
}
}
- protected function _makeSplash($width, $height, $name, $dir = null) {
+ protected function _makeSplash($width, $height, $name, $dir) {
$im = imagecreatetruecolor($width, $height);
// Draw Background
$back = imagecolorhexallocate($im, $this->theme->parametres->backgroundColor);
imagefill($im, 0, 0, $back);
// Draw image
- if (is_null($dir)) {
- $dir = $this->resources . '/splash';
- }
$this->_drawBackImage($im, $width, $height);
imagepng($im, $dir . '/' . $name . '.png');
}
- protected function _makeIcon($size, $name, $dir = null) {
- if ($this->theme->parametres->favicon != '') {
+ protected function _makeIcon($size, $name, $dir, $os = '') {
+
+ $os = strtolower($os);
+ $icoos = $os.'icon';
+
+ if (isset($this->theme->parametres->$icoos) && $this->theme->parametres->$icoos != '') {
+ $base = $this->themeRoot . '/' . $this->theme->parametres->$icoos;
+ } elseif ($this->theme->parametres->favicon != '') {
$base = $this->themeRoot . '/' . $this->theme->parametres->favicon;
} else {
$base = WS_COMPILE_ASSETS . '/_ico/phonegap.png';
}
- if (is_null($dir)) {
- $dir = $this->resources . '/icons';
- }
-
- $it = new imageTools();
+ $it = new cubeImageTools();
$it->loadImage($base);
- $it->resize($size, $size, 'ratio');
+ $it->resize($size, $size, 'ratio',false,'C','M','transparent');
$it->output('png', $dir . '/' . $name . '.png');
}