aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Routing.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Routing.class.php')
-rwxr-xr-xinc/poche/Routing.class.php31
1 files changed, 25 insertions, 6 deletions
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index 6ae93d21..177b74d5 100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -33,6 +33,7 @@ class Routing
33 $this->view = Tools::checkVar('view', 'home'); 33 $this->view = Tools::checkVar('view', 'home');
34 $this->action = Tools::checkVar('action'); 34 $this->action = Tools::checkVar('action');
35 $this->id = Tools::checkVar('id'); 35 $this->id = Tools::checkVar('id');
36 $this->autoclose = Tools::checkVar('autoclose',FALSE);
36 $_SESSION['sort'] = Tools::checkVar('sort', 'id'); 37 $_SESSION['sort'] = Tools::checkVar('sort', 'id');
37 $this->url = new Url((isset ($_GET['url'])) ? $_GET['url'] : ''); 38 $this->url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
38 } 39 }
@@ -64,9 +65,15 @@ class Routing
64 $tplVars = array(); 65 $tplVars = array();
65 66
66 if (\Session::isLogged()) { 67 if (\Session::isLogged()) {
67 $this->wallabag->action($this->action, $this->url, $this->id); 68 $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose);
68 $tplFile = Tools::getTplFile($this->view); 69 $tplFile = Tools::getTplFile($this->view);
69 $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); 70 $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id));
71 } elseif(ALLOW_REGISTER && isset($_GET['registerform'])) {
72 Tools::logm('register');
73 $tplFile = Tools::getTplFile('register');
74 } elseif (ALLOW_REGISTER && isset($_GET['register'])){
75 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']);
76 Tools::redirect();
70 } elseif(isset($_SERVER['PHP_AUTH_USER'])) { 77 } elseif(isset($_SERVER['PHP_AUTH_USER'])) {
71 if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { 78 if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) {
72 $this->wallabag->login($this->referer); 79 $this->wallabag->login($this->referer);
@@ -102,8 +109,11 @@ class Routing
102 $this->wallabag->login($this->referer); 109 $this->wallabag->login($this->referer);
103 } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) { 110 } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) {
104 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); 111 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
105 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']); 112 $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0);
106 } 113 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit);
114 } //elseif (ALLOW_REGISTER && isset($_GET['register'])) {
115 //$this->wallabag->register
116 //}
107 117
108 //allowed ONLY to logged in user 118 //allowed ONLY to logged in user
109 if (\Session::isLogged() === true) 119 if (\Session::isLogged() === true)
@@ -115,12 +125,21 @@ class Routing
115 // update password 125 // update password
116 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); 126 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
117 } elseif (isset($_GET['newuser'])) { 127 } elseif (isset($_GET['newuser'])) {
118 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); 128 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail'], true);
119 } elseif (isset($_GET['deluser'])) { 129 } elseif (isset($_GET['deluser'])) {
120 $this->wallabag->deleteUser($_POST['password4deletinguser']); 130 $this->wallabag->deleteUser($_POST['password4deletinguser']);
121 } elseif (isset($_GET['epub'])) { 131 } elseif (isset($_GET['epub'])) {
122 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']); 132 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']);
123 $epub->run(); 133 $epub->prepareData();
134 $epub->produceEpub();
135 } elseif (isset($_GET['mobi'])) {
136 $mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']);
137 $mobi->prepareData();
138 $mobi->produceMobi();
139 } elseif (isset($_GET['pdf'])) {
140 $pdf = new WallabagPDF($this->wallabag, $_GET['method'], $_GET['value']);
141 $pdf->prepareData();
142 $pdf->producePDF();
124 } elseif (isset($_GET['import'])) { 143 } elseif (isset($_GET['import'])) {
125 $import = $this->wallabag->import(); 144 $import = $this->wallabag->import();
126 $tplVars = array_merge($this->vars, $import); 145 $tplVars = array_merge($this->vars, $import);
@@ -148,4 +167,4 @@ class Routing
148 { 167 {
149 echo $this->wallabag->tpl->render($file, $vars); 168 echo $this->wallabag->tpl->render($file, $vars);
150 } 169 }
151} \ No newline at end of file 170}