本文整理汇总了PHP中auth::isAccessGranted方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::isAccessGranted方法的具体用法?PHP auth::isAccessGranted怎么用?PHP auth::isAccessGranted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::isAccessGranted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
$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";
// --------------------
示例2: buildConfigOfPageUpdate
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"));
//.........这里部分代码省略.........
示例3: getPageSearch
//.........这里部分代码省略.........
// $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
示例4: OS_outputFormat
$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
// --------------------
示例5: Btopmenu
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;
}
示例6: outputSitemapList
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;
}