aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Routing.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Routing.class.php')
-rwxr-xr-x[-rw-r--r--]inc/poche/Routing.class.php92
1 files changed, 40 insertions, 52 deletions
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index ec33432c..0b373058 100644..100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -98,62 +98,50 @@ class Routing
98 private function _launchAction() 98 private function _launchAction()
99 { 99 {
100 if (isset($_GET['login'])) { 100 if (isset($_GET['login'])) {
101 // hello you 101 // hello to you
102 $this->wallabag->login($this->referer); 102 $this->wallabag->login($this->referer);
103 } elseif (isset($_GET['logout'])) { 103 } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) {
104 // see you soon ! 104 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
105 $this->wallabag->logout(); 105 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']);
106 } elseif (isset($_GET['config'])) { 106 }
107 // update password 107
108 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); 108 //allowed ONLY to logged in user
109 } elseif (isset($_GET['newuser'])) { 109 if (\Session::isLogged() === true)
110 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); 110 {
111 } elseif (isset($_GET['deluser'])) { 111 if (isset($_GET['logout'])) {
112 $this->wallabag->deleteUser($_POST['password4deletinguser']); 112 // see you soon !
113 } elseif (isset($_GET['epub'])) { 113 $this->wallabag->logout();
114 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']); 114 } elseif (isset($_GET['config'])) {
115 $epub->prepareData(); 115 // update password
116 $epub->produceEpub(); 116 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
117 } elseif (isset($_GET['mobi'])) { 117 } elseif (isset($_GET['newuser'])) {
118 $mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']); 118 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']);
119 $mobi->prepareData(); 119 } elseif (isset($_GET['deluser'])) {
120 $mobi->produceMobi(); 120 $this->wallabag->deleteUser($_POST['password4deletinguser']);
121 } elseif (isset($_GET['send2kindle'])) { 121 } elseif (isset($_GET['epub'])) {
122 $mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']); 122 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['id'], $_GET['value']);
123 $mobi->prepareData(); 123 $epub->run();
124 $mobi->produceMobi(TRUE); 124 } elseif (isset($_GET['import'])) {
125 } elseif (isset($_GET['pdf'])) { 125 $import = $this->wallabag->import();
126 $pdf = new WallabagPDF($this->wallabag, $_GET['method'], $_GET['value']); 126 $tplVars = array_merge($this->vars, $import);
127 $pdf->prepareData(); 127 } elseif (isset($_GET['empty-cache'])) {
128 $pdf->producePDF(); 128 Tools::emptyCache();
129 } elseif (isset($_GET['import'])) { 129 } elseif (isset($_GET['export'])) {
130 $import = $this->wallabag->import(); 130 $this->wallabag->export();
131 $tplVars = array_merge($this->vars, $import); 131 } elseif (isset($_GET['updatetheme'])) {
132 } elseif (isset($_GET['download'])) { 132 $this->wallabag->tpl->updateTheme($_POST['theme']);
133 Tools::downloadDb(); 133 } elseif (isset($_GET['updatelanguage'])) {
134 } elseif (isset($_GET['empty-cache'])) { 134 $this->wallabag->language->updateLanguage($_POST['language']);
135 Tools::emptyCache(); 135 } elseif (isset($_GET['uploadfile'])) {
136 } elseif (isset($_GET['export'])) { 136 $this->wallabag->uploadFile();
137 $this->wallabag->export(); 137 } elseif (isset($_GET['feed']) && isset($_GET['action']) && $_GET['action'] == 'generate') {
138 } elseif (isset($_GET['updatetheme'])) {
139 $this->wallabag->tpl->updateTheme($_POST['theme']);
140 } elseif (isset($_GET['updatelanguage'])) {
141 $this->wallabag->language->updateLanguage($_POST['language']);
142 } elseif (isset($_GET['uploadfile'])) {
143 $this->wallabag->uploadFile();
144 } elseif (isset($_GET['feed'])) {
145 if (isset($_GET['action']) && $_GET['action'] == 'generate') {
146 $this->wallabag->updateToken(); 138 $this->wallabag->updateToken();
147 } 139 }
148 else { 140 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
149 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); 141 $plainUrl = new Url(base64_encode($_GET['plainurl']));
150 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']); 142 $this->wallabag->action('add', $plainUrl);
151 } 143 }
152 } 144 }
153 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
154 $plainUrl = new Url(base64_encode($_GET['plainurl']));
155 $this->wallabag->action('add', $plainUrl);
156 }
157 } 145 }
158 146
159 public function _render($file, $vars) 147 public function _render($file, $vars)