Example #1
0
    $model->iconUpdate(array('icon' => $uploader->getUploadName(), 'updated_at' => date("Y-m-d H:i:s")), array('id' => $icon->id));
    $path = 'storage/icons/' . $api->getInputVal('current');
    if (is_file($path)) {
        unlink($path);
    }
    $response->data = array('icon' => $uploader->getUploadName());
    $response->json($response);
} elseif ($route->match('userread', null)) {
    // Prepare and sanitize post input
    $response->data = $model->userFind(array('id' => $user->id));
    $response->json($response);
} elseif ($route->match('userupdate', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $user_id = $user->role === 1 ? $api->getInputVal('id') : $user->id;
    $model->userUpdate($api->getInputs(), array('id' => $user_id));
    $response->json($response);
} elseif ($route->match('adminmodules', null)) {
    // Admin only
    if ($user->role !== 1) {
        $response->status = 403;
        $response->message = 'Forbidden';
        $response->json($response);
    }
    //$response->data = $model->modulesAllNotVerified();
    //$where = ($user->role > 1 ? array('user_id' => $user->id) : null);
    $response->data = $model->modulesAll(NULL);
    $response->json($response);
} elseif ($route->match('adminmoduleverify', null)) {
    // Admin only
    if ($user->role !== 1) {