} $input['id'] = $db->inserId(); } $response->data = $input; $response->json($response); } elseif ($route->match('iconupdate', null)) { // Prepare and sanitize post input $_POST['updated_at'] = date("Y-m-d H:i:s"); $api->setInputs($_POST, $model->getWhitelist('icons')); $skin = $model->iconFind(array('id' => $api->getInputVal('id'), 'user_id' => $user->id, 'name' => $api->getInputVal('name'))); if (!$skin) { $response->status = 404; $response->message = 'Not found'; $response->json($response); } $model->iconUpdate($api->getInputs(), array('id' => $api->getInputVal('id'))); $response->json($response); } elseif ($route->match('icondelete', null)) { // Prepare and sanitize post input $api->setInputs($_POST); $icon = $model->iconFind(array('id' => $api->getInputVal('id'), 'user_id' => $user->id)); if (!count($icon)) { $response->status = 404; $response->message = 'Not found'; $response->json($response); } if (!$model->iconDelete(array('id' => $api->getInputVal('id'), 'user_id' => $user->id))) { $response->status = 500; $response->message = 'Unable to delete the icon'; $response->json($response); }