From 59571458e7e63f41b02fd873aef6a8586868ce06 Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 12 Oct 2011 13:03:17 +0000 Subject: [PATCH] rename file and change db sql. --- application/models/EmailText.php | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 application/models/EmailText.php 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