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 | 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 | * Alumni module for Xoops |
||
14 | * |
||
15 | * @copyright XOOPS Project https://xoops.org/ |
||
16 | * @license GPL 2.0 or later |
||
17 | * @package alumni |
||
18 | * @since 2.6.x |
||
19 | * @author John Mordo (jlm69) |
||
20 | */ |
||
21 | |||
22 | use Xoops\Core\Request; |
||
23 | |||
24 | defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
||
25 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
||
26 | include_once XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/class/alumni_tree.php"; |
||
27 | |||
28 | /** |
||
29 | * Class AlumniSearchForm |
||
30 | */ |
||
31 | class AlumniSearchForm extends XoopsThemeForm |
||
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. ![]() |
|||
32 | { |
||
33 | /** |
||
34 | * We are not using this for objects but we need to override the constructor |
||
35 | * @param null $obj |
||
36 | */ |
||
37 | public function __construct($obj = null) |
||
38 | { |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param $andor |
||
43 | * @param $queries |
||
44 | * @param $mids |
||
45 | * @param $mid |
||
46 | * @param $bycat |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function alumni_getSearchFrom($andor, $queries, $mids, $mid, $bycat) |
||
0 ignored issues
–
show
function alumni_getSearchFrom() 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. ![]() |
|||
50 | { |
||
51 | $xoops = Xoops::getInstance(); |
||
52 | $alumni = Alumni::getInstance(); |
||
53 | // create form |
||
54 | parent::__construct(XoopsLocale::SEARCH, 'alumni', 'search.php', 'get'); |
||
0 ignored issues
–
show
It seems like you call parent on a different method (
__construct() instead of alumni_getSearchFrom() ). Are you sure this is correct? If so, you might want to change this to $this->__construct() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
55 | |||
56 | // create form elements |
||
57 | $this->addElement(new XoopsFormText(XoopsLocale::KEYWORDS, 'query', 30, 255, htmlspecialchars(stripslashes(implode(' ', $queries)), ENT_QUOTES)), true); |
||
58 | $type_select = new XoopsFormSelect(XoopsLocale::TYPE, 'andor', $andor); |
||
0 ignored issues
–
show
$type_select 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. ![]() |
|||
59 | $type_select->addOptionArray([ |
||
0 ignored issues
–
show
$type_select 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. ![]() |
|||
60 | 'AND' => XoopsLocale::ALL_AND, |
||
61 | 'OR' => XoopsLocale::ANY_OR, |
||
62 | 'exact' => XoopsLocale::EXACT_MATCH |
||
63 | ]); |
||
64 | $this->addElement($type_select); |
||
0 ignored issues
–
show
$type_select 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. ![]() |
|||
65 | |||
66 | $by_cat = Request::getInt('by_cat', 0); |
||
0 ignored issues
–
show
$by_cat 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. ![]() |
|||
67 | |||
68 | $categoriesHandler = $xoops->getModuleHandler('category', 'alumni'); |
||
69 | $search = Search::getInstance(); |
||
70 | |||
71 | $module_id = $xoops->module->getVar('mid'); |
||
0 ignored issues
–
show
$module_id 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. ![]() |
|||
72 | $groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
||
73 | $alumni_ids = $alumni->getGrouppermHandler()->getItemIds('alumni_view', $groups, $module_id); |
||
0 ignored issues
–
show
$alumni_ids 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. ![]() |
|||
74 | $criteria = new CriteriaCompo(); |
||
75 | $criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
0 ignored issues
–
show
$alumni_ids 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. ![]() |
|||
76 | $criteria->setOrder($xoops->getModuleConfig('alumni_csortorder')); |
||
77 | |||
78 | $category_arr = $categoriesHandler->getAll($criteria); |
||
0 ignored issues
–
show
$category_arr 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. ![]() |
|||
79 | |||
80 | foreach (array_keys($category_arr) as $i) { |
||
0 ignored issues
–
show
$category_arr 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. ![]() |
|||
81 | $cid = $category_arr[$i]->getVar('cid'); |
||
0 ignored issues
–
show
$category_arr 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. ![]() |
|||
82 | $pid = $category_arr[$i]->getVar('pid'); |
||
0 ignored issues
–
show
$category_arr 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. ![]() $pid is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
83 | $title = $category_arr[$i]->getVar('title'); |
||
0 ignored issues
–
show
$category_arr 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. ![]() |
|||
84 | } |
||
85 | |||
86 | $categories = $alumni->getCategoryHandler()->getCategoriesForSearch(); |
||
87 | $category_select = new XoopsFormSelect(AlumniLocale::L_ALUMNI_CATEGORIES, 'by_cat', $by_cat); |
||
0 ignored issues
–
show
$category_select 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. ![]() |
|||
88 | foreach ($categories as $cid => $title) { |
||
89 | $category_select->addOption('0', XoopsLocale::ALL); |
||
0 ignored issues
–
show
$category_select 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. ![]() |
|||
90 | $category_select->addOptionArray([$cid => $title]); |
||
0 ignored issues
–
show
$category_select 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. ![]() |
|||
91 | } |
||
92 | $this->addElement($category_select); |
||
0 ignored issues
–
show
$category_select 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. ![]() |
|||
93 | |||
94 | if (!empty($mids)) { |
||
95 | $mods_checkbox = new XoopsFormCheckBox(XoopsLocale::SEARCH_IN, 'mids[]', $mids); |
||
0 ignored issues
–
show
$mods_checkbox 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. ![]() |
|||
96 | } else { |
||
97 | $mods_checkbox = new XoopsFormCheckBox(XoopsLocale::SEARCH_IN, 'mids[]', $mid); |
||
0 ignored issues
–
show
$mods_checkbox 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. ![]() |
|||
98 | } |
||
99 | if (empty($modules)) { |
||
0 ignored issues
–
show
The variable
$modules seems to never exist, and therefore empty should always return true . Did you maybe rename this variable?
This check looks for calls to This is most likely caused by the renaming of a variable or the removal of a function/method parameter. ![]() |
|||
100 | $gperm_handler = $xoops->getHandlerGroupPermission(); |
||
0 ignored issues
–
show
$gperm_handler 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. ![]() |
|||
101 | $available_modules = $gperm_handler->getItemIds('module_read', $xoops->getUserGroups()); |
||
0 ignored issues
–
show
$available_modules 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. ![]() |
|||
102 | $available_plugins = Xoops\Module\Plugin::getPlugins('search'); |
||
0 ignored issues
–
show
$available_plugins 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. ![]() |
|||
103 | |||
104 | $criteria = new CriteriaCompo(); |
||
105 | $criteria->add(new Criteria('dirname', '(\'' . implode('\',\'', array_keys($available_plugins)) . '\')', 'IN')); |
||
0 ignored issues
–
show
$available_plugins 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. ![]() |
|||
106 | if (null !== $available_modules && !empty($available_modules)) { |
||
0 ignored issues
–
show
$available_modules 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. ![]() |
|||
107 | $criteria->add(new Criteria('mid', '(' . implode(',', $available_modules) . ')', 'IN')); |
||
0 ignored issues
–
show
$available_modules 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. ![]() |
|||
108 | } |
||
109 | $moduleHandler = $xoops->getHandlerModule(); |
||
110 | $mods_checkbox->addOptionArray($moduleHandler->getNameList($criteria)); |
||
0 ignored issues
–
show
$mods_checkbox 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. ![]() |
|||
111 | } else { |
||
112 | /* @var $module XoopsModule */ |
||
113 | $module_array = []; |
||
0 ignored issues
–
show
$module_array 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. ![]() |
|||
114 | foreach ($modules as $mid => $module) { |
||
115 | $module_array[$mid] = $module->getVar('name'); |
||
0 ignored issues
–
show
$module_array 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. ![]() |
|||
116 | } |
||
117 | $mods_checkbox->addOptionArray($module_array); |
||
0 ignored issues
–
show
$mods_checkbox 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. ![]() |
|||
118 | } |
||
119 | $this->addElement($mods_checkbox); |
||
0 ignored issues
–
show
$mods_checkbox 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. ![]() |
|||
120 | if ($search->getConfig('keyword_min') > 0) { |
||
121 | $this->addElement(new XoopsFormLabel(XoopsLocale::SEARCH_RULE, sprintf(XoopsLocale::EF_KEYWORDS_MUST_BE_GREATER_THAN, $search->getConfig('keyword_min')))); |
||
122 | } |
||
123 | $this->addElement(new XoopsFormHidden('action', 'results')); |
||
124 | $this->addElement(new XoopsFormHiddenToken('id')); |
||
125 | $this->addElement(new XoopsFormButton('', 'submit', XoopsLocale::SEARCH, 'submit')); |
||
126 | |||
127 | return $this; |
||
128 | } |
||
129 | } |
||
130 |
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.