} elseif ($route->match('api-comments', 1)) { // Prepare and sanitize post input $api->setInputs(array('module_id' => $route->getParam(0))); $response->data = $model->commentsAll($api->getInputs()); $response->json($response); } elseif ($route->match('api-rating-create', null)) { // Prepare and sanitize post input $api->setInputs($_POST); // Already rated $rating = $model->ratingFind(array('module_id' => $api->getInputVal('module_id'), 'remote_id' => $api->getInputVal('remote_id'))); if ($rating) { $response->status = 409; $response->message = 'Already rated'; $response->json($response); } if ((int) $api->getInputVal('score') > 5 || !$model->ratingCreate($api->getInputs())) { $response->status = 500; $response->message = 'Unable to rate the module'; $response->json($response); } $input['id'] = $db->inserId(); $response->data = $input; $response->json($response); } elseif ($route->match('api-skins', null)) { $response->data = $model->skinsAll(array('active' => 1)); $response->json($response); } elseif ($route->match('api-icons', null)) { $response->data = $model->iconsAll(array('active' => 1)); $response->json($response); } elseif ($route->match('api-iconpreview', 1)) { // Prepare and sanitize input