/
admin-panel.php
56 lines (49 loc) · 1.22 KB
/
admin-panel.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
<?php
// api
include_once WM_INSTALLER_PATH.'../libraries/afterlogic/api.php';
class CAdminpanelStep extends AInstallerStep
{
/**
* @var api_Settings
*/
protected $oSettings;
public function __construct()
{
$this->oSettings =& CApi::GetSettings();
}
public function DoPost()
{
if (isset($_POST['next_btn']))
{
if (5 > strlen(trim(CPost::get('txtPassword1', ''))))
{
CSession::Set('wm_install_pass_error', 'Minimum password length is 5 characters.');
}
else if (CPost::get('txtPassword1', '') !== CPost::get('txtPassword2', ''))
{
CSession::Set('wm_install_pass_error', 'The password and its confirmation don\'t match.');
}
else
{
$this->oSettings->SetConf('Common/AdminPassword', crypt(trim(CPost::get('txtPassword1')), CApi::$sSalt));
return $this->oSettings->SaveToXml();
}
}
return false;
}
public function TemplateValues()
{
$sFootError = '';
if (CSession::Has('wm_install_pass_error'))
{
$sFootError = CSession::get('wm_install_pass_error', '');
CSession::clear('wm_install_pass_error');
}
return array(
'Login' => $this->oSettings->GetConf('Common/AdminLogin'),
'Password1' => '',
'Password2' => '',
'FootError' => $sFootError,
);
}
}