/
reg.php
426 lines (393 loc) · 14 KB
/
reg.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
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<?php
/*
* AfterLogic WebMail Pro PHP by AfterLogic Corp. <support@afterlogic.com>
*
* Copyright (C) 2002-2010 AfterLogic Corp. (www.afterlogic.com)
* Distributed under the terms of the license described in COPYING
*
*/
defined('WM_ROOTPATH') || define('WM_ROOTPATH', (dirname(__FILE__).'/'));
require_once(WM_ROOTPATH.'common/inc_top.php');
require WM_ROOTPATH.'common/class_session.php';
require_once(WM_ROOTPATH.'common/inc_constants.php');
@ob_start(USE_INDEX_GZIP ? 'obStartGzip' : 'obStartNoGzip');
require_once(WM_ROOTPATH.'common/class_settings.php');
require_once(WM_ROOTPATH.'common/class_folders.php');
require_once(WM_ROOTPATH.'common/class_mailprocessor.php');
require_once(WM_ROOTPATH.'common/class_filesystem.php');
require_once WM_ROOTPATH.'common/class_tempfiles.php';
require_once WM_ROOTPATH.'common/class_log.php';
$errorClass = 'wm_hide';
$errorDesc = '';
$null = null;
$error = isset($_GET['error']) ? $_GET['error'] : '';
$isconfig = true;
unset($_SESSION[SESSION_LANG]);
$settings =& Settings::CreateInstance();
if (!$settings || !$settings->isLoad)
{
$isconfig = false;
$error = '3';
}
$langs =& FileSystem::GetLangList();
if (isset($_GET['lang']) && in_array($_GET['lang'], $langs))
{
define('defaultLanguage', $_GET['lang']);
setcookie('awm_defLang', defaultLanguage, time() + 31104000);
}
else if ($settings->AllowLanguageOnLogin && isset($_COOKIE['awm_defLang']) && in_array($_COOKIE['awm_defLang'], $langs))
{
define('defaultLanguage', $_COOKIE['awm_defLang']);
}
if (!defined('defaultLanguage'))
{
define('defaultLanguage', $settings->DefaultLanguage);
}
if ($isconfig && !$settings->IncludeLang(defaultLanguage))
{
$isconfig = false;
$error = '1';
}
if (!$settings->AllowRegistration)
{
@header('Location: ./index.php');
exit();
}
$_langDiv = '';
if ($settings->AllowLanguageOnLogin)
{
if (count($langs) > 0)
{
$_langDiv .= '
<span class="wm_language_place">
<a id="langs_selected" href="#" class="wm_reg" onclick="return false;" style="padding-right: 0px;"><span>'.GetNameByLang(defaultLanguage).'</span><font> </font><span class="wm_login_lang_switcher"> </span></a>
<input type="hidden" value="'.(isset($_GET['lang']) ? defaultLanguage : '').'" id="language" name="language">
<br />
<div id="langs_collection">';
foreach ($langs as $langName)
{
$_langDiv .= '<a href="#" name="lng_'.ConvertUtils::AttributeQuote($langName).'" onclick="ChangeLang(this); return false;">'.GetNameByLang($langName).'</a>';
}
$_langDiv .= '
</div>
</span>';
}
}
$_log =& CLog::CreateInstance($settings);
$_rtl = in_array(defaultLanguage, explode('|', RTL_ARRAY));
$_style = ($_rtl) ? '<link rel="stylesheet" href="skins/'.ConvertUtils::AttributeQuote($settings->DefaultSkin).'/styles-rtl.css" type="text/css">' : '';
$_js_rtl = ($_rtl) ? 'var RTL = true;' : '';
$_isGdSupport = @function_exists('imagecreatefrompng');
define('JS_VERS', ConvertUtils::GetJsVersion());
if (!$isconfig)
{
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Pragma" content="cache" />
<meta http-equiv="Cache-Control" content="public" />
<link rel="shortcut icon" href="favicon.ico" />
<title>WebMail is not configured properly</title>
<link rel="stylesheet" href="skins/AfterLogic/styles.css" type="text/css" />
<?php echo $_style; ?>
</head>
<body>
<div align="center" id="content" class="wm_content">
<div class="wm_logo" id="logo" tabindex="-1" onfocus="this.blur();"></div>
<br /><br />
<div class="wm_login_error">
<div class="wm_login_error_icon"></div>
<div class="wm_login_error_message">WebMail is not configured properly.</div>
</div>
<div class="wm_copyright" id="copyright">
<?php
@require('inc.footer.php');
exit('</div></div>');
}
$dbStorage =& DbStorageCreator::CreateDatabaseStorage($null);
@header('Content-type: text/html; charset=utf-8');
define('defaultTitle', $settings->WindowTitle);
$skins =& FileSystem::GetSkinsList();
foreach ($skins as $skinName)
{
if ($skinName == $settings->DefaultSkin)
{
define('defaultSkin', $settings->DefaultSkin);
break;
}
}
if (!defined('defaultSkin'))
{
define('defaultSkin', (count($skins) > 0) ? $skins[0] : 'AfterLogic');
}
$eximDomains = $dbStorage->GetDomainsArray();
foreach ($eximDomains as $idDomain => $domainArray)
{
if (isset($domainArray[2]) && !$domainArray[2])
{
unset($eximDomains[$idDomain]);
}
}
function GetDomainStringLine($eximDomains)
{
$onlyOne = (count($eximDomains) == 1);
$return = '';
if (!$onlyOne)
{
$return .= ' <select class="wm_input" id="reg_domain" style="width:130px;">';
}
foreach ($eximDomains as $domainArray)
{
if ($onlyOne)
{
$return = $domainArray[0].'<input type="hidden" id="reg_domain" value="'.$domainArray[0].'" />';
break;
}
else
{
$return .= '<option value="'.$domainArray[0].'">'.$domainArray[0].'</option>';
}
}
if (!$onlyOne)
{
$return .= '</select>';
}
return $return;
}
$domainStr = '';
if ($eximDomains && count($eximDomains) > 0)
{
$domainStr = GetDomainStringLine($eximDomains);
}
else
{
@header('Location: ./index.php');
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="shortcut icon" href="favicon.ico" />
<meta http-equiv="Pragma" content="cache" />
<meta http-equiv="Cache-Control" content="public" />
<title><?php echo defaultTitle; ?></title>
<link rel="stylesheet" href="skins/<?php echo defaultSkin; ?>/styles.css" type="text/css" id="skin" />
<link rel="stylesheet" href="skins/<?php echo defaultSkin; ?>/reg-styles.css" type="text/css" />
<?php echo $_style; ?>
<script type="text/javascript">
var NeedToSubmit = false;
var WebMailUrl = "webmail.php";
var LoginUrl = "reg.php";
var ActionUrl = "processing.php";
var LanguageUrl = "langs.js.php";
var WmVersion = "<?php echo JS_VERS; ?>";
<?php
echo $_js_rtl;
?>
</script>
<script type="text/javascript" src="langs.js.php?v=<?php echo JS_VERS; ?>&lang=<?php echo ConvertUtils::AttributeQuote(defaultLanguage); ?>"></script>
<?php if (USE_JS_GZIP && IS_SUPPORT_GZIP) { ?>
<script type="text/javascript" src="cache-loader.php?v=<?php echo JS_VERS; ?>&t=def"></script>
<script type="text/javascript" src="cache-loader.php?v=<?php echo JS_VERS; ?>&t=reg"></script>
<?php } else { ?>
<script type="text/javascript" src="js/common/defines.js"></script>
<script type="text/javascript" src="js/common/common-helpers.js"></script>
<script type="text/javascript" src="js/common/loaders.js"></script>
<script type="text/javascript" src="js/common/functions.js"></script>
<script type="text/javascript" src="js/common/popups.js"></script>
<script type="text/javascript" src="js/login/reg-screen.js"></script>
<?php } ?>
<script type="text/javascript">
function ChangeLang(object) {
if (object && object.name && object.name.length > 4 && object.name.substr(0, 4) == 'lng_') {
document.location = LoginUrl + '?lang=' + object.name.substr(4);
}
}
</script>
</head>
<body onload="Init();" id="mbody">
<table class="wm_hide" cellpadding="0" cellspacing="0" style="right: auto; width: auto; top: 0px; left: 604px;" id="info">
<tr style="position:relative;z-index:20">
<td class="wm_shadow" style="width:2px;font-size:1px;"></td>
<td>
<div class="wm_info_message" id="info_message"></div>
<div class="a"> </div>
<div class="b"> </div>
</td>
<td class="wm_shadow" style="width:2px;font-size:1px;"> </td>
</tr>
<tr>
<td colspan="3" class="wm_shadow" style="height:2px;background:none;">
<div class="a"> </div>
<div class="b"> </div>
</td>
</tr>
<tr style="position:relative;z-index:19">
<td colspan="3" style="height:2px;">
<div class="a wm_shadow" style="margin:0px 2px;height:2px; top:-4px; position:relative; border:0px;background:#555;"> </div>
</td>
</tr>
</table>
<div align="center" class="wm_content">
<div id="content">
<div class="wm_logo" id="logo" tabindex="-1" onfocus="this.blur();"></div>
</div>
<div id="registration_screen">
<div class="<?php echo $errorClass; ?>" id="reg_error">
<div class="wm_login_error_icon"></div>
<div id="reg_error_message" class="wm_login_error_message"><?php echo $errorDesc; ?></div>
</div>
<form action="reg.php?mode=submit" method="post" id="reg_form" name="reg_form" onsubmit="NeedToSubmit = true; return false;">
<div class="wm_registration" >
<div class="a top"></div>
<div class="b top"></div>
<div class="login_table">
<div class="wm_login_header" id="lang_LoginInfo">
<span id="lang_RegTitle"><?php echo RegRegistrationTitle; ?></span>
<?php echo $_langDiv; ?>
</div>
<div class="wm_login_content">
<div class="fieldset">
<br />
<div class="field">
<label id="lang_RegName"><?php echo RegName; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="text" id="reg_name" />
</span>
</div>
<div class="field">
<label id="lang_RegEmail"><?php echo RegEmail; ?>:</label>
<span class="inputfield">
<input type="text" class="wm_input" style="width:150px; text-align:right" id="reg_login" /> @<?php echo $domainStr; ?>
<span class="text_desc" id="lang_RegEmailDesc">
<?php echo RegEmailDesc; ?>
</span>
</span>
</div>
<div class="field">
<span class="inputfield">
<input class="wm_checkbox" type="checkbox" value="1" id="sign_me" name="sign_me" />
<label for="sign_me" id="lang_SignMe" style="font-size: 12px;"><?php echo RegSignMe; ?></label>
<span class="text_desc" id="lang_RegSignMeDesc">
<?php echo RegSignMeDesc; ?>
</span>
</span>
</div>
<div class="separator"></div>
<div class="field">
<label id="lang_RegPass1"><?php echo RegPass1; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="password" id="reg_pass_1" />
</span>
</div>
<div class="field">
<label id="lang_RegPass2"><?php echo RegPass2; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="password" id="reg_pass_2" />
</span>
</div>
<div class="separator"></div>
<div class="field">
<span class="inputfield">
<span class="text_desc" id="lang_RegQuestionDesc">
<?php echo RegQuestionDesc; ?>
</span>
</span>
</div>
<div class="field">
<label id="lang_RegQuestion1"><?php echo RegQuestion1; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="text" id="reg_question_1" />
</span>
</div>
<div class="field">
<label id="lang_RegAnswer1"><?php echo RegAnswer1; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="text" id="reg_answer_1" />
</span>
</div>
<div class="field">
<label id="lang_RegQuestion2"><?php echo RegQuestion2; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="text" id="reg_question_2" />
</span>
</div>
<div class="field">
<label id="lang_RegAnswer2"><?php echo RegAnswer2; ?>:</label>
<span class="inputfield">
<input class="wm_input" type="text" id="reg_answer_2" />
</span>
</div>
<div class="separator"></div>
<div class="field">
<label id="lang_RegTimeZone"><?php echo RegTimeZone; ?>:</label>
<span class="inputfield">
<select class="wm_input" id="reg_timezone">
<?php
$posTime = 0;
foreach ($TIMEZONE as $timeItem)
{
echo '<option value="'.$posTime++.'">'.$timeItem.'</option>';
}
?>
</select>
</span>
</div>
<div class="field">
<label id="lang_RegLang"><?php echo RegLang; ?>:</label>
<span class="inputfield">
<select class="wm_input" id="reg_lang">
<?php
foreach ($langs as $lang)
{
$selected = (defaultLanguage === $lang) ? ' selected="selected"' : '';
echo '<option value="'.$lang.'"'.$selected.'>'.GetNameByLang($lang).'</option>';
}
?>
</select>
</span>
</div>
<?php if ($_isGdSupport): ?>
<div class="separator"></div>
<div class="field">
<label id="lang_RegCaptcha"><?php echo RegCaptcha; ?>:</label>
<span class="inputfield">
<input style="width:95px; font-size:16px;" class="wm_input" type="text" id="captcha" name="captcha" maxlength="6"
onfocus="this.className = 'wm_input_focus';" onblur="this.className = 'wm_input';" />
<br /><br />
<img src="captcha.php?<?php echo 'PHPWEBMAILSESSID='.@session_id().'&c='.rand(100, 999); ?>"
id="captcha_img" width="120" height="46" class="wm_chaptcha" />
<br />
<a href="#" class="wm_reg" id="lang_CaptchaReloadLink"><?php echo CaptchaReloadLink; ?></a>
</span>
</div>
<?php endif; ?>
<div class="separator"></div>
<div class="field" style="text-align:right">
<input class="wm_button" type="submit" id="submitId" name="submitName" value="<?php echo RegSubmitButtonValue; ?>" />
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="b"></div>
<div class="a"></div>
</div>
</form>
<div class="clear"></div>
</div>
<a class="wm_reg_link" href="index.php" id="return_id"><?php echo RegReturnLink; ?></a>
<div id="dummy"></div>
</div>
<div class="wm_copyright" id="copyright">
<?php @require('inc.footer.php'); ?>
</div>
</body>
</html>
<?php
echo '<!-- '.WMVERSION.' -->';