Example #1
0
        $response->status = 500;
        $response->message = 'Unable to update a comment';
        $response->json($response);
    }
    //    $input['id'] = $db->inserId();
    //    $response->data = $input;
    $response->json($response);
} elseif ($route->match('commentdelete', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $model->commentDelete($api->getInputs());
    $response->json($response);
} elseif ($route->match('archivedelete', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $archive = $model->archiveFind($api->getInputs());
    if (!$archive) {
        $response->status = 404;
        $response->message = 'Not found';
        $response->json($response);
    }
    $model->archiveDelete(array('id' => $archive->id));
    if (is_file('archiv/' . $archive->image)) {
        unlink('archiv/' . $archive->image);
    }
    if (is_file('archiv/' . $archive->archiv)) {
        unlink('archiv/' . $archive->archiv);
    }
    $response->json($response);
} elseif ($route->match('skins', null)) {
    $where = $user->role > 1 ? array('user_id' => $user->id) : null;