function showlist($ulrows, $total_results, $pageNav, $limitstart, $query_ext, $search = "") { $app =& JFactory::getApplication(); $fbConfig =& CKunenaConfig::getInstance(); $kunena_db =& JFactory::getDBO(); if ($search == "") { $search = _KUNENA_USRL_SEARCH; } ?> <script type = "text/javascript"> <!-- function validate() { if ((document.usrlform.search == "") || (document.usrlform.search.value == "")) { alert('<?php echo _KUNENA_USRL_SEARCH_ALERT; ?> '); return false; } else { return true; } } //--> </script> <?php if ($fbConfig->joomlastyle < 1) { $boardclass = "fb_"; } ?> <div class="<?php echo $boardclass; ?> _bt_cvr1"> <div class="<?php echo $boardclass; ?> _bt_cvr2"> <div class="<?php echo $boardclass; ?> _bt_cvr3"> <div class="<?php echo $boardclass; ?> _bt_cvr4"> <div class="<?php echo $boardclass; ?> _bt_cvr5"> <table class = "fb_blocktable" id ="fb_userlist" border = "0" cellspacing = "0" cellpadding = "0" width="100%"> <thead> <tr> <th> <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0"> <tr> <td align = "left"> <div class = "fb_title_cover fbm"> <span class="fb_title fbl"> <?php echo _KUNENA_USRL_USERLIST; ?> </span> <?php printf(_KUNENA_USRL_REGISTERED_USERS, $app->getCfg('sitename'), $total_results); ?> </div> </td> <td align = "right"> <form name = "usrlform" method = "post" action = "<?php echo CKunenaLink::GetUserlistURL(); ?> " onsubmit = "return validate()"> <input type = "text" name = "search" class = "inputbox" style = "width:150px" maxlength = "100" value = "<?php echo $search; ?> " onblur = "if(this.value=='') this.value='<?php echo $search; ?> ';" onfocus = "if(this.value=='<?php echo $search; ?> ') this.value='';" /> <input type = "image" src = "<?php echo KUNENA_TMPLTMAINIMGURL . '/images/usl_search_icon.gif'; ?> " alt = "<?php echo _KUNENA_USRL_SEARCH; ?> " align = "top" style = "border: 0px;"/> </form> </td> </tr> </table> </th> </tr> </thead> <tbody> <tr> <td class = "<?php echo $boardclass; ?> fb-userlistinfo"> <!-- Begin: Listing --> <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0"> <tr class = "fb_sth fbs"> <th class = "th-1 frst <?php echo $boardclass; ?> sectiontableheader" align="center"> </th> <?php if ($fbConfig->userlist_online) { ?> <th class = "th-2 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_ONLINE; ?> </th> <?php } ?> <?php if ($fbConfig->userlist_avatar) { ?> <th class = "th-3 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_AVATAR; ?> </th> <?php } ?> <?php if ($fbConfig->userlist_name) { ?> <th class = "th-4 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_NAME; echo CKunenaLink::GetUserlistLink('&orderby=name&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=name&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_username) { ?> <th class = "th-5 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_USERNAME; echo CKunenaLink::GetUserlistLink('&orderby=username&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=username&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_group) { ?> <th class = "th-6 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_GROUP; echo CKunenaLink::GetUserlistLink('&orderby=group_id&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=group_id&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_posts) { ?> <th class = "th-7 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_POSTS; echo CKunenaLink::GetUserlistLink('&orderby=posts&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=posts&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_karma) { ?> <th class = "th-7 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_KARMA; echo CKunenaLink::GetUserlistLink('&orderby=karma&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=karma&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_email) { ?> <th class = "th-8 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_EMAIL; echo CKunenaLink::GetUserlistLink('&orderby=email&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=email&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_usertype) { ?> <th class = "th-9 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_USERTYPE; echo CKunenaLink::GetUserlistLink('&orderby=usertype&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=usertype&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_joindate) { ?> <th class = "th-10 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_JOIN_DATE; echo CKunenaLink::GetUserlistLink('&orderby=registerDate&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=registerDate&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_lastvisitdate) { ?> <th class = "th-11 <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_LAST_LOGIN; echo CKunenaLink::GetUserlistLink('&orderby=lastvisitDate&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=lastvisitDate&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> <?php if ($fbConfig->userlist_userhits) { ?> <th class = "th-12 lst <?php echo $boardclass; ?> sectiontableheader" align="center"> <?php echo _KUNENA_USRL_HITS; echo CKunenaLink::GetUserlistLink('&orderby=uhits&direction=ASC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/down.gif" border="0" alt="' . _KUNENA_USRL_ASC . '" />'); echo CKunenaLink::GetUserlistLink('&orderby=uhits&direction=DESC', '<img src="' . KUNENA_TMPLTMAINIMGURL . '/images/up.gif" border="0" alt="' . _KUNENA_USRL_DESC . '" />'); ?> </th> <?php } ?> </tr> <?php $i = 1; foreach ($ulrows as $ulrow) { $evenodd = $i % 2; if ($evenodd == 0) { $usrl_class = "sectiontableentry1"; } else { $usrl_class = "sectiontableentry2"; } $nr = $i + $limitstart; // Avatar $uslavatar = ''; if ($fbConfig->avatar_src == "clexuspm") { $uslavatar = '<img border="0" class="usl_avatar" src="' . MyPMSTools::getAvatarLinkWithID($ulrow->id, "s") . '" alt="" />'; } else { if ($fbConfig->avatar_src == "cb") { $kunenaProfile =& CKunenaCBProfile::getInstance(); $uslavatar = $kunenaProfile->showAvatar($ulrow->id); } else { $kunena_db->setQuery("SELECT avatar FROM #__fb_users WHERE userid='{$ulrow->id}'"); $avatar = $kunena_db->loadResult(); if ($avatar != '') { if (!file_exists(KUNENA_PATH_UPLOADED . DS . 'avatars/s_' . $avatar)) { $uslavatar = '<img border="0" class="usl_avatar" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/' . $avatar . '" alt="" />'; } else { $uslavatar = '<img border="0" class="usl_avatar" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/s_' . $avatar . '" alt="" />'; } } else { $uslavatar = '<img border="0" class="usl_avatar" src="' . KUNENA_LIVEUPLOADEDPATH . '/avatars/s_nophoto.jpg" alt="" />'; } } } // ?> <tr class = "<?php echo $boardclass; echo $usrl_class; ?> fbm"> <td class = "td-1 frst fbs" align="center"> <?php echo $nr; ?> </td> <?php if ($fbConfig->userlist_online) { ?> <td class = "td-2"> <?php // online - ofline status $sql = "SELECT COUNT(userid) FROM #__session WHERE userid='{$ulrow->id}'"; $kunena_db->setQuery($sql); $isonline = $kunena_db->loadResult(); if ($isonline && $ulrow->showOnline == 1) { echo isset($fbIcons['onlineicon']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['onlineicon'] . '" border="0" alt="' . _MODLIST_ONLINE . '" />' : ' <img src="' . KUNENA_URLEMOTIONSPATH . 'onlineicon.gif" border="0" alt="' . _MODLIST_ONLINE . '" />'; } else { echo isset($fbIcons['offlineicon']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['offlineicon'] . '" border="0" alt="' . _MODLIST_OFFLINE . '" />' : ' <img src="' . KUNENA_URLEMOTIONSPATH . 'offlineicon.gif" border="0" alt="' . _MODLIST_OFFLINE . '" />'; } ?> </td> <?php } ?> <?php if ($fbConfig->userlist_avatar) { ?> <td class = "td-3" align="center"> <?php if (strlen($uslavatar)) { echo CKunenaLink::GetProfileLink($fbConfig, $ulrow->id, $uslavatar); } else { echo ' '; } ?> </td> <?php } ?> <?php if ($fbConfig->userlist_name) { ?> <td class = "td-4 fbm" align="center"> <?php echo CKunenaLink::GetProfileLink($fbConfig, $ulrow->id, $ulrow->name); ?> </td> <?php } ?> <?php if ($fbConfig->userlist_username) { ?> <td class = "td-5 fbm" align="center"> <?php echo CKunenaLink::GetProfileLink($fbConfig, $ulrow->id, $ulrow->username); ?> </td> <?php } ?> <?php if ($fbConfig->userlist_group) { ?> <td class = "td-6 fbs" align="center"> <span class = "view-group_<?php echo $ulrow->group_id; ?> "> <?php echo $ulrow->title; ?> </span> </td> <?php } ?> <?php if ($fbConfig->userlist_posts) { ?> <td class = "td-7 fbs" align="center"> <?php echo $ulrow->posts; ?> </td> <?php } ?> <?php if ($fbConfig->userlist_karma) { ?> <td class = "td-7 fbs" align="center"> <?php echo $ulrow->karma; ?> </td> <?php } ?> <?php if ($fbConfig->userlist_email) { echo "\t\t<td class=\"td-8 fbs\" align=\"center\"><a href=\"mailto:{$ulrow->email}\">{$ulrow->email}</a></td>\n"; } if ($fbConfig->userlist_usertype) { echo "\t\t<td class=\"td-9 fbs\" align=\"center\">{$ulrow->usertype}</td>\n"; } if ($fbConfig->userlist_joindate) { echo "\t\t<td class=\"td-10 fbs\" align=\"center\">" . convertDate($ulrow->registerDate) . "</td>\n"; } if ($fbConfig->userlist_lastvisitdate) { echo "\t\t<td class=\"td-11 fbs\" align=\"center\">" . convertDate($ulrow->lastvisitDate) . "</td>\n"; } ?> <td class = "td-12 lst fbs" align="center"> <?php if ($fbConfig->userlist_userhits) { ?> <?php echo $ulrow->uhits; ?> <?php } ?> </td> <?php echo "\t</tr>\n"; $i++; } ?> </table> <form name = "usrlform" method = "post" action = "<?php echo CKunenaLink::GetUserlistURL(); ?> " onsubmit = "return false;"> <table width = "100%" class="fb_userlist_pagenav" border = "0" cellspacing = "0" cellpadding = "0"> <tr class = "fb_sth fbs"> <th class = "th-1 fbm" align = "center" style = "text-align:center;"> <?php // TODO: fxstein - Need to perform SEO cleanup echo $pageNav->getPagesLinks(CKunenaLink::GetUserlistURL($query_ext)); ?> </th> </tr> </table> <table class = "fb_blocktable" id="fb_userlist_bottom" style="border-bottom:0px;margin:0;" border = "0" cellspacing = "0" cellpadding = "0" width="100%"> <tr> <th class = "th-right fbs" align="right" style="text-align:right"> <?php echo $pageNav->getPagesCounter(); ?> | <?php echo _KUNENA_USRL_DISPLAY_NR; ?> <?php echo $pageNav->getLimitBox(CKunenaLink::GetUserlistURL($query_ext)); ?> </th> </tr> </table> </form> </td> </tr> </tbody> </table> <!-- Finish: Listing --> </div> </div> </div> </div> </div> <?php //(JJ) BEGIN: WHOISONLINE if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/who/whoisonline.php')) { include KUNENA_ABSTMPLTPATH . '/plugin/who/whoisonline.php'; } else { include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/who/whoisonline.php'; } //(JJ) FINISH: WHOISONLINE ?> <!-- Begin: Forum Jump --> <div class="<?php echo $boardclass; ?> _bt_cvr1"> <div class="<?php echo $boardclass; ?> _bt_cvr2"> <div class="<?php echo $boardclass; ?> _bt_cvr3"> <div class="<?php echo $boardclass; ?> _bt_cvr4"> <div class="<?php echo $boardclass; ?> _bt_cvr5"> <table class = "fb_blocktable" id="fb_bottomarea" border = "0" cellspacing = "0" cellpadding = "0"> <thead> <tr> <th class = "th-right"> <?php //(JJ) FINISH: CAT LIST BOTTOM if ($fbConfig->enableforumjump) { require_once KUNENA_PATH_LIB . DS . 'kunena.forumjump.php'; } ?> </th> </tr> </thead> <tbody><tr><td></td></tr></tbody> </table> </div> </div> </div> </div> </div> <!-- Finish: Forum Jump --> <?php }
function displayWhosonline($tpl = null) { $moderator = intval($this->me->isModerator()); $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->template->name}.common.whosonline.{$moderator}", "com_kunena.template")) return; $this->my = JFactory::getUser(); $users = KunenaUserHelper::getOnlineUsers(); KunenaUserHelper::loadUsers(array_keys($users)); $onlineusers = KunenaUserHelper::getOnlineCount(); $who = '<strong>'.$onlineusers['user'].' </strong>'; if($onlineusers['user']==1) { $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER').' '; } else { $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS').' '; } $who .= JText::_('COM_KUNENA_WHO_AND'); $who .= '<strong> '. $onlineusers['guest'].' </strong>'; if($onlineusers['guest']==1) { $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST').' '; } else { $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS').' '; } $who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW'); $this->membersOnline = $who; $this->onlineList = array(); $this->hiddenList = array(); foreach ($users as $userid=>$usertime) { $user = KunenaUserHelper::get($userid); if ( !$user->showOnline ) { if ($this->me->isModerator()) $this->hiddenList[$user->getName()] = $user; } else { $this->onlineList[$user->getName()] = $user; } } ksort($this->onlineList); ksort($this->hiddenList); $this->usersURL = CKunenaLink::GetUserlistURL(''); $result = $this->loadTemplate($tpl); if (JError::isError($result)) { return $result; } echo $result; $cache->end(); }
" onsubmit="return false;"> <table class="kblocktable" id="kuserlist-bottom"> <tr> <td> <div> <?php // TODO: fxstein - Need to perform SEO cleanup echo $this->pageNav->getPagesLinks(CKunenaLink::GetUserlistURL($this->searchuri)); ?> <span style="float:right"> <?php echo $this->pageNav->getPagesCounter(); ?> | <?php echo JText::_('COM_KUNENA_USRL_DISPLAY_NR'); ?> <?php echo $this->pageNav->getLimitBox(CKunenaLink::GetUserlistURL($this->searchuri)); ?> </span> </div> </td> </tr> </table> </form> </div> </div> </div> <?php $this->displayWhoIsOnline();
function __construct() { $this->app = JFactory::getApplication(); $this->config = KunenaFactory::getConfig(); $this->db = JFactory::getDBO(); $this->my = JFactory::getUser(); $this->me = KunenaFactory::getUser(); $this->search = JRequest::getVar('search', ''); $this->limitstart = JRequest::getInt('limitstart', 0); $this->limit = $querylimit = JRequest::getInt('limit', (int) $this->config->userlist_rows); jimport('joomla.html.pagination'); if (!$this->isAllowed()) { return false; } $filter_order = $this->app->getUserStateFromRequest('kunena.userlist.filter_order', 'filter_order', 'registerDate', 'cmd'); $filter_order_dir = $this->app->getUserStateFromRequest('kunena.userlist.filter_order_dir', 'filter_order_Dir', 'asc', 'word'); $direction = $filter_order_dir == 'asc' ? 'ASC' : 'DESC'; $orderby = " ORDER BY {$this->db->nameQuote($filter_order)} {$direction}"; if (empty($this->search)) { if ($this->config->userlist_count_users == '0') { $where = '1'; } elseif ($this->config->userlist_count_users == '1') { $where = '(block=0 OR activation="")'; } elseif ($this->config->userlist_count_users == '2') { $where = '(block=0 AND activation="")'; } elseif ($this->config->userlist_count_users == '3') { $where = 'block=0'; } } else { $where = '1'; } // Total $this->db->setQuery("SELECT COUNT(*) FROM #__users WHERE {$where}"); $this->total = $this->db->loadResult(); KunenaError::checkDatabaseError(); // Search total $query = "SELECT COUNT(*) FROM #__users AS u INNER JOIN #__kunena_users AS fu ON u.id=fu.userid WHERE {$where}"; if ($this->search != "") { if (!JRequest::checkToken()) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $this->app->redirect(CKunenaLink::GetUserlistURL()); return false; } $query .= " AND (u.name LIKE '%{$this->db->getEscaped($this->search)}%' OR u.username LIKE '%{$this->db->getEscaped($this->search)}%')"; } $this->db->setQuery($query); $total = $this->db->loadResult(); KunenaError::checkDatabaseError(); if ($this->limit > $total) { $this->limitstart = 0; } // this is need to show something when the user choose all, but we need to limit even the 'all' with a number if ($this->limit == 0) { $querylimit = '150'; } $useridAdmin = KUNENA_JOOMLA_COMPAT == '1.5' ? '62' : '42'; // Select query $moderator = intval($this->me->isModerator()); $query = "SELECT u.id, u.name, u.username, u.usertype, IF(fu.hideEmail=0 OR {$moderator},u.email,'') AS email, u.registerDate, u.lastvisitDate, fu.userid, fu.showOnline, fu.group_id, fu.posts, fu.karma, fu.uhits " . " FROM #__users AS u INNER JOIN #__kunena_users AS fu ON fu.userid = u.id WHERE {$where}"; $this->searchuri = ""; if ($this->search != "") { $query .= " AND (name LIKE '%{$this->db->getEscaped($this->search)}%' OR username LIKE '%{$this->db->getEscaped($this->search)}%') AND u.id NOT IN ({$useridAdmin})"; $this->searchuri .= "&search=" . $this->search; } else { $query .= " AND u.id NOT IN ({$useridAdmin})"; } $query .= $orderby; $query .= " LIMIT {$this->limitstart}, {$querylimit}"; $this->db->setQuery($query); $this->users = $this->db->loadObjectList(); KunenaError::checkDatabaseError(); $userlist = array(); foreach ($this->users as $user) { $userlist[intval($user->userid)] = intval($user->userid); } // Prefetch all users/avatars to avoid user by user queries during template iterations KunenaUser::loadUsers($userlist); // table ordering $this->order_dir = $filter_order_dir; $this->order = $filter_order; if ($this->search == "") { $this->search = JText::_('COM_KUNENA_USRL_SEARCH'); } $this->pageNav = new JPagination($total, $this->limitstart, $this->limit); $this->allow = true; $template = KunenaFactory::getTemplate(); $this->params = $template->params; }