From eeffd207bea809c5ee1e48129cda17f2986e078a Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 28 Jul 2012 13:20:02 +0100 Subject: [PATCH] docRoot being passed in, delimiting on asterisk Recently started using $docRoot in place of the $_SERVER version but this var isn't available within the class. Now being passed in so it can be used. Also now exploding the exclude list on asterisk rather than comma to avoid problems elsewhere. --- plugins/zip-it/index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/zip-it/index.php b/plugins/zip-it/index.php index dc0df7c..a2d8c02 100644 --- a/plugins/zip-it/index.php +++ b/plugins/zip-it/index.php @@ -20,12 +20,13 @@ $keepLastDays = 7; if (!is_dir($zipItSaveLocation)) {mkdir($zipItSaveLocation, 0777);} Class zipIt { - public function zipFilesUp($zipDir,$zipFile,$keepLastDays) { + public function zipFilesUp($zipDir,$zipFile,$keepLastDays,$docRoot) { $zipName = $zipDir.$zipFile; $zipFiles = array(); $_GET['zip']=="|" ? $zipTgt = "" : $zipTgt = str_replace("|","/",strClean($_GET['zip'])); if (strpos($_GET['zip'],"/")!==0) {$zipTgt = "/".$zipTgt;}; $addItem = $docRoot.$zipTgt; + if (is_dir($addItem)) { $dirStack = array($addItem); while (!empty($dirStack)) { @@ -57,7 +58,7 @@ Class zipIt { if(count($zipFiles)) { $zip = new ZipArchive(); if($zip->open($zipName,ZIPARCHIVE::CREATE)!== true) {return false;} - $excludeFilesFolders = explode(",",strClean($_GET['exclude'])); + $excludeFilesFolders = explode("*",strClean($_GET['exclude'])); foreach($zipFiles as $file) { $canAdd=true; for ($i=0;$itop.ICEcoder.serverMessage("Zipping Files");'; - $zipItAddToZip = $zipItDoZip->zipFilesUp($zipItSaveLocation,$zipItFileName,$keepLastDays); + $zipItAddToZip = $zipItDoZip->zipFilesUp($zipItSaveLocation,$zipItFileName,$keepLastDays,$docRoot); if (!$zipItAddToZip) { echo ''; } else {