Example #1
0
function kfm_zip($name, $files)
{
    include_once KFM_BASE_PATH . 'includes/files.php';
    return _zip($name, $files);
}
Example #2
0
function zip($filename)
{
    global $folder, $l, $config;
    if (!$filename == "") {
        // = path to zip
        $path_to_zip = $folder . $filename;
        // = destination file
        $zip_filename = $folder . $filename . '.zip';
        if (file_exists($zip_filename)) {
            $zip_filename = $folder . $filename . '.' . time() . '.zip';
        }
        // = zip it
        $res = _zip($path_to_zip, $zip_filename);
        if ($res === false) {
            $msg = $l['ZIP_MSG3'];
        } else {
            if (is_dir($path_to_zip)) {
                $msg = $l['ZIP_MSG2'];
            } else {
                $msg = $l['ZIP_MSG1'];
            }
        }
        // = render answer
        $config['msg'] = "<div class='breadcrumb'>" . str_replace(array('%1', '%2'), array("[ <span style='color:#c00;'>" . breadcrumb($folder) . " / " . $filename . "</span> ]", " <a href='" . $zip_filename . "' target='_blank'>" . str_replace($folder, '', $zip_filename) . "</a>"), $msg) . "</div>";
        home();
        return;
    }
}