whitespace cleanup

This commit is contained in:
Mario Vavti 2016-11-23 09:41:10 +01:00
parent 5ba8749a38
commit 2fce010f30

View File

@ -96,31 +96,31 @@ class Wiki extends \Zotlabs\Web\Controller {
// Download a wiki // Download a wiki
if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) { if ((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) {
$resource_id = argv(4); $resource_id = argv(4);
$w = wiki_get_wiki($resource_id); $w = wiki_get_wiki($resource_id);
if (!$w['path']) { if (!$w['path']) {
notice(t('Error retrieving wiki') . EOL); notice(t('Error retrieving wiki') . EOL);
} }
$zip_folder_name = random_string(10); $zip_folder_name = random_string(10);
$zip_folderpath = '/tmp/' . $zip_folder_name; $zip_folderpath = '/tmp/' . $zip_folder_name;
if (!mkdir($zip_folderpath, 0770, false)) { if (!mkdir($zip_folderpath, 0770, false)) {
logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL); logger('Error creating zip file export folder: ' . $zip_folderpath, LOGGER_NORMAL);
notice(t('Error creating zip file export folder') . EOL); notice(t('Error creating zip file export folder') . EOL);
} }
$zip_filename = $w['urlName']; $zip_filename = $w['urlName'];
$zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename; $zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename;
// Generate the zip file // Generate the zip file
\Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE); \Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE);
// Output the file for download // Output the file for download
header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"'); header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"');
header("Content-Type: application/zip"); header("Content-Type: application/zip");
$success = readfile($zip_filepath); $success = readfile($zip_filepath);
if ($success) { if ($success) {
rrmdir($zip_folderpath); // delete temporary files rrmdir($zip_folderpath); // delete temporary files
} else { } else {
rrmdir($zip_folderpath); // delete temporary files rrmdir($zip_folderpath); // delete temporary files
logger('Error downloading wiki: ' . $resource_id); logger('Error downloading wiki: ' . $resource_id);
} }
} }
switch (argc()) { switch (argc()) {