Example #1
0
        $response->json($response);
    }
    if (!$model->userDelete(array('id' => $api->getInputVal('id')))) {
        $response->status = 500;
        $response->message = 'DB error';
        $response->json($response);
    }
    $response->json($response);
} elseif ($route->match('api-modules', null)) {
    $tokens = '';
    $ids = '';
    if (count($_POST['token'])) {
        foreach ($_POST['token'] as $key => $value) {
            $tokens .= '\'' . $value . '\',';
        }
        $ids = $model->apiTokensModuleIds(rtrim($tokens, ','));
    }
    $response->data = $model->apiModulesAll(array('verified' => 1, 'active' => 1), $ids);
    $response->json($response);
} elseif ($route->match('api-modulesweb', null)) {
    $response->data = $model->modulesAll(array('verified' => 1, 'active' => 1));
    $response->json($response);
} elseif ($route->match('api-modulesidweb', 1)) {
    // Prepare and sanitize post input
    $api->setInputs(array('id' => $route->getParam(0)));
    $module = $model->moduleFindJoin(array('m.id' => $api->getInputVal('id')));
    if (!$module) {
        $response->status = 404;
        $response->message = 'Not found';
        $response->json($response);
    }