Example #1
0
    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'));
    $skin = $model->skinFind($where);
    if (!count($skin)) {
        $response->status = 404;
        $response->message = 'Not found';
        $response->json($response);
    }
    $response->data = $skin;
    $response->json($response);
} elseif ($route->match('skincreate', null)) {
    $name = Ut::toSlug(strtok($_FILES['file']['name'], '.'));