function fm_mkalllocal($files)
{
    global $prepath;
    if (!count($files)) {
        return $files;
    }
    $dir = upOne($files[0]);
    $nfiles = array();
    foreach ($files as $i => $file) {
        if (upOne($file) != $dir) {
            if (!is_dir('cache/down/local')) {
                mkdir('cache/down/local');
            }
            foreach ($files as $i => $file) {
                @copy($prepath . $file, 'cache/down/local/' . basename($file));
                $files[$i] = 'cache/down/local/' . basename($file);
            }
            return $files;
        } else {
            $nfiles[$i] = $prepath . $file;
        }
    }
    return $nfiles;
}
Beispiel #2
0
        </td></tr>
        <tr><td valign="top">
          Permissions:
        </td><td valign="top">
          <input type="text" class="textbox" name="perms" id="perms" value="<?php 
                                                    echo $fileinfo['perms'];
                                                    ?>
" onchange="chg(0)" onfocus="chg(1)" onblur="chg(0)" />
        </td></tr>
      </table><div id="btnbar" style="border-top: 1px solid #BBBBBB; padding:12px 12px 0 12px; margin: 12px -12px 0 -12px;">
        <input type="hidden" name="act" id="act" value="chmod" />
        <input type="submit" value="Save" />
      </div></form>
    </div></div>
    <div style="margin:20px"><input type="button" style="font-size: 14pt;" id="na" name="na" value="&laquo; Back to folder" onclick="parent.location.href = 'index.php?d=<?php 
                                                    echo $presub, upOne($postsub . $file, $presub), $hasid;
                                                    ?>
';" /></div>
    <script language="javascript" type="text/javascript">
    <!--
      var cperms = '<?php 
                                                    echo $fileinfo['perms'];
                                                    ?>
';
      function chg(f)
      {
        var laquo = document.getElementById('na').value.substr(0,1);
        if (document.getElementById('perms').value == cperms && !f)
        {
          document.getElementById('btnbar').style.display = 'none';
          document.getElementById('na').value = laquo+' Back to folder';
function fm_compresszip($files, $dest = FALSE, $overwrite = FALSE)
{
    if (file_exists($dest) && !$overwrite || !count($files)) {
        return FALSE;
    } else {
        fm_delete($dest);
    }
    @unlink('cache/up/temp.zip');
    $lfiles = fm_mkalllocal($files);
    $archive = new PclZip('cache/up/temp.zip');
    $archive->create($lfiles, PCLZIP_OPT_REMOVE_PATH, upOne($lfiles[0]));
    fm_recachedir('down/local/');
    $res = fm_upload('temp.zip', $dest, $overwrite);
    @unlink('cache/up/temp.zip');
    return $res;
}
function fm_isdir($path)
{
    if (!$path) {
        return true;
    }
    $cfiles = fm_fastgetfiles(upOne($ftp_prepath . $path));
    return in_array(basename($path) . '/', $cfiles);
}