예제 #1
0
파일: process.php 프로젝트: uhtoff/eCRF
<?php

require_once 'setup.php';
session_start();
if (isset($_POST['page']) && ctype_alnum($_POST['page'])) {
    // If someone tries to send something odd then return to index
    $page = $_POST['page'];
} else {
    $_SESSION['error'] = "An error has occurred, please try again.";
    header('Location:index.php');
    exit;
}
$trial = new eCRF($page);
if (isset($_SESSION['user'])) {
    $user = $_SESSION['user'];
    $loggedIn = $trial->addUser($user);
    if (!$loggedIn) {
        $_SESSION['error'] = "Log in expired due to inactivity";
        header("Location:index.php?expire=1");
        exit;
    }
}
if (!isset($_POST['csrfToken']) || !isset($_SESSION['csrfToken']) || $_POST['csrfToken'] != $_SESSION['csrfToken']) {
    $_SESSION['error'] = 'A token error has occurred, please try again.';
    if (isset($_SESSION['csrfToken'])) {
        unset($_SESSION['csrfToken']);
    }
    header("Location:index.php");
    exit;
}
if (isset($_SESSION['csrfToken'])) {
예제 #2
0
파일: index.php 프로젝트: uhtoff/eCRF
session_start();
unset($_SESSION['newTrialID']);
unset($_SESSION['returnTo']);
if (isset($_GET['expire'])) {
    $_SESSION['error'] = "Log in expired due to inactivity";
    unset($_SESSION['user']);
}
$allowed = array("_");
if (isset($_GET['page']) && ctype_alnum(str_replace($allowed, '', $_GET['page']))) {
    // If someone tries to send something odd then just go to default
    $page = $_GET['page'];
} else {
    $page = NULL;
}
$loggedIn = false;
$trial = new eCRF($page);
// Create trial object
if (isset($_SESSION['user']) && $_SESSION['user']) {
    // Add current user to trial object (if they exist)
    $user =& $_SESSION['user'];
    $loggedIn = $trial->addUser($user);
    // On adding user it checks to see if user has been expired and if not renews their last logon time
    if (!$loggedIn) {
        unset($_SESSION['user']);
        header("Location:index.php?expire=1");
        exit;
    }
    if (!isset($_GET['keepData']) && $trial->user->isLinked()) {
        $trial->addRecord();
        $complete = $trial->checkComplete('core');
        if (!$complete) {
예제 #3
0
파일: cli.php 프로젝트: uhtoff/eCRF
<?php

if (php_sapi_name() !== 'cli') {
    header('Location:index.php');
    exit;
}
require_once 'setup.php';
session_start();
if (isset($argv[1]) && ctype_alnum($argv[1])) {
    // If someone tries to send something odd then just go to default
    $page = $argv[1];
} else {
    $page = NULL;
}
$loggedIn = false;
$trial = new eCRF($page);
// Create trial object
$user = new eCRFUser(11);
$trial->addUser($user);
$_SESSION['user'] = $user;
if ($page) {
    $include = basename($page);
    // Should be unneccesary, but you never know!
    require "./includes/{$include}.php";
}
예제 #4
0
파일: adddata.php 프로젝트: uhtoff/eCRF
<?php

require_once 'setup.php';
session_start();
if (isset($_SESSION['user']) && isset($_POST['page'])) {
    $user = $_SESSION['user'];
    $page = $_POST['page'];
    $trial = new eCRF($page);
    $loggedIn = $trial->addUser($user);
    if (!$loggedIn) {
        $_SESSION['error'] = "Log in expired due to inactivity";
        header("Location:index.php?expire=1");
        exit;
    }
} else {
    $_SESSION['error'] = "Log in expired due to inactivity";
    header("Location:index.php?expire=1");
    exit;
}
if (!isset($_POST['csrfToken']) || !isset($_SESSION['csrfToken']) || $_POST['csrfToken'] != $_SESSION['csrfToken']) {
    $_SESSION['error'] = 'A token error has occurred, please try again.';
    if (isset($_SESSION['csrfToken'])) {
        unset($_SESSION['csrfToken']);
    }
    header("Location:index.php");
    exit;
}
if (isset($_SESSION['csrfToken'])) {
    unset($_SESSION['csrfToken']);
}
$link_id = $trial->addRecord();
예제 #5
0
파일: addcore.php 프로젝트: uhtoff/eCRF
<?php

require_once 'setup.php';
session_start();
$page = "core";
$trial = new eCRF($page);
if (isset($_SESSION['user'])) {
    $user = $_SESSION['user'];
    $loggedIn = $trial->addUser($user);
} else {
    $loggedIn = false;
}
if (!$loggedIn) {
    $_SESSION['error'] = "Log in expired due to inactivity";
    header("Location:index.php?expire=1");
    exit;
}
if (!isset($_POST['csrfToken']) || !isset($_SESSION['csrfToken']) || $_POST['csrfToken'] != $_SESSION['csrfToken']) {
    $_SESSION['error'] = 'A token error has occurred, please try again.';
    if (isset($_SESSION['csrfToken'])) {
        unset($_SESSION['csrfToken']);
    }
    header("Location:index.php");
    exit;
}
if (isset($_SESSION['csrfToken'])) {
    unset($_SESSION['csrfToken']);
}
$include = $trial->checkPageLogin($page);
if (!$include) {
    $_SESSION['error'] = "Unauthorised access attempted.";
예제 #6
0
 echo "<div class=\"container well\" style=\"background-color:#FFFFFF;\">";
 echo "<h3>Protocol deviations</h3>";
 if ($user->isCentralAdmin()) {
     echo "<h5>If you wish to remove a protocol deviation form then please select and click 'Delete' - the form will be stored for audit purposes.</h5>";
     echo "<form action=\"process.php\" method=\"POST\">";
 }
 echo '<table class="table table-striped table-bordered table-hover dataTable"><thead>';
 echo '<tr><th scope="col">Centre</th><th scope="col">' . Config::get('idName') . '</th><th scope="col">Deviation</th>';
 echo '<th scope="col">Description</th><th scope="col">Reported time</th><th scope="col">Reported by</th>';
 if ($user->isCentralAdmin()) {
     echo '<th>Select</th>';
 }
 echo '</tr></thead>';
 echo "<tbody>\n";
 foreach ($result->rows as $rowv) {
     $e = new eCRF('violation');
     $e->addRecord($rowv->link_id);
     foreach ($e->getViolations() as $v) {
         if ($v->isActive()) {
             echo "<tr class=\"clickable\"><td>{$rowv->centre_name}</td><td>{$rowv->trialid}</td>";
             $typearray = array('no' => 'Participant in the intervention group did NOT receive CPAP', 'low' => 'CPAP started at a dose other than 5cmH2O', 'stop' => 'CPAP administered for less than 4 hours or with significant interruption', 'wrong' => 'Participant in the usual care group DID receive CPAP');
             $output = '<td><ul>';
             foreach ($typearray as $type => $title) {
                 if ($v->{$type . 'cpap'}) {
                     $output .= "<li><b>{$title}</b></li>";
                     $output .= "<ul>";
                     foreach ($v->{$type . 'cpapreason'} as $reason) {
                         $sql = "SELECT option_text FROM {$type}cpapreason WHERE option_value = ?";
                         $pA = array('i', $reason);
                         $result = DB::query($sql, $pA);
                         $output .= "<li>{$result->option_text}</li>";
예제 #7
0
파일: dataentry.php 프로젝트: uhtoff/eCRF
        $pages[] = $row->name;
    }
}
// If valid input page is passed via GET use it, if not reset
if (isset($_GET['page']) && in_array($_GET['page'], $pages)) {
    $page = $_GET['page'];
} else {
    header('Location:index.php');
    exit;
}
if (isset($_SESSION['user'])) {
    /**
     * @var $user eCRFUser
     */
    $user = $_SESSION['user'];
    $trial = new eCRF($page);
    $loggedIn = $trial->addUser($user);
    if (!$loggedIn) {
        $_SESSION['error'] = "Log in expired due to inactivity";
        header("Location:index.php?expire=1");
        exit;
    }
} else {
    $_SESSION['error'] = "Log in expired due to inactivity";
    header("Location:index.php?expire=1");
    exit;
}
$link_id = $trial->addRecord();
$include = $trial->checkPageLogin($page);
// Generate correct include file, assuming user has correct privilege
if (!$link_id || !isset($include) || $include != $page) {
예제 #8
0
파일: adddisc.php 프로젝트: uhtoff/eCRF
<?php

require_once 'setup.php';
session_start();
if (isset($_SESSION['user']) && isset($_POST['page'])) {
    $user = $_SESSION['user'];
    $page = $_POST['page'];
    $trial = new eCRF($page);
    $loggedIn = $trial->addUser($user);
    if (!$loggedIn) {
        $_SESSION['error'] = "Log in expired due to inactivity";
        header("Location:index.php?expire=1");
        exit;
    }
} else {
    $_SESSION['error'] = "Log in expired due to inactivity";
    header("Location:index.php?expire=1");
    exit;
}
$link_id = $trial->addRecord();
if (!$link_id) {
    $_SESSION['error'] = "No record linked to this user.";
    header('Location:index.php');
    exit;
} elseif (!isset($_POST['link_id']) || $link_id != $_POST['link_id']) {
    $_SESSION['error'] = "An error has occurred, please reselect the patient you wish to discontinue.";
    header('Location:index.php');
    exit;
}
$include = $trial->checkPageLogin($page);
if (!$include) {
예제 #9
0
파일: processAjax.php 프로젝트: uhtoff/eCRF
         $sql .= implode(' AND ', $whereArr);
         $numParam = count($params);
         $paramType = str_pad('', $numParam, 'i');
         array_unshift($params, $paramType);
         $result = DB::query($sql, $params);
     } else {
         $result = DB::query($sql);
     }
     $emailArr = array();
     if ($result->getRows()) {
         $emailArr = $result->getArray('email');
     }
     echo json_encode($emailArr);
     exit;
 }
 $trial = new eCRF($page);
 if (isset($_SESSION['user'])) {
     $user = $_SESSION['user'];
     $loggedIn = $trial->addUser($user);
     if (!$loggedIn) {
         throw new Exception("Your session has timed out, please log in again.", 1);
     }
 } else {
     throw new Exception("Your session has timed out, please log in again.", 1);
 }
 if (!$trial->addRecord()) {
     // Bind a record to the trial, if it fails then throw exception
     throw new Exception("No record is linked with this user, please try selecting a different record.");
 }
 if ($trial->user->isLocal()) {
     if ($trial->record->getCentre() != $trial->user->getCentre()) {