function fm_extractzip($file, $dest = FALSE, $overwrite = FALSE) { if (!$GLOBALS['ext_pclzip']) { return false; } $archive = new PclZip(fm_mklocal($file)); if (is_dir('cache/up/extracted/')) { fm_clearcache('up/extracted/'); } @mkdir('cache/up/extracted/'); $res = $archive->extract(PCLZIP_OPT_PATH, 'cache/up/extracted/'); if ($res == 0) { return FALSE; } $res = fm_upload('extracted/', $dest, $overwrite); fm_clearcache('up/extracted/'); return $res; }
function fm_contents($file, $newline = false) { $lfile = fm_mklocal($file); $res = file_get_contents($lfile); @unlink($lfile); if ($newline) { $res = str_replace("\n", $newline, str_replace("\r", "", $res)); } return $res; }