automatically trim() all parameters given
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -106,6 +106,10 @@ abstract class ApiCommand
|
||||
$this->version = $version;
|
||||
$this->dbversion = $dbversion;
|
||||
$this->branding = $branding;
|
||||
|
||||
if (! is_null($params)) {
|
||||
$params = $this->trimArray($params);
|
||||
}
|
||||
$this->cmd_params = $params;
|
||||
if (! empty($header)) {
|
||||
$this->readUserData($header);
|
||||
@@ -463,4 +467,15 @@ abstract class ApiCommand
|
||||
}
|
||||
throw new Exception("Invalid API credentials", 400);
|
||||
}
|
||||
|
||||
private function trimArray($input)
|
||||
{
|
||||
if (! is_array($input)) {
|
||||
return trim($input);
|
||||
}
|
||||
return array_map(array(
|
||||
$this,
|
||||
'trimArray'
|
||||
), $input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user