clearfiy structure
This commit is contained in:
parent
943b7c6bb2
commit
6ef61cdb8a
@ -17,22 +17,25 @@ function presets($_action, $_data = null)
|
|||||||
global $lang;
|
global $lang;
|
||||||
if ($_action === 'get') {
|
if ($_action === 'get') {
|
||||||
$kind = strtolower(trim($_data));
|
$kind = strtolower(trim($_data));
|
||||||
if (!in_array($kind, ['rspamd', 'sieve'], true)) {
|
$langSection = 'admin';
|
||||||
|
|
||||||
|
if (!in_array($kind, ['admin-rspamd', 'mailbox-sieve'], true)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($kind === 'mailbox-sieve') {
|
||||||
|
$langSection = 'mailbox';
|
||||||
|
}
|
||||||
|
|
||||||
$presets = [];
|
$presets = [];
|
||||||
foreach (glob(__DIR__ . '/presets/' . $kind . '/*.yml') as $filename) {
|
foreach (glob(__DIR__ . '/presets/' . $kind . '/*.yml') as $filename) {
|
||||||
$preset = Spyc::YAMLLoad($filename);
|
$preset = Spyc::YAMLLoad($filename);
|
||||||
|
|
||||||
/* get translated headlines */
|
/* get translated headlines */
|
||||||
if (isset($preset['headline']) && strpos($preset['headline'], 'lang.') === 0) {
|
if (isset($preset['headline']) && strpos($preset['headline'], 'lang.') === 0) {
|
||||||
$textName = trim(substr($preset['headline'], 5));
|
$langTextName = trim(substr($preset['headline'], 5));
|
||||||
|
if (isset($lang[$langSection][$langTextName])) {
|
||||||
if ($kind === 'rspamd') {
|
$preset['headline'] = $lang[$langSection][$langTextName];
|
||||||
$preset['headline'] = $lang['admin'][$textName];
|
|
||||||
} elseif ($kind === 'sieve') {
|
|
||||||
$preset['headline'] = $lang['mailbox'][$textName];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user