GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (13)

Security Analysis    not enabled

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.

src/classes/Util.php (4 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
2
3
namespace Selim;
4
5
class Util
6
{
7
    public static function stripPhpComments($str)
8
    {
9
        $regex_multiline = "/\\/\\*[^\\Z]*\\*\\//m";
10
        $regex_singleline = "/\\/\\/.*/m";
11
        $result = preg_filter($regex_multiline, "", $str);
12
        if ($result) {
13
            $str = $result;
14
        }
15
16
        return preg_filter($regex_singleline, "", $str);
17
    }
18
19
    public static function boolToString($bool)
20
    {
21
        return $bool ? 'true' : 'false';
22
    }
23
24
    public static function filterSitesByName(array $sites, $filterRegex)
25
    {
26
        $arr = array();
27
        foreach ($sites as $sc) {
28
            if (!$sc instanceof SiteConfig) {
29
                continue;
30
            }
31
            if (preg_match("/$filterRegex/", $sc->name)) {
32
                array_push($arr, $sc);
33
            }
34
        }
35
36
        return $arr;
37
    }
38
39
    public static function findInArrayWithRegex(array $arr, $regex)
40
    {
41
        foreach ($arr as $a) {
42
            if (preg_match($regex, $a)) {
43
                return $a;
44
            }
45
        }
46
47
        return null;
48
    }
49
50
    /**
51
     * @param array $sspages should contain only objects of class SilverstripePage
52
     * @param string $filterRegex
53
     * @return array all SilverstripePages that match the regex
54
     *
55
     */
56 View Code Duplication
    public static function filterPagesByModules(array $sspages, $filterRegex)
0 ignored issues
show
This method 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...
57
    {
58
        $arr = array();
59
        foreach ($sspages as $sspage) {
60
            if (!$sspage instanceof SilverstripePage) {
61
                continue;
62
            }
63
            if ($sspage->hasModule("/$filterRegex/")) {
64
                array_push($arr, $sspage);
65
            }
66
        }
67
68
        return $arr;
69
    }
70
71
72
    /**
73
     * @param array $sspages
74
     * @param string $env environment type dev OR live OR test
75
     * @return array  all SilverstripePages that have environment_type $env
76
     */
77 View Code Duplication
    public static function filterPagesByEnvironmentType($sspages, $env) {
0 ignored issues
show
This method 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...
78
        $arr = array();
79
        if(preg_match("/^(dev|test|live)$/",$env) === 1){
80
            foreach ($sspages as $sspage) {
81
                if (!$sspage instanceof SilverstripePage) {
82
                    continue;
83
                }
84
                if ($env === $sspage->getEnvironmentType()) {
85
                    array_push($arr, $sspage);
86
                }
87
            }
88
        }
89
        return $arr;
90
    }
91
92
    /**
93
     * @param array $sspages
94
     * @param string $filterRegex environment type dev OR live OR test
95
     *
96
     * @return array all SilverstripePages where the version string matches $filterRegex
97
     */
98 View Code Duplication
    public static function filterPagesByVersion($sspages, $filterRegex) {
0 ignored issues
show
This method 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...
99
        $arr = array();
100
        foreach ($sspages as $sspage) {
101
            if (!$sspage instanceof SilverstripePage) {
102
                continue;
103
            }
104
            if (preg_match("/$filterRegex/",$sspage->getVersion())) {
105
                array_push($arr, $sspage);
106
            }
107
        }
108
109
        return $arr;
110
    }
111
112
    /**
113
     * @param SilverstripePage[] $sspages
114
     * @param bool $da_val
115
     * @return SilverstripePage[]
116
     */
117
    public static function filterPagesByDefaultAdmin($sspages, $da_val = true) {
118
        $arr = array();
119
        $da_val = $da_val === true ? true : false;
120
        foreach ($sspages as $sspage) {
121
            if (!$sspage instanceof SilverstripePage) {
122
                continue;
123
            }
124
            if ($sspage->hasDefaultAdmin() === $da_val) {
125
                array_push($arr, $sspage);
126
            }
127
        }
128
        return $arr;
129
    }
130
131
    /**
132
     * @param $version "1.1.1" "2.1.4" "2.0"
133
     *
134
     * @return array [1,1,1] [2,1,4] [2,0,0]
135
     */
136
    public static function VersionStringsToArray($version)
137
    {
138
        $arr = array();
139
        $single = explode(".", $version);
140
141
        for ($i = 0;$i<3;$i++) {
142
            if (!isset($single[$i])) {
143
                $x = 0;
144
            } else {
145
                $x = intval($single[$i]);
146
            }
147
            array_push($arr, $x ? $x : 0);
148
        }
149
150
        return $arr;
151
    }
152
153
    public static function VersionStringsGreaterThenOrEqual($version1, $version2)
154
    {
155
        $v1 = Util::VersionStringsToArray($version1);
156
        $v2 = Util::VersionStringsToArray($version2);
157
        for ($i = 0; $i<3;$i++) {
158
            if ($v1[$i] < $v2[$i]) {
159
                return false;
160
            }
161
        }
162
163
        return true;
164
    }
165
166
    /**
167
     * puts blanks at the end of a string until it reaches the minimum length.
168
     *
169
     * @param string $str
170
     * @param int    $min
171
     */
172
    public static function forceStringMinLength(&$str, $min)
173
    {
174
        while (strlen($str) < $min) {
175
            $str .= " ";
176
        }
177
    }
178
179
    public static function reportError($string,$die = true) {
180
        if($die) {
181
            exit($string);
0 ignored issues
show
Coding Style Compatibility introduced by
The method reportError() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
182
        }else{
183
            echo($string);
184
        }
185
    }
186
}
187