Example #1
0
    if (is_file('modules/' . $module->icon)) {
        unlink('modules/' . $module->icon);
    }
    if (is_file('modules/' . $module->file)) {
        unlink('modules/' . $module->file);
    }
    $response->json($response);
} elseif ($route->match('tokens', 1)) {
    // Prepare and sanitize post input
    $api->setInputs(array('module_id' => $route->getParam(0)));
    $response->data = $model->tokensAll(array('module_id' => $api->getInputVal('module_id')));
    $response->json($response);
} elseif ($route->match('tokencreate', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $model->tokenCreate($api->getInputs());
    $response->json($response);
} elseif ($route->match('tokendelete', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $model->tokenDelete($api->getInputs());
    $response->json($response);
} elseif ($route->match('commentnotnew', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    //    var_dump($api->getInputs());
    //    exit;
    if (!$model->commentUpdate(array('isnew' => 0), array('module_id' => $api->getInputVal('module_id')))) {
        $response->status = 500;
        $response->message = 'Unable to update a comment';
        $response->json($response);