function completeID($array_of_files) { $ids = unstore(); $sdi = array_flip($ids); // paths are keys $save = false; $upload_path_size = strlen($_SESSION['upload_path']); foreach ($array_of_files as $file) { $file = substr($file, $upload_path_size); if (!isset($sdi[$file])) { $save = true; $ids[uniqid(true)] = $file; } } if ($save) { store($ids); echo '<script>location.reload();</script>'; } }
} imagecopyresampled($thumb, $src, 0, 0, $recadrageX, $recadrageY, $width, $height, $src_width, $src_height); imagepng($thumb, $thumb_name); imagedestroy($thumb); return $thumb_name; } if (empty($mask)) { $mask = '*'; } else { $mask = '*' . $mask . '*'; } $liste = glob(UPLOAD_PATH . $mask); if ($index = array_search('index.html', $liste)) { unset($liste[$index]); } $ids = unstore(ID_FILE); $save = false; 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));
function regen_tree($user = '', $ids = null, $path = null) { global $ids; if (!$ids) { $ids = unstore(); } if (empty($user)) { $user = $_SESSION['login']; } if (empty($path)) { $path = $_SESSION['upload_root_path'] . $user . '/'; /*if (!empty($user)){$path=$_SESSION['upload_root_path'].$user.'/';} elseif (!empty($_SESSION['upload_user_path'])){ $path=$_SESSION['upload_root_path'].$_SESSION['upload_user_path']; $user=$_SESSION['login']; }else{$path=$_SESSION['upload_root_path'];}*/ } $tree = array(); foreach ($ids as $id => $value) { if (strpos($value, $path) !== false) { $tree[$id] = $value; } } return $tree; }
$file_list[] = id2file($item); } if (!is_dir($_SESSION['temp_folder'])) { mkdir($_SESSION['temp_folder']); } zip($file_list, $zipfile); header('location: ' . $zipfile); exit; } # Lock folder with password if (!empty($_POST['pass']) && !empty($_POST['id']) && !empty($_POST['confirm']) && is_owner($_POST['id']) && $_POST['confirm'] == $_POST['pass']) { $id = $_POST['id']; $file = id2file($id); $password = blur_password($_POST['pass']); # turn normal share id into password hashed id $ids = unstore(); unset($ids[$id]); $ids[$password . $id] = $file; store($ids); header('location:index.php?p=admin&token=' . TOKEN); exit; } # Handle folder share with users if (!empty($_POST['share']) && is_owner($_POST['share'])) { $folder_id = $_POST['share']; $users = $auto_restrict['users']; unset($users[$_SESSION['login']]); $shared_with = load_folder_share(); $sent = array_flip($_POST['users']); foreach ($users as $login => $data) { if (isset($sent[$login])) {
function load() { global $config; return unstore($config['data_file']); }