Ejemplo n.º 1
0
    $where = $user->role > 1 ? array('m.id' => $api->getInputVal('id'), 'm.user_id' => $user->id) : array('m.id' => $api->getInputVal('id'));
    $module = $model->moduleFindJoin($where);
    if (!count($module)) {
        $response->status = 403;
        $response->message = 'Forbidden';
        $response->json($response);
    }
    $response->data = $module;
    $response->json($response);
} elseif ($route->match('moduleupload', null)) {
    require_once 'api/upload.php';
    die;
} elseif ($route->match('moduleverify', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    $api->moduleVerify();
    if ($api->getErrors()) {
        $response->status = 500;
        $response->message = 'Unable to send verification request';
        $response->data = $api->getErrors();
        $response->json($response);
    }
    $response->json($response);
} elseif ($route->match('moduleupdate', null)) {
    // Prepare and sanitize post input
    $api->setInputs($_POST, $model->getWhitelist('modules'));
    $where = $user->role > 1 ? array('id' => $api->getInputVal('id'), 'user_id' => $user->id) : array('id' => $api->getInputVal('id'));
    $module = $model->moduleFind($where);
    if (!$module) {
        $response->status = 403;
        $response->message = 'Forbidden';