Simplify the metadata sanitization and bugfix it
* SAAS-376 and CC-5868
This commit is contained in:
parent
2ae921e9d7
commit
17f1d0e96d
3 changed files with 17 additions and 32 deletions
|
@ -1,9 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sourcefabric
|
||||
* Date: 17/02/15
|
||||
*/
|
||||
|
||||
class FileDataHelper {
|
||||
|
||||
|
@ -12,9 +7,16 @@ class FileDataHelper {
|
|||
* at all costs, so check the data and sanitize it if necessary
|
||||
* @param array $data array containing new file metadata
|
||||
*/
|
||||
public static function sanitizeData(&$data) {
|
||||
// If the track number isn't numeric, this will return 0
|
||||
$data["track_number"] = intval($data["track_number"]);
|
||||
public static function sanitizeData(&$data)
|
||||
{
|
||||
if (array_key_exists("track_number", $data)) {
|
||||
// If the track number isn't numeric, this will return 0
|
||||
$data["track_number"] = intval($data["track_number"]);
|
||||
}
|
||||
if (array_key_exists("year", $data)) {
|
||||
// If the track number isn't numeric, this will return 0
|
||||
$data["year"] = intval($data["year"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue