From a1e3c21c4dcc133672200a0c1901de381e94cb4c Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 24 Sep 2012 03:28:26 +0000 Subject: [PATCH] =?UTF-8?q?#243=20=E6=95=B0=E6=8D=AE=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E4=B8=AD=E8=AE=B0=E5=BD=95=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E8=80=85=E7=9A=84email=E5=92=8Cip=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controllers/DataController.php | 9 +++++---- application/default/controllers/AuthorController.php | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 9e881ed6..eabafd47 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -605,11 +605,14 @@ class Admin_DataController extends Zend_Controller_Action { $user = $auth->getIdentity(); $uid = $user->id; + $email = $user->email; } - $sql = "INSERT INTO comments (uuid,author,reply,userid,content) VALUES (?,?,?,?,?)"; + $ipaddr = $_SERVER['REMOTE_ADDR']; + + $sql = "INSERT INTO comments (uuid,author,reply,userid,content,email,ip) VALUES (?,?,?,?,?,?,?)"; $sth = $this->db->prepare($sql); - $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body)); + $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body,$email,$ipaddr)); if($rs) { @@ -2932,7 +2935,6 @@ class Admin_DataController extends Zend_Controller_Action return $row; } - /* * 保存XML数据到数据库 */ @@ -2954,4 +2956,3 @@ class Admin_DataController extends Zend_Controller_Action return true; }//jsonexit() 退出并返回json数据 } - diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 858b4e17..a960c3a5 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -1148,6 +1148,7 @@ class AuthorController extends Zend_Controller_Action { $user = $auth->getIdentity(); $uid = $user->id; + $email = $user->email; } $sql = "SELECT md.title,c.id,c.author,c.email,c.url,c.ts_created,c.content FROM comments c @@ -1166,9 +1167,11 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql = "INSERT INTO comments (uuid,author,reply,userid,content) VALUES (?,?,?,?,?)"; + $ipaddr = $_SERVER['REMOTE_ADDR']; + + $sql = "INSERT INTO comments (uuid,author,reply,userid,content,email,ip) VALUES (?,?,?,?,?,?,?)"; $sth = $this->db->prepare($sql); - $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body)); + $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body,$email,$ipaddr)); if($rs) {