diff --git a/application/models/EmailText.php b/application/models/EmailText.php new file mode 100644 index 00000000..943c39f3 --- /dev/null +++ b/application/models/EmailText.php @@ -0,0 +1,53 @@ +tmpid)||empty($this->tmpid)) + { + $this->tmpid = 0; + } + } + + public function loadtmp(){ + + if(empty($this->tmpid)) + { + return false; + }else{ + $sql = "select id,body from emailtext where id='".$this->tmpid."'"; + $rs = $this->db->query($sql); + + $c = $rs->fetch(); + if(!empty($c['id'])) + { + if(count($this->data)==0) + { + return false; + } + else + { + $patterns = array(); + $replacements = array(); + foreach($this->data as $k=>$v) + { + $patterns[]='/{'.$k.'}/i'; + $replacements[]=$v; + } + ksort($patterns); + ksort($replacements); + $newString=preg_replace($patterns, $replacements, $c['body']); + return $newString; + }//count($this->data) + } + else + { + return false; + } + }//empty($this->tmpid) + }//function loadtmp +} \ No newline at end of file