Skip to content

Commit

Permalink
Fix budget info sanitisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Cobby committed Oct 10, 2012
1 parent d5fb641 commit e55ccc9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/DGM/Service/BudgetPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,23 @@ public function sanitize()
{
foreach ($this->data as $key => $value) {
if ($key == "name" || $key == "email" || $key == "description") {
$this->data[$key] = trim($value);
$this->data[$key] = strip_tags($value);
$value = trim($value);
$value = strip_tags($value);
}

if ($key == "name" || $key == "email") {
$value = substr($value, 0, 50);
}

if ($key == "description") {
$value = substr($value, 0, 500);
}

if (isset(Budget::$categoryData[$key])) {
$this->data[$key] = (float) $value;
$value = (float) $value;
}

$this->data[$key] = $value;
}
}

Expand Down

0 comments on commit e55ccc9

Please sign in to comment.