-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.php
109 lines (100 loc) · 3.26 KB
/
contact.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
<?php
// This file is part of Music Match.
// Copyright (C) 2022 David P. Anderson
//
// Music Match is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Music Match is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Music Match. If not, see <http://www.gnu.org/licenses/>.
// --------------------------------------------------------------------
require_once("../inc/util.inc");
require_once("../inc/email.inc");
require_once("../inc/mm.inc");
require_once("../inc/recaptchalib.php");
function form($user) {
global $recaptcha_public_key;
page_head("Contact Music Match", null, null, null, boinc_recaptcha_get_head_extra());
echo "
<p>
Please let us know if
<p>
<ul>
<li> Something doesn't work or is confusing.
<li> There's a feature you'd like to see.
<li> Other users are behaving inappropriately
(spam, abusive language, etc.)
</ul>
<p><br>
";
form_start("contact.php", "POST");
if ($user) {
form_input_hidden("user_id", $user->id);
} else {
form_input_text('Your email address', 'email_addr');
}
form_input_textarea("Message to Music Match", 'message');
if (!$user) {
form_general('', boinc_recaptcha_get_html($recaptcha_public_key));
}
form_submit("Send", "name=submit value=on");
form_end();
echo "
<p><br>
If you're familiar with Github,
you can also create an 'issue' on
<a href=https://github.com/davidpanderson/music_match/> the Music Match Github repository</a>.
";
page_tail();
}
function action($user) {
global $recaptcha_private_key;
$message = post_str('message');
if (!$message) {
error_page('No message');
}
if (strpos($message, 'SEO')!==false) {
error_page('go away');
}
if (strpos($message, 'Viagra')!==false) {
error_page('go away');
}
if (strpos($message, 'ryptocurrency')!==false) {
error_page('go away');
}
if ($user) {
$message = "(message from user $user->name email $user->email_addr ID $user->id)\n".$message;
} else {
if (!boinc_recaptcha_isValidated($recaptcha_private_key)) {
error_page(
tra("Your reCAPTCHA response was not correct. Please try again.")
);
}
$e = post_str('email_addr');
$message = "(message from $e)\n".$message;
}
$user = new StdClass;
$user->email_addr = SYS_ADMIN_EMAIL;
$user->name = "Music Match admin";
send_email($user, "Music Match feedback", $message);
page_head("Message sent");
echo "
Thanks for your feedback.
";
page_tail();
}
if (post_str('submit', true)) {
$user = get_logged_in_user(false);
action($user);
} else {
$user = get_logged_in_user(false);
form($user);
}
?>