forked from nextcloud/nextcloud.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-file-access-whitepapersubmit.php
107 lines (95 loc) · 3.65 KB
/
page-file-access-whitepapersubmit.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
<head>
<link href="<?php echo get_template_directory_uri(); ?>/assets/css/pages/workflow.css" rel="stylesheet">
</head>
<div class="background workflow-background">
<div class="container">
<div class="row">
<div class="col-md-6 topheader">
<h1><?php echo $l->t('File Access Control and Workflows');?></h1>
<h2><?php echo $l->t('Manage, control and secure the flow of data on your Nextcloud server');?></h2>
</div>
</div>
</div>
</div>
<?php
if(isset($_POST['email'])) {
function died($error) {
// error code goes here
?>
<section class="section--whitepaper">
<div class="container text-center">
<h3>Sorry, there was an error with the form you submitted</h3>
<p>The error(s) detected:<br/>
<?php
echo $error . "<br />";
?>
</p>
<p>Use the back key to go to the previous page and fix the
issue!</p>
</div>
</section>
<?php
}
// validation expected data exists
$error_message = "";
$email_to = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); // requires
if(!filter_var($email_to, FILTER_VALIDATE_EMAIL)) {
$error_message .= 'The email address supplied is invalid.<br />';
}
if (defined('RECAPTCHA_SECRET') && RECAPTCHA_SECRET !== '' && isset($_POST['g-recaptcha-response'])) {
$url = 'https://www.google.com/recaptcha/api/siteverify';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('secret' => RECAPTCHA_SECRET, 'response' => $_POST['g-recaptcha-response'])));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
$server_output = json_decode($server_output, true);
curl_close($ch);
if (!isset($server_output['success']) || $server_output['success'] !== true) {
$error_message .= 'The captcha result was invalid.<br />';
}
} else {
$error_message .= 'Captcha code is missing.<br />';
}
if (strlen($error_message) > 0) {
died($error_message);
} else {
function clean_string($string) {
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
// the app review mailing list address
$email_from = "sales@nextcloud.com";
$email_jos = "jos@nextcloud.com";
$email_nina = "nina@nextcloud.com";
$email_subject = "Nextcloud File Access and Retention Datasheet download";
$email_message .= "\n";
$email_message .= "Thank you for your interest in our File Access and Retention Datasheet Datasheet!"."\n\n";
$email_message .= "You can download the datasheet here:"."\n";
$email_message .= "https://nextcloud.com/wp-content/themes/next/assets/files/3NLkR6bd/file-access-control-datasheet.pdf"."\n\n";
$email_message .= "Your feedback is welcome. If you have any questions or if you are interested in a demo, let us know!"."\n\n";
$email_message .= "Greetings,"."\n";
$email_message .= "The Nextcloud team";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from;
// Send the email to the list
@mail($email_to, $email_subject, $email_message, $headers);
// Second email to subscribe to the mailing list
@mail($email_jos, $email_subject, $email_to, $headers);
// Third email to subscribe to the mailing list
@mail($email_nina, $email_subject, $email_to, $headers);
?>
<!-- success html here -->
<section class="section--whitepaper">
<div class="container text-center">
<h3>Thank you for your interest in our datasheet</h3>
<p>The datasheet has been sent to <?php echo($email_to); ?>,</p>
<p>Check your spam folder if you cannot find it!</p>
</div>
</section>
<?php
}
}
?>