summaryrefslogtreecommitdiffstats
path: root/lib/private/l10n
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-01-15 11:25:35 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-01-26 14:02:31 +0100
commit7ec7464ee249f15d377a44c1b8b23e127e07385e (patch)
tree95a39bdd668a183ca2fca388d1cafae5ea164b86 /lib/private/l10n
parent043625ee522357e25bb786c4b439c90ab21bbfd1 (diff)
downloadnextcloud-server-7ec7464ee249f15d377a44c1b8b23e127e07385e.tar.gz
nextcloud-server-7ec7464ee249f15d377a44c1b8b23e127e07385e.zip
Move validation and fallbacks of app and lang to the constructor/factory
Diffstat (limited to 'lib/private/l10n')
-rw-r--r--lib/private/l10n/factory.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php
index ecc2318893a..39d69c81935 100644
--- a/lib/private/l10n/factory.php
+++ b/lib/private/l10n/factory.php
@@ -71,9 +71,14 @@ class Factory implements IFactory {
* @return \OCP\IL10N
*/
public function get($app, $lang = null) {
+ $app = \OC_App::cleanAppId($app);
+ if ($lang !== null) {
+ $lang = str_replace(array('\0', '/', '\\', '..'), '', (string) $lang);
+ }
$key = $lang;
- if ($key === null) {
+ if ($key === null || !$this->languageExists($app, $lang)) {
$key = 'null';
+ $lang = $this->findLanguage($app);
}
if (!isset($this->instances[$key][$app])) {