[Openfirst-cvscommit] base/config/functions mail.php,1.2,1.3
Brought to you by:
xtimg
From: <xt...@us...> - 2003-09-01 15:38:23
|
Update of /cvsroot/openfirst/base/config/functions In directory sc8-pr-cvs1:/tmp/cvs-serv4865 Modified Files: mail.php Log Message: Fix mail functions so that they can properly send messages using PHP or ASP header files, rather than requiring plain HTML headers in order to function correctly. Index: mail.php =================================================================== RCS file: /cvsroot/openfirst/base/config/functions/mail.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mail.php 17 Aug 2003 16:22:44 -0000 1.2 --- mail.php 1 Sep 2003 15:38:16 -0000 1.3 *************** *** 56,59 **** --- 56,81 ---- } fclose($fle); + // Strip the PHP tags from the header. + while(stristr($fheader,"<?")) { + $fheader = str_replace(substr($fheader, strpos($fheader, "<?"), strpos($fheader, "?>") - strpos($fheader, "<?") + 2), "", $fheader); + } + while(stristr($ffooter,"<?")) { + $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<?"), strpos($ffooter, "?>") - strpos($ffooter, "<?") + 2), "", $ffooter); + } + // Strip the ASP tags from the header. + + while(stristr($fheader,"<%")) { + $fheader = str_replace(substr($fheader, strpos($fheader, "<%"), strpos($fheader, "%>") - strpos($fheader, "<%") + 2), "", $fheader); + } + while(stristr($ffooter,"<%")) { + $ffooter = str_replace(substr($ffooter, strpos($ffooter, "<%"), strpos($ffooter, "%>") - strpos($ffooter, "<%") + 2), "", $ffooter); + } + $fheader = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); + $fheader = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); + $fheader = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $fheader); + $ffooter = str_replace("src=\"/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); + $ffooter = str_replace("src='/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); + $ffooter = str_replace("src=/", "src=\"http://" . $_SERVER["SERVER_NAME"] . "/" . $basepath, $ffooter); + $info .= ("$fheader<pre>$message</pre>$ffooter"); return(mail($to, $subject, $info, $headers)); |