assign('page_en_cours','infos'); if(isset($_GET['news'])){ $smarty->assign('page_en_cours2','news'); } if(isset($_GET['evenements'])){ $smarty->assign('page_en_cours2','evenements'); } if(isset($_GET['presse'])){ $smarty->assign('page_en_cours2','presse'); } if(isset($_GET['contact'])){ $smarty->assign('page_en_cours2','contact'); } if(!isset($_GET['qui-sommes-nous']) && !isset($_GET['news']) && !isset($_GET['evenements']) && !isset($_GET['presse']) && !isset($_GET['contact'])){ $_GET['qui-sommes-nous']="qui-sommes-nous"; $smarty->assign('page_en_cours2','qui-sommes-nous'); } if(isset($_GET['qui-sommes-nous'])){ $smarty->assign('page_en_cours2','qui-sommes-nous'); if (($id_cms = 8) AND $cms = new CMS(intval($id_cms), intval($cookie->id_lang)) AND Validate::isLoadedObject($cms)){ $smarty->assign('cms' , $cms); } } $js_files = array( __PS_BASE_URI__.'js/jquery/jquery.scrollto.js', __PS_BASE_URI__.'js/jquery/jquery.serialScroll.js', _THEME_JS_DIR_.'tools.js' ); $smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang))); if (isset($_POST['submitMessage'])){ $nom=$_POST['nom']; $prenom=$_POST['prenom']; $adresse=$_POST['adresse']; $adresse2=$_POST['adresse2']; $codepostal=$_POST['codepostal']; $ville=$_POST['ville']; $pays=$_POST['pays']; $activite=$_POST['activite']; $email=$_POST['from']; $telephone=$_POST['telephone']; $message=nl2br($_POST['message']); if (!($from = Tools::getValue('from')) OR !Validate::isEmail($from)) $errors[] = Tools::displayError('invalid e-mail address'); elseif (!($message = nl2br2(Tools::getValue('message')))) $errors[] = Tools::displayError('message cannot be blank'); elseif (!Validate::isMessage($message)) $errors[] = Tools::displayError('invalid message'); elseif (!($id_contact = intval(Tools::getValue('id_contact'))) OR !(Validate::isLoadedObject($contact = new Contact(intval($id_contact), intval($cookie->id_lang))))) $errors[] = Tools::displayError('please select a contact in the list'); else { if (intval($cookie->id_customer)) $customer = new Customer(intval($cookie->id_customer)); if (Mail::Send(intval($cookie->id_lang), 'contact', 'Message from contact form', array( '{email}' => $from, '{nom}' => $nom, '{prenom}' => $prenom, '{adresse}' => $adresse, '{adresse2}' => $adresse2, '{codepostal}' => $codepostal, '{ville}' => $ville, '{pays}' => $pays, '{activite}' => $activite, '{telephone}' => $telephone, '{message}' => addslashes($message) ), $contact->email, $contact->name, $from, (intval($cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : $from))){ $smarty->assign('confirmation', 1); }else{ $errors[] = Tools::displayError('an error occurred while sending message'); } } $smarty->assign('confirmation', 1); Db::getInstance()->Execute(' insert into '._DB_PREFIX_.'msgcontact (id_msg,destinataire, nom, prenom, adresse, adresse2, codepostal, ville, pays, activite, email, telephone, message, date_post) values (NULL,"'.$contact->name.'", "'.$nom.'", "'.$prenom.'", "'.$adresse.'", "'.$adresse2.'", "'.$codepostal.'", "'.$ville.'", "'.$pays.'", "'.$activite.'", "'.$email.'", "'.$telephone.'", "'.addslashes($message).'", '.mktime().')'); } $email = Tools::safeOutput(Tools::getValue('email', ((isset($cookie) AND isset($cookie->email) AND Validate::isEmail($cookie->email)) ? $cookie->email : ''))); $smarty->assign(array( 'errors' => $errors, 'email' => $email )); $countries = Country::getCountries(intval($cookie->id_lang), true); $smarty->assign("pays",$countries); include(dirname(__FILE__).'/header.php'); $smarty->display(_PS_THEME_DIR_.'infos.tpl'); include(dirname(__FILE__).'/footer.php'); ?>