private function _footer($ncol, $extra)
 {
     global $Conf;
     if ($this->count == 0) {
         return "";
     }
     $revpref = $this->table_type == "editReviewPreference";
     $lllgroups = SearchAction::list_all_actions($this->contact, $this->qreq, $this);
     // Upload preferences (review preferences only)
     if ($revpref) {
         $lllgroups[] = [100, "uploadpref", "Upload", "<b>&nbsp;preference file:</b> &nbsp;" . "<input class=\"wantcrpfocus\" type='file' name='uploadedFile' accept='text/plain' size='20' tabindex='6' onfocus='autosub(\"uploadpref\",this)' />&nbsp; " . Ht::submit("fn", "Go", ["value" => "uploadpref", "tabindex" => 6, "onclick" => "return plist_submit.call(this)", "data-plist-submit-all" => 1])];
     }
     // Set preferences (review preferences only)
     if ($revpref) {
         $lllgroups[] = [200, "setpref", "Set preferences", "<b>:</b> &nbsp;" . Ht::entry("pref", "", array("class" => "wantcrpfocus", "size" => 4, "tabindex" => 6, "onfocus" => 'autosub("setpref",this)')) . " &nbsp;" . Ht::submit("fn", "Go", ["value" => "setpref", "tabindex" => 6, "onclick" => "return plist_submit.call(this)"])];
     }
     usort($lllgroups, function ($a, $b) {
         return $a[0] - $b[0];
     });
     $whichlll = 1;
     foreach ($lllgroups as $i => $lllg) {
         if ($this->qreq->fn == $lllg[1] || $this->atab == $lllg[1]) {
             $whichlll = $i + 1;
         }
     }
     // Linelinks container
     $foot = "  <tr class=\"pl_footrow\">";
     if (!$this->viewmap->columns) {
         $foot .= '<td class="pl_footselector">' . Ht::img("_.gif", "^^", "placthook") . "</td>";
         --$ncol;
     }
     $foot .= '<td id="plact" class="pl_footer linelinks' . $whichlll . '" colspan="' . $ncol . '">';
     $foot .= "<table><tbody><tr>\n" . '    <td class="pl_footer_desc"><b>Select papers</b> (or <a href="' . selfHref(["selectall" => 1]) . '#plact" onclick="return papersel(true)">select all ' . $this->count . "</a>), then&nbsp;</td>\n" . "   </tr></tbody></table>";
     foreach ($lllgroups as $i => $lllg) {
         $x = $i + 1;
         $foot .= "<table><tbody><tr>\n" . "    <td class=\"pl_footer_desc lll{$x}\"><a href=\"" . selfHref(["atab" => $lllg[1]]) . "#plact\" onclick=\"return crpfocus('plact',this)\">" . $lllg[2] . "</a></td>\n";
         for ($j = 3; $j < count($lllg); ++$j) {
             $cell = is_array($lllg[$j]) ? $lllg[$j] : ["content" => $lllg[$j]];
             $class = isset($cell["class"]) ? "lld{$x} " . $cell["class"] : "lld{$x}";
             $foot .= "    <td class=\"{$class}\"";
             if (isset($cell["id"])) {
                 $foot .= " id=\"" . $cell["id"] . "\"";
             }
             $foot .= ">" . $cell["content"] . "</td>\n";
         }
         if ($i < count($lllgroups) - 1) {
             $foot .= "    <td>&nbsp;<span class='barsep'>·</span>&nbsp;</td>\n";
         }
         $foot .= "   </tr></tbody></table>";
     }
     $foot .= $extra . "<hr class=\"c\" /></td>\n  </tr>\n";
     return $foot;
 }
