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 $api->setInputs(array('name' => $route->getParam(0))); $dir = 'storage/icons/' . $api->getInputVal('name') . '/'; $files = Ut::getFilesIndDir($dir, array('jpg', 'jpeg', 'png', 'gif')); // Response $response->data = $files; $response->json($response); } elseif ($route->match('logout', null)) { unset($_SESSION['user']); Ut::redirectTo(Ut::uri('home'), array('You are logged out'), 'success'); } else { // var_dump(strpos($_SERVER["HTTP_ACCEPT"], 'json')); // die; Ut::redirectTo(Ut::uri('report'), array('404 page not found')); } require_once 'views/' . $view->layout . '.php';