Example #1
0
<?php

// profile.php -- Peteramati user profile page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// Distributed under an MIT-like license; see LICENSE
require_once "src/initweb.php";
ContactView::set_path_request(array("/u"));
if ($Me->is_empty()) {
    $Me->escape();
}
global $User, $Pset, $Info, $Commit;
$User = $Me;
if (isset($_REQUEST["u"]) && (!$Me->isPC || !($User = ContactView::prepare_user($_REQUEST["u"])))) {
    redirectSelf(array("u" => null));
}
assert($User == $Me || $Me->isPC);
assert($Me->privChair);
if (@$_POST["enable"] && check_post()) {
    UserActions::enable(array($User->contactId), $Me);
    redirectSelf();
}
if (@$_POST["disable"] && check_post()) {
    UserActions::disable(array($User->contactId), $Me);
    redirectSelf();
}
if (@$_POST["update"] && check_post()) {
    $ck = $cv = array();
    $roles = 0;
    if (@$_POST["pctype"] === "chair") {
        $roles |= Contact::ROLE_CHAIR | Contact::ROLE_PC;
    } else {
Example #2
0
<?php

// diff.php -- Peteramati diff page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// See LICENSE for open-source distribution terms
require_once "src/initweb.php";
ContactView::set_path_request(array("/@", "/@/p", "/@/p/h", "/@/p/h/h", "/p/h/h"));
if ($Me->is_empty()) {
    $Me->escape();
}
global $User, $Pset, $Info;
$User = $Me;
if (isset($_REQUEST["u"]) && !($User = ContactView::prepare_user($_REQUEST["u"]))) {
    redirectSelf(array("u" => null));
}
assert($User == $Me || $Me->isPC);
Ht::stash_script("peteramati_uservalue=" . json_encode($Me->user_linkpart($User)));
$Pset = ContactView::find_pset_redirect(@$_REQUEST["pset"]);
$Info = ContactView::user_pset_info($User, $Pset);
if (!get($_GET, "commit") || !get($_GET, "commit1") || $Pset->gitless) {
    $Me->escape();
}
$diff_options = ["wdiff" => false];
$hasha = $hashb = $hasha_mine = $hashb_mine = null;
$hrecent = $Pset->handout_commits();
if ($hasha = git_commit_in_list($hrecent, $_GET["commit"])) {
    $diff_options["hasha_hrepo"] = true;
} else {
    $hasha = $hasha_mine = $Info->set_commit($_GET["commit"]);
}
if ($hashb = git_commit_in_list($hrecent, $_GET["commit1"])) {
Example #3
0
<?php

// pset.php -- Peteramati problem set page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// See LICENSE for open-source distribution terms
require_once "src/initweb.php";
ContactView::set_path_request(array("/@", "/@/p", "/@/p/H", "/p", "/p/H", "/p/u", "/p/u/H"));
if ($Me->is_empty()) {
    $Me->escape();
}
global $User, $Pset, $Info, $Commit;
$User = $Me;
if (isset($_REQUEST["u"]) && !($User = ContactView::prepare_user($_REQUEST["u"]))) {
    redirectSelf(array("u" => null));
}
assert($User == $Me || $Me->isPC);
Ht::stash_script("peteramati_uservalue=" . json_encode($Me->user_linkpart($User)));
$Pset = ContactView::find_pset_redirect(req("pset"));
class Series
{
    public $n;
    public $sum;
    public $sumsq;
    public $series;
    public $cdf;
    private $calculated;
    public function __construct()
    {
        $this->n = $this->sum = $this->sumsq = 0;
        $this->byg = $this->series = array();
        $this->calculated = false;