X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/2dc4984ad57dfcb0ded829bfc9d45493484fe6e3..b87b52221de3f4c3f84e6b11df83008e2585e181:/admin.php diff --git a/admin.php b/admin.php index 4500a19..6560f10 100644 --- a/admin.php +++ b/admin.php @@ -53,72 +53,59 @@ if (php_sapi_name() == "cli") { } /* Unlog if asked. */ - if (isset($_POST['action']) && (strcmp($_POST['action'], 'logout') == 0)) { - $_SESSION['admin_auth'] = false; + if (jirafeau_admin_session_logged() && isset($_POST['action']) && (strcmp($_POST['action'], 'logout') == 0)) { + jirafeau_admin_session_end(); } - /* 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 '

'. - t('BAD_PSW') . '

'; + if (!jirafeau_admin_session_logged()) { + /* Test HTTP authentification. */ + if (!empty($cfg['admin_http_auth_user']) && + $cfg['admin_http_auth_user'] == $_SERVER['PHP_AUTH_USER']) { + jirafeau_admin_session_start(); + } + /* Test web password authentification. */ + else if (!empty($cfg['admin_password']) && isset($_POST['admin_password'])) { + if ($cfg['admin_password'] === $_POST['admin_password'] || + $cfg['admin_password'] === hash('sha256', $_POST['admin_password'])) { + jirafeau_admin_session_start(); + } else { + require(JIRAFEAU_ROOT . 'lib/template/header.php'); + echo '

'. t('BAD_PSW') . '

'; + require(JIRAFEAU_ROOT.'lib/template/footer.php'); + exit; + } + } + /* Admin password prompt form. */ + else { + require(JIRAFEAU_ROOT . 'lib/template/header.php'); ?> +
+
+ + + + + + + + + + +
+
+
+
+
+ -
-
- - - - - - - - - -
- -
-
-
-

'. - t('NO_ADMIN_AUTH') . - '

'; - require(JIRAFEAU_ROOT.'lib/template/footer.php'); - exit; - } /* Operations may take a long time. * Be sure PHP's safe mode is off. @@ -138,6 +125,7 @@ if (php_sapi_name() == "cli") {
+ @@ -150,6 +138,7 @@ if (php_sapi_name() == "cli") { + @@ -162,6 +151,7 @@ if (php_sapi_name() == "cli") { + @@ -174,6 +164,7 @@ if (php_sapi_name() == "cli") { + @@ -188,6 +179,7 @@ if (php_sapi_name() == "cli") { + @@ -202,8 +194,9 @@ if (php_sapi_name() == "cli") { + - + @@ -216,10 +209,10 @@ if (php_sapi_name() == "cli") { +