LEVEL_VISITOR ? '' : "AND #_TP_entities.status>0 AND #_TP_types.status>0"; function_exists("filtered_mysql_fetch_assoc") || include_once 'filterfunc.php'; $id = C::get('id'); $site = C::get('site', 'cfg'); defined('INC_CONNECT') || include 'connect.php'; global $db; $result = $db->Execute(lq(" SELECT #_TP_textes.*, #_TP_entities.*,type FROM #_entitiestypesjoin_ JOIN #_TP_textes ON #_TP_entities.id = #_TP_textes.identity WHERE #_TP_entities.id='$id' $critere")) or trigger_error("SQL ERROR :
".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR); if ($result->RecordCount() < 1) { $result->Close(); $context['notfound'] = 1; View::getView()->render('signaler'); return; } $context = array_merge($context, filtered_mysql_fetch_assoc($context, $result)); $result->Close(); // send if (isset($context['envoi'])) { if($context['signaler_recaptcha'] === true) { // recaptcha $resp = recaptcha_check_answer (C::get('recaptcha_privatekey', 'cfg'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $context['recaptcha_error'] = $resp->error; C::set('nocache', true); View::getView()->render('signaler'); exit; } } // validation do { $err = false; // on vérifie que les mails fournies sont correctes if (empty($context['to']) || !preg_match("/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/", $context['to'])) { $err = $context['error_to'] = 1; } if (empty($context['from']) || !preg_match("/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/", $context['from'])) { $err = $context['error_from'] = 1; } if ($err) { break; } $row = $db->getRow(lq("SELECT url FROM #_MTP_sites WHERE name='{$site}'")); $context['subject'] = 'Un article de ' . $context['options']['metadonneessite']['titresite'] . " sur {$row['url']} signalé par "; if(!empty($context['nom_expediteur'])) $context['subject'] .= $context['nom_expediteur']; else $context['subject'] .= "un ami (" . $context['from'] . ")."; class_exists('View') || include 'View.php'; // should be included by the autoload ob_start(); $GLOBALS['nodesk'] = true; // on veut pas le desk pour la génération du mail ! // on utilise pas le cache pour le mail généré !! C::set('nocache', true); insert_template($context, 'signaler-mail'); $content = ob_get_clean(); // envoie le mail if (true !== send_mail ($context['to'], $content, $context['subject'], $context['from'], $context['nom_expediteur'])) { $context['error_mail']=1; break; } header ('location: '. makeurlwithid($id, 'index')); return; } while (0); } View::getView()->renderCached('signaler'); } catch(LodelException $e) { echo $e->getContent(); exit(); } ?>