Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

94 righe
2.8 KiB

<?php
exit();
$mode = $_REQUEST['action'];
switch ($mode) {
case 'saveFaq':
exit();
saveFaq();
break;
case 'load':
exit();
load();
break;
}
function load() {
exit();
$id = Utils::getFromReq("id", 0);
$record = new Faq($id);
$record->DOMANDA = htmlentities(htmlspecialchars($record->DOMANDA));
$record->OGGETTO = utf8_decode($record->OGGETTO);
exit(json_encode($record));
}
function saveFaq() {
exit();
$return = array();
$return['esito'] = -999;
$return['erroreDescrizione'] = "Sezione FAQ Chiusa";
exit(json_encode($return));
global $con, $LoggedAccount;
$captcha = '';
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
}
$controlloCaptcha = true;
if ($LoggedAccount->ID > 0) {
$captcha = true;
$controlloCaptcha = false;
}
if (!$captcha && CAPTCHA_ACTIVE) {
$ritorno['esito'] = 0;
$ritorno['erroreDescrizione'] = "1 Recaptcha error - Al momento non è possibile proseguire con la procedura.";
exit(json_encode($ritorno));
}
if ($controlloCaptcha && CAPTCHA_ACTIVE) {
$secretKey = CAPTCHA_SECRET_PRIVATEKEY;
$response = file_get_contents(CAPCTHA_URL_SITEVERIFY . "?secret=" . $secretKey . "&response=" . $captcha);
$responseKeys = json_decode($response, true);
} else {
$responseKeys["success"] = 1;
}
if (intval($responseKeys["success"]) !== 1) {
$ritorno['esito'] = 0;
$ritorno['Description'] = "2 Recaptcha error - Al momento non è possibile proseguire con la procedura.";
} else {
$transaction = false;
$return = array();
$risposta = array();
$con->db_transactionStart();
if ($_REQUEST['ID'] > 0) {
$faq = new FaqUtenti($_REQUEST['ID']);
} else {
$faq = new FaqUtenti();
}
$faq->NOME = Utils::get_filter_string('NOME');
$faq->COGNOME = Utils::get_filter_string('COGNOME');
$faq->DOMANDA = htmlentities(htmlspecialchars($_POST['DOMANDA']));
$faq->EMAIL = ($_REQUEST['EMAIL'] != "" ? $_REQUEST['EMAIL'] : $LoggedAccount->SPID_EMAIL );
$faq->DATA_INSERIMENTO = date("d-m-Y");
$faq->ID_ACCOUNT = $LoggedAccount->ID;
$faq->ID_CATEGORIA = Utils::get_filter_int('ID_CATEGORIA');
$risposta = $faq->Save();
if ($risposta['esito'] == 1) {
$transaction = true;
}
if ($transaction) {
$con->db_transactionCommit();
$return['esito'] = 1;
$return['custom'] = $risposta;
} else {
$return['esito'] = -999;
$return['erroreDescrizione'] = $risposta['erroreDescrizione'];
$con->db_transactionRollback();
}
exit(json_encode($return));
}
}