aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2016-04-02 13:02:14 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2016-04-02 13:02:14 +0200
commitccdf8e7ee1753a962f673d7b261166b1317384c2 (patch)
tree0d8fa2d4a1ff06198d1ec49c64754feb645ad221 /phpBB/includes
parent0a9c049f76ab4a812a3ec3717fb84cd3b3011a9b (diff)
parent621b958b1ca41e1def6349e07e0e3c8258a9d9f3 (diff)
downloadforums-ccdf8e7ee1753a962f673d7b261166b1317384c2.tar
forums-ccdf8e7ee1753a962f673d7b261166b1317384c2.tar.gz
forums-ccdf8e7ee1753a962f673d7b261166b1317384c2.tar.bz2
forums-ccdf8e7ee1753a962f673d7b261166b1317384c2.tar.xz
forums-ccdf8e7ee1753a962f673d7b261166b1317384c2.zip
Merge pull request #4270 from kasimi/ticket/14562
[ticket/14562] Language fallback for extension permissions * kasimi/ticket/14562: [ticket/14562] Language fallback for extension permissions
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_admin.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index b3641a2b45..4ecb7b9354 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -3320,18 +3320,47 @@ function tidy_database()
*/
function add_permission_language()
{
- global $user, $phpEx, $phpbb_extension_manager;
+ global $config, $user, $phpEx, $phpbb_extension_manager;
// add permission language files from extensions
$finder = $phpbb_extension_manager->get_finder();
- $lang_files = $finder
+ // We grab the language files from the default, English and user's language.
+ // So we can fall back to the other files like we do when using add_lang()
+ $default_lang_files = $english_lang_files = $user_lang_files = array();
+
+ // Search for board default language if it's not the user language
+ if ($config['default_lang'] != $user->lang_name)
+ {
+ $default_lang_files = $finder
+ ->prefix('permissions_')
+ ->suffix(".$phpEx")
+ ->core_path('language/' . basename($config['default_lang']) . '/')
+ ->extension_directory('/language/' . basename($config['default_lang']))
+ ->find();
+ }
+
+ // Search for english, if its not the default or user language
+ if ($config['default_lang'] != 'en' && $user->lang_name != 'en')
+ {
+ $english_lang_files = $finder
+ ->prefix('permissions_')
+ ->suffix(".$phpEx")
+ ->core_path('language/en/')
+ ->extension_directory('/language/en')
+ ->find();
+ }
+
+ // Find files in the user's language
+ $user_lang_files = $finder
->prefix('permissions_')
->suffix(".$phpEx")
->core_path('language/' . $user->lang_name . '/')
->extension_directory('/language/' . $user->lang_name)
->find();
+ $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files);
+
foreach ($lang_files as $lang_file => $ext_name)
{
if ($ext_name === '/')