summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2013-11-26 11:43:27 +0100
committerFabio Bas <ctrlaltca@gmail.com>2013-11-26 11:43:27 +0100
commit65adcbec2cc9a00a5b0611e34c7141bf4e6d63f7 (patch)
tree2a2f353f2f7b0fd6cde035068a2036ab630f688b
parenta1983c5f49f5ec95da2d3848a0250771a870534d (diff)
parent5632770c86d30361fe0c3eefc7d327786b478702 (diff)
Merge branch 'jquery' of https://github.com/pradosoft/prado into jquery
-rw-r--r--.gitignore3
-rw-r--r--framework/Caching/TDbCache.php6
-rw-r--r--framework/Caching/TSqliteCache.php6
-rw-r--r--framework/PradoBase.php24
-rw-r--r--framework/TApplication.php10
-rw-r--r--framework/Web/UI/TPage.php8
6 files changed, 17 insertions, 40 deletions
diff --git a/.gitignore b/.gitignore
index 93cbf3f5..d1850cff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,5 @@ bin/coveralls
bin/dbunit.php
#OSX
-.DS_Store \ No newline at end of file
+.DS_Store
+/nbproject/private/ \ No newline at end of file
diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php
index 01962a55..03c6f54f 100644
--- a/framework/Caching/TDbCache.php
+++ b/framework/Caching/TDbCache.php
@@ -463,12 +463,12 @@ class TDbCache extends TCache
try {
$sql='SELECT value FROM '.$this->_cacheTable.' WHERE itemkey=\''.$key.'\' AND (expire=0 OR expire>'.time().') ORDER BY expire DESC';
$command=$this->getDbConnection()->createCommand($sql);
- return Prado::unserialize($command->queryScalar());
+ return unserialize($command->queryScalar());
}
catch(Exception $e)
{
$this->initializeCache(true);
- return Prado::unserialize($command->queryScalar());
+ return unserialize($command->queryScalar());
}
}
@@ -505,7 +505,7 @@ class TDbCache extends TCache
{
$command=$this->getDbConnection()->createCommand($sql);
$command->bindValue(':key',$key,PDO::PARAM_STR);
- $command->bindValue(':value',Prado::serialize($value),PDO::PARAM_LOB);
+ $command->bindValue(':value',serialize($value),PDO::PARAM_LOB);
$command->execute();
return true;
}
diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php
index a00a8472..ae040028 100644
--- a/framework/Caching/TSqliteCache.php
+++ b/framework/Caching/TSqliteCache.php
@@ -163,7 +163,7 @@ class TSqliteCache extends TCache
{
$sql='SELECT value FROM '.self::CACHE_TABLE.' WHERE key=\''.$key.'\' AND (expire=0 OR expire>'.time().') LIMIT 1';
if(($ret=$this->_db->query($sql))!=false && ($row=$ret->fetch(SQLITE_ASSOC))!==false)
- return Prado::unserialize($row['value']);
+ return unserialize($row['value']);
else
return false;
}
@@ -180,7 +180,7 @@ class TSqliteCache extends TCache
protected function setValue($key,$value,$expire)
{
$expire=($expire<=0)?0:time()+$expire;
- $sql='REPLACE INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string(Prado::serialize($value)).'\','.$expire.')';
+ $sql='REPLACE INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string(serialize($value)).'\','.$expire.')';
return $this->_db->query($sql)!==false;
}
@@ -196,7 +196,7 @@ class TSqliteCache extends TCache
protected function addValue($key,$value,$expire)
{
$expire=($expire<=0)?0:time()+$expire;
- $sql='INSERT INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string(Prado::serialize($value)).'\','.$expire.')';
+ $sql='INSERT INTO '.self::CACHE_TABLE.' VALUES(\''.$key.'\',\''.sqlite_escape_string(serialize($value)).'\','.$expire.')';
return @$this->_db->query($sql)!==false;
}
diff --git a/framework/PradoBase.php b/framework/PradoBase.php
index 6e884cec..0722d0fd 100644
--- a/framework/PradoBase.php
+++ b/framework/PradoBase.php
@@ -191,30 +191,6 @@ class PradoBase
}
/**
- * Serializes a data.
- * The original PHP serialize function has a bug that may not serialize
- * properly an object.
- * @param mixed data to be serialized
- * @return string the serialized data
- */
- public static function serialize($data)
- {
- return serialize($data);
- }
-
- /**
- * Unserializes a data.
- * The original PHP unserialize function has a bug that may not unserialize
- * properly an object.
- * @param string data to be unserialized
- * @return mixed unserialized data, null if unserialize failed
- */
- public static function unserialize($str)
- {
- return unserialize($str);
- }
-
- /**
* Creates a component with the specified type.
* A component type can be either the component class name
* or a namespace referring to the path of the component class file.
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 7769a9e0..d7aac218 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -1071,10 +1071,10 @@ class TApplication extends TComponent
$config=new TApplicationConfiguration;
$config->loadFromFile($this->_configFile);
if($this->_cacheFile!==null)
- file_put_contents($this->_cacheFile,Prado::serialize($config),LOCK_EX);
+ file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
}
else
- $config=Prado::unserialize(file_get_contents($this->_cacheFile));
+ $config=unserialize(file_get_contents($this->_cacheFile));
$this->applyConfiguration($config,false);
}
@@ -1844,11 +1844,11 @@ class TApplicationStatePersister extends TModule implements IStatePersister
public function load()
{
if(($cache=$this->getApplication()->getCache())!==null && ($value=$cache->get(self::CACHE_NAME))!==false)
- return Prado::unserialize($value);
+ return unserialize($value);
else
{
if(($content=@file_get_contents($this->getStateFilePath()))!==false)
- return Prado::unserialize($content);
+ return unserialize($content);
else
return null;
}
@@ -1860,7 +1860,7 @@ class TApplicationStatePersister extends TModule implements IStatePersister
*/
public function save($state)
{
- $content=Prado::serialize($state);
+ $content=serialize($state);
$saveFile=true;
if(($cache=$this->getApplication()->getCache())!==null)
{
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 4e8652f4..394229da 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -1275,9 +1275,9 @@ class TPageStateFormatter
{
$sm=$page->getApplication()->getSecurityManager();
if($page->getEnableStateValidation())
- $str=$sm->hashData(Prado::serialize($data));
+ $str=$sm->hashData(serialize($data));
else
- $str=Prado::serialize($data);
+ $str=serialize($data);
if($page->getEnableStateCompression() && extension_loaded('zlib'))
$str=gzcompress($str);
if($page->getEnableStateEncryption())
@@ -1305,10 +1305,10 @@ class TPageStateFormatter
if($page->getEnableStateValidation())
{
if(($str=$sm->validateData($str))!==false)
- return Prado::unserialize($str);
+ return unserialize($str);
}
else
- return Prado::unserialize($str);
+ return unserialize($str);
}
return null;
}