function whyNotText($whyNot, $action)
{
    global $Conf, $Now;
    if (!is_array($whyNot)) {
        $whyNot = array($whyNot => 1);
    }
    $paperId = isset($whyNot['paperId']) ? $whyNot['paperId'] : -1;
    $reviewId = isset($whyNot['reviewId']) ? $whyNot['reviewId'] : -1;
    $thisPaper = $paperId < 0 ? "this paper" : "paper #{$paperId}";
    $text = '';
    if (isset($whyNot['invalidId'])) {
        $x = $whyNot['invalidId'] . "Id";
        $xid = isset($whyNot[$x]) ? " \"" . $whyNot[$x] . "\"" : "";
        $text .= "Invalid " . $whyNot['invalidId'] . " number" . htmlspecialchars($xid) . ". ";
    }
    if (isset($whyNot['noPaper'])) {
        $text .= "No such paper" . ($paperId < 0 ? "" : " #{$paperId}") . ". ";
    }
    if (isset($whyNot['noReview'])) {
        $text .= "No such review" . ($reviewId < 0 ? "" : " #{$reviewId}") . ". ";
    }
    if (isset($whyNot["dbError"])) {
        $text .= $whyNot["dbError"] . " ";
    }
    if (isset($whyNot["permission"])) {
        $text .= "You don’t have permission to {$action} {$thisPaper}. ";
    }
    if (isset($whyNot["signin"])) {
        $text .= "You must sign in to {$action} {$thisPaper}. ";
    }
    if (isset($whyNot["withdrawn"])) {
        $text .= ucfirst($thisPaper) . " has been withdrawn. ";
    }
    if (isset($whyNot['notWithdrawn'])) {
        $text .= ucfirst($thisPaper) . " has not been withdrawn. ";
    }
    if (isset($whyNot['notSubmitted'])) {
        $text .= ucfirst($thisPaper) . " is not submitted. ";
    }
    if (isset($whyNot["rejected"])) {
        $text .= ucfirst($thisPaper) . " was not accepted for publication. ";
    }
    if (isset($whyNot["decided"])) {
        $text .= "The review process for {$thisPaper} has completed. ";
    }
    if (isset($whyNot['updateSubmitted'])) {
        $text .= ucfirst($thisPaper) . " has already been submitted and can no longer be updated. ";
    }
    if (isset($whyNot['notUploaded'])) {
        $text .= ucfirst($thisPaper) . " can’t be submitted because you haven’t yet uploaded the paper itself. Upload the paper and try again. ";
    }
    if (isset($whyNot['reviewNotSubmitted'])) {
        $text .= "This review is not yet ready for others to see. ";
    }
    if (isset($whyNot['reviewNotComplete'])) {
        $text .= "Your own review for {$thisPaper} is not complete, so you can’t view other people’s reviews. ";
    }
    if (isset($whyNot['responseNotReady'])) {
        $text .= "The authors’ response for {$thisPaper} is not yet ready for reviewers to view. ";
    }
    if (isset($whyNot['reviewsOutstanding'])) {
        $text .= "You will get access to the reviews once you complete <a href=\"" . hoturl("search", "q=&amp;t=r") . "\">your assigned reviews for other papers</a>.  If you can’t complete your reviews, please let the conference organizers know via the “Refuse review” links. ";
    }
    if (isset($whyNot['reviewNotAssigned'])) {
        $text .= "You are not assigned to review {$thisPaper}. ";
    }
    if (isset($whyNot['deadline'])) {
        $dname = $whyNot['deadline'];
        if ($dname[0] == "s") {
            $start = $Conf->setting("sub_open", -1);
        } else {
            if ($dname[0] == "p" || $dname[0] == "e") {
                $start = $Conf->setting("rev_open", -1);
            } else {
                $start = 1;
            }
        }
        $end = $Conf->setting($dname, -1);
        if ($start <= 0 || $start == $end) {
            $text .= "You can’t {$action} {$thisPaper} yet. ";
        } else {
            if ($start > 0 && $Now < $start) {
                $text .= "You can’t {$action} {$thisPaper} until " . $Conf->printableTime($start, "span") . ". ";
            } else {
                if ($end > 0 && $Now > $end) {
                    if ($dname == "sub_reg") {
                        $text .= "The paper registration deadline has passed. ";
                    } else {
                        if ($dname == "sub_update") {
                            $text .= "The deadline to update papers has passed. ";
                        } else {
                            if ($dname == "sub_sub") {
                                $text .= "The paper submission deadline has passed. ";
                            } else {
                                if ($dname == "extrev_hard") {
                                    $text .= "The external review deadline has passed. ";
                                } else {
                                    if ($dname == "pcrev_hard") {
                                        $text .= "The PC review deadline has passed. ";
                                    } else {
                                        if ($dname == "final_done") {
                                            $text .= "The deadline to update final versions has passed. ";
                                        } else {
                                            $text .= "The deadline to {$action} {$thisPaper} has passed. ";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $text .= "It was " . $Conf->printableTime($end, "span") . ". ";
                } else {
                    if ($dname == "au_seerev") {
                        if ($Conf->au_seerev == Conf::AUSEEREV_UNLESSINCOMPLETE) {
                            $text .= "Authors who are also reviewers can’t see reviews for their papers while they still have <a href='" . hoturl("search", "t=rout&amp;q=") . "'>incomplete reviews</a> of their own. ";
                        } else {
                            $text .= "Authors can’t view paper reviews at the moment. ";
                        }
                    } else {
                        $text .= "You can’t {$action} {$thisPaper} at the moment. ";
                    }
                }
            }
        }
        $text .= "(<a class='nw' href='" . hoturl("deadlines") . "'>View deadlines</a>) ";
    }
    if (isset($whyNot["override"])) {
        $text .= "“Override deadlines” can override this restriction. ";
    }
    if (isset($whyNot['blindSubmission'])) {
        $text .= "Submission to this conference is blind. ";
    }
    if (isset($whyNot['author'])) {
        $text .= "You aren’t a contact for {$thisPaper}. ";
    }
    if (isset($whyNot['conflict'])) {
        $text .= "You have a conflict with {$thisPaper}. ";
    }
    if (isset($whyNot['externalReviewer'])) {
        $text .= "External reviewers may not view other reviews for the papers they review. ";
    }
    if (isset($whyNot['differentReviewer'])) {
        $text .= "You didn’t write this review, so you can’t change it. ";
    }
    if (isset($whyNot['reviewToken'])) {
        $text .= "If you know a valid review token, enter it above to edit that review. ";
    }
    if (isset($whyNot["clickthrough"])) {
        $text .= "You can’t do that until you agree to the current terms. ";
    }
    if (isset($whyNot["otherTwiddleTag"])) {
        $text .= "Tag “#" . htmlspecialchars($whyNot["tag"]) . "” doesn’t belong to you. ";
    }
    if (isset($whyNot["chairTag"])) {
        $text .= "Tag “#" . htmlspecialchars($whyNot["tag"]) . "” can only be set by administrators. ";
    }
    if (isset($whyNot["voteTag"])) {
        $text .= "The voting tag “#" . htmlspecialchars($whyNot["tag"]) . "” shouldn’t be changed directly. To vote for this paper, change the “#~" . htmlspecialchars($whyNot["tag"]) . "” tag. ";
    }
    if (isset($whyNot["voteTagNegative"])) {
        $text .= "Negative votes aren’t allowed. ";
    }
    // finish it off
    if (isset($whyNot["chairMode"])) {
        $text .= "(<a class='nw' href=\"" . selfHref(array("forceShow" => 1)) . "\">" . ucfirst($action) . " the paper anyway</a>) ";
    }
    if (isset($whyNot["forceShow"]) && $whyNot["forceShow"] === true) {
        $text .= "(As an administrator, you can override your conflict.) ";
    } else {
        if (isset($whyNot["forceShow"])) {
            $text .= "(<a class='nw' href=\"" . selfHref(array("forceShow" => 1)) . "\">Override conflict</a>) ";
        }
    }
    if ($text && $action == "view") {
        $text .= "Enter a paper number above, or <a href='" . hoturl("search", "q=") . "'>list the papers you can view</a>. ";
    }
    return rtrim($text);
}
 function escape()
 {
     global $Conf;
     if (get($_REQUEST, "ajax")) {
         if ($this->is_empty()) {
             $Conf->ajaxExit(array("ok" => 0, "loggedout" => 1));
         } else {
             $Conf->ajaxExit(array("ok" => 0, "error" => "You don’t have permission to access that page."));
         }
     }
     if ($this->is_empty()) {
         // Preserve post values across session expiration.
         $x = array();
         if (Navigation::path()) {
             $x["__PATH__"] = preg_replace(",^/+,", "", Navigation::path());
         }
         if (get($_REQUEST, "anchor")) {
             $x["anchor"] = $_REQUEST["anchor"];
         }
         $url = selfHref($x, array("raw" => true, "site_relative" => true));
         $_SESSION["login_bounce"] = array($Conf->dsn, $url, Navigation::page(), $_POST);
         if (check_post()) {
             error_go(false, "You’ve been logged out due to inactivity, so your changes have not been saved. After logging in, you may submit them again.");
         } else {
             error_go(false, "You must sign in to access that page.");
         }
     } else {
         error_go(false, "You don’t have permission to access that page.");
     }
 }
Example #4
0
foreach (array("emailNote", "reason") as $x) {
    if (isset($_REQUEST[$x]) && $_REQUEST[$x] == "Optional explanation") {
        unset($_REQUEST[$x], $_GET[$x], $_POST[$x]);
    }
}
if (!isset($_REQUEST["p"]) && !isset($_REQUEST["paperId"]) && preg_match(',\\A(?:new|\\d+)\\z,i', Navigation::path_component(0))) {
    $_REQUEST["p"] = $_GET["p"] = Navigation::path_component(0);
    if (!isset($_REQUEST["m"]) && ($x = Navigation::path_component(1))) {
        $_REQUEST["m"] = $_GET["m"] = $x;
    }
    if (isset($_REQUEST["m"]) && $_REQUEST["m"] === "api" && !isset($_REQUEST["fn"]) && ($x = Navigation::path_component(2))) {
        $_REQUEST["fn"] = $_GET["fn"] = $x;
    }
} else {
    if (!Navigation::path() && isset($_REQUEST["p"]) && $_REQUEST["p"] && ctype_digit($_REQUEST["p"]) && !check_post()) {
        go(selfHref());
    }
}
// header
function confHeader()
{
    global $paperTable;
    $mode = $paperTable ? $paperTable->mode : "p";
    PaperTable::do_header($paperTable, "paper_" . ($mode == "edit" ? "edit" : "view"), $mode);
}
function errorMsgExit($msg)
{
    global $Conf;
    if (@$_REQUEST["ajax"]) {
        Conf::msg_error($msg);
        $Conf->ajaxExit(array("ok" => false));
function reviewLinks($prow, $rrows, $crows, $rrow, $mode, &$allreviewslink)
{
    global $Conf, $Me;
    $conflictType = $Me->view_conflict_type($prow);
    $allow_admin = $Me->allow_administer($prow);
    $any_comments = false;
    $admin = $Me->can_administer($prow);
    $xsep = ' <span class="barsep">·</span> ';
    $nvisible = 0;
    $myrr = null;
    if ($rrows) {
        foreach ($rrows as $rr) {
            if ($Me->can_view_review($prow, $rr, null)) {
                $nvisible++;
            }
            if ($rr->contactId == $Me->contactId || !$myrr && $Me->is_my_review($rr)) {
                $myrr = $rr;
            }
        }
    }
    // comments
    $pret = "";
    if ($crows && count($crows) > 0 && !$rrow && $mode !== "edit") {
        $cids = array();
        $cnames = array();
        $tagger = new Tagger($Me);
        foreach ($crows as $cr) {
            if ($Me->can_view_comment($prow, $cr, null)) {
                if ($Me->can_view_comment_identity($prow, $cr, null)) {
                    $n = Text::abbrevname_html($cr->user());
                } else {
                    $n = "anonymous";
                }
                if ($cr->commentType & COMMENTTYPE_RESPONSE) {
                    $rname = $Conf->resp_round_name($cr->commentRound);
                    $n = $n === "anonymous" ? "" : " ({$n})";
                    if ($cr->commentType & COMMENTTYPE_DRAFT && $rname != "1") {
                        $n = "<i>Draft {$rname} Response</i>{$n}";
                    } else {
                        if ($cr->commentType & COMMENTTYPE_DRAFT) {
                            $n = "<i>Draft Response</i>{$n}";
                        } else {
                            if ($rname != "1") {
                                $n = "<i>{$rname} Response</i>{$n}";
                            } else {
                                $n = "<i>Response</i>{$n}";
                            }
                        }
                    }
                }
                $cids[] = $cid = CommentInfo::unparse_html_id($cr);
                $tclass = "cmtlink";
                if ($cr->commentTags && ($tags = Tagger::strip_nonviewable($cr->commentTags, $Me)) && $Me->can_view_comment_tags($prow, $cr, null) && ($color = TagInfo::color_classes($tags))) {
                    if (TagInfo::classes_have_colors($color)) {
                        $tclass .= " tagcolorspan";
                    }
                    $tclass .= " {$color} taghl";
                }
                $cnames[] = '<a class="' . $tclass . '" href="#' . $cid . '">' . $n . '</a>';
            }
        }
        if (count($cids) > 0) {
            $pret = '<div class="revnotes"><a href="#' . $cids[0] . '"><strong>' . plural(count($cids), "Comment") . '</strong></a>: <span class="nb">' . join(',</span> <span class="nb">', $cnames) . "</span></div>";
            $any_comments = true;
        }
    }
    $t = "";
    // see all reviews
    $allreviewslink = false;
    if (($nvisible > 1 || $nvisible > 0 && !$myrr) && ($mode !== "p" || $rrow)) {
        $allreviewslink = true;
        $x = '<a href="' . hoturl("paper", "p={$prow->paperId}") . '" class="xx">' . Ht::img("view24.png", "[All reviews]", "dlimg") . "&nbsp;<u>All reviews</u></a>";
        $t .= ($t === "" ? "" : $xsep) . $x;
    }
    // edit paper
    if ($mode !== "edit" && $prow->conflictType >= CONFLICT_AUTHOR && !$Me->can_administer($prow)) {
        $x = '<a href="' . hoturl("paper", "p={$prow->paperId}&amp;m=edit") . '" class="xx">' . Ht::img("edit24.png", "[Edit paper]", "dlimg") . "&nbsp;<u><strong>Edit paper</strong></u></a>";
        $t .= ($t === "" ? "" : $xsep) . $x;
    }
    // edit review
    if ($mode === "re" || $mode === "assign" && $t !== "" || !$prow) {
        /* no link */
    } else {
        if ($myrr && $rrow != $myrr) {
            $myrlink = unparseReviewOrdinal($myrr);
            $a = '<a href="' . hoturl("review", "p={$prow->paperId}&r={$myrlink}") . '" class="xx">';
            if ($Me->can_review($prow, $myrr)) {
                $x = $a . Ht::img("review24.png", "[Edit review]", "dlimg") . "&nbsp;<u><b>Edit your review</b></u></a>";
            } else {
                $x = $a . Ht::img("review24.png", "[Your review]", "dlimg") . "&nbsp;<u><b>Your review</b></u></a>";
            }
            $t .= ($t === "" ? "" : $xsep) . $x;
        } else {
            if (!$myrr && !$rrow && $Me->can_review($prow, null)) {
                $x = '<a href="' . hoturl("review", "p={$prow->paperId}&amp;m=re") . '" class="xx">' . Ht::img("review24.png", "[Write review]", "dlimg") . "&nbsp;<u><b>Write review</b></u></a>";
                $t .= ($t === "" ? "" : $xsep) . $x;
            }
        }
    }
    // review assignments
    if ($mode !== "assign" && $mode !== "edit" && $Me->can_request_review($prow, true)) {
        $x = '<a href="' . hoturl("assign", "p={$prow->paperId}") . '" class="xx">' . Ht::img("assign24.png", "[Assign]", "dlimg") . "&nbsp;<u>" . ($admin ? "Assign reviews" : "External reviews") . "</u></a>";
        $t .= ($t === "" ? "" : $xsep) . $x;
    }
    // new comment
    $nocmt = preg_match('/\\A(?:assign|contact|edit|re)\\z/', $mode);
    if (!$allreviewslink && !$nocmt && $Me->can_comment($prow, null)) {
        $x = '<a href="#cnew" onclick="return papercomment.edit_new()" class="xx">' . Ht::img("comment24.png", "[Add comment]", "dlimg") . "&nbsp;<u>Add comment</u></a>";
        $t .= ($t === "" ? "" : $xsep) . $x;
        $any_comments = true;
    }
    // new response
    if (!$nocmt && ($prow->conflictType >= CONFLICT_AUTHOR || $allow_admin) && ($rrounds = $Conf->time_author_respond())) {
        foreach ($rrounds as $i => $rname) {
            $cid = ($i ? $rname : "") . "response";
            $what = "Add";
            if ($crows) {
                foreach ($crows as $cr) {
                    if ($cr->commentType & COMMENTTYPE_RESPONSE && $cr->commentRound == $i) {
                        $what = "Edit";
                        if ($cr->commentType & COMMENTTYPE_DRAFT) {
                            $what = "Edit draft";
                        }
                    }
                }
            }
            $x = '<a href="#' . $cid . '" onclick=\'return papercomment.edit_response(' . json_encode($rname) . ')\' class="xx">' . Ht::img("comment24.png", "[{$what} response]", "dlimg") . "&nbsp;" . ($conflictType >= CONFLICT_AUTHOR ? '<u style="font-weight:bold">' : '<u>') . $what . ($i ? " {$rname}" : "") . ' response</u></a>';
            $t .= ($t === "" ? "" : $xsep) . $x;
            $any_comments = true;
        }
    }
    // override conflict
    if ($allow_admin && !$admin) {
        $x = '<a href="' . selfHref(array("forceShow" => 1)) . '" class="xx">' . Ht::img("override24.png", "[Override]", "dlimg") . "&nbsp;<u>Override conflict</u></a> to show reviewers and allow editing";
        $t .= ($t === "" ? "" : $xsep) . $x;
    } else {
        if ($Me->privChair && !$allow_admin) {
            $x = "You can’t override your conflict because this paper has an administrator.";
            $t .= ($t === "" ? "" : $xsep) . $x;
        }
    }
    if ($any_comments) {
        CommentInfo::echo_script($prow);
    }
    if (($list = SessionList::active()) && ($pret || $t)) {
        return '<div class="has_hotcrp_list" data-hotcrp-list="' . $list->listno . '">' . $pret . $t . '</div>';
    } else {
        return $pret . $t;
    }
}
 function header($title, $id, $actionBar, $title_div = null)
 {
     global $ConfSitePATH, $Me, $Now, $Opt;
     if ($this->headerPrinted) {
         return;
     }
     // <head>
     if ($title === "Home") {
         $title = "";
     }
     $this->header_head($title);
     // <body>
     $body_class = "";
     if ($id === "paper_view" || $id === "paper_edit" || $id === "review" || $id === "assign") {
         $body_class = "paper";
     }
     echo "<body";
     if ($id) {
         echo ' id="', $id, '"';
     }
     if ($body_class) {
         echo ' class="', $body_class, '"';
     }
     echo ">\n";
     // initial load (JS's timezone offsets are negative of PHP's)
     Ht::stash_script("hotcrp_load.time(" . -date("Z", $Now) / 60 . "," . (get($Opt, "time24hour") ? 1 : 0) . ")");
     // deadlines settings
     if ($Me) {
         Ht::stash_script("hotcrp_deadlines.init(" . json_encode($Me->my_deadlines($this->paper)) . ")");
     }
     if (self::$gDefaultFormat) {
         Ht::stash_script("render_text.set_default_format(" . self::$gDefaultFormat . ")");
     }
     // meeting tracker
     $trackerowner = ($trackerstate = $this->setting_json("tracker")) && $trackerstate->trackerid && $trackerstate->sessionid == session_id();
     if ($trackerowner) {
         Ht::stash_script("hotcrp_deadlines.tracker(0)");
     }
     echo '<div id="prebody"><div id="header">';
     // $header_site
     $is_home = $id === "home";
     $site_div = '<div id="header_site" class="header_site_logo ' . ($is_home ? "header_site_home" : "header_site_page") . '"><h1><a class="qq" href="' . hoturl("index") . '">' . htmlspecialchars($Opt["shortName"]);
     if (!$is_home) {
         $site_div .= ' <span style="font-weight:normal">Home</span>';
     }
     $site_div .= '</a></h1></div>';
     // $header_profile
     $profile_html = "";
     if ($Me && !$Me->is_empty()) {
         // profile link
         $xsep = ' <span class="barsep">·</span> ';
         if ($Me->has_email()) {
             $profile_html .= '<a class="q" href="' . hoturl("profile") . '"><strong>' . htmlspecialchars($Me->email) . '</strong></a> &nbsp; <a href="' . hoturl("profile") . '">Profile</a>' . $xsep;
         }
         // "act as" link
         if (($actas = get($_SESSION, "last_actas")) && get($_SESSION, "trueuser") && ($Me->privChair || Contact::$trueuser_privChair === $Me)) {
             // Link becomes true user if not currently chair.
             if (!$Me->privChair || strcasecmp($Me->email, $actas) == 0) {
                 $actas = $_SESSION["trueuser"]->email;
             }
             if (strcasecmp($Me->email, $actas) != 0) {
                 $profile_html .= "<a href=\"" . selfHref(array("actas" => $actas)) . "\">" . ($Me->privChair ? htmlspecialchars($actas) : "Admin") . "&nbsp;" . Ht::img("viewas.png", "Act as " . htmlspecialchars($actas)) . "</a>" . $xsep;
             }
         }
         // help, sign out
         $x = $id == "search" ? "t={$id}" : ($id == "settings" ? "t=chair" : "");
         $profile_html .= '<a href="' . hoturl("help", $x) . '">Help</a>';
         if (!$Me->has_email() && !isset($Opt["httpAuthLogin"])) {
             $profile_html .= $xsep . '<a href="' . hoturl("index", "signin=1") . '">Sign&nbsp;in</a>';
         }
         if (!$Me->is_empty() || isset($Opt["httpAuthLogin"])) {
             $profile_html .= $xsep . '<a href="' . hoturl_post("index", "signout=1") . '">Sign&nbsp;out</a>';
         }
     }
     if (!$title_div && $title) {
         $title_div = '<div id="header_page"><h1>' . $title . '</h1></div>';
     }
     if (!$title_div && $actionBar) {
         $title_div = '<hr class="c" />';
     }
     $renderf = get($Opt, "headerRenderer");
     if (!$renderf) {
         $renderf = "Conf::echo_header";
     }
     if (is_array($renderf)) {
         require_once $renderf[0];
         $renderf = $renderf[1];
     }
     call_user_func($renderf, $this, $is_home, $site_div, $title_div, $profile_html, $actionBar);
     echo "  <hr class=\"c\" /></div>\n";
     echo "<div id=\"initialmsgs\">\n";
     if (get($Opt, "maintenance")) {
         echo "<div class=\"merror\"><strong>The site is down for maintenance.</strong> ", is_string($Opt["maintenance"]) ? $Opt["maintenance"] : "Please check back later.", "</div>";
     }
     $this->save_messages = false;
     if (($msgs = $this->session("msgs")) && count($msgs)) {
         $this->save_session("msgs", null);
         foreach ($msgs as $m) {
             $this->msg($m[0], $m[1]);
         }
     }
     echo "</div>\n";
     $this->headerPrinted = true;
     echo "</div>\n<div id=\"body\" class=\"body\">\n";
     // If browser owns tracker, send it the script immediately
     if ($trackerowner) {
         $this->echoScript();
     }
     // Callback for version warnings
     if ($Me && $Me->privChair && (!isset($_SESSION["updatecheck"]) || $_SESSION["updatecheck"] + 20 <= $Now) && (!isset($Opt["updatesSite"]) || $Opt["updatesSite"])) {
         $m = defval($Opt, "updatesSite", "//hotcrp.lcdf.org/updates");
         $m .= (strpos($m, "?") === false ? "?" : "&") . "addr=" . urlencode($_SERVER["SERVER_ADDR"]) . "&base=" . urlencode(Navigation::siteurl()) . "&version=" . HOTCRP_VERSION;
         $v = HOTCRP_VERSION;
         if (is_dir("{$ConfSitePATH}/.git")) {
             $args = array();
             exec("export GIT_DIR=" . escapeshellarg($ConfSitePATH) . "/.git; git rev-parse HEAD 2>/dev/null; git merge-base origin/master HEAD 2>/dev/null", $args);
             if (count($args) >= 1) {
                 $m .= "&git-head=" . urlencode($args[0]);
                 $v .= " " . $args[0];
             }
             if (count($args) >= 2) {
                 $m .= "&git-upstream=" . urlencode($args[1]);
                 $v .= " " . $args[1];
             }
         }
         Ht::stash_script("check_version(\"{$m}\",\"{$v}\")");
         $_SESSION["updatecheck"] = $Now;
     }
 }