X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=web%2Fapp%2Fmods%2Fforms%2Fcontact.php;h=69f3da8e780542f9c575178b6520f94397611249;hb=7cf7609a7e236347374c1b21777a9698bcd1726c;hp=d0fcc50f68cc40582b80c8a3a5b501f3edbdcdba;hpb=19b8f3b9263210d9154e7556446e903f84175519;p=mtweb diff --git a/web/app/mods/forms/contact.php b/web/app/mods/forms/contact.php index d0fcc50..69f3da8 100644 --- a/web/app/mods/forms/contact.php +++ b/web/app/mods/forms/contact.php @@ -1,32 +1,31 @@ path("libs")."ptitcaptcha.php")) require $this->path("libs")."ptitcaptcha.php"; + class mw_forms_contact extends mw_mod{ - class mw_forms_contact extends mw_mod - { - - function validate(&$env) - { if($pages_view_mod = $env->get_mod("pages/view")) - { return $pages_view_mod->validate(&$env); - } - return true; - } - - function index(&$env) - { if($env->config("contact_form") && $env->config("email")) - { if($_POST) - { if - ( $this->send - ( $env, + function index(&$env){ + if($env->config("contact_form") && $env->config("email")){ + if($env->config("captcha")){ + if(file_exists($env->path("libs")."ptitcaptcha.php")){ + require $env->path("libs")."ptitcaptcha.php"; + } + else{ + $env->erreur("fichier du captcha introuvable"); + return; + } + } + if($_POST){ + if( + $this->__send_form( + $env, $_POST["email"], "[".$env->config("site_name")."] nouveau message", $_POST["message"], $env->config("email"), $env->config("captcha") ) - ) - { $env->redirect - ( $env->url("index"), + ){ + $env->redirect( + $env->url("index"), "Le message a été envoyé", 2 ); @@ -36,25 +35,21 @@ else $env->run("index"); } - function send(&$env, $from, $titre, $message, $dest, $captcha) - { $env->set_out("ENVOYE", false); - if($captcha && !file_exists($env->path("libs")."ptitcaptcha.php")) - { $env->erreur("fichier du captcha introuvable"); - return false; - } - if(!$captcha || PtitCaptchaHelper::checkCaptcha()) - { if($from) - { if($dest) - { if - ( mail - ( $dest, + function __send_form(&$env, $from, $titre, $message, $dest, $captcha){ + $env->set_out("ENVOYE", false); + if(!$captcha || PtitCaptchaHelper::checkCaptcha()){ + if($from){ + if($dest){ + if( + @mail( + $dest, $titre, $message, "From: ".$from."\r\n" ."Reply-To: ".$from."\r\n" ) - ) - { $env->set_out("ENVOYE", true); + ){ + $env->set_out("ENVOYE", true); return true; } else $env->erreur("Erreur à l'envoi du mail");