forked from zedzedtop/mailzu
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.php
53 lines (44 loc) · 1.39 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* This file is the login page for the system
* It provides a login form and will automatically
* forward any users who are logged in.
*
* @author Gergely Nagy <gna@r-us.hu>
* @version 2021-11-08
* @package mailzu-ng
*
* Copyright (C) 2021 mailzu-ng
* License: GPL, see LICENSE
*/
/**
* Include autoloader
*/
include_once('lib/autoload.php');
$auth = new Auth();
$t = new Template();
$msg = '';
$resume = (isset($_POST['resume'])) ? $_POST['resume'] : '';
// Logging user out
if (isset($_GET['logout'])) {
$auth->doLogout();
} else if (isset($_POST['login'])) {
$msg = $auth->doLogin($_POST['email'], $_POST['password'], (isset($_POST['setCookie']) ? 'y' : null), false, $resume, $_POST['language'], isset($_POST['domain']) ? $_POST['domain'] : '');
} else if (isset($_COOKIE['ID'])) {
$msg = $auth->doLogin($_COOKIE['ID'], '', 'y', $_COOKIE['ID'], $resume); // Check if user has cookies set up. If so, log them in automatically
}
$t->printHTMLHeader();
// Print out logoImage if it exists
echo (!empty($conf['ui']['logoImage']))
? '<div class="alignleft"><img src="' . $conf['ui']['logoImage'] . '" alt="logo" vspace="5"/></div>'
: '';
$t->startMain();
if (isset($_GET['auth'])) {
$auth->printLoginForm(translate('You are not logged in!'), $_GET['resume']);
} else {
$auth->printLoginForm($msg);
}
$t->endMain();
// Print HTML footer
$t->printHTMLFooter();
?>