Issues (61)

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/LegacyModel/Location.php (2 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
declare( strict_types = 1 );
4
5
namespace Maps\LegacyModel;
6
7
use DataValues\Geo\Values\LatLongValue;
8
9
/**
10
 * Class describing a single location (geographical point).
11
 *
12
 * TODO: rethink the design of this class after deciding on what actual role it has
13
 *
14
 * @since 3.0
15
 *
16
 * @licence GNU GPL v2+
17
 * @author Jeroen De Dauw < [email protected] >
18
 * @author Daniel Werner
19
 */
20
class Location extends BaseElement {
21
22
	/**
23
	 * @var LatLongValue
24
	 */
25
	private $coordinates;
26
27
	/**
28
	 * @var string
29
	 */
30
	private $address;
31
32
	/**
33
	 * @var string
34
	 */
35
	private $icon = '';
36
37
	/**
38
	 * @var string
39
	 */
40
	private $group = '';
41
42
	/**
43
	 * @var string
44
	 */
45
	private $inlineLabel = '';
46
47
	/**
48
	 * @var string
49
	 */
50
	private $visitedIcon = '';
51
52 77
	public function __construct( LatLongValue $coordinates, string $title = '', string $text = '' ) {
53 77
		$this->coordinates = $coordinates;
54 77
		$this->setTitle( $title );
55 77
		$this->setText( $text );
56 77
	}
57
58 3
	public static function newFromLatLon( float $lat, float $lon ): self {
59 3
		return new self( new LatLongValue( $lat, $lon ) );
60
	}
61
62 8
	public function getCoordinates(): LatLongValue {
63 8
		return $this->coordinates;
64
	}
65
66 18
	public function getJSONObject( string $defText = '', string $defTitle = '', string $defIconUrl = '',
67
		string $defGroup = '', string $defInlineLabel = '', string $defVisitedIcon = '' ): array {
68
69 18
		$parentArray = parent::getJSONObject( $defText, $defTitle );
0 ignored issues
show
Deprecated Code introduced by
The method Maps\LegacyModel\BaseElement::getJSONObject() has been deprecated.

This method has been deprecated.

Loading history...
70
71
		$array = [
72 18
			'lat' => $this->coordinates->getLatitude(),
73 18
			'lon' => $this->coordinates->getLongitude(),
74 18
			'icon' => $this->hasIcon() ? \Maps\MapsFunctions::getFileUrl( $this->getIcon() ) : $defIconUrl,
0 ignored issues
show
Deprecated Code introduced by
The method Maps\MapsFunctions::getFileUrl() has been deprecated.

This method has been deprecated.

Loading history...
75
		];
76 18
		$val = $this->getAddress();
77 18
		if ( $val !== '' ) {
78
			$array['address'] = $val;
79
		}
80 18
		$val = $this->hasGroup() ? $this->getGroup() : $defGroup;
81 18
		if ( !empty( $val ) ) {
82
			$array['group'] = $val;
83
		}
84 18
		$val = $this->hasInlineLabel() ? $this->getInlineLabel() : $defInlineLabel;
85 18
		if ( !empty( $val ) ) {
86 1
			$array['inlineLabel'] = $val;
87
		}
88 18
		$val = $this->hasVisitedIcon() ? $this->getVisitedIcon() : $defVisitedIcon;
89 18
		if ( !empty( $val ) ) {
90
			$array['visitedicon'] = $val;
91
		}
92
93 18
		return array_merge( $parentArray, $array );
94
	}
95
96 18
	public function hasIcon(): bool {
97 18
		return $this->icon !== '';
98
	}
99
100
	public function getIcon(): string {
101
		return $this->icon;
102
	}
103
104 4
	public function setIcon( string $icon ) {
105 4
		$this->icon = $icon;
106 4
	}
107
108
	/**
109
	 * Returns the address corresponding to this location.
110
	 * If there is none, and empty sting is returned.
111
	 */
112 18
	public function getAddress(): string {
113 18
		if ( is_null( $this->address ) ) {
114 18
			$this->address = '';
115
		}
116
117 18
		return $this->address;
118
	}
119
120
	/**
121
	 * Returns whether Location is assigned to a group.
122
	 */
123 18
	public function hasGroup(): bool {
124 18
		return $this->group !== '';
125
	}
126
127
	public function getGroup(): string {
128
		return $this->group;
129
	}
130
131 1
	public function setGroup( string $group ) {
132 1
		$this->group = trim( $group );
133 1
	}
134
135 18
	public function hasInlineLabel(): bool {
136 18
		return $this->inlineLabel !== '';
137
	}
138
139 1
	public function getInlineLabel(): string {
140 1
		return $this->inlineLabel;
141
	}
142
143 1
	public function setInlineLabel( string $label ) {
144 1
		$this->inlineLabel = $label;
145 1
	}
146
147 18
	public function hasVisitedIcon(): bool {
148 18
		return $this->visitedIcon !== '';
149
	}
150
151
	public function getVisitedIcon(): string {
152
		return $this->visitedIcon;
153
	}
154
155
	public function setVisitedIcon( string $visitedIcon ) {
156
		$this->visitedIcon = $visitedIcon;
157
	}
158
159
}
160