Issues (5)

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.

src/Models/Icon.php (1 issue)

Severity

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 OpenMindParser\Models;
4
5
use OpenMindParser\Exceptions\UnexistentFileException;
6
7
/*Object that represent an Icon.*/
8
class Icon 
9
{
10
	/**
11
	 * @var String $name : The name of the icon without the path or the extension.
12
	 */
13
	private $name;
14
	/**
15
	 * @var String $fullName : The name of the icon without the path but with the extension.
16
	 */
17
	private $fullName;
18
	/**
19
	 * @var String $filePath : The file path of the icon. If it is a builtin icon, then it is in the 'img' directory of the project.
20
	 */
21
	private $path;
22
	/**
23
	 * @var String $shortUri : The short uri to thye image. Will be used for exports. If it is a builtin icon, value will be '/img/'.
24
	 */
25
	private $shortUri;
26
	/**
27
	 * @var int $size : The size of the file.
28
	 */
29
	private $size;
30
	/**
31
	 * @var String $extension : The extension of the icon file without the leading dot. If it is a builtin icon, then it is 'png'.
32
	 */
33
	private $extension;
34
	
35
	/**
36
	 * The constructor. Use setIcon method.
37
	 * 
38
	 * @param String $name : The name of the icon without the path or the extension.
39
	 * @param String $path : The file path of the icon. If it is a builtin icon, then it is in the 'img' directory of the project.
40
	 * @param String $shortUri : The short uri to thye image. Will be used for exports. If it is a builtin icon, value will be '/img/'.
41
	 * @param int $size : The size of the file.
42
	 * @param String $extension : The extension of the icon file without the leading dot. If it is a builtin icon, then it is 'png'.
43
	 */ 
44
	public function __construct($name = null, $extension = null, $path = null, $shortUri = null, $size = null) {
45
		if(!empty($name)) {
46
			$this->setIcon($name, $extension, $path, $shortUri, $size);
47
		}
48
	}
49
	
50
	/**
51
	 * Fill all the instance attributes according to the given parameters.
52
	 * If only the name is given , then it will assume that a builtin icon is beeing used so the aother attributes will be filled following this logic.
53
	 * 
54
	 * @param String $name : The name of the icon without the path or the extension.
55
	 * @param String $path : The file path of the icon. If it is a builtin icon, then it is in the 'img' directory of the project.
56
	 * @param String $shortUri : The short uri to thye image. Will be used for exports. If it is a builtin icon, value will be '/img/'.
57
	 * @param int $size : The size of the file.
58
	 * @param String $extension : The extension of the icon file without the leading dot. If it is a builtin icon, then it is 'png'.
59
	 */ 
60
	public function setIcon($name, $extension = null, $path = null, $shortUri = null, $size = null) {
0 ignored issues
show
The parameter $size is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
61
		$this->name = $name;
62
		$this->extension = $extension ?: 'png';
63
		$this->fullName = $this->name.'.'.$this->extension;
64
		$this->shortUri = $shortUri ?: '/img/'.$this->fullName;
65
		$this->path = $path ?: realpath(__DIR__.'/../../img/'.$this->fullName);
66
		
67
		if(!file_exists($this->path)) {
68
			throw new UnexistentFileException('The file '.$this->path.' does not exist !');
69
		}
70
		
71
		$this->size = filesize($this->path);
72
	}
73
	
74
	/**
75
	 * Return icon name.
76
	 * 
77
	 * @return String : the icon name.
78
	 */
79
	public function getName() {
80
		return $this->name;
81
	}
82
	
83
	/**
84
	 * Return the full icon name.
85
	 * 
86
	 * @return String : the full icon name.
87
	 */
88
	public function getFullName() {
89
		return $this->fullName;
90
	}
91
	
92
	/**
93
	 * Return icon extension.
94
	 * 
95
	 * @return String : the icon extension.
96
	 */
97
	public function getExtension() {
98
		return $this->extension;
99
	}
100
	
101
	/**
102
	 * Return icon file path.
103
	 * 
104
	 * @return String : the icon path.
105
	 */
106
	 public function getPath() {
107
	 	return $this->path;
108
	 }
109
	
110
	/**
111
	 * Return icon short uri.
112
	 * 
113
	 * @return String : the icon short uri.
114
	 */
115
	 public function getShortUri() {
116
	 	return $this->shortUri;
117
	 }
118
	
119
	/**
120
	 * Set the icon short uri.
121
	 * 
122
	 * @return String : the icon uri.
123
	 */
124
	 public function setShortUri($shortUri) {
125
	 	$this->shortUri = $shortUri;
126
	 }
127
	
128
	/**
129
	 * Return icon name.
130
	 * 
131
	 * @return int : the icon size.
132
	 */
133
	public function getSize() {
134
		return $this->size;
135
	}
136
	
137
	/**
138
	 * Transform the objects tree in an array tree.
139
	 * 
140
	 * @return Array $array : The array tree.
141
	 */
142
	public function toArray() {
143
		return get_object_vars($this);
144
	}
145
	
146
	/**
147
	 * Magic to String method.
148
	 * 
149
	 * @return String
150
	 */
151
	public function __toString() {
152
		return $this->getPath();
153
	}
154
}