From 7fe66c8b4b20fd13c69d46c9a18aeed27f643028 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 24 Jul 2013 10:09:19 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8A=A9=E6=89=8B=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=96=B0=E5=8A=9F=E8=83=BD=20getHos?= =?UTF-8?q?tLink()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/models/helper/dbh.php | 4 ++++ application/models/helper/view.php | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/application/models/helper/dbh.php b/application/models/helper/dbh.php index ac73e3c5..f9af1ecc 100644 --- a/application/models/helper/dbh.php +++ b/application/models/helper/dbh.php @@ -80,6 +80,10 @@ class dbh { $v = preg_replace("/\'/","''",$v); } + if(preg_match("/\"/",$v)) + { + $v = preg_replace("/\"/","''",$v); + } $ups[] = '"'.$k.'"=\''.$v."'"; } } diff --git a/application/models/helper/view.php b/application/models/helper/view.php index 300f3a5d..c4fc32d6 100644 --- a/application/models/helper/view.php +++ b/application/models/helper/view.php @@ -1,5 +1,5 @@ db = $db; } - static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request = NULL,$limit = 10) + static function addPaginator($data,$ctl,\Zend_Controller_Request_Abstract $request = NULL,$limit = 10) { if(empty($request)) { @@ -21,11 +21,11 @@ class view extends Zend_Controller_Plugin_Abstract $view = $ctl; } - $paginator = Zend_Paginator::factory($data); + $paginator = \Zend_Paginator::factory($data); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($limit); $paginator->setView($view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + \Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $view->paginator = $paginator; } @@ -70,7 +70,7 @@ class view extends Zend_Controller_Plugin_Abstract } static function User($param){ - $auth = Zend_Auth::getInstance(); + $auth = \Zend_Auth::getInstance(); if($auth->hasIdentity()) { $user = $auth->getIdentity(); @@ -90,7 +90,7 @@ class view extends Zend_Controller_Plugin_Abstract } } - static function Post(Zend_Controller_Action $ctl,$msg,$url=""){ + static function Post(\Zend_Controller_Action $ctl,$msg,$url=""){ if(empty($msg)) { @@ -101,10 +101,20 @@ class view extends Zend_Controller_Plugin_Abstract $msg = array('content'=>$msg,'url'=>$url); } - $helper = new Zend_Controller_Action_HelperBroker($ctl); + $helper = new \Zend_Controller_Action_HelperBroker($ctl); $helper->layout->setLayout('layout'); $helper->viewRenderer->setNoRender(); echo $ctl->view->partial('post-message.phtml', $msg); return true; } + + static function getHostLink() + { + $protocol = "http"; + if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https")) + { + $protocol = "https"; + } + return $protocol."://".$_SERVER['SERVER_NAME']; + } } \ No newline at end of file