-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
168 lines (132 loc) · 9.38 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
<?php
session_start();
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require __DIR__ . '/vendor/autoload.php';
if (!isset($_SESSION['number1'])) {
$_SESSION['number1'] = (int) rand(1,9);
$_SESSION['number2'] = (int) rand(1,9);
}
function dummy_captcha_validate($field) {
if (isset($_SESSION['number1'])) {
if (isset($_SESSION['number2'])) {
$sum = $_SESSION['number1'] + $_SESSION['number2'];
if ($field == $sum) {
return true;
}
}
}
return false;
}
function process_data ($values) {
$mail = new PHPMailer(true);
try {
//Server settings
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = $_ENV['SMTP_HOST'] ?? 'mail.openstreetmap.org';
$mail->SMTPAuth = false;
$mail->Port = $_ENV['SMTP_PORT'] ?? 26;
$mail->CharSet = 'UTF-8';
//Recipients
$mail->setFrom('dmca@osmfoundation.org', 'OSMF Copyright Form');
$mail->addAddress('dmca@osmfoundation.org');
$mail->addReplyTo(trim($values['email']), trim($values['name_first'].' '.$values['name_last']));
//Content
$mail->isHTML(false);
$mail->Subject = 'OSM Claim of Copyright Infringement';
$email_body = 'OpenStreetMap - Claim of Copyright Infringement form:'."\n\n";
$email_body .= 'Automated Email - Form Posted.'."\n\n";
$email_body .= print_r($values, true);
$reply_address = $values['name_first'].' '.$values['name_last'].' <'.$values['email'].'>';
$email_body .= 'Formatted address: '.$reply_address."\n\n";
$mail->Body = $email_body;
$mail->send();
echo '<h1>Thank you</h1>';
echo 'Your report has been submitted';
} catch (Exception $e) {
echo '<h1>Error</h1>';
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>OpenStreetMap Legal - Claim of Copyright Infringement</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div class="regForm">
<?php
// Instantiate the HTML_QuickForm object
$form = new HTML_QuickForm('osm_legal_claim_of_copyright');
$renderer = new HTML_QuickForm_Renderer_Tableless();
$form->addElement('header', null, 'OpenStreetMap: Claim of Copyright Infringement');
$form->addElement('static', null, '<p>To file a copyright infringement notification with us, you will need to send a written communication that includes the following (please consult your legal counsel or see Section 512(c)(3) of the Digital Millennium Copyright Act to confirm these requirements):</p>
<ul><li> A physical or electronic signature of a person authorized to act on behalf of the owner of an exclusive right that is allegedly infringed.
<li>Identification of the copyrighted work claimed to have been infringed or, if multiple copyrighted works at a single online site are covered by a single notification, a representative list of such works at that site.
<li>Identification of the material that is claimed to be infringing or to be the subject of infringing activity and that is to be removed or access to which is to be disabled, and information reasonably sufficient to permit the service provider to locate the material. Providing URLs in the body of an email is the best way to help us locate content quickly.
<li>Information reasonably sufficient to permit the service provider to contact the complaining party, such as an address, telephone number, and, if available, an electronic mail address at which the complaining party may be contacted.
<li>A statement that the complaining party has a good faith belief that use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law.
<li>A statement that the information in the notification is accurate and, under penalty of perjury, that the complaining party is authorized to act on behalf of the owner of an exclusive right that is allegedly infringed.
</ul><p>To expedite our ability to process your request, such written notice should be sent to our designated agent via our online copyright complaint form below.</p>
<p>This form is only for cases where you believe that material on OpenStreetMap\'s websites or in its geodata database infringes your copyright or that of your clients. For example, you claim someone has copied material from a map belonging to you.</p>
<p>If you have come here for reporting map inaccuracies, privacy issues or another reason, <a href="https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Takedown_procedure/When_To_Use_The_Form">Read here</a>.</p>');
$form->addElement('text', 'url', 'URL of Allegedly Infringing Material', array('size' => 50, 'maxlength' => 255));
$form->addRule('url', 'Please enter URL of Allegedly Infringing Material', 'required', null, 'client');
$form->addElement('textarea', 'work', 'Describe the work allegedly infringed. For example, which map has been copied and what specifically has been copied.', array('rows' => 20, 'cols' => 70));
$form->addRule('work', 'Please describe the work allegedly infringed', 'required', null, 'client');
$form->addElement('text', 'territory', 'Territories where infringement occurred', array('size' => 50, 'maxlength' => 255));
$form->addRule('territory', 'Please enter the territories where infringement occurred', 'required', null, 'client');
$form->addElement('text', 'name_first', 'First Name', array('size' => 50, 'maxlength' => 255));
$form->addRule('name_first', 'Please enter your First Name', 'required', null, 'client');
$form->addElement('text', 'name_last', 'Last Name', array('size' => 50, 'maxlength' => 255));
$form->addRule('name_last', 'Please enter your Last Name', 'required', null, 'client');
$form->addElement('text', 'company', 'Company Name', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'company_tile', 'Title/Position');
$form->addElement('text', 'address', 'Street Address');
$form->addRule('address', 'Please enter Street Address', 'required', null, 'client');
$form->addElement('text', 'city', 'City', array('size' => 50, 'maxlength' => 255));
$form->addRule('city', 'Please enter City', 'required', null, 'client');
$form->addElement('text', 'state', 'State/Province', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'postal_code', 'Zip/Postal Code', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'country', 'Country', array('size' => 50, 'maxlength' => 255));
$form->addRule('country', 'Please enter Country', 'required', null, 'client');
$form->addElement('text', 'phone_number', 'Phone Number', array('size' => 50, 'maxlength' => 255));
$form->addRule('phone_number', 'Please enter Phone Number', 'required', null, 'client');
$form->addElement('text', 'mobile_number', 'Mobile Number', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'email', 'Email Address', array('size' => 50, 'maxlength' => 255));
$form->addRule('email', 'Please enter Email Address', 'required', null, 'client');
$form->addRule('email', 'Please enter a valid Email Address', 'email', null, 'client');
$form->addElement('text', 'fax', 'Fax', array('size' => 50, 'maxlength' => 255));
$complaint_options = array();
$complaint_options[] = $form->createElement('checkbox', '1_of_4_owner_or_authorised', null, 'I am the owner, or an agent authorized to act on behalf of the owner, of an exclusive right that is allegedly infringed.');
$complaint_options[] = $form->createElement('checkbox', '2_of_4_good_faith', null, 'I have a good faith belief that the use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law; and');
$complaint_options[] = $form->createElement('checkbox', '3_of_4_accurate', null, 'This notification is accurate.');
$complaint_options[] = $form->createElement('checkbox', '4_of_4_not_misrepresent', null, 'I acknowledge that under Section 512(f) any person who knowingly materially misrepresents that material or activity is infringing may be subject to liability for damages.');
$form->addGroup($complaint_options, 'complaint_confirm', 'By checking the following boxes, I state UNDER PENALTY OF PERJURY that (choose all of the options)', '<br />');
$form->addElement('text', 'signature', 'Typing your full name in this box will act as your digital signature.', array('size' => 25, 'maxlength' => 255));
$form->addRule('signature', 'Field is required', 'required', null, 'client');
$form->registerRule('captcha_validate', 'callback', 'dummy_captcha_validate');
$form->addElement('text', 'captcha', 'Please add (+) together the following numbers: ' . $_SESSION['number1'] . ' and ' . $_SESSION['number2'], array('size' => 25, 'maxlength' => 255));
$form->addRule('captcha', 'Captcha field is required', 'required', null, 'client');
$form->addRule('captcha', 'You did not solve the sum', 'captcha_validate');
$form->addElement('submit', null, 'Send');
$form->removeAttribute('name');
$form->getValidationScript();
if ($form->validate()) {
// Do some stuff
$form->freeze();
$form->process('process_data', false);
} else {
// Output the form
$form->accept($renderer);
echo $renderer->toHtml();
}
?>
</div>
</body>
</html>