$Commit = $Qreq->commit; } if (!$Info->set_commit($Commit)) { $Conf->ajaxExit(array("ok" => false, "error" => $Info->repo ? "No repository." : "Commit " . htmlspecialchars($Commit) . " isn’t connected to this repository.")); } return $Info; } ContactView::set_path_request(array("/@", "/@/p", "/@/p/h/f", "/@/p/f", "/p/h/f", "/p/f")); $Qreq = make_qreq(); // user, pset, runner $User = $Me; if (isset($Qreq->u) && !($User = ContactView::prepare_user($Qreq->u))) { exit; } assert($User == $Me || $Me->isPC); $Pset = ContactView::find_pset_redirect($Qreq->pset); $Psetid = $Pset->id; // repo $Info = user_pset_info(); $Repo = $Info->repo; $Commit = $Info->commit_hash(); $RecentCommits = $Info->recent_commits(); if (!$Repo || !$Commit || !$Info->can_view_repo_contents || !$Qreq->file) { exit; } // file $result = $Repo->gitrun("git cat-file blob {$Commit}:" . escapeshellarg($Qreq->file)); if ($result === null || $result === "") { $sizeresult = $Repo->gitrun("git cat-file -s {$Commit}:" . escapeshellarg($Qreq->file)); if (trim($sizeresult) !== "0") { exit;
// 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"])) { $diff_options["hashb_hrepo"] = true; } else {
// 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; } public function add($g)