From 3ea63072225a473239227facfabde294bb58ed1d Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 3 Dec 2005 16:19:08 +0000 Subject: --- framework/Web/UI/THiddenFieldPageStatePersister.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/THiddenFieldPageStatePersister.php') diff --git a/framework/Web/UI/THiddenFieldPageStatePersister.php b/framework/Web/UI/THiddenFieldPageStatePersister.php index bd32f686..5525b50a 100644 --- a/framework/Web/UI/THiddenFieldPageStatePersister.php +++ b/framework/Web/UI/THiddenFieldPageStatePersister.php @@ -14,6 +14,7 @@ class THiddenFieldPageStatePersister extends TComponent implements IPageStatePer public function init($application, $config) { $this->_application=$application; + $application->getService()->setPageStatePersister($this); } /** @@ -36,19 +37,19 @@ class THiddenFieldPageStatePersister extends TComponent implements IPageStatePer { $data=Prado::serialize($state); $hmac=$this->computeHMAC($data,$this->getKey()); - if(function_exists('gzuncompress') && function_exists('gzcompress')) + if(extension_loaded('zlib')) $data=gzcompress($hmac.$data); else $data=$hmac.$data; - $this->_application->getService()->getRequestedPage()->saveStateField($data); + $this->_application->getService()->getRequestedPage()->getClientScript()->registerHiddenField(TClientScriptManager::FIELD_PAGE_STATE,base64_encode($data)); } public function load() { - $str=$this->_application->getService()->getRequestedPage()->loadStateField(); + $str=base64_decode($this->_application->getRequest()->getItems()->itemAt(TClientScriptManager::FIELD_PAGE_STATE)); if($str==='') return null; - if(function_exists('gzuncompress') && function_exists('gzcompress')) + if(extension_loaded('zlib')) $data=gzuncompress($str); else $data=$str; -- cgit v1.2.3