- if (isset ($_POST['action']) && (strcmp ($_POST['action'], 'logout') == 0))
- $_SESSION['admin_auth'] = false;
-
- /* Check classic admin password authentification. */
- if (isset ($_POST['admin_password']) && empty($cfg['admin_http_auth_user']))
- {
- if ($cfg['admin_password'] === $_POST['admin_password'] ||
- $cfg['admin_password'] === hash('sha256', $_POST['admin_password']))
- $_SESSION['admin_auth'] = true;
- else
- {
- $_SESSION['admin_auth'] = false;
- require (JIRAFEAU_ROOT . 'lib/template/header.php');
- echo '<div class="error"><p>'.
- t('Wrong password.') . '</p></div>';
- require (JIRAFEAU_ROOT.'lib/template/footer.php');
- exit;
- }
- }
- /* Ask for classic admin password authentification. */
- elseif ((!isset ($_SESSION['admin_auth']) || $_SESSION['admin_auth'] != true)
- && empty($cfg['admin_http_auth_user']))
- {
- require (JIRAFEAU_ROOT . 'lib/template/header.php'); ?>
- <form action = "<?php echo basename(__FILE__); ?>" method = "post">
- <fieldset>
- <table>
- <tr>
- <td class = "label"><label for = "enter_password">
- <?php echo t('Administration password') . ':';?></label>
- </td>
- <td class = "field"><input type = "password"
- name = "admin_password" id = "admin_password"
- size = "40" />
- </td>
- </tr>
- <tr class = "nav">
- <td></td>
- <td class = "nav next">
- <input type = "submit" name = "key" value =
- "<?php echo t('Login'); ?>" />
- </td>
- </tr>
- </table>
- </fieldset>
- </form>
- <?php
- require (JIRAFEAU_ROOT.'lib/template/footer.php');
- exit;
- }
- /* Check authenticated user if HTTP authentification is enable. */
- elseif ((!isset ($_SESSION['admin_auth']) || $_SESSION['admin_auth'] != true)
- && !empty($cfg['admin_http_auth_user']))
- {
- if ($cfg['admin_http_auth_user'] == $_SERVER['PHP_AUTH_USER'])
- $_SESSION['admin_auth'] = true;