public function __construct($data, $boxname = "") { $this->TopData['templatename'] = "topthreads"; $this->getBoxStatus($data); $this->TopData['boxID'] = $data['boxID']; if (!defined('TOPTHREADS_COUNT')) { define('TOPTHREADS_COUNT', 10); } if (!defined('TOPTHREADS_TITLELENGTH')) { define('TOPTHREADS_TITLELENGTH', 25); } if (!defined('TOPTHREADS_SBCOLOR_ACP')) { define('TOPTHREADS_SBCOLOR_ACP', 2); } require_once WBB_DIR . 'lib/data/board/Board.class.php'; $boardIDs = Board::getAccessibleBoards(); if (!empty($boardIDs)) { $sql = "SELECT thread.*" . "\n FROM wbb" . WBB_N . "_thread thread" . "\n WHERE thread.boardID IN (0" . $boardIDs . ")" . "\n ORDER BY thread.replies DESC" . "\n LIMIT 0, " . TOPTHREADS_COUNT; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $row['replies'] = StringUtil::formatInteger($row['replies']); $row['title'] = StringUtil::encodeHTML($row['topic']) . ' - ' . $row['replies']; if (TOPTHREADS_TITLELENGTH != 0 && strlen($row['topic']) > TOPTHREADS_TITLELENGTH) { $row['topic'] = StringUtil::substring($row['topic'], 0, TOPTHREADS_TITLELENGTH - 3) . '...'; } $row['topic'] = StringUtil::encodeHTML($row['topic']); $this->TopData['threads'][] = $row; } } }
public function __construct($data, $boxname = "") { $this->TopData['templatename'] = "topthanksgivinguser"; $this->getBoxStatus($data); $this->TopData['boxID'] = $data['boxID']; if (!defined('TOPTHANKSGIVINGUSER_COUNT_ACP')) { define('TOPTHANKSGIVINGUSER_COUNT_ACP', 10); } if (!defined('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP')) { define('TOPTHANKSGIVINGUSER_TITLELENGTH_ACP', 28); } if (!defined('TOPTHANKSGIVINGUSER_SBCOLOR_ACP')) { define('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', 2); } if (!defined('TOPTHANKSGIVINGUSER_HITS_ACP')) { define('TOPTHANKSGIVINGUSER_HITS_ACP', true); } $sql = "SELECT wcf.userID, wcf.username, wbb.thanks_got" . "\n FROM wcf" . WCF_N . "_user wcf" . "\n LEFT JOIN wbb" . WBB_N . "_user wbb ON (wbb.userid = wcf.userid)" . "\n WHERE wbb.thanks_got > 0" . "\n ORDER BY wbb.thanks_got DESC, wcf.username" . "\n LIMIT 0, " . TOPTHANKSGIVINGUSER_COUNT_ACP; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $plainUser = $row['username']; $row['thanks_got'] = StringUtil::formatInteger($row['thanks_got']); if (TOPTHANKSGIVINGUSER_TITLELENGTH_ACP != 0 && strlen($plainUser) > TOPTHANKSGIVINGUSER_TITLELENGTH_ACP) { $row['username'] = StringUtil::substring($plainUser, 0, TOPTHANKSGIVINGUSER_TITLELENGTH_ACP - 3) . '...'; } $row['username'] = StringUtil::encodeHTML($row['username']); $this->TopData['thanksgivinguser'][] = $row; } WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_SBCOLOR_ACP', intval(TOPTHANKSGIVINGUSER_SBCOLOR_ACP)); WCF::getTPL()->assign('TOPTHANKSGIVINGUSER_HITS_ACP', TOPTHANKSGIVINGUSER_HITS_ACP); }
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; } } }
public function __construct($data, $boxname = "") { $this->threadLastPostsBoxData['templatename'] = "threadlastpostsbox"; $this->getBoxStatus($data); $this->threadLastPostsBoxData['boxID'] = $data['boxID']; $cntPosts = 0; if (!defined('THREADLASTPOSTSBOX_THREADID')) { define('THREADLASTPOSTSBOX_THREADID', 0); } if (!defined('THREADLASTPOSTSBOX_LIMIT')) { define('THREADLASTPOSTSBOX_LIMIT', 10); } if (!defined('THREADLASTPOSTSBOX_TITLELENGTH')) { define('THREADLASTPOSTSBOX_TITLELENGTH', 28); } if (!defined('THREADLASTPOSTSBOX_SBCOLOR')) { define('THREADLASTPOSTSBOX_SBCOLOR', 2); } require_once WBB_DIR . 'lib/data/board/Board.class.php'; $boardIDs = Board::getAccessibleBoards(); if (!empty($boardIDs) && THREADLASTPOSTSBOX_THREADID) { $sql = "SELECT wp.postID, wp.threadID, wp.userID, wp.subject, wp.message, wp.time" . "\n FROM wbb1_1_post wp" . "\n JOIN wbb1_1_thread wt ON (wt.threadID = wp.threadID)" . "\n WHERE wp.threadID = " . THREADLASTPOSTSBOX_THREADID . "\n AND wp.isDeleted = 0" . "\n AND wp.isDisabled = 0" . "\n AND wt.isDeleted = 0" . "\n AND wt.isDisabled = 0" . "\n AND wt.boardID IN (" . $boardIDs . ")" . "\n ORDER BY wp.postID DESC" . "\n LIMIT 0, " . THREADLASTPOSTSBOX_LIMIT; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { if (!empty($row['subject'])) { $title = $row['subject']; } else { $title = preg_replace('/\\[/', '<', $row['message']); $title = preg_replace('/\\]/', '>', $title); $title = strip_tags($title); //StringUtil::stripHTML($title); } if (THREADLASTPOSTSBOX_TITLELENGTH != 0 && StringUtil::length($title) > THREADLASTPOSTSBOX_TITLELENGTH) { $title = StringUtil::substring($title, 0, THREADLASTPOSTSBOX_TITLELENGTH - 3) . '...'; } $row['title'] = StringUtil::encodeHTML($title); $this->threadLastPostsBoxData['box'][] = $row; $cntPosts++; } } WCF::getTPL()->assign(array('THREADLASTPOSTSBOX_SBCOLOR' => intval(THREADLASTPOSTSBOX_SBCOLOR), 'threadLastPostBoxCnt' => $cntPosts)); }
public function __construct($data, $boxname = "") { $this->TopPosterData['templatename'] = "topposter"; $this->getBoxStatus($data); $this->TopPosterData['boxID'] = $data['boxID']; if (!defined('TOPPOSTER_COUNT')) { define('TOPPOSTER_COUNT', 10); } if (!defined('TOPPOSTER_SBCOLOR_ACP')) { define('TOPPOSTER_SBCOLOR_ACP', 2); } WCF::getTPL()->assign('TOPPOSTER_SBCOLOR_ACP', intval(TOPPOSTER_SBCOLOR_ACP)); $sql = "SELECT wcu.userid, wcu.username, wbu.posts" . "\n FROM wcf" . WCF_N . "_user wcu" . "\n LEFT JOIN wbb" . WBB_N . "_user wbu ON (wbu.userid = wcu.userid)" . "\n ORDER BY wbu.posts DESC, wcu.username" . "\n LIMIT 0, " . TOPPOSTER_COUNT; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $row['username'] = StringUtil::encodeHTML($row['username']); $row['posts'] = StringUtil::formatInteger($row['posts']); $this->TopPosterData['users'][] = $row; } }
/** * @see CacheBuilder::getData() */ public function getData($cacheResource) { $data = array(); $boardIDs = STICKYTOPICSBOX_BOARDIDS; $limit = STICKYTOPICSBOX_NUMOFENTRIES; $showClosed = STICKYTOPICSBOX_SHOWCLOSED; $sortField = STICKYTOPICSBOX_SORTFIELD; $permBoardIDs = Board::getAccessibleBoards(); if (empty($boardIDs) || empty($permBoardIDs)) { return $data; } $sql = "SELECT *" . "\n FROM wbb" . WBB_N . "_thread" . "\n WHERE isSticky = 1" . "\n AND boardID IN(" . $boardIDs . ")" . "\n AND boardID IN(" . $permBoardIDs . ")" . "\n AND isDeleted = 0" . "\n AND isDisabled = 0" . "\n AND movedThreadID = 0"; if (empty($showClosed)) { $sql .= "\n AND isClosed = 0"; } $sql .= " ORDER BY " . $sortField . " DESC" . "\n LIMIT " . $limit; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $data[] = $row; } return $data; }
public function __construct($data, $boxname = "") { $this->TopData['templatename'] = "topthanksgivingposts"; $this->getBoxStatus($data); $this->TopData['boxID'] = $data['boxID']; if (!defined('TOPTHANKSGIVING_COUNT_ACP')) { define('TOPTHANKSGIVING_COUNT_ACP', 10); } if (!defined('TOPTHANKSGIVING_TITLELENGTH_ACP')) { define('TOPTHANKSGIVING_TITLELENGTH_ACP', 28); } if (!defined('TOPTHANKSGIVING_SBCOLOR_ACP')) { define('TOPTHANKSGIVING_SBCOLOR_ACP', 2); } if (!defined('TOPTHANKSGIVING_HITS_ACP')) { define('TOPTHANKSGIVING_HITS_ACP', true); } require_once WBB_DIR . 'lib/data/board/Board.class.php'; $boardIDs = Board::getAccessibleBoards(); if (!empty($boardIDs)) { $sql = "SELECT thread.topic AS subject, MIN(post.postID) AS postID, COUNT(*) AS cnt" . "\n FROM wbb" . WBB_N . "_thread thread" . "\n LEFT JOIN (wbb" . WBB_N . "_post post, wbb" . WBB_N . "_thank_guests tg, wbb" . WBB_N . "_thank_user tu)" . "\n ON (post.threadID = thread.threadID AND (post.postID = tu.postID OR post.postID = tg.postID))" . "\n WHERE thread.isDisabled = 0" . "\n AND thread.isDeleted = 0" . "\n AND thread.boardID IN (" . $boardIDs . ")" . "\n AND post.isDeleted = 0" . "\n AND post.isDisabled = 0" . "\n GROUP BY thread.threadID" . "\n ORDER BY cnt DESC" . "\n LIMIT 0, " . TOPTHANKSGIVING_COUNT_ACP; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $plainSubject = $row['subject']; $row['thanks'] = StringUtil::formatInteger($row['cnt']); $row['title'] = StringUtil::encodeHTML($plainSubject) . ' - ' . $row['thanks']; if (TOPTHANKSGIVING_TITLELENGTH_ACP != 0 && strlen($plainSubject) > TOPTHANKSGIVING_TITLELENGTH_ACP) { $row['subject'] = StringUtil::substring($plainSubject, 0, TOPTHANKSGIVING_TITLELENGTH_ACP - 3) . '...'; } $row['subject'] = StringUtil::encodeHTML($row['subject']); $this->TopData['thanksgiving'][] = $row; } } WCF::getTPL()->assign('TOPTHANKSGIVING_SBCOLOR_ACP', intval(TOPTHANKSGIVING_SBCOLOR_ACP)); WCF::getTPL()->assign('TOPTHANKSGIVING_HITS_ACP', TOPTHANKSGIVING_HITS_ACP); }
public function __construct($data, $boxname = "") { $this->BoxData['templatename'] = "personalbox"; $this->getBoxStatus($data); $this->BoxData['boxID'] = $data['boxID']; // Instant Messenger by Tatzelwurm if (!defined('INSTANTMESSENGER_AKTIV')) { define('INSTANTMESSENGER_AKTIV', false); } $imcount = 0; $pbShowIM = false; if (!empty($_REQUEST['page'])) { $boxCurPage = $_REQUEST['page']; } else { $boxCurPage = 'Portal'; } // DEFAULTS $pbCatVertOffset = 4; $pbLargeRankImages = false; $pbRepeatRankImage = true; $pbRankImage = '<img src="' . RELATIVE_WCF_DIR . 'icon/userRank1S.png" alt="" title="' . WCF::getLanguage()->get('wcf.user.rank') . '" />'; $pbLineFeedRank = false; $pbFBColor = 1; $pbSBColor = 2; $pbShowUserMarking = true; $pbStyleWidth = 140; $pbShowProfileLink = false; $pbShowDisplayLink = false; $pbFirstColWidth = 20; $pbTableWidth = '99%'; $pbCellPadding = 0; $pbWeatherZipCode = '60329'; $pbWeatherComZipCode = 'DEPLZ,60329'; $pbWeatherStyle = 1; $pbWeatherComStyle = 4; $pbWeatherWidth = 140; $pbWeatherComDay = 'C'; $pbMaxHeight = 0; $pbShowAvatar = true; $pbAvatarMaxWidth = 150; $pbAvatarMaxHeight = 150; $pbShowPersonal = false; $pbShowSearch = true; $pbSearchDays = 0; $pbShowPM = true; $pbShowUserCP = true; $pbShowStyles = false; $pbShowMisc = false; $pbShowWeather = false; $pbShowWeatherCom = false; $pbShowProfileHits = false; // ACP Konstanten... if (!defined('PERSONALBOX_CATSPACER_ACP')) { define('PERSONALBOX_CATSPACER_ACP', $pbCatVertOffset); } if (!defined('PERSONALBOX_LARGERANKIMAGES_ACP')) { define('PERSONALBOX_LARGERANKIMAGES_ACP', $pbLargeRankImages); } if (!defined('PERSONALBOX_REPEATRANKIMAGE_ACP')) { define('PERSONALBOX_REPEATRANKIMAGE_ACP', $pbRepeatRankImage); } if (!defined('PERSONALBOX_STYLEBOXWIDTH_ACP')) { define('PERSONALBOX_STYLEBOXWIDTH_ACP', $pbStyleWidth); } if (!defined('PERSONALBOX_WEATHER_ZIPCODE_ACP')) { define('PERSONALBOX_WEATHER_ZIPCODE_ACP', $pbWeatherZipCode); } if (!defined('PERSONALBOX_WEATHERCOM_ZIPCODE_ACP')) { define('PERSONALBOX_WEATHERCOM_ZIPCODE_ACP', $pbWeatherComZipCode); } if (!defined('PERSONALBOX_WEATHER_STYLE_ACP')) { define('PERSONALBOX_WEATHER_STYLE_ACP', $pbWeatherStyle); } if (!defined('PERSONALBOX_WEATHERCOM_STYLE_ACP')) { define('PERSONALBOX_WEATHERCOM_STYLE_ACP', $pbWeatherComStyle); } if (!defined('PERSONALBOX_WEATHERCOM_DAY_ACP')) { define('PERSONALBOX_WEATHERCOM_DAY_ACP', $pbWeatherComDay); } if (!defined('PERSONALBOX_WEATHER_WIDTH_ACP')) { define('PERSONALBOX_WEATHER_WIDTH_ACP', $pbWeatherWidth); } if (!defined('PERSONALBOX_LINEFEEDRANK_ACP')) { define('PERSONALBOX_LINEFEEDRANK_ACP', $pbLineFeedRank); } if (!defined('PERSONALBOX_FBCOLOR_ACP')) { define('PERSONALBOX_FBCOLOR_ACP', $pbFBColor); } if (!defined('PERSONALBOX_SBCOLOR_ACP')) { define('PERSONALBOX_SBCOLOR_ACP', $pbSBColor); } if (!defined('PERSONALBOX_SHOWUSERMARKING_ACP')) { define('PERSONALBOX_SHOWUSERMARKING_ACP', $pbShowUserMarking); } if (!defined('PERSONALBOX_SHOWPROFILELINK_ACP')) { define('PERSONALBOX_SHOWPROFILELINK_ACP', $pbShowProfileLink); } if (!defined('PERSONALBOX_SHOWDISPLAYLINK_ACP')) { define('PERSONALBOX_SHOWDISPLAYLINK_ACP', $pbShowDisplayLink); } if (!defined('PERSONALBOX_FIRSTCOLWIDTH_ACP')) { define('PERSONALBOX_FIRSTCOLWIDTH_ACP', $pbFirstColWidth); } if (!defined('PERSONALBOX_TABLEWIDTH_ACP')) { define('PERSONALBOX_TABLEWIDTH_ACP', $pbTableWidth); } if (!defined('PERSONALBOX_CELLPADDING_ACP')) { define('PERSONALBOX_CELLPADDING_ACP', $pbCellPadding); } if (!defined('PERSONALBOX_MAXHEIGHT_ACP')) { define('PERSONALBOX_MAXHEIGHT_ACP', $pbMaxHeight); } if (!defined('PERSONALBOX_SHOW_AVATAR_ACP')) { define('PERSONALBOX_SHOW_AVATAR_ACP', $pbShowAvatar); } if (!defined('PERSONALBOX_AVATARMAXWIDTH_ACP')) { define('PERSONALBOX_AVATARMAXWIDTH_ACP', $pbAvatarMaxWidth); } if (!defined('PERSONALBOX_AVATARMAXHEIGHT_ACP')) { define('PERSONALBOX_AVATARMAXHEIGHT_ACP', $pbAvatarMaxHeight); } if (!defined('PERSONALBOX_SHOW_PERSONAL_ACP')) { define('PERSONALBOX_SHOW_PERSONAL_ACP', $pbShowPersonal); } if (!defined('PERSONALBOX_SHOW_SEARCH_ACP')) { define('PERSONALBOX_SHOW_SEARCH_ACP', $pbShowSearch); } if (!defined('PERSONALBOX_SEARCH_DAYS_ACP')) { define('PERSONALBOX_SEARCH_DAYS_ACP', $pbSearchDays); } if (!defined('PERSONALBOX_SHOW_PM_ACP')) { define('PERSONALBOX_SHOW_PM_ACP', $pbShowPM); } if (!defined('PERSONALBOX_SHOW_USERCP_ACP')) { define('PERSONALBOX_SHOW_USERCP_ACP', $pbShowUserCP); } if (!defined('PERSONALBOX_SHOW_STYLES_ACP')) { define('PERSONALBOX_SHOW_STYLES_ACP', $pbShowStyles); } if (!defined('PERSONALBOX_SHOW_MISC_ACP')) { define('PERSONALBOX_SHOW_MISC_ACP', $pbShowMisc); } if (!defined('PERSONALBOX_WEATHER_SHOW_ACP')) { define('PERSONALBOX_WEATHER_SHOW_ACP', $pbShowWeather); } if (!defined('PERSONALBOX_WEATHERCOM_SHOW_ACP')) { define('PERSONALBOX_WEATHERCOM_SHOW_ACP', $pbShowWeatherCom); } if (!defined('PERSONALBOX_SHOW_IM_ACP')) { define('PERSONALBOX_SHOW_IM_ACP', false); } if (!defined('PERSONALBOX_SHOW_PROFILEHITS_ACP')) { define('PERSONALBOX_SHOW_PROFILEHITS_ACP', $pbShowProfileHits); } if (WCF::getUser()->userID != 0) { // Include libraries... require_once WBB_DIR . 'lib/data/board/Board.class.php'; require_once WCF_DIR . 'lib/data/user/UserProfile.class.php'; // Boxen Hoehe if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMaxheight') && (WCF::getUser()->personalbox_maxheight >= 100 || WCF::getUser()->personalbox_maxheight == 0 || WCF::getUser()->personalbox_maxheight == 1)) { $pbMaxHeight = intval(WCF::getUser()->personalbox_maxheight); } else { if (PERSONALBOX_MAXHEIGHT_ACP >= 100) { $pbMaxHeight = PERSONALBOX_MAXHEIGHT_ACP; } } // Avatar if (WCF::getUser()->getPermission('user.profile.personalbox.canSetAvatar') && WCF::getUser()->personalbox_show_avatar == 'enabled') { $pbShowAvatar = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetAvatar') && WCF::getUser()->personalbox_show_avatar == 'disabled') { $pbShowAvatar = false; } else { $pbShowAvatar = PERSONALBOX_SHOW_AVATAR_ACP; } } // Persoenliches if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPersonal') && WCF::getUser()->personalbox_show_personal == 'enabled') { $pbShowPersonal = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPersonal') && WCF::getUser()->personalbox_show_personal == 'disabled') { $pbShowPersonal = false; } else { $pbShowPersonal = PERSONALBOX_SHOW_PERSONAL_ACP; } } // Beitraege if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_show_search == 'enabled') { $pbShowSearch = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_show_search == 'disabled') { $pbShowSearch = false; } else { $pbShowSearch = PERSONALBOX_SHOW_SEARCH_ACP; } } // Private Nachrichten if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPM') && WCF::getUser()->personalbox_show_pm == 'enabled') { $pbShowPM = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetPM') && WCF::getUser()->personalbox_show_pm == 'disabled') { $pbShowPM = false; } else { $pbShowPM = PERSONALBOX_SHOW_PM_ACP; } } // Verwaltung if (WCF::getUser()->getPermission('user.profile.personalbox.canSetUserCP') && WCF::getUser()->personalbox_show_usercp == 'enabled') { $pbShowUserCP = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetUserCP') && WCF::getUser()->personalbox_show_usercp == 'disabled') { $pbShowUserCP = false; } else { $pbShowUserCP = PERSONALBOX_SHOW_USERCP_ACP; } } // Style if (WCF::getUser()->getPermission('user.profile.personalbox.canSetStyle') && WCF::getUser()->personalbox_show_styles == 'enabled') { $pbShowStyles = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetStyle') && WCF::getUser()->personalbox_show_styles == 'disabled') { $pbShowStyles = false; } else { $pbShowStyles = PERSONALBOX_SHOW_STYLES_ACP; } } $pbStyles = array(); if ($pbShowStyles && defined('PERSONALBOX_CNTSTYLES_ACP') && PERSONALBOX_CNTSTYLES_ACP == true) { $i = $isDefaultIdx = $cntDisabled = 0; $sql = "SELECT s.styleID, s.styleName, s.isDefault, s.disabled, COUNT(u.userID) AS CNT" . "\n FROM wcf" . WCF_N . "_style s" . "\n LEFT JOIN wcf" . WCF_N . "_user u ON (u.styleID = s.styleID OR (u.styleID = 0 AND isDefault = 1))" . "\n GROUP BY styleID, styleName, isDefault, disabled" . "\n ORDER BY styleName"; $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { $pbStyles[$i]['ID'] = $row['styleID']; $pbStyles[$i]['NAME'] = $row['styleName']; $pbStyles[$i]['DEFAULT'] = $row['isDefault']; $pbStyles[$i]['DISABLED'] = $row['disabled']; $pbStyles[$i]['CNT'] = $row['CNT']; if (!empty($row['isDefault'])) { $isDefaultIdx = $i; } if (!empty($row['disabled'])) { $cntDisabled += $row['CNT']; } $i++; } if ($cntDisabled > 0 && isset($pbStyles[$isDefaultIdx])) { $pbStyles[$isDefaultIdx]['CNT'] += $cntDisabled; } } // Sonstiges if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMisc') && WCF::getUser()->personalbox_show_misc == 'enabled') { $pbShowMisc = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetMisc') && WCF::getUser()->personalbox_show_misc == 'disabled') { $pbShowMisc = false; } else { $pbShowMisc = PERSONALBOX_SHOW_MISC_ACP; } } $pbLinks = array(); if ($pbShowMisc && defined('PERSONALBOX_LINKLIST_ACP') && PERSONALBOX_LINKLIST_ACP != '' && preg_match('/\\|/', PERSONALBOX_LINKLIST_ACP)) { $linkList = preg_split("/\r?\n/", PERSONALBOX_LINKLIST_ACP); $i = 0; foreach ($linkList as $line) { $line = trim($line); if (preg_match("/\\{SPACER\\}/", $line)) { $pbLinks[$i]['TYPE'] = 'SPACER'; $pbLinks[$i]['SPACER'] = preg_replace("/\\{SPACER\\}(.*)\\{\\/SPACER\\}/i", "\$1", $line); $i++; } else { if (preg_match("/\\|/", $line)) { list($img, $url, $title, $target, $perm) = preg_split("/\\|/", $line, 5); $img = trim($img); $url = trim($url); $title = trim($title); $target = trim($target); $perm = trim($perm); if (!empty($url) && !empty($title)) { if (preg_match("/\\{\\@?RELATIVE_WBB_DIR\\}/", $img) && defined('RELATIVE_WBB_DIR')) { $img = preg_replace("/{\\@?RELATIVE_WBB_DIR\\}/", RELATIVE_WBB_DIR, $img); } if (preg_match("/\\{\\@?RELATIVE_WCF_DIR\\}/", $img) && defined('RELATIVE_WCF_DIR')) { $img = preg_replace("/{\\@?RELATIVE_WCF_DIR\\}/", RELATIVE_WCF_DIR, $img); } if (preg_match("/\\{\\@?RELATIVE_WBB_DIR\\}/", $url) && defined('RELATIVE_WBB_DIR')) { $url = preg_replace("/{\\@?RELATIVE_WBB_DIR\\}/", RELATIVE_WBB_DIR, $url); } if (preg_match("/\\{\\@?RELATIVE_WCF_DIR\\}/", $url) && defined('RELATIVE_WCF_DIR')) { $url = preg_replace("/{\\@?RELATIVE_WCF_DIR\\}/", RELATIVE_WCF_DIR, $url); } if (preg_match("/\\{\\@?SECURITY_TOKEN\\}/", $url) && defined('SECURITY_TOKEN')) { $url = preg_replace("/{\\@?SECURITY_TOKEN\\}/", SECURITY_TOKEN, $url); } if (preg_match("/\\{\\@?PACKAGE_ID\\}/", $url) && defined('PACKAGE_ID')) { $url = preg_replace("/{\\@?PACKAGE_ID\\}/", PACKAGE_ID, $url); } if (preg_match("/\\{\\@?SID_ARG_2ND\\}/", $url) && defined('SID_ARG_2ND')) { $url = preg_replace("/{\\@?SID_ARG_2ND\\}/", SID_ARG_2ND, $url); } if (preg_match("/\\{\\@?USER_ID\\}/", $url)) { $url = preg_replace("/{\\@?USER_ID\\}/", WCF::getUser()->userID, $url); } $pbLinks[$i]['TYPE'] = 'LINK'; $pbLinks[$i]['IMG'] = $img; $pbLinks[$i]['URL'] = $url; $pbLinks[$i]['TITLE'] = $title; $pbLinks[$i]['TARGET'] = $target; $pbLinks[$i]['PERM'] = $perm; $i++; } } } } } // Wetter if (WCF::getUser()->getPermission('user.profile.personalbox.enableWeather')) { // Donnerwetter if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weather_enabled == 'enabled') { $pbShowWeather = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weather_enabled == 'disabled') { $pbShowWeather = false; } else { $pbShowWeather = PERSONALBOX_WEATHER_SHOW_ACP; } } // PLZ fuer Donnerwetter if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherZip') && preg_match("/^[0-9]{4,5}\$/", WCF::getUser()->personalbox_weather_zipcode)) { $pbWeatherZipCode = WCF::getUser()->personalbox_weather_zipcode; } else { if (preg_match("/^[0-9]{4,5}\$/", PERSONALBOX_WEATHER_ZIPCODE_ACP)) { $pbWeatherZipCode = PERSONALBOX_WEATHER_ZIPCODE_ACP; } } // Style fuer Donnerwetter... if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^1|2\$/", WCF::getUser()->personalbox_weather_style)) { $pbWeatherStyle = WCF::getUser()->personalbox_weather_style; } else { if (preg_match("/^1|2\$/", PERSONALBOX_WEATHER_STYLE_ACP)) { $pbWeatherStyle = PERSONALBOX_WEATHER_STYLE_ACP; } } // wetter.com if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weathercom_enabled == 'enabled') { $pbShowWeatherCom = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeather') && WCF::getUser()->personalbox_weathercom_enabled == 'disabled') { $pbShowWeatherCom = false; } else { $pbShowWeatherCom = PERSONALBOX_WEATHERCOM_SHOW_ACP; } } if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherZip') && preg_match("/^.*\\,.*\$/", WCF::getUser()->personalbox_weathercom_zipcode)) { $pbWeatherComZipCode = WCF::getUser()->personalbox_weathercom_zipcode; } else { if (preg_match("/^.*\\,.*\$/", PERSONALBOX_WEATHERCOM_ZIPCODE_ACP)) { $pbWeatherComZipCode = PERSONALBOX_WEATHERCOM_ZIPCODE_ACP; } } if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^[1-5]\$/", WCF::getUser()->personalbox_weathercom_style)) { $pbWeatherComStyle = WCF::getUser()->personalbox_weathercom_style; } else { if (preg_match("/^[1-5]\$/", PERSONALBOX_WEATHERCOM_STYLE_ACP)) { $pbWeatherComStyle = PERSONALBOX_WEATHERCOM_STYLE_ACP; } } if (WCF::getUser()->getPermission('user.profile.personalbox.canSetWeatherStyle') && preg_match("/^Z|C|F\$/", WCF::getUser()->personalbox_weathercom_day)) { $pbWeatherComDay = WCF::getUser()->personalbox_weathercom_day; } else { if (preg_match("/^Z|C|F\$/", PERSONALBOX_WEATHERCOM_DAY_ACP)) { $pbWeatherComDay = PERSONALBOX_WEATHERCOM_DAY_ACP; } } } // setze Timestamp genau auf 0.00 Uhr... if (WCF::getUser()->getPermission('user.profile.personalbox.canSetCurPosts') && WCF::getUser()->personalbox_search_days != 'default') { $pbSearchDays = intval(WCF::getUser()->personalbox_search_days); } else { $pbSearchDays = PERSONALBOX_SEARCH_DAYS_ACP; } if ($pbSearchDays == 0) { $itstamp = time(); } else { $itstamp = time() - $pbSearchDays * 86400; } $searchTime = mktime(0, 0, 0, (int) date("m", $itstamp), (int) date("d", $itstamp), (int) date("Y", $itstamp)); // Hintergrundfarbe fuer Donnerwetter... if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_BGCOLOR_ACP)) { $bgColor = strtoupper(PERSONALBOX_WEATHER_BGCOLOR_ACP); } else { $bgColor = strtoupper(WBBCore::getStyle()->getVariable('container1.background.color')); $bgColor = preg_replace("/\\#/", "", $bgColor); if (strlen($bgColor) < 6 && strlen($bgColor) > 0) { $bgColor = str_pad($bgColor, 6, substr($bgColor, -1, 1)); } } // Rahmenfarbe fuer Donnerwetter... if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_BOCOLOR_ACP)) { $boColor = strtoupper(PERSONALBOX_WEATHER_BOCOLOR_ACP); } else { $boColor = $bgColor; } // Textfarbe fuer Donnerwetter... if (preg_match("/^[a-f0-9]{6}\$/i", PERSONALBOX_WEATHER_TEXTCOLOR_ACP)) { $textColor = strtoupper(PERSONALBOX_WEATHER_TEXTCOLOR_ACP); } else { $textColor = strtoupper(WBBCore::getStyle()->getVariable('container1.font.color')); $textColor = preg_replace("/\\#/", "", $textColor); if (strlen($textColor) < 6 && strlen($textColor) > 0) { $textColor = str_pad($textColor, 6, substr($textColor, -1, 1)); } } // Standardfarben, falls bis hierhin keine zugeordnet... if (empty($bgColor)) { $bgColor = 'FFFFFF'; } if (empty($boColor)) { $boColor = 'FFFFFF'; } if (empty($textColor)) { $textColor = '000000'; } $boardIDs = Board::getAccessibleBoards(); $user = new UserProfile(WCF::getUser()->userID); // RANK if ($user->rankImage) { if (PERSONALBOX_REPEATRANKIMAGE_ACP && $user->repeatImage) { $pbRankImage = ''; for ($i = 0; $i < $user->repeatImage; $i++) { $pbRankImage .= '<img src="' . RELATIVE_WCF_DIR . $user->rankImage . '" alt="" title="' . WCF::getLanguage()->get($user->rankTitle) . '" />'; } } else { $pbRankImage = '<img src="' . RELATIVE_WCF_DIR . $user->rankImage . '" alt="" title="' . WCF::getLanguage()->get($user->rankTitle) . '" />'; } } $user->username = StringUtil::encodeHTML(WCF::getUser()->username); $user->searchTime = $searchTime; $user->bgColor = $bgColor; $user->boColor = $boColor; $user->textColor = $textColor; $user->posts = 0; $user->cntNewPosts = 0; $user->cntLastPosts = 0; $user->cntReported = 0; $user->cntSub = 0; if (WCF::getUser()->getPermission('user.profile.personalbox.cntOwnPosts')) { // Anzahl Postings... $sql = "SELECT wbu.posts" . "\n FROM wbb" . WBB_N . "_user wbu" . "\n WHERE wbu.userid = " . WCF::getUser()->userID; $result = WBBCore::getDB()->getFirstRow($sql); $user->posts = StringUtil::formatInteger($result['posts']); } // Instant Messenger by Tatzelwurm if (INSTANTMESSENGER_AKTIV && (WCF::getUser()->getPermission('user.board.instantmessenger.canUseInstantMessenger') || WCF::getUser()->getPermission('user.instantmessenger.canUseInstantMessenger'))) { if (@(require_once WCF_DIR . 'lib/data/InstantMessage/IM.class.php')) { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetIM') && WCF::getUser()->personalbox_show_im == 'enabled') { $pbShowIM = true; } else { if (WCF::getUser()->getPermission('user.profile.personalbox.canSetIM') && WCF::getUser()->personalbox_show_im == 'disabled') { $pbShowIM = false; } else { $pbShowIM = PERSONALBOX_SHOW_IM_ACP; } } $imcount = IM::countNewIM(); } } // userOnlineMarking... if (PERSONALBOX_SHOWUSERMARKING_ACP) { $sql = "SELECT wcg.userOnlineMarking" . "\n FROM wcf" . WCF_N . "_group wcg" . "\n JOIN wcf" . WCF_N . "_user wcu ON (wcu.userOnlineGroupID = wcg.groupID)" . "\n WHERE wcu.userID = " . WCF::getUser()->userID; $result = WBBCore::getDB()->getFirstRow($sql); $userOnlineMarking = $result['userOnlineMarking']; if ($userOnlineMarking && $userOnlineMarking != '%s') { $user->username = sprintf($userOnlineMarking, StringUtil::encodeHTML(WCF::getUser()->username)); } } // neue Beitraege seit letztem Besuch und n Tagen, Abonnements... if ($pbShowSearch) { if (WCF::getUser()->getPermission('user.profile.personalbox.cntCurPosts')) { $sql = "SELECT COUNT(*) cntNewPosts" . "\n FROM wbb" . WBB_N . "_thread wbt" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n AND wbt.lastPostTime >= " . WCF::getUser()->boardLastActivityTime; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntNewPosts = $result['cntNewPosts']; } if (WCF::getUser()->getPermission('user.profile.personalbox.cntLastPosts')) { $sql = "SELECT COUNT(*) cntLastPosts" . "\n FROM wbb" . WBB_N . "_thread wbt" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n AND wbt.lastPostTime >= " . $searchTime; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntLastPosts = $result['cntLastPosts']; } if (WCF::getUser()->getPermission('user.profile.personalbox.cntSubscriptions')) { $sql = "SELECT COUNT(*) AS newSubscriptions" . "\n FROM wbb" . WBB_N . "_thread_subscription subscription" . "\n JOIN wbb" . WBB_N . "_thread thread ON (thread.threadID = subscription.threadID)" . "\n JOIN\twbb" . WBB_N . "_thread_visit thread_visit ON (thread_visit.threadID = subscription.threadID AND subscription.userID = thread_visit.userID)" . "\n JOIN\twbb" . WBB_N . "_board_visit board_visit ON (board_visit.boardID = thread.boardID AND subscription.userID = board_visit.userID)" . "\n WHERE subscription.userID = " . WCF::getUser()->userID . "\n AND thread_visit.lastVisitTime < thread.lastPostTime" . "\n AND (thread_visit.lastVisitTime > board_visit.lastVisitTime" . "\n OR board_visit.lastVisitTime < thread.lastPostTime" . "\n OR board_visit.lastVisitTime IS NULL)" . "\n GROUP BY subscription.userID"; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntSub = intval($result['newSubscriptions']); } } // Moderation... if ($pbShowUserCP && (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canDeleteThreadCompletely') || WCF::getUser()->getPermission('mod.board.canDeletePostCompletely') || WCF::getUser()->getPermission('mod.board.canEnablePost') || WCF::getUser()->getPermission('mod.board.canEnableThread'))) { if (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canEnablePost') || WCF::getUser()->getPermission('mod.board.canEnableThread')) { $sql = "SELECT COUNT(*) cntReported" . "\n FROM wbb" . WBB_N . "_post_report wbr"; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntReported = $result['cntReported']; } if (WCF::getUser()->getPermission('admin.general.canUseAcp') || WCF::getUser()->getPermission('mod.board.canDeleteThreadCompletely') || WCF::getUser()->getPermission('mod.board.canDeletePostCompletely')) { $sql = "SELECT COUNT(*) cntTrash" . "\n FROM wbb" . WBB_N . "_post wbp" . "\n JOIN wbb" . WBB_N . "_thread wbt ON (wbt.threadID = wbp.threadID)" . "\n WHERE wbt.boardID IN (0" . $boardIDs . ")" . "\n AND (wbp.isDeleted > 0 OR wbt.isDeleted > 0)"; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntTrash = $result['cntTrash']; } } // Guestbook $user->cntGB = 0; if (WCF::getUser()->getPermission('user.guestbook.canUseOwn')) { $sql = "SELECT entries, userLastVisit, lastEntry" . "\n FROM wcf" . WCF_N . "_user_guestbook_header" . "\n WHERE userID = " . WCF::getUser()->userID; $result = WBBCore::getDB()->getFirstRow($sql); $user->cntGB = empty($result['entries']) ? 0 : $result['entries']; if (!empty($result['lastEntry']) && $result['lastEntry'] > $result['userLastVisit']) { $user->newGB = true; } else { $user->newGB = false; } } $this->BoxData['user'] = $user; } // Template Variablen zuordnen... WCF::getTPL()->assign(array('pbCatVertOffset' => intval(PERSONALBOX_CATSPACER_ACP), 'pbFirstBoxColor' => intval(PERSONALBOX_FBCOLOR_ACP), 'pbSecondBoxColor' => intval(PERSONALBOX_SBCOLOR_ACP), 'pbFirstColWidth' => intval(PERSONALBOX_FIRSTCOLWIDTH_ACP), 'pbTableWidth' => PERSONALBOX_TABLEWIDTH_ACP, 'pbCellPadding' => intval(PERSONALBOX_CELLPADDING_ACP), 'pbLargeImages' => PERSONALBOX_LARGERANKIMAGES_ACP, 'pbShowIP' => WCF::getUser()->getPermission('user.profile.personalbox.showIP') && WBBCore::getSession()->ipAddress ? WBBCore::getSession()->ipAddress : 0, 'pbStyleWidth' => PERSONALBOX_STYLEBOXWIDTH_ACP, 'pbLineFeedRank' => PERSONALBOX_LINEFEEDRANK_ACP, 'pbShowProfileLink' => PERSONALBOX_SHOWPROFILELINK_ACP, 'pbShowDisplayLink' => PERSONALBOX_SHOWDISPLAYLINK_ACP, 'pbRankImage' => $pbRankImage, 'pbMaxHeight' => $pbMaxHeight, 'pbShowAvatar' => $pbShowAvatar, 'pbAvatarMaxWidth' => PERSONALBOX_AVATARMAXWIDTH_ACP, 'pbAvatarMaxHeight' => PERSONALBOX_AVATARMAXHEIGHT_ACP, 'pbShowPersonal' => $pbShowPersonal, 'pbShowSearch' => $pbShowSearch, 'pbShowPM' => $pbShowPM, 'pbShowUserCP' => $pbShowUserCP, 'pbShowStyles' => $pbShowStyles, 'pbShowMisc' => $pbShowMisc, 'pbShowWeather' => $pbShowWeather, 'pbWeatherZipCode' => $pbWeatherZipCode, 'pbWeatherComZipCode' => $pbWeatherComZipCode, 'pbWeatherStyle' => $pbWeatherStyle, 'pbWeatherComStyle' => $pbWeatherComStyle, 'pbWeatherWidth' => $pbWeatherWidth, 'pbShowWeatherCom' => $pbShowWeatherCom, 'pbWeatherComDay' => $pbWeatherComDay, 'pbLinks' => isset($pbLinks) ? $pbLinks : array(), 'pbStyles' => isset($pbStyles) ? $pbStyles : array(), 'imcount' => $imcount, 'pbShowIM' => $pbShowIM, 'pbShowProfileHits' => PERSONALBOX_SHOW_PROFILEHITS_ACP, 'boxCurPage' => $boxCurPage)); }
public function __construct($data, $boxname = "") { $this->LastOnlineBoxData['templatename'] = "lastonlinebox"; $this->getBoxStatus($data); $this->LastOnlineBoxData['boxID'] = $data['boxID']; $cntTodayOnline = 0; $showAllOU = 0; $curPage = ''; if (!defined('LASTONLINEBOX_NUMOFUSER_ACP')) { define('LASTONLINEBOX_NUMOFUSER_ACP', 5); } if (!defined('LASTONLINEBOX_SBCOLOR_ACP')) { define('LASTONLINEBOX_SBCOLOR_ACP', 2); } if (!defined('LASTONLINEBOX_MAXHEIGHT_ACP')) { define('LASTONLINEBOX_MAXHEIGHT_ACP', 300); } if (!defined('LASTONLINEBOX_SHOWTIME_ACP')) { define('LASTONLINEBOX_SHOWTIME_ACP', true); } if (!defined('LASTONLINEBOX_SHOWUSERMARKING_ACP')) { define('LASTONLINEBOX_SHOWUSERMARKING_ACP', true); } if (WCF::getUser()->getPermission('user.board.canSeeLastOnlineBox') > 0) { $itstamp = time(); $todayStartTime = mktime(0, 0, 0, (int) date("m", $itstamp), (int) date("d", $itstamp), (int) date("Y", $itstamp)); $i = 0; if (!empty($_GET['showAllOU'])) { $showAllOU = 1; } if (!empty($_GET['page'])) { $curPage = $_GET['page']; } if (WCF::getUser()->userID > 0 && WCF::getUser()->getPermission('admin.general.canViewInvisible')) { $sql = "SELECT COUNT(*) AS cntTodayOnline" . "\n FROM wcf" . WCF_N . "_user wcu" . "\n WHERE wcu.lastActivityTime >= " . $todayStartTime; $result = WBBCore::getDB()->getFirstRow($sql); $cntTodayOnline = $result['cntTodayOnline']; } else { $sql = "SELECT COUNT(*) AS cntTodayOnline" . "\n FROM wcf" . WCF_N . "_user wcu" . "\n LEFT JOIN wcf" . WCF_N . "_user_option_value wcuo ON (wcuo.userID = wcu.userID)" . "\n WHERE wcu.lastActivityTime >= " . $todayStartTime . "\n AND wcuo.userOption" . User::getUserOptionID('invisible') . " = 0"; $result = WBBCore::getDB()->getFirstRow($sql); $cntTodayOnline = $result['cntTodayOnline']; } if (LASTONLINEBOX_SHOWUSERMARKING_ACP) { $sql = "SELECT wcu.userID, wcu.username, wcu.lastActivityTime, wcuo.userOption" . User::getUserOptionID('invisible') . " isInvisible, wcg.userOnlineMarking" . "\n FROM wcf" . WCF_N . "_user wcu" . "\n LEFT JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = wcu.userOnlineGroupID)"; } else { $sql = "SELECT wcu.userID, wcu.username, wcu.lastActivityTime, wcuo.userOption" . User::getUserOptionID('invisible') . " isInvisible" . "\n FROM wcf" . WCF_N . "_user wcu"; } $sql .= "\n LEFT JOIN wcf" . WCF_N . "_user_option_value wcuo ON (wcuo.userID = wcu.userID)" . "\n WHERE wcu.lastActivityTime >= " . $todayStartTime . "\n ORDER BY wcu.lastActivityTime DESC"; if (LASTONLINEBOX_NUMOFUSER_ACP > 0 && empty($showAllOU)) { $sql .= "\n LIMIT 0, " . LASTONLINEBOX_NUMOFUSER_ACP; } $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { if ($row['isInvisible'] && !WCF::getUser()->getPermission('admin.general.canViewInvisible')) { continue; } if (LASTONLINEBOX_SHOWUSERMARKING_ACP && $row['userOnlineMarking'] != '%s') { $row['username'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML($row['username'])); if ($row['isInvisible']) { $row['username'] .= WCF::getLanguage()->get('wcf.usersOnline.invisible'); } } else { $row['username'] = StringUtil::encodeHTML($row['username']); } $this->lastOnline[$i]['userID'] = $row['userID']; $this->lastOnline[$i]['username'] = $row['username']; $this->lastOnline[$i]['plainname'] = $row['username']; $this->lastOnline[$i]['lastActivityTime'] = $row['lastActivityTime']; $i++; } $this->getSortedByNames(); } WCF::getTPL()->assign('LASTONLINEBOX_SBCOLOR_ACP', intval(LASTONLINEBOX_SBCOLOR_ACP)); WCF::getTPL()->assign('LASTONLINEBOX_MAXHEIGHT_ACP', intval(LASTONLINEBOX_MAXHEIGHT_ACP)); WCF::getTPL()->assign('LASTONLINEBOX_SHOWTIME_ACP', LASTONLINEBOX_SHOWTIME_ACP); WCF::getTPL()->assign('lastOnline', $this->lastOnline); WCF::getTPL()->assign('lastOnlineByName', $this->lastOnlineByName); WCF::getTPL()->assign('canSeeLastOnlineBox', WCF::getUser()->getPermission('user.board.canSeeLastOnlineBox')); WCF::getTPL()->assign('cntTodayOnline', $cntTodayOnline); WCF::getTPL()->assign('showAllOU', $showAllOU); WCF::getTPL()->assign('curPage', $curPage); }
public function __construct($data, $boxname = "") { $this->TeamOnlineBoxData['templatename'] = "teamonlinebox"; $this->getBoxStatus($data); $this->TeamOnlineBoxData['boxID'] = $data['boxID']; if (!defined('TEAMONLINEBOX_SHOWCOUNT_ACP')) { define('TEAMONLINEBOX_SHOWCOUNT_ACP', true); } if (!defined('TEAMONLINEBOX_SHOWBYLINE_ACP')) { define('TEAMONLINEBOX_SHOWBYLINE_ACP', true); } if (!defined('TEAMONLINEBOX_SHOWTIME_ACP')) { define('TEAMONLINEBOX_SHOWTIME_ACP', true); } if (!defined('TEAMONLINEBOX_ORDERBY_ACP')) { define('TEAMONLINEBOX_ORDERBY_ACP', 'lastActivityTime'); } if (!defined('TEAMONLINEBOX_SORTDESC_ACP')) { define('TEAMONLINEBOX_SORTDESC_ACP', true); } if (!defined('TEAMONLINEBOX_SBCOLOR_ACP')) { define('TEAMONLINEBOX_SBCOLOR_ACP', 2); } $teamOnline = array(); if (WCF::getUser()->userID > 0 && WCF::getUser()->getPermission('user.board.canSeeTeamOnlineBox') > 0) { require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php'; $teamOnlineList = null; $teamOnlineList = new UsersOnlineList('', true); $teamOnlineList->renderOnlineList(); $uOnlineIDs = '0'; if (isset($teamOnlineList->usersOnline)) { foreach ($teamOnlineList->usersOnline as $k => $v) { if (isset($v['userID'])) { $uOnlineIDs .= ',' . $v['userID']; } } } if ($uOnlineIDs != '0') { if (TEAMONLINEBOX_SORTDESC_ACP) { $sort = 'DESC'; } else { $sort = 'ASC'; } $sql = "SELECT DISTINCT wcu.userID, wcu.username, wcu.lastActivityTime, wcuo.userOption" . User::getUserOptionID('invisible') . " isInvisible, teamOnlineMarking" . "\n FROM wcf" . WCF_N . "_user wcu" . "\n JOIN wcf" . WCF_N . "_group wcg ON (wcg.groupID = wcu.userOnlineGroupID)" . "\n JOIN wcf" . WCF_N . "_user_option_value wcuo ON (wcuo.userID = wcu.userID)" . "\n WHERE wcg.showOnTeamOnlineBox = 1" . "\n AND wcu.userID IN (" . $uOnlineIDs . ")" . "\n ORDER BY wcu." . TEAMONLINEBOX_ORDERBY_ACP . " " . $sort; $result = WBBCore::getDB()->sendQuery($sql); $i = 0; while ($row = WBBCore::getDB()->fetchArray($result)) { if ($row['isInvisible'] && !WCF::getUser()->getPermission('admin.general.canViewInvisible')) { continue; } if ($row['teamOnlineMarking'] != '%s') { if ($row['isInvisible']) { $row['username'] .= WCF::getLanguage()->get('wcf.usersOnline.invisible'); } $row['username'] = sprintf($row['teamOnlineMarking'], StringUtil::encodeHTML($row['username'])); } else { $row['username'] = StringUtil::encodeHTML($row['username']); } $teamOnline[$i]['userID'] = $row['userID']; $teamOnline[$i]['username'] = $row['username']; $teamOnline[$i]['lastActivityTime'] = $row['lastActivityTime']; $i++; } } } WCF::getTPL()->assign('teamOnline', $teamOnline); WCF::getTPL()->assign('TEAMONLINEBOX_SHOWCOUNT_ACP', TEAMONLINEBOX_SHOWCOUNT_ACP); WCF::getTPL()->assign('TEAMONLINEBOX_SHOWBYLINE_ACP', TEAMONLINEBOX_SHOWBYLINE_ACP); WCF::getTPL()->assign('TEAMONLINEBOX_SHOWTIME_ACP', TEAMONLINEBOX_SHOWTIME_ACP); WCF::getTPL()->assign('TEAMONLINEBOX_SBCOLOR_ACP', intval(TEAMONLINEBOX_SBCOLOR_ACP)); }
public function getBirthdays($y, $m, $d = 0) { $month = intval($m); $day = intval($d); if ($day != 0 && $day < 10) { $day = '0' . $day; } $ret = array(); if ($month < 10) { $month = '0' . $month; } $optionID = intval(User::getUserOptionID('birthday')); if (!empty($optionID)) { $sql = "SELECT u.userID, u.username, uov.userOption" . $optionID . " AS BD" . "\n FROM wcf" . WCF_N . "_user_option_value uov" . "\n LEFT JOIN wcf" . WCF_N . "_user u ON (u.userID = uov.userID)" . "\n WHERE 1 = 1"; if ($day == 0) { $sql .= "\n AND uov.userOption" . $optionID . " LIKE '____-" . $month . "-__'"; } else { $sql .= "\n AND uov.userOption" . $optionID . " LIKE '____-" . $month . "-" . $day . "'"; } $result = WBBCore::getDB()->sendQuery($sql); while ($row = WBBCore::getDB()->fetchArray($result)) { list($by, $bm, $bd) = preg_split('/\\-/', $row['BD'], 3); $by = intval($by); $bm = intval($bm); $bd = intval($bd); if ($y >= $by) { if (!$by > 0) { $age = null; } else { $age = $y - $by; } if (isset($ret[$bd])) { $ret[$bd] .= ", "; } else { $ret[$bd] = ''; } $ret[$bd] .= StringUtil::encodeHTML($row['username']) . ($age ? ' (' . $age . ')' : ''); } } } return $ret; }