Skip to content

Commit

Permalink
[php:connector] Remove null & stripslashes applies on "magic_quotes_gpc"
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Jan 15, 2014
1 parent 046f351 commit 8005f9b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion php/elFinderConnector.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function run() {

$args['debug'] = isset($src['debug']) ? !!$src['debug'] : false;

$this->output($this->elFinder->exec($cmd, $args));
$this->output($this->elFinder->exec($cmd, $this->input_filter($args)));
}

/**
Expand Down Expand Up @@ -130,4 +130,24 @@ protected function output(array $data) {

}

/**
* Remove null & stripslashes applies on "magic_quotes_gpc"
*
* @param mixed $args
* @return mixed
* @author Naoki Sawada
*/
private function input_filter($args) {
static $magic_quotes_gpc = NULL;

if ($magic_quotes_gpc === NULL)
$magic_quotes_gpc = (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc());

if (is_array($args)) {
return array_map(array(& $this, 'input_filter'), $args);
}
$res = str_replace("\0", '', $args);
$magic_quotes_gpc && ($res = stripslashes($res));
return $res;
}
}// END class

0 comments on commit 8005f9b

Please sign in to comment.