diff options
author | tcitworld <thomas.citharet@gmail.com> | 2014-01-04 12:30:31 -0800 |
---|---|---|
committer | tcitworld <thomas.citharet@gmail.com> | 2014-01-04 12:30:31 -0800 |
commit | 7f667839764621b5aa01c9db8ce5dde2a29ef18f (patch) | |
tree | 93d8241ee81c87e18494325ae02f0589a8e328a2 /index.php | |
parent | a84f77d6ba15a64ff00453f5d5190c021ce460ed (diff) | |
parent | 2abcccb37180c17318f5226f5d4bc28f30b621ea (diff) | |
download | wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.tar.gz wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.tar.zst wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.zip |
Merge pull request #1 from inthepoche/dev
Dev
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -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 | ||
11 | define ('POCHE', '1.0.0'); | 11 | define ('POCHE', '1.3.0'); |
12 | require_once 'inc/poche/global.inc.php'; | 12 | require_once 'inc/poche/global.inc.php'; |
13 | session_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 | ||
74 | elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) { | 85 | elseif (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 |
92 | echo $poche->tpl->render($tpl_file, $tpl_vars); \ No newline at end of file | 122 | echo $poche->tpl->render($tpl_file, $tpl_vars); |