get up to date

This commit is contained in:
tcit 2014-09-27 19:42:37 +02:00
parent 824f8c45ed
commit a1b31d93b6
1 changed files with 40 additions and 52 deletions

92
inc/poche/Routing.class.php Normal file → Executable file
View File

@ -98,62 +98,50 @@ class Routing
private function _launchAction() private function _launchAction()
{ {
if (isset($_GET['login'])) { if (isset($_GET['login'])) {
// hello you // hello to you
$this->wallabag->login($this->referer); $this->wallabag->login($this->referer);
} elseif (isset($_GET['logout'])) { } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) {
// see you soon ! $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
$this->wallabag->logout(); $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']);
} elseif (isset($_GET['config'])) { }
// update password
$this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); //allowed ONLY to logged in user
} elseif (isset($_GET['newuser'])) { if (\Session::isLogged() === true)
$this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); {
} elseif (isset($_GET['deluser'])) { if (isset($_GET['logout'])) {
$this->wallabag->deleteUser($_POST['password4deletinguser']); // see you soon !
} elseif (isset($_GET['epub'])) { $this->wallabag->logout();
$epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']); } elseif (isset($_GET['config'])) {
$epub->prepareData(); // update password
$epub->produceEpub(); $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
} elseif (isset($_GET['mobi'])) { } elseif (isset($_GET['newuser'])) {
$mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']); $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']);
$mobi->prepareData(); } elseif (isset($_GET['deluser'])) {
$mobi->produceMobi(); $this->wallabag->deleteUser($_POST['password4deletinguser']);
} elseif (isset($_GET['send2kindle'])) { } elseif (isset($_GET['epub'])) {
$mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']); $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['id'], $_GET['value']);
$mobi->prepareData(); $epub->run();
$mobi->produceMobi(TRUE); } elseif (isset($_GET['import'])) {
} elseif (isset($_GET['pdf'])) { $import = $this->wallabag->import();
$pdf = new WallabagPDF($this->wallabag, $_GET['method'], $_GET['value']); $tplVars = array_merge($this->vars, $import);
$pdf->prepareData(); } elseif (isset($_GET['empty-cache'])) {
$pdf->producePDF(); Tools::emptyCache();
} elseif (isset($_GET['import'])) { } elseif (isset($_GET['export'])) {
$import = $this->wallabag->import(); $this->wallabag->export();
$tplVars = array_merge($this->vars, $import); } elseif (isset($_GET['updatetheme'])) {
} elseif (isset($_GET['download'])) { $this->wallabag->tpl->updateTheme($_POST['theme']);
Tools::downloadDb(); } elseif (isset($_GET['updatelanguage'])) {
} elseif (isset($_GET['empty-cache'])) { $this->wallabag->language->updateLanguage($_POST['language']);
Tools::emptyCache(); } elseif (isset($_GET['uploadfile'])) {
} elseif (isset($_GET['export'])) { $this->wallabag->uploadFile();
$this->wallabag->export(); } elseif (isset($_GET['feed']) && isset($_GET['action']) && $_GET['action'] == 'generate') {
} elseif (isset($_GET['updatetheme'])) {
$this->wallabag->tpl->updateTheme($_POST['theme']);
} elseif (isset($_GET['updatelanguage'])) {
$this->wallabag->language->updateLanguage($_POST['language']);
} elseif (isset($_GET['uploadfile'])) {
$this->wallabag->uploadFile();
} elseif (isset($_GET['feed'])) {
if (isset($_GET['action']) && $_GET['action'] == 'generate') {
$this->wallabag->updateToken(); $this->wallabag->updateToken();
} }
else { elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
$tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); $plainUrl = new Url(base64_encode($_GET['plainurl']));
$this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']); $this->wallabag->action('add', $plainUrl);
} }
} }
elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
$plainUrl = new Url(base64_encode($_GET['plainurl']));
$this->wallabag->action('add', $plainUrl);
}
} }
public function _render($file, $vars) public function _render($file, $vars)