Example #1
0
    } else {
        render('err404', null, false);
    }
});
// App View
// --------------------------------------------------------------------------------
get('/app/:app_id', function ($app_id) {
    $app = app_get($app_id);
    if (isset($app)) {
        render('app', array('head_title' => 'Viewing app', 'app' => $app, 'applicant' => account_data($app->applicant), 'my_vote' => app_my_vote($app), 'is_self' => user_email() == $app->applicant));
    } else {
        render('err404', null, false);
    }
});
post('/app/:app_id', function ($app_id) {
    $app = app_get($app_id);
    $is_self = user_email() == $app->applicant;
    if (!is_reviewer() && $is_self && from($_REQUEST, 'action') == 'label' && from($_REQUEST, 'label') == 'Deleted') {
        app_change_label($app, 'Deleted', true);
        redirect();
        return;
    }
    if (!isset($app) || !is_reviewer()) {
        render('err403', null, false);
        return;
    }
    $action = from($_REQUEST, 'action');
    switch (strtolower($action)) {
        // ADD/CHANGE VOTE
        // Add or change your vote
        case 'vote':
 function elastica()
 {
     return app_get('elastica');
 }