aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-11-23 09:47:10 +0100
committerMario Vavti <mario@mariovavti.com>2016-11-23 09:47:10 +0100
commit69e1f6e4ba9b3f33ab9b93541fdd68d0f5d6d01a (patch)
tree4ab8bf8e4c3e2612fa853975d69541ba4cf9638f
parent2fce010f305a8c86581a51445529267e0bac11ad (diff)
downloadvolse-hubzilla-69e1f6e4ba9b3f33ab9b93541fdd68d0f5d6d01a.tar.gz
volse-hubzilla-69e1f6e4ba9b3f33ab9b93541fdd68d0f5d6d01a.tar.bz2
volse-hubzilla-69e1f6e4ba9b3f33ab9b93541fdd68d0f5d6d01a.zip
whitespace and coding style
-rw-r--r--Zotlabs/Module/Wiki.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index ed9f7ad06..53c267a93 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -95,30 +95,39 @@ class Wiki extends \Zotlabs\Web\Controller {
$o = profile_tabs($a, $is_owner, \App::$profile['channel_address']);
// 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);
+
$w = wiki_get_wiki($resource_id);
- if (!$w['path']) {
- notice(t('Error retrieving wiki') . EOL);
+ if(!$w['path']) {
+ notice(t('Error retrieving wiki') . EOL);
}
+
$zip_folder_name = random_string(10);
$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);
notice(t('Error creating zip file export folder') . EOL);
}
+
$zip_filename = $w['urlName'];
$zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename;
+
// Generate the zip file
\Zotlabs\Lib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE);
+
// Output the file for download
header('Content-disposition: attachment; filename="' . $zip_filename . '.zip"');
header("Content-Type: application/zip");
+
$success = readfile($zip_filepath);
- if ($success) {
- rrmdir($zip_folderpath); // delete temporary files
- } else {
- rrmdir($zip_folderpath); // delete temporary files
+
+ if($success) {
+ rrmdir($zip_folderpath); // delete temporary files
+ }
+ else {
+ rrmdir($zip_folderpath); // delete temporary files
logger('Error downloading wiki: ' . $resource_id);
}
}