1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/10824] Display message about invalid styles on install style view

PHPBB3-10824
This commit is contained in:
Marc Alexander 2016-01-17 23:24:22 +01:00
parent b0337b21d5
commit 81f3483994
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
3 changed files with 51 additions and 1 deletions

View File

@ -127,7 +127,7 @@
<!-- IF styles_list.COMMENT != '' -->
<span class="error"><br />{styles_list.COMMENT}</span>
<!-- ENDIF -->
<!-- IF not styles_list.STYLE_ID and styles_list.COMMENT == '' -->
<!-- IF not styles_list.STYLE_ID and styles_list.COMMENT == '' and not styles_list.STYLE_INVALID -->
<span class="style-path"><br />{L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}</span>
<!-- ENDIF -->
</td>

View File

@ -711,6 +711,12 @@ class acp_styles
// Show styles
foreach ($styles as &$style)
{
if (!$style['_available'] && !empty($style['_invalid']))
{
$this->list_invalid($style);
continue;
}
// Check if style has a parent style in styles list
$has_parent = false;
if ($style['_inherit_name'] != '')
@ -795,6 +801,13 @@ class acp_styles
catch (\DomainException $e)
{
// Invalid composer.json
$style = array(
'_available' => false,
'_invalid' => true,
'style_path' => $dir,
);
$styles[] = $style;
continue;
}
@ -1076,6 +1089,42 @@ class acp_styles
$this->style_counters['total']++;
}
/**
* List invalid style
*
* @param array $style Array with info about style to display as invalid
*/
protected function list_invalid(&$style)
{
$style['_shown'] = true;
$row = array(
// Style data
'STYLE_INVALID' => true,
'STYLE_NAME' => $this->user->lang('INVALID_STYLE_MESSAGE', $style['style_path']),
);
$this->template->assign_block_vars('styles_list', $row);
$this->template->assign_block_vars('styles_list.actions', array(
'HTML' => $this->user->lang['CANNOT_BE_INSTALLED']
));
// Increase counters
if (!isset($this->style_counters))
{
$this->style_counters = array(
'total' => 0,
'active' => 0,
'inactive' => 0,
'caninstall' => 0,
'cannotinstall' => 0
);
}
$this->style_counters['cannotinstall']++;
$this->style_counters['total']++;
}
/**
* Show welcome message
*

View File

@ -54,6 +54,7 @@ $lang = array_merge($lang, [
'INSTALL_STYLES' => 'Install styles',
'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.<br>If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.',
'INVALID_STYLE_ID' => 'Invalid style ID.',
'INVALID_STYLE_MESSAGE' => 'The directory <strong><i>%1$s</i></strong> does not contain a valid style.',
'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.',
'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.',