From 754320b7d2649cd36d8d4bace400bd3fccdefecb Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 15 Dec 2011 02:34:56 +0000 Subject: [PATCH] =?UTF-8?q?#279=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E6=9D=BF=E4=B8=AD=E6=A0=87=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/models/EmailText.php | 38 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/application/models/EmailText.php b/application/models/EmailText.php index 6bfe94c8..ae40722d 100644 --- a/application/models/EmailText.php +++ b/application/models/EmailText.php @@ -6,10 +6,10 @@ class EmailText{ protected $tmpinfo; function __construct($db,$id,$replace) - { - $this->db=$db; - $this->tmpid=$id; - $this->data=$replace; + { + $this->db=$db; + $this->tmpid=$id; + $this->data=$replace; $this->load(); } @@ -18,7 +18,7 @@ class EmailText{ if(is_numeric($this->tmpid)) $sql = "select * from emailtext where id='".$this->tmpid."'"; else - $sql = "select * from emailtext where template='".$this->tmpid."'"; + $sql = "select * from emailtext where template='".$this->tmpid."'"; $t=$this->db->getFetchMode(); $this->db->setFetchMode(Zend_Db::FETCH_ASSOC); $rs = $this->db->query($sql); @@ -33,10 +33,15 @@ class EmailText{ { return false; }else{ - if (empty($body)) - { - $this->getinfo(); - $body=$this->tmpinfo['body']; + if (empty($body)) + { + $this->getinfo(); + $body=$this->tmpinfo['body']; + } + + if (empty($this->tmpinfo['subject'])) + { + $this->getinfo(); } if(!empty($body)) @@ -56,7 +61,8 @@ class EmailText{ } ksort($patterns); ksort($replacements); - $this->tmpinfo['body']=preg_replace($patterns, $replacements, $body); + $this->tmpinfo['body'] = preg_replace($patterns, $replacements, $body); + $this->tmpinfo['subject'] = preg_replace($patterns, $replacements, $this->tmpinfo['subject']); return true; }//count($this->data) } @@ -65,11 +71,11 @@ class EmailText{ return false; } }//empty($this->tmpid) - }//function loadtmp - public function getBody() { - return $this->tmpinfo['body']; - } - public function getSubject() { - return $this->tmpinfo['subject']; + }//function loadtmp + public function getBody() { + return $this->tmpinfo['body']; + } + public function getSubject() { + return $this->tmpinfo['subject']; } } \ No newline at end of file