diff --git a/item.php b/item.php index cd00f80..098a356 100644 --- a/item.php +++ b/item.php @@ -2,11 +2,13 @@ class Item implements JsonSerializable { - - // TODO: create a persist() method that updates the line if the offset where + // TODO: Create a persist() method that updates the line if the offset where // it originally existed in is given by 'ftell'. If it doesn't have an // ID, then try to find it in the file and if it doesn't exist, append // + // TODO: Mantain ":" between tags and subtags that can multiple subtags, use + // another character ("="?) to signal that it should be unique + // // TODO: Maybe implement tags as an associative array or somethign? // // TODO: Change to id here in all occurrences @@ -23,6 +25,7 @@ class Item implements JsonSerializable $db->map(function ($line) use (&$ret, $id) { if ($line[0] == $id) { $ret = Item::fromLine($line); + return true; } @@ -48,6 +51,9 @@ class Item implements JsonSerializable { $from_path = $php_file['tmp_name'] ?? null; + // TODO: If any step fails, nothing should be actually written to the + // media file or the image copied. Maybe revert the changes? + // --- CHECKS --- if (!is_string($from_path)) Json::error('Passed invalid upload structure')->die();