Пример #1
0
                    $target = 'download="' . $nom . '"';
                }
                $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => TOKEN, '#SIZE' => sizeconvert(filesize($fichier)), '#NAME' => $nom, '#TARGET' => $target, '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
                $filelist .= template($mode . '_image_' . $layout, $array);
            } elseif (is_file($fichier) && $extension == 'zip' && $_SESSION['zip']) {
                # Item is a zip file=> add change to folder
                $icone_visu = '<a class="tofolder" href="index.php?p=admin&unzip=' . $id . '&token=' . TOKEN . '" title="' . e('Convert this zip file to folder', false) . '"><span class="icon-folder-1"></span></a>';
                $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => TOKEN, '#SIZE' => sizeconvert(filesize($fichier)), '#NAME' => $nom, '#TARGET' => 'download="' . $nom . '"', '#TITLE' => $title, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#ICONE_EDIT' => $icone_edit, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
                $filelist .= template($mode . '_file_' . $layout, $array);
            } elseif (is_file($fichier)) {
                chrono('fichier:' . $nom);
                # all other types
                if (empty($target)) {
                    $target = 'download="' . $nom . '"';
                }
                $array = array('#CLASS' => $class, '#ID' => $id, '#FICHIER' => $fichier_short, '#TOKEN' => TOKEN, '#SIZE' => sizeconvert(filesize($fichier)), '#NAME' => $nom, '#TITLE' => $title, '#TARGET' => $target, '#EXTENSION' => $extension, '#ICONE_VISU' => $icone_visu, '#ICONE_EDIT' => $icone_edit, '#SLASHEDNAME' => addslashes($nom), '#SLASHEDFICHIER' => addslashes($fichier_short));
                $filelist .= template($mode . '_file_' . $layout, $array);
                chrono('fichier:' . $nom);
            }
        }
    }
    if ($mode == 'view') {
        $column = '<td class="table_check"></td>';
        $column_header = '<th class="table_check sorttable_nosort"><input type="checkbox" id="check_all" title="' . e('Check all', false) . '"/></th>';
        $form_header = '<form id="multiselect" action="#" method="POST">
		<input type="hidden" name="token" value="' . TOKEN . '"/>
		<input type="hidden" name="multiselect_command" id="multiselect_command" value=""/>';
        $form_footer = '</form>';
    } else {
        $column = $form_header = $form_footer = $column_header = '';
    }
Пример #2
0
function folder_usage_draw($profile, $mode = 1)
{
    $folder = $_SESSION['upload_root_path'] . $profile;
    if (!is_dir($folder)) {
        return false;
    }
    if (empty($_SESSION['profile_folder_max_size'])) {
        return false;
    }
    if (is_admin()) {
        return false;
    }
    $free = folder_free($folder, 1);
    $user_size = $_SESSION['profile_folder_max_size'] * 1048576;
    $used = round($user_size - $free, 1);
    $usedpc = round($used * 100 / $user_size, 1);
    $freepc = round($free * 100 / $user_size, 1);
    if (empty($free)) {
        $free = 0;
    }
    if ($mode == 1) {
        echo '<div class="free_space_bar" ><span class="used" style="width:' . $usedpc . '%" title="' . $used . ' M">' . $usedpc . '%</span><span class="free" style="width:' . $freepc . '%;" title="' . $free . ' M">' . $freepc . '%</label>';
    }
    if ($mode == 2) {
        echo '<div class="free_space_icon btn" title="' . $freepc . '% ' . e('free', false) . ' (' . $free . ' MB)"><span class="free" style="height:' . $freepc * 32 / 100 . 'px"></span><span class="used" style="height:' . $usedpc * 32 / 100 . 'px"></span></label>';
    }
    if ($mode == 3) {
        echo '<div class="free_space_text">' . $freepc . '% ' . e('free', false) . ' (' . sizeconvert($free) . ')</label>';
    }
}
Пример #3
0
 $thumb = '';
 $lightbox = '';
 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 = '';
Пример #4
0
if (count($liste) > 0) {
    $files = array_flip($ids);
    $folderlist = '';
    $filelist = '';
    foreach ($liste as $fichier) {
        $nom = basename($fichier);
        $length_upload_path = strlen($_SESSION['upload_root_path'] . $_SESSION['upload_user_path']);
        $nom_racine = substr($fichier, $length_upload_path);
        if (empty($files[$fichier]) && empty($files[$nom_racine])) {
            // générer l'id du fichier si il n'est pas présent
            $id = uniqid(true);
            $ids[$id] = $fichier;
            $files[$fichier] = $id;
            $save = true;
        }
        $taille = sizeconvert(filesize($fichier));
        if (!empty($files[$fichier])) {
            $id = $files[$fichier];
        } else {
            $id = $files[$nom_racine];
        }
        $class = '';
        $title = '';
        if (substr($id, 0, 1) == '*') {
            // ajouter une class burn et un titre à l'élément
            $class = ' burn';
            $title = e('The user can access this item only one time', false);
        } elseif (strlen($id) > strlen(uniqid(true))) {
            // ajouter une class "bloqué" et un titre à l'élément
            $class = ' locked';
            $title = e('The user can access this item only with the password', false);