Beispiel #1
0
function draw_tree($tree)
{
    if (!only_image($tree)) {
        # file list tree
        echo '<section><ul class="tree">';
        $root = explode('/', $tree[0]);
        $fork = '&#9500;';
        $root = array_search(basename($tree[0]), $root) + 1;
        $level = 0;
        $tab = str_repeat('&nbsp;', 2);
        for ($i = 0; $i < count($tree); $i++) {
            $branch = $tree[$i];
            if (isset($tree[$i + 1])) {
                $next = $tree[$i + 1];
            } else {
                $next = false;
            }
            if ($link = file2id($branch)) {
                $ext = '';
                $level = count(explode('/', $branch)) - $root;
                if ($next) {
                    $next_level = count(explode('/', $next)) - $root;
                } else {
                    $next_level = 0;
                }
                if ($level < 0) {
                    $level = 0;
                }
                if ($next_level < 0) {
                    $next_level = 0;
                }
                $ext = strtolower(pathinfo($branch, PATHINFO_EXTENSION));
                $folder = '';
                $basename = basename($branch);
                if (is_dir($branch)) {
                    $folder = ' folder';
                }
                if ($level > $next_level || !$next) {
                    $fork = '&#9492;';
                } else {
                    $fork = '&#9500;';
                }
                if ($level < $next_level) {
                    echo '<li>' . str_repeat('<span class="vl">' . $tab . '&#9474;' . $tab . '</span>', $level + 1) . '</li>';
                }
                echo '<li><span class="vl">' . str_repeat($tab . '&#9474;' . $tab, $level) . $tab . $fork . $tab . '</span><span class="' . $ext . $folder . '"><a href="index.php?f=' . $link . '">' . $basename . '</a></span></li>';
                if ($level > $next_level) {
                    echo '<li>' . str_repeat('<span class="vl">' . $tab . '&#9474;' . $tab . '</span>', $level) . '</li>';
                }
            }
        }
        echo '</ul></section>';
    } else {
        # image gallery
        if (!function_exists('auto_thumb')) {
            include 'core/auto_thumb.php';
        }
        global $gallery_thumbs_width;
        $title = explode('/', $tree[0]);
        $title = $title[count($title) - 1];
        unset($tree[0]);
        echo '<section><ul class="gallery"><h1>' . $title . '</h1>';
        foreach ($tree as $image) {
            $link = 'index.php?f=' . file2id($image);
            $ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
            if ($ext != 'mp4') {
                $size = getimagesize($image);
                $size = $size[0] . 'x' . $size[1];
                $file = basename($image);
                auto_thumb($image, $width = $gallery_thumbs_width, $height = $gallery_thumbs_width, $add_to_thumb_filename = '_THUMBGALLERY_', $crop_image = true);
                echo '<a class="image" href="' . $link . '" ><img src="' . $link . '&gthumbs" alt="' . $file . '"/><span class="info"><em>' . $file . '</em> ' . $size . '</span></a>';
            } else {
                echo '<a class="image video" href="' . $link . '" ><div class="blank">&nbsp;</div><span class="info"><em>' . $file . '</em> ' . $size . '</span></a>';
            }
        }
        echo '</ul></section>';
    }
}
Beispiel #2
0
         }
         $extension = strtolower(pathinfo($fichier, PATHINFO_EXTENSION));
         if (visualizeIcon($extension)) {
             $icone_visu = '<a class="visu" href="index.php?f=' . $id . '" target="_BLANK" title="' . e('View this file', false) . '">&nbsp;</a>';
         } else {
             $icone_visu = '';
         }
         $fichier_short = substr($fichier, $upload_path_size);
         if (is_dir($fichier)) {
             # Item is a folder
             $taille = count(_glob($fichier . '/'));
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier));
             $folderlist .= template($mode . '_folder_' . $layout, $array);
         } elseif ($extension == 'gif' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'png') {
             # Item is a picture
             auto_thumb($fichier, 64, 64);
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_image_' . $layout, $array);
         } elseif ($extension == 'zip') {
             # Item is a zip file=> add change to folder
             $icone_visu = '<a class="tofolder" href="index.php?p=admin&unzip=' . $id . '&token=' . returnToken() . '" title="' . e('Convert this zip file to folder', false) . '">&nbsp;</a>';
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_file_' . $layout, $array);
         } else {
             # all other types
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_file_' . $layout, $array);
         }
     }
 }
 echo $folderlist . $filelist;
Beispiel #3
0
         }
         $extension = strtolower(pathinfo($fichier, PATHINFO_EXTENSION));
         if (visualizeIcon($extension)) {
             $icone_visu = '<a class="visu" href="index.php?f=' . $id . '" target="_BLANK" title="' . e('View this file', false) . '">&nbsp;</a>';
         } else {
             $icone_visu = '';
         }
         $fichier_short = substr($fichier, $upload_path_size);
         if (is_dir($fichier)) {
             # Item is a folder
             $taille = count(_glob($fichier . '/'));
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier));
             $folderlist .= template($mode . '_folder_item', $array);
         } elseif ($extension == 'gif' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'png') {
             # Item is a picture
             auto_thumb($fichier_short, 64, 64);
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_image_item', $array);
         } elseif ($extension == 'zip') {
             # Item is a zip file=> add change to folder
             $icone_visu = '<a class="tofolder" href="admin.php?unzip=' . $id . '&token=' . returnToken() . '" title="' . e('Convert this zip file to folder', false) . '">&nbsp;</a>';
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_file_item', $array);
         } else {
             # all other types
             $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
             $filelist .= template($mode . '_file_item', $array);
         }
     }
 }
 echo $folderlist . $filelist;
Beispiel #4
0
if (count($liste) > 1) {
    $files = array_flip($ids);
    foreach ($liste as $fichier) {
        $nom = basename($fichier);
        if ($nom != 'index.html' && empty($files[$nom])) {
            // generates the file ID if not present
            $id = uniqid(true);
            $ids[$id] = $nom;
            $save = true;
        }
        if ($nom != 'index.html' && !empty($files[$nom])) {
            $taille = round(filesize($fichier) / 1024, 2);
            $id = $files[$nom];
            $extension = strtolower(pathinfo($fichier, PATHINFO_EXTENSION));
            if ($extension == 'gif' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'png') {
                echo '<li class="' . $extension . '"><a class="close" href="#" onclick="d(\'' . $id . '\');">&nbsp;</a><a href="index.php?f=' . $id . '" ><img src="" style="background:url(' . auto_thumb($fichier, 64, 64) . ');"/></a><em>' . $taille . ' ko</em><em>' . $nom . '</em></li>';
            } else {
                echo '<li class="' . $extension . '"><a class="close" href="#" onclick="d(\'' . $id . '\');">&nbsp;</a><a href="index.php?f=' . $id . '"><img class="' . $extension . '" src=""/></a><em>' . $taille . ' ko</em><em>' . $nom . '</em></li>';
            }
        }
    }
    if ($save) {
        store(ID_FILE, $ids);
    }
    // save in case of new files
} else {
    e('No file on the server');
}
?>

<script>
Beispiel #5
0
 if ($location == count(explode('/', $path)) - 1) {
     // nom du fichier
     $name = basename($path);
     // id
     $idfile = file2id($path);
     // lien du fichier
     $link = 'index.php?f=' . $idfile;
     if (is_dir($path)) {
         $type = 'folder';
         $arg = '';
     }
     if (is_file($path)) {
         $type = 'file';
         $size = sizeconvert(filesize($path));
         if (is_image($path)) {
             auto_thumb($path, 64, 64);
             $thumb = $link . '&amp;image=thumbs';
         }
         $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
         $arg = arg($ext);
         switch ($ext) {
             case 'gif':
             case 'jpg':
             case 'jpeg':
             case 'png':
                 $lightbox = ' data-lightbox="' . $idfile . '" data-title=" "';
                 break;
             default:
                 $lightbox = '';
                 break;
         }
Beispiel #6
0
function draw_tree($tree = null)
{
    if (!$tree) {
        return false;
    }
    $first = array_keys($tree);
    $second = $first[1];
    $first = $first[0];
    $image_only = only_type($tree, '.jpg .jpeg .gif .png');
    $sound_only = only_type($tree, '.mp3 .ogg');
    if (!$image_only && !$sound_only) {
        # file list tree
        echo '<section class="tree">';
        $tree = array_map(function ($i) {
            return $i . '/';
        }, $tree);
        natcasesort($tree);
        echo '<h1>' . _basename(rtrim($tree[$first], '/\\')) . '</h1>';
        unset($tree[$first]);
        if (empty($tree)) {
            return false;
        }
        $previous_branch = explode('/', $tree[$second]);
        $previous_level = $current_level = count($previous_branch);
        foreach ($tree as $id => $branch) {
            if (!is_dir($branch)) {
                $branch = rtrim($branch, '/\\');
            }
            $current_branch = explode('/', $branch);
            $current_level = count($current_branch);
            if (is_dir($branch) && $previous_level == $current_level) {
                echo '</ul>';
            }
            if ($current_level < $previous_level) {
                $nb = count_back($previous_branch, $current_branch);
                echo str_repeat('</ul>', $nb);
            }
            if (is_dir($branch)) {
                echo '<li class="folder"><span class="icon-folder-1"></span> ' . _basename(rtrim($branch, '/\\')) . '</li>';
                echo '<ul class="folder_content">';
            } elseif (is_file($branch)) {
                $extension = strtolower(pathinfo($branch, PATHINFO_EXTENSION));
                echo '<li><a href="index.php?f=' . $id . '"><span class="icon-file ' . $extension . '"><em>' . $extension . '</em></span> ' . _basename($branch) . '</a></li>';
            }
            $previous_level = $current_level;
            $previous_branch = $current_branch;
        }
        echo '</ul>';
        echo '</section>';
    } elseif ($image_only) {
        # image gallery
        if (!function_exists('auto_thumb')) {
            include 'core/auto_thumb.php';
        }
        global $gallery_thumbs_width;
        $title = explode('/', $tree[$first]);
        $title = $title[count($title) - 1];
        unset($tree[$first]);
        echo '<link rel="stylesheet" type="text/css" href="' . THEME_PATH . '/css/gallery.css">';
        echo '<section><ul class="gallery"><h1>' . $title . '</h1>';
        foreach ($tree as $id => $image) {
            if (is_file($image)) {
                $link = 'index.php?f=' . $id;
                $file = _basename($image);
                $filesize = sizeconvert(filesize($image));
                $ext = strtolower(pathinfo($image, PATHINFO_EXTENSION));
                if ($ext != 'mp4') {
                    $size = getimagesize($image);
                    $size = $size[0] . 'x' . $size[1];
                    auto_thumb($image, $width = $gallery_thumbs_width, $height = $gallery_thumbs_width, $add_to_thumb_filename = '_THUMBGALLERY_', $crop_image = true);
                    echo '<a class="image" data-type="img" data-group="gallery" href="' . $link . '" ><img class="b-lazy" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="' . $link . '&gthumbs" alt="' . $file . '"/><span class="info"><em>' . $file . '</em> ' . $size . ' ' . $filesize . '</span></a>';
                } else {
                    $size = sizeconvert(filesize($image));
                    echo '<a class="image video" data-type="" data-group="gallery" href="' . $link . '" ><img class="blank b-lazy" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="  data-src="' . THEME_PATH . 'img/video.png"/><span class="info"><em>' . $file . '</em>' . $size . '</span></a>';
                }
            }
        }
        echo '</ul></section>';
        echo '
			<script src="core/js/blazy.js"></script>
		    <script>
		        ;(function() {
		            // Initialize
		            var bLazy = new Blazy();
		        })();
		    </script>';
    } elseif ($sound_only) {
        # music player
        $title = explode('/', $tree[$first]);
        $title = $title[count($title) - 1];
        unset($tree[$first]);
        echo '<section class="music_player"><h1>' . $title . '</h1>';
        echo '<table><tr>';
        echo '<td><audio preload autoplay></audio></td>';
        echo '<td id="volume">';
        $mult = 3;
        for ($vol = 1; $vol < 11; $vol++) {
            if ($vol < 10) {
                echo '<span class="volume" data-volume="0.' . $vol . '" style="background-position:center ' . (30 - $vol * $mult) . 'px">&nbsp;</span>';
            } else {
                echo '<span class="volume active"data-volume="1"  style="background-position:center ' . (30 - $vol * $mult) . 'px">&nbsp;</span>';
            }
        }
        echo '</td></tr></table>';
        foreach ($tree as $id => $sound) {
            if (is_file($image)) {
                $link = 'index.php?f=' . $id;
                $file = _basename($sound);
                $ext = strtolower(pathinfo($sound, PATHINFO_EXTENSION));
                $size = sizeconvert(filesize($sound));
                echo '<a class="sound" onclick="play(this);" href="#" data-src="' . $link . '" ><em>' . $file . '</em> ' . $size . '</a>';
            }
        }
        echo '</section>';
        echo '
				<script src="core/js/audio.js"></script>
				<script src="core/js/playlist.js"></script>';
    }
}
Beispiel #7
0
 if (is_dir($fichier)) {
     // le lien s'ouvre-t-il dans un nouvel onglet
     $target = '';
     if ($share_in_new_tab == true) {
         $target = ' target="_blank"';
     }
     $icone_visu = '<a class="visu" href="index.php?f=' . $id . '" title="' . e('View this folder', false) . '"' . $target . '>&nbsp;</a>';
     // l'élément est un dossier
     $taille = count(glob($fichier . '/'));
     $array = ['#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short)];
     $folderlist .= template($mode . '_folder_' . $layout, $array);
 } elseif ($extension == 'gif' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'png') {
     // l'élément est une image
     if (is_image($fichier)) {
         auto_thumb($fichier, 64, 64);
         auto_thumb($fichier, $image_max_width, $image_max_height, $add_to_thumb_filename = '_WEB_', $crop_image = false);
         $thumbs = 'index.php?f=' . $id . '&amp;image=thumbs';
     } else {
         $thumbs = THEME_PATH . 'img/ghost.png';
     }
     $array = ['#CLASS' => $class, '#ID' => $id, '#THUMBS' => $thumbs, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short)];
     $filelist .= template($mode . '_image_' . $layout, $array);
 } elseif ($extension == 'zip') {
     // l'élément est un fichier zip => ajouter l'option "convertir en dossier"
     $icone_visu = '<a class="tofolder" href="index.php?p=admin&unzip=' . $id . '&amp;token=' . returnToken() . '" title="' . e('Convert this zip file to folder', false) . '">&nbsp;</a>';
     $array = ['#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short)];
     $filelist .= template($mode . '_file_' . $layout, $array);
 } else {
     // tout les autres types de fichier
     $array = ['#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => returnToken(), '#SIZE' => $taille, '#NAME' => $nom, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short)];
     $filelist .= template($mode . '_file_' . $layout, $array);