/**
  * @see	Module::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     if (MODULE_USERS_ONLINE) {
         require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php';
         $usersOnlineList = new UsersOnlineList('', true);
         $usersOnlineList->renderOnlineList();
     }
 }
 /**
  * Wrapper for UsersOnlineList->renderOnlineList()
  * @see UsersOnlineList::renderOnlineList()
  */
 protected function renderOnlineList()
 {
     require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php';
     $usersOnlineList = new UsersOnlineList('', true);
     $usersOnlineList->renderOnlineList();
     // check users online record
     $usersOnlineTotal = USERS_ONLINE_RECORD_NO_GUESTS ? $usersOnlineList->usersOnlineMembers : $usersOnlineList->usersOnlineTotal;
     if ($usersOnlineTotal > USERS_ONLINE_RECORD) {
         // save new users online record
         $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\tSET\toptionValue = IF(" . $usersOnlineTotal . " > optionValue, " . $usersOnlineTotal . ", optionValue)\n\t\t\t\tWHERE\toptionName = 'users_online_record'\n\t\t\t\t\tAND packageID = " . PACKAGE_ID;
         WCF::getDB()->registerShutdownUpdate($sql);
         // save new record time
         if (TIME_NOW > USERS_ONLINE_RECORD_TIME) {
             $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\t\tSET\toptionValue = IF(" . TIME_NOW . " > optionValue, " . TIME_NOW . ", optionValue)\n\t\t\t\t\tWHERE\toptionName = 'users_online_record_time'\n\t\t\t\t\t\tAND packageID = " . PACKAGE_ID;
             WCF::getDB()->registerShutdownUpdate($sql);
         }
         // reset options file
         require_once WCF_DIR . 'lib/acp/option/Options.class.php';
         Options::resetFile();
     }
 }
 public function __construct($data, $boxname = "")
 {
     $this->WwoData['templatename'] = "todayonlinebox";
     $this->getBoxStatus($data);
     $this->WwoData['boxID'] = $data['boxID'];
     // defaults
     if (!defined('TODAYONLINEBOX_SHOWONLINEUSER_ACP')) {
         define('TODAYONLINEBOX_SHOWONLINEUSER_ACP', true);
     }
     if (!defined('TODAYONLINEBOX_SHOWSTATS_ACP')) {
         define('TODAYONLINEBOX_SHOWSTATS_ACP', true);
     }
     if (!defined('TODAYONLINEBOX_SHOWLEGEND_ACP')) {
         define('TODAYONLINEBOX_SHOWLEGEND_ACP', 'wio');
     }
     WCF::getTPL()->assign('TODAYONLINEBOX_SHOWONLINEUSER_ACP', TODAYONLINEBOX_SHOWONLINEUSER_ACP);
     WCF::getTPL()->assign('TODAYONLINEBOX_SHOWSTATS_ACP', TODAYONLINEBOX_SHOWSTATS_ACP);
     WCF::getTPL()->assign('TODAYONLINEBOX_SHOWLEGEND_ACP', TODAYONLINEBOX_SHOWLEGEND_ACP);
     $stats = array();
     if (TODAYONLINEBOX_SHOWSTATS_ACP) {
         $stats = WCF::getCache()->get('stat');
     }
     WCF::getTPL()->assign('stats', $stats);
     if (TODAYONLINEBOX_SHOWONLINEUSER_ACP) {
         require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php';
         $usersOnlineListObj = null;
         $usersOnlineListObj = new UsersOnlineList('', true);
         $usersOnlineListObj->renderOnlineList();
     }
     if (WCF::getUser()->getPermission('user.board.canSeeWWO')) {
         require_once WCF_DIR . 'lib/data/user/usersOnline/UsersWasOnlineList.class.php';
         if (INDEX_LIMIT_WASONLINE_LIST && INDEX_LIMIT_WASONLINE_LIST_AMOUNT > 0) {
             $usersWasOnlineList = new UsersWasOnlineList('', true, INDEX_LIMIT_WASONLINE_LIST_AMOUNT);
         } else {
             $usersWasOnlineList = new UsersWasOnlineList('', true);
         }
         $usersWasOnlineList->renderWasOnlineList();
     }
 }
 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));
 }
 /**
  * Wrapper for UsersOnlineList->renderOnlineList()
  * @see UsersOnlineList::renderOnlineList()
  */
 protected function renderOnlineList()
 {
     require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php';
     $usersOnlineList = new UsersOnlineList('session.boardID = ' . $this->boardID);
     $usersOnlineList->renderOnlineList();
 }