Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
37
core/safecollection.php
Normal file
37
core/safecollection.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
require_once 'core/collection.php';
|
||||
require_once 'FirePHPCore/fb.php';
|
||||
|
||||
class SafeCollection extends Collection
|
||||
{
|
||||
protected function _clean()
|
||||
{
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$this->data = $this->_stripSlashes($this->data);
|
||||
}
|
||||
$this->data = $this->data;
|
||||
}
|
||||
|
||||
function import(array $data)
|
||||
{
|
||||
parent::import($data);
|
||||
$this->_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip slashes code from php.net website.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
protected function _stripSlashes($value)
|
||||
{
|
||||
if(is_array($value)) {
|
||||
return array_map(array($this,'_stripSlashes'), $value);
|
||||
} else {
|
||||
return stripslashes($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue