From 3ba065922fadd3dfc9e60014690e139a5568f8a9 Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Wed, 15 Jul 2009 09:01:05 +0000 Subject: Merging latests 3.1 changes into trunk --- framework/Web/UI/TPage.php | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/TPage.php') diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 12433715..6f7e533d 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -133,6 +133,11 @@ class TPage extends TTemplateControl * @var boolean whether page state should be encrypted */ private $_enableStateEncryption=false; + /** + * @var boolean whether page state should be compressed + * @since 3.1.6 + */ + private $_enableStateCompression=true; /** * @var string page state persister class name */ @@ -283,7 +288,7 @@ class TPage extends TTemplateControl $this->setAdapter(new TActivePageAdapter($this)); // Decode Callback postData from UTF-8 to current Charset - if (($g=$this->getApplication()->getGlobalization(false))!==null && + if (($g=$this->getApplication()->getGlobalization(false))!==null && strtoupper($enc=$g->getCharset())!='UTF-8') foreach ($this->_postData as $k=>$v) $this->_postData[$k]=iconv('UTF-8',$enc.'//IGNORE',$v); @@ -1123,6 +1128,24 @@ class TPage extends TTemplateControl $this->_enableStateEncryption=TPropertyValue::ensureBoolean($value); } + /** + * @return boolean whether page state should be compressed. Defaults to true. + * @since 3.1.6 + */ + public function getEnableStateCompression() + { + return $this->_enableStateCompression; + } + + /** + * @param boolean whether page state should be compressed. + * @since 3.1.6 + */ + public function setEnableStateCompression($value) + { + $this->_enableStateCompression=TPropertyValue::ensureBoolean($value); + } + /** * @return string the requested page path for this page */ @@ -1234,7 +1257,7 @@ class TPageStateFormatter $str=$sm->hashData(Prado::serialize($data)); else $str=Prado::serialize($data); - if(extension_loaded('zlib')) + if($page->getEnableStateCompression() && extension_loaded('zlib')) $str=gzcompress($str); if($page->getEnableStateEncryption()) $str=$sm->encrypt($str); @@ -1256,7 +1279,7 @@ class TPageStateFormatter $sm=$page->getApplication()->getSecurityManager(); if($page->getEnableStateEncryption()) $str=$sm->decrypt($str); - if(extension_loaded('zlib')) + if($page->getEnableStateCompression() && extension_loaded('zlib')) $str=@gzuncompress($str); if($page->getEnableStateValidation()) { @@ -1270,4 +1293,4 @@ class TPageStateFormatter } } -?> +?> \ No newline at end of file -- cgit v1.2.3