diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-05-18 07:01:51 -0500 |
---|---|---|
committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-05-18 07:01:51 -0500 |
commit | 367b3dac8c910e7877139d4631e63e44f4f843f0 (patch) | |
tree | 2fd1188a790a3a319de05db98e58fcd89d4bc7a5 /phpBB/includes/functions_admin.php | |
parent | 1c1452d758240b98ed711311c408993da0569895 (diff) | |
parent | 48e1be58db26ba09f7421082038f1f6353a38e91 (diff) | |
download | forums-367b3dac8c910e7877139d4631e63e44f4f843f0.tar forums-367b3dac8c910e7877139d4631e63e44f4f843f0.tar.gz forums-367b3dac8c910e7877139d4631e63e44f4f843f0.tar.bz2 forums-367b3dac8c910e7877139d4631e63e44f4f843f0.tar.xz forums-367b3dac8c910e7877139d4631e63e44f4f843f0.zip |
Merge remote-tracking branch 'remotes/blitze/ticket/11458' into develop
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index d273b9fb3a..d9e445cff9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3040,38 +3040,29 @@ function tidy_database() */ function add_permission_language() { - global $user, $phpEx; + global $user, $phpEx, $phpbb_extension_manager; - // First of all, our own file. We need to include it as the first file because it presets all relevant variables. - $user->add_lang('acp/permissions_phpbb'); + // add permission language files from extensions + $finder = $phpbb_extension_manager->get_finder(); - $files_to_add = array(); + $lang_files = $finder + ->prefix('permissions_') + ->suffix(".$phpEx") + ->core_path('language/' . $user->lang_name . '/') + ->extension_directory('/language/' . $user->lang_name) + ->find(); - // Now search in acp and mods folder for permissions_ files. - foreach (array('acp/', 'mods/') as $path) + foreach ($lang_files as $lang_file => $ext_name) { - $dh = @opendir($user->lang_path . $user->lang_name . '/' . $path); - - if ($dh) + if ($ext_name === '/') { - while (($file = readdir($dh)) !== false) - { - if ($file !== 'permissions_phpbb.' . $phpEx && strpos($file, 'permissions_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) - { - $files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1)); - } - } - closedir($dh); + $user->add_lang($lang_file); + } + else + { + $user->add_lang_ext($ext_name, $lang_file); } } - - if (!sizeof($files_to_add)) - { - return false; - } - - $user->add_lang($files_to_add); - return true; } /** |