mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Improve ENV replacement
This commit is contained in:
parent
338f18d2af
commit
0f981a9e51
2 changed files with 19 additions and 10 deletions
|
|
@ -66,15 +66,26 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
$sKey = \strtolower($sSection.'.'.$sName);
|
$sKey = \strtolower($sSection.'.'.$sName);
|
||||||
if (\in_array($sKey, $this->aReplaceEnv) && false !== strpos($mResult, '$'))
|
if (\in_array($sKey, $this->aReplaceEnv) && false !== strpos($mResult, '$'))
|
||||||
{
|
{
|
||||||
foreach ($_ENV as $sKey => $sValue)
|
$mResult = \preg_replace_callback('/\$([^\s]+)/', function($aMatch) {
|
||||||
{
|
|
||||||
$mResult = \str_replace('$'.$sKey, $sValue, $mResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($_SERVER as $sKey => $sValue)
|
if (!empty($aMatch[0]) && !empty($aMatch[1]))
|
||||||
{
|
{
|
||||||
$mResult = \str_replace('$'.$sKey, $sValue, $mResult);
|
if (!empty($_ENV[$aMatch[1]]))
|
||||||
}
|
{
|
||||||
|
return $_SERVER[$aMatch[1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_SERVER[$aMatch[1]]))
|
||||||
|
{
|
||||||
|
return $_SERVER[$aMatch[1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $aMatch[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
|
||||||
|
}, $mResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -619,7 +619,6 @@ class PdoAddressBook
|
||||||
foreach ($aPaths as $sKey => $sValue)
|
foreach ($aPaths as $sKey => $sValue)
|
||||||
{
|
{
|
||||||
$sValue = \MailSo\Base\Utils::StrToLowerIfAscii($sValue);
|
$sValue = \MailSo\Base\Utils::StrToLowerIfAscii($sValue);
|
||||||
|
|
||||||
if (\in_array($sValue, array('contacts', 'default', 'addressbook', 'address book')))
|
if (\in_array($sValue, array('contacts', 'default', 'addressbook', 'address book')))
|
||||||
{
|
{
|
||||||
$sNewPath = $sKey;
|
$sNewPath = $sKey;
|
||||||
|
|
@ -639,7 +638,6 @@ class PdoAddressBook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sPath = $sNewPath;
|
$sPath = $sNewPath;
|
||||||
|
|
||||||
$bGood = $this->checkContactsPath($oClient, $sPath);
|
$bGood = $this->checkContactsPath($oClient, $sPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue