apply accesses the super-global variable $_SESSION. Open
function apply()
{
$tasks = $_SESSION[__CLASS__];
foreach ($tasks as $task) {
$res = $this->{"apply_{$task}"}();
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_config accesses the super-global variable $GLOBALS. Open
function check_config()
{
$sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_pm accesses the super-global variable $GLOBALS. Open
function check_pm()
{
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("priv_msgs");
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return false;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_config accesses the super-global variable $GLOBALS. Open
function check_config()
{
$sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_block accesses the super-global variable $GLOBALS. Open
function check_block()
{
$sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_profile accesses the super-global variable $GLOBALS. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_config accesses the super-global variable $GLOBALS. Open
function check_config()
{
$sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_pm accesses the super-global variable $GLOBALS. Open
function check_pm()
{
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("priv_msgs");
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return false;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_pm accesses the super-global variable $GLOBALS. Open
function check_pm()
{
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("priv_msgs");
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return false;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
apply accesses the super-global variable $_SESSION. Open
function apply()
{
$tasks = $_SESSION[__CLASS__];
foreach ($tasks as $task) {
$res = $this->{"apply_{$task}"}();
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_block accesses the super-global variable $GLOBALS. Open
function check_block()
{
$sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
apply_profile accesses the super-global variable $GLOBALS. Open
function apply_profile()
{
$xoopsDB = $GLOBALS['xoopsDB'];
// Restore users table
$xoopsDB->queryF(
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_profile accesses the super-global variable $GLOBALS. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
apply_pm accesses the super-global variable $GLOBALS. Open
function apply_pm()
{
$xoopsDB = $GLOBALS['xoopsDB'];
$sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgs") . "`
DROP `from_delete`,
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_profile accesses the super-global variable $GLOBALS. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
apply_config accesses the super-global variable $GLOBALS. Open
function apply_config()
{
$xoopsDB = $GLOBALS['xoopsDB'];
$result = true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
check_block accesses the super-global variable $GLOBALS. Open
function check_block()
{
$sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
isApplied accesses the super-global variable $_SESSION. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Method apply_block
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
Function apply_block
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File index.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Upgrader from 2.2.* to 2.0.x
*
* @copyright The XOOPS project http://www.xoops.org/
The class upgrade_220 has 11 public methods. Consider refactoring upgrade_220 to keep number of public methods under 10. Open
class upgrade_220
{
var $usedFiles = array ();
var $tasks = array('config', 'profile', 'block', 'pm');
var $updater;
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class upgrade_220 has an overall complexity of 56 which is very high. The configured complexity threshold is 50. Open
class upgrade_220
{
var $usedFiles = array ();
var $tasks = array('config', 'profile', 'block', 'pm');
var $updater;
- Exclude checks
Method apply_config
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apply_config()
{
$xoopsDB = $GLOBALS['xoopsDB'];
$result = true;
Method apply_profile
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apply_profile()
{
$xoopsDB = $GLOBALS['xoopsDB'];
// Restore users table
$xoopsDB->queryF(
Function isApplied
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method apply_block() has an NPath complexity of 54020. The configured NPath complexity threshold is 200. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method apply_block() has 194 lines of code. Current threshold is set to 100. Avoid really long methods. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Exclude checks
The method apply_block() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Remove error control operator '@' on line 350. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 398. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 391. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 341. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Avoid assigning values to variables in if clauses and the like (line '70', column '8'). Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'icms_db_legacy_Factory' in method '__construct'. Open
$this->updater = icms_db_legacy_Factory::getDatabaseUpdater();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '32', column '10'). Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid unused local variables such as '$profile_module'. Open
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$res'. Open
if (!$res = $this->{"check_{$task}"}()) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Call to method getDatabaseUpdater
from undeclared class \icms_db_legacy_Factory
Open
$this->updater = icms_db_legacy_Factory::getDatabaseUpdater();
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
function isApplied()
{
if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 128.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
function check_config()
{
$sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
function check_block()
{
$sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class upgrade_220
- Exclude checks
The class upgrade_220 is not named in CamelCase. Open
class upgrade_220
{
var $usedFiles = array ();
var $tasks = array('config', 'profile', 'block', 'pm');
var $updater;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Method name "upgrade_220::check_block" is not in camel caps format Open
function check_block()
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" (bid, mid, options, name, title, side, weight, visible, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" block_type, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" isactive, dirname, func_file," .
- Exclude checks
The var keyword must not be used to declare a property Open
var $tasks = array('config', 'profile', 'block', 'pm');
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
$xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` u, `" . $xoopsDB->prefix("user_profile") . "` p SET u.{$field} = p.{$field} WHERE u.uid=p.profileid");
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
//Set loginname as uname
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
$xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("users") . " DROP loginname");
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
return true;
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Opening brace should be on the same line as the declaration for class upgrade_220 Open
{
- Exclude checks
Visibility must be declared on property "$usedFiles" Open
var $usedFiles = array ();
- Exclude checks
Visibility must be declared on method "_block_lookup" Open
function _block_lookup($block, $blocks)
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" c_type, " .
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (! @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/xoops_version.php' ) continue;
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
"ALTER TABLE `" . $xoopsDB->prefix("users") . "`
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
//Drop loginname
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" SELECT " .
- Exclude checks
Method name "upgrade_220::apply_pm" is not in camel caps format Open
function apply_pm()
- Exclude checks
Visibility must be declared on method "__construct" Open
function __construct() {
- Exclude checks
Method name "upgrade_220::apply_block" is not in camel caps format Open
function apply_block()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" c_type, " .
- Exclude checks
Visibility must be declared on method "isApplied" Open
function isApplied()
- Exclude checks
Visibility must be declared on method "check_config" Open
function check_config()
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Visibility must be declared on method "apply_profile" Open
function apply_profile()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" WHERE bid = " . $row['bid'];
- Exclude checks
Visibility must be declared on method "apply" Open
function apply()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" GROUP BY b.dirname, b.bid, i.instanceid";
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" WHERE i.bid = c.bid" .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" FROM " . $xoopsDB->prefix("newblocks_bak") . " AS b LEFT JOIN " . $xoopsDB->prefix('block_instance') . " AS i ON b.bid = i.bid " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" (bid, mid, options, name, title, side, weight, visible, " .
- Exclude checks
Method name "upgrade_220::check_config" is not in camel caps format Open
function check_config()
- Exclude checks
Visibility must be declared on method "check_profile" Open
function check_profile()
- Exclude checks
Method name "upgrade_220::_block_lookup" is not in camel caps format Open
function _block_lookup($block, $blocks)
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" show_func, edit_func, template, bcachetime, last_modified)" .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" GROUP BY b.dirname, b.bid";
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" CASE WHEN c_type='' THEN 'H' ELSE c_type END," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" show_func, edit_func, template, 0, last_modified" .
- Exclude checks
Method name "upgrade_220::check_pm" is not in camel caps format Open
function check_pm()
- Exclude checks
Visibility must be declared on method "apply_config" Open
function apply_config()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" AND i.instanceid = " . $row['instanceid'];
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" func_num, " .
- Exclude checks
Visibility must be declared on method "apply_pm" Open
function apply_pm()
- Exclude checks
Visibility must be declared on property "$tasks" Open
var $tasks = array('config', 'profile', 'block', 'pm');
- Exclude checks
Method name "upgrade_220::check_profile" is not in camel caps format Open
function check_profile()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
$profile_fields = array("url", "user_regdate", "user_icq", "user_from", "user_sig", "user_viewemail", "actkey", "user_aim", "user_yim", "user_msnm", "posts", "attachsig", "theme", "timezone_offset", "last_login", "umode", "uorder", "notify_method", "notify_mode", "user_occ", "bio", "user_intrest", "user_mailok");
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
$xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` SET login_name=loginname");
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" func_num, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" isactive, dirname, func_file," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" CASE WHEN show_func='b_system_custom_show' THEN 'C' WHEN mid = 1 THEN 'S' ELSE 'M' END," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" bid + {$MaxInstanceId}, -1" .
- Exclude checks
The var keyword must not be used to declare a property Open
var $usedFiles = array ();
- Exclude checks
Visibility must be declared on property "$updater" Open
var $updater;
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Visibility must be declared on method "check_pm" Open
function check_pm()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
foreach ($profile_fields as $field) {
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
}
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" block_type, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" c.show_func, c.edit_func, c.template, i.bcachetime, c.last_modified" .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" WHERE i.instanceid IS NULL" .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" isactive, dirname, func_file," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" FROM " . $xoopsDB->prefix("newblocks_bak") .
- Exclude checks
Method name "upgrade_220::apply_profile" is not in camel caps format Open
function apply_profile()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
/*
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" FROM " . $xoopsDB->prefix('block_instance') . " AS i LEFT JOIN " . $xoopsDB->prefix("newblocks_bak") . " AS b ON b.bid = i.bid " .
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (! @include ICMS_ROOT_PATH . '/modules/' . $dirname . '/xoops_version.php' ) continue;
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" WHERE bid = " . $row['bid'];
- Exclude checks
The var keyword must not be used to declare a property Open
var $updater;
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
// Copy data from profile table
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" CASE WHEN c.c_type='' THEN 'H' ELSE c.c_type END," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" c.isactive, c.dirname, c.func_file," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" " . $xoopsDB->prefix("newblocks_bak") . " AS c" .
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" i.instanceid, c.mid, i.options, c.name, i.title, i.side, i.weight, i.visible, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" FROM " . $xoopsDB->prefix("block_instance") . " AS i," .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" {$block_key}, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
);
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" show_func, edit_func, template, bcachetime, last_modified)" .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" bid + {$MaxInstanceId}, mid, options, name, name, 0, 0, 0, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" (block_id, module_id)" .
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Opening brace should be on the same line as the declaration Open
{
- Exclude checks
Visibility must be declared on method "check_block" Open
function check_block()
- Exclude checks
Method name "upgrade_220::apply_config" is not in camel caps format Open
function apply_config()
- Exclude checks
Visibility must be declared on method "apply_block" Open
function apply_block()
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" {$block_key}, " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" SELECT " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" SELECT " .
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
" FROM " . $xoopsDB->prefix("newblocks_bak") .
- Exclude checks
Inline control structures are not allowed Open
if (!$result) return false;
- Exclude checks
Inline control structures are not allowed Open
if ($block_key === null) continue;
- Exclude checks
Inline control structures are not allowed Open
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
- Exclude checks
Inline control structures are not allowed Open
if (! @include ICMS_ROOT_PATH . '/modules/' . $dirname . '/xoops_version.php' ) continue;
- Exclude checks
Inline control structures are not allowed Open
if (!$res) return false;
- Exclude checks
Inline control structures are not allowed Open
if ($GLOBALS['xoopsDB']->getRowsNum($result) > 8) return false;
- Exclude checks
Inline control structures are not allowed Open
if (empty($modversion['blocks']) && $dirname != 'system') continue;
- Exclude checks
Inline control structures are not allowed Open
if ($GLOBALS['xoopsDB']->getRowsNum($result) == 0) return false;
- Exclude checks
Inline control structures are not allowed Open
if (empty($options) || !is_array($options)) $options = array();
- Exclude checks
Inline control structures are not allowed Open
if (empty($modversion['blocks']) && $dirname != 'system') continue;
- Exclude checks
Inline control structures are not allowed Open
if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) return false;
- Exclude checks
Inline control structures are not allowed Open
if ($block_key === null) continue;
- Exclude checks
Inline control structures are not allowed Open
if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) return false;
- Exclude checks
Inline control structures are not allowed Open
if (!$result) return true;
- Exclude checks
Inline control structures are not allowed Open
if (!$result) return true;
- Exclude checks
Inline control structures are not allowed Open
if (!$result) return false;
- Exclude checks
Inline control structures are not allowed Open
if (
- Exclude checks
Inline control structures are not allowed Open
if (! @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/xoops_version.php' ) continue;
- Exclude checks
Class name "upgrade_220" is not in camel caps format Open
class upgrade_220
- Exclude checks
Line indented incorrectly; expected 2 tabs, found 3 Open
}
- Exclude checks
A closing tag is not permitted at the end of a PHP file Open
?>
- Exclude checks
Line indented incorrectly; expected 2 tabs, found 3 Open
foreach ($profile_fields as $field) {
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
if (
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 14 Open
);
- Exclude checks
The variable $module_handler is not named in camelCase. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_options is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $profile_module is not named in camelCase. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_options is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_options is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $MaxInstanceId is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_options is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $profile_fields is not named in camelCase. Open
function apply_profile()
{
$xoopsDB = $GLOBALS['xoopsDB'];
// Restore users table
$xoopsDB->queryF(
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $MaxInstanceId is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $module_handler is not named in camelCase. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $MaxInstanceId is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_options is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $profile_fields is not named in camelCase. Open
function apply_profile()
{
$xoopsDB = $GLOBALS['xoopsDB'];
// Restore users table
$xoopsDB->queryF(
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $block_key is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method apply_pm is not named in camelCase. Open
function apply_pm()
{
$xoopsDB = $GLOBALS['xoopsDB'];
$sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgs") . "`
DROP `from_delete`,
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method check_pm is not named in camelCase. Open
function check_pm()
{
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("priv_msgs");
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return false;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method apply_block is not named in camelCase. Open
function apply_block()
{
global $xoopsDB;
$xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _block_lookup is not named in camelCase. Open
function _block_lookup($block, $blocks)
{
if ($block['show_func'] == 'b_system_custom_show') {
return 0;
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method check_config is not named in camelCase. Open
function check_config()
{
$sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method check_profile is not named in camelCase. Open
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method apply_profile is not named in camelCase. Open
function apply_profile()
{
$xoopsDB = $GLOBALS['xoopsDB'];
// Restore users table
$xoopsDB->queryF(
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method check_block is not named in camelCase. Open
function check_block()
{
$sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return true;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method apply_config is not named in camelCase. Open
function apply_config()
{
$xoopsDB = $GLOBALS['xoopsDB'];
$result = true;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
Unexpected spaces found. Open
ADD user_viewemail tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD user_mailok tinyint(1) unsigned NOT NULL default '1'
- Exclude checks
Unexpected spaces found. Open
$xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("users") . " DROP loginname");
- Exclude checks
Unexpected spaces found. Open
edit_func varchar(50) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD user_from varchar(100) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD uorder tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD notify_method tinyint(1) NOT NULL default '1',
- Exclude checks
Unexpected spaces found. Open
ADD user_occ varchar(100) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
);
- Exclude checks
Unexpected spaces found. Open
foreach ($profile_fields as $field) {
- Exclude checks
Unexpected spaces found. Open
/*
- Exclude checks
Unexpected spaces found. Open
func_num tinyint(3) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
//Drop loginname
- Exclude checks
Unexpected spaces found. Open
return true;
- Exclude checks
Unexpected spaces found. Open
" show_func, edit_func, template, bcachetime, last_modified)" .
- Exclude checks
Unexpected spaces found. Open
ADD user_sig tinytext,
- Exclude checks
Unexpected spaces found. Open
"
- Exclude checks
Unexpected spaces found. Open
// Copy data from profile table
- Exclude checks
Unexpected spaces found. Open
bcachetime int(10) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
" GROUP BY b.dirname, b.bid, i.instanceid";
- Exclude checks
Unexpected spaces found. Open
" isactive, dirname, func_file," .
- Exclude checks
Unexpected spaces found. Open
" WHERE i.bid = c.bid" .
- Exclude checks
Unexpected spaces found. Open
ADD url varchar(100) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
side tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
c_type char(1) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
KEY mid (mid),
- Exclude checks
Unexpected spaces found. Open
" (bid, mid, options, name, title, side, weight, visible, " .
- Exclude checks
Unexpected spaces found. Open
" isactive, dirname, func_file," .
- Exclude checks
Unexpected spaces found. Open
" SELECT " .
- Exclude checks
Unexpected spaces found. Open
" isactive, dirname, func_file," .
- Exclude checks
Unexpected spaces found. Open
DROP `from_save`;
- Exclude checks
Unexpected spaces found. Open
ADD user_yim varchar(25) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD user_msnm varchar(100) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD attachsig tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD user_intrest varchar(150) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
" block_type, " .
- Exclude checks
Unexpected spaces found. Open
" AND i.instanceid = " . $row['instanceid'];
- Exclude checks
Unexpected spaces found. Open
DROP `to_delete`,
- Exclude checks
Unexpected spaces found. Open
ADD user_icq varchar(15) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
$xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` u, `" . $xoopsDB->prefix("user_profile") . "` p SET u.{$field} = p.{$field} WHERE u.uid=p.profileid");
- Exclude checks
Unexpected spaces found. Open
//Set loginname as uname
- Exclude checks
Unexpected spaces found. Open
" FROM " . $xoopsDB->prefix('block_instance') . " AS i LEFT JOIN " . $xoopsDB->prefix("newblocks_bak") . " AS b ON b.bid = i.bid " .
- Exclude checks
Unexpected spaces found. Open
ADD posts mediumint(8) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD timezone_offset float(3,1) NOT NULL default '0.0',
- Exclude checks
Unexpected spaces found. Open
func_file varchar(50) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
" FROM " . $xoopsDB->prefix("block_instance") . " AS i," .
- Exclude checks
Unexpected spaces found. Open
" WHERE i.instanceid IS NULL" .
- Exclude checks
Unexpected spaces found. Open
DROP `to_save`,
- Exclude checks
Unexpected spaces found. Open
weight smallint(5) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
" SELECT " .
- Exclude checks
Unexpected spaces found. Open
ADD user_regdate int(10) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD umode varchar(10) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD actkey varchar(8) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
ADD notify_mode tinyint(1) NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
visible tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
mid smallint(5) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
" c_type, " .
- Exclude checks
Unexpected spaces found. Open
content text,
- Exclude checks
Unexpected spaces found. Open
" i.instanceid, c.mid, i.options, c.name, i.title, i.side, i.weight, i.visible, " .
- Exclude checks
Unexpected spaces found. Open
last_modified int(10) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
" c_type, " .
- Exclude checks
Unexpected spaces found. Open
" (block_id, module_id)" .
- Exclude checks
Unexpected spaces found. Open
" c.isactive, c.dirname, c.func_file," .
- Exclude checks
Unexpected spaces found. Open
" WHERE bid = " . $row['bid'];
- Exclude checks
Unexpected spaces found. Open
ADD theme varchar(100) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
$xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` SET login_name=loginname");
- Exclude checks
Unexpected spaces found. Open
options varchar(255) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
dirname varchar(50) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
PRIMARY KEY (bid),
- Exclude checks
Unexpected spaces found. Open
" (bid, mid, options, name, title, side, weight, visible, " .
- Exclude checks
Unexpected spaces found. Open
" {$block_key}, " .
- Exclude checks
Unexpected spaces found. Open
" CASE WHEN c_type='' THEN 'H' ELSE c_type END," .
- Exclude checks
Unexpected spaces found. Open
" c.show_func, c.edit_func, c.template, i.bcachetime, c.last_modified" .
- Exclude checks
Unexpected spaces found. Open
" func_num, " .
- Exclude checks
Unexpected spaces found. Open
" show_func, edit_func, template, bcachetime, last_modified)" .
- Exclude checks
Unexpected spaces found. Open
" FROM " . $xoopsDB->prefix("newblocks_bak") .
- Exclude checks
Unexpected spaces found. Open
ADD user_aim varchar(18) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
";
- Exclude checks
Unexpected spaces found. Open
$profile_fields = array("url", "user_regdate", "user_icq", "user_from", "user_sig", "user_viewemail", "actkey", "user_aim", "user_yim", "user_msnm", "posts", "attachsig", "theme", "timezone_offset", "last_login", "umode", "uorder", "notify_method", "notify_mode", "user_occ", "bio", "user_intrest", "user_mailok");
- Exclude checks
Unexpected spaces found. Open
template varchar(50) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
KEY visible (visible),
- Exclude checks
Unexpected spaces found. Open
KEY mid_funcnum (mid,func_num)
- Exclude checks
Unexpected spaces found. Open
" CASE WHEN c.c_type='' THEN 'H' ELSE c.c_type END," .
- Exclude checks
Unexpected spaces found. Open
" FROM " . $xoopsDB->prefix("newblocks_bak") . " AS b LEFT JOIN " . $xoopsDB->prefix('block_instance') . " AS i ON b.bid = i.bid " .
- Exclude checks
Unexpected spaces found. Open
" block_type, " .
- Exclude checks
Unexpected spaces found. Open
" bid + {$MaxInstanceId}, mid, options, name, name, 0, 0, 0, " .
- Exclude checks
Unexpected spaces found. Open
" bid + {$MaxInstanceId}, -1" .
- Exclude checks
Unexpected spaces found. Open
"ALTER TABLE `" . $xoopsDB->prefix("users") . "`
- Exclude checks
Unexpected spaces found. Open
ADD last_login int(10) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
ADD bio tinytext,
- Exclude checks
Unexpected spaces found. Open
" show_func, edit_func, template, 0, last_modified" .
- Exclude checks
Unexpected spaces found. Open
" {$block_key}, " .
- Exclude checks
Unexpected spaces found. Open
" GROUP BY b.dirname, b.bid";
- Exclude checks
Unexpected spaces found. Open
" WHERE bid = " . $row['bid'];
- Exclude checks
Unexpected spaces found. Open
title varchar(255) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
block_type char(1) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
isactive tinyint(1) unsigned NOT NULL default '0',
- Exclude checks
Unexpected spaces found. Open
" func_num, " .
- Exclude checks
Unexpected spaces found. Open
" " . $xoopsDB->prefix("newblocks_bak") . " AS c" .
- Exclude checks
Unexpected spaces found. Open
" CASE WHEN show_func='b_system_custom_show' THEN 'C' WHEN mid = 1 THEN 'S' ELSE 'M' END," .
- Exclude checks
Unexpected spaces found. Open
DROP `from_delete`,
- Exclude checks
Unexpected spaces found. Open
show_func varchar(50) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
" SELECT " .
- Exclude checks
Unexpected spaces found. Open
" FROM " . $xoopsDB->prefix("newblocks_bak") .
- Exclude checks
Unexpected spaces found. Open
}
- Exclude checks
Unexpected spaces found. Open
bid mediumint(8) unsigned NOT NULL auto_increment,
- Exclude checks
Unexpected spaces found. Open
name varchar(150) NOT NULL default '',
- Exclude checks
Unexpected spaces found. Open
KEY isactive_visible_mid (isactive,visible,mid),
- Exclude checks
Unexpected spaces found. Open
);
- Exclude checks
Unexpected spaces found. Open
";
- Exclude checks