aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_module.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r--phpBB/includes/functions_module.php52
1 files changed, 45 insertions, 7 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index b7615e923b..f17333edda 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -250,13 +250,25 @@ class p_master
// Function for building 'url_extra'
$short_name = $this->get_short_name($row['module_basename']);
- $url_func = '_module_' . $short_name . '_url';
+ $url_func = 'phpbb_module_' . $short_name . '_url';
+ if (!function_exists($url_func))
+ {
+ $url_func = '_module_' . $short_name . '_url';
+ }
// Function for building the language name
- $lang_func = '_module_' . $short_name . '_lang';
+ $lang_func = 'phpbb_module_' . $short_name . '_lang';
+ if (!function_exists($lang_func))
+ {
+ $lang_func = '_module_' . $short_name . '_lang';
+ }
// Custom function for calling parameters on module init (for example assigning template variables)
- $custom_func = '_module_' . $short_name;
+ $custom_func = 'phpbb_module_' . $short_name;
+ if (!function_exists($custom_func))
+ {
+ $custom_func = '_module_' . $short_name;
+ }
$names[$row['module_basename'] . '_' . $row['module_mode']][] = true;
@@ -1028,19 +1040,45 @@ class p_master
*/
function add_mod_info($module_class)
{
- global $user, $phpEx;
-
- global $phpbb_extension_manager;
+ global $config, $user, $phpEx, $phpbb_extension_manager;
$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('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/' . basename($config['default_lang']))
+ ->core_path('language/' . basename($config['default_lang']) . '/mods/')
+ ->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('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/en')
+ ->core_path('language/en/mods/')
+ ->find();
+ }
+
+ // Find files in the user's language
+ $user_lang_files = $finder
->prefix('info_' . strtolower($module_class) . '_')
->suffix(".$phpEx")
->extension_directory('/language/' . $user->lang_name)
->core_path('language/' . $user->lang_name . '/mods/')
->find();
+ $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files));
foreach ($lang_files as $lang_file => $ext_name)
{
$user->add_lang_ext($ext_name, $lang_file);