Esempio n. 1
0
 function getFilePackage($fileids, $returnContent = false)
 {
     $fileids = explode(",", $fileids);
     include_once "createZip.inc.php";
     $createZip = new createZip();
     $fileCount = 0;
     foreach ($fileids as $fileid) {
         if (file_exists($this->rootPath . $fileid)) {
             $createZip->addFile(file_get_contents($this->rootPath . $fileid), basename($fileid));
             $fileCount++;
         }
     }
     if ($fileCount > 0) {
         if ($returnContent != true) {
             header("Content-Type: application/zip");
             header("Content-Transfer-Encoding: Binary");
             #header("Content-length: ".strlen($zipped));
             header("Content-disposition: attachment; filename=\"package.zip\"");
             echo $createZip->getZippedfile();
         } else {
             return $createZip->getZippedfile();
         }
     } else {
         $this->error('no files zipped');
     }
 }
Esempio n. 2
0
function getFilePackage($paths, $returnContent = false)
{
    // paths will look like:
    // "/filestore~kristinaRose.jpeg,/filestore/pics~harmonyRose.jpeg"
    logAction('getFilePackage', $paths);
    $paths = explode("\\\\,", $paths);
    $files = array();
    $fileCount = 0;
    include_once "inc/createZip.inc.php";
    $createZip = new createZip();
    foreach ($paths as $path) {
        $i = preg_split("/\\~/", $path);
        $files[] = array("path" => $i[0], "filename" => $i[1]);
    }
    foreach ($files as $file) {
        $filePath = $file['path'] . '/' . $file['filename'];
        if (file_exists($filePath)) {
            $createZip->addFile(file_get_contents($filePath), $file['filename']);
            $fileCount++;
        }
    }
    if ($fileCount > 0) {
        if ($returnContent != true) {
            header("Content-Type: application/zip");
            header("Content-Transfer-Encoding: Binary");
            header("Content-disposition: attachment; filename=\"package.zip\"");
            echo $createZip->getZippedfile();
        } else {
            return $createZip->getZippedfile();
        }
    } else {
        error('No files zipped.');
    }
}
function tfu_zip_download($files, $enable_file_download)
{
    global $zip_folder;
    // The folder is used to create the temp download files!
    if ($enable_file_download == 'false' && !isset($_GET['fullscreen'])) {
        echo 'This action is not enabled!';
        exit(0);
    }
    $createZip = new createZip();
    $nrfiles = count($files);
    for ($i = 0; $i < $nrfiles; $i++) {
        $createZip->addFile(file_get_contents($files[$i]), my_basename($files[$i]));
    }
    $fileName = $zip_folder . '/' . $_GET['zipname'];
    $fd = fopen($fileName, "wb");
    $out = fwrite($fd, $createZip->getZippedfile());
    fclose($fd);
    tfu_download($fileName, $enable_file_download);
    @unlink($fileName);
}
Esempio n. 4
0
                if (is_dir($file)) {
                    $createZip->addDirectory($basename . "/" . $zipPath);
                } else {
                    $fileContents = file_get_contents($file);
                    $createZip->addFile($fileContents, $basename . "/" . $zipPath);
                }
            }
        }
    }
}
if (isset($configBackupDB) && is_array($configBackupDB) && count($configBackupDB) > 0) {
    foreach ($configBackupDB as $db) {
        $backup = new MySQL_Backup();
        $backup->server = $db['server'];
        $backup->username = $db['username'];
        $backup->password = $db['password'];
        $backup->database = $db['database'];
        #$backup->tables   = $db['tables'];
        $backup->backup_dir = $configBackupDir;
        $sqldump = $backup->Execute(MSB_STRING, "", false);
        $createZip->addFile($sqldump, $db['database'] . '-' . date('d-m-y') . '-' . date('H-i-s') . '.sql');
    }
}
$fileName = $configBackupDir . $backupName;
$fd = fopen($fileName, "wb");
$out = fwrite($fd, $createZip->getZippedfile());
fclose($fd);
// Dump done now lets email the user
if (isset($configEmail) && !empty($configEmail)) {
    mailAttachment($fileName, $configEmail, '*****@*****.**', 'Backup Script', '*****@*****.**', 'Backup - ' . $backupName, "Backup file is attached");
}
Esempio n. 5
0
function getFilePackage($fileids, $returnContent = false)
{
    global $database, $fileinfo, $filepath;
    $fileids = preg_split("/\\,/", $fileids);
    include_once "inc/createZip.inc.php";
    $createZip = new createZip();
    $fileCount = 0;
    logAction('getFilePackage', $fileids);
    foreach ($fileids as $fileid) {
        if (getFileInfo($fileid)) {
            if (getUserAuth('download', $fileinfo['virtualpath'])) {
                logAction('get', $fileid);
                $query = "update {$GLOBALS['tablePrefix']}filesystem set downloads=downloads+1 where id={$fileid}";
                $result = mysql_query($query, $database);
                $createZip->addFile(file_get_contents($filepath), "{$fileinfo['filename']}");
                $fileCount++;
            } else {
                // denied
            }
        } else {
            // denied
        }
    }
    if ($fileCount > 0) {
        if ($returnContent != true) {
            header("Content-Type: application/zip");
            header("Content-Transfer-Encoding: Binary");
            #header("Content-length: ".strlen($zipped));
            header("Content-disposition: attachment; filename=\"package.zip\"");
            echo $createZip->getZippedfile();
        } else {
            return $createZip->getZippedfile();
        }
    } else {
        error('no files zipped');
    }
}
    copy('include/index.html', 'archives/index.html');
}
$zip = new createZip();
$zip->addDirectory("images/");
if ($dh = opendir('offline')) {
    while (($file = readdir($dh)) !== false) {
        if (is_file('offline/' . $file)) {
            $fileContents = file_get_contents('offline/' . $file);
            $zip->addFile($fileContents, $file);
        }
    }
    closedir($dh);
}
if ($dh = opendir('offline/images')) {
    while (($file = readdir($dh)) !== false) {
        if (is_file('offline/images/' . $file)) {
            $fileContents = file_get_contents('offline/images/' . $file);
            $zip->addFile($fileContents, 'images/' . $file);
        }
    }
    closedir($dh);
}
$fileName = 'archives/pol-docs-099-' . $d . '.zip';
$fd = fopen($fileName, "wb");
$out = fwrite($fd, $zip->getZippedfile());
fclose($fd);
echo "Finished";
?>


Esempio n. 7
0
 public function home()
 {
     $dim = array(900, 600);
     $dim = array(800, 533);
     $dim = array(600, 400);
     if (_button()) {
         $v = $this->__(array('start' => 0, 'folder' => '', 'width' => 0, 'height' => 0));
         $images = $types = w();
         $dim = array($v['width'], $v['height']);
         @set_time_limit(0);
         $original = PCK . $v['folder'] . '/';
         $gallery = $original . 'gallery/';
         if (!@file_exists($original)) {
             exit;
         }
         if (!@file_exists($gallery)) {
             @mkdir($gallery, 0777);
             @chmod($gallery, 0777);
         }
         require_once XFS . XCOR . 'upload.php';
         require_once XFS . XCOR . 'zip.php';
         if (!is_writable($original) || !is_writable($gallery)) {
             exit;
         }
         $upload = new upload();
         $zip = new createZip();
         $fp = @opendir(PCK . $v['folder']);
         while ($row = @readdir($fp)) {
             if (preg_match('#^(.*?)\\.(jpg|JPG)$#is', $row, $s) && @is_readable($original . $row)) {
                 $images[] = $row;
                 $type = preg_match('#^(\\d+)$#is', $s[1]) ? 'numeric' : 'string';
                 $types[$type] = true;
             }
         }
         @closedir($fp);
         if (!count($images)) {
             exit('No hay archivos para convertir.');
         }
         $multisort = array(&$images, SORT_ASC);
         if (!isset($types['string'])) {
             $multisort[] = SORT_NUMERIC;
         }
         hook('array_multisort', $multisort);
         foreach ($images as $image) {
             $row = $upload->_row($gallery, $image);
             $xa = $upload->resize($row, $original, $gallery, $start, $dim, false, false, false, $original . $image);
             $start++;
             $zip->addFile(file_get_contents($gallery . $xa['filename']), $xa['filename']);
         }
         $zipfile = PCK . $folder . '.zip';
         $fd = @fopen($zipfile, 'wb');
         $out = @fwrite($fd, $zip->getZippedfile());
         @fclose($fd);
         $zip->forceDownload($zipfile);
         @unlink($zipfile);
         exit;
     }
     $options = w();
     $fp = @opendir(PCK);
     while ($file = @readdir($fp)) {
         if (substr($file, 0, 1) != '.' && is_dir(PCK . $file)) {
             $options[] = $file;
         }
     }
     @closedir($fp);
     foreach ($options as $row) {
         echo '<option value="' . $row . '">' . $row . '</option>';
     }
     return;
 }