From 07127621e1afedbf9e2d5ee6dbcf135935dd0df6 Mon Sep 17 00:00:00 2001 From: Tohir Solomons Date: Wed, 13 Jan 2010 15:49:02 +0200 Subject: [PATCH] Fixes to cater for downloading multiple folders at a time --- webservice/clienttools/services/0.9/kt.php | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/webservice/clienttools/services/0.9/kt.php b/webservice/clienttools/services/0.9/kt.php index 1c92754..4b8b5fb 100644 --- a/webservice/clienttools/services/0.9/kt.php +++ b/webservice/clienttools/services/0.9/kt.php @@ -1222,29 +1222,44 @@ Fatal error: Cannot unset string offsets in on line 981 function get_all_files($arr) { $kt=&$this->KT; - - $folderId = str_replace('F_', '', $arr['folderid']); - $folder=&$kt->get_folder_by_id($folderId); - if (PEAR::isError($folder)){ - $this->setResponse('error 1'); - return false; - } + $folders = array(); - // Note 50 is set here as the level depth, inaccurate - $listing = $folder->get_listing(50, 'DF'); //DF - - if ($folderId == '1') { - $path = 'KnowledgeTree'; + if (is_array($arr['folderid'])) { + foreach ($arr['folderid'] as $folder) + { + $folders[] = str_replace('F_', '', $folder); + } } else { - $path = $folder->get_folder_name(); + $folders[] = str_replace('F_', '', $arr['folderid']); } $this->listOfFiles = array(); $this->listOfFoldersToBeCreated = array(); - $this->addFolderToList($listing, $path); + + foreach ($folders as $folderId) + { + $folder=&$kt->get_folder_by_id($folderId); + if (PEAR::isError($folder)){ + $this->setResponse('error 1'); + return false; + } + + // Note 50 is set here as the level depth, inaccurate + $listing = $folder->get_listing(50, 'DF'); //DF + + if ($folderId == '1') { + $path = 'KnowledgeTree'; + } else { + $path = $folder->get_folder_name(); + } + + $this->addFolderToList($listing, $path); + + } + // Sort Array by list of folders to be created in right order sort($this->listOfFoldersToBeCreated); -- libgit2 0.21.4