Skip to content
Permalink
Browse files

Improve the way urlbase arguments are handled.

In particular the t parameter should always be provided.
  • Loading branch information...
kohler committed Sep 27, 2019
1 parent c013857 commit ecc76c10bdf76a4d4a1ea304bbf4040e0d768916
Showing with 29 additions and 18 deletions.
  1. +4 −2 autoassign.php
  2. +4 −2 conflictassign.php
  3. +4 −3 manualassign.php
  4. +4 −2 reviewprefs.php
  5. +3 −2 src/api/api_search.php
  6. +10 −7 src/papersearch.php
@@ -502,8 +502,10 @@ function divClass($name, $classes = null) {
echo join("", $tOpt);
echo "   ", Ht::submit("requery", "List", ["id" => "requery"]);
if (isset($Qreq->requery) || isset($Qreq->haspap)) {
$search = new PaperSearch($Me, array("t" => $Qreq->t, "q" => $Qreq->q,
"urlbase" => $Conf->hoturl_site_relative_raw("autoassign")));
$search = new PaperSearch($Me, [
"t" => $Qreq->t, "q" => $Qreq->q,
"pageurl" => $Conf->hoturl_site_relative_raw("autoassign")
]);
$plist = new PaperList($search, ["display" => "show:reviewers"]);
$plist->set_selection($SSel);
@@ -26,8 +26,10 @@
echo "</div>\n";
$search = new PaperSearch($Me, ["t" => "alladmin", "q" => "",
"urlbase" => $Conf->hoturl_site_relative_raw("conflictassign")]);
$search = new PaperSearch($Me, [
"t" => "alladmin", "q" => "",
"pageurl" => $Conf->hoturl_site_relative_raw("conflictassign", ["neg" => $Qreq->neg ? 1 : null])
]);
$rowset = $Conf->paper_set(["allConflictType" => 1, "allReviewerPreference" => 1, "tags" => 1, "paperId" => $search->paper_ids()], $Me);
if ($Qreq->neg) {
@@ -228,9 +228,10 @@ function saveAssignments($qreq, $reviewer) {
'">Search for current and potential conflicts</a></div>';
// main assignment form
$search = new PaperSearch($Me, ["t" => $Qreq->t, "q" => $Qreq->q,
"urlbase" => $Conf->hoturl_site_relative_raw("manualassign"),
"reviewer" => $reviewer]);
$search = new PaperSearch($Me, [
"t" => $Qreq->t, "q" => $Qreq->q, "reviewer" => $reviewer,
"pageurl" => $Conf->hoturl_site_relative_raw("manualassign")
]);
if (!empty($hlsearch))
$search->set_field_highlighter_query(join(" OR ", $hlsearch));
$paperList = new PaperList($search, ["sort" => true, "display" => "show:topics show:reviewers"], $Qreq);
@@ -207,7 +207,6 @@ function parseUploadedPreferences($text, $filename, $apply) {
// Prepare search
$Qreq->urlbase = $Conf->hoturl_site_relative_raw("reviewprefs");
$Qreq->q = get($Qreq, "q", "");
$Qreq->t = "editpref";
@@ -234,7 +233,10 @@ function parseUploadedPreferences($text, $filename, $apply) {
// search
$search = new PaperSearch($Me, ["t" => $Qreq->t, "urlbase" => $Qreq->urlbase, "q" => $Qreq->q, "reviewer" => $reviewer]);
$search = new PaperSearch($Me, [
"t" => $Qreq->t, "q" => $Qreq->q, "reviewer" => $reviewer,
"pageurl" => $Conf->hoturl_site_relative_raw("reviewprefs")
]);
$pl = new PaperList($search, ["sort" => true, "report" => "pf"], $Qreq);
$pl->set_table_id_class("foldpl", "pltable-fullw", "p#");
$pl_text = $pl->table_html("editpref",
@@ -14,10 +14,11 @@ static function search(Contact $user, Qrequest $qreq) {
$q = trim($q);
if ($q === "(All)")
$q = "";
} else if (isset($qreq->qa) || isset($qreq->qo) || isset($qreq->qx))
} else if (isset($qreq->qa) || isset($qreq->qo) || isset($qreq->qx)) {
$q = PaperSearch::canonical_query((string) $qreq->qa, (string) $qreq->qo, (string) $qreq->qx, $qreq->qt, $user->conf);
else
} else {
return new JsonResult(400, "Missing parameter.");
}
$search = new PaperSearch($user, ["t" => $t, "q" => $q, "qt" => $qreq->qt, "urlbase" => $qreq->urlbase, "reviewer" => $qreq->reviewer]);
$pl = new PaperList($search, ["report" => $qreq->report ? : "pl", "sort" => true], $qreq);
@@ -1604,16 +1604,19 @@ function __construct(Contact $user, $options) {
$limit = "ar";
// URL base
if (isset($options["urlbase"]))
$this->_urlbase = $options["urlbase"];
else
$this->_urlbase = $this->conf->hoturl_site_relative_raw("search", "t=" . urlencode($limit));
if ($this->_qt !== "n")
$this->_urlbase = get($options, "pageurl");
if ($this->_urlbase === null) {
$this->_urlbase = $this->conf->hoturl_site_relative_raw("search");
}
$this->_urlbase = hoturl_add_raw($this->_urlbase, "t=" . urlencode($limit));
if ($this->_qt !== "n") {
$this->_urlbase = hoturl_add_raw($this->_urlbase, "qt=" . urlencode($this->_qt));
}
if ($this->_reviewer_user
&& $this->_reviewer_user->contactId !== $user->contactId
&& strpos($this->_urlbase, "reviewer=") === false)
&& $this->_reviewer_user->contactId !== $user->contactId) {
assert(strpos($this->_urlbase, "reviewer=") === false);
$this->_urlbase = hoturl_add_raw($this->_urlbase, "reviewer=" . urlencode($this->_reviewer_user->email));
}
assert(strpos($this->_urlbase, "&amp;") === false);
$this->_named_limit = $limit;

0 comments on commit ecc76c1

Please sign in to comment.
You can’t perform that action at this time.