本文整理汇总了PHP中auth::isAuthenticated方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::isAuthenticated方法的具体用法?PHP auth::isAuthenticated怎么用?PHP auth::isAuthenticated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::isAuthenticated方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// -- REGIONS bar[top|right|bottom|left]
// -----------------------
$GLOBALS[SUBSITE]["regions"]["bartop"] = array();
if (SHOW_MYMENU) {
$GLOBALS[SUBSITE]["regions"]["bartop"][] = "block::BmyMenu('mymenu')";
}
$GLOBALS[SUBSITE]["regions"]["barright"] = array();
$GLOBALS[SUBSITE]["regions"]["barbottom"] = array();
$GLOBALS[SUBSITE]["regions"]["barleft"] = array();
// -----------------------
// -- REGION pagetop
// -----------------------
$GLOBALS[SUBSITE]["regions"]["pagetop"][] = "block::BskipToContent('skiptocontent','region-content')";
//$GLOBALS[SUBSITE]["regions"]["pagetop"][] = "block::BfeedLink('feed')"; // --> region-top
$GLOBALS[SUBSITE]["regions"]["pagetop"][] = "block::BloginForm('modalbox')";
if (!SHOW_MYMENU || !auth::isAuthenticated()) {
$GLOBALS[SUBSITE]["regions"]["pagetop"][] = "block::BloginLink('login')";
}
// -----------------------
// -- REGION banner
// -----------------------
$GLOBALS[SUBSITE]["regions"]["banner"][] = "block::Blogo('logo')";
// -----------------------
// -- REGION headlineleft
// -----------------------
$GLOBALS[SUBSITE]["regions"]["headlineleft"] = array();
if (IS_ENTRANCE) {
$GLOBALS[SUBSITE]["regions"]["headlineleft"] = array();
} elseif (!IS_INDEXPAGE && $this->getConfig("showsplash") && (!isset($_SESSION["splashimage"]) || $_SESSION["splashimage"])) {
// 1st parameter: 'sprite' or 'single':
$GLOBALS[SUBSITE]["regions"]["headlineleft"][] = "block::Bsplashimage('single','splashimage')";
示例2: drawLoginForm
public static function drawLoginForm($modal = false)
{
// -----------------------
// If myPear authentication fails, simulate login call in order to present
// login form again, with error message.
// -----------------------
if (!auth::isAuthenticated() && isset($_SESSION["mypear_auth_attempted"])) {
$_REQUEST["login"] = 1;
$GLOBALS["nw_loginerror"]["username"][] = "Please enter correct username and password";
unset($_SESSION["mypear_auth_attempted"]);
}
// -----------------------
// If page requests inline form, the $modal parameter should always be FALSE.
// -----------------------
if (self::isLoginType("inline")) {
$modal = false;
}
// -----------------------
// -- No output if no login required
// -----------------------
if (!self::isLoginRequired() && !self::isLoginAllowed()) {
return "";
}
// -----------------------
// -- No output if login allowed but not mandatory
// -----------------------
if (self::isLoginAllowed() && !self::isLoginRequested()) {
return "";
}
// -----------------------
// -- No output if login should be via link but no login requested from login link
// -----------------------
if (self::isLoginType("link") && !self::isLoginRequested()) {
return "";
}
// -----------------------
// -- No output if already authenticated
// -----------------------
if (self::isAuthenticated()) {
return "";
}
// -----------------------
// -- If authentication failed, set output parameters and then output the login form
// -----------------------
// -- set $error_msg
$error_msg = "";
if (isset($GLOBALS["nw_loginerror"])) {
foreach ($GLOBALS["nw_loginerror"] as $field => $msgs) {
$error_msg .= "<p>" . implode("</p><p>", $msgs) . "</p>";
}
}
$a = trim(strip_tags($error_msg));
if (empty($a)) {
$error_msg = "";
}
// -- set $action
// -----------------------
// -- Assemble pieces of login form
// -----------------------
$theform = " <form method='post' action='" . PATH_FROM_DOCROOT . "' " . "name='nw-login-form' id='nw-login-form'>\r\n" . " <table>\r\n" . (!empty($error_msg) ? " <tr>\r\n" . " <td colspan='3' " . "class='nw-login-error'" . ">" . $error_msg . "</td>\r\n" . " </tr>\r\n" : "") . " <tr>\r\n" . " <td><img src='" . PATH_IMG . "/auth_man.png' alt='Username'></td>\r\n" . " <td>Username:</td>\r\n" . " <td><input type='text' " . "name='auth_username' id='auth_username' " . "value='' size='25' " . "autofocus='autofocus'></td>\r\n" . " </tr>\r\n" . " <tr>\r\n" . " <td><img src='" . PATH_IMG . "/auth_key.png' alt='Password'></td>\r\n" . " <td>Password:</td>\r\n" . " <td><input type='password' " . "name='auth_password' id='auth_password' " . "value='' size='25'></td>\r\n" . " </tr>\r\n" . " <tr>\r\n" . " <td colspan='2'></td>\r\n" . " <td>" . "<input type='submit'" . " value='LOGIN'>" . "<input type='hidden' name='auth_submitted' value='1'>" . "<input type='hidden' name='login' value='1'>" . "</td>\r\n" . " </tr>\r\n" . " </table>\r\n" . " </form>\r\n";
return functions::drawReallyDothisBox($theform, "nw-login", "nw_modal_fade", $modal);
/*
$close_plainbox =
" <p><a href='" .
//( (!empty($GLOBALS["cb"])) ? urldecode($GLOBALS["cb"]) : "#" ) .
PATH_FROM_DOCROOT .
// $_SERVER["PHP_SELF"] .
"' onclick='" .
"document.getElementById(\"nw-login\").style.display=\"none\";" . //TODO: problems with " ?
"document.getElementById(\"nw_modal_fade\").style.display=\"none\";" . //TODO: problems with " ?
"'>" .
"close" .
"<img src='".PATH_IMG."/auth_close.png' alt='Close'>" .
"</a></p>\r\n";
$close_fancybox =
" <div>" .
"<a href='" .
PATH_FROM_DOCROOT .
// $_SERVER["PHP_SELF"] .
"' class='fancybox-close'" .
" title='close'" .
" onclick='" .
"document.getElementById(\"nw-login\").style.display=\"none\";" . //TODO: problems with " ?
"document.getElementById(\"nw_modal_fade\").style.display=\"none\";" . //TODO: problems with " ?
"'" .
">" .
"</a>" .
"</div>\r\n";
// -----------------------
// -- Output plain form or form in modal box
// -----------------------
if ($modal) {
return
" <div id='nw-login'>\r\n" .
// $close_plainbox .
$close_fancybox .
//.........这里部分代码省略.........
示例3: drawAddComment
//.........这里部分代码省略.........
unset($_SESSION["openid_identifier"]);
if (isset($GLOBALS["domain"])) {
unset($GLOBALS["domain"]);
}
}
if (OPENIDDEBUG && isset($_REQUEST["relog"])) {
echo "<br>openid_last_valid_identifier <strong>after relog</strong>= ";
var_dump($_SESSION["openid_last_valid_identifier"]);
}
functions::gpc_declare_input("openid_last_valid_identifier", "", false, array(), true);
if (OPENIDDEBUG) {
echo "<br>openid_last_valid_identifier <strong>after gpc</strong> = ";
var_dump($_SESSION["openid_last_valid_identifier"]);
}
if (OPENIDDEBUG) {
echo "<br>openid_last_valid_identifier <strong>when setting domain</strong> = ";
var_dump($_SESSION["openid_last_valid_identifier"]);
}
// -- Set domain of OpenID provider
$GLOBALS["domain"] = openid::setOpDomain();
if (OPENIDDEBUG) {
echo "<br>freshly set <strong>DOMAIN</strong> = ";
var_dump($GLOBALS["domain"]);
}
// -- Part of spam filter
functions::gpc_declare_input(HONEYTRAP_ID, "", false);
if (!empty($GLOBALS[HONEYTRAP_ID]) && isset($GLOBALS["addcmt"])) {
$GLOBALS["addcmt"] = false;
}
// sent to openid check
$_SESSION["articleid"] = !empty($GLOBALS["articleid"]) ? $GLOBALS["articleid"] : "";
$_SESSION["openid_return_url"] = $GLOBALS["openid_return_url"] = URL_PREFIX . $_SERVER["PHP_SELF"] . (!empty($GLOBALS["articleid"]) ? "?articleid=" . $GLOBALS["articleid"] : "") . "";
// -- Is user logged in to the news site
$loggedinas = auth::isAuthenticated() ? auth::getUsername() : false;
//if (OPENIDDEBUG) {echo "<br>SESSION AFTER: RETURN URL= ";if (isset($_SESSION["openid_return_url"])) var_dump($_SESSION["openid_return_url"]);echo "<br><br>GLOBALS CMT_TEXT=";var_dump($GLOBALS["cmt_text"]);echo "<br>GLOBALS ADDCMT=";var_dump($GLOBALS["addcmt"]);echo "<br>GLOBALS janrain_nonce=";var_dump($GLOBALS["janrain_nonce"]);}
// --------------------------------
// -- Check form input
// --------------------------------
if ($GLOBALS["addcmt"]) {
if (OPENIDDEBUG) {
echo "<h3>IN ADDCMT</h3>";
}
//echo "<p>openid_identifier=";var_dump($GLOBALS["openid_identifier"]);echo "<hr>"; echo "<p>openid_validation_error=";var_dump($GLOBALS["openid_validation_error"]);echo "<hr>";
// -- Trim indata
//TODO: spam filtering
//TODO: check HTML validity
//TODO: http://se.php.net/manual/en/function.strip-tags.php
//$GLOBALS["cmt_text"] = "<p>" . str_replace("\r","</p>\r<p>",$GLOBALS["cmt_text"]) . "</p>";
$allowed_html_tags = "";
// "<p> <a> <b> <i> <strong> <em> <br>";
$GLOBALS["cmt_text"] = strip_tags($GLOBALS["cmt_text"], $allowed_html_tags);
$GLOBALS["cmt_text"] = trim($GLOBALS["cmt_text"]);
$_SESSION["cmt_text"] = $GLOBALS["cmt_text"];
$_SESSION["cmt_name"] = $GLOBALS["cmt_name"];
//if (OPENIDDEBUG) {echo "<br>GLOBALS CMT_TEXT=";var_dump($GLOBALS["cmt_text"]);echo "<br>SESSION CMT_TEXT=";var_dump($_SESSION["cmt_text"]);}
// -- Check for errors in submitted comment text
if (empty($GLOBALS["cmt_text"])) {
$founderror["cmt_text"] = 1;
$errormessage["left"] .= "<p class='messages error'>Your comment looks quite empty</p>\r\n";
}
// -- Check for error messages from OpenId authentication call.
// Retrieved via session variable from page treated by CheckOpenid().
functions::gpc_declare_input("openid_validation_error", "", false, array(), true);
if (!empty($GLOBALS["openid_validation_error"])) {
$founderror["openid_identifier"] = 1;
$errormessage["right"] .= "<p class='messages error'>" . $GLOBALS["openid_validation_error"] . "</p>\r\n";
示例4: buildPageHtml
//.........这里部分代码省略.........
functions::gpc_declare_input("nw_screenresolution", false, true, array(), true);
if ($_SESSION["nw_screenresolution"]) {
$bodyattributes_class[] = "nw_screenresolution";
}
}
if ($this->getConfig("nolist")) {
$bodyattributes_class[] = "noindex";
}
/* RESTORE if test tabs needed */
/*
if (SHOW_TEST_TABS && isset($GLOBALS["frontselect"])) {
$bodyattributes_class[] = "frontselect".$GLOBALS["frontselect"];
} */
// --- SCRIPT
//$bodyattributes_script[] = "";
// --- TOTAL
if (isset($bodyattributes_class) && count($bodyattributes_class)) {
$bodyattributes .= " class='" . implode(" ", $bodyattributes_class) . "'";
}
if (isset($bodyattributes_script) && count($bodyattributes_script)) {
$bodyattributes .= implode(" ", $bodyattributes_script);
}
// --- ONLOAD
unset($bodyattributes_onload);
// ======================================================================
//TODO: these should be put in some config file
// initiate google map in colophon (call before 'focus'):
if (isInPath("googlemap")) {
$bodyattributes_onload[] = "initmap(\"googlemap-map-canvas\",12)";
}
// ======================================================================
// ======================================================================
//TODO: these should be put in some config file
if (auth::isLoginRequired() && !auth::isAuthenticated()) {
$bodyattributes_onload[] = "document.getElementById(\"auth_username\").focus()";
} elseif (SHOW_SEARCH && !$this->getConfig("nosearchfocus")) {
if (isInPath("/people/search/") && !isset($_REQUEST["pqry"])) {
$bodyattributes_onload[] = "document.getElementById(\"pqry\").focus()";
} elseif (SHOW_SEARCH && isInPath("/search/") && !isset($_REQUEST["qry"]) && !isset($_REQUEST["sqry"])) {
// orca search form
$bodyattributes_onload[] = "document.getElementById(\"qry\").focus()";
} else {
// simple search form
$bodyattributes_onload[] = "document.getElementById(\"sqry\").focus()";
// keep but don't use
}
} elseif ($this->getConfig("nosearchfocus") && !isset($_REQUEST["qry"]) && !isset($_REQUEST["sqry"]) && !isset($_REQUEST["pqry"])) {
if ((isInPath("/" . PATH_NEWS . "/") || isInPath("/" . PATH_NEWSTEST . "/")) && isset($_REQUEST["cmt_text"])) {
$bodyattributes_onload[] = "document.getElementById(\"cmt_text\").focus()";
} else {
// mainly captcha form
$bodyattributes_onload[] = "document.getElementById(\"" . CAPTCHA_ID . "\").focus()";
}
}
// ======================================================================
// $bodyattributes_onload[] = "window.location.reload(true)"; //NOP
if (isset($bodyattributes_onload) && !IS_PRINT) {
$bodyattributes .= " onLoad='" . implode(";", $bodyattributes_onload) . "'";
}
// ---
$stdout .= " <body" . $bodyattributes . (HIDE_BACKGROUND_IMAGE ? " style='background-image:none!important'" : "") . ">\r\n" . "\r\n";
//Only during test period:
$stdout .= TESTSERVER_FLAG;
//if (IS_TESTSERVER) $stdout.= "<h1 style='position:fixed;width:50%;margin:0;color:red;top:0px;left:0px;opacity:0.2'>[TESTSERVER]</h1>\r\n\r\n";
//if (IS_ON_KTH_SERVER) $stdout.= "<h1 style='position:fixed;width:50%;margin:0;color:red;top:0px;left:0px;opacity:0.2'>[VIRTUAL SERVER]</h1>\r\n\r\n";
// ---------------------------------------------------------------------------
示例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;
}