-
Notifications
You must be signed in to change notification settings - Fork 21
/
atmail.php
60 lines (43 loc) · 1.61 KB
/
atmail.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
54
55
56
57
58
59
60
<?php
// +----------------------------------------------------------------+
// | atmail.php |
// +----------------------------------------------------------------+
// | AtMail Open - Licensed under the Apache 2.0 Open-source License|
// | http://opensource.org/licenses/apache2.0.php |
// +----------------------------------------------------------------+
require_once('header.php');
require_once('Global.php');
// Check for account sent as one string
if (isset($_REQUEST['account'])) {
list($_REQUEST['username'], $_REQUEST['pop3host']) = explode('@', $_REQUEST['account']);
}
// sanitize some vars
if (isset($_REQUEST['username'])) {
$_REQUEST['username'] = htmlspecialchars($_REQUEST['username']);
}
if (isset($_REQUEST['pop3host'])) {
$_REQUEST['pop3host'] = htmlspecialchars($_REQUEST['pop3host']);
}
$atmail = new AtmailGlobal();
$atmail->getAuthObj(false);
$atmail->auth();
// Only start session if user is authentcated
require_once('Session.php');
session_start();
// force refresh of imap folder cache
// so we see all folders once logged in
$_SESSION['ForceImapRefresh'] = 1;
$atmail->auth->update_session();
$_SESSION['auth'] =& $atmail->auth;
$lang = $atmail->logintype();
$atmail->loadprefs();
// Toggle which MailType to use. IMAP or POP3
$atmail->mailtype();
$atmail->Language = ($lang)? $lang : $_REQUEST['Language'];
if (!$atmail->Language)
$atmail->Language = $pref['Language'];
echo $atmail->FromField;
$log = new Log(array('Account' => "$atmail->username@$atmail->pop3host"));
// Log the access
$log->write_log( "Login", "Access from {$_SERVER['REMOTE_ADDR']}");
$atmail->end();