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 {@link https://xoops.org/ XOOPS Project} |
||||
14 | * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
15 | * @package efqdirectory |
||||
16 | * @since |
||||
17 | * @author Martijn Hertog (aka wtravel) |
||||
18 | * @author XOOPS Development Team, |
||||
19 | */ |
||||
20 | |||||
21 | /****************************************************************************** |
||||
22 | * Function: b_efqdiralpha1_menu_show |
||||
23 | * Input : $options[0] = date for the most recent links |
||||
24 | * hits for the most popular links |
||||
25 | * $block['content'] = The optional above content |
||||
26 | * $options[1] = How many reviews are displayes |
||||
27 | * Output : Returns the desired most recent or most popular links |
||||
28 | ***************************************************************************** |
||||
29 | * @param $options |
||||
30 | * @return array |
||||
31 | */ |
||||
32 | |||||
33 | function b_efqdiralpha1_menu_show($options) |
||||
0 ignored issues
–
show
|
|||||
34 | { |
||||
35 | global $xoopsDB, $xoopsModule, $eh; |
||||
36 | if (isset($xoopsModule)) { |
||||
37 | |||||
38 | //$moddir = $xoopsModule->getvar("dirname"); |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% of this comment could be valid code. Did you maybe forget this after debugging?
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. ![]() |
|||||
39 | $moduleDirName = basename(dirname(__DIR__)); |
||||
40 | $moduleHandler = xoops_getHandler('module'); |
||||
0 ignored issues
–
show
The function
xoops_getHandler 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
![]() |
|||||
41 | $module = $moduleHandler->getByDirname($moduleDirName); |
||||
42 | $moddir = $module->getvar('dirname'); |
||||
43 | } else { |
||||
44 | $info = __DIR__; |
||||
45 | $split = preg_split("#[\]#", $info); |
||||
46 | $count = count($split) - 2; |
||||
47 | $moddir = $split[$count]; |
||||
48 | } |
||||
49 | $block = array(); |
||||
50 | $block['lang_dirmenu'] = _MB_EFQDIR_MENU; |
||||
51 | $block['moddir'] = $moddir; |
||||
52 | $myts = MyTextSanitizer::getInstance(); |
||||
0 ignored issues
–
show
The type
MyTextSanitizer 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
53 | $result = $xoopsDB->query('SELECT dirid, name, descr FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE open='1' ORDER BY name") or $eh->show('0013'); |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
54 | echo 'test'; |
||||
55 | print_r($result); |
||||
56 | View Code Duplication | while ($myrow = $xoopsDB->fetchArray($result)) { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
57 | $directory = array(); |
||||
58 | $name = $myts->htmlSpecialChars($myrow['name']); |
||||
59 | $directory['dirid'] = $myrow['dirid']; |
||||
60 | $directory['name'] = $name; |
||||
61 | $directory['descr'] = $myrow['descr']; |
||||
62 | $block['directories'][] = $directory; |
||||
63 | } |
||||
64 | $sublink = array(); |
||||
0 ignored issues
–
show
|
|||||
65 | |||||
66 | return $block; |
||||
67 | } |
||||
68 | |||||
69 | /** |
||||
70 | * @param $options |
||||
71 | * @return string |
||||
72 | */ |
||||
73 | View Code Duplication | function b_efqdiralpha1_menu_edit($options) |
|||
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
74 | { |
||||
75 | $form = '' . _MB_EFQDIR_DISP . ' '; |
||||
76 | $form .= "<input type='hidden' name='options[]' value='"; |
||||
77 | if ($options[0] === 'date') { |
||||
78 | $form .= "date'"; |
||||
79 | } else { |
||||
80 | $form .= "hits'"; |
||||
81 | } |
||||
82 | $form .= '>'; |
||||
83 | $form .= "<input type='text' name='options[]' value='" . $options[1] . '\'> ' . _MB_EFQDIR_LISTINGS . ''; |
||||
84 | $form .= ' <br>' . _MB_EFQDIR_CHARS . " <input type='text' name='options[]' value='" . $options[2] . '\'> ' . _MB_EFQDIR_LENGTH . ''; |
||||
85 | |||||
86 | return $form; |
||||
87 | } |
||||
88 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.