[ticket/10824] Use correct language and style composer.json data

PHPBB3-10824
This commit is contained in:
Marc Alexander 2018-12-28 16:38:09 +01:00
parent 204f81c6f7
commit adf9f49a42
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 32 additions and 17 deletions

View file

@ -121,6 +121,18 @@ class acp_language
$lang_iso = $lang_entries['lang_iso'];
/** @var \phpbb\language\language_file_helper $language_helper */
$language_helper = $phpbb_container->get('language.helper.language_file');
try
{
$lang_cfg = $language_helper->get_language_data_from_composer_file("{$phpbb_root_path}language/$lang_iso/composer.json");
}
catch (\DomainException $e)
{
trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$template->assign_vars(array(
'S_DETAILS' => true,
'U_ACTION' => $this->u_action . "&action=details&id=$lang_id",
@ -129,6 +141,8 @@ class acp_language
'LANG_LOCAL_NAME' => $lang_entries['lang_local_name'],
'LANG_ENGLISH_NAME' => $lang_entries['lang_english_name'],
'LANG_ISO' => $lang_iso,
'LANG_VERSION' => $lang_cfg['version'],
'LANG_PHPBB_VERSION' => $lang_cfg['phpbb_version'],
'LANG_AUTHOR' => $lang_entries['lang_author'],
'L_MISSING_FILES' => $user->lang('THOSE_MISSING_LANG_FILES', $lang_entries['lang_local_name']),
'L_MISSING_VARS_EXPLAIN' => $user->lang('THOSE_MISSING_LANG_VARIABLES', $lang_entries['lang_local_name']),

View file

@ -462,7 +462,7 @@ class acp_styles
}
// Read style configuration file
$style_cfg = $this->read_style_cfg($style['style_path']);
$style_cfg = $this->read_style_composer_file($style['style_path']);
// Find all available parent styles
$list = $this->find_possible_parents($styles, $id);
@ -611,13 +611,12 @@ class acp_styles
'STYLE_ID' => $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name'], ENT_COMPAT),
'STYLE_PATH' => htmlspecialchars($style['style_path'], ENT_COMPAT),
'STYLE_VERSION' => htmlspecialchars($style_cfg['style_version'], ENT_COMPAT),
'STYLE_VERSION' => htmlspecialchars($style_cfg['version'], ENT_COMPAT),
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_PARENT' => $style['style_parent_id'],
'S_STYLE_ACTIVE' => $style['style_active'],
'S_STYLE_DEFAULT' => ($style['style_id'] == $this->default_style)
)
);
));
}
/**
@ -985,7 +984,7 @@ class acp_styles
'STYLE_ID' => $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name'], ENT_COMPAT),
'STYLE_VERSION' => $style_cfg['style_version'] ?? '-',
'STYLE_PHPBB_VERSION' => $style_cfg['phpbb_version'],
'STYLE_PHPBB_VERSION' => $this->read_style_composer_file($style['style_path'])['extra']['phpbb-version'],
'STYLE_PATH' => htmlspecialchars($style['style_path'], ENT_COMPAT),
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_ACTIVE' => $style['style_active'],

View file

@ -105,6 +105,8 @@ class language_file_helper
'name' => $data['extra']['english-name'],
'local_name' => $data['extra']['local-name'],
'author' => implode(', ', $authors),
'version' => $data['version'],
'phpbb_version' => $data['extra']['phpbb-version'],
);
}
}