mambax7 /
newbb5
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ |
||
| 14 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 15 | * @package NEWBB |
||
| 16 | * @since 4.3 |
||
| 17 | * @author irmtfan <[email protected]> |
||
| 18 | * @author The Persian Xoops Support Site<www.xoops.ir> |
||
| 19 | */ |
||
| 20 | |||
| 21 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | global $xoTheme; |
||
|
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
| 24 | |||
| 25 | include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); |
||
| 26 | $iconHandler = newbbGetIconHandler(); |
||
| 27 | // get css rel path from setted language |
||
| 28 | $css_rel_path = $iconHandler->getPath('language/' . $GLOBALS['xoopsConfig']['language'], 'newbb', 'language/english', 'css'); |
||
|
0 ignored issues
–
show
$css_rel_path does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 29 | // add local stylesheet |
||
| 30 | /** @var xos_opal_Theme $xoTheme */ |
||
| 31 | $xoTheme->addStylesheet($css_rel_path . '/style.css'); |
||
|
0 ignored issues
–
show
$css_rel_path does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 32 | |||
| 33 | // get js rel path from setted language |
||
| 34 | $js_rel_path = $iconHandler->getPath('language/' . $GLOBALS['xoopsConfig']['language'], 'newbb', 'language/english', 'js'); |
||
|
0 ignored issues
–
show
$js_rel_path does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 35 | // add all local js files inside js directory |
||
| 36 | xoops_load('XoopsLists'); |
||
| 37 | $allfiles = \XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($js_rel_path)); |
||
|
0 ignored issues
–
show
$js_rel_path does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 38 | foreach ($allfiles as $jsfile) { |
||
| 39 | if ('js' === strtolower(pathinfo($jsfile, PATHINFO_EXTENSION))) { |
||
| 40 | $xoTheme->addScript($js_rel_path . '/' . $jsfile); |
||
|
0 ignored issues
–
show
$js_rel_path does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 41 | } |
||
| 42 | } |
||
| 43 | global $forumCookie; // for $forumCookie["prefix"] revert last change - use global instead of include_once |
||
|
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
| 44 | // add toggle script |
||
| 45 | //$toggle_script = "var toggle_cookie=\"" . $forumCookie['prefix'] . 'G' . '\';'; |
||
| 46 | $toggle_script = 'var toggle_cookie="' . $forumCookie['prefix'] . 'G";'; |
||
|
0 ignored issues
–
show
$toggle_script does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 47 | $xoTheme->addScript(null, ['type' => 'text/javascript'], $toggle_script); |
||
|
0 ignored issues
–
show
$toggle_script does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. Loading history...
|
|||
| 48 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.