Exemplo n.º 1
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if (!$qbc->isUser()) {
    header("Location: login.php");
    exit;
}
$qid = $qbc->getLastQuestion();
if (!empty($_GET['qid']) && is_numeric($_GET['qid'])) {
    $qid = $_GET['qid'];
}
// Save last qid accessed for user
$qbc->updateLastQuestion($qid);
$question = $qbc->getQuestion($qid);
$answer = $qbc->getAnswer($qid);
$corefs = $qbc->getCorefsAsJSON($qid, $_SESSION['username']);
$show_accuracy = $qbc->isQuestionGoldStandard($qid);
$total_corefs = 0;
if ($show_accuracy) {
    $total_corefs = $qbc->getCountGoldStandardCorefs($qid);
}
$prevqid = $qbc->getPrevQuestion($qid);
$nextqid = $qbc->getNextQuestion($qid);
// Redirect if first login
if ($qbc->first_login == true) {
    header("Location: tutorial.php?first=1");
    exit;
}
// Check for old version of IE
if ($qbc->isUsingOldIEBrowser()) {
Exemplo n.º 2
0
<?php

require_once '../includes/QBCoref.class.php';
$qbc = new QBCoref();
$count = 0;
if ($_GET['load'] == "questions") {
    $count = $qbc->loadQuestions();
} else {
    if ($_GET['load'] == "answers") {
        $count = $qbc->loadAnswers();
    }
}
print "Done inserting " . $count . " rows";
Exemplo n.º 3
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
$qbc->logout();
// initialize variables
$username = "";
$firstname = "";
$lastname = "";
$email = "";
if (!empty($_POST['action']) && $_POST['action'] == "register") {
    $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
    $firstname = filter_input(INPUT_POST, 'first-name', FILTER_SANITIZE_STRING);
    $lastname = filter_input(INPUT_POST, 'last-name', FILTER_SANITIZE_STRING);
    $email = $_POST['email'];
    $errors = array();
    if (empty($username)) {
        $errors[] = "Please include a username.";
    } else {
        if ($username != $_POST['username']) {
            $errors[] = "Invalid characters, please pick another username.";
        } else {
            if (!$qbc->isUsernameUnique($username)) {
                $errors[] = "Duplicate username detected, please try another username.";
            }
        }
    }
    if (empty($_POST['password'])) {
        $errors[] = "Password can not be empty.";
    } else {
        if ($_POST['password'] != $_POST['password-confirm']) {
Exemplo n.º 4
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if (!$qbc->isUser()) {
    header("Location: login.php");
}
if (!empty($_POST['action'])) {
    $errors = array();
    if ($_POST['action'] == "change-password") {
        if (!$qbc->verifyPassword($_POST['current-password'])) {
            $errors[] = "Current password doesn't match.";
        } else {
            if (empty($_POST['password'])) {
                $errors[] = "Password can not be empty.";
            } else {
                if ($_POST['password'] != $_POST['password-confirm']) {
                    $errors[] = "Passwords do not match.";
                }
            }
        }
        if (empty($errors)) {
            $qbc->updatePassword($_POST['password']);
            header("Location: myaccount.php?success=1");
        }
    }
}
?>
<!doctype html>
<html lang="us">
<head>
Exemplo n.º 5
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
$success = 0;
$error = 0;
// initialize variables
$fromName = "";
$fromEmail = "";
$message = "";
if (!empty($_POST['action']) && $_POST['action'] == "contactus") {
    if (!empty($_POST['mail'])) {
        $error = 1;
    } else {
        $fromName = filter_input(INPUT_POST, 'InputName', FILTER_SANITIZE_STRING);
        $fromEmail = filter_input(INPUT_POST, 'InputEmail', FILTER_SANITIZE_STRING);
        $message = filter_input(INPUT_POST, 'InputMessage', FILTER_SANITIZE_STRING);
        if (empty($fromName) || empty($fromEmail) || empty($message)) {
            $error = 1;
        } else {
            $result = $qbc->sendEmail($fromName, $fromEmail, $message);
            if ($result) {
                $success = 1;
                $fromName = "";
                $fromEmail = "";
                $message = "";
            } else {
                $error = 1;
            }
        }
    }
Exemplo n.º 6
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
$qbc->logout();
if (!empty($_POST['username']) && !empty($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $result = $qbc->login($username, $password);
    if ($result) {
        header("Location: index.php");
    } else {
        $error = "<strong>Invalid login</strong>. Please try again.";
    }
}
?>
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<title>Coreference Tool - Login</title>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
<link href="css/coref.css" rel="stylesheet">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.min.js"></script>
<style type="text/css">
body {
	padding-top: 60px;
	padding-bottom: 40px;
}
Exemplo n.º 7
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if (!$qbc->isUser()) {
    header("Location: login.php");
}
?>
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<title>Coreference Tool - Unsupported Browser</title>
<link href="css/smoothness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
<link href="css/coref.css" rel="stylesheet">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-ui-1.10.4.custom.js"></script>
</head>
<body>
	<?php 
$active_page = 'unsupported';
require_once 'views/topnav.php';
?>

	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>Unsupported Browser</h2>
Exemplo n.º 8
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if (!$qbc->isAdmin()) {
    die("You don't have access to this page.");
}
function array2csv($array)
{
    if (count($array) == 0) {
        return null;
    }
    ob_start();
    $df = fopen("php://output", 'w');
    $headers = array();
    $headers[] = 'cid';
    $headers[] = 'qid';
    $headers[] = 'pos_start';
    $headers[] = 'pos_end';
    $headers[] = 'description';
    $headers[] = 'coref_group';
    $headers[] = 'author';
    $headers[] = 'date_added';
    fputcsv($df, $headers);
    foreach ($array as $row) {
        fputcsv($df, $row);
    }
    fclose($df);
    return ob_get_clean();
}
function download_send_headers($filename)
Exemplo n.º 9
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if (!$qbc->isUser()) {
    header("Location: login.php");
}
$limit = 10;
$leaderboard = $qbc->getLeaderboard($limit);
?>
<!doctype html>
<html lang="us">
<head>
	<meta charset="utf-8">
	<title>Coreference Tool - Leaderboard</title>
	<link href="css/smoothness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
	<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
	<link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
	<link href="css/coref.css" rel="stylesheet">
	<script src="js/jquery-1.10.2.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/jquery-ui-1.10.4.custom.js"></script>
</head>
<body>
	<?php 
$active_page = 'leaderboard';
require_once 'views/topnav.php';
?>

    <div class="container">
    	<div class="row">
Exemplo n.º 10
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
if ($_GET['action'] == 'save') {
    $qid = $_POST['qid'];
    $author = $_POST['author'];
    $qbc->deleteCoreferences($qid, $author);
    foreach ($_POST as $key => $coref) {
        if (is_numeric($key)) {
            $pos_start = $coref['pos']['start'];
            $pos_end = $coref['pos']['end'];
            $description = addslashes($coref['description']);
            $coref_group = $coref['type'];
            $qbc->saveCoref($qid, $author, $pos_start, $pos_end, $description, $coref_group);
        }
    }
    print $qbc->getPoints();
} else {
    if ($_GET['action'] == 'accuracy') {
        $qid = $_POST['qid'];
        $pos_start = $_POST['pos']['start'];
        $pos_end = $_POST['pos']['end'];
        $description = addslashes($_POST['description']);
        $accuracy = $qbc->getAccuracy($qid, $description, $pos_start, $pos_end);
        if ($accuracy) {
            print "<span class=\"glyphicon glyphicon-ok\"></span> Correct";
        } else {
            print "<span class=\"glyphicon glyphicon-remove\"></span> No match for this tag was found.";
        }
    }