Skip to content

Commit 4a5eb0a

Browse files
boneliferclaude
andauthored
Require phpBB 3.3.19 (#8)
Refuse to enable on phpBB older than 3.3.19 or below the extension's minimum PHP version, showing a clear reason instead of a generic error. phpBB 3.3.17 through 3.3.19 fixed a series of security issues, so older boards should update phpBB first. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent da21533 commit 4a5eb0a

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

‎ext.php‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
*
4+
* Group Switches extension for the phpBB Forum Software package
5+
*
6+
* @author RMcGirr83 (Rich McGirr) rmcgirr83@phpbbmodders.net
7+
* @copyright (c) 2015 phpbbmodders.net
8+
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
9+
* @license GNU General Public License, version 2 (GPL-2.0)
10+
*
11+
*/
12+
13+
namespace phpbbmodders\groupswitches;
14+
15+
/**
16+
* Group Switches extension base
17+
*/
18+
class ext extends \phpbb\extension\base
19+
{
20+
/**
21+
* Check whether the extension can be enabled.
22+
* The current phpBB version should meet or exceed
23+
* the minimum version required by this extension.
24+
*
25+
* @return bool|array
26+
* @access public
27+
*/
28+
public function is_enableable()
29+
{
30+
$enableable = $this->check_phpbb_version() && $this->check_php_version();
31+
32+
if (!$enableable)
33+
{
34+
$language = $this->container->get('language');
35+
$language->add_lang('install_groupswitches', 'phpbbmodders/groupswitches');
36+
37+
return $language->lang('GROUPSWITCHES_NOT_ENABLEABLE');
38+
}
39+
40+
return $enableable;
41+
}
42+
43+
/**
44+
* Require phpBB 3.3.19
45+
*
46+
* @return bool
47+
*/
48+
public function check_phpbb_version()
49+
{
50+
return phpbb_version_compare(PHPBB_VERSION, '3.3.19', '>=');
51+
}
52+
53+
/**
54+
* Require PHP 7.4
55+
*
56+
* @return bool
57+
*/
58+
public function check_php_version()
59+
{
60+
return PHP_VERSION_ID >= 70400;
61+
}
62+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
*
4+
* Group Switches extension for the phpBB Forum Software package
5+
*
6+
* @author RMcGirr83 (Rich McGirr) rmcgirr83@phpbbmodders.net
7+
* @copyright (c) 2015 phpbbmodders.net
8+
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
9+
* @license GNU General Public License, version 2 (GPL-2.0)
10+
*
11+
*/
12+
13+
/**
14+
* DO NOT CHANGE
15+
*/
16+
if (!defined('IN_PHPBB'))
17+
{
18+
exit;
19+
}
20+
21+
if (empty($lang) || !is_array($lang))
22+
{
23+
$lang = [];
24+
}
25+
26+
// DEVELOPERS PLEASE NOTE
27+
//
28+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
29+
//
30+
// Placeholders can now contain order information, e.g. instead of
31+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
32+
// translators to re-order the output of data while ensuring it remains correct
33+
//
34+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
35+
// equally where a string contains only two placeholders which are used to wrap text
36+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
37+
//
38+
// Some characters you may want to copy&paste:
39+
// ’ » “ ” …
40+
//
41+
42+
$lang = array_merge($lang, [
43+
'GROUPSWITCHES_NOT_ENABLEABLE' => 'Group Switches could not be enabled. The minimum requirements of phpBB 3.3.19 and/or PHP 7.4.0 were not satisfied.',
44+
]);

0 commit comments

Comments
 (0)