/usr/share/IlohaMail/source/index.php is in ilohamail 0.8.14-0rc3sid6.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | <?php
/////////////////////////////////////////////////////////
//
// source/index.php
//
// (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
//
// This file is part of IlohaMail.
// IlohaMail is free software released under the GPL
// license. See enclosed file COPYING for details,
// or see http://www.fsf.org/copyleft/gpl.html
//
/////////////////////////////////////////////////////////
/********************************************************
AUTHOR: Ryo Chijiiwa <ryo@ilohamail.org>
FILE: source/index.php
PURPOSE:
1. Provides interface for logging in.
2. Authenticates user/password for given IMAP server
3. Initiates session
PRE-CONDITIONS:
$user - IMAP account name
$password - IMAP account password
$host - IMAP server
COMMENTS:
Modify form tags for "host" as required.
For an example, if you only want the program to be used to log into specific
servers, you can use "select" lists (if multiple), or "hidden" (if single) tags.
Alternatively, simply show a text box to have the user specify the server.
********************************************************/
include("../include/super2global.inc");
include("../include/nocache.inc");
$document_head = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>IlohaMail</TITLE>
<STYLE type="text/css">
<!--
body
{
font-family: Verdana, Arial, Helvetica, sans-serif;
}
//-->
</STYLE>
</HEAD>';
include_once("../include/encryption.inc");
include_once("../include/version.inc");
include_once("../include/langs.inc");
include_once("../conf/conf.inc");
include_once("../conf/login.php");
//set content type header
if (!empty($int_lang)){
include_once("../lang/".$int_lang."init.inc");
}else{
include_once("../lang/".$default_lang."init.inc");
}
header("Content-type: text/html; charset=".$lang_charset);
$authenticated = false;
// session not started yet
if (!isset($session) || (empty($session))){
//figure out lang
if (strlen($int_lang)>2){
//lang selected from menu (probably)
$lang = $int_lang;
}else{
//default, or non-selection
$lang = (isset($default_lang)?$default_lang:"eng/");
}
include_once("../conf/defaults.inc");
//clean up
$user = trim(chop($user));
$host = trim(chop($host));
//validate host
if (!empty($default_host)){
if (is_array($default_host)){
if (empty($default_host[$host])){
$host="";
$error .= $loginErrors[0]."<br>\n";
}
}else{
if (strcasecmp($host, $default_host)!=0){
$host="";
$error .= $loginErrors[0]."<br>\n";
}
}
}
//auto append
if ((empty($error)) && (is_array($AUTO_APPEND)) && (!empty($AUTO_APPEND[$host]))){
if (strpos($user, $AUTO_APPEND[$host])===false) $user .= $AUTO_APPEND[$host];
}
//attempt to initiate session
if ($user && $password && $host){
include("../include/icl.inc");
$user_name = $user;
//first, authenticate against server
$iil_conn=iil_Connect($host, $user, $password, $AUTH_MODE);
if ($iil_conn){
//run custom authentication code
include("../conf/custom_auth.php");
//if successful, start session
if (empty($error)){
if ((!isset($port))||(empty($port))) $port = 143;
include("../include/write_sinc.inc");
if ($new_user){
include("../conf/new_user.php");
$new_user = 1;
}else{
$new_user = 0;
}
$authenticated = true;
}
iil_Close($iil_conn);
}else{
$error = $iil_error."<br>";
}
//make log entry
$log_action = "log in";
include("../include/log.inc");
}
}
// valid session
$login_success = false;
if ((isset($session)) && ($session != "")){
$user=$session;
//load session data
include("../include/session_auth.inc");
include("../conf/defaults.inc");
//authenticate
if (!$authenticated){
include_once("../include/icl.inc");
$conn=iil_Connect($host, $loginID, $password, $AUTH_MODE);
if ($conn){
iil_Close($conn);
}else{
echo "Authentication failed.";
echo "</html>\n";
exit;
}
}
//do prefs (posted from "Prefs" pane so that changes apply to all frames)
if ($do_prefs){
//check charset (change to default if unsupported)
include_once("../lang/".$lang."init.inc");
if (!empty($charset)){
if (!$supported_charsets[$charset]) $charset = $lang_charset;
}else{
$charset = $lang_charset;
}
//apply changes...
if (isset($apply)) $update=true;
if ((isset($update))||(isset($revert))){
//check rootdir
if ($rootdir=="-") $rootdir = $rootdir_other;
//initialize $my_prefs
$my_prefs=$init["my_prefs"];
//if updating, over-write values
if (isset($update)){
reset($my_prefs);
while (list($key, $value) = each ($my_prefs)) {
$my_prefs[$key]=$$key;
echo "<!-- $key ".$$key." -->\n";
}
}
//save prefs to backend
include("../include/save_prefs.inc");
//display prefs page again
$show_page="prefs";
//show error if any
if (!empty($error)){
echo "<body>ERROR: $error</body></html>";
exit;
}
}
}
//do pref_colors (posted from "Prefs:Colors" pane so that changes apply to all frames)
if ($do_pref_colors){
//apply changes...
if (isset($apply)) $update=true;
if ((isset($update))||(isset($revert))){
//check rootdir
if ($font_family=="other") $font_family = $font_family_other;
//initialize $my_prefs
$my_colors=$init["my_colors"];
//if updating, over-write values
if (isset($update)){
reset($my_colors);
while (list($key, $value) = each ($my_colors)) {
$my_colors[$key]=$$key;
echo "<!-- $key ".$$key." -->\n";
}
}
//save prefs to backend
include("../include/save_colors.inc");
//display prefs page again
$show_page="pref_colors";
//show error...
if (!empty($error)){
echo "<body>ERROR: $error</body></html>";
exit;
}
}
}
//overwrite lang prefs if different
if ((strlen($int_lang)>2) && (strcmp($int_lang, $my_prefs["lang"])!=0)){
$my_prefs["lang"] = $int_lang;
include("../lang/".$lang."init.inc");
if ($supported_charsets[$my_prefs["charset"]]!=1) $my_prefs["charset"] = $lang_charset;
include("../include/save_prefs.inc");
}
//figure out which page to load in main frame
if (($new_user)||($show_page=="prefs")) $main_page = "prefs.php?user=".$session;
else if ($show_page == "pref_colors") $main_page = "pref_colors.php?user=".$session;
else $main_page = "main.php?folder=INBOX&user=".$session;
//show document head
echo $document_head;
//show frames
if (($my_prefs["list_folders"]==1) && ($port!=110)){
//...with folder list
$login_success = true;
?>
<FRAMESET ROWS="30,*" frameborder=no border=0 framespacing=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<FRAMESET COLS="30,*" frameborder=no border=0 framespacing=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<FRAME SRC="radar.php?user=<?php echo $session?>" NAME="radar" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0" frameborder=no border=0 framespacing=0>
<FRAME SRC="tool.php?user=<?php echo $session?>" NAME="tool" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0" frameborder=no border=0 framespacing=0>
</FRAMESET>
<FRAMESET COLS="<?php echo $my_prefs["folderlistWidth"]?>,*" frameborder=no border=0 framespacing=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<FRAME SRC="folders.php?user=<?php echo $session?>" NAME="list1" MARGINWIDTH=5 MARGINHEIGHT=5 NORESIZE frameborder=no border=0 framespacing=0>
<FRAME SRC="<?php echo $main_page?>" NAME="list2" MARGINWIDTH=10 MARGINHEIGHT=10 FRAMEBORDER=no border=0 framespacing=0>
</FRAMESET>
</FRAMESET>
<?php
}else if (empty($error)){
//...without folder list
$login_success = true;
?>
<FRAMESET ROWS="30,*" frameborder=no border=0 framespacing=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<FRAMESET COLS="30,*" frameborder=no border=0 framespacing=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<FRAME SRC="radar.php?user=<?php echo $session?>" NAME="radar" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0" frameborder=no border=0 framespacing=0>
<FRAME SRC="tool.php?user=<?php echo $session?>" NAME="tool" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0" frameborder=no border=0 framespacing=0>
</FRAMESET>
<FRAME SRC="<?php echo $main_page?>" NAME="list2" MARGINWIDTH=10 MARGINHEIGHT=10 FRAMEBORDER=no border=0 framespacing=0>
</FRAMESET>
<?php
}
}
//couldn't log in, show login form
if (!$login_success){
//check for cookie...
if ($_COOKIE["ILOHAMAIL_SESSION"]){
$user = "";
setcookie("ILOHAMAIL_SESSION", "");
}
//put together lang options
$langOptions="<option value=\"--\">--";
while (list($key, $val)=each($languages))
$langOptions.="<option value=\"$key\" ".(strcmp($key,$int_lang)==0?"SELECTED":"").">$val\n";
//colors...
$bgcolor = $default_colors["folder_bg"];
$textColorOut = $default_colors["folder_link"];
$bgcolorIn = $default_colors["tool_bg"];
$textColorIn = $default_colors["tool_link"];
//load lang file
if (!empty($int_lang)){
include("../lang/".$int_lang."login.inc");
}else{
include("../lang/".$default_lang."login.inc");
}
//set a test cookie
if ($USE_COOKIES){
setcookie ("IMAIL_TEST_COOKIE", "test", time()+$MAX_SESSION_TIME, "/", $_SERVER[SERVER_NAME]);
}
//print document head
echo $document_head;
echo "\n<!-- \nSESS_KEY: $IMAIL_SESS_KEY $MAX_SESSION_TIME ".$_SERVER[SERVER_NAME]."\nOLD: $OLD_SESS_KEY\n //-->\n";
?>
<BODY BGCOLOR="<?php echo $bgcolor?>" TEXT="<?php echo $textColorOut?>" LINK="<?php echo $textColorOut?>" ALINK="<?php echo $textColorOut?>" VLINK="<?php echo $textColorOut?>" onLoad="document.forms[0].user.focus();">
<p><BR><BR>
<center>
<form method="POST" action="index.php">
<input type="hidden" name="logout" value=0>
<table width="280" border="0" cellspacing="0" cellpadding="0" bgcolor="<?php echo $bgcolorIn?>">
<tr><td align="center" colspan=2>
<?php
include("../conf/login_title.inc");
if (!empty($error)) echo "<font color=\"#FFAAAA\">".$error."</font><br>";
?>
</td>
</tr>
<tr><td align=right><?php echo $loginStrings[0] ?>:</td><td><input type="text" name="user" value="<?php echo $user; ?>" size=15></td></tr>
<tr><td align=right><?php echo $loginStrings[1] ?>: </td><td><input type="password" name="password" value="" size=15 AUTOCOMPLETE="off"></td></tr>
<?php
$HTTP_HOST = strtolower($_SERVER["HTTP_HOST"]);
if (is_array($VDOMAIN_DETECT) && empty($host)){
$host = $VDOMAIN_DETECT[$HTTP_HOST];
}
//empty default host
//show text box
//default host is array
//show list (select $host)
//default host is string
//show host
//don't show host
if (empty($default_host)){
echo "<tr><td align=right>".$loginStrings[2].": </td><td><input type=text name=\"host\" value=\"$host\"> </td></tr>";
}else if (is_array($default_host)){
echo "<tr><td align=right>".$loginStrings[2].":</td><td><select name=\"host\">\n";
reset($default_host);
while ( list($server, $name) = each($default_host) ){
echo "<option value=\"$server\" ".($server==$host?"SELECTED":"").">$name\n";
}
echo "</select></td></tr>";
}else{
echo "<input type=hidden name=\"host\" value=\"$default_host\">";
if (!$hide_host){
echo "<tr><td align=right>".$loginStrings[2].": </td><td><b>$host</b> ";
echo "</td></tr>";
}
}
//initialize default rootdir and port
if ((!isset($rootdir))||(empty($rootdir))) $rootdir = $default_rootdir;
if ((!isset($port))||(empty($port))) $port = $default_port;
//show (or hide) protocol selection
if (!$hide_protocol){
echo "<tr>";
echo "<td align=\"right\">".$loginStrings[3].": </td>\n<td>";
echo "<select name=\"port\">\n";
echo "<option value=\"143\" ".($port==143?"SELECTED":"").">IMAP\n";
if ($SSL_ENABLED) echo "<option value=\"993\" ".($port==993?"SELECTED":"").">IMAP-SSL\n";
echo "<option value=\"110\" ".($port==110?"SELECTED":"").">POP3\n";
echo "</select>\n";
//echo "<td><input type=\"text\" name=\"port\" value=\"$port\" size=\"4\"></td>";
echo "</td></tr>\n";
}else{
echo "<input type=\"hidden\" name=\"port\" value=\"$default_port\">\n";
}
//show (or hide) root dir box
if (!$hide_rootdir){
echo "<tr>";
echo "<td align=\"right\">".$loginStrings[4].":</td>";
echo "<td><input type=\"text\" name=\"rootdir\" value=\"$rootdir\" size=\"12\"></td>";
echo "</tr>\n";
}else{
echo "<input type=\"hidden\" name=\"rootdir\" value=\"$default_rootdir\">\n";
}
if (!$hide_lang){
echo "<tr><td align=right>".$loginStrings[5].": </td><td>\n";
echo "<select name=\"int_lang\">\n";
echo $langOptions;
echo "</select></td></tr>\n";
}
?>
<tr><td align="right" colspan="2"><input type=submit value="<?php echo $loginStrings[6] ?>"> <p> </td></tr>
</table>
</form>
<?php
include("../conf/login_blurb.inc");
?>
</center>
</body>
<?php
}
?>
</HTML>
|