|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class ChangePasswordVpopmailPlugin extends \RainLoop\Plugins\AbstractPlugin |
|
4
|
|
|
{ |
|
5
|
|
|
public function Init() |
|
6
|
|
|
{ |
|
7
|
|
|
$this->addHook('main.fabrica', 'MainFabrica'); |
|
8
|
|
|
} |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @param string $sName |
|
12
|
|
|
* @param mixed $oProvider |
|
13
|
|
|
*/ |
|
14
|
|
|
public function MainFabrica($sName, &$oProvider) |
|
15
|
|
|
{ |
|
16
|
|
|
switch ($sName) |
|
17
|
|
|
{ |
|
18
|
|
|
case 'change-password': |
|
19
|
|
|
|
|
20
|
|
|
include_once __DIR__.'/ChangePasswordVpopmailDriver.php'; |
|
21
|
|
|
|
|
22
|
|
|
$oProvider = new ChangePasswordVpopmailDriver(); |
|
23
|
|
|
|
|
24
|
|
|
$sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ', |
|
25
|
|
|
$this->Config()->Get('plugin', 'domains', '')))); |
|
26
|
|
|
|
|
27
|
|
|
if (0 < \strlen($sDomains)) |
|
28
|
|
|
{ |
|
29
|
|
|
$aDomains = \explode(' ', $sDomains); |
|
30
|
|
|
$oProvider->SetAllowedDomains($aDomains); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
$oProvider |
|
34
|
|
|
->SetLogger($this->Manager()->Actions()->Logger()) |
|
35
|
|
|
->SetmHost($this->Config()->Get('plugin', 'mHost', '')) |
|
36
|
|
|
->SetmUser($this->Config()->Get('plugin', 'mUser', '')) |
|
37
|
|
|
->SetmPass($this->Config()->Get('plugin', 'mPass', '')) |
|
38
|
|
|
->SetmDatabase($this->Config()->Get('plugin', 'mDatabase', '')) |
|
39
|
|
|
->SetmTable($this->Config()->Get('plugin', 'mTable', '')) |
|
40
|
|
|
->SetmColumn($this->Config()->Get('plugin', 'mColumn', '')) |
|
41
|
|
|
; |
|
42
|
|
|
|
|
43
|
|
|
break; |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return array |
|
49
|
|
|
*/ |
|
50
|
|
|
public function configMapping() |
|
51
|
|
|
{ |
|
52
|
|
|
return array( |
|
53
|
|
|
\RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains') |
|
54
|
|
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) |
|
55
|
|
|
->SetDescription('Allowed domains, space as delimiter') |
|
56
|
|
|
->SetDefaultValue('gmail.com yahoo.com'), |
|
57
|
|
|
\RainLoop\Plugins\Property::NewInstance('mHost')->SetLabel('MySQL Host') |
|
58
|
|
|
->SetDefaultValue('localhost'), |
|
59
|
|
|
\RainLoop\Plugins\Property::NewInstance('mUser')->SetLabel('MySQL User') |
|
60
|
|
|
->SetDefaultValue('vpopmail'), |
|
61
|
|
|
\RainLoop\Plugins\Property::NewInstance('mPass')->SetLabel('MySQL Password') |
|
62
|
|
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD), |
|
63
|
|
|
\RainLoop\Plugins\Property::NewInstance('mDatabase')->SetLabel('MySQL Database') |
|
64
|
|
|
->SetDefaultValue('vpopmail'), |
|
65
|
|
|
\RainLoop\Plugins\Property::NewInstance('mTable')->SetLabel('MySQL Table') |
|
66
|
|
|
->SetDefaultValue('vpopmail'), |
|
67
|
|
|
\RainLoop\Plugins\Property::NewInstance('mColumn')->SetLabel('MySQL Column') |
|
68
|
|
|
->SetDefaultValue('pw_passwd') |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|