function make_icons($array) { foreach ($array as $value) { switch ($value[0]) { case 'icon': echo "<link rel=\"{$value['0']}\" type=\"" . _mime_content_type(PATH . $value[1]) . "\" href=\"{$value['1']}\">\n"; break; default: echo "<link rel=\"{$value['0']}\" href=\"{$value['1']}\">\n"; } } }
<input type="password" name="password" class="button red"/> <input type="submit" value="Ok" class="button"/> </form> </div> '; } else { if (!isset($_POST['password']) || isset($_POST['password']) && blur_password($_POST['password']) == $id) { if (isset($_GET['thumbs'])) { $f = get_thumbs_name($f); } else { $f = $_SESSION['upload_path'] . $f; } # normal mode or access granted if ($f && is_file($f)) { # file request => return file according to $behaviour var (see core.php) $type = _mime_content_type($f); $ext = strtolower(pathinfo($f, PATHINFO_EXTENSION)); if (is_in($ext, 'FILES_TO_ECHO') !== false) { echo '<pre>' . htmlspecialchars(file_get_contents($f)) . '</pre>'; } else { if (is_in($ext, 'FILES_TO_RETURN') !== false) { header('Content-type: ' . $type . '; charset=utf-8'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($f)); readfile($f); } else { header('Content-type: ' . $type); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($f)); // lance le téléchargement des fichiers non affichables header('Content-Disposition: attachment; filename="' . basename($f) . '"');
} else { $icone_visu = '<a class="visu" target="_BLANK" href="index.php?f=' . $id . '" title="' . e('View this share', false) . '"><span class="icon-eye" ></span></a>'; } if (!$click_on_link_to_download) { $target = 'target="_BLANK"'; } else { $target = null; } } else { $icone_visu = '<a class="visu" target="_BLANK" href="index.php?f=' . $id . '&view" title="' . e('View this file', false) . '"><span class="icon-eye" ></span></a>'; } } else { $icone_visu = ''; } #adding edit icon if needed if (is_file($fichier) && _mime_content_type($fichier) == 'text/plain' && $extension != 'js' && $extension != 'php' && $extension != 'sphp') { $icone_edit = '<a class="edit" href="index.php?p=editor&overwrite=true&file=' . $id . '&token=' . TOKEN . '" title="' . e('Edit this file', false) . '"><span class="icon-edit" ></span></a>'; } else { $icone_edit = ''; } # create item for file or folder $fichier_short = substr($fichier, $upload_path_size); if (is_dir($fichier)) { # Item is a folder $current_tree = tree($fichier, null, false, false, $tree); if (only_type($current_tree, '.jpg .jpeg .gif .png') || only_type($current_tree, '.mp3 .ogg') || only_type($fichier, '.jpg .jpeg .gif .png') || only_type($fichier, '.mp3 .ogg')) { $icone_visu = '<a class="visu" href="index.php?f=' . $id . '" title="' . e('View this share', false) . '"><span class="icon-eye"></span></a>'; } if ($allow_folder_size_stat) { $taille = folder_size($fichier); } else {
function bml_it_getext($file) { if (PHP_VERSION_ID > 50299) { $mime = _mime_content_type($file); } elseif (function_exists('mime_content_type')) { $mime = mime_content_type($file); } else { return ''; } switch ($mime) { case 'image/jpg': case 'image/jpeg': return '.jpg'; break; case 'image/gif': return '.gif'; break; case 'image/png': return '.png'; break; } return ''; }