$peopleresult = trim($peopleresult); } } else { $peopleresult = false; } // -------------------- // Create $searchform // -------------------- // Method should be GET to ensure back-button functionality on result page $searchform = " <form action='" . $_SERVER['PHP_SELF'] . "' method='get' id='os_search' " . " enctype='application/x-www-form-urlencoded'>\r\n" . " <div>\r\n"; if (isset($_LANG)) { $searchform .= " <input type='text' id='qry' name='qry' " . "value='" . htmlspecialchars($GLOBALS['QUERY']['original']) . "'>\r\n"; if (isset($_SDATA['categories']) && count($_SDATA['categories']) > 1) { $searchform .= " <label>\r\n" . " \r\n" . " <select name='ctg' size='1'>\r\n" . " <option value=''" . ($GLOBALS['QUERY']['category'] == "" ? " selected='selected'" : "") . ">in the entire Nordita web</option>\r\n"; foreach ($_SDATA['categories'] as $category) { if (isset($GLOBALS["nw_categories"][$category]) && auth::isAccessGranted($GLOBALS["nw_categories"][$category])) { $searchform .= " <option value='" . $category . "'" . ($GLOBALS['QUERY']['category'] == $category ? " selected='selected'" : "") . ">only in the " . $category . " " . (strtolower($category) == "main" ? "Nordita Site" : "Subsite") . "</option>\r\n"; } } $searchform .= " </select>\r\n" . " </label>\r\n"; } $searchform .= " <input type='submit' value='Go'>\r\n"; } else { $searchform .= " "; } $searchform .= " </div>\r\n" . " </form>\r\n" . "\r\n"; // -------------------- // Create $searchtips // -------------------- $searchtips = " <ul class='os_searchtips'>\r\n" . " <li>Search terms with fewer than " . $GLOBALS["VDATA"]['s.termlength'] . " characters are ignored</li>\r\n" . " <li>Enclose groups of terms in quotes ("") to search for phrases</li>\r\n" . " <li>Prefix terms with a plus-sign (+) to make them important</li>\r\n" . " <li>Prefix terms with a minus-sign (-) or exclamation point (!) to exclude terms</li>\r\n" . " </ul>\r\n" . "\r\n"; // --------------------
private function buildConfigOfPageUpdate() { // ----------------------------------------------------------- // -- (1) Update $this->configOfPage with menu configuration of current page // ----------------------------------------------------------- if (isset($this->allMenusArray[$this->pagePath])) { foreach ($this->allMenusArray[$this->pagePath] as $field => $value) { $this->setConfig($field, $value); } } // ----------------------------------------------------------- // -- (2) Massage some of the fields in $this->configOfPage // ----------------------------------------------------------- if (!$this->getConfig("requirelogin") && $this->getConfig("access")) { $this->setConfig("logintype", "link"); } // ----------------------- if ($this->getConfig("listincontext")) { $this->setConfig("notintopmenu", 1); } // ----------------------- // Login form should always be 'medwide' // ----------------------- if (auth::isLoginType("inline") && (!auth::isAuthenticated() || auth::isLogoutRequested() || !auth::isAccessGranted())) { $this->setConfig("wide", 0); $this->setConfig("medwide", 1); $this->setConfig("rightwide", 0); //$this->setConfig("nocolophon", 1); } // ----------------------- // Any kind of login form must have stylesheet 'loginform.css' // ----------------------- if ((auth::isLoginRequired() || auth::isLoginAllowed()) && (!auth::isAuthenticated() || auth::isLogoutRequested())) { $GLOBALS[SUBSITE]["stylesheets"]["all"][] = "loginform.css"; } // ----------------------- if (IS_ERRORPAGE) { $this->setConfig("title", "Oops! Something seems to have gone wrong..."); $this->setConfig("bodyid", "error"); } // if (IS_TESTSERVER) { // $this->setConfig("robots","noindex,nofollow,noodp,noydir"); // } //TODO: convert to current framework /* if ($this->getConfig("wide") ) { unset($GLOBALS["blocks"]["top"]); unset($GLOBALS["blocks"]["subtree"]); unset($GLOBALS["blocks"]["fixedimage"]); unset($GLOBALS["blocks"]["splashimage"]); unset($GLOBALS["blocks"]["sidebar"]); $GLOBALS["blocks"]["twotop"] = 1; } else if ($this->getConfig("medwide") ) { unset($GLOBALS["blocks"]["sidebar"]); } */ // For 'people/doorlabel' if (isset($_REQUEST["us"]) && count($_REQUEST["us"]) <= 4) { $this->setConfig("nobanner", 1); $this->setConfig("nobackground", 1); $this->setConfig("nocolophon", 1); $this->setConfig("nopagetitle", 1); } // ----------------------- if (isset($_REQUEST["eventlist_select"])) { $this->setConfig("url", functions::callMethod("event", "lib/event", "getEventListUrl")); } // ----------------------- if (isset($_REQUEST["statistics_preprints"])) { switch ($_REQUEST["preprints_type"]) { case "word": $this->setConfig("plaincss", 1); $this->setConfig("nomenu", 1); $this->setConfig("nocss", 1); $this->setConfig("nocolophon", 1); $this->setConfig("nobanner", 1); $this->setConfig("nosearch", 1); $this->setConfig("nopagetitle", 1); $this->setConfig("nobackground", 1); break; case "text": $this->setConfig("bodyid", "text"); break; } } // ----------------------- // If received data from login form, check authentication and redirect on success: // ----------------------- if ((isset($_REQUEST["auth_submitted"]) || isset($_SESSION["mypear_auth_attempted"])) && auth::checkLogin()) { $this->setConfig("url", $_SERVER["PHP_SELF"]); } // ----------------------- // Possibly modify $this->configOfPage["bannertext"] // -- Initiated to "Nordic Institute <span class='only_online'><br></span>for // Theoretical Physics" in 'config_SUBSITE.php'. // -- NB that YB apps pages should be self-sufficient // ----------------------- // Legacy YB-style, with page title in banner box; probably no longer used if ($this->getConfig("titleinbanner") && !$this->getConfig("nopagetitle")) { $this->setConfig("bannertext", $this->getConfig("title")); } /* RESTORE if test tabs needed */ /* if (SHOW_TEST_TABS && IS_INDEXPAGE && isset($GLOBALS["frontselect"]) && ($GLOBALS["frontselect"]==10)) $this->setConfig("bannertext",""); */ // ----------------------- // Set $this->configOfPage["titletag"] // -- TITLE TAG IN <HEAD> // TITLE and TITLE_EXTENSION are defined in 'config.php' // ----------------------- $thetitle = ""; if (IS_ERRORPAGE) { $thetitle = TITLE . " - " . $this->httpstatus_sc . " " . $this->httpstatus_reason; } elseif (IS_INDEXPAGE) { $thetitle = TITLE . " - " . TITLE_EXTENSION; } elseif (!empty($_REQUEST["iid"])) { if (!isset($GLOBALS["newsClass"])) { if (!class_exists("fromdb_nwnews", FALSE)) { require_once PATH_CLASSES . "/fromdb/nwnews.php"; } $GLOBALS["newsClass"] = new fromdb_nwnews(); } $thearticle = $GLOBALS["newsClass"]->getIssue(NEWS_ANYISSUE, $_REQUEST["iid"]); $issue = !empty($thearticle["issue_year"]) && !empty($thearticle["issue_number"]) ? ". " . $thearticle["issue_year"] . ", Issue " . $thearticle["issue_number"] : ""; $thetitle = "Nordita Newsletter" . $issue . " - " . TITLE; } elseif (!empty($_REQUEST["u"])) { $userdata = functions::callMethod('people', 'lib/people', 'getPeopleArray'); $fullname = isset($userdata[$_REQUEST["u"]]) && !empty($userdata[$_REQUEST["u"]]["nw_fullname"]) ? $userdata[$_REQUEST["u"]]["nw_fullname"] . " - " : ""; $thetitle = $fullname . TITLE; } elseif ($this->getConfig("title")) { $thetitle = $this->getConfig("title") . " - " . TITLE; } elseif (!empty($_REQUEST["htmltitel"])) { $thetitle = $_REQUEST["htmltitel"] . " - " . TITLE; } $this->setConfig("titletag", $thetitle); /* RESTORE if test tabs needed */ /* if (SHOW_TEST_TABS && IS_INDEXPAGE && !empty($GLOBALS["frontselect"])) $this->setConfig("titletag","[" . $GLOBALS["frontselect"] . "] " . $this->getConfig("titletag")); */ }
private static function getPageSearch() { $pagedata = array(); self::loadClass(); // ---------------------------------------------------------------------------- // SETUP // ---------------------------------------------------------------------------- // -------------------- // -- Start timer // Later used in: search::outputPageSearchBlurb() // -------------------- functions::timerStart("pageSearch"); /* // -------------------- // -- Magic quotes fix // [Done in 'config.php'] // -------------------- if (get_magic_quotes_gpc()) { $fsmq = create_function('&$mData, $fnSelf', 'if (is_array($mData)) foreach ($mData as $mKey=>$mValue) $fnSelf($mData[$mKey], $fnSelf); else $mData = stripslashes($mData);'); $fsmq($_POST, $fsmq); $fsmq($_GET, $fsmq); $fsmq($_REQUEST, $fsmq); $fsmq($_COOKIE, $fsmq); $fsmq($_ENV, $fsmq); $fsmq($_SERVER, $fsmq); } ini_set('magic_quotes_runtime', 0); // -------------------- // -- Include User Variables // [Done in 'config.php'] // Called in fromdb_nwsearch->getPageSearchResults() but only as method $_MIME->get_ctype() // -------------------- $_MIME = new OS_TypeList(); $_MIME->ctype["none"] = new OS_ContentType(); $_MIME->ctype["txt"] = new OS_ContentType(array("text/plain")); $_MIME->ctype["html"] = new OS_ContentType(array("text/html", "application/xhtml+xml", "application/xml", "text/xml")); // -------------------- // -- Connect to MySQL server // [Done in 'config.php'] // --> $_DDATA["link"] // --> $_DDATA["error"] // --> $_DDATA["errno"] // --> $_DDATA["online"] // -------------------- $GLOBALS["DDATA"]["online"] = false; $_DDATA["link"] = @mysql_connect($_DDATA["hostname"], $_DDATA["username"], $_DDATA["password"]) or ($GLOBALS["DDATA"]["error"] = $_DDATA["error"] = mysql_error()); if (!isset($_DDATA["error"])) $GLOBALS["DDATA"]["link"] = $_DDATA["link"]; if (!isset($_DDATA["error"])) @mysql_select_db($_DDATA["database"], $_DDATA["link"]) or ($GLOBALS["DDATA"]["error"] = $_DDATA["error"] = mysql_error()); if (!isset($_DDATA["error"])) { $GLOBALS["DDATA"]["online"] = $_DDATA["online"] = true; } else { $GLOBALS["DDATA"]["errno"] = $_DDATA["errno"] = mysql_errno(); } if (!$GLOBALS["DDATA"]["online"]) return array(); */ // -------------------- // -- Assemble array with analyzed query data from GPC string // --> $_SESSION["searchConfig"] // --> $GLOBALS["nw_categories"] // --> $GLOBALS["qry"] // --> $GLOBALS["ctg"] // --> $GLOBALS["QUERY"] // -------------------- if (!isset($GLOBALS["QUERY"])) { search::initiateQueryParameters(); } if (!count($GLOBALS["QUERY"]["terms"])) { return array(); } // -------------------- // -- Trim cache size if it is time to do so; otherwise mail query statistics if this is requested. // -------------------- if (CACHE_SEARCH_QUERIES) { $GLOBALS["searchClass"]->cacheTrim(); } // -------------------- // -- Trigger another spider, if $_SESSION["searchConfig"]["sp.interval"] hours have // passed since last time // -------------------- //TODO: is this properly debugged? $GLOBALS["searchClass"]->triggerAnotherSpider(); // ---------------------------------------------------------------------------- // SEARCH // ---------------------------------------------------------------------------- // -------------------- // -- If result for this query has been cached, fetch $_RESULT[] from cache // --> $pagedata[] // -------------------- if (CACHE_SEARCH_QUERIES) { $pagedata = $GLOBALS["searchClass"]->cacheFetchResultFrom(); if (count($pagedata)) { functions::timerStop("pageSearch"); return $pagedata; } } // -------------------- // -- Return empty result if the database is locked or no seamless search allowed // -------------------- if ($_SESSION["searchConfig"]["sp.lock"] != "false" && $_SESSION["searchConfig"]["sp.seamless"] != "true") { if ($_SESSION["searchConfig"]["sp.progress"] < time() - 60) { $GLOBALS["searchClass"]->setData("sp.lock", "false"); } functions::timerStop("pageSearch"); return NULL; } /* // -------------- require_once PATH_SEARCH . "/config.php"; // --> $GLOBALS["SDATA"], $GLOBALS["DDATA"] //debug::rr(array_filter(array_map("OS_pquote", explode("\n", $GLOBALS['VDATA']['sp.require'])))); if ($GLOBALS['VDATA']['sm.unlisted'] != "true") { //debug::rr($GLOBALS['VDATA']); $lq = ($GLOBALS['VDATA']['s.orphans'] == "show") ? " AND (`status`='OK' OR `status`='Orphan')" : " AND `status`='OK'"; $nq = ""; $sData['noSearch'] = array_filter(array_map("trim", explode("\n", $GLOBALS['VDATA']['s.ignore']))); foreach ($sData['noSearch'] as $noSearch) { $nq .= " AND ((`uri` NOT ". (($noSearch{0} == "*") ? "REGEXP '".substr(str_replace("'", "\\'", $noSearch), 1)."'" : " LIKE '%".str_replace("'", "\\'", $noSearch)."%'") . ") OR (`uri` LIKE '%www.nordita.org/~%') )"; } $qadd = " AND `unlist`!='true'{$lq}{$nq}"; } else $qadd = ""; $sql = "SELECT `uri`, `sm.lastmod`, `sm.changefreq`, `sm.priority` " . "FROM `{$_DDATA['tablename']}` " . "WHERE `sm.list`='true' AND `uri` LIKE '%//".str_replace("'", "\\'", $GLOBALS['VDATA']['sm.domain'])."/%' AND `body`!=''$qadd;"; //debug::rr("$sql"); $sitemap = mysql_unbuffered_query($sql); while ($uri = $GLOBALS["searchClass"]->next_record_assoc($sitemap)) { debug::rr($uri); } */ // -------------------- // -- SELECT ALL RECORDS IN WEB PAGE DATABASE respecting filetype, +term and -term // requirements (using $GLOBALS["QUERY"]["typey"], ["typen"], ["and"], ["not"]). // Remaining query terms are treated in // --> $result // -------------------- $result = $GLOBALS["searchClass"]->getPageSearchResults($GLOBALS["QUERY"]); // -------------------- // -- SORT SEARCH RESULT $result INTO ARRAY $auxpagedata[] with // all records in $result matching also optional terms, weighted by relevance. // (using $GLOBALS["QUERY"]["and"], ["or"]). // --> $auxpagedata[] // -------------------- // load authentication class if (!class_exists("auth", FALSE)) { require_once PATH_CLASSES . "/lib/auth.php"; } $auxpagedata = array(); //while ($uri = $GLOBALS["searchClass"]->next_record_assoc($result)) { // very slow while ($uri = $GLOBALS["searchClass"]->next_record_assoc($result)) { /* foreach ($uri as $key => $value) { if (mb_detect_encoding($value)!="UTF-8") {$uri[$key] = utf8_encode($value);} } */ // -- Attempt at speed things up a little $hit = 0; if (!count($GLOBALS["QUERY"]["and"])) { foreach ($GLOBALS["QUERY"]["or"] as $or) { if (preg_match("/" . $or . "/i", strtolower($uri["data"]))) { $hit++; } } } if ($hit || count($GLOBALS["QUERY"]["and"])) { $uri["bonus"] = 1; // strange, seems not to be used anywhere... // -- Cleaner version of page path $uri["path"] = str_replace(array("http://" . $_SERVER["HTTP_HOST"] . preg_replace("/\\/[^\\/]*\$/", "/", $_SERVER["PHP_SELF"]), "http://" . $_SERVER["HTTP_HOST"] . "/", "http://www.nordita.org/", "http://", "/index.php"), array("", "", "", "", ""), $uri["uri"]); // -- Calculate $uri["relevance"] and update $uri["matchText"] based on // required and optional query terms $uri["relevance"] = 0; $uri["matchText"] = ""; if (empty($GLOBALS["QUERY"]["and"]) && empty($GLOBALS["QUERY"]["or"])) { // only NOT $uri["relevance"] = 0.01; } else { $uri = self::auxAddRelevance($uri, $GLOBALS["QUERY"]["and"], $_SESSION["searchConfig"]["s.weight"][6]); $uri = self::auxAddRelevance($uri, $GLOBALS["QUERY"]["or"], 1); } if ($uri["relevance"]) { $auxpagedata[] = array("title" => $uri["title"], "description" => $uri["description"], "category" => $uri["category"], "uri" => $uri["uri"], "path" => $uri["path"], "body" => $uri["body"], "ctype" => $uri["ctype"], "matchText" => $uri["matchText"], "relevance" => $uri["relevance"]); } } // end if } // end while if (empty($auxpagedata)) { return array(); } // -------------------- // -- MASSAGE DATA IN ARRAY $auxpagedata[] and put in array $pagedata. // --> $pagedata[???][???] = array(record) // -------------------- foreach ($auxpagedata as $uri) { // -- Put together $uri["matchText"] // $uri["matchText"] = self::trimMatchText ($uri["matchText"],$uri["description"],$uri["body"]); if ($uri["matchText"]) { $uri["matchText"] = trim(substr($uri["matchText"], 0, strlen($uri["matchText"]) - 5)); if (isset($uri["matchText"][0]) && preg_match("/^[^A-Z]/", $uri["matchText"][0])) { $uri["matchText"] = " ... " . $uri["matchText"]; } if (isset($uri["matchText"][strlen($uri["matchText"]) - 1]) && preg_match("/[^.?!]/", $uri["matchText"][strlen($uri["matchText"]) - 1])) { $uri["matchText"] .= " ... "; } $uri["matchText"] = str_replace(array("\n", "\r"), "", $uri["matchText"]); } else { if (trim($uri["description"])) { $uri["matchText"] = $uri["description"]; } else { if (trim($uri["body"])) { $max = strlen($uri["body"]) - (int) (SEARCH_MAX_MATCHED_TEXT_DISPLAYED / 3); if ($max >= 0) { $uri["matchText"] = substr($uri["body"], mt_rand(0, $max), (int) (SEARCH_MAX_MATCHED_TEXT_DISPLAYED / 3)); } if (SEARCH_UTF8_INDEXING) { $uri["matchText"] = preg_replace(array("/^.*?(?=[�-��-�\\s])/s", "/(�[�-�]?[�-�]?|[�-�][�-�]{,2}|�[�-�]?[�-�]?|�[�-�]?|[�-���][�-�]?|�[�-�]?|[�-�]|\\w+)\$/"), "", $uri["matchText"]); } else { $uri["matchText"] = preg_replace(array("/^[^\\s]*\\s/", "/\\s[^\\s]*\$/"), "", $uri["matchText"]); } $uri["matchText"] .= " ... "; } } } // end if // -------------------- // -- Remove paths that the current user has no access rights to see // ($uri["path"] added by HVZM) // -------------------- if ($uri["relevance"] && (!auth::isAccessGranted($GLOBALS["documentClass"]->getConfigOfPath($uri["path"], "access")) || isset($GLOBALS["nw_categories"]) && isset($GLOBALS["nw_categories"][$uri["category"]]) && !auth::isAccessGranted($GLOBALS["nw_categories"][$uri["category"]]))) { $uri["relevance"] = 0; } // -------------------- // -- Reduce weight of pages in 'signature' path: // -------------------- if ($uri["relevance"] && strpos($uri["uri"], "/signature/") !== false) { $uri["relevance"] = 0.1; } // -------------------- // -- Remove paths of single-user pages: // -------------------- // keep for future reference: //if ($uri["relevance"] && (strpos($uri["uri"],"u=")!==false)) $uri["relevance"] = 0; // -------------------- // -- Highlight query terms in text strings // -------------------- if ($uri["relevance"]) { $uri["matchText"] = self::auxOutputFormat($uri["matchText"], $GLOBALS["QUERY"]["andor"]); $uri["title"] = self::auxOutputFormat($uri["title"], $GLOBALS["QUERY"]["andor"]); $uri["matchURI"] = (double) $_SESSION["searchConfig"]["s.weight"][4] > 0 ? self::auxOutputFormat("/" . $uri["path"], $GLOBALS["QUERY"]["andor"]) : "/" . $uri["path"]; $uri["description"] = self::auxOutputFormat($uri["description"], array()); } // -------------------- // -- If path has not been removed, create new element in $pagedata // -------------------- if ($uri["relevance"]) { $pagedata[] = array("title" => $uri["title"], "description" => $uri["description"], "category" => $uri["category"], "uri" => $uri["uri"], "matchURI" => $uri["matchURI"], "path" => $uri["path"], "filetype" => $uri["ctype"], "matchText" => $uri["matchText"], "relevance" => $uri["relevance"]); } } // end foreach ($auxpagedata) // -------------------- // -- Massage $pagedata // -------------------- if (count($pagedata)) { // -------------------- // -- Keep only elements in $pagedata[] in the selected category in $pagedata[]["category"] // -------------------- if ($GLOBALS["QUERY"]["category"] != "") { $pagedata = array_filter($pagedata, create_function('$v', 'return ($v[\'category\'] != $GLOBALS[\'QUERY\'][\'category\']) ? false : true;')); $pagedata = array_values($pagedata); } // -------------------- // -- Sort $pagedata[] according to relevance // -------------------- usort($pagedata, create_function('$a, $b', 'return($a["relevance"]==$b["relevance"])?0:(($a["relevance"]>$b["relevance"])?-1:1);')); // -------------------- // -- Keep only $maxNoOfResultsToShow results in $pagedata[] // -------------------- // Alt 1: Keep number of results corresponding to 1/6 of total number of records // in database (here SEARCH_MAX_RETURNED_RESULTS is usually 0): /* keep -- $totalRows = $GLOBALS["searchClass"]->getTotalRows(); $maxNoOfResultsToShow = (SEARCH_MAX_RETURNED_RESULTS) ? SEARCH_MAX_RETURNED_RESULTS : max(5, min(100, ceil($totalRows / 6))); -- keep */ // Alt 2: Keep all results: $maxNoOfResultsToShow = NULL; $pagedata = array_slice($pagedata, 0, $maxNoOfResultsToShow); } // end if // -------------------- // -- Update statistics record in DB about this query // -------------------- //if (CACHE_SEARCH_QUERIES) $GLOBALS["searchClass"]->cacheUploadResultTo($pagedata); // -------------------- // -- Stop timer // Later used in: search::outputPageSearchBlurb() // -------------------- functions::timerStop("pageSearch"); // -------------------- return $pagedata; }
$uri['matchText'] = OS_outputFormat($uri['matchText'], $GLOBALS["QUERY"]['andor']); $uri['title'] = OS_outputFormat($uri['title'], $GLOBALS["QUERY"]['andor']); $uri['matchURI'] = (double) $GLOBALS["VDATA"]['s.weight'][4] > 0 ? OS_outputFormat($uri['uri'], $GLOBALS["QUERY"]['andor']) : $uri['uri']; $uri['description'] = OS_outputFormat($uri['description'], array()); // -------------------- // -- Remove paths that the current user has no access rights to see // ($uri['path'] added by HVZM) // -------------------- $uri['path'] = preg_replace("~http://[^/]*/~", "", str_replace("/index.php", "", $uri['uri'])); //if ($uri["relevance"]) debug::rr(array( "title" => $uri['title'], "description" => $uri['description'], "category" => $uri['category'], "uri" => $uri['uri'], "matchURI" => $uri['matchURI'], "path" => $uri['path'], "filetype" => $uri['ctype'], "matchText" => $uri['matchText'], "relevance" => $uri["relevance"]));echo "<br>".$uri["category"];var_dump(auth::isAccessGranted($GLOBALS["nw_categories"][$uri["category"]])); // $allpaths -- array with union of all sitemap info for entire site $allpaths = fromcache::get('allsitemap', '24', 'widget::WgetAllPaths'); if (!class_exists("auth", FALSE)) { require_once PATH_CLASSES . "/lib/auth.php"; } if ($uri["relevance"] && (isset($allpaths[$uri["path"]]["access"]) && !auth::isAccessGranted($allpaths[$uri["path"]]["access"]) || isset($GLOBALS["nw_categories"][$uri["category"]]) && !auth::isAccessGranted($GLOBALS["nw_categories"][$uri["category"]]))) { $uri["relevance"] = 0; } // -------------------- // -- Reduce weight of signature page paths: // -------------------- if ($uri["relevance"] && strpos($uri['uri'], "/signature/") !== false) { $uri["relevance"] = 0.1; } // -------------------- // -- Remove paths of single-user pages: // -------------------- //if ($uri["relevance"] && (strpos($uri['uri'],"u=")!==false)) $uri["relevance"] = 0; // -------------------- // -- If path has not been removed, create new element in $_RESULTS // --------------------
public static function Btopmenu($id = "topmenu", $blockclass = "", $liclass = "") { $stdout = ""; if (IS_ENTRANCE) { return ""; } $work = $GLOBALS["documentClass"]->getMenuThisTop(); $txt = ""; foreach ($work as $subpage) { if (auth::isAccessGranted($subpage["access"])) { if (!empty($subpage)) { $txt .= " <li class='" . (!empty($liclass) ? $liclass . " " : "") . ($subpage["active"] && !empty($subpage["path"]) ? "expanded" : "collapsed") . ($subpage["path"] == PUBLICCRUMB ? " last " : "") . "'><a href='" . $subpage["url"] . "'>" . str_replace(TEST_PREFIX, "", str_replace(EXTERNAL_LINK, "", $subpage["title"])) . "</a></li>\r\n"; } } } /* RESTORE if test tabs needed */ /* if (SHOW_TEST_TABS && IS_INDEXPAGE && ($GLOBALS["frontselect"]==10)) $txt = " <li style='float:none;height:auto;margin:0px;padding:2px 15px 0px 65px;text-decoration:none;font-size:1.4em;font-weight:normal;font-family:\"Baskerville\",\"Times\",\"Times New Roman\",serif;letter-spacing:0.2em;'>The Nordic Institute for Theoretical Physics</li>\r\n"; */ $stdout = " <div id='block-" . $id . "'" . (!empty($blockclass) ? " class='" . $blockclass . "'" : "") . ">\r\n" . " <ul>\r\n" . ($GLOBALS["documentClass"]->getConfig("requirelogin") && (!auth::isAuthenticated() || auth::isLogoutRequested()) ? "" : $txt) . " </ul>\r\n" . " </div> <!-- " . $id . " -->\r\n" . "\r\n"; return $stdout; }
private static function outputSitemapList($blank = "", $page = array()) { $stdout = ""; foreach ($page as $subpage) { if (isset($subpage["access"]) && auth::isAccessGranted($subpage["access"])) { $stdout .= empty($subpage) || !isset($subpage["url"]) || !isset($subpage["title"]) ? "" : $blank . " <li>" . "<a href='" . $subpage["url"] . "'" . (isset($subpage["nofollow"]) && $subpage["nofollow"] ? " rel='nofollow'" : "") . ">" . $subpage["title"] . "</a>"; if (isset($subpage["parent"]) && is_array($subpage["parent"])) { $stdout .= "\r\n" . $blank . " <ul>\r\n" . self::outputSitemapList($blank . " ", $subpage["parent"]) . $blank . " </ul>\r\n" . $blank . " "; } $stdout .= "</li>\r\n"; } // end if } // end foreach return $stdout; }