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 | * Alumni module for Xoops |
||
13 | * |
||
14 | * @copyright XOOPS Project https://xoops.org/ |
||
15 | * @license GPL 2.0 or later |
||
16 | * @package alumni |
||
17 | * @since 2.6.x |
||
18 | * @author John Mordo (jlm69) |
||
19 | */ |
||
20 | |||
21 | $moduleDirName = basename(dirname(__DIR__)); |
||
22 | |||
23 | $xoops = Xoops::getInstance(); |
||
24 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
25 | |||
26 | View Code Duplication | function alumni_ShowImg() |
|
0 ignored issues
–
show
function alumni_ShowImg() 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. ![]() 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. ![]() |
|||
27 | { |
||
28 | global $moduleDirName; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
29 | |||
30 | echo "<script type=\"text/javascript\">\n"; |
||
31 | echo "<!--\n\n"; |
||
32 | echo "function showimage() {\n"; |
||
33 | echo "if (!document.images)\n"; |
||
34 | echo "return\n"; |
||
35 | echo "document.images.avatar.src=\n"; |
||
36 | echo "'" . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/cat/' + document.imcat.img.options[document.imcat.img.selectedIndex].value\n"; |
||
37 | echo "}\n\n"; |
||
38 | echo "//-->\n"; |
||
39 | echo "</script>\n"; |
||
40 | } |
||
41 | |||
42 | View Code Duplication | function alumni_ShowImg2() |
|
0 ignored issues
–
show
function alumni_ShowImg2() 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. ![]() 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. ![]() |
|||
43 | { |
||
44 | global $moduleDirName; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
45 | |||
46 | echo "<script type=\"text/javascript\">\n"; |
||
47 | echo "<!--\n\n"; |
||
48 | echo "function showimage2() {\n"; |
||
49 | echo "if (!document.images)\n"; |
||
50 | echo "return\n"; |
||
51 | echo "document.images.scphoto.src=\n"; |
||
52 | echo "'" . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/schools/' + document.imcat.scphoto.options[document.imcat.scphoto.selectedIndex].value\n"; |
||
53 | echo "}\n\n"; |
||
54 | echo "//-->\n"; |
||
55 | echo "</script>\n"; |
||
56 | } |
||
57 | |||
58 | //Reusable Link Sorting Functions |
||
59 | /** |
||
60 | * @param $orderby |
||
61 | * @return string |
||
62 | */ |
||
63 | function alumni_convertorderbyin($orderby) |
||
0 ignored issues
–
show
function alumni_convertorderbyin() 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. ![]() |
|||
64 | { |
||
65 | switch (trim($orderby)) { |
||
66 | case 'nameA': |
||
67 | $orderby = 'lname ASC'; |
||
68 | break; |
||
69 | case 'schoolA': |
||
70 | $orderby = 'school ASC'; |
||
71 | break; |
||
72 | case 'studiesA': |
||
73 | $orderby = 'studies ASC'; |
||
74 | break; |
||
75 | case 'yearA': |
||
76 | $orderby = 'year ASC'; |
||
77 | break; |
||
78 | case 'dateA': |
||
79 | $orderby = 'date ASC'; |
||
80 | break; |
||
81 | case 'viewA': |
||
82 | $orderby = 'view ASC'; |
||
83 | break; |
||
84 | case 'nameD': |
||
85 | $orderby = 'lname DESC'; |
||
86 | break; |
||
87 | case 'schoolD': |
||
88 | $orderby = 'school DESC'; |
||
89 | break; |
||
90 | case 'studiesD': |
||
91 | $orderby = 'studies DESC'; |
||
92 | break; |
||
93 | case 'yearD': |
||
94 | $orderby = 'year DESC'; |
||
95 | break; |
||
96 | case 'viewD': |
||
97 | $orderby = 'view DESC'; |
||
98 | break; |
||
99 | case 'dateD': |
||
100 | default: |
||
101 | $orderby = 'date DESC'; |
||
102 | break; |
||
103 | } |
||
104 | |||
105 | return $orderby; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @param $orderby |
||
110 | * @return string |
||
111 | */ |
||
112 | function alumni_convertorderbytrans($orderby) |
||
0 ignored issues
–
show
function alumni_convertorderbytrans() 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. ![]() |
|||
113 | { |
||
114 | global $main_lang; |
||
0 ignored issues
–
show
$main_lang 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. ![]() Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
115 | |||
116 | if ('view ASC' === $orderby) { |
||
117 | $orderbyTrans = '' . constant($main_lang . '_POPULARITYLTOM') . ''; |
||
0 ignored issues
–
show
$main_lang 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 | if ('view DESC' === $orderby) { |
||
120 | $orderbyTrans = '' . constant($main_lang . '_POPULARITYMTOL') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
121 | } |
||
122 | if ('lname ASC' === $orderby) { |
||
123 | $orderbyTrans = '' . constant($main_lang . '_NAMEATOZ') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
124 | } |
||
125 | if ('lname DESC' === $orderby) { |
||
126 | $orderbyTrans = '' . constant($main_lang . '_NAMEZTOA') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
127 | } |
||
128 | if ('school ASC' === $orderby) { |
||
129 | $orderbyTrans = '' . constant($main_lang . '_SCHOOLATOZ') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
130 | } |
||
131 | if ('school DESC' === $orderby) { |
||
132 | $orderbyTrans = '' . constant($main_lang . '_SCHOOLZTOA') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
133 | } |
||
134 | if ('studies ASC' === $orderby) { |
||
135 | $orderbyTrans = '' . constant($main_lang . '_STUDIESATOZ') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
136 | } |
||
137 | if ('studies DESC' === $orderby) { |
||
138 | $orderbyTrans = '' . constant($main_lang . '_STUDIESZTOA') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
139 | } |
||
140 | if ('year ASC' === $orderby) { |
||
141 | $orderbyTrans = '' . constant($main_lang . '_YEAROLD') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
142 | } |
||
143 | if ('year DESC' === $orderby) { |
||
144 | $orderbyTrans = '' . constant($main_lang . '_YEARNEW') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
145 | } |
||
146 | if ('date ASC' === $orderby) { |
||
147 | $orderbyTrans = '' . constant($main_lang . '_DATEOLD') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
148 | } |
||
149 | if ('date DESC' === $orderby) { |
||
150 | $orderbyTrans = '' . constant($main_lang . '_DATENEW') . ''; |
||
0 ignored issues
–
show
$main_lang 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. ![]() |
|||
151 | } |
||
152 | |||
153 | return $orderbyTrans; |
||
0 ignored issues
–
show
The variable
$orderbyTrans does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
154 | } |
||
155 | |||
156 | /** |
||
157 | * @param $orderby |
||
158 | * @return string |
||
159 | */ |
||
160 | function alumni_convertorderbyout($orderby) |
||
0 ignored issues
–
show
function alumni_convertorderbyout() 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. ![]() |
|||
161 | { |
||
162 | if ('lname ASC' === $orderby) { |
||
163 | $orderby = 'nameA'; |
||
164 | } |
||
165 | if ('school ASC' === $orderby) { |
||
166 | $orderby = 'schoolA'; |
||
167 | } |
||
168 | if ('studies ASC' === $orderby) { |
||
169 | $orderby = 'studiesA'; |
||
170 | } |
||
171 | if ('year ASC' === $orderby) { |
||
172 | $orderby = 'yearA'; |
||
173 | } |
||
174 | if ('date ASC' === $orderby) { |
||
175 | $orderby = 'dateA'; |
||
176 | } |
||
177 | if ('view ASC' === $orderby) { |
||
178 | $orderby = 'viewA'; |
||
179 | } |
||
180 | if ('lname DESC' === $orderby) { |
||
181 | $orderby = 'nameD'; |
||
182 | } |
||
183 | if ('school DESC' === $orderby) { |
||
184 | $orderby = 'schoolD'; |
||
185 | } |
||
186 | if ('studies DESC' === $orderby) { |
||
187 | $orderby = 'studiesD'; |
||
188 | } |
||
189 | if ('year DESC' === $orderby) { |
||
190 | $orderby = 'yearD'; |
||
191 | } |
||
192 | if ('date DESC' === $orderby) { |
||
193 | $orderby = 'dateD'; |
||
194 | } |
||
195 | if ('view DESC' === $orderby) { |
||
196 | $orderby = 'viewD'; |
||
197 | } |
||
198 | |||
199 | return $orderby; |
||
200 | } |
||
201 |
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.