aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/configureController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-16 19:34:04 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-16 19:34:04 +0100
commitdbdda1d0c19b48d06b30879e8fe78679f79cc0c4 (patch)
tree28cca8318b5887f74d1b42a9631e806c2455e7f4 /app/Controllers/configureController.php
parent7bbd6133af93238dce759016df7f661a7cfbffed (diff)
Move import/export operations into an independant class
- import and export are now two methods of importExportController - "opml" has been removed from the title
Diffstat (limited to 'app/Controllers/configureController.php')
-rwxr-xr-xapp/Controllers/configureController.php65
1 files changed, 0 insertions, 65 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index 41a7920f0..bd0d0a185 100755
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -210,71 +210,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
Minz_View::prependTitle (Minz_Translate::t ('sharing') . ' · ');
}
- public function importExportAction () {
- require_once(LIB_PATH . '/lib_opml.php');
- $catDAO = new FreshRSS_CategoryDAO ();
- $this->view->categories = $catDAO->listCategories ();
-
- $this->view->req = Minz_Request::param ('q');
-
- if ($this->view->req == 'export') {
- Minz_View::_title ('freshrss_feeds.opml');
-
- $this->view->_useLayout (false);
- header('Content-Type: application/xml; charset=utf-8');
- header('Content-disposition: attachment; filename=freshrss_feeds.opml');
-
- $feedDAO = new FreshRSS_FeedDAO ();
- $catDAO = new FreshRSS_CategoryDAO ();
-
- $list = array ();
- foreach ($catDAO->listCategories () as $key => $cat) {
- $list[$key]['name'] = $cat->name ();
- $list[$key]['feeds'] = $feedDAO->listByCategory ($cat->id ());
- }
-
- $this->view->categories = $list;
- } elseif ($this->view->req == 'import' && Minz_Request::isPost ()) {
- if ($_FILES['file']['error'] == 0) {
- invalidateHttpCache();
- // on parse le fichier OPML pour récupérer les catégories et les flux associés
- try {
- list ($categories, $feeds) = opml_import (
- file_get_contents ($_FILES['file']['tmp_name'])
- );
-
- // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD
- // les flux sont mis au préalable dans des variables de Request
- Minz_Request::_param ('q', 'null');
- Minz_Request::_param ('categories', $categories);
- Minz_Request::_param ('feeds', $feeds);
- Minz_Request::forward (array ('c' => 'feed', 'a' => 'massiveImport'));
- } catch (FreshRSS_Opml_Exception $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
-
- $notif = array (
- 'type' => 'bad',
- 'content' => Minz_Translate::t ('bad_opml_file')
- );
- Minz_Session::_param ('notification', $notif);
-
- Minz_Request::forward (array (
- 'c' => 'configure',
- 'a' => 'importExport'
- ), true);
- }
- }
- }
-
- $feedDAO = new FreshRSS_FeedDAO ();
- $this->view->feeds = $feedDAO->listFeeds ();
-
- // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste
- $this->view->flux = false;
-
- Minz_View::prependTitle (Minz_Translate::t ('import_export_opml') . ' · ');
- }
-
public function shortcutAction () {
$list_keys = array ('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter',
'escape', 'f', 'g', 'h', 'home', 'i', 'insert', 'j', 'k', 'l', 'left',