Issues (95)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * Advanced BBCode Box
5
 *
6
 * @copyright (c) 2015 Matt Friedman
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace vse\abbc3;
12
13
use phpbb\filesystem\exception\filesystem_exception;
0 ignored issues
show
The type phpbb\filesystem\exception\filesystem_exception was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
class ext extends \phpbb\extension\base
0 ignored issues
show
The type phpbb\extension\base was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
{
17
	const MOVE_UP = 'move_up';
18
	const MOVE_DOWN = 'move_down';
19
	const MOVE_DRAG = 'move_drag';
20
	const PHPBB_MIN_VERSION = '3.2.2'; // Require 3.2.2 due to TextFormatter and BBCode changes
21
	const PHPBB_LEGACY_MAX = '3.3.10'; // Max version of phpBB to use legacy settings
22
	const ABBC3_BBCODE_FONTS = ['ABBC3_FONT_SAFE' => ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Georgia', 'Impact', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana']];
23
24
	/**
25 3
	 * {@inheritdoc}
26
	 */
27 3
	public function is_enableable()
28 3
	{
29 3
		$config = $this->container->get('config');
30
		return $this->version_check($config['version']) && $this->version_check(PHPBB_VERSION);
0 ignored issues
show
The constant vse\abbc3\PHPBB_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
31
	}
32
33
	/**
34
	 * {@inheritdoc}
35
	 */
36
	public function enable_step($old_state)
37
	{
38
		if ($old_state === false)
39
		{
40
			$filesystem = $this->container->get('filesystem');
41
			$root_path = $this->container->getParameter('core.root_path');
42
43
			try // Make an ABBC3 icon dir in phpBB's images dir
44
			{
45
				if (!$filesystem->exists($root_path . 'images/abbc3/icons'))
46
				{
47
					$filesystem->mkdir($root_path . 'images/abbc3/icons');
48
				}
49
			}
50
			catch (filesystem_exception $e)
51
			{
52
				$user = $this->container->get('user');
53
				$this->container->get('log')->add('critical', $user->data['user_id'], $user->ip, 'LOG_ABBC3_ENABLE_FAIL', false, [$e->get_filename()]);
54
			}
55
56
			return 'abbc3-step';
57
		}
58
59
		return parent::enable_step($old_state);
60
	}
61
62
	/**
63
	 * Enable version check
64
	 *
65
	 * @param string|int $version The version to check
66
	 * @return bool
67
	 */
68
	protected function version_check($version)
69
	{
70
		return phpbb_version_compare($version, self::PHPBB_MIN_VERSION, '>=');
0 ignored issues
show
The function phpbb_version_compare was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

70
		return /** @scrutinizer ignore-call */ phpbb_version_compare($version, self::PHPBB_MIN_VERSION, '>=');
Loading history...
71
	}
72
}
73