forked from oheil/NOCC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
193 lines (175 loc) · 8.12 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/**
* Login
*
* This file is part of NVLL. NVLL is free software under the terms of the
* GNU General Public License. You should have received a copy of the license
* along with NVLL. If not, see <http://www.gnu.org/licenses>.
*/
//If a previous authentification cookie was set, we use it to bypass login window.
require_once dirname(__FILE__) . '/common.php';
require_once dirname(__FILE__) . '/functions/captcha.php';
if (isset($_REQUEST['_vmbox']) && $_REQUEST['_vmbox'] == "RSS") {
header("Location: " . $conf->base_url);
exit();
}
if (isset($_SESSION['restart_session']) && $_SESSION['restart_session'] == true) {
header("Location: " . $conf->base_url . "api.php?" . NVLL_Session::getUrlGetSession());
exit();
}
require_once dirname(__FILE__) . '/functions/check.php';
require dirname(__FILE__) . '/html/header.php';
?>
<form method="POST" action="api.php?<?php echo NVLL_Session::getUrlGetSession(); ?>" id="nvll_webmail_login" accept-charset="UTF-8">
<div id="loginBox">
<h2><?php echo i18n_message($html_welcome, $conf->nvll_name); ?></h2>
<input type="hidden" name="service" value="login" />
<input type="hidden" name="folder" value="INBOX" />
<table>
<tr>
<th><label for="user"><?php echo $html_user_label; ?></label></th>
<td>
<input class="button" type="text" name="user" id="user" size="25" placeholder="e.g. chernobyl, [email protected]" value="<?php if (isset($REMOTE_USER)) echo $REMOTE_USER; ?>" />
<?php if (count($conf->domains) > 1) {
//Add fill-in domain
if (isset($conf->typed_domain_login)) {
echo '<label for="fillindomain">@</label> <input class="button" type="text" name="fillindomain" id="fillindomain">';
} elseif (isset($conf->vhost_domain_login) && $conf->vhost_domain_login == true) {
$i = 0;
while (!empty($conf->domains[$i]->in)) {
if (strpos($_SERVER['HTTP_HOST'], $conf->domains[$i]->domain)) echo '<input type="hidden" name="domain_index" id="domain_index" value="' . $i . '" />' . "\n";
$i++;
}
} else {
echo '<label for="domain_index">@</label> <select class="button" name="domain_index" id="domain_index">';
$i = 0;
while (!empty($conf->domains[$i]->in)) {
if (isset($conf->domains[$i]->show_as) && strlen($conf->domains[$i]->show_as) > 0) {
if (!isset($_SESSION['send_backup']) || $_SESSION['send_backup']['nvll_domain_index'] == $i) echo "<option value=\"$i\">" . $conf->domains[$i]->show_as . '</option>';
} else {
if (!isset($_SESSION['send_backup']) || $_SESSION['send_backup']['nvll_domain_index'] == $i) echo "<option value=\"$i\">" . $conf->domains[$i]->domain . '</option>';
}
$i++;
}
echo '</select>' . "\n";
}
} else {
echo '<input type="hidden" name="domain_index" value="0" id="domain_index" />' . "\n";
}
?>
</td>
</tr>
<tr>
<th><label for="passwd"><?php echo $html_passwd_label ?></label></th>
<td>
<input class="button" type="password" name="passwd" id="passwd" size="25" />
</td>
</tr>
<?php if ($conf->domains[0]->in == '') {
echo '<tr>';
echo '<th><label for="server">' . $html_server_label . '</label></th>';
echo '<td>';
echo '<input class="button" type="text" name="server" id="server" value="mail.example.com" size="15" /><br /><input class="button" type="text" size="4" name="port" value="143" />';
echo '<select class="button" name="servtype" onchange="updateLoginPort()">';
echo '<option value="imap">IMAP</option>';
echo '<option value="notls">IMAP (no TLS)</option>';
echo '<option value="ssl">IMAP SSL</option>';
echo '<option value="ssl/novalidate-cert">IMAP SSL (self signed)</option>';
echo '<option value="pop3">POP3</option>';
echo '<option value="pop3/notls">POP3 (no TLS)</option>';
echo '<option value="pop3/ssl">POP3 SSL</option>';
echo '<option value="pop3/ssl/novalidate-cert">POP3 SSL (self signed)</option>';
echo '</select>';
echo '</td>';
echo '</tr>';
}
if ($conf->hide_lang_select_from_login_page == false) { ?>
<tr>
<th><label for="lang"><?php echo $html_lang_label ?></label></th>
<td>
<select class="button" name="lang" id="lang" onchange="updateLoginPage('<?php echo NVLL_Session::getUrlGetSession(); ?>')">
<?php
echo '<option value="default"';
if (!isset($_REQUEST['lang']) || $_REQUEST['lang'] == "default") {
echo ' selected="selected"';
}
echo '>' . convertLang2Html($html_default) . '</option>';
foreach ($lang_array as $_lang_key => $_lang_var) {
if (file_exists('lang/' . $_lang_var->filename . '.php')) {
echo '<option value="' . $_lang_var->filename . '"';
if (isset($_REQUEST['lang']) && $_REQUEST['lang'] != "default" && $_SESSION['nvll_lang'] == $_lang_var->filename) {
echo ' selected="selected"';
}
echo '>' . convertLang2Html($_lang_var->label) . '</option>';
}
}
?>
</select>
</td>
</tr>
<?php }
if ($conf->use_theme == true && $conf->hide_theme_select_from_login_page == false) { ?>
<tr>
<th><label for="theme"><?php echo $html_theme_label ?></label></th>
<td>
<select class="button" name="theme" id="theme" onchange="updateLoginPage('<?php echo NVLL_Session::getUrlGetSession(); ?>')">
<?php
echo '<option value="default"';
if (!isset($_REQUEST['lang']) || $_REQUEST['lang'] == "default") echo ' selected="selected"';
echo '>' . convertLang2Html($html_default) . '</option>';
$themes = new NVLL_Themes('./themes/', $_SESSION['nvll_theme']);
foreach ($themes->getThemeNames() as $themeName) { //for all theme names...
echo '<option value="' . $themeName . '"';
if (isset($_REQUEST['theme']) && $_REQUEST['theme'] != "default" && $themeName == $_SESSION['nvll_theme']) echo ' selected="selected"';
echo '>' . $themeName . '</option>';
}
unset($themeName);
unset($themes);
?>
</select>
</td>
</tr>
<?php }
if (isset($conf->prefs_dir) && $conf->prefs_dir != '') { ?>
<tr>
<th></th>
<td class="remember">
<input type="checkbox" name="remember" id="remember" value="true" />
<label for="remember">
<?php echo convertLang2Html($html_remember) ?>
<br>
<span><?php echo convertLang2Html($html_remember_desc); ?>
<a href=""><?php echo convertLang2Html($html_why); ?>?
</a></span>
</label>
</td>
</tr>
<?php if ($conf->use_captcha): ?>
<tr>
<td><?php echo send_captcha(); ?></td>
</tr>
<?php endif; ?>
<?php if (isset($_SESSION['send_backup'])): ?>
<tr>
<td colspan="2">
<br />
<?php echo "<span style=\"color:red\">" . $html_send_recover . "</span>"; ?>
<br />
<a href="index.php?<?php echo NVLL_Session::getUrlGetSession(); ?>&discard=1">
<?php echo $html_send_discard; ?>
</a>
<br />
</td>
</tr>
<?php endif; ?>
<?php } ?>
</table>
<p><input name="enter" class="button" type="submit" value="<?php echo $html_login ?>" /></p>
</div>
</form>
<script type="text/javascript">
document.getElementById("nvll_webmail_login").user.focus();
document.getElementById("nvll_webmail_login").passwd.value = '';
</script>
<?php
require dirname(__FILE__) . '/html/footer.php';