Example #1
0
 public function newTemplateMsg($template, $additionalHooks)
 {
     global $mail_templates_dir, $debug_mode;
     $this->contents = file_get_contents($mail_templates_dir . $template);
     //Check to see we can access the file / it has some contents
     if (!$this->contents || empty($this->contents)) {
         if ($debug_mode) {
             if (!$this->contents) {
                 echo lang("MAIL_TEMPLATE_DIRECTORY_ERROR", array(getenv("DOCUMENT_ROOT")));
                 die;
             } else {
                 if (empty($this->contents)) {
                     echo lang("MAIL_TEMPLATE_FILE_EMPTY");
                     die;
                 }
             }
         }
         return false;
     } else {
         //Replace default hooks
         $this->contents = replaceDefaultHook($this->contents);
         //Replace defined / custom hooks
         $this->contents = str_replace($additionalHooks["searchStrs"], $additionalHooks["subjectStrs"], $this->contents);
         //Do we need to include an email footer?
         //Try and find the #INC-FOOTER hook
         if (strpos($this->contents, "#INC-FOOTER#") !== FALSE) {
             $footer = file_get_contents($mail_templates_dir . "email-footer.html");
             if ($footer && !empty($footer)) {
                 $this->contents .= replaceDefaultHook($footer);
             }
             $this->contents = str_replace("#INC-FOOTER#", "", $this->contents);
         }
         return true;
     }
 }
 public function newTemplateMsg($template, $additionalHooks)
 {
     global $mail_templates_dir, $debug_mode;
     $this->contents = @file_get_contents($mail_templates_dir . $template);
     //Check to see we can access the file / it has some contents
     if (!$this->contents || empty($this->contents)) {
         if ($debug_mode) {
             if (!$this->contents) {
                 echo "Unable to open mail-templates directory. Perhaps try: " . getenv("DOCUMENT_ROOT") . "/YOUR-USER-CAKE-DIRECTORY/models/mail-templates/" . "    in models/settings.php for mail directory";
                 die;
             } else {
                 if (empty($this->contents)) {
                     echo "Template file is empty... nothing to send.";
                     die;
                 }
             }
         }
         return false;
     } else {
         //Replace default hooks
         $this->contents = replaceDefaultHook($this->contents);
         //Replace defined / custom hooks
         $this->contents = str_replace($additionalHooks["searchStrs"], $additionalHooks["subjectStrs"], $this->contents);
         //Do we need to include an email footer?
         //Try and find the #INC-FOOTER hook
         if (strpos($this->contents, "#INC-FOOTER#") !== FALSE) {
             $footer = @file_get_contents($mail_templates_dir . "email-footer.txt");
             if ($footer && !empty($footer)) {
                 $this->contents .= replaceDefaultHook($footer);
             }
             $this->contents = str_replace("#INC-FOOTER#", "", $this->contents);
         }
         return true;
     }
 }
Example #3
0
 public function newTemplateMsg($template, $additionalHooks)
 {
     global $mail_templates_dir, $debug_mode;
     $this->contents = file_get_contents($mail_templates_dir . $template);
     //Check to see we can access the file / it has some contents
     if (!$this->contents || empty($this->contents)) {
         return false;
     } else {
         //Replace default hooks
         $this->contents = replaceDefaultHook($this->contents);
         //Replace defined / custom hooks
         $this->contents = str_replace($additionalHooks["searchStrs"], $additionalHooks["subjectStrs"], $this->contents);
         return true;
     }
 }