Issues (141)

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.

SemanticResultFormats.hooks.php (3 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
/**
4
 * Static class for hooks handled by the Semantic Result Formats.
5
 *
6
 * @since 1.7
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Jeroen De Dauw < [email protected] >
10
 * @author mwjames
11
 */
12
final class SRFHooks {
13
14
	/**
15
	 * Hook to add PHPUnit test cases.
16
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList
17
	 *
18
	 * @since 1.8
19
	 *
20
	 * @param array $files
21
	 *
22
	 * @return boolean
23
	 */
24
	public static function registerUnitTests( array &$files ) {
25
		// Keep this in alphabetical order please!
26
		$testFiles = [
27
28
			'Resources',
29
30
			// Formats
31
			'formats/Array',
32
			'formats/Dygraphs',
33
			'formats/EventCalendar',
34
			'formats/Gallery',
35
			'formats/Graph',
36
			'formats/Incoming',
37
			'formats/jqPlotChart',
38
			'formats/jqPlotSeries',
39
			'formats/ListWidget',
40
			'formats/Math',
41
			'formats/PageWidget',
42
			'formats/Sparkline',
43
			'formats/TagCloud',
44
			'formats/Timeseries',
45
			'formats/Tree',
46
			'formats/vCard',
47
			'formats/MediaPlayer',
48
			'formats/DataTables',
49
50
			// Boilerplate
51
			// Register your testclass
52
			// 'formats/Boilerplate',
53
		];
54
55
		foreach ( $testFiles as $file ) {
56
			$files[] = dirname( __FILE__ ) . '/tests/phpunit/' . $file . 'Test.php';
57
		}
58
59
		return true;
60
	}
61
62
	/**
63
	 * Add new JavaScript/QUnit testing modules
64
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
65
	 *
66
	 * @since: 1.9
67
	 *
68
	 * @param  array $testModules array of JavaScript testing modules
69
	 * @param  ResourceLoader $resourceLoader object
70
	 *
71
	 * @return boolean
72
	 */
73
	public static function registerQUnitTests( array &$testModules, ResourceLoader &$resourceLoader ) {
0 ignored issues
show
The parameter $resourceLoader 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...
74
		$testModules['qunit']['ext.srf.tests'] = [
75
			'scripts' => [
76
				// Base
77
				'tests/qunit/ext.srf.test.js',
78
				'tests/qunit/ext.srf.util.test.js',
79
80
				// Formats
81
				'tests/qunit/formats/ext.srf.formats.eventcalendar.tests.js',
82
				'tests/qunit/formats/ext.srf.formats.datatables.test.js',
83
				'tests/qunit/formats/ext.srf.formats.filtered.test.js',
84
				'tests/qunit/formats/ext.srf.formats.gallery.test.js',
85
				'tests/qunit/formats/ext.srf.formats.media.test.js',
86
				'tests/qunit/formats/ext.srf.formats.tagcloud.test.js',
87
88
				// Widgets
89
				'tests/qunit/widgets/ext.srf.widgets.eventcalendar.tests.js',
90
				'tests/qunit/widgets/ext.srf.widgets.optionslist.test.js',
91
				'tests/qunit/widgets/ext.srf.widgets.panel.test.js',
92
				'tests/qunit/widgets/ext.srf.widgets.parameters.test.js'
93
94
			],
95
			'dependencies' => [
96
				'ext.srf',
97
				'ext.srf.util',
98
				'ext.srf.eventcalendar',
99
				'ext.srf.datatables',
100
				'ext.srf.widgets',
101
				'ext.srf.gallery.overlay',
102
				'ext.srf.gallery.carousel',
103
				'ext.srf.gallery.slideshow',
104
				'ext.srf.gallery.redirect',
105
				'ext.srf.formats.media',
106
				'ext.srf.formats.tagcloud',
107
				'ext.srf.filtered.value-filter.select',
108
			],
109
			'position' => 'top',
110
			'localBasePath' => __DIR__,
111
			'remoteExtPath' => 'SemanticResultFormats',
112
		];
113
114
		return true;
115
	}
116
117
	/**
118
	 * Adds a link to Admin Links page.
119
	 *
120
	 * @since 1.7
121
	 *
122
	 * @param ALTree $admin_links_tree
123
	 *
124
	 * @return boolean
125
	 */
126
	public static function addToAdminLinks( ALTree &$admin_links_tree ) {
127
		$displaying_data_section = $admin_links_tree->getSection( wfMessage( 'smw_adminlinks_displayingdata' )->text() );
128
129
		// Escape is SMW hasn't added links.
130
		if ( is_null( $displaying_data_section ) ) {
131
			return true;
132
		}
133
134
		$smw_docu_row = $displaying_data_section->getRow( 'smw' );
135
		$srf_docu_label = wfMessage( 'adminlinks_documentation', wfMessage( 'srf-name' )->text() )->text();
136
		$smw_docu_row->addItem( AlItem::newFromExternalLink( 'https://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats', $srf_docu_label ) );
137
138
		return true;
139
	}
140
141
	/**
142
	 * Hook: ResourceLoaderGetConfigVars called right before
143
	 * ResourceLoaderStartUpModule::getConfig returns
144
	 *
145
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
146
	 *
147
	 * @param &$vars Array of variables to be added into the output of the startup module.
148
	 *
149
	 * @return true
150
	 */
151
	public static function onResourceLoaderGetConfigVars( &$vars ) {
152
153
		$vars['srf-config'] = [
154
			'version' => SRF_VERSION,
155
			'settings' => [
156
				'wgThumbLimits' => $GLOBALS['wgThumbLimits'],
157
				'srfgScriptPath' => $GLOBALS['srfgScriptPath'],
158
			]
159
		];
160
161
		return true;
162
	}
163
164
	/**
165
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
166
	 *
167
	 * @param OutputPage $outputPage
168
	 * @param Skin $skin
169
	 *
170
	 * @return true
171
	 */
172
	public static function onBeforePageDisplay ( &$outputPage, &$skin ) {
0 ignored issues
show
The parameter $skin 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...
173
174
		$outputPage->addModuleStyles( 'ext.srf.styles' );
175
176
		return true;
177
	}
178
179
	/**
180
	 * Hook: GetPreferences adds user preference
181
	 * @see https://www.mediawiki.org/wiki/Manual:Hooks/GetPreferences
182
	 *
183
	 * @param User $user
184
	 * @param array $preferences
185
	 *
186
	 * @return true
187
	 */
188
	public static function onGetPreferences( $user, &$preferences ) {
0 ignored issues
show
The parameter $user 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...
189
190
		// Intro text, do not escape the message here as it contains
191
		// href links
192
		$preferences['srf-prefs-intro'] = [
193
			'type' => 'info',
194
			'label' => '&#160;',
195
			'default' => wfMessage( 'srf-prefs-intro-text' )->parseAsBlock(),
196
			'section' => 'smw/srf',
197
			'raw' => 1,
198
		];
199
200
		// Enable auto update during a page refresh
201
		$preferences['srf-prefs-eventcalendar-options-update-default'] = [
202
			'type' => 'toggle',
203
			'label-message' => 'srf-prefs-eventcalendar-options-update-default',
204
			'section' => 'smw/srf-eventcalendar-options',
205
		];
206
207
		// Enable paneView by default
208
		$preferences['srf-prefs-eventcalendar-options-paneview-default'] = [
209
			'type' => 'toggle',
210
			'label-message' => 'srf-prefs-eventcalendar-options-paneview-default',
211
			'section' => 'smw/srf-eventcalendar-options',
212
		];
213
214
215
		// Enable auto update during a page refresh
216
		$preferences['srf-prefs-datatables-options-update-default'] = [
217
			'type' => 'toggle',
218
			'label-message' => 'srf-prefs-datatables-options-update-default',
219
			'section' => 'smw/srf-datatables-options',
220
		];
221
222
		// Enable local caching
223
		$preferences['srf-prefs-datatables-options-cache-default'] = [
224
			'type' => 'toggle',
225
			'label-message' => 'srf-prefs-datatables-options-cache-default',
226
			'section' => 'smw/srf-datatables-options',
227
		];
228
229
		return true;
230
	}
231
}
232