Skip to content

Commit 7c6b24b

Browse files
committed
Ensure filemanager config is writable before trying to load/save settings in acp
1 parent bad2722 commit 7c6b24b

File tree

7 files changed

+396
-129
lines changed

7 files changed

+396
-129
lines changed

acp/settings_module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ protected function save_filemanager_settings(array &$config)
309309
$this->config->set('sm_filemanager', false);
310310
$filemanager_docs = 'https://blitze.github.io/phpBB-ext-sitemaker/docs/' . $this->user->data['user_lang'] . '/filemanager';
311311

312-
trigger_error($this->translator->lang('FILEMANAGER_NO_EXIST', $filemanager_docs) . adm_back_link($this->u_action), E_USER_WARNING);
312+
trigger_error($this->translator->lang($this->filemanager->get_error(), $filemanager_docs) . adm_back_link($this->u_action), E_USER_WARNING);
313313
}
314314
}
315315
}

adm/style/acp_settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h3>{{ lang('FILEMANAGER_SETTINGS') }}</h3>
8686
</dd>
8787
</dl>
8888
<div id="filemanager-settings">
89-
{% if filemanager|length %}
89+
{% if filemanager is iterable %}
9090
{% set image_modes = ['exact', 'portrait', 'landscape', 'auto', 'crop'] %}
9191
<dl>
9292
<dt><label for="filemanager_max_image">{{ lang('FILEMANAGER_IMAGE_MAX_DIMENSIONS') }}</label><br /><span>{{ lang('MAX_AVATAR_SIZE_EXPLAIN') }}</span></dt>
@@ -148,7 +148,7 @@ <h3>{{ lang('FILEMANAGER_SETTINGS') }}</h3>
148148
<dd><input id="filemanager_watermark_padding" type="number" min="0" name="filemanager[image_watermark_padding]" value="{{ filemanager.image_watermark_padding }}" /> {{ lang('PIXEL') }}</dd>
149149
</dl>
150150
{% else %}
151-
<p>{{ lang('FILEMANAGER_NO_EXIST', 'https://blitze.github.io/phpBB-ext-sitemaker/docs/' ~ sm_user_lang ~ '/filemanager') }}</p>
151+
<p>{{ lang(filemanager, 'https://blitze.github.io/phpBB-ext-sitemaker/docs/' ~ sm_user_lang ~ '/filemanager') }}</p>
152152
{% endif %}
153153
</div>
154154
</fieldset>

language/en/info_acp_settings.php

Lines changed: 68 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
<?php
22

33
/**
4-
*
5-
* @package phpBB Sitemaker [English]
64
* @copyright (c) 2013 Daniel A. (blitze)
75
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
8-
*
96
*/
107

118
/**
129
* @ignore
1310
*/
14-
if (!defined('IN_PHPBB'))
15-
{
16-
exit;
11+
if (!defined('IN_PHPBB')) {
12+
exit;
1713
}
1814

19-
if (empty($lang) || !is_array($lang))
20-
{
21-
$lang = array();
15+
if (empty($lang) || !is_array($lang)) {
16+
$lang = [];
2217
}
2318

2419
// DEVELOPERS PLEASE NOTE
@@ -37,74 +32,75 @@
3732
// ’ » “ ” …
3833
//
3934

40-
$lang = array_merge($lang, array(
41-
'ACP_SITEMAKER' => 'SiteMaker',
42-
'ACP_SM_SETTINGS' => 'Settings',
35+
$lang = array_merge($lang, [
36+
'ACP_SITEMAKER' => 'SiteMaker',
37+
'ACP_SM_SETTINGS' => 'Settings',
4338

44-
'BLOCKS_CLEANUP' => 'Blocks Cleanup',
45-
'BLOCKS_CLEANUP_EXPLAIN' => 'The following items were found to no longer exist or unreachable, and you can therefore delete all blocks associated to them. Please keep in mind that some of these may be false positives',
46-
'BLOCKS_CLEANUP_BLOCKS' => 'Invalid Blocks (e.g. from uninstalled extensions):',
47-
'BLOCKS_CLEANUP_ROUTES' => 'Unreachable/broken Pages:',
48-
'BLOCKS_CLEANUP_STYLES' => 'Uninstalled Styles (ids):',
49-
'BLOCKS_CLEANUP_SUCCESS' => 'Blocks purged sucessfully',
39+
'BLOCKS_CLEANUP' => 'Blocks Cleanup',
40+
'BLOCKS_CLEANUP_EXPLAIN' => 'The following items were found to no longer exist or unreachable, and you can therefore delete all blocks associated to them. Please keep in mind that some of these may be false positives',
41+
'BLOCKS_CLEANUP_BLOCKS' => 'Invalid Blocks (e.g. from uninstalled extensions):',
42+
'BLOCKS_CLEANUP_ROUTES' => 'Unreachable/broken Pages:',
43+
'BLOCKS_CLEANUP_STYLES' => 'Uninstalled Styles (ids):',
44+
'BLOCKS_CLEANUP_SUCCESS' => 'Blocks purged sucessfully',
5045

51-
'FILEMANAGER_SETTINGS' => 'File Manager Settings',
52-
'FILEMANAGER_STATUS' => 'Status',
53-
'FILEMANAGER_NO_EXIST' => 'You will need to install the File Manager before you can enable it. Installation instructions are found <a href="%s" target="_blank" rel="noopener noreferrer"><strong>here</strong></a>',
54-
'FILEMANAGER_IMAGE_AUTO_RESIZE' => 'Automatically resize uploaded images?',
55-
'FILEMANAGER_IMAGE_AUTO_RESIZE_DIMENSIONS' => 'Resize to specified dimensions',
56-
'FILEMANAGER_IMAGE_AUTO_RESIZING_MODE' => 'Auto resizing mode',
57-
'FILEMANAGER_IMAGE_MAX_DIMENSIONS' => 'Max. image size',
58-
'FILEMANAGER_IMAGE_MAX_MODE' => 'Max. image size mode',
59-
'FILEMANAGER_IMAGE_MODE_EXPLAIN' => 'Used to calculate the height/width if you only provide height or width but not both above',
60-
'FILEMANAGER_IMAGE_MODE_AUTO' => 'Auto',
61-
'FILEMANAGER_IMAGE_MODE_CROP' => 'Crop',
62-
'FILEMANAGER_IMAGE_MODE_EXACT' => 'Exact',
63-
'FILEMANAGER_IMAGE_MODE_LANDSCAPE' => 'Landscape',
64-
'FILEMANAGER_IMAGE_MODE_PORTRAIT' => 'Portrait',
65-
'FILEMANAGER_WATERMARK' => 'Watermark',
66-
'FILEMANAGER_WATERMARK_EXPLAIN' => 'URL of image to use as watermark on all uploaded images',
67-
'FILEMANAGER_WATERMARK_POSITION' => 'Watermark position',
68-
'FILEMANAGER_WATERMARK_POSITION_EXPLAIN' => 'Select a pre-determined position where the watermark should appear or enter the coordinates e.g. 50x100',
69-
'FILEMANAGER_WATERMARK_POSITION_TL' => 'Top Left',
70-
'FILEMANAGER_WATERMARK_POSITION_T' => 'Top',
71-
'FILEMANAGER_WATERMARK_POSITION_TR' => 'Top Right',
72-
'FILEMANAGER_WATERMARK_POSITION_L' => 'Left',
73-
'FILEMANAGER_WATERMARK_POSITION_M' => 'Middle',
74-
'FILEMANAGER_WATERMARK_POSITION_R' => 'Right',
75-
'FILEMANAGER_WATERMARK_POSITION_BL' => 'Bottom Left',
76-
'FILEMANAGER_WATERMARK_POSITION_B' => 'Bottom',
77-
'FILEMANAGER_WATERMARK_POSITION_BR' => 'Bottom Right',
78-
'FILEMANAGER_WATERMARK_POSITION_SUFFIX' => 'or',
79-
'FILEMANAGER_WATERMARK_PADDING' => 'Watermark padding',
80-
'FILEMANAGER_WATERMARK_PADDING_EXPLAIN' => 'If using a pre-determined position you can adjust the padding from the edges. If using co-ordinates, this value is ignored',
46+
'FILEMANAGER_SETTINGS' => 'File Manager Settings',
47+
'FILEMANAGER_STATUS' => 'Status',
48+
'FILEMANAGER_NO_EXIST' => 'You will need to install the File Manager before you can enable it. Installation instructions are found <a href="%s" target="_blank" rel="noopener noreferrer"><strong>here</strong></a>',
49+
'FILEMENAGER_NOT_WRITABLE' => 'Filemanager config folder (root/ResponsiveFilemanager/filemanager/config/) is not writable. Please change the permissions to writable by all (777 or -rwxrwxrwx within your FTP Client)',
50+
'FILEMANAGER_IMAGE_AUTO_RESIZE' => 'Automatically resize uploaded images?',
51+
'FILEMANAGER_IMAGE_AUTO_RESIZE_DIMENSIONS' => 'Resize to specified dimensions',
52+
'FILEMANAGER_IMAGE_AUTO_RESIZING_MODE' => 'Auto resizing mode',
53+
'FILEMANAGER_IMAGE_MAX_DIMENSIONS' => 'Max. image size',
54+
'FILEMANAGER_IMAGE_MAX_MODE' => 'Max. image size mode',
55+
'FILEMANAGER_IMAGE_MODE_EXPLAIN' => 'Used to calculate the height/width if you only provide height or width but not both above',
56+
'FILEMANAGER_IMAGE_MODE_AUTO' => 'Auto',
57+
'FILEMANAGER_IMAGE_MODE_CROP' => 'Crop',
58+
'FILEMANAGER_IMAGE_MODE_EXACT' => 'Exact',
59+
'FILEMANAGER_IMAGE_MODE_LANDSCAPE' => 'Landscape',
60+
'FILEMANAGER_IMAGE_MODE_PORTRAIT' => 'Portrait',
61+
'FILEMANAGER_WATERMARK' => 'Watermark',
62+
'FILEMANAGER_WATERMARK_EXPLAIN' => 'URL of image to use as watermark on all uploaded images',
63+
'FILEMANAGER_WATERMARK_POSITION' => 'Watermark position',
64+
'FILEMANAGER_WATERMARK_POSITION_EXPLAIN' => 'Select a pre-determined position where the watermark should appear or enter the coordinates e.g. 50x100',
65+
'FILEMANAGER_WATERMARK_POSITION_TL' => 'Top Left',
66+
'FILEMANAGER_WATERMARK_POSITION_T' => 'Top',
67+
'FILEMANAGER_WATERMARK_POSITION_TR' => 'Top Right',
68+
'FILEMANAGER_WATERMARK_POSITION_L' => 'Left',
69+
'FILEMANAGER_WATERMARK_POSITION_M' => 'Middle',
70+
'FILEMANAGER_WATERMARK_POSITION_R' => 'Right',
71+
'FILEMANAGER_WATERMARK_POSITION_BL' => 'Bottom Left',
72+
'FILEMANAGER_WATERMARK_POSITION_B' => 'Bottom',
73+
'FILEMANAGER_WATERMARK_POSITION_BR' => 'Bottom Right',
74+
'FILEMANAGER_WATERMARK_POSITION_SUFFIX' => 'or',
75+
'FILEMANAGER_WATERMARK_PADDING' => 'Watermark padding',
76+
'FILEMANAGER_WATERMARK_PADDING_EXPLAIN' => 'If using a pre-determined position you can adjust the padding from the edges. If using co-ordinates, this value is ignored',
8177

82-
'FORUM_INDEX_SETTINGS' => 'Forum Index Settings',
83-
'FORUM_INDEX_SETTINGS_EXPLAIN' => 'These settings only apply when there is no startpage defined',
78+
'FORUM_INDEX_SETTINGS' => 'Forum Index Settings',
79+
'FORUM_INDEX_SETTINGS_EXPLAIN' => 'These settings only apply when there is no startpage defined',
8480

85-
'HIDE' => 'Hide',
86-
'HIDE_BIRTHDAY' => 'Hide Birthday section',
87-
'HIDE_LOGIN' => 'Hide login box',
88-
'HIDE_ONLINE' => 'Hide Whos online section',
81+
'HIDE' => 'Hide',
82+
'HIDE_BIRTHDAY' => 'Hide Birthday section',
83+
'HIDE_LOGIN' => 'Hide login box',
84+
'HIDE_ONLINE' => 'Hide Whos online section',
8985

90-
'LAYOUT_BLOG' => 'Blog',
91-
'LAYOUT_CUSTOM' => 'Custom',
92-
'LAYOUT_HOLYGRAIL' => 'Holy Grail',
93-
'LAYOUT_PORTAL' => 'Portal',
94-
'LAYOUT_PORTAL_ALT' => 'Portal (alt)',
95-
'LAYOUT_SETTINGS' => 'Layout Settings',
86+
'LAYOUT_BLOG' => 'Blog',
87+
'LAYOUT_CUSTOM' => 'Custom',
88+
'LAYOUT_HOLYGRAIL' => 'Holy Grail',
89+
'LAYOUT_PORTAL' => 'Portal',
90+
'LAYOUT_PORTAL_ALT' => 'Portal (alt)',
91+
'LAYOUT_SETTINGS' => 'Layout Settings',
9692

97-
'LOG_DELETED_BLOCKS_FOR_STYLE' => 'Sitemaker blocks deleted for missing style with id %s',
98-
'LOG_DELETED_BLOCKS_FOR_ROUTE' => 'Sitemaker blocks deleted for broken pages:<br />%s',
99-
'LOG_DELETED_BLOCKS' => 'Invalid Sitemaker blocks deleted:<br />%s',
93+
'LOG_DELETED_BLOCKS_FOR_STYLE' => 'Sitemaker blocks deleted for missing style with id %s',
94+
'LOG_DELETED_BLOCKS_FOR_ROUTE' => 'Sitemaker blocks deleted for broken pages:<br />%s',
95+
'LOG_DELETED_BLOCKS' => 'Invalid Sitemaker blocks deleted:<br />%s',
10096

101-
'NAVIGATION_SETTINGS' => 'Navigation Settings',
102-
'NO_NAVBAR' => 'None',
97+
'NAVIGATION_SETTINGS' => 'Navigation Settings',
98+
'NO_NAVBAR' => 'None',
10399

104-
'SELECT_NAVBAR_MENU' => 'Select main navigation menu',
105-
'SETTINGS_SAVED' => 'Your settings have been saved',
106-
'SHOW' => 'Show',
107-
'SHOW_FORUM_NAV' => 'Show ’Forum’ in navigation bar?',
108-
'SHOW_FORUM_NAV_EXPLAIN' => 'When a page is set as startpage instead of the forum index, should we display ’Forum’ in navigation bar',
109-
'SHOW_FORUM_NAV_WITH_ICON' => 'Yes - with icon:',
110-
));
100+
'SELECT_NAVBAR_MENU' => 'Select main navigation menu',
101+
'SETTINGS_SAVED' => 'Your settings have been saved',
102+
'SHOW' => 'Show',
103+
'SHOW_FORUM_NAV' => 'Show ’Forum’ in navigation bar?',
104+
'SHOW_FORUM_NAV_EXPLAIN' => 'When a page is set as startpage instead of the forum index, should we display ’Forum’ in navigation bar',
105+
'SHOW_FORUM_NAV_WITH_ICON' => 'Yes - with icon:',
106+
]);

0 commit comments

Comments
 (0)