Issues (116)

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.

web/index.php (5 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
require dirname(dirname(__FILE__)).'/vendor/autoload.php';
3
use morphos\Gender;
4
use morphos\Russian\CardinalNumeralGenerator;
5
use morphos\Russian\Cases;
6
use morphos\Russian\NounDeclension;
7
use morphos\Russian\GeographicalNamesInflection;
8
use morphos\Russian\NounPluralization;
9
use morphos\Russian\OrdinalNumeralGenerator;
10
11
function safe_string($string) {
12
	return preg_replace('~[^А-Яа-яЁё -]~u', null, trim($string));
13
}
14
15
foreach (array('name', 'noun', 'geographical-name') as $field) {
16
	if (isset($_POST[$field])) {
17
		$_POST[$field] = safe_string($_POST[$field]);
18
	}
19
}
20
21
$gender_labels = array(Gender::MALE => 'мужской', Gender::FEMALE => 'женский', Gender::NEUTER => 'средний');
22
23
?><html>
24
<head>
25
	<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
26
	<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
27
	<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
28
	<title>Morphos Testing Script</title>
29
	<style>
30
	.demo-layout-transparent {
31
	}
32
	.demo-layout-transparent .mdl-layout__header,
33
	.demo-layout-transparent .mdl-layout__drawer-button {
34
	  /* This background is dark, so we set text to white. Use 87% black instead if
35
	     your background is light. */
36
	  color: white;
37
	  background-color: #0B5A78;
38
	}
39
	</style>
40
</head>
41
<body>
42
	<div class="demo-layout-transparent mdl-layout mdl-js-layout">
43
		<header class="mdl-layout__header mdl-layout__header--transparent">
44
			<div class="mdl-layout__header-row">
45
				<!-- Title -->
46
				<span class="mdl-layout-title">Morphos Testing Script</span>
47
				<!-- Add spacer, to align navigation to the right -->
48
				<div class="mdl-layout-spacer"></div>
49
				<!-- Navigation -->
50
				<!-- <nav class="mdl-navigation">
51
					<a class="mdl-navigation__link" href="">Link</a>
52
					<a class="mdl-navigation__link" href="">Link</a>
53
					<a class="mdl-navigation__link" href="">Link</a>
54
					<a class="mdl-navigation__link" href="">Link</a>
55
				</nav> -->
56
			</div>
57
		</header>
58
		<div class="mdl-layout__drawer">
59
			<span class="mdl-layout-title">Useful links</span>
60
				<nav class="mdl-navigation">
61
				<a class="mdl-navigation__link" href="https://github.com/wapmorgan/Morphos">GitHub</a>
62
				<a class="mdl-navigation__link" href="https://packagist.org/packages/wapmorgan/morphos">Packagist</a>
63
				<a class="mdl-navigation__link" href="https://github.com/wapmorgan/Morphos-Blade">Blade adapter</a>
64
				<a class="mdl-navigation__link" href="https://github.com/wapmorgan/Morphos-Twig">Twig adapter</a>
65
			</nav>
66
		</div>
67
		<main class="mdl-layout__content">
68
69
			<div class="mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
70
				<div class="mdl-tabs__tab-bar">
71
			      <a href="#personal-names" class="mdl-tabs__tab is-active">Склонение имен собственных</a>
72
			      <a href="#geographical-names" class="mdl-tabs__tab">Склонение географических названий</a>
73
			      <a href="#nouns" class="mdl-tabs__tab">Склонение существительных</a>
74
			      <a href="#numerals" class="mdl-tabs__tab">Генерация числительных</a>
75
				</div>
76
77
				<div class="mdl-tabs__panel" id="nouns">
78
					<div class="mdl-grid">
79
						<div class="mdl-cell mdl-cell--6-col" style="text-align: right;">
80
							<form method="post" action="#nouns">
81
								<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp" style="margin: 0 0 0 auto;">
82
									<tbody>
83
										<tr>
84
											<td class="mdl-data-table__cell--non-numeric">
85
												<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
86
													<input name="noun" value="<?= isset($_POST['noun']) ? $_POST['noun'] : null ?>" class="mdl-textfield__input" id="noun-input">
87
													<label class="mdl-textfield__label" for="noun-input">Существительное</label>
88
											</td>
89
										</tr>
90
										<tr>
91
											<td class="mdl-data-table__cell--non-numeric"><label><input type="checkbox" name="animate" <?= isset($_POST['animate']) ? "checked='checked'" : null ?> /> Одушевлённое</label></td>
92
										</tr>
93
										<tr>
94
											<td class="mdl-data-table__cell--non-numeric"><input type="submit" value="Просклонять"/> <input name="count" type="submit" value="Посчитать до 100"/></td>
95
										</tr>
96
									</tbody>
97
								</table>
98
							</form>
99
						</div>
100
						<div class="mdl-cell mdl-cell--6-col" style="text-align: left;">
101
<?php if (isset($_POST['noun'])): ?>
102
	<?php
103
	$animate = !empty($_POST['animate']);
104
	$noun = $_POST['noun'];
105
	?>
106
	<?php if (!isset($_POST['count'])): ?>
107
	<?php
108
	$cases = NounDeclension::getCases($noun, $animate);
109
	?>
110
		<table>
111
			<tr>
112
				<td>
113
						<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
114
							<tbody>
115
								<tr>
116
									<td class="mdl-data-table__cell--non-numeric" colspan="2" style="text-align: center;"><?= $noun ?> (<?=NounDeclension::getDeclension($noun)?> склонение)</td>
117
								</tr>
118 View Code Duplication
								<?php foreach(array(Cases::IMENIT => 'Именительный', Cases::RODIT => 'Родительный', Cases::DAT => 'Дательный', Cases::VINIT => 'Винительный', Cases::TVORIT => 'Творительный', Cases::PREDLOJ => 'Предложный') as $case => $name): ?>
0 ignored issues
show
This code seems to be duplicated across 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...
119
									<tr>
120
										<td class="mdl-data-table__cell--non-numeric"><?=$name?></td>
121
										<td class="mdl-data-table__cell--non-numeric"><?=$cases[$case]?></td>
122
									</tr>
123
								<?php endforeach; ?>
124
							</tbody>
125
						</table>
126
				</td>
127
				<td>
128
	<?php
129
	$cases = NounPluralization::getCases($noun, $animate);
130
	?>
131
						<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
132
							<tbody>
133
								<tr>
134
									<td class="mdl-data-table__cell--non-numeric" colspan="2" style="text-align: center;"><?=$_POST['noun']?> (<?=NounDeclension::getDeclension($noun)?> склонение) во множественном числе</td>
135
								</tr>
136 View Code Duplication
								<?php foreach(array(Cases::IMENIT => 'Именительный', Cases::RODIT => 'Родительный', Cases::DAT => 'Дательный', Cases::VINIT => 'Винительный', Cases::TVORIT => 'Творительный', Cases::PREDLOJ => 'Предложный') as $case => $name): ?>
0 ignored issues
show
This code seems to be duplicated across 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...
137
									<tr>
138
										<td class="mdl-data-table__cell--non-numeric"><?=$name?></td>
139
										<td class="mdl-data-table__cell--non-numeric"><?=$cases[$case]?></td>
140
									</tr>
141
								<?php endforeach; ?>
142
							</tbody>
143
						</table>
144
				</td>
145
			</tr>
146
		</table>
147
			<?php else: ?>
148
				<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
149
					<tbody>
150
						<tr>
151
							<td class="mdl-data-table__cell--non-numeric" colspan="2" style="text-align: center;"><?=$noun?> (<?=NounDeclension::getDeclension($noun)?> склонение)</td>
152
						</tr>
153
						<?php for ($i = 1; $i <= 20; $i++): ?>
154
							<tr>
155
								<td class="mdl-data-table__cell--non-numeric"><?=$i.' '.NounPluralization::pluralize($noun, $i, $animate)?></td>
156
								<td class="mdl-data-table__cell--non-numeric"><?=($i+20).' '.NounPluralization::pluralize($noun, $i + 20, $animate)?></td>
157
								<td class="mdl-data-table__cell--non-numeric"><?=($i+40).' '.NounPluralization::pluralize($noun, $i + 40, $animate)?></td>
158
								<td class="mdl-data-table__cell--non-numeric"><?=($i+60).' '.NounPluralization::pluralize($noun, $i + 60, $animate)?></td>
159
								<td class="mdl-data-table__cell--non-numeric"><?=($i+80).' '.NounPluralization::pluralize($noun, $i + 80, $animate)?></td>
160
							</tr>
161
						<?php endfor; ?>
162
					</tbody>
163
				</table>
164
			<?php endif; ?>
165
		<?php endif; ?>
166
						</div>
167
					</div>
168
				</form>
169
			</div>
170
171
			<div class="mdl-tabs__panel" id="geographical-names">
172
				<div class="mdl-grid">
173
					<div class="mdl-cell mdl-cell--6-col" style="text-align: right;">
174
						<form method="post" action="#geographical-names">
175
							<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp" style="margin: 0 0 0 auto;">
176
								<tbody>
177
									<tr>
178
										<td class="mdl-data-table__cell--non-numeric">
179
											<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
180
											<input name="geographical-name" value="<?= isset($_POST['geographical-name']) ? $_POST['geographical-name'] : null ?>" class="mdl-textfield__input" id="geographical-name-input">
181
											<label class="mdl-textfield__label" for="geographical-name-input">Город, страна</label>
182
											</div>
183
										</td>
184
									</tr>
185
									<tr>
186
										<td class="mdl-data-table__cell--non-numeric">
187
											<input type="submit" value="Просклонять"/>
188
										</td>
189
									</tr>
190
								</tbody>
191
							</table>
192
						</form>
193
					</div>
194
					<div class="mdl-cell mdl-cell--6-col" style="text-align: left;">
195
			<?php if (isset($_POST['geographical-name'])): ?>
196
	<?php
197
	$geographical_name = $_POST['geographical-name'];
198
	$cases = GeographicalNamesInflection::getCases($geographical_name);
199
	?>
200
						<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
201
							<tbody>
202
								<tr>
203
									<td class="mdl-data-table__cell--non-numeric" colspan="2" style="text-align: center;"><?=$geographical_name?></td>
204
								</tr>
205 View Code Duplication
								<?php foreach(array(Cases::IMENIT => 'Именительный', Cases::RODIT => 'Родительный', Cases::DAT => 'Дательный', Cases::VINIT => 'Винительный', Cases::TVORIT => 'Творительный', Cases::PREDLOJ => 'Предложный') as $case => $name): ?>
0 ignored issues
show
This code seems to be duplicated across 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...
206
									<tr>
207
										<td class="mdl-data-table__cell--non-numeric"><?=$name?></td>
208
										<td class="mdl-data-table__cell--non-numeric"><?=$cases[$case]?></td>
209
									</tr>
210
								<?php endforeach; ?>
211
							</tbody>
212
						</table>
213
		<?php endif; ?>
214
					</div>
215
				</div>
216
			</div>
217
218
			<div class="mdl-tabs__panel is-active" id="personal-names">
219
				<div class="mdl-grid">
220
					<div class="mdl-cell mdl-cell--6-col" style="text-align: right;">
221
						<form method="post" action="#personal-names">
222
							<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp" style="margin: 0 0 0 auto;">
223
								<tbody>
224
									<tr>
225
										<td class="mdl-data-table__cell--non-numeric">
226
											<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
227
												<input name="name" value="<?= isset($_POST['name']) ? $_POST['name'] : null ?>" class="mdl-textfield__input" id="name-input">
228
												<label class="mdl-textfield__label" for="name-inpuy">Фамилия Имя [Отчество]</label>
229
											</div>
230
										</td>
231
									</tr>
232
									<tr>
233
										<td class="mdl-data-table__cell--non-numeric">
234
											Выберите пол:
235
											<label><input type="radio" name="gender" value="" <?= !isset($_POST['gender']) || !in_array($_POST['gender'], array(Gender::MALE, Gender::FEMALE)) ? "checked='checked'" : null ?> /> Автоматически </label>
236
											<label><input type="radio" name="gender" value="<?=morphos\Gender::MALE?>" <?= isset($_POST['gender']) && $_POST['gender'] == morphos\Gender::MALE ? "checked='checked'" : null ?> /> Мужской </label>
237
											<label><input type="radio" name="gender" value="<?=morphos\Gender::FEMALE?>" <?= isset($_POST['gender']) && $_POST['gender'] == morphos\Gender::FEMALE ? "checked='checked'" : null ?> /> Женский </label>
238
										</td>
239
									</tr>
240
									<tr>
241
										<td class="mdl-data-table__cell--non-numeric">
242
											<input type="submit" value="Просклонять"/>
243
										</td>
244
									</tr>
245
								</tbody>
246
							</table>
247
						</form>
248
					</div>
249
					<div class="mdl-cell mdl-cell--6-col" style="text-align: left;">
250
<?php if (isset($_POST['name'])): ?>
251
	<?php
252
	$name = $_POST['name'];
253
	$gender = !empty($_POST['gender']) ? $_POST['gender'] : morphos\Russian\detectGender($name);
254
	$cases = morphos\Russian\inflectName($name, null, $gender);
255
	if ($cases !== false):
256
	?>
257
						<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
258
							<tbody>
259
								<tr>
260
									<td class="mdl-data-table__cell--non-numeric" colspan="2" style="text-align: center;"><?=$name?> (<?= isset($gender_labels[$gender]) ? $gender_labels[$gender] : 'неопределенный' ?> пол)</td>
261
								</tr>
262 View Code Duplication
								<?php foreach(array(Cases::IMENIT => 'Именительный', Cases::RODIT => 'Родительный', Cases::DAT => 'Дательный', Cases::VINIT => 'Винительный', Cases::TVORIT => 'Творительный', Cases::PREDLOJ => 'Предложный') as $case => $name): ?>
0 ignored issues
show
This code seems to be duplicated across 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...
263
									<tr>
264
										<td class="mdl-data-table__cell--non-numeric"><?=$name?></td>
265
										<td class="mdl-data-table__cell--non-numeric"><?=$cases[$case]?></td>
266
									</tr>
267
								<?php endforeach; ?>
268
							</tbody>
269
						</table>
270
		<?php endif; ?>
271
		<?php endif; ?>
272
					</div>
273
				</div>
274
			</div>
275
276
			<div class="mdl-tabs__panel" id="numerals">
277
					<div class="mdl-grid">
278
						<div class="mdl-cell mdl-cell--6-col" style="text-align: right;">
279
							<form method="post" action="#numerals">
280
								<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp" style="margin: 0 0 0 auto;">
281
									<tbody>
282
										<tr>
283
											<td class="mdl-data-table__cell--non-numeric">
284
												<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
285
													<input name="number" value="<?= isset($_POST['number']) ? intval($_POST['number']) : null ?>" class="mdl-textfield__input" id="number-input">
286
													<label class="mdl-textfield__label" for="number-input">Число</label>
287
												</div>
288
											</td>
289
										</tr>
290
										<tr>
291
											<td class="mdl-data-table__cell--non-numeric">
292
												Выберите пол связанного числительного:
293
												<label><input type="radio" name="gender" value="<?=morphos\Gender::NEUTER?>" <?= isset($_POST['gender']) && $_POST['gender'] == morphos\Gender::NEUTER ? "checked='checked'" : null ?> /> Средний </label>
294
												<label><input type="radio" name="gender" value="<?=morphos\Gender::MALE?>" <?= isset($_POST['gender']) && $_POST['gender'] == morphos\Gender::MALE ? "checked='checked'" : null ?> /> Мужской </label>
295
												<label><input type="radio" name="gender" value="<?=morphos\Gender::FEMALE?>" <?= isset($_POST['gender']) && $_POST['gender'] == morphos\Gender::FEMALE ? "checked='checked'" : null ?> /> Женский </label>
296
											</td>
297
										</tr>
298
										<tr>
299
											<td class="mdl-data-table__cell--non-numeric"><input type="submit" name="ordinal" value="Сгенерировать числительные"/></td>
300
										</tr>
301
									</tbody>
302
								</table>
303
							</form>
304
						</div>
305
						<div class="mdl-cell mdl-cell--6-col" style="text-align: left;">
306
<?php if (isset($_POST['number'])): ?>
307
	<?php
308
	$number = intval($_POST['number']);
309
	$gender = isset($_POST['gender']) ? $_POST['gender'] : morphos\Gender::MALE;
310
	$cardinal = CardinalNumeralGenerator::getCases($number, $gender);
311
  $ordinal = OrdinalNumeralGenerator::getCases($number, $gender);
312
	?>
313
	<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
314
		<thead>
315
				<th class="mdl-data-table__cell--non-numeric" style="text-align: center;"><?=$number?> (<?= $gender_labels[$gender] ?> род)</th>
316
				<th class="mdl-data-table__cell--non-numeric" style="text-align: center;">Количественное</th>
317
				<th class="mdl-data-table__cell--non-numeric" style="text-align: center;">Порядковое</th>
318
		</thead>
319
		<tbody>
320 View Code Duplication
			<?php foreach(array(Cases::IMENIT => 'Именительный', Cases::RODIT => 'Родительный', Cases::DAT => 'Дательный', Cases::VINIT => 'Винительный', Cases::TVORIT => 'Творительный', Cases::PREDLOJ => 'Предложный') as $case => $name): ?>
0 ignored issues
show
This code seems to be duplicated across 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...
321
				<tr>
322
					<td class="mdl-data-table__cell--non-numeric"><?=$name?></td>
323
					<td class="mdl-data-table__cell--non-numeric"><?=$cardinal[$case]?></td>
324
					<td class="mdl-data-table__cell--non-numeric"><?=$ordinal[$case]?></td>
325
				</tr>
326
			<?php endforeach; ?>
327
		</tbody>
328
	</table>
329
		<?php endif; ?>
330
						</div>
331
					</div>
332
				</form>
333
			</div>
334
335
		</main>
336
	</div>
337
</body>
338
</html>