Issues (51)

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/queryprinters/SM_KMLPrinter.php (1 issue)

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
use ParamProcessor\ParamDefinition;
4
use SMW\FileExportPrinter;
5
6
/**
7
 * SMWResultPrinter class for printing a query result as KML.
8
 *
9
 * @since 0.7.3
10
 *
11
 * @file SM_KMLPrinter.php
12
 * @ingroup SemanticMaps
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class SMKMLPrinter extends FileExportPrinter {
18
19
	/**
20
	 * Handler of the print request.
21
	 *
22
	 * @since 0.7.3
23
	 *
24
	 * @param SMWQueryResult $res
25
	 * @param $outputmode
26
	 *
27
	 * @return array
28
	 */
29
	public function getResultText( SMWQueryResult $res, $outputmode ) {
30
		if ( $outputmode == SMW_OUTPUT_FILE ) {
31
			return $this->getKML( $res, $outputmode );
32
		}
33
		else {
34
			return $this->getKMLLink( $res, $outputmode );
35
		}
36
	}
37
38
	/**
39
	 * @see SMWResultPrinter::handleParameters
40
	 *
41
	 * @since 1.0
42
	 *
43
	 * @param array $params
44
	 * @param $outputmode
45
	 */
46
	protected function handleParameters( array $params, $outputmode ) {
47
		$this->params = $params;
48
	}
49
50
	/**
51
	 * @see SMWResultPrinter::getParamDefinitions
52
	 *
53
	 * @since 3.0
54
	 *
55
	 * @param ParamDefinition[] $definitions
56
	 *
57
	 * @return array of ParamDefinition|array
58
	 */
59
	public function getParamDefinitions( array $definitions ) {
60
		global $egMapsDefaultLabel, $egMapsDefaultTitle;
61
62
		$params = parent::getParamDefinitions( $definitions );
63
64
		$params['text'] = [
65
			'message' => 'semanticmaps-kml-text',
66
			'default' => $egMapsDefaultLabel,
67
		];
68
69
		$params['title'] = [
70
			'message' => 'semanticmaps-kml-title',
71
			'default' => $egMapsDefaultTitle,
72
		];
73
74
		$params['linkabsolute'] = [
75
			'message' => 'semanticmaps-kml-linkabsolute',
76
			'type' => 'boolean',
77
			'default' => true,
78
		];
79
80
		$params['pagelinktext'] = [
81
			'message' => 'semanticmaps-kml-pagelinktext',
82
			'default' => wfMessage( 'semanticmaps-default-kml-pagelink' )->text(),
83
		];
84
85
		return $params;
86
	}
87
88
	/**
89
	 * Returns the KML for the query result.
90
	 *
91
	 * @since 0.7.3
92
	 *
93
	 * @param SMWQueryResult $res
94
	 * @param integer $outputmode
95
	 *
96
	 * @return string
97
	 */
98
	protected function getKML( SMWQueryResult $res, $outputmode ) {
99
		$queryHandler = new SMQueryHandler( $res, $outputmode, $this->params['linkabsolute'], $this->params['pagelinktext'], false );
100
		$queryHandler->setText( $this->params['text'] );
101
		$queryHandler->setTitle( $this->params['title'] );
102
		$queryHandler->setSubjectSeparator( '' );
103
104
		$formatter = new MapsKMLFormatter( $this->params );
105
106
		$shapes = $queryHandler->getShapes();
107
		$formatter->addPlacemarks( $shapes['locations'] );
108
109
		return $formatter->getKML();
110
	}
111
112
	/**
113
	 * Returns a link (HTML) pointing to a query that returns the actual KML file.
114
	 *
115
	 * @since 0.7.3
116
	 *
117
	 * @param SMWQueryResult $res
118
	 * @param integer $outputmode
119
	 *
120
	 * @return string
121
	 */
122
	protected function getKMLLink( SMWQueryResult $res, $outputmode ) {
123
		$searchLabel = $this->getSearchLabel( $outputmode );
124
		$link = $res->getQueryLink( $searchLabel ? $searchLabel : wfMessage( 'semanticmaps-kml-link' )->inContentLanguage()->text() );
0 ignored issues
show
Deprecated Code introduced by
The method SMWQueryResult::getQueryLink() has been deprecated with message: since SMW 1.8

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
125
		$link->setParameter( 'kml', 'format' );
126
		$link->setParameter( $this->params['linkabsolute'] ? 'yes' : 'no', 'linkabsolute' );
127
		$link->setParameter( $this->params['pagelinktext'], 'pagelinktext' );
128
129
		if ( $this->params['title'] !== '' ) {
130
			$link->setParameter( $this->params['title'], 'title' );
131
		}
132
133
		if ( $this->params['text'] !== '' ) {
134
			$link->setParameter( $this->params['text'], 'text' );
135
		}
136
137
		// Fix for offset-error in getQueryLink()
138
		// (getQueryLink by default sets offset to point to the next 
139
		// result set, fix by setting it to 0 if now explicitly set)
140
		if ( array_key_exists( 'offset', $this->params ) ) {
141
			$link->setParameter( $this->params['offset'], 'offset' );
142
		} else {
143
			$link->setParameter( 0, 'offset' );
144
		}
145
146
		if ( array_key_exists( 'limit', $this->params ) ) {
147
			$link->setParameter( $this->params['limit'], 'limit' );
148
		} else { // Use a reasonable default limit.
149
			$link->setParameter( 20, 'limit' );
150
		}
151
152
		$this->isHTML = ( $outputmode == SMW_OUTPUT_HTML );
153
154
		return $link->getText( $outputmode, $this->mLinker );
155
	}
156
157
	/**
158
	 * @see SMWIExportPrinter::getMimeType
159
	 *
160
	 * @since 2.0
161
	 *
162
	 * @param SMWQueryResult $queryResult
163
	 *
164
	 * @return string
165
	 */
166
	public function getMimeType( SMWQueryResult $queryResult ) {
167
		return 'application/vnd.google-earth.kml+xml';
168
	}
169
170
	/**
171
	 * @see SMWIExportPrinter::getFileName
172
	 *
173
	 * @since 2.0
174
	 *
175
	 * @param SMWQueryResult $queryResult
176
	 *
177
	 * @return string|boolean
178
	 */
179
	public function getFileName( SMWQueryResult $queryResult ) {
180
		return 'kml.kml';
181
	}
182
183
	/**
184
	 * @see SMWResultPrinter::getName()
185
	 */
186
	public final function getName() {
187
		return wfMessage( 'semanticmaps-kml' )->text();
188
	}
189
}
190