-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·85 lines (68 loc) · 2.96 KB
/
functions.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
<?php
//Inclui o arquivo de configuração
include 'config.php';
//Verifica se foi submetida alguma pergunta
if (isset($_POST['pergunta']) && isset($_POST['nome']) && isset($_POST['email']) && isset($_POST['acao']) ){
//verifica se a pergunta deve ser enviada por email
if($_POST['acao'] == "envia" && SENDMETHOD == "email"){
$mailpara = SENDMETHODMAIL;
$mailassunto = 'Pergunta de '.$_POST['nome'].' - '.NOMEEVENTO;
$mailmensagem = $_POST['nome'].'('.$_POST['email'].') enviou uma pergunta: "'.$_POST['pergunta'].'"';
$mailheaders = 'From: '.SENDMETHODFROM. "\r\n" .
'Reply-To: '.$_POST['email']. "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($mailpara, $mailassunto, $mailmensagem, $mailheaders);
} else if($_POST['acao'] == "envia" && SENDMETHOD == "pushover") {
$PUSHOVERTITLE = "Pergunta de ".$_POST['nome'];
$PUSHOVERTOKEN = PUSHOVERTOKEN;
$PUSHOVERUSER = PUSHOVERUSER;
$PUSHOVERMESSAGE = $_POST['pergunta'];
$PUSHOVERURL = "mailto:".$_POST['email'];
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POSTFIELDS => array(
"token" => $PUSHOVERTOKEN,
"user" => $PUSHOVERUSER,
"message" => $PUSHOVERMESSAGE,
"title" => $PUSHOVERTITLE,
"url" => $PUSHOVERURL,
"url_title" => $_POST['email'],
"priority" => 0
),
CURLOPT_RETURNTRANSFER => true,));
curl_exec($ch);
curl_close($ch);
} else if($_POST['acao'] == "envia" && SENDMETHOD == "sqlite") {
date_default_timezone_set(TIMEZONE);
$SQLITEDATE = date('G:i:s');
$dbsqlite = new SQLite3(SQLITEDB);
$dbsqlite->exec('INSERT INTO perguntas (id, hora, pergunta, nome, email) VALUES (NULL,"'.$SQLITEDATE.'","'.$_POST['pergunta'].'","'.$_POST['nome'].'","'.$_POST['email'].'")');
}
}
function askalert(){
if (isset($_POST['pergunta']) && isset($_POST['nome']) && isset($_POST['email']) && isset($_POST['acao'])){
if ($_POST['acao'] == "envia") {
if (SHOWSLIDES == false) {
echo '<section class="alert">Sua pergunta foi enviada com sucesso, aguarde que já vamos responder</section>';
} else {
echo '<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Sua pergunta foi enviada com sucesso, aguarde que já vamos responder
</div>';
}
}
}
else if(isset($_POST['acao'])) {
if($_POST['acao'] == "envia") {
if (SHOWSLIDES == false) {
echo '<section class="alert">Por favor, complete todos os campos para poder efetuar sua pergunta</section>';
} else {
echo '<div class="alert alert-warning alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Por favor, complete todos os campos para poder efetuar sua pergunta
</div>';
}
}
}
}
?>