%PDF- %PDF-
Direktori : /home/devcapijob/public_html/composants/contact/ |
Current File : /home/devcapijob/public_html/composants/contact/model.php |
<?php /** * @version 1 * @package yassir * @copyright Copyright (C) 2011 Open Source Matters. All rights reserved. * @license sharware * * * @ Contact MODELE */ class contactModele extends Model{ function contact_detail(){ $data=$this->details_info_contact(); return $data[0]; } function ajouter_message(){ $date=date('Y-m-d H:i:s'); $query='INSERT INTO #_contact_messages ( nom , societe , email , telephone , sujet , message, date ) VALUES ( "'.Request::post('nom').'", "", "'.Request::post('email').'", "", "'.Request::post('sujet').'", "'.Request::post('message').'", "'.$date.'" );'; //echo $query;exit; $a=DB::do_query($query); if($a){ $this->send_mail_contact(); return true;} else{return false;} } function send_mail_contact(){ require_once('Zend/Mail.php'); $header = $this->header_mail(); // envoi mail $rc=$this->soc_info('rc'); $body ='<tr bgcolor="#e4e4e4"> <td> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="center" style="padding:40px 60px"><span style="display: block;border-bottom: 1px solid #fff;"><span style="font-size: 20px;font-weight: bold;background:#e4e4e4;padding: 18px;position: relative;top: 9px;">Formulaire de contact</span></span></td> </tr> <tr> <td align="left" style="padding:10px 30px"> <p> <strong>Nom</strong> : '.utf8_decode(stripcslashes(Request::post('nom'))).' <br/> <strong>Email</strong> '.Request::post('email').'<br/> <strong>Sujet </strong> : '.utf8_decode(stripcslashes(Request::post('sujet'))).'<br/> <strong>Message </strong> : '.utf8_decode(stripcslashes(nl2br($_POST['message']))).' </p> </td> </tr> <tr> <td align="center" style="padding:30px 30px"> </td> </tr> </table> </td> </tr>'; $footer = $this->footer_mail($rc); $html =$header.$body.$footer; //echo $html;exit; $mail = new Zend_Mail(); $mail->setType(Zend_Mime::MULTIPART_RELATED); $mail->setBodyHtml($html); $mail->setFrom('marc@capijob.com', $this->soc_info('rc')); $mail->addTo('alain@capijob.com', $rc); $mail->setSubject("Contact ".$rc); if(Request::post('cdc')!=''){ $tab_cdc=explode(';',Request::post('cdc')); for($i=0;$i<sizeof($tab_cdc);$i++){ $fileContents = file_get_contents('files_perso/cdc/'.$tab_cdc[$i]); $file = $mail->createAttachment($fileContents); $file->filename = $tab_cdc[$i]; } } if($mail->send()){ //echo 'ds';exit; return true; } } /*function send_mail_contact(){ // envoi mail $email=Request::post('email'); $rc=$this->soc_info('rc'); $to = $this->soc_info('email'); $Sujet = "Contact ".$rc; $From = "From: ".Request::post('nom')." <".Request::post('email')."> \r\n"; $From .="Reply-To:'".Request::post('nom')."' <".Request::post('email')."> \r\n"; $From .= "MIME-version: 1.0\n"; $From .= "Content-Type: text/html; charset=ISO-8859-1 \n"; $msg = "<html><body><b>Bonjour, </b><br />"; $msg .= "<p>Vous venez de recevoir un message depuis le site ".$rc." : </p>"; $msg .= "<br />Nom : <b>".(Request::post('nom'))."</b>"; $msg .= "<br /><br />Email : <b>".(Request::post('email'))."</b>"; $msg .= "<br /><br />Tél. : <b>".(Request::post('sujet'))."</b>"; $msg .= "<br /><br />Message : <br /><b>".utf8_decode(stripcslashes(nl2br($_POST['message'])))."</b>"; $msg .= "<br /> "; $msg .= "<br />"; $msg .= "<br /> Bien cordialement</body></html>"; if(mail($to,$Sujet,$msg,$From)){return true;}; }*/ function soc_info($element=NULL){ $el=(is_null($element))? '*' : $element; $query='select '.$el.' from #_societe'; $data=DB::do_query($query); $array=array(); $row = $data->fetch(); if(!is_null($element)){return $row[$el];} return $row; } } ?>