diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -8,7 +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.1.0'); | ||
11 | require_once 'inc/poche/global.inc.php'; | 12 | require_once 'inc/poche/global.inc.php'; |
13 | session_start(); | ||
12 | 14 | ||
13 | # Start Poche | 15 | # Start Poche |
14 | $poche = new Poche(); | 16 | $poche = new Poche(); |
@@ -35,7 +37,12 @@ $tpl_vars = array( | |||
35 | if (! empty($notInstalledMessage)) { | 37 | if (! empty($notInstalledMessage)) { |
36 | if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { | 38 | if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) { |
37 | # We cannot use Twig to display the error message | 39 | # We cannot use Twig to display the error message |
38 | die($notInstalledMessage); | 40 | echo '<h1>Errors</h1><ol>'; |
41 | foreach ($notInstalledMessage as $message) { | ||
42 | echo '<li>' . $message . '</li>'; | ||
43 | } | ||
44 | echo '</ol>'; | ||
45 | die(); | ||
39 | } else { | 46 | } else { |
40 | # Twig is installed, put the error message in the template | 47 | # Twig is installed, put the error message in the template |
41 | $tpl_file = Tools::getTplFile('error'); | 48 | $tpl_file = Tools::getTplFile('error'); |
@@ -61,7 +68,10 @@ if (isset($_GET['login'])) { | |||
61 | $poche->export(); | 68 | $poche->export(); |
62 | } elseif (isset($_GET['updatetheme'])) { | 69 | } elseif (isset($_GET['updatetheme'])) { |
63 | $poche->updateTheme(); | 70 | $poche->updateTheme(); |
71 | } elseif (isset($_GET['updatelanguage'])) { | ||
72 | $poche->updateLanguage(); | ||
64 | } | 73 | } |
74 | |||
65 | elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) { | 75 | elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) { |
66 | $plain_url = new Url(base64_encode($_GET['plainurl'])); | 76 | $plain_url = new Url(base64_encode($_GET['plainurl'])); |
67 | $poche->action('add', $plain_url); | 77 | $poche->action('add', $plain_url); |
@@ -71,8 +81,18 @@ if (Session::isLogged()) { | |||
71 | $poche->action($action, $url, $id); | 81 | $poche->action($action, $url, $id); |
72 | $tpl_file = Tools::getTplFile($view); | 82 | $tpl_file = Tools::getTplFile($view); |
73 | $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id)); | 83 | $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id)); |
84 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { | ||
85 | if($poche->store->userExists($_SERVER['PHP_AUTH_USER'])) { | ||
86 | $poche->login($referer); | ||
87 | } else { | ||
88 | $poche->messages->add('e', _('login failed: user doesn\'t exist')); | ||
89 | Tools::logm('user doesn\'t exist'); | ||
90 | $tpl_file = Tools::getTplFile('login'); | ||
91 | $tpl_vars['http_auth'] = 1; | ||
92 | } | ||
74 | } else { | 93 | } else { |
75 | $tpl_file = Tools::getTplFile('login'); | 94 | $tpl_file = Tools::getTplFile('login'); |
95 | $tpl_vars['http_auth'] = 0; | ||
76 | } | 96 | } |
77 | 97 | ||
78 | # because messages can be added in $poche->action(), we have to add this entry now (we can add it before) | 98 | # because messages can be added in $poche->action(), we have to add this entry now (we can add it before) |
@@ -80,4 +100,4 @@ $messages = $poche->messages->display('all', FALSE); | |||
80 | $tpl_vars = array_merge($tpl_vars, array('messages' => $messages)); | 100 | $tpl_vars = array_merge($tpl_vars, array('messages' => $messages)); |
81 | 101 | ||
82 | # display poche | 102 | # display poche |
83 | echo $poche->tpl->render($tpl_file, $tpl_vars); \ No newline at end of file | 103 | echo $poche->tpl->render($tpl_file, $tpl_vars); |