Exemple #1
0
 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&amp;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";
 }
 private function header_head($title)
 {
     global $Me, $ConfSitePATH, $Opt;
     // load session list and clear its cookie
     $list = SessionList::active();
     SessionList::set_requested(0);
     echo "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"google\" content=\"notranslate\" />\n";
     if (isset($Opt["fontScript"])) {
         echo $Opt["fontScript"];
     }
     echo $this->make_css_link("stylesheets/style.css"), "\n";
     if (get($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";
     }
     if (isset($Opt["stylesheets"])) {
         foreach (mkarray($Opt["stylesheets"]) as $css) {
             echo $this->make_css_link($css), "\n";
         }
     }
     // favicon
     if ($favicon = defval($Opt, "favicon", "images/review24.png")) {
         if (strpos($favicon, "://") === false && $favicon[0] != "/") {
             if (get($Opt, "assetsUrl") && substr($favicon, 0, 7) === "images/") {
                 $favicon = $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";
                 }
             }
         }
     }
     // title
     echo "<title>";
     if ($title) {
         $title = preg_replace("/<([^>\"']|'[^']*'|\"[^\"]*\")*>/", "", $title);
         $title = preg_replace(",(?: |&nbsp;| )+,", " ", $title);
         $title = str_replace("&#x2215;", "-", $title);
     }
     if ($title) {
         echo $title, " - ";
     }
     echo htmlspecialchars($Opt["shortName"]), "</title>\n</head>\n";
     // jQuery
     $stash = Ht::take_stash();
     if (isset($Opt["jqueryUrl"])) {
         $jquery = $Opt["jqueryUrl"];
     } else {
         if (get($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");
     // 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 ($list) {
         Ht::stash_script("hotcrp_list=" . json_encode(["num" => $list->listno, "id" => $list->listid]) . ";");
     }
     if ($urldefaults = hoturl_defaults()) {
         Ht::stash_script("siteurl_defaults=" . json_encode($urldefaults) . ";");
     }
     Ht::stash_script("assetsurl=" . json_encode($Opt["assetsUrl"]) . ";");
     $huser = (object) array();
     if ($Me && $Me->email) {
         $huser->email = $Me->email;
     }
     if ($Me && $Me->is_pclike()) {
         $huser->is_pclike = true;
     }
     if ($Me && $Me->has_database_account()) {
         $huser->cid = $Me->contactId;
     }
     Ht::stash_script("hotcrp_user="******";");
     $pid = get($_REQUEST, "paperId");
     $pid = $pid && ctype_digit($pid) ? (int) $pid : 0;
     if (!$pid && $this->paper) {
         $pid = $this->paper->paperId;
     }
     if ($pid) {
         Ht::stash_script("hotcrp_paperid={$pid}");
     }
     if ($pid && $Me && $Me->is_admin_force()) {
         Ht::stash_script("hotcrp_want_override_conflict=true");
     }
     // script.js
     if (!get($Opt, "noDefaultScript")) {
         Ht::stash_html($this->make_script_file("scripts/script.js") . "\n");
     }
     // other scripts
     if (get($Opt, "scripts")) {
         foreach ($Opt["scripts"] as $file) {
             Ht::stash_html($this->make_script_file($file) . "\n");
         }
     }
     if ($stash) {
         Ht::stash_html($stash);
     }
 }
Exemple #3
0
 private static function _cvt_numeric_set($optarr)
 {
     $ids = array();
     foreach (mkarray($optarr) as $x) {
         if (($x = cvtint($x)) > 0) {
             $ids[] = $x;
         }
     }
     return $ids;
 }