public static function unCleanData ($data, $force = false) { if ($force) { $magicquotes = true; } else { $magicquotes = (get_magic_quotes_gpc() == 1 ? true : false); } if (is_array($data)) { foreach ($data as $k => $v) { $data[$k] = janitor::unCleanData($v, $type); } } else { $data = ($magicquotes ? stripslashes($data) : $data); } return $data; }
public function process ($input) { $this->populate(janitor::unCleanData($input)); switch ($this->action) { case 'creating': $object = metaclass::create($this->type); break; case 'updating': $object = metaclass::load($this->type, $this->id); break; } foreach ($this->definitions as $k => $v) { $object->setProperty($k, $input[$k]); } if ($object->save()) { return true; } else { foreach ($object->invalid as $k => $v) { foreach ($v as $y => $z) { $obVars = metaclass::getClassVars($this->type); $this->invalid[] = text::get('validation/error_' . $y, array ( $obVars['propertyDefinitions'][$k]['title'] )); } } return false; } }