function sessionMatchPreg($name) { if (isset($this->qreq->ls) && ($l = SessionList::lookup($this->qreq->ls)) && ($x = get($l->matchPreg, $name))) { return $x; } else { return ""; } }
private function header_head($title) { global $Me, $ConfSitePATH, $CurrentList; echo "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n<meta http-equiv=\"Content-Language\" content=\"en\" />\n<meta name=\"google\" content=\"notranslate\" />\n"; if (strstr($title, "<") !== false) { $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title); } echo $this->opt("fontScript", ""); echo $this->make_css_link("stylesheets/style.css"), "\n"; if ($this->opt("mobileStylesheet")) { echo '<meta name="viewport" content="width=device-width, initial-scale=1">', "\n"; echo $this->make_css_link("stylesheets/mobile.css", "screen and (max-width: 768px)"), "\n"; } foreach (mkarray($this->opt("stylesheets", [])) as $css) { echo $this->make_css_link($css), "\n"; } // favicon $favicon = $this->opt("favicon"); if ($favicon) { if (strpos($favicon, "://") === false && $favicon[0] != "/") { if ($this->opt["assetsUrl"] && substr($favicon, 0, 7) === "images/") { $favicon = $this->opt["assetsUrl"] . $favicon; } else { $favicon = Navigation::siteurl() . $favicon; } } if (substr($favicon, -4) == ".png") { echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".ico") { echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".gif") { echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n"; } else { echo "<link rel=\"icon\" href=\"{$favicon}\" />\n"; } } } } // jQuery if (isset($this->opt["jqueryUrl"])) { $jquery = $this->opt["jqueryUrl"]; } else { if ($this->opt("jqueryCdn")) { $jquery = "//code.jquery.com/jquery-1.12.3.min.js"; } else { $jquery = "scripts/jquery-1.12.3.min.js"; } } Ht::stash_html($this->make_script_file($jquery, true) . "\n"); Ht::stash_html($this->make_script_file("scripts/jquery.color-2.1.2.min.js", true) . "\n"); Ht::stash_html($this->make_script_file("scripts/jquery.flot.min.js", true) . "\n"); //Ht::stash_html($this->make_script_file("scripts/ZeroClipboard.min.js", true) . "\n"); // Javascript settings to set before script.js Ht::stash_script("siteurl=" . json_encode(Navigation::siteurl()) . ";siteurl_suffix=\"" . Navigation::php_suffix() . "\""); if (session_id() !== "") { Ht::stash_script("siteurl_postvalue=\"" . post_value() . "\""); } if (@$CurrentList && ($list = SessionList::lookup($CurrentList))) { Ht::stash_script("hotcrp_list={num:{$CurrentList},id:\"" . addcslashes($list->listid, "\n\r\\\"/") . "\"}"); } if ($urldefaults = hoturl_defaults()) { Ht::stash_script("siteurl_defaults=" . json_encode($urldefaults) . ";"); } Ht::stash_script("assetsurl=" . json_encode($this->opt["assetsUrl"]) . ";"); $huser = (object) array(); if ($Me && $Me->email) { $huser->email = $Me->email; } if ($Me && $Me->is_pclike()) { $huser->is_pclike = true; } Ht::stash_script("hotcrp_user="******"ZeroClipboard.setDefaults({moviePath:\"" . Navigation::siteurl() . "cacheable" . Navigation::php_suffix() . "?file=scripts/ZeroClipboard.swf&mtime=" . filemtime("$ConfSitePATH/scripts/ZeroClipboard.swf") . "\"})"); // script.js if (!$this->opt("noDefaultScript")) { Ht::stash_html($this->make_script_file("scripts/script.js") . "\n"); } echo Ht::unstash(); echo "<title>"; if ($title) { echo $title, " - "; } echo htmlspecialchars($this->short_name), "</title>\n</head>\n"; }
static function track_api($qreq, $user) { if (!$user->privChair || !check_post()) { json_exit(array("ok" => false)); } // argument: IDENTIFIER LISTNUM [POSITION] -OR- stop if ($qreq->track === "stop") { self::clear(); return; } // check tracker_start_at to ignore concurrent updates if (($start_at = $qreq->tracker_start_at) && ($tracker = self::lookup())) { $time = $tracker->position_at; if (isset($tracker->start_at)) { $time = $tracker->start_at; } if ($time > $start_at) { return; } } // actually track $args = preg_split('/\\s+/', $qreq->track); if (count($args) >= 2 && ($xlist = SessionList::lookup($args[1])) && str_starts_with($xlist->listid, "p/")) { $position = null; if (count($args) >= 3 && ctype_digit($args[2])) { $position = array_search((int) $args[2], $xlist->ids); } self::update($xlist, $args[0], $position); } }
private function header_head($title) { global $Me, $ConfSiteBase, $ConfSiteSuffix, $ConfSitePATH, $Opt, $CurrentList; echo "<!DOCTYPE html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n<meta http-equiv=\"Content-Language\" content=\"en\" />\n<meta name=\"google\" content=\"notranslate\" />\n"; if (strstr($title, "<") !== false) { $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title); } if (isset($Opt["fontScript"])) { echo $Opt["fontScript"]; } echo $this->make_css_link("stylesheets/style.css"), "\n"; if (isset($Opt["stylesheets"])) { foreach ($Opt["stylesheets"] as $css) { echo $this->make_css_link($css), "\n"; } } // favicon if ($favicon = defval($Opt, "favicon")) { if (strpos($favicon, "://") === false && $favicon[0] != "/") { if (@$Opt["assetsUrl"] && substr($favicon, 0, 7) === "images/") { $favicon = $Opt["assetsUrl"] . $favicon; } else { $favicon = $ConfSiteBase . $favicon; } } if (substr($favicon, -4) == ".png") { echo "<link rel=\"icon\" type=\"image/png\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".ico") { echo "<link rel=\"shortcut icon\" href=\"{$favicon}\" />\n"; } else { if (substr($favicon, -4) == ".gif") { echo "<link rel=\"icon\" type=\"image/gif\" href=\"{$favicon}\" />\n"; } else { echo "<link rel=\"icon\" href=\"{$favicon}\" />\n"; } } } } // jQuery if (isset($Opt["jqueryUrl"])) { $jquery = $Opt["jqueryUrl"]; } else { if (@$Opt["jqueryCdn"]) { $jquery = "//code.jquery.com/jquery-1.11.3.min.js"; } else { $jquery = "scripts/jquery-1.11.3.min.js"; } } $this->scriptStuff = $this->make_script_file($jquery, true) . "\n"; $this->scriptStuff .= $this->make_script_file("scripts/jquery.color-2.1.2.min.js", true) . "\n"; $this->scriptStuff .= $this->make_script_file("scripts/jquery.flot.min.js", true) . "\n"; //$this->scriptStuff .= $this->make_script_file("scripts/ZeroClipboard.min.js", true) . "\n"; // Javascript settings to set before script.js $this->scriptStuff .= "<script>siteurl=\"{$ConfSiteBase}\";siteurl_suffix=\"{$ConfSiteSuffix}\""; if (session_id() !== "") { $this->scriptStuff .= ";siteurl_postvalue=\"" . post_value() . "\""; } if (@$CurrentList && ($list = SessionList::lookup($CurrentList))) { $this->scriptStuff .= ";hotcrp_list={num:{$CurrentList},id:\"" . addcslashes($list->listid, "\n\r\\\"/") . "\"}"; } if ($urldefaults = hoturl_defaults()) { $this->scriptStuff .= ";siteurl_defaults=" . json_encode($urldefaults); } $huser = (object) array(); if ($Me && $Me->email) { $huser->email = $Me->email; } if ($Me && $Me->is_pclike()) { $huser->is_pclike = true; } $this->scriptStuff .= ";hotcrp_user="******"paperId"]; $pid = $pid && ctype_digit($pid) ? (int) $pid : 0; if ($pid) { $this->scriptStuff .= ";hotcrp_paperid={$pid}"; } if ($pid && $Me && $Me->privChair && ($forceShow = @$_REQUEST["forceShow"]) && $forceShow != "0") { $this->scriptStuff .= ";hotcrp_want_override_conflict=true"; } //$this->scriptStuff .= ";ZeroClipboard.setDefaults({moviePath:\"${ConfSiteBase}cacheable$ConfSiteSuffix?file=scripts/ZeroClipboard.swf&mtime=" . filemtime("$ConfSitePATH/scripts/ZeroClipboard.swf") . "\"})"; $this->scriptStuff .= "</script>\n"; // script.js $this->scriptStuff .= $this->make_script_file("scripts/script.js") . "\n"; echo $this->scriptStuff; $this->scriptStuff = ""; echo "<title>", $title, " - ", htmlspecialchars($Opt["shortName"]), "</title>\n</head>\n"; }