-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
361 lines (348 loc) · 21.9 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
if (isset($_GET['source'])) {show_source(__FILE__); exit();}
/**
* @author Stöger Florian D. M. (http://fdms.eu)
* @license EUPL 1.1 (//joinup.ec.europa.eu/sites/default/files/eupl1.1.-licence-en_0.pdf)
* @copyright © (//joinup.ec.europa.eu/sites/default/files/eupl1.1.-licence-en_0.pdf) Stöger Florian D. M. (http://fdms.eu)
*/
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Wikimedia OTRS release generator</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css">
<style>
p {
background-color: white;
}
.hof {
height: 100vh;
overflow-y: auto;
}
.dropdown-menu li {
cursor: pointer;
}
</style>
<script type="text/javascript" src="//tools-static.wmflabs.org/cdnjs/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$("a.smsc").on("click", function(event) {
event.preventDefault();
var hash = this.hash;
$("html, body").animate({
scrollTop: $(hash).offset().top
}, 400);
});
$("#meta").popover({
html:true,
});
$("form").on("keyup keypress", function(e) {
if (e.keyCode == 13) {
e.preventDefault();
}
});
$(".nt").on("keydown", function(e) {
if (e.keyCode == 9) {
e.preventDefault()
}
});
});
function s1v() {
s1vi = 0;
if (!$("#namei").val().match(/\S/)) {
if (!$("#s1fg1").hasClass("has-error")) {
$("#s1fg1").addClass("has-error");
}
s1vi++;
} else {
if ($("#s1fg1").hasClass("has-error")) {
$("#s1fg1").removeClass("has-error");
}
}
if ($("#irep").css("display") != "none") {
if (!$("#repi").val().match(/\S/)) {
if (!$("#s1fg2").hasClass("has-error")) {
$("#s1fg2").addClass("has-error");
}
s1vi++;
} else {
if ($("#s1fg2").hasClass("has-error")) {
$("#s1fg2").removeClass("has-error");
}
}
if (!$("#authi").val().match(/\w/)) {
if (!$("#s1fg3").hasClass("has-error")) {
$("#s1fg3").addClass("has-error");
}
s1vi++;
} else {
if ($("#s1fg3").hasClass("has-error")) {
$("#s1fg3").removeClass("has-error");
}
}
}
if (s1vi == 0) {
$("html, body").animate({
scrollTop: $(s2).offset().top
}, 400);
}
}
function s4v() {
if (!$("#licensei").val().match(/\w/)) {
if (!$("#s4fg").hasClass("has-error")) {
$("#s4fg").addClass("has-error");
}
} else {
$("form").submit();
}
}
</script>
</head>
<body style="background: url('bg.png') no-repeat fixed right bottom; overflow:hidden;">
<?php
$relgen = "0.9.10";
date_default_timezone_set("UTC");
$starttime = date("H:i:s");
$trn = $name = $rep = $auth = $filer = $license = $s1 = $s2 = $s3 = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$starttime = test_input($_POST["starttime"]);
$trn = test_input($_POST["trn"]);
$name = test_input($_POST["name"]);
$rep = test_input($_POST["rep"]);
$auth = test_input($_POST["auth"]);
$filer = test_input($_POST["filer"]);
$license = test_input($_POST["license"]);
$s1 = test_input($_POST["s1"]);
$s2 = test_input($_POST["s2"]);
$s3 = test_input($_POST["s3"]);
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
if ($_POST["result"] == "1") {
?>
<script type="text/javascript">
$(function() {
$("html, body").animate({
scrollTop: $(result).offset().top
}, 400);
});
</script>
<?php
}
?>
<div class="container">
<h1>Wikimedia OTRS release generator <small><a id="meta" tabindex="0" data-toggle="popover" data-placement="bottom" data-trigger="focus" data-content="created and maintained by <a href='//meta.wikimedia.org/wiki/User:FDMS4' target='_blank'>FDMS</a><br />© (<a href='//joinup.ec.europa.eu/sites/default/files/eupl1.1.-licence-en_0.pdf' target='_blank'>EUPL 1.1</a>) <a href='http://fdms.eu' target='_blank'>Stöger Florian D. M.</a>" style="color:#777;"><?=$relgen?></a></small></h1>
<form method="post" action="//tools.wmflabs.org/relgen/index.php">
<div id="s0" class="row hof"> <!-- step 0 -->
<br /><br />
<div class="col-md-7">
<a role="button" href="#s1" class="btn btn-primary btn-lg btn-block smsc nt">start</a>
<input type="hidden" name="starttime" value="<?=$starttime?>" />
<input type="hidden" name="result" value="1" />
</div><br />
</div>
<div id="s1" class="row hof"> <!-- step 1 -->
<br />
step 1 of 5 [ <a href="//commons.wikimedia.org/wiki/Commons:Help_desk?action=edit§ion=new&preloadtitle=help+with+Wikimedia+OTRS+release+generator+step+1" target="_blank">help</a> | <a href="//commons.wikimedia.org/wiki/User_talk:FDMS4?action=edit§ion=new&preloadtitle=Wikimedia+OTRS+release+generator+feedback" target="_blank">feedback</a> ]
<br /><br />
<div class="col-md-7">
<div class="button" data-toggle="buttons">
<label class="btn btn-default btn-block" onclick="$('#iam').show();$('#irep').hide();$('#idk').hide();"><input type="radio" id="s11" name="s1" value="1" />I am the copyright holder</label>
<label class="btn btn-default btn-block" onclick="$('#iam').show();$('#irep').show();$('#idk').hide();"><input type="radio" id="s12" name="s1" value="2" />I represent the copyright holder</label>
<label class="btn btn-default btn-block" onclick="$('#iam').hide();$('#irep').hide();$('#idk').show();"><input type="radio" id="s13" name="s1" value="" />I don't know the copyright holder</label>
</div>
<br />
<p>The copyright holder of a media work is the <b>person who created it</b> (photographer, designer, painter, …), unless the copyright was explicitly transferred by an operation of law or contract.</p>
<br /><br />
</div>
<div class="col-md-4">
<div style="display:none;" id="iam">
my name<br /><div id="s1fg1" class="form-group"><input id="namei" type="text" name="name" value="<?php echo $name;?>" placeholder="John Doe (required)" class="form-control" /></div>
<div style="display:none;" id="irep">
<br />
copyright holder<br /><div id="s1fg2" class="form-group"><input id="repi" type="text" name="rep" value="<?php echo $rep;?>" placeholder="Ace Inc. / Jane Roe (required)" class="form-control" /></div>
<br />
my authority<br /><div id="s1fg3" class="form-group"><input id="authi" type="text" name="auth" value="<?php echo $auth;?>" placeholder="CEO, appointed representative, … (required)" class="form-control" /></div>
</div>
<br /><br />
<a role="button" class="btn btn-primary btn-block nt" onclick="s1v()">proceed to the next step</a>
</div>
<div style="display:none;" id="idk">
<p class="text-danger">Wikimedia OTRS cannot accept a release from you – please <a href="//commons.wikimedia.org/wiki/Commons:OTRS#notch">reach out to the copyright holder</a> instead.</p>
</div>
</div>
<br />
</div>
<div id="s2" class="row hof"> <!-- step 2 -->
<br />
step 2 of 5 [ <a href="#s1" class="smsc">back</a> | <a href="//commons.wikimedia.org/wiki/Commons:Help_desk?action=edit§ion=new&preloadtitle=help+with+Wikimedia+OTRS+release+generator+step+2" target="_blank">help</a> | <a href="//commons.wikimedia.org/wiki/User_talk:FDMS4?action=edit§ion=new&preloadtitle=Wikimedia+OTRS+release+generator+feedback" target="_blank">feedback</a> ]
<br /><br />
<div class="col-md-7">
<div class="button" data-toggle="buttons">
<label class="btn btn-default btn-block" onclick="$('#iup').show();$('#iatt').show();"><input type="radio" id="s21" name="s2" value="1" />I or others have already uploaded the file to Wikimedia Commons</label>
<label class="btn btn-default btn-block" onclick="$('#iup').hide();$('#iatt').show();"><input type="radio" id="s22" name="s2" value="2" />I will attach the file to the email</label>
</div>
<br />
<p>Please use the <a href="//commons.wikimedia.org/wiki/Special:UploadWizard" target="_blank"><b>UploadWizard</b></a> to upload the file to Wikimedia Commons if you haven't done so already.</p>
<p>To prevent the file from getting deleted while your release email is awaiting processing by the Wikimedia OTRS team, you may place <b><samp>{{subst:OP}}</samp></b> on the file description page.</p>
<br /><br />
</div>
<div class="col-md-4">
<div style="display:none;" id="iatt">
<div style="display:none;" id="iup">
Wikimedia Commons file name<br /><input type="text" name="filer" placeholder="Example.jpg (required)" class="form-control" />
<br /><br />
</div>
<a role="button" href="#s3" class="btn btn-primary btn-block smsc nt">proceed to the next step</a>
</div>
</div>
<br />
</div>
<div id="s3" class="row hof"> <!-- step 3 -->
<br />
step 3 of 5 [ <a href="#s2" class="smsc">back</a> | <a href="//commons.wikimedia.org/wiki/Commons:Help_desk?action=edit§ion=new&preloadtitle=help+with+Wikimedia+OTRS+release+generator+step+3" target="_blank">help</a> | <a href="//commons.wikimedia.org/wiki/User_talk:FDMS4?action=edit§ion=new&preloadtitle=Wikimedia+OTRS+release+generator+feedback" target="_blank">feedback</a> ]
<br /><br />
<div class="col-md-7">
<div class="button" data-toggle="buttons">
<label class="btn btn-default btn-block" onclick="$('#i3').show();"><input type="radio" id="s31" name="s3" value="1" />I want to release the media work</label>
<label class="btn btn-default btn-block" onclick="$('#i3').show();"><input type="radio" id="s32" name="s3" value="2" />I want to release the work depicted in the media work</label>
<label class="btn btn-default btn-block" onclick="$('#i3').show();"><input type="radio" id="s33" name="s3" value="3" />I want to release both the work depicted and the media work</label>
</div>
<br />
<p>If the media work depicts or otherwise includes someone else's artwork in a non-trivial manner, it is a <a href="//commons.wikimedia.org/wiki/Commons:Derivative_works" target="_blank"><b>derivative work</b></a> and therefore a separate release from the copyright holder of the depicted artwork is generally required.</p>
<p>In some countries, thanks to the <a href="//commons.wikimedia.org/wiki/Commons:Freedom_of_panorama" target="_blank"><b>freedom of panorama</b></a> exception, architecture and other artwork on permanent public display are exempted from this requirement. In the United States, only architecture is exempted.</p>
<br /><br />
</div>
<div class="col-md-4">
<div style="display:none;" id="i3">
<a role="button" href="#s4" class="btn btn-primary btn-block smsc nt">proceed to the next step</a>
</div>
</div>
<br />
</div>
<div id="s4" class="row hof"> <!-- step 4 -->
<br />
step 4 of 5 [ <a href="#s3" class="smsc">back</a> | <a href="//commons.wikimedia.org/wiki/Commons:Help_desk?action=edit§ion=new&preloadtitle=help+with+Wikimedia+OTRS+release+generator+step+4" target="_blank">help</a> | <a href="//commons.wikimedia.org/wiki/User_talk:FDMS4?action=edit§ion=new&preloadtitle=Wikimedia+OTRS+release+generator+feedback" target="_blank">feedback</a> ]
<br /><br />
<div class="col-md-7">
<p>I agree to publish the above-mentioned content under the following free license:</p>
<div id="s4fg" class="form-group"><div class="input-group">
<input id="licensei" type="text" name="license" value="Creative Commons Attribution-ShareAlike 4.0 International" class="form-control" />
<div class="input-group-btn">
<a role="button" data-toggle="dropdown" class="btn btn-default"><span class="caret" /></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a onclick="$('#licensei').val('Creative Commons Attribution-ShareAlike 4.0 International'); $('#iawattr').show();">Creative Commons Attribution-ShareAlike 4.0 International</a></li>
<li><a onclick="$('#licensei').val('Creative Commons Attribution 4.0 International'); $('#iawattr').show();">Creative Commons Attribution 4.0 International</a></li>
<li><a onclick="$('#licensei').val('Creative Commons CC0 1.0 Universal'); $('#iawattr').hide();">Creative Commons CC0 1.0 Universal (public domain dedication)</a></li>
</ul>
<a role="button" href="//commons.wikimedia.org/wiki/Commons:First_steps/License_selection" target="_blank" class="btn btn-default">
<span class="glyphicon glyphicon-question-sign" />
</a>
</div>
</div></div>
<p>I acknowledge that by doing so I grant anyone the right to use the work, even in a commercial product or otherwise, and to modify it according to their needs, provided that they abide by the terms of the license and any other applicable laws.</p>
<p>I am aware that this agreement is not limited to Wikipedia or related sites.</p>
<p id="iawattr">I am aware that the copyright holder always retains ownership of the copyright as well as the right to be attributed in accordance with the license chosen. Modifications others make to the work will not be claimed to have been made by the copyright holder.</p>
<p>I acknowledge that I cannot withdraw this agreement, and that the content may or may not be kept permanently on a Wikimedia project.</p>
<br />
<button type="button" class="btn btn-default btn-block" data-toggle="button" onclick="$('#iag').toggle();">I agree</button>
<br /><br />
</div>
<div class="col-md-4">
<div style="display:none;" id="iag">
<a role="button" class="btn btn-primary btn-block nt" onclick="s4v()">proceed to the next step</a>
</div>
</div>
<br />
</div>
</form> <!-- result -->
<div id="result" class="row hof">
<br />
step 5 of 5 [ <a href="#s1" class="smsc">start over</a> | <a href="//commons.wikimedia.org/wiki/Commons:Help_desk?action=edit§ion=new&preloadtitle=help+with+Wikimedia+OTRS+release+generator+step+5" target="_blank">help</a> | <a href="//commons.wikimedia.org/wiki/User_talk:FDMS4?action=edit§ion=new&preloadtitle=Wikimedia+OTRS+release+generator+feedback" target="_blank">feedback</a> ]
<br /><br />
<?php if (($s1 != "") && ($name != "") && !(($s1 == "2") && (($rep == "") || ($auth == ""))) && ($s2 != "") && !(($s2 != "2") && ($filer == "")) && ($s3 != "") && ($license != "")) {
$stats = fopen("stats/" . date('Y') . ".csv", "a");
fputcsv($stats, array (date("m-d"), $starttime, date("H:i:s"), $trn), ";");
fclose($stats);
?>
<div class="col-md-7">
<p>If you have an email client installed, simply <b>click the button</b> to create the release email. Alternatively, copy-and-paste the text in the green box below into an email to <a href="mailto:[email protected]" style="white-space:nowrap;">[email protected]</a>.</p>
<p>The email should come from an <b>email address that we can recognise as associated with the content being released</b>. For instance, if you are releasing images shown on a website, your email address should be associated with the website or listed on the contact page of the website; if you are releasing images on behalf of an organisation, your email address should be an official email address of the organisation.</p>
<br />
<?php
switch ($s1) {
case "1":
$p1s = ", $name, am";
break;
case "2":
$p1s = " represent $rep,";
$p1s_ = "<br />$auth of $rep";
$p1s_m = "%0A$auth of $rep";
break;
}
switch ($s2) {
case "1":
$file = preg_replace("/(File:|(http|https):\/\/(commons|en).wiki(m|p)edia.org\/(wiki\/|w\/index\.php\?title=)File:)/", "", $filer);
$p3s = "<a href='//commons.wikimedia.org/wiki/File:" . rawurlencode(str_replace(" " , "_", str_replace("&", "&", $file))) . "' target='_blank'>https://commons.wikimedia.org/wiki/File:" . str_replace(" " , "_", $file) . "</a>";
$p3sm = "https:%2F%2Fcommons.wikimedia.org%2Fwiki%2FFile:" . rawurlencode(str_replace(" " , "_", str_replace("&", "&", $file)));
$subj = "release of " . str_replace("&", "%26", $file);
break;
case "2":
$p3s = $p3sm = "attached to this email";
$subj = "release of content attached to this email";
break;
case "3":
$file = $filer;
$p3s = "<a href='" . str_replace("&", "&", $file) . "' target='_blank'>" . $file . "</a>";
$p3sm = rawurlencode(str_replace("&", "&", $file));
$subj = "release of " . str_replace("&", "%26", $file);
break;
}
switch ($s3) {
case "1":
$p2s = "the media work";
break;
case "2":
$p2s = "the work depicted in the media";
break;
case "3":
$p2s = "both the work depicted and the media";
break;
}
$b1 = "I hereby affirm that I$p1s the creator and/or sole owner of the exclusive copyright of $p2s $p3s.";
$b1m = "I hereby affirm that I$p1s the creator and/or sole owner of the exclusive copyright of $p2s $p3sm.";
$b2 = "I agree to publish the above-mentioned work under the $license.";
$b3 = "I acknowledge that by doing so I grant anyone the right to use the work, even in a commercial product or otherwise, and to modify it according to their needs, provided that they abide by the terms of the license and any other applicable laws.";
$b4 = "I am aware that this agreement is not limited to Wikipedia or related sites.";
if ($license != "Creative Commons CC0 1.0 Universal") {
$b5 = "<br />I am aware that the copyright holder always retains ownership of the copyright as well as the right to be attributed in accordance with the license chosen. Modifications others make to the work will not be claimed to have been made by the copyright holder.";
$b5m = "%0AI am aware that the copyright holder always retains ownership of the copyright as well as the right to be attributed in accordance with the license chosen. Modifications others make to the work will not be claimed to have been made by the copyright holder.";
}
$b6 = "I acknowledge that I cannot withdraw this agreement, and that the content may or may not be kept permanently on a Wikimedia project.";
$tracking = "[generated using relgen]";
echo "<div class='bg-success' style='padding:8px;'>$b1<br />$b2<br />$b3<br />$b4$b5<br />$b6<br /><br />$name$p1s_<br />" . date("Y-m-d") . "<br /><br />$tracking</div>";
?>
<br /><br />
</div>
<div class="col-md-4">
<a role="button" href="mailto:[email protected]?subject=<?=$subj?>&body=<?=$b1m?>%0A<?=$b2?>%0A<?=$b3?>%0A<?=$b4?><?=$b5m?>%0A<?=$b6?>%0A%0A<?=$name?><?=$p1s_m?>%0A<?=date('Y-m-d')?>%0A%0A<?=$tracking?>" class="btn btn-default btn-block" style="width:100%;">create release email</a>
</div>
<?php
} else {
if ($name == "") echo "<p class='text-danger'>Error: No name specified!</p>";
if (($s1 == "2") && (($rep == "") || ($auth == ""))) echo "<p class='text-danger'>Error: No copyright holder and/or authority specified!</p>";
if (($s2 != "2") && ($filer == "")) echo "<p class='text-danger'>Error: No file name specified!</p>";
if ($license == "") echo "<p class='text-danger'>Error: No license specified!</p>";
}
?>
<br />
</div>
</div>
</body>
</html>