Esempio n. 1
0
/**
 * Affiche la liste des fichiers sur index.php
 * @param $treestructure L'array contenant la hiérarchie de fichiers
 * @param $filter Le filtre à utiliser (all ou video)
 * @param $editmode Prendre en compte l'editmode dans l'affichage
 * @param $father Un paramètre récursif qui permet de connaître le(s) parent(s) d'un dossier
 */
function print_tree_structure($treestructure, $editmode = FALSE, $father = "")
{
    global $lang;
    if (empty($treestructure)) {
        echo '<div style="margin-bottom:5px;" class="onefile" id="div-' . htmlspecialchars($file) . '">';
        echo $lang[LOCAL_LANG]['empty_dir'];
        echo '</div>';
        return;
    }
    foreach ($treestructure as $key => $file) {
        // Si on est sur un dossier
        if (is_array($file)) {
            $fullkey = $key;
            $key = addslashes(basename($key));
            echo '<div class="onedir">';
            if ($editmode) {
                echo '<input name="Files[]" id="Files" type="checkbox" value="' . $father . htmlspecialchars($key) . '" onclick="CheckLikes(this);" />';
            }
            echo '
      	  <img src="ressources/' . showLastAddFolder($fullkey) . '" class="pointerLink imgfolder" onclick="showhidedir(\'' . $key . '\'); return false;" />
          <span class="pointerLink" onclick="showhidedir(\'' . $key . '\'); return false;">' . stripslashes($key) . '</span></div>
          <div id="' . stripslashes($key) . '" class="dirInList" style="display:none;">
          ';
            print_tree_structure($file, $editmode, $father . htmlspecialchars($key) . "/");
            echo '</div>';
        } else {
            $pathInfo = pathinfo($file);
            echo '<div style="margin-bottom:5px;" class="onefile" id="div-' . htmlspecialchars($file) . '">';
            // La checkbox de l'editmode
            if ($editmode) {
                echo '<input name="Files[]" id="Files" type="checkbox" value="' . htmlspecialchars($file) . '"/>';
            }
            // Affichage des images à gauche du titre (Direct Download + Watch)
            echo '<a href="' . DOWNLOAD_LINK . $file . '" download="' . $pathInfo['basename'] . '">';
            echo '<img src="ressources/download.png" title="Download this file" /> &nbsp;';
            echo '</a>';
            echo '<a href="watch.php?file=' . urlencode($file) . '">';
            echo '<img src="' . get_file_icon($file) . '" title="Stream or download this file" /> &nbsp;';
            echo '</a>';
            showLastAdd($file);
            if (SEEN_MODE_ENABLE && file_exists("data/" . $pathInfo['basename'])) {
                // Affichage du titre (soulignement si marqué comme vu)
                echo SEEN_SPAN;
                echo basename(htmlspecialchars($file));
                echo '</span>';
            } else {
                echo basename(htmlspecialchars($file));
            }
            // Création de l'infobulle
            echo '<a href="#" class="tooltip">&nbsp;(?)
      		<span>
              ' . $lang[LOCAL_LANG]['size'] . ' : ' . getFilesize($file) . '<br/>
              ' . $lang[LOCAL_LANG]['last_update'] . ' : ' . date("d F Y, H:i", filemtime($file)) . '<br/>
              ' . $lang[LOCAL_LANG]['last_access'] . ' : ' . date("d F Y, H:i", fileatime($file)) . '<br/>
            </span>
            </a>';
            echo '</div>';
        }
    }
}
Esempio n. 2
0
// Open form for editmode
if ($editmode) {
    ?>
				<form name="editform" action="index.php?editmode" method="post">
			<?php 
}
?>
			
			
			<!-- Local files -->
			<div id="local">
				<?php 
$listof_dir = array();
// Filled by recursive_directory_tree as a global var (for list of dir in editmode)
$tree_structure = recursive_directory_tree(LOCAL_DL_PATH);
print_tree_structure($tree_structure, $editmode);
?>
			</div>
			<!-- / Local files -->
			
			<?php 
// Show the editbox
if ($editmode) {
    ?>
			<div class="editbox">
			
				<!-- Create dir form-->
				<p>
					<?php 
    echo $lang[LOCAL_LANG]['create_new_dir'];
    ?>