This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | use Bitrix\Main\Localization\Loc; |
||
4 | |||
5 | Loc::loadMessages(__FILE__); |
||
6 | |||
7 | if (class_exists('digitalwand_admin_helper')) return; |
||
8 | |||
9 | class digitalwand_admin_helper extends CModule |
||
0 ignored issues
–
show
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class: namespace YourVendor;
class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries. ![]() |
|||
10 | { |
||
11 | var $MODULE_ID = 'digitalwand.admin_helper'; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_ID .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
12 | var $MODULE_VERSION; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_VERSION .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
13 | var $MODULE_VERSION_DATE; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_VERSION_DATE .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
14 | var $MODULE_NAME; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_NAME .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
15 | var $MODULE_DESCRIPTION; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_DESCRIPTION .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
16 | var $MODULE_GROUP_RIGHTS = 'Y'; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_GROUP_RIGHTS .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
17 | var $MODULE_CSS; |
||
0 ignored issues
–
show
The visibility should be declared for property
$MODULE_CSS .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
18 | var $PARTNER_NAME = 'DigitalWand & Notamedia'; |
||
0 ignored issues
–
show
The visibility should be declared for property
$PARTNER_NAME .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
19 | var $PARTNER_URI = ''; |
||
0 ignored issues
–
show
The visibility should be declared for property
$PARTNER_URI .
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using class A {
var $property;
}
the property is implicitly global. To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2. ![]() |
|||
20 | |||
21 | function digitalwand_admin_helper() |
||
0 ignored issues
–
show
|
|||
22 | { |
||
23 | include __DIR__ . '/version.php'; |
||
24 | |||
25 | $this->MODULE_VERSION = ADMIN_HELPER_VERSION; |
||
26 | $this->MODULE_VERSION_DATE = ADMIN_HELPER_VERSION_DATE; |
||
27 | $this->MODULE_NAME = Loc::getMessage('ADMIN_HELPER_INSTALL_NAME'); |
||
28 | $this->MODULE_DESCRIPTION = Loc::getMessage('ADMIN_HELPER_INSTALL_DESCRIPTION'); |
||
29 | } |
||
30 | |||
31 | function DoInstall() |
||
0 ignored issues
–
show
|
|||
32 | { |
||
33 | |||
34 | $eventManager = \Bitrix\Main\EventManager::getInstance(); |
||
35 | |||
36 | RegisterModule($this->MODULE_ID); |
||
37 | $this->InstallFiles(); |
||
38 | |||
39 | $eventManager->registerEventHandler( |
||
40 | 'main', |
||
41 | 'OnPageStart', |
||
42 | $this->MODULE_ID, |
||
43 | '\DigitalWand\AdminHelper\EventHandlers', |
||
44 | 'onPageStart' |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | function DoUninstall() |
||
0 ignored issues
–
show
|
|||
49 | { |
||
50 | $eventManager = \Bitrix\Main\EventManager::getInstance(); |
||
51 | |||
52 | UnRegisterModule($this->MODULE_ID); |
||
53 | |||
54 | $eventManager->unRegisterEventHandler( |
||
55 | 'main', |
||
56 | 'OnPageStart', |
||
57 | $this->MODULE_ID, |
||
58 | '\DigitalWand\AdminHelper\EventHandlers', |
||
59 | 'onPageStart' |
||
60 | ); |
||
61 | } |
||
62 | |||
63 | function InstallFiles() |
||
0 ignored issues
–
show
InstallFiles uses the super-global variable $_SERVER which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
64 | { |
||
65 | CopyDirFiles(__DIR__ . '/admin', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin'); |
||
66 | |||
67 | return true; |
||
68 | } |
||
69 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.