Example #1
0
    $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;
    $response->data = $model->skinsAll($where);
    $response->json($response);
} elseif ($route->match('skin', 1)) {
    // Prepare and sanitize input
    $api->setInputs(array('id' => $route->getParam(0)));
    $where = $user->role > 1 ? array('id' => $api->getInputVal('id'), 'user_id' => $user->id) : array('id' => $api->getInputVal('id'));