Skip to content

Commit fbfe0d5

Browse files
authored
Merge pull request #179 from iMattPro/develop
Mo Problems, Mo Fixes
2 parents fb94c20 + e3a58bc commit fbfe0d5

File tree

6 files changed

+54
-21
lines changed

6 files changed

+54
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
- [Change] QI's error handling improved. Only one internal error handler now (using trigger_error).
77
- [Change] QI's error page will have the same Navbar as the rest of QI, and will work as expected in responsive views.
88
- [Change] QI will no longer pass any error messages to the user via URL parameters. Instead, AJAX will be used to handle certain error messages.
9-
- [Change] QI will no longer display backtraces in minor error notices. Backtraces will only be shown for serious errors and warnings.
9+
- [Change] QI will no longer display backtraces in warnings or notices. Backtraces will only be shown for errors.
1010
- [Change] QI's internal language translation system has been updated to support substitution variables.
1111
- [Change] Moved QI's NPM development files to the project/repository root.
1212
- [Change] A small batch of optimisations and code improvements.
1313
- [Fix] Fixed CSS mapping to source files (for development). Maps are no longer embedded in the minified CSS either.
1414
- [Fix] Minor alignment tweaks to the icons and phpBB board version number badge in the "My Boards" sidebar.
15+
- [Fix] Fixed failure to load language files from phpBB 4.0.0-a1.
1516

1617
## Version 1.6.1
1718
- [Fix] Fixed problems that prevented phpBB 4.0.0-alpha builds from successfully installing.

includes/class_qi.php

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,45 @@ public static function get_lang_select($lang_path, $config_var, $get_var = '')
280280
continue;
281281
}
282282

283-
$file = "$lang_path/$lang/iso.txt";
283+
$lang_iso = $lang_path . $lang . DIRECTORY_SEPARATOR . 'iso.txt'; // for phpBB 3.x languages
284+
$lang_composer = $lang_path . $lang . DIRECTORY_SEPARATOR . 'composer.json'; // for phpBB 4.0 languages
284285

285-
if (file_exists($file))
286+
if (file_exists($lang_iso))
286287
{
287-
$rows = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
288-
289-
// Always show the English language name, except for the "active" language.
290-
$lang_options[] = [
291-
'name' => ($lang === $user_lang) ? $rows[1] : $rows[0],
292-
'value' => $lang,
293-
'selected' => $lang === $user_lang,
294-
];
288+
$rows = file($lang_iso, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
289+
290+
$english_name = $rows[0];
291+
$local_name = $rows[1];
292+
}
293+
else if (file_exists($lang_composer))
294+
{
295+
global $phpbb_root_path;
296+
$language_helper = new \phpbb\language\language_file_helper($phpbb_root_path);
297+
298+
try
299+
{
300+
$lang_pack = $language_helper->get_language_data_from_composer_file($lang_composer);
301+
}
302+
catch (\DomainException $e)
303+
{
304+
trigger_error('LANGUAGE_PACK_MISSING', E_USER_WARNING);
305+
}
306+
307+
$english_name = $lang_pack['name'];
308+
$local_name = $lang_pack['local_name'];
295309
}
310+
else
311+
{
312+
// worst case just use the iso name if nothing above worked
313+
$local_name = $english_name = $lang;
314+
}
315+
316+
// Always show the English language name, except for the "active" language.
317+
$lang_options[] = [
318+
'name' => ($lang === $user_lang) ? $local_name : $english_name,
319+
'value' => $lang,
320+
'selected' => $lang === $user_lang,
321+
];
296322
}
297323

298324
return $lang_options;

includes/default_settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
"num_replies_max": 50,
5151
"no_dbpasswd": 0,
5252
"install_styles": 0,
53-
"default_style": ""
53+
"default_style": "",
54+
"drop_db": "0",
55+
"delete_files": "0",
56+
"debug": "0",
57+
"alt_env": ""
5458
}

language/en/qi.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175

176176
'JAVASCRIPT_DISABLED_ALERT' => '<strong>Javascript is disabled!</strong> Please enable Javascript for full functionality.',
177177

178+
'LANGUAGE_PACK_MISSING' => 'The source phpBB board does not have a valid language pack. Please download a fresh copy of phpBB and try again.',
178179
'LOAD' => 'Load',
179180
'LOG_INSTALL_INSTALLED_QI' => '<strong>Installed by phpBB QuickInstall version %s</strong>',
180181
'LOREM_IPSUM' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',

modules/qi_manage.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ public function __construct()
3636
{
3737
$current_item = $settings->get_boards_dir() . $item;
3838

39+
// First get config-file data for the board
40+
$cfg_file = $current_item . '/config.' . $phpEx;
41+
$dbhost = $dbport = $dbname = $dbuser = $dbpasswd = $dbms = '';
42+
if (file_exists($cfg_file))
43+
{
44+
include $cfg_file;
45+
}
46+
3947
// Attempt to delete the board from filesystem
4048
if (!file_exists($current_item) || !is_dir($current_item))
4149
{
@@ -58,13 +66,6 @@ public function __construct()
5866
}
5967

6068
// Attempt to delete the database
61-
$cfg_file = $current_item . '/config.' . $phpEx;
62-
$dbhost = $dbport = $dbname = $dbuser = $dbpasswd = $dbms = '';
63-
if (file_exists($cfg_file))
64-
{
65-
include $cfg_file;
66-
}
67-
6869
if (!empty($dbname) && !empty($dbhost) && !empty($dbms) && empty($error))
6970
{
7071
$dbms = (strpos($dbms, '\\') !== false) ? substr(strrchr($dbms, '\\'), 1) : $dbms;

modules/qi_settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class qi_settings
1919
{
2020
public function __construct()
2121
{
22-
global $settings, $template, $user, $quickinstall_path, $mode, $alt_env, $alt_env_missing;
22+
global $settings, $template, $user, $quickinstall_path, $phpbb_root_path, $mode, $alt_env, $alt_env_missing;
2323

2424
$saved = false;
2525
$config_text = '';
@@ -83,7 +83,7 @@ public function __construct()
8383
'ALT_ENV' => !empty($alt_env) ? $alt_env : false,
8484
'PROFILES' => $settings->get_profiles(),
8585
'QI_LANG' => qi::get_lang_select("{$quickinstall_path}language/", 'qi_lang', 'lang'),
86-
'PHPBB_LANG' => qi::get_lang_select("{$quickinstall_path}sources/phpBB3/language/", 'default_lang'),
86+
'PHPBB_LANG' => qi::get_lang_select("{$phpbb_root_path}/language/", 'default_lang'),
8787

8888
'CONFIG_TEXT' => htmlspecialchars($config_text),
8989

0 commit comments

Comments
 (0)