Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
e598dddb
Unverified
Commit
e598dddb
authored
5 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
fix(config) Forbid setting of unavailable locale
issue
#6051
parent
666282fa
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class_Language.inc
+20
-0
include/class_Language.inc
plugins/config/class_configInLdap.inc
+3
-0
plugins/config/class_configInLdap.inc
with
23 additions
and
0 deletions
+23
-0
include/class_Language.inc
+
20
−
0
View file @
e598dddb
...
...
@@ -127,6 +127,26 @@ class Language
return
al2gt
(
$langs
);
}
/*!
* \brief Checks if a locale is available
*
* \param string $lang Language locale to use
*/
public
static
function
isAvailable
(
string
$lang
):
bool
{
/* Store current locale */
$locale
=
setlocale
(
LC_ALL
,
0
);
/* Try to switch */
list
(
$language
,
,
$char
)
=
parse_gettext_lang
(
$lang
);
$langset
=
setlocale
(
LC_ALL
,
$lang
,
$language
.
'.'
.
$char
);
/* Set current locale back */
setlocale
(
LC_ALL
,
$locale
);
return
(
$langset
!==
FALSE
);
}
/*!
* \brief Get the language for the user connecting
*
...
...
This diff is collapsed.
Click to expand it.
plugins/config/class_configInLdap.inc
+
3
−
0
View file @
e598dddb
...
...
@@ -533,6 +533,9 @@ class configInLdap extends simplePlugin
if
((
$this
->
fdPasswordDefaultHash
==
'sasl'
)
&&
(
$this
->
fdSaslRealm
==
''
)
&&
(
$this
->
fdSaslExop
==
''
))
{
$messages
[]
=
_
(
'You need to fill saslRealm or saslExop in the configuration screen in order to use SASL'
);
}
if
(
$this
->
attributesAccess
[
'fdLanguage'
]
->
hasChanged
()
&&
(
$this
->
fdLanguage
!=
''
)
&&
!
Language
::
isAvailable
(
$this
->
fdLanguage
))
{
$messages
[]
=
sprintf
(
_
(
'It seems the selected language "%s" is not installed on the system. Please install it or select an other one.'
),
$this
->
fdLanguage
);
}
return
$messages
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets