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


PHP auth::getUsername方法代码示例

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


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

示例1: 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,代码来源:

示例2: sendAnnouncementForm

 private static function sendAnnouncementForm($founderror = array(), $dbData = array())
 {
     $stdout = "";
     if (!$GLOBALS["send"] && !$GLOBALS["template_id"]) {
         return "<div class='col-content-1of3'>\r\n" . "  <h3><span class='green anfang'>1</span> Make sure the new newsletter " . "<span class='nowrap'>is ready</span> for publication</h3>\r\n" . "  <p>The issue to be released is ....</p>\r\n" . "  <p>[Not ready yet...]</p>\r\n" . "</div> <div class='col-content-2of3 divider'>\r\n" . "  <h3><span class='green anfang'>2</span> Check that the " . "list of e-mail subscriptions " . "<span class='nowrap'>is up to date</span></h3>\r\n" . "  <p style='margin-bottom:-1em'>There are currently</p>\r\n" . "  <p class='nowrap bold green' style='font-size:1.3em; " . "margin-bottom:-0.5em;text-indent:1em'>" . $GLOBALS["newsClass"]->getNumberOfSubscribers() . " active subscribers.</p>\r\n" . "  <p>You can <a href='" . SUBSITE . "/subscriptions/announcement_edit/index.php'><strong>view and " . "edit the list of subscribers</strong></a>. " . "Only subscriptions marked 'active' will receive " . "an announcement by e-mail.</p>\r\n" . "</div> <div class='col-content-3of3 divider'>\r\n" . "  <h3 class='bottommargin'><span class='green anfang'>3</span> Edit and<br>send the announcement e-mail</h3>\r\n" . "<form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='margin-bottom:2em;text-align:right'>\r\n" . "  <input type='submit' value='Continue to the e-mail form &#187;' class='fakelink h4'>\r\n" . "  <input type='hidden' name='template_id' value='1'>\r\n" . "</form>\r\n" . "</div><div style='clear:both'><br></div>\r\n" . "\r\n";
     }
     //debug::rrr();
     //debug::rr($dbData);
     $stdout .= "<div class='col-content-left1third'>\r\n";
     if (empty($dbData)) {
         $stdout .= "<p class='messages error bold'>There are no announcement templates. " . "Please write your own text in the form below.</p>\r\n";
     } else {
         $news_url = isInPath("/" . PATH_NEWSEDITTEST . "/") ? PATH_NEWSEDITTEST : PATH_NEWSEDIT;
         $stdout .= "<h3 class='bottommargin'>First select a " . "<a href='" . $news_url . "/subscriptions/announcement_template/index.php'>template</a>:</h3>\r\n";
         foreach ($dbData as $id => $data) {
             $stdout .= "<form method='post' action='" . $_SERVER["PHP_SELF"] . "'>\r\n" . "  <input type='submit' value='" . $data["title"] . "' " . "class='fakelink' style='font-size:1.2em;font-weight:bold'>\r\n" . (isset($data["isdefault"]) && $data["isdefault"] ? " <span style='color:black;font-weight:normal;font-style:italic;padding-left:0.5em'>[default]</span>" : "") . "  <input type='hidden' name='template_id' value='" . ($id + 1) . "'>\r\n" . "  <p" . " style='margin-left:2em;margin-top:0;font-style:italic;line-height:1.0;font-size:0.9em'" . ">&quot;" . functions::truncateStringByWord($data["text"], 120) . "...&quot;</p>\r\n" . "</form>\r\n";
         }
     }
     $stdout .= "</div> <div class='col right2of3'>\r\n";
     $stdout .= "<h3 class='bottommargin'>Then edit the message and send:</h3>\r\n";
     foreach ($founderror as $error) {
         $stdout .= "<p class='messages error bold'>&#187; " . $error . "</p>\r\n";
     }
     $stdout .= "<form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='margin-bottom:2em'>\r\n" . "  <table class='padding'>\r\n" . "    <tr>\r\n" . "      <td style='text-align:right;padding:0'><span class='red'>*</span></td>\r\n" . "      <td>Subject line:</td>\r\n" . "    </tr>\r\n" . "    <tr>\r\n" . "      <td></td>\r\n" . "      <td><input" . (isset($founderror["subject"]) ? " class='error'" : "") . "  type='text' name='subject' size='60' value='" . (!empty($GLOBALS["subject"]) ? $GLOBALS["subject"] : "") . "'></td>\r\n" . "    </tr>\r\n" . "    <tr>\r\n" . "      <td style='text-align:right;padding:0'><span class='red'>*</span></td>\r\n" . "      <td>Message:\r\n" . "      </td>\r\n" . "    </tr>\r\n" . "    <tr>\r\n" . "      <td></td>\r\n" . "      <td><textarea" . (isset($founderror["text"]) ? " class='error'" : "") . " name='text' rows='20' cols='55'>" . (!empty($GLOBALS["text"]) ? $GLOBALS["text"] : (isset($dbData[$GLOBALS["template_id"] - 1]) ? $dbData[$GLOBALS["template_id"] - 1]["text"] : "")) . "</textarea></td>\r\n" . "    </tr>\r\n" . "    <tr>\r\n" . "      <td colspan='3' style='text-align:right;padding-top:0.5em'>\r\n" . "        <input type='submit' value='Send Announcement Mail'>\r\n" . "        <input type='input' name='" . HONEYTRAP_ID . "' class='osynl'>\r\n" . "        <input type='hidden' name='send' value='1'>\r\n" . "      </td>\r\n" . "    </tr>\r\n" . "  </table>\r\n" . "</form>\r\n";
     if (NEWS_DEBUG) {
         $to = ($username = auth::getUsername()) && functions::isEmailAddress($username . "@nordita.org") ? $username . "@nordita.org" : "hvzm@nordita.org";
         $stdout .= "<h1 class='red'>TEST MODE!</h1>\r\n" . "<p class='red h4'>Actually only '<strong>" . $to . "</strong>' will get this mail</p>\r\n";
         //"<p>Only seleted beta testers actually get these mails</p>\r\n";
     }
     $stdout .= "</div><div style='clear:both'><br></div>\r\n";
     return $stdout;
 }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例3: drawManagePreprintsRegister

 public static function drawManagePreprintsRegister()
 {
     $stdout = "";
     $error = $warning = $confirm = array();
     if (!self::getRowEditRights($GLOBALS["pp_rowid"], auth::getUsername())) {
         return "<div class='medwide-box'>" . BLURB_SORRY_PREPRINT_NOTOWNER . "  </div> <!-- medwide-box -->\r\n";
     }
     // --------------------------------
     // -- OBTAIN DATA
     // --------------------------------
     $row = $GLOBALS["preprintClass"]->getPreprintByRowid($GLOBALS["pp_rowid"]);
     $ppn = self::getFullPpNumber($row["year"], $row["ppn"]);
     // --------------------------------
     // -- OUTPUT DATA
     // --------------------------------
     if (empty($GLOBALS["pp_rowid"]) || empty($row)) {
         $error[] = "WARNING: Could not register this preprint.";
     } else {
         // If basic data and archive copy seem to be ok, change status to 'registered' and
         // notify preprints secretary.
         if (empty($row["field"])) {
             $error[] = "A research field must be entered.";
         }
         if (empty($row["authors"])) {
             $error[] = "One or more authors must be entered.";
         }
         if (empty($row["title"])) {
             $error[] = "A title must be entered.";
         }
         if (empty($row["owneruid"])) {
             $error[] = "An entry owner must be entered.";
         }
         if (empty($row["location"]) && empty($row["journal"])) {
             $error[] = "A location address, submitted file or journal of publication must be entered.";
         }
         if (empty($error) && $GLOBALS["preprintClass"]->registerOnePreprint($GLOBALS["pp_rowid"])) {
             $stdout .= self::mail2secretary($row, "Registered");
             $confirm[] = "Your preprint has been registered, and is waiting for acceptance.";
             $GLOBALS["preprintClass"]->insertLogRow("register", $ppn, auth::getGecos($row["owneruid"]));
         } else {
             $error[] = "ERROR: Could not register this preprint.";
         }
     }
     if (!empty($error)) {
         $stdout .= functions::boxMessage("error", $error);
     }
     if (!empty($warning)) {
         $stdout .= functions::boxMessage("warning", $warning);
     }
     if (!empty($confirm)) {
         $stdout .= functions::boxMessage("confirm", $confirm);
     }
     $stdout .= self::drawCancelButton("Back to Preprints List") . (!empty($error) ? " &nbsp; " . self::drawFakeButton($_SERVER["PHP_SELF"] . "?" . "pp_period=" . $GLOBALS["pp_period"] . "&amp;pp_rowid=" . $GLOBALS["pp_rowid"] . "&amp;pp_editmode=" . PP_MODE_EDIT . "&amp;pp_managemode=" . $GLOBALS["pp_managemode"] . "&amp;pp_currentmode=" . $GLOBALS["pp_currentmode"], "Edit this preprint") : "") . self::drawSinglePreprint($GLOBALS["pp_rowid"], "singlepreprint");
     // --------------------------------
     return "  <div class='medwide-box'>\r\n" . "\r\n" . $stdout . "  </div> <!-- medwide-box -->\r\n" . "\r\n";
 }
开发者ID:,项目名称:,代码行数:56,代码来源:


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