diff options
Diffstat (limited to 'index.php')
-rwxr-xr-x[-rw-r--r--] | index.php | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -8,10 +8,18 @@ | |||
8 | * @license http://www.wtfpl.net/ see COPYING file | 8 | * @license http://www.wtfpl.net/ see COPYING file |
9 | */ | 9 | */ |
10 | 10 | ||
11 | define ('POCHE', '1.5.2'); | 11 | define ('POCHE', '1.7.1'); |
12 | require 'check_setup.php'; | 12 | require 'check_setup.php'; |
13 | require_once 'inc/poche/global.inc.php'; | 13 | require_once 'inc/poche/global.inc.php'; |
14 | session_start(); | 14 | |
15 | # Set error reporting level | ||
16 | if (defined('ERROR_REPORTING')) { | ||
17 | error_reporting(ERROR_REPORTING); | ||
18 | } | ||
19 | |||
20 | # Start session | ||
21 | Session::$sessionName = 'poche'; | ||
22 | Session::init(); | ||
15 | 23 | ||
16 | # Start Poche | 24 | # Start Poche |
17 | $poche = new Poche(); | 25 | $poche = new Poche(); |
@@ -30,14 +38,14 @@ $tpl_vars = array( | |||
30 | 'referer' => $referer, | 38 | 'referer' => $referer, |
31 | 'view' => $view, | 39 | 'view' => $view, |
32 | 'poche_url' => Tools::getPocheUrl(), | 40 | 'poche_url' => Tools::getPocheUrl(), |
33 | 'title' => _('poche, a read it later open source system'), | 41 | 'title' => _('wallabag, a read it later open source system'), |
34 | 'token' => Session::getToken(), | 42 | 'token' => Session::getToken(), |
35 | 'theme' => $poche->getTheme() | 43 | 'theme' => $poche->getTheme() |
36 | ); | 44 | ); |
37 | 45 | ||
38 | if (! empty($notInstalledMessage)) { | 46 | if (! empty($notInstalledMessage)) { |
39 | if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { | 47 | if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { |
40 | # We cannot use Twig to display the error message | 48 | # We cannot use Twig to display the error message |
41 | echo '<h1>Errors</h1><ol>'; | 49 | echo '<h1>Errors</h1><ol>'; |
42 | foreach ($notInstalledMessage as $message) { | 50 | foreach ($notInstalledMessage as $message) { |
43 | echo '<li>' . $message . '</li>'; | 51 | echo '<li>' . $message . '</li>'; |
@@ -63,8 +71,15 @@ if (isset($_GET['login'])) { | |||
63 | } elseif (isset($_GET['config'])) { | 71 | } elseif (isset($_GET['config'])) { |
64 | # Update password | 72 | # Update password |
65 | $poche->updatePassword(); | 73 | $poche->updatePassword(); |
74 | } elseif (isset($_GET['newuser'])) { | ||
75 | $poche->createNewUser(); | ||
76 | } elseif (isset($_GET['deluser'])) { | ||
77 | $poche->deleteUser(); | ||
78 | } elseif (isset($_GET['epub'])) { | ||
79 | $poche->createEpub(); | ||
66 | } elseif (isset($_GET['import'])) { | 80 | } elseif (isset($_GET['import'])) { |
67 | $import = $poche->import($_GET['from']); | 81 | $import = $poche->import(); |
82 | $tpl_vars = array_merge($tpl_vars, $import); | ||
68 | } elseif (isset($_GET['download'])) { | 83 | } elseif (isset($_GET['download'])) { |
69 | Tools::download_db(); | 84 | Tools::download_db(); |
70 | } elseif (isset($_GET['empty-cache'])) { | 85 | } elseif (isset($_GET['empty-cache'])) { |
@@ -75,13 +90,15 @@ if (isset($_GET['login'])) { | |||
75 | $poche->updateTheme(); | 90 | $poche->updateTheme(); |
76 | } elseif (isset($_GET['updatelanguage'])) { | 91 | } elseif (isset($_GET['updatelanguage'])) { |
77 | $poche->updateLanguage(); | 92 | $poche->updateLanguage(); |
93 | } elseif (isset($_GET['uploadfile'])) { | ||
94 | $poche->uploadFile(); | ||
78 | } elseif (isset($_GET['feed'])) { | 95 | } elseif (isset($_GET['feed'])) { |
79 | if (isset($_GET['action']) && $_GET['action'] == 'generate') { | 96 | if (isset($_GET['action']) && $_GET['action'] == 'generate') { |
80 | $poche->generateToken(); | 97 | $poche->generateToken(); |
81 | } | 98 | } |
82 | else { | 99 | else { |
83 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); | 100 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); |
84 | $poche->generateFeeds($_GET['token'], $_GET['user_id'], $tag_id, $_GET['type']); | 101 | $poche->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']); |
85 | } | 102 | } |
86 | } | 103 | } |
87 | 104 | ||
@@ -115,6 +132,7 @@ if (Session::isLogged()) { | |||
115 | } else { | 132 | } else { |
116 | $tpl_file = Tools::getTplFile('login'); | 133 | $tpl_file = Tools::getTplFile('login'); |
117 | $tpl_vars['http_auth'] = 0; | 134 | $tpl_vars['http_auth'] = 0; |
135 | Session::logout(); | ||
118 | } | 136 | } |
119 | 137 | ||
120 | # because messages can be added in $poche->action(), we have to add this entry now (we can add it before) | 138 | # because messages can be added in $poche->action(), we have to add this entry now (we can add it before) |