当前位置: 首页>>代码示例>>PHP>>正文


PHP auth::isLoginRequired方法代码示例

本文整理汇总了PHP中auth::isLoginRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::isLoginRequired方法的具体用法?PHP auth::isLoginRequired怎么用?PHP auth::isLoginRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth的用法示例。


在下文中一共展示了auth::isLoginRequired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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";
     // ---------------------------------------------------------------------------
开发者ID:,项目名称:,代码行数:67,代码来源:

示例2: BmyMenu

 public static function BmyMenu($id = "mymenu", $class = "")
 {
     // class="centered"
     $stdout = $userIcon = $menuitems = $logoutLink = $contentblock = "";
     $menuitem = array();
     if (!defined("SEPARATE_LOGIN")) {
         define("SEPARATE_LOGIN", "<span style='color:#777' title='separate login required'>(&#8270;)</span> ");
     }
     // -------------------------------
     // -- check if bar might not be needed
     // -------------------------------
     if (!auth::isAuthenticated() && auth::isLoginType("inline") || auth::isLoginRequested() || !auth::isAuthenticated() && !auth::isLoginRequired() && !auth::isLoginAllowed() || $GLOBALS["documentClass"]->getConfig("nobanner")) {
         return "";
     }
     // -------------------------------
     // -- return with login icon if logout requested
     // -------------------------------
     if (auth::checkLogout()) {
         $stdout = auth::drawLoginLink();
         if (empty($stdout)) {
             return "";
         }
         return "        <div" . (!empty($id) ? " id='block-login'" : "") . ">\r\n" . $stdout . "        </div> <!-- " . $id . " -->\r\n" . "\r\n";
     }
     // -------------------------------
     // -- obtain data
     // -------------------------------
     $username = auth::getUsername();
     $userData = functions::callMethod('people', 'lib/people', 'getUserData', $username);
     $userFullName = isset($userData["nw_fullname"]) ? $userData["nw_fullname"] : "";
     // -------------------------------
     // -- collect output snippets
     // -------------------------------
     $iconfile = PATH_PEOPLE . "/48x48/" . $username . "-48.png";
     if (file_exists(INCLEVEL . $iconfile)) {
         $userIcon = "         <div class='my-usericon'>\r\n" . "           <a href='people/staff/index.php?u=" . $username . "'>" . "<img src='" . $iconfile . "' alt='" . $userFullName . "' title='" . $userFullName . "'>" . "</a>\r\n" . "         </div>\r\n" . "\r\n";
     }
     $logoutLink = "         <div id='my-logout'>\r\n" . "           <form method='post' action='" . PATH_FROM_DOCROOT . "'>\r\n" . "             <input type='hidden' name='login' value='0'>\r\n" . "             <input type='submit' value='[Logout]' class='fakelink bold'>\r\n" . "           </form>\r\n" . "         </div>\r\n" . "\r\n";
     $menuitem["fullname"] = array("label" => !empty($userFullName) ? $userFullName : "My Personal Data", "content" => array("1" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . "                  <p><em>Note that the &quot;Employees and Alumni&quot; (EA) database of Nordita is independent of the HR database of KTH, so you might want to check both.</em></p>\r\n" . "                  <ul>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=ea/356353008'>View and Edit My Personal Info</a> <span class='nowrap'>[CMS-EA]</span></li>\r\n" . "                  </ul>\r\n", "2" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . "                  <ul>\r\n" . "                  <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Edit My Home Address &amp;c</a><br><em>Egenrapportering &#8594; Mina&nbsp;Sidor &#8594; Mina&nbsp;Personuppgifter</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://login.kth.se/password/change?l=en' target='_blank'>Change My KTH Password</a></li>\r\n" . (!empty($userData["acc_kth"]) ? "                    <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/profile/" . $userData["acc_kth"] . "/' target='_blank'>Edit My KTH Online Profile</a></li>\r\n" : "") . "                    <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/internt/minasidor/installningar/mail.jsp?l=en_UK&null=' target='_blank'>Edit My E-Mail Forwarding Address</a></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://www.kth.se/internt/minasidor/installningar/mail.jsp?l=en_UK&null=' target='_blank'>Check My E-Mail Aliases</a></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://login.sys.kth.se/peapshow.html' target='_blank'>Show My Eduroam Password (&quot;Network Secret&quot;)</a></li>\r\n" . "                  </ul>\r\n", "3" => "                  <ul>\r\n" . "                    <li><a href='eduroam/'>Wireless Login Using Eduroam</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                  </ul>\r\n"));
     $menuitem["myemployment"] = array("label" => "My Employment", "content" => array("1" => "", "2" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . "                  <p><em>Note that some of the sevices below do not apply for Nordita fellows (=scholarships)</em></p>\r\n" . "                  <ul>\r\n" . "                    <li><a href='http://intra.kth.se/en/anstallning' target='_blank'>My Employment at KTH</a> (Overview)</li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://www.flexpay.se/fps/setLanguage.do?&amp;languageId=12' target='_blank'>Employment Benefits &quot;KTH&nbsp;For&nbsp;Me&quot;</a></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Salary Specification</a><br><em>Egenrapportering &#8594; Mina&nbsp;Sidor &#8594; Lönespec&nbsp;Online &#8594; check+button [lönespec&nbsp;online&nbsp;(presentation)]</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Vacation</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Ledigheter</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Sick Leave</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Sjuk&nbsp;&amp;&nbsp;Vård&nbsp;av...</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://hrweb.admin.kth.se/' target='_blank'>Register Overtime</a><br><em>Egenrapportering &#8594; Mina&nbsp;Ärenden &#8594; Övertid&nbsp;&amp;&nbsp;Mertid</em></li>\r\n" . "                  </ul>\r\n", "3" => "                  <ul>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                  </ul>\r\n"));
     $menuitem["mytravels"] = array("label" => "My Travels", "content" => array("1" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . "                  <ul>\r\n" . "                    <li><a href='" . URL_PREFIX . "/travel/' target='_blank'>View Nordita &quot;Who Is Where&quot; Travel Schedule</a></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='" . URL_PREFIX . "/travel/private/edit-confirm.php' target='_blank'>Edit My Travels in Nordita Travel Schedule</a></li>\r\n" . "                    <li><a href='intranet/job/travels/scholarship/request/' target='_blank'>Travel Request</a> (only for Nordita fellows/scholarships)</li>\r\n" . "                  </ul>\r\n", "2" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate KTH login required</em></p>\r\n" . "                  <p><em>The KTH-RES system should only be used by Nordita employees (not fellows/scholarships)</em></p>\r\n" . "                  <ul>\r\n" . "                    <li><a href='http://intra.kth.se/en/administration/kth-res' target='_blank'>KTH-RES</a> (Overview and Guides)</li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/' target='_blank'>Book New Travel</a> (only for employees)<br><em>Travel &#8594; Booking</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/' target='_blank'>Manage Travel Bills</a> (only for employees)<br><em>Travel &#8594; Travel&nbsp;bill</em></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='https://kth.ebuilder.se/ebbooking/profile/personprofile.do' target='_blank'>Edit My KTH-RES Profile</a></li>\r\n" . "                  </ul>\r\n", "3" => "                  <ul>\r\n" . "                    <li><a href='intranet/job/travels/'>Travel</a></li>\r\n" . "                    <li><a href='intranet/job/travels/employment/'>Travel for Employees</a></li>\r\n" . "                    <li><a href='intranet/job/travels/scholarship/'>Travel for Scholarships</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                  </ul>\r\n"));
     $menuitem["myguests"] = array("label" => "My Guests", "content" => array("1" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . "                  <ul>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/1735395761/1961830993'>See People I Invite</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/1735395761/1181421194'>Register New Guest</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . "                  </ul>\r\n", "2" => "", "3" => "                  <ul>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                  </ul>\r\n"));
     $menuitem["myevents"] = array("label" => "My Events", "content" => array("1" => "                  <p>" . SEPARATE_LOGIN . "<em>means separate CMS login required</em></p>\r\n" . "                  <ul>\r\n" . "                    <li>" . SEPARATE_LOGIN . "<a href='http://cms.nordita.org/?q=vm/3862121824'>Manage Events I Organize</a> <span class='nowrap'>[CMS-VM]</span></li>\r\n" . "                  </ul>\r\n", "2" => "", "3" => "                  <ul>\r\n" . "                    <li><a href='organizers/index.php'>For Organizers of Nordita Events</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                    <li><a href='" . $_SERVER["REQUEST_URI"] . "#'>Dummy Link...</a></li>\r\n" . "                  </ul>\r\n"));
     // -- NB.
     //    The three columns in the panels need to be realized as a <table> rather than as positioned
     //    <div> (eg. as <div class='col c1of3'> etc). For the jQuery UI tabs generated panels to have
     //    a non-zero height, the content must not be positioned as absolute, fixed or float; just
     //    position relative cannot generate three parallel columns; this leaves <table> as only option.
     foreach ($menuitem as $target => $item) {
         $menuitems .= "              <li class='" . $target . "'>" . "<a href='" . (!empty($item["url"]) ? $item["url"] : $_SERVER["REQUEST_URI"] . "#" . $target) . "'>" . $item["label"] . "</a>" . "</li>\r\n";
         if (!is_array($item["content"])) {
             $content = "              &nbsp;";
         } else {
             $content = "              <table><tr>\r\n" . "                <td>\r\n" . "                  <h4>Nordita</h4>\r\n" . (!empty($item["content"][1]) ? $item["content"][1] : "                  <p>&#8212;</p>\r\n") . "                </td>\r\n" . "                <td>\r\n" . "                  <h4>KTH</h4>\r\n" . (!empty($item["content"][2]) ? $item["content"][2] : "                  <p>&#8212;</p>\r\n") . "                </td>\r\n" . "                <td>\r\n" . "                  <h4>Nordita Help Pages</h4>\r\n" . (!empty($item["content"][3]) ? $item["content"][3] : "                  <p>&#8212;</p>\r\n") . "                </td>\r\n" . "              </tr></table>\r\n";
         }
         $contentblock .= "            <div id='" . $target . "'>\r\n" . $content . "            </div>\r\n" . "\r\n";
     }
     // -------------------------------
     // -- output data
     // -------------------------------
     $stdout = "      <div" . (!empty($id) ? " id='block-" . $id . "'" : "") . (!empty($class) ? " class='" . $class . "'" : "") . ">\r\n" . "\r\n" . "        <div>\r\n" . "\r\n" . $userIcon . "          <div id='my-tabs'>\r\n" . "\r\n" . "            <ul>\r\n" . $menuitems . "            </ul>\r\n" . "\r\n" . $contentblock . "          </div> <!-- my-tabs -->\r\n" . "\r\n" . $logoutLink . "        </div>\r\n" . "\r\n" . "      </div> <!-- " . $id . " -->\r\n" . "\r\n";
     return $stdout;
 }
开发者ID:,项目名称:,代码行数:63,代码来源:


注:本文中的auth::isLoginRequired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。