aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/index.php b/index.php
index a6459270..4e86fe11 100644
--- a/index.php
+++ b/index.php
@@ -8,8 +8,9 @@
8 * @license http://www.wtfpl.net/ see COPYING file 8 * @license http://www.wtfpl.net/ see COPYING file
9 */ 9 */
10 10
11define ('POCHE', '1.0.0'); 11define ('POCHE', '1.3.0');
12require_once 'inc/poche/global.inc.php'; 12require_once 'inc/poche/global.inc.php';
13session_start();
13 14
14# Start Poche 15# Start Poche
15$poche = new Poche(); 16$poche = new Poche();
@@ -63,12 +64,22 @@ if (isset($_GET['login'])) {
63 $poche->updatePassword(); 64 $poche->updatePassword();
64} elseif (isset($_GET['import'])) { 65} elseif (isset($_GET['import'])) {
65 $import = $poche->import($_GET['from']); 66 $import = $poche->import($_GET['from']);
67} elseif (isset($_GET['download'])) {
68 Tools::download_db();;
66} elseif (isset($_GET['export'])) { 69} elseif (isset($_GET['export'])) {
67 $poche->export(); 70 $poche->export();
68} elseif (isset($_GET['updatetheme'])) { 71} elseif (isset($_GET['updatetheme'])) {
69 $poche->updateTheme(); 72 $poche->updateTheme();
70} elseif (isset($_GET['updatelanguage'])) { 73} elseif (isset($_GET['updatelanguage'])) {
71 $poche->updateLanguage(); 74 $poche->updateLanguage();
75} elseif (isset($_GET['feed'])) {
76 if (isset($_GET['action']) && $_GET['action'] == 'generate') {
77 $poche->generateToken();
78 }
79 else {
80 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
81 $poche->generateFeeds($_GET['token'], $_GET['user_id'], $tag_id, $_GET['type']);
82 }
72} 83}
73 84
74elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) { 85elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
@@ -80,8 +91,27 @@ if (Session::isLogged()) {
80 $poche->action($action, $url, $id); 91 $poche->action($action, $url, $id);
81 $tpl_file = Tools::getTplFile($view); 92 $tpl_file = Tools::getTplFile($view);
82 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id)); 93 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
94} elseif(isset($_SERVER['PHP_AUTH_USER'])) {
95 if($poche->store->userExists($_SERVER['PHP_AUTH_USER'])) {
96 $poche->login($referer);
97 } else {
98 $poche->messages->add('e', _('login failed: user doesn\'t exist'));
99 Tools::logm('user doesn\'t exist');
100 $tpl_file = Tools::getTplFile('login');
101 $tpl_vars['http_auth'] = 1;
102 }
103} elseif(isset($_SERVER['REMOTE_USER'])) {
104 if($poche->store->userExists($_SERVER['REMOTE_USER'])) {
105 $poche->login($referer);
106 } else {
107 $poche->messages->add('e', _('login failed: user doesn\'t exist'));
108 Tools::logm('user doesn\'t exist');
109 $tpl_file = Tools::getTplFile('login');
110 $tpl_vars['http_auth'] = 1;
111 }
83} else { 112} else {
84 $tpl_file = Tools::getTplFile('login'); 113 $tpl_file = Tools::getTplFile('login');
114 $tpl_vars['http_auth'] = 0;
85} 115}
86 116
87# because messages can be added in $poche->action(), we have to add this entry now (we can add it before) 117# because messages can be added in $poche->action(), we have to add this entry now (we can add it before)
@@ -89,4 +119,4 @@ $messages = $poche->messages->display('all', FALSE);
89$tpl_vars = array_merge($tpl_vars, array('messages' => $messages)); 119$tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
90 120
91# display poche 121# display poche
92echo $poche->tpl->render($tpl_file, $tpl_vars); \ No newline at end of file 122echo $poche->tpl->render($tpl_file, $tpl_vars);