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


PHP UserProfile::isOnline方法代码示例

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


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

示例1: __construct

 public function __construct($data, $boxname = "")
 {
     if (!defined('BUDDIESBOX_SBCOLOR_ACP')) {
         define('BUDDIESBOX_SBCOLOR_ACP', 2);
     }
     if (!defined('BUDDIESBOX_SHOWDEL_ACP')) {
         define('BUDDIESBOX_SHOWDEL_ACP', false);
     }
     if (!defined('BUDDIESBOX_SHOWUSERMARKING_ACP')) {
         define('BUDDIESBOX_SHOWUSERMARKING_ACP', false);
     }
     if (!defined('BUDDIESBOX_SHOWONLYONLINE_ACP')) {
         define('BUDDIESBOX_SHOWONLYONLINE_ACP', true);
     }
     if (!defined('BUDDIESBOX_HIDEIFEMPTY_ACP')) {
         define('BUDDIESBOX_HIDEIFEMPTY_ACP', true);
     }
     $this->BuddiesData['templatename'] = "buddiesbox";
     $this->getBoxStatus($data);
     $this->BuddiesData['boxID'] = $data['boxID'];
     $this->BuddiesData['showBuddiesBox'] = false;
     //        $buddies = WCF::getUser()->buddies;
     if (WCF::getUser()->userID != 0) {
         require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
         $cnt = 0;
         $sql = "SELECT u.*, uo.*, wcg.*" . "\n  FROM wcf" . WCF_N . "_user_whitelist wcu" . "\n  JOIN wcf" . WCF_N . "_user u ON (u.userID = wcu.whiteUserID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = u.userOnlineGroupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID . "\n ORDER BY u.username";
         $result = WBBCore::getDB()->sendQuery($sql);
         while ($row = WBBCore::getDB()->fetchArray($result)) {
             $user = new UserProfile(null, $row);
             if (BUDDIESBOX_SHOWONLYONLINE_ACP && !$user->isOnline()) {
                 continue;
             }
             if ($user->isOnline()) {
                 $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.online', array('$username' => $row['username'])));
                 $this->BuddiesData['buddies'][$cnt]['img'] = 'onlineS.png';
             } else {
                 $this->BuddiesData['buddies'][$cnt]['imgTitle'] = StringUtil::decodeHTML(WCF::getLanguage()->get('wcf.user.offline', array('$username' => $row['username'])));
                 $this->BuddiesData['buddies'][$cnt]['img'] = 'offlineS.png';
             }
             if ($user->acceptPm) {
                 $this->BuddiesData['buddies'][$cnt]['pm'] = '1';
             } else {
                 $this->BuddiesData['buddies'][$cnt]['pm'] = '';
             }
             $this->BuddiesData['buddies'][$cnt]['userID'] = $row['userID'];
             $this->BuddiesData['buddies'][$cnt]['username'] = StringUtil::encodeHTML($row['username']);
             // userOnlineMarking...
             if (BUDDIESBOX_SHOWUSERMARKING_ACP && !empty($row['userOnlineMarking']) && $row['userOnlineMarking'] != '%s') {
                 $this->BuddiesData['buddies'][$cnt]['username'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML($row['username']));
             }
             $cnt++;
         }
         if ($cnt > 0 || !BUDDIESBOX_HIDEIFEMPTY_ACP) {
             $this->BuddiesData['showBuddiesBox'] = true;
         }
     }
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:57,代码来源:BuddiesBox.class.php

示例2: readEntries

 public function readEntries($sortField = 'updateDate', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
 {
     $ret = array();
     $i = 0;
     if (preg_match('/(userID|avatarID)/', $sortField)) {
         $sortField = 'u.' . $sortField;
     }
     require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
     require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
     $sql = "SELECT uwp.*, IFNULL(SUM(attachmentSize),0) + LENGTH(uwp.text) AS size, COUNT(attachmentID) AS aCnt, u.*, a.*, rank.*, uo.*" . "\n  FROM wcf" . WCF_N . "_user_wanted_poster uwp" . "\n  JOIN wcf" . WCF_N . "_user u ON u.userID = uwp.userID" . "\n  LEFT JOIN wcf" . WCF_N . "_attachment wat ON (wat.userID = uwp.userID AND wat.messageType = 'wantedPoster')" . "\n  LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)";
     if (!WCF::getUser()->getPermission('mod.wantedPoster.canLockEntries')) {
         $sql .= "\n WHERE uwp.locked != 1";
     }
     $sql .= "\n GROUP BY uwp.userID, uwp.insertDate, uwp.updateDate, uwp.text, uwp.views, uwp.enableSmilies, uwp.enableHtml, uwp.enableBBCodes, uwp.locked, uwp.lockDate, uwp.lockUser" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $ret[$i]['userID'] = $row['userID'];
         $ret[$i]['insertDate'] = $row['insertDate'];
         $ret[$i]['updateDate'] = $row['updateDate'];
         $ret[$i]['views'] = $row['views'];
         $ret[$i]['locked'] = $row['locked'];
         $ret[$i]['size'] = StringUtil::formatInteger($row['size']);
         $ret[$i]['aCnt'] = StringUtil::formatInteger($row['aCnt']);
         // username
         $user = new UserProfile(null, $row);
         $username = StringUtil::encodeHTML($row['username']);
         $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
         $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
         $userData['username'] = '<div class="containerIconSmall">';
         if ($user->isOnline()) {
             $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
         } else {
             $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/offlineS.png" alt="' . $title . '" title="' . $title . '" />';
         }
         $userData['username'] .= '</div><div class="containerContentSmall">';
         $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
         $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
         if ($user->getUserTitle()) {
             $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
         }
         $userData['username'] .= '</div>';
         $ret[$i]['username'] = $userData['username'];
         // avatar
         if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
             $avatar = new Avatar(null, $row);
             $avatar->setMaxHeight(50);
             $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
             $ret[$i]['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
         } else {
             $ret[$i]['avatar'] = '&nbsp;';
         }
         $i++;
     }
     return $ret;
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:57,代码来源:UserWantedPosterData.class.php

示例3: getMember

 /**
  * Returns the data of a member.
  * 
  * @param	array		$row
  * @return	array 
  */
 protected function getMember($row)
 {
     $user = new UserProfile(null, $row);
     $username = StringUtil::encodeHTML($row['username']);
     $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
     $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
     foreach ($this->activeFields as $field) {
         switch ($field) {
             // default fields
             case 'username':
                 $userData['username'] = '<div class="containerIconSmall">';
                 if ($user->isOnline()) {
                     $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
                     $userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('onlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
                 } else {
                     $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
                     $userData['username'] .= '<img src="' . StyleManager::getStyle()->getIconPath('offlineS.png') . '" alt="' . $title . '" title="' . $title . '" />';
                 }
                 $userData['username'] .= '</div><div class="containerContentSmall">';
                 $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
                 $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
                 if (MODULE_USER_RANK == 1 && $user->getUserTitle()) {
                     $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
                 }
                 $userData['username'] .= '</div>';
                 break;
             case 'registrationDate':
                 $userData['registrationDate'] = DateUtil::formatDate(null, $row['registrationDate']);
                 break;
             case 'lastActivity':
                 $userData['lastActivity'] = '';
                 if ($user->invisible != 1 || WCF::getUser()->getPermission('admin.general.canViewInvisible')) {
                     $userData['lastActivity'] = DateUtil::formatTime(null, $row['lastActivityTime']);
                 }
                 break;
             case 'avatar':
                 if ($user->getAvatar() && ($row['userID'] == WCF::getUser()->userID || WCF::getUser()->getPermission('user.profile.avatar.canViewAvatar'))) {
                     $user->getAvatar()->setMaxHeight(50);
                     $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
                     $userData['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $user->getAvatar()->__toString() . '</a>';
                 } else {
                     $userData['avatar'] = '';
                 }
                 break;
             case 'language':
                 if ($row['languageID'] && $row['languageCode']) {
                     $userData['language'] = '<img src="' . RELATIVE_WCF_DIR . 'icon/language' . ucfirst($row['languageCode']) . 'S.png" alt="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" title="' . WCF::getLanguage()->get('wcf.global.language.' . $row['languageCode']) . '" />';
                 } else {
                     $userData['language'] = '';
                 }
                 break;
                 // user options
             // user options
             default:
                 $userData[$field] = '';
                 $option = $this->userOptions->getOptionValue($field, $user);
                 if (!$protectedProfile && $option) {
                     $userData[$field] = $option['optionValue'];
                 }
         }
     }
     return $userData;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:69,代码来源:MembersListPage.class.php

示例4: getGuestbookList

 public function getGuestbookList($sortField = 'lastEntry', $sortOrder = 'DESC', $pageNo = 1, $itemsPerPage = 20)
 {
     $ret = array();
     $i = 0;
     $optID = self::getOptionID('userGuestbook_enable');
     if (preg_match('/(userID|avatarID)/', $sortField)) {
         $sortField = 'u.' . $sortField;
     }
     require_once WCF_DIR . 'lib/data/user/avatar/Avatar.class.php';
     $gbUserIDs = 0;
     $sql = "SELECT ugb.*, u.*, rank.*, a.*, uo.*, leu.username AS lastEntryUser, lv.username AS lastVisitor" . "\n  FROM wcf" . WCF_N . "_user_guestbook_header ugb" . "\n  JOIN wcf" . WCF_N . "_user u ON (u.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user leu ON (leu.userID = ugb.lastEntryUserID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user lv ON (lv.userID = ugb.visitorID)" . "\n  LEFT JOIN wcf" . WCF_N . "_avatar a ON (a.avatarID = u.avatarID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_rank rank ON (rank.rankID = u.rankID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value uo ON (uo.userID = u.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_option_value ov ON (ov.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_user_to_groups ug ON (ug.userID = ugb.userID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option_value gv ON (gv.groupID = ug.groupID)" . "\n  LEFT JOIN wcf" . WCF_N . "_group_option go ON (go.optionID = gv.optionID)" . "\n WHERE ov.userOption" . $optID . " = '1'" . "\n   AND gv.optionValue = '1'" . "\n   AND go.optionName = 'user.guestbook.canUseOwn'";
     if (!WCF::getUser()->getPermission('mod.guestbook.canLock')) {
         $sql .= "\n   AND ugb.locked != 1";
         $sql .= "\n   AND ugb.entries > 0";
     } else {
         $sql .= "\n   AND (ugb.locked = 1 OR ugb.entries > 0)";
     }
     $sql .= "\n GROUP BY ugb.userID, ugb.userLastVisit, ugb.lastEntryUserID, ugb.lastEntry, ugb.entries, ugb.newEntries, ugb.views, ugb.visitorID, ugb.visitorLastVisit, ugb.locked, ugb.lockTime, ugb.lockUserID" . "\n ORDER BY " . $sortField . " " . $sortOrder . "\n LIMIT " . $itemsPerPage . "\nOFFSET " . ($pageNo - 1) * $itemsPerPage;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $user = new UserProfile(null, $row);
         if (!$user->userGuestbook_enable) {
             continue;
         }
         $gbUserIDs .= ',' . $row['userID'];
         $ret[$i]['curUserEntry'] = false;
         $ret[$i]['userID'] = $row['userID'];
         $ret[$i]['userLastVisit'] = $row['userLastVisit'];
         $ret[$i]['userLastCommentTime'] = $row['userLastCommentTime'];
         $ret[$i]['lastEntry'] = $row['lastEntry'];
         $ret[$i]['visitorLastVisit'] = $row['visitorLastVisit'];
         $ret[$i]['entries'] = StringUtil::formatInteger($row['entries']);
         $ret[$i]['newEntries'] = StringUtil::formatInteger($row['newEntries']);
         $ret[$i]['views'] = StringUtil::formatInteger($row['views']);
         $ret[$i]['locked'] = $row['locked'];
         if (empty($row['lastEntryUser'])) {
             $ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUsername']);
             $ret[$i]['lastEntryUserID'] = 0;
         } else {
             $ret[$i]['lastEntryUser'] = StringUtil::encodeHTML($row['lastEntryUser']);
             $ret[$i]['lastEntryUserID'] = $row['lastEntryUserID'];
         }
         $ret[$i]['lastVisitor'] = StringUtil::encodeHTML($row['lastVisitor']);
         $ret[$i]['lastVisitorID'] = $row['visitorID'];
         // username
         $username = StringUtil::encodeHTML($row['username']);
         $protectedProfile = $user->protectedProfile && WCF::getUser()->userID != $user->userID;
         $userData = array('user' => $user, 'encodedUsername' => $username, 'protectedProfile' => $protectedProfile);
         $userData['username'] = '<div class="containerIconSmall">';
         if ($user->isOnline()) {
             $title = WCF::getLanguage()->get('wcf.user.online', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/onlineS.png" alt="' . $title . '" title="' . $title . '" />';
         } else {
             $title = WCF::getLanguage()->get('wcf.user.offline', array('$username' => $username));
             $userData['username'] .= '<img src="' . RELATIVE_WCF_DIR . 'icon/offlineS.png" alt="' . $title . '" title="' . $title . '" />';
         }
         $userData['username'] .= '</div><div class="containerContentSmall">';
         $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $username));
         $userData['username'] .= '<p><a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $username . '</a></p>';
         if ($user->getUserTitle()) {
             $userData['username'] .= '<p class="smallFont">' . $user->getUserTitle() . ' ' . ($user->getRank() ? $user->getRank()->getImage() : '') . '</p>';
         }
         $userData['username'] .= '</div>';
         $ret[$i]['username'] = $userData['username'];
         // avatar
         if (empty($row['disableAvatar']) && !empty($row['avatarID']) && !empty($row['avatarExtension'])) {
             $avatar = new Avatar(null, $row);
             $avatar->setMaxHeight(50);
             $title = WCF::getLanguage()->get('wcf.user.viewProfile', array('$username' => $row['username']));
             $ret[$i]['avatar'] = '<a href="index.php?page=User&amp;userID=' . $row['userID'] . SID_ARG_2ND . '" title="' . $title . '">' . $avatar->__toString() . '</a>';
         } else {
             $ret[$i]['avatar'] = '&nbsp;';
         }
         $i++;
     }
     if (!empty($gbUserIDs) && WCF::getUser()->userID) {
         $sql = "SELECT DISTINCT userID" . "\n  FROM wcf" . WCF_N . "_user_guestbook" . "\n WHERE userID IN (" . $gbUserIDs . ")" . "\n   AND fromUserID = " . WCF::getUser()->userID;
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             foreach ($ret as $k => $v) {
                 if ($ret[$k]['userID'] == $row['userID']) {
                     $ret[$k]['curUserEntry'] = true;
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:88,代码来源:UserGuestbookData.class.php


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