Issues (884)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

include/functions.php (25 issues)

Upgrade to new PHP Analysis Engine

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
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 26 and the first side effect is on line 21.

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.

Loading history...
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.

Loading history...
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.

Loading history...
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 global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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.

Loading history...
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.

Loading history...
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 global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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 global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
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.

Loading history...
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