summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-08-11 19:02:27 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-08-11 19:02:27 +0200
commit94570aaf5a23dfc02bf1120d168ec30c2ab3f044 (patch)
tree7349e8c938792d7cf26515f9fa237f2685f95085
parentbc71a577fe3154080df9949b394c7ae552773c7b (diff)
Improve system import/export
Miss checking presence of zip extension during import See https://github.com/marienfressinaud/FreshRSS/issues/494
-rw-r--r--app/Controllers/importExportController.php10
-rw-r--r--app/i18n/en.php2
-rw-r--r--app/i18n/fr.php2
-rw-r--r--app/views/importExport/index.phtml4
4 files changed, 16 insertions, 2 deletions
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 2b3353d93..dd6c23322 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -39,7 +39,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
// We try to list all files according to their type
// A zip file is first opened and then its files are listed
$list = array();
- if ($type_file === 'zip') {
+ if ($type_file === 'zip' && extension_loaded('zip')) {
$zip = zip_open($file['tmp_name']);
while (($zipfile = zip_read($zip)) !== false) {
@@ -56,6 +56,14 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
}
zip_close($zip);
+ } elseif ($type_file === 'zip') {
+ // Zip extension is not loaded
+ Minz_Session::_param('notification', array(
+ 'type' => 'bad',
+ 'content' => _t('no_zip_extension')
+ ));
+
+ Minz_Request::forward(array('c' => 'importExport'), true);
} elseif ($type_file !== 'unknown') {
$list_files[$type_file][] = file_get_contents(
$file['tmp_name']
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 748d9a81b..0c87f52be 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -182,7 +182,9 @@ return array (
'focus_search' => 'Access search box',
'file_to_import' => 'File to import<br />(OPML, Json or Zip)',
+ 'file_to_import_no_zip' => 'File to import<br />(OPML or Json)',
'import' => 'Import',
+ 'no_zip_extension' => 'Zip extension is not present on your server.',
'export' => 'Export',
'export_opml' => 'Export list of feeds (OPML)',
'export_starred' => 'Export your favourites',
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index ba8c8686a..57ddebc20 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -182,7 +182,9 @@ return array (
'focus_search' => 'Accéder à la recherche',
'file_to_import' => 'Fichier à importer<br />(OPML, Json ou Zip)',
+ 'file_to_import_no_zip' => 'Fichier à importer<br />(OPML ou Json)',
'import' => 'Importer',
+ 'no_zip_extension' => 'L’extension Zip n’est pas présente sur votre serveur.',
'export' => 'Exporter',
'export_opml' => 'Exporter la liste des flux (OPML)',
'export_starred' => 'Exporter les favoris',
diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml
index e1458e916..35371faca 100644
--- a/app/views/importExport/index.phtml
+++ b/app/views/importExport/index.phtml
@@ -6,7 +6,9 @@
<form method="post" action="<?php echo _url('importExport', 'import'); ?>" enctype="multipart/form-data">
<legend><?php echo _t('import'); ?></legend>
<div class="form-group">
- <label class="group-name" for="file"><?php echo _t('file_to_import'); ?></label>
+ <label class="group-name" for="file">
+ <?php echo extension_loaded('zip') ? _t('file_to_import') : _t('file_to_import_no_zip'); ?>
+ </label>
<div class="group-controls">
<input type="file" name="file" id="file" />
</div>