Exemple #1
0
<?php

session_start();
require_once 'common.inc';
if (!$_SESSION['userid']) {
    redirect('login.php?error=1');
    exit;
}
try {
    transition_user_to_state($_SESSION['userid'], STATUS_SUBMITTED);
    $db = new DbConn();
    $db->exec('update users set submitdate = ? where id = ?', date_create(), $_SESSION['userid']);
    echo "OK";
} catch (Exception $e) {
    header('Content-Type: text/plain', true, 500);
    echo $e->getMessage();
}
Exemple #2
0
 function submit()
 {
     $user = $this->user->get_current_user();
     $this->user->verify_draft($user);
     transition_user_to_state($user->id, STATUS_SUBMITTED);
     $db = new DbConn();
     $db->exec('update users set submitdate = ? where id = ?', date_create(), $user->id);
     //redirect("apply/success");
     $this->success();
 }
Exemple #3
0
<?php

require_once './common.inc';
$id = (int) $_REQUEST['id'];
$action = $_REQUEST['action'];
if ($action == 'accept') {
    transition_user_to_state($id, STATUS_ACCEPTED);
} else {
    if ($action == 'reject') {
        transition_user_to_state($id, STATUS_REJECTED);
    } else {
        throw new RuntimeException('Unknown action, or no action provided');
    }
}
redirect('../');
Exemple #4
0
 function change_dates($userId)
 {
     $user = get_user($userId);
     if (!$user) {
         show_error('User not found', 404);
     }
     $arrival = $this->_to_date($this->input->post('arrivaldate'));
     $departure = $this->_to_date($this->input->post('departuredate'));
     $travelnotes = $this->input->post('travelnotes');
     $confirmed = $this->input->post('datesconfirmed');
     $db = new DbConn();
     $rows = $db->exec('update users set arrivaldate = ?, departuredate = ?, travelnotes = ? where id = ?', $arrival, $departure, $travelnotes, (int) $userId);
     $arrival_str = $arrival->format('Y-m-d');
     $departure_str = $arrival->format('Y-m-d');
     log_event(LOG_TRAVEL_INFO_UPDATE, $userId, substr("Arrive: {$arrival_str}\nDepart: {$departure_str}\nNotes: {$travelnotes}", 0, 255));
     if ($user->status == STATUS_ACCEPTED && $confirmed) {
         transition_user_to_state($userId, STATUS_CONFIRMED);
     }
     $this->session->set_flashdata('message', 'Changes saved successfully');
     redirect("admin/volunteers/show/{$userId}");
 }
Exemple #5
0
<?php

session_start();
require_once 'common.inc';
if (!$_SESSION['userid']) {
    redirect('login.php?error=1');
    exit;
}
try {
    transition_user_to_state($_SESSION['userid'], STATUS_DRAFT);
    merge_data($_SESSION['userid'], file_get_contents("php://input"));
    echo "OK";
} catch (Exception $e) {
    header('Content-Type: text/plain', true, 500);
    echo $e->getMessage();
}