<?
//v1.8 www.exoops.info 2006/03
// 
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Pascal Le Boustouller
// Author Website : http://www.perso-search.com/e-xoopsien/
// Licence Type   : GPL
// ------------------------------------------------------------------------- //
if ($submit) {
include("header.php");
global $bcoosConfig, $db, $myts;
 $result = $db->query("SELECT email, submitter, title, type, description FROM  ".$db->prefix("ann_annonces")." WHERE lid = '$id'");
while(list($email, $submitter, $titre, $type, $description) = $db->fetchRow($result)) {
	$title = $myts->makeTboxData4Show($title);
	$type = $myts->makeTboxData4Show($type);
	$description = $myts->makeTboxData4Show($description);
	$submitter = $myts->makeTboxData4Show($submitter);	
if ($tele) {
$teles = ""._CLA_ORAT." $tele";
}  else {
$teles = "";
}
 
$message .= ""._CLA_MESSFROM." $namep "._CLA_FROMANNOF." ".$bcoosConfig['title']."\n\n";
$message .= ""._CLA_REMINDANN."\n$type : $titre\nTexte : $description\n\n";
$message .= "--------------- "._CLA_STARTMESS." $namep -------------------\n";
$message .= "$messtext\n\n";
$message .= "--------------- "._CLA_ENDMESS." de $namep -------------------\n\n";
$message .= ""._CLA_CANJOINT." $namep "._CLA_TO." $post $teles";
	$subject = ""._CLA_CONTACTAFTERANN."";
	$mail =& getMailer();
	$mail->useMail();
	//$mail->setFromName($bcoosConfig['title']);
	$mail->setFromEmail($post);
	$mail->setToEmails($email);
	$mail->setSubject($subject);
	$mail->setBody($message);
	$mail->send();
	echo $mail->getErrors();
}
redirect_header("index.php",1,_CLA_MESSEND);
exit();
} else {
include("header.php");
include(XOOPS_ROOT_PATH."/modules/MyAnnonces/include/functions.php");
include(XOOPS_ROOT_PATH."/header.php");
OpenTable();
echo "<script>
          function verify() {
                var msg = \""._CLA_VALIDERORMSG."\\n__________________________________________________\\n\\n\";
                var errors = \"FALSE\";
			
				if (document.Cont.namep.value == \"\") {
                        errors = \"TRUE\";
                        msg += \""._CLA_VALIDSUBMITTER."\\n\";
                }
				
				if (document.Cont.post.value == \"\") {
                        errors = \"TRUE\";
                        msg += \""._CLA_VALIDEMAIL."\\n\";
                }
				
				if (document.Cont.messtext.value == \"\") {
                        errors = \"TRUE\";
                        msg += \""._CLA_VALIDMESS."\\n\";
                }
				
  
                if (errors == \"TRUE\") {
                        msg += \"__________________________________________________\\n\\n"._CLA_VALIDMSG."\\n\";
                        alert(msg);
                        return false;
                }
          }
          </script>";
echo "<B><A HREF=\"index.php\">"._CLA_MAIN."</A> &raquo; "._CLA_CONTACTAUTOR."</B><BR><BR>";
echo ""._CLA_TEXTAUTO."<BR>";
echo "<form onSubmit=\"return verify();\" method=\"post\" action=\"contact.php\" NAME=\"Cont\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$lid\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"submit\" VALUE=\"1\">";
    if($xoopsUser) {
	$idd =$xoopsUser->getVar("name", "E");
	$idde =$xoopsUser->getVar("email", "E");
	}
echo "<TABLE WIDTH=100% BORDER=0 CELLSPACING=1>
    <TR>
      <TD>"._CLA_YOURNAME."</TD>
      <TD><input type=\"text\" class=\"text\" name=\"namep\" size=\"42\" value=\"$idd\"></TD>
    </TR>
    <TR>
      <TD>"._CLA_YOUREMAIL."</TD>
      <TD><input type=\"text\" class=\"text\" name=\"post\" size=\"42\" value=\"$idde\"></font></TD>
    </TR>
    <TR>
      <TD>"._CLA_YOURPHONE."</TD>
      <TD><input type=\"text\" class=\"text\" name=\"tele\" size=\"42\"></font></TD>
    </TR>
    <TR>
      <TD>"._CLA_YOURMESSAGE."</TD>
      <TD><textarea rows=\"5\" class=\"textarea\" name=\"messtext\" cols=\"40\"></textarea></TD>
    </TR>
</TABLE>
      <p><INPUT TYPE=\"submit\" VALUE=\""._CLA_SENDFR."\" class=\"button\">
</form>";
CloseTable();
copyright();
include(XOOPS_ROOT_PATH."/footer.php");
}
?>
