forked from Steinsplitter/uv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
165 lines (151 loc) · 6.77 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title><?php require ("i18n.php"); echo $th; ?></title>
<link href="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="//tools-static.wmflabs.org/cdnjs/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style>
body {
padding-top: 60px;
}
</style>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"><?php echo $th; ?></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> <?php require ("i18n.php"); echo $langf; ?>
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="index.php?lang=ar">العربية (ar)</a></li>
<li><a href="index.php?lang=ca">Català (ca)</a></li>
<li><a href="index.php?lang=de">Deutsch (de)</a></li>
<li><a href="index.php?lang=es">Español (es)</a></li>
<li><a href="index.php?lang=en">English (en)</a></li>
<li><a href="index.php?lang=hy">Հայերեն (hy)</a></li>
<li><a href="index.php?lang=id">Bahasa Indonesia (id)</a></li>
<li><a href="index.php?lang=ja">日本語 (ja)</a></li>
<li><a href="index.php?lang=ru">Pусский (ru)</a></li>
<li><a href="index.php?lang=zh">中文 (zh)</a></li>
<li role="separator" class="divider"></li>
<li><a href="https://github.com/steinsplitter/uv">Edit / Translate</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="container">
<?php echo $t0; ?>
<br>
<div class="well form-submit">
<form action="index.php">
<?php
if($_GET["specialform"] == "dewiki") {
echo "<input type=\"hidden\" name=\"specialform\" value=\"dewiki\" />";
echo "<b><p>Neuer Benutzername:</p></b>";
} elseif($_GET["specialform"] == "eswiki") {
echo "<input type=\"hidden\" name=\"specialform\" value=\"eswiki\" />";
echo "<b><p>Solicita un nombre de usuario nuevo por el que quieras que se te conozca a través de todos los proyectos:</p></b>";
}
?>
<input type="text" name="username" class="form-control" id="username" placeholder="<?php echo $un; ?>"><br>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input class="btn btn-primary btn-success" value="<?php echo $t9; ?>" type="submit">
</form>
</div>
<br>
<?php
function errormsg($text) {
echo "<div class=\"alert alert-danger\" role=\"alert\"><span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span> ";
echo "$text";
echo "</div>";
}
function okmsg($text) {
echo "<div class=\"alert alert-success\" role=\"alert\"><span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span> ";
echo "$text";
echo "</div>";
}
$username = $_GET['username'];
if(isset($username) && !empty($username)) {
echo "<span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> <b>";
echo $un; echo ":</b> "; echo htmlspecialchars($username);
echo "<br><br>";
if (preg_match('/^[a-z].*$/', $username)) {
errormsg($t1);
$valid = "false";
} elseif (preg_match('/\@/', $username)) {
errormsg($t2);
$valid = "false";
} elseif (preg_match('/.{40}/', $username)) {
errormsg($t3);
$valid = "false";
} elseif (preg_match('/(\#|\<|\>|\[|\]|\||\{|\}\/)/', $username)) {
errormsg($t4);
$valid = "false";
} else {
$valid = "true";
}
if ($valid == "true") {
okmsg($t5);
$tools_pw = posix_getpwuid(posix_getuid());
$tools_mycnf = parse_ini_file($tools_pw['dir'] . "/replica.my.cnf");
$db = new mysqli('s7.web.db.svc.wikimedia.cloud', $tools_mycnf['user'], $tools_mycnf['password'],
'centralauth_p');
if ($db->connect_errno)
die("Failed to connect to MySQL: (" . $db->connect_errno . ") " . $db->connect_error);
$r = $db->query('select gu_name from globaluser where gu_name = "' . $db->real_escape_string($username) . '" limit 1;');
unset($tools_mycnf, $tools_pw);
$cnt = $r->num_rows;
if ($cnt == "1"){
errormsg($t6);
} else {
okmsg($t7);
if($_GET["specialform"] == "dewiki") {
echo "<div class=\"form-group\">
<form id=\"upload\" method=\"post\" enctype=\"multipart/form-data\" action=\"https://de.wikipedia.org/w/index.php?title=Wikipedia:Benutzernamen_%C3%A4ndern&action=edit§ion=new&nosummary=1\" style=\"display:inline\">
<h1>Benutzername ändern</h1>
<p class=\"bg-info\">Achte darauf, dass du mit deinem aktuellen Benutzernamen angemeldet bist.<br>Bitte ersetze \"Hinweise etc.\" solltest du eine Hinweis oder eine Begründung hinterlassen wollen.</p>
<textarea rows=\"8\" class=\"form-control\" name=\"wpTextbox1\">{{subst:Wikipedia:Benutzernamen ändern/Preloadvorlage
|1= ". htmlspecialchars($username) ."
|2= Hinweise etc.
}}
</textarea>
<input name=\"wpPreview\" value=\"wpPreview\" type=\"hidden\">
<input value=\"0\" name=\"wpStarttime\" type=\"hidden\">
<input value=\"0\" name=\"wpEdittime\" type=\"hidden\">
<input value=\"0\" name=\"wpMinoredit\" type=\"hidden\">
<br>
<input class=\"btn btn-primary\" name=\"wpPreview\" value=\"Vorschau & Speichern\" type=\"submit\">
</form>
</div>";
} elseif($_GET["specialform"] == "eswiki") {
echo "<div class=\"form-group\">
<form id=\"upload\" method=\"post\" enctype=\"multipart/form-data\" action=\"https://es.wikipedia.org/w/index.php?title=Wikipedia:Cambiar_el_nombre_de_usuario&action=edit§ion=new&nosummary=1\" style=\"display:inline\">
<h1>Cambiar el nombre de usuario</h1>
<p class=\"bg-info\">Por favor verifica que has iniciado sesión con tu cuenta.</p>
<textarea rows=\"8\" class=\"form-control\" name=\"wpTextbox1\">{{sust:renombrar usuario
| 1 = ". htmlspecialchars($username) ."
| 2 = Reemplaza esta línea de texto con el motivo por el que solicitas el cambio
}}
</textarea>
<input name=\"wpPreview\" value=\"wpPreview\" type=\"hidden\">
<input value=\"0\" name=\"wpStarttime\" type=\"hidden\">
<input value=\"0\" name=\"wpEdittime\" type=\"hidden\">
<input value=\"0\" name=\"wpMinoredit\" type=\"hidden\">
<br>
<input class=\"btn btn-primary\" name=\"wpPreview\" value=\"Previsualizar y guardar\" type=\"submit\">
</form>
</div>";
}
}
}
} else {
echo $t8;
}
?>