From 71bfcceb8d87289ac824caf5e10e7109cdde54bf Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Fri, 11 Jan 2013 05:32:54 +0000 Subject: [PATCH] + add mailExist function. --- module/mail/control.php | 3 ++- module/mail/model.php | 11 +++++++++++ module/mail/view/save.html.php | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/mail/control.php b/module/mail/control.php index 1ef22b0cf1..30cc2e7c89 100755 --- a/module/mail/control.php +++ b/module/mail/control.php @@ -82,7 +82,7 @@ class mail extends control $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common); $this->view->position[] = $this->lang->mail->edit; - $this->view->mailExist = $this->dao->select('email')->from(TABLE_USER)->where('email')->ne('')->fetch(); + $this->view->mailExist = $this->mail->mailExist(); $this->view->mailConfig = $mailConfig; $this->display(); } @@ -121,6 +121,7 @@ class mail extends control $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common); $this->view->position[] = $this->lang->mail->save; + $this->view->mailExist = $this->mail->mailExist(); $this->display(); } } diff --git a/module/mail/model.php b/module/mail/model.php index c47dde8c30..c27a05bb2c 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -369,6 +369,17 @@ class mailModel extends model $this->mta->clearAttachments(); } + /** + * Check system if there is a mail at least. + * + * @access public + * @return bool | object + */ + public function mailExist() + { + return $this->dao->select('email')->from(TABLE_USER)->where('email')->ne('')->fetch(); + } + /** * Is error? * diff --git a/module/mail/view/save.html.php b/module/mail/view/save.html.php index 633e198d14..50e204ce5b 100755 --- a/module/mail/view/save.html.php +++ b/module/mail/view/save.html.php @@ -17,7 +17,7 @@ include '../../common/view/header.html.php'; mail->successSaved; - echo html::linkButton($lang->mail->test, inlink('test')); + if($this->config->mail->turnon and $mailExist) echo html::linkButton($lang->mail->test, inlink('test')); ?>