예제 #1
0
 function caclStripslashes(&$value)
 {
     $ret = '';
     if (is_string($value)) {
         $ret = stripslashes($value);
     } else {
         if (is_array($value)) {
             $ret = array();
             foreach ($value as $key => $val) {
                 $ret[$key] = caclStripslashes($val);
             }
         } else {
             $ret = $value;
         }
     }
     return $ret;
 }
 function bind($array, $ignore = '')
 {
     if (!is_array($array)) {
         $this->_error = strtolower(get_class($this)) . '::bind failed.';
         return false;
     } else {
         $prefix = NULL;
         $checkSlashes = true;
         if (!is_array($array) || !is_object($this)) {
             return false;
         }
         foreach (get_object_vars($this) as $k => $v) {
             if (substr($k, 0, 1) != '_') {
                 // internal attributes of an object are ignored
                 if (strpos($ignore, $k) === false) {
                     if ($prefix) {
                         $ak = $prefix . $k;
                     } else {
                         $ak = $k;
                     }
                     if (isset($array[$ak])) {
                         $this->{$k} = $checkSlashes && get_magic_quotes_gpc() ? caclStripslashes($array[$ak]) : $array[$ak];
                     }
                 }
             }
         }
         return true;
     }
 }