diff --git a/application/models/EmailText.php b/application/models/EmailText.php index 6dc5fdbc..da3bcf18 100644 --- a/application/models/EmailText.php +++ b/application/models/EmailText.php @@ -4,6 +4,7 @@ class EmailText{ var $tmpid; var $db; var $data; + var $tmpinfo; function __construct() { @@ -13,19 +14,30 @@ class EmailText{ } } + public function getinfo(){ + + if(is_numeric($this->tmpid)) + $sql = "select * from emailtext where id='".$this->tmpid."'"; + else + $sql = "select * from emailtext where template='".$this->tmpid."'"; + + $rs = $this->db->query($sql); + + $this->tmpinfo = $rs->fetch(); + + } + public function loadtmp(){ if(empty($this->tmpid)) { return false; }else{ - if(is_numeric($this->tmpid)) - $sql = "select id,body from emailtext where id='".$this->tmpid."'"; - else - $sql = "select id,body from emailtext where template='".$this->tmpid."'"; - $rs = $this->db->query($sql); - $c = $rs->fetch(); + $this->getinfo(); + + $c = $this->tmpinfo; + if(!empty($c['id'])) { if(count($this->data)==0)