Issues (4122)

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.

languages/classes/LanguageTyv.php (15 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
 * Tyvan (Тыва дыл) specific code.
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License along
16
 * with this program; if not, write to the Free Software Foundation, Inc.,
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
 * http://www.gnu.org/copyleft/gpl.html
19
 *
20
 * @file
21
 * @ingroup Language
22
 */
23
24
/**
25
 * Tyvan localization (Тыва дыл)
26
 *
27
 * From friends at tyvawiki.org
28
 *
29
 * @ingroup Language
30
 */
31
class LanguageTyv extends Language {
32
	/**
33
	 * Grammatical transformations, needed for inflected languages
34
	 * Invoked by putting {{grammar:case|word}} in a message
35
	 *
36
	 * @param string $word
37
	 * @param string $case
38
	 * @return string
39
	 */
40
	function convertGrammar( $word, $case ) {
41
		global $wgGrammarForms;
42
		if ( isset( $wgGrammarForms['tyv'][$case][$word] ) ) {
43
			return $wgGrammarForms['tyv'][$case][$word];
44
		}
45
46
		// Set up some constants...
47
		$allVowels = [ "е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я" ];
48
		$frontVowels = [ "е", "и", "э", "ө", "ү" ];
49
		$backVowels = [ "а", "ё", "о", "у", "ы", "ю", "я" ];
50
		$unroundFrontVowels = [ "е", "и", "э" ];
51
		$roundFrontVowels = [ "ө", "ү" ];
52
		$unroundBackVowels = [ "а", "ы", "я" ];
53
		$roundBackVowels = [ "ё", "о", "у", "ю" ];
54
		$unvoicedPhonemes = [ "т", "п", "с", "ш", "к", "ч", "х" ];
55
		$directiveUnvoicedStems = [ "т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң" ];
56
		$directiveVoicedStems = [ "д", "б", "з", "ж", "г", "р", "й" ];
57
58
		// Put the word in a form we can play with since we're using UTF-8
59
		preg_match_all( '/./us', $word, $ar );
60
61
		// Here's the last letter in the word
62
		$wordEnding = $ar[0][count( $ar[0] ) - 1];
63
64
		// Here's an array with the order of the letters in the word reversed so
65
		// we can find a match quicker. *shrug*
66
		$wordReversed = array_reverse( $ar[0] );
67
68
		// Find the last vowel in the word
69
		$wordLastVowel = null;
70 View Code Duplication
		foreach ( $wordReversed as $xvalue ) {
71
			foreach ( $allVowels as $yvalue ) {
72
				if ( strcmp( $xvalue, $yvalue ) == 0 ) {
73
					$wordLastVowel = $xvalue;
74
					break;
75
				} else {
76
					continue;
77
				}
78
			}
79
80
			if ( $wordLastVowel !== null ) {
81
				break;
82
			} else {
83
				continue;
84
			}
85
		}
86
87
		// Now convert the word
88
		switch ( $case ) {
89 View Code Duplication
			case "genitive":
90
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
91
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
92
						$word = implode( "", $ar[0] ) . "түң";
93
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
94
						$word = implode( "", $ar[0] ) . "тиң";
95
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
96
						$word = implode( "", $ar[0] ) . "туң";
97
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
98
						$word = implode( "", $ar[0] ) . "тың";
99
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
100
					}
101
				} elseif ( $wordEnding === "л" ) {
102
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
103
						$word = implode( "", $ar[0] ) . "дүң";
104
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
105
						$word = implode( "", $ar[0] ) . "диң";
106
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
107
						$word = implode( "", $ar[0] ) . "дуң";
108
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
109
						$word = implode( "", $ar[0] ) . "дың";
110
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
111
					}
112
				} else {
113
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
114
						$word = implode( "", $ar[0] ) . "нүң";
115
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
116
						$word = implode( "", $ar[0] ) . "ниң";
117
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
118
						$word = implode( "", $ar[0] ) . "нуң";
119
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
120
						$word = implode( "", $ar[0] ) . "ның";
121
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
122
					}
123
				}
124
				break;
125 View Code Duplication
			case "dative":
126
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
127
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
128
						$word = implode( "", $ar[0] ) . "ке";
129
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
130
						$word = implode( "", $ar[0] ) . "ка";
131
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
132
					}
133
				} else {
134
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
135
						$word = implode( "", $ar[0] ) . "ге";
136
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
137
						$word = implode( "", $ar[0] ) . "га";
138
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
139
					}
140
				}
141
				break;
142 View Code Duplication
			case "accusative":
143
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
144
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
145
						$word = implode( "", $ar[0] ) . "тү";
146
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
147
						$word = implode( "", $ar[0] ) . "ти";
148
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
149
						$word = implode( "", $ar[0] ) . "ту";
150
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
151
						$word = implode( "", $ar[0] ) . "ты";
152
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
153
					}
154
				} elseif ( $wordEnding === "л" ) {
155
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
156
						$word = implode( "", $ar[0] ) . "дү";
157
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
158
						$word = implode( "", $ar[0] ) . "ди";
159
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
160
						$word = implode( "", $ar[0] ) . "ду";
161
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
162
						$word = implode( "", $ar[0] ) . "ды";
163
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
164
					}
165
				} else {
166
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
167
						$word = implode( "", $ar[0] ) . "нү";
168
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
169
						$word = implode( "", $ar[0] ) . "ни";
170
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
171
						$word = implode( "", $ar[0] ) . "ну";
172
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
173
						$word = implode( "", $ar[0] ) . "ны";
174
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
175
					}
176
				}
177
				break;
178 View Code Duplication
			case "locative":
179
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
180
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
181
						$word = implode( "", $ar[0] ) . "те";
182
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
183
						$word = implode( "", $ar[0] ) . "та";
184
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
185
					}
186
				} else {
187
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
188
						$word = implode( "", $ar[0] ) . "де";
189
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
190
						$word = implode( "", $ar[0] ) . "да";
191
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
192
					}
193
				}
194
				break;
195 View Code Duplication
			case "ablative":
196
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
197
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
198
						$word = implode( "", $ar[0] ) . "тен";
199
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
200
						$word = implode( "", $ar[0] ) . "тан";
201
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
202
					}
203
				} else {
204
					if ( in_array( $wordLastVowel, $frontVowels ) ) {
205
						$word = implode( "", $ar[0] ) . "ден";
206
					} elseif ( in_array( $wordLastVowel, $backVowels ) ) {
207
						$word = implode( "", $ar[0] ) . "дан";
208
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
209
					}
210
				}
211
				break;
212
			case "directive1":
213
				if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
214
					$word = implode( "", $ar[0] ) . "же";
215
				} elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
216
					$word = implode( "", $ar[0] ) . "че";
217
				} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
218
				}
219
				break;
220
			case "directive2":
221
				if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
222
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
223
						$word = implode( "", $ar[0] ) . "түве";
224
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
225
						$word = implode( "", $ar[0] ) . "тиве";
226
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
227
						$word = implode( "", $ar[0] ) . "туве";
228
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
229
						$word = implode( "", $ar[0] ) . "тыве";
230
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
231
					}
232
				} else {
233
					if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
234
						$word = implode( "", $ar[0] ) . "дүве";
235
					} elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
236
						$word = implode( "", $ar[0] ) . "диве";
237
					} elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
238
						$word = implode( "", $ar[0] ) . "дуве";
239
					} elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
240
						$word = implode( "", $ar[0] ) . "дыве";
241
					} else {
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
242
					}
243
				}
244
				break;
245
			default:
246
				break;
247
		}
248
249
		return $word;
250
	}
251
}
252