$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); } $path = 'storage/icons/'; if (is_file($path . $icon->file)) { unlink($path . $icon->file); } if (is_file($path . $icon->icon)) { unlink($path . $icon->icon); } Ut::cleanDirectory($path . $icon->name); $response->json($response); } elseif ($route->match('iconupload', 1)) { $api->setInputs(array('name' => $route->getParam(0)));