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 (917)

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/File/File.php (7 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
class Nip_File_Exception extends Exception
0 ignored issues
show
Coding Style Compatibility introduced by
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.

Loading history...
4
{
5
}
6
7
class Nip_File extends Nip_Object
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
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.

Loading history...
8
{
9
10
    protected $_path;
11
    protected $_name;
12
    protected $_extension;
13
14
    public function __construct($path = false)
15
    {
16
        if ($path) {
17
            $this->setPath($path);
18
        }
19
    }
20
21
    /**
22
     * @param $target
23
     * @return $this
24
     * @throws Nip_File_Exception
25
     */
26 View Code Duplication
    public function move($target)
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...
27
    {
28
        $dir = dirname($target);
29
        if (!is_dir($target)) {
30
            mkdir($dir, 0755, true);
31
        }
32
33
        if (rename($this->getPath(), $target)) {
34
            $this->setPath($target);
35
        } else {
36
            throw new Nip_File_Exception("Cannot move $this->_path file to $target");
37
        }
38
        return $this;
39
    }
40
41
    public function getPath()
42
    {
43
        return $this->_path;
44
    }
45
46
    public function setPath($path)
47
    {
48
        $this->_name = basename($path);
49
        $this->_extension = pathinfo($path, PATHINFO_EXTENSION);
50
        $this->_path = $path;
51
        return $this;
52
    }
53
54
    /**
55
     * @param $target
56
     * @return $this
57
     * @throws Nip_File_Exception
58
     */
59 View Code Duplication
    public function copy($target)
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...
60
    {
61
        $dir = dirname($target);
62
        if (!is_dir($target)) {
63
            mkdir($dir, 0755, true);
64
        }
65
66
        if (copy($this->getPath(), $target)) {
67
            $this->setPath($target);
68
        } else {
69
            throw new Nip_File_Exception("Cannot copy $this->_path file to $target");
70
        }
71
        return $this;
72
    }
73
74
    /**
75
     * @param string $target
76
     * @return Nip_Process
77
     */
78 View Code Duplication
    public function unzip($target)
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...
79
    {
80
        if (!is_dir($target)) {
81
            mkdir($target, 0755, true);
82
        }
83
84
        $process = new Nip_Process("unzip {$this->_path}  -d $target");
85
        $process->run();
86
87
        return $process;
88
    }
89
90
    public function download($filename = false, $contentType = false)
91
    {
92
        if (!$filename) {
93
            $filename = $this->getName();
94
        }
95
        if (!$contentType) {
96
            $contentType = "application/force-download";
97
        }
98
99
        header("Pragma: public");
100
        header("Expires: 0");
101
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
102
        header("Cache-Control: private", false);
103
        header("Content-Type: $contentType");
104
        header("Content-Disposition: attachment; filename=\"$filename\"");
105
        header("Content-Length: {$this->getSize()}");
106
        header("Content-Transfer-Encoding: binary");
107
108
        readfile($this->getPath());
109
        exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The method download() 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...
110
    }
111
112
    public function getName()
113
    {
114
        return $this->_name;
115
    }
116
117
    public function getSize()
118
    {
119
        return filesize($this->getPath());
120
    }
121
122
    public function delete()
123
    {
124
        unlink($this->getPath());
125
    }
126
127
    public function getExtension()
128
    {
129
        return $this->_extension;
130
    }
131
132
    public function getTime()
133
    {
134
        return filemtime($this->getPath());
135
    }
136
137
    public function getMimeType()
138
    {
139
        if (function_exists('mime_content_type')) {
140
            return mime_content_type($this->getPath());
141
142
        } elseif (function_exists('finfo_open')) {
143
            $finfo = finfo_open(FILEINFO_MIME);
144
            $mimetype = finfo_file($finfo, $this->getPath());
145
            finfo_close($finfo);
146
            return $mimetype;
147
        }
148
149
        return "unknown";
150
    }
151
152
}