diff options
author | OpenShift guest <dachebodt@gmail.com> | 2013-05-10 10:15:25 -0400 |
---|---|---|
committer | OpenShift guest <dachebodt@gmail.com> | 2013-05-10 10:15:25 -0400 |
commit | a50d23078e8964396bda1e2c9cfc6e503f4f6fb9 (patch) | |
tree | 1e5c86fe8fea45bc0f54fa17e0594efbfa5e9691 /phpBB/includes | |
parent | 109b1a3a952f8a590f6613c8d940e6d01b755af7 (diff) | |
download | forums-a50d23078e8964396bda1e2c9cfc6e503f4f6fb9.tar forums-a50d23078e8964396bda1e2c9cfc6e503f4f6fb9.tar.gz forums-a50d23078e8964396bda1e2c9cfc6e503f4f6fb9.tar.bz2 forums-a50d23078e8964396bda1e2c9cfc6e503f4f6fb9.tar.xz forums-a50d23078e8964396bda1e2c9cfc6e503f4f6fb9.zip |
[ticket/11458] Use finder to get all permission language files
PHPBB3-11458
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_admin.php | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index b5efa49159..d9e445cff9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3042,50 +3042,27 @@ function add_permission_language() { 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'); - - $files_to_add = array(); - - // Now search in acp and mods folder for permissions_ files. - foreach (array('acp/', 'mods/') as $path) - { - $dh = @opendir($user->lang_path . $user->lang_name . '/' . $path); - - if ($dh) - { - 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); - } - } - - // find permission language files from extensions + // add permission language files from extensions $finder = $phpbb_extension_manager->get_finder(); - $ext_lang_files = $finder + $lang_files = $finder ->prefix('permissions_') ->suffix(".$phpEx") + ->core_path('language/' . $user->lang_name . '/') ->extension_directory('/language/' . $user->lang_name) ->find(); - foreach ($ext_lang_files as $lang_file => $ext_name) + foreach ($lang_files as $lang_file => $ext_name) { - $user->add_lang_ext($ext_name, $lang_file); - } - - if (!sizeof($files_to_add)) - { - return false; + if ($ext_name === '/') + { + $user->add_lang($lang_file); + } + else + { + $user->add_lang_ext($ext_name, $lang_file); + } } - - $user->add_lang($files_to_add); - return true; } /** |