User management for the world wide web

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Mail.php

00001 <?php
00002 
00003 require_once("GenieGate/View.php");
00004 
00016 class GenieGate_View_Mail extends GenieGate_View {
00017 
00018     var $page;
00019     var $subject;
00020     var $to;
00021     var $hdr = FALSE;
00022     
00032     function GenieGate_View_Mail($to,$php){
00033         $this->to($to);
00034             $this->page = $php;
00035     }
00036   
00040     function subject($subject = FALSE){
00041             $rv = $this->subject;
00042             if($subject){
00043                 $this->subject = $subject;
00044             }
00045             return($rv);
00046     }    
00047     
00051     function headers($headers = FALSE){
00052         $rv = $this->hdr;
00053         if($headers){
00054             $this->hdr = $headers;
00055         }
00056         return($rv);
00057     }
00058     
00064     function page($php = FALSE){
00065         $rv = $this->page;
00066         if($php){
00067             $this->page = $php;
00068         }
00069         return($rv);
00070     }
00071 
00079     function to($to = FALSE){
00080             $rv = $this->to;
00081             if($to){
00082                 // Don't allow \nBcc:spam-o-gram\n in the To: line. (this is  
00083             // probably superfluous, but just to be sure we aren't used for spammers.) 
00084                 // 
00085             // This is very unlikely, since the only sent mail is canned, but
00086             // if this class were ever used for feedback forms and the like
00087             // it could come in handy.
00088             $this->to = preg_replace("/[\t\n\r\s,]/","",$to);
00089             }
00090             return($rv);
00091     }
00092   
00097     function display(){
00098         ob_start();
00099             require($this->page); // use require() NOT include() so that errors are fatal, not sent in email.
00100             $data = ob_get_contents();
00101             ob_clean();
00102             ob_end_flush();
00103             if($this->hdr){
00104             return(mail($this->to(),$this->subject(),$data,$this->hdr));
00105             }else{
00106                 return(mail($this->to(),$this->subject(),$data));
00107         }
00108     }
00109 
00110 }
00111 
00112 ?>

DoxyGen Documentation generated by DoxyGen