mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11458] We still auto add language files from the mods and acp
folders in the language directory, so we revert some changes here PHPBB3-11458
This commit is contained in:
parent
323a494cd1
commit
474b4a60a5
1 changed files with 31 additions and 4 deletions
|
@ -3045,20 +3045,47 @@ function add_permission_language()
|
||||||
// First of all, our own file. We need to include it as the first file because it presets all relevant variables.
|
// 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');
|
$user->add_lang('acp/permissions_phpbb');
|
||||||
|
|
||||||
// add permission language files from extensions
|
$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
|
||||||
$finder = $phpbb_extension_manager->get_finder();
|
$finder = $phpbb_extension_manager->get_finder();
|
||||||
|
|
||||||
$lang_files = $finder
|
$ext_lang_files = $finder
|
||||||
->prefix('permissions_')
|
->prefix('permissions_')
|
||||||
->suffix(".$phpEx")
|
->suffix(".$phpEx")
|
||||||
->extension_directory('/language/' . $user->lang_name)
|
->extension_directory('/language/' . $user->lang_name)
|
||||||
->core_path('language/' . $user->lang_name . '/mods')
|
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
foreach ($lang_files as $lang_file => $ext_name)
|
foreach ($ext_lang_files as $lang_file => $ext_name)
|
||||||
{
|
{
|
||||||
$user->add_lang_ext($ext_name, $lang_file);
|
$user->add_lang_ext($ext_name, $lang_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sizeof($files_to_add))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->add_lang($files_to_add);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue