function boardIndexTemplate($lastvisit = "", $stats = array(), $cat_data = array(), $show_side_blocks = true, $side_blocks = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_boards', $this->_funcHooks['boardIndexTemplate'])) {
         $count_d79a4680f047b95f9c696f93b859d2a2 = is_array($this->functionData['boardIndexTemplate']) ? count($this->functionData['boardIndexTemplate']) : 0;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['lastvisit'] = $lastvisit;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['stats'] = $stats;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['cat_data'] = $cat_data;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['show_side_blocks'] = $show_side_blocks;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['side_blocks'] = $side_blocks;
     }
     $this->templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $this->__default__templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("board", "0") . "" . (true ? "" : "") . "\r\n<div id='board_index' class='ipsLayout " . ($this->templateVars['sidebar_enabled'] ? "ipsLayout_withright" : "") . " ipsLayout_largeright clearfix " . (IPSCookie::get('hide_sidebar') == '1' ? "no_sidebar" : "") . "'>\t\r\n\t<div id='categories' class='ipsLayout_content clearfix'>\r\n\t<!-- CATS AND FORUMS -->\r\n\t\t" . ((is_array($cat_data) and count($cat_data)) ? "\r\n\t\t\t" . $this->__f__f3046b4671aec0807f8ac620415036a8($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t" : "") . "\r\n\t</div>\r\n\t" . ($this->templateVars['sidebar_enabled'] ? "<div id='index_stats' class='ipsLayout_right clearfix' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . ">\r\n\t\t\t" . $this->__f__89030e7582e797890a67a50f095f2544($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t</div>\r\n\t\t<a href='#' id='toggle_sidebar' title='{$this->lang->words['toggle_sidebar']}' data-closed=\"{$this->lang->words['_laquo']}\" data-open=\"&times;\">&nbsp;</a>" : "") . "\r\n</div>\r\n<script type='text/javascript'>\r\n//<![CDATA[\r\n\tvar markerURL  = ipb.vars['base_url'] + \"app=forums&module=ajax&section=markasread&i=1\"; // Ajax URL so don't use &amp;\r\n\tvar unreadIcon = \"<img src='{$this->settings['img_url']}/f_icon_read.png' />\";\r\n\t\r\n\t" . ((is_array($cat_data) and count($cat_data)) ? "\r\n\t\t" . $this->__f__2d7df5c3f0ad6083957d5ca77bafc27f($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t" : "") . "\r\n//]]>\r\n</script>\r\n" . ($this->settings['show_totals'] ? "\r\n\t<div id='board_stats'>\t\t\r\n\t\t<ul class='ipsType_small ipsList_inline'>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t<span class='value'>{$stats['info']['total_posts']}</span>\r\n\t\t\t\t{$this->lang->words['total_posts']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t<span class='value'>{$stats['info']['mem_count']}</span>\r\n\t\t\t\t{$this->lang->words['total_members']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t" . IPSMember::makeProfileLink($stats['info']['last_mem_name'], $stats['info']['last_mem_id'], $stats['info']['last_mem_seo'], 'value') . "\r\n\t\t\t\t{$this->lang->words['newest_member']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear' data-tooltip=\"{$stats['info']['most_time']}\">\r\n\t\t\t\t<span class='value'>{$stats['info']['most_online']}</span>\r\n\t\t\t\t{$this->lang->words['online_at_once']}\r\n\t\t\t</li>\r\n\t\t</ul>\r\n\t</div>\r\n" : "") . "\r\n<div id='board_statistics' class='statistics clearfix'>\r\n\t<ul id='stat_links' class='ipsList_inline right ipsType_small'>\r\n\t\t" . (1 == 1 ? "<!-- Hook point -->\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats&amp;do=leaders", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_forum_leaders_title']}\">{$this->lang->words['sm_forum_leaders']}</a></li>\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_all_posters_title']}\">{$this->lang->words['sm_today_posters']}</a></li>\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=list&amp;max_results=20&amp;sort_key=posts&amp;sort_order=desc&amp;filter=ALL", "public", ''), "false", "") . "\" title=\"{$this->lang->words['sm_overall_posters_title']}\">{$this->lang->words['sm_overall_posters']}</a></li>\r\n\t\t\t" . ($this->settings['reputation_enabled'] ? "<li>\r\n\t\t\t\t\t<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=reputation&amp;section=most", "public", ''), "most_liked", "most_liked") . "\" title=\"" . ($this->settings['reputation_point_types'] == 'like' ? "{$this->lang->words['most_rep_likes']}" : "{$this->lang->words['most_rep_rep']}") . "\">\r\n\t\t\t\t\t\t" . ($this->settings['reputation_point_types'] == 'like' ? "\r\n\t\t\t\t\t\t\t{$this->lang->words['most_rep_likes']}\r\n\t\t\t\t\t\t" : "\r\n\t\t\t\t\t\t\t{$this->lang->words['most_rep_rep']}\r\n\t\t\t\t\t\t") . "\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</li>" : "") . "" : "") . "\r\n\t</ul>\r\n\t\r\n\t" . ($this->settings['show_active'] && $this->memberData['gbw_view_online_lists'] ? "<h4 class='statistics_head'>" . sprintf($this->lang->words['online_right_now'], $stats['TOTAL']) . " {$this->lang->words['active_users']}</h4>\r\n\t\t<p class='statistics_brief desc'>\r\n\t\t\t" . sprintf($this->lang->words['active_users_detail'], $stats['MEMBERS'], $stats['GUESTS'], $stats['ANON']) . "\r\n\t\t\t" . ($this->settings['allow_online_list'] ? "&nbsp;&nbsp;<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_order=desc", "public", ''), "", "") . "' title='{$this->lang->words['online_link']}'>({$this->lang->words['online_link']})</a>" : "") . "\r\n\t\t</p>" : "") . "\r\n\t" . (count($stats['NAMES']) && $this->settings['show_active'] ? "\r\n\t\t<br />\r\n\t\t<p>\r\n\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $stats['NAMES']) . "</span>\r\n\t\t</p>\r\n\t" : "") . "\r\n</div>";
     return $IPBHTML;
 }
 function boardIndexTemplate($lastvisit = "", $stats = array(), $cat_data = array(), $show_side_blocks = true, $side_blocks = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_boards', $this->_funcHooks['boardIndexTemplate'])) {
         $count_3caeb9bb43000ee1df74d49ffc12eae7 = is_array($this->functionData['boardIndexTemplate']) ? count($this->functionData['boardIndexTemplate']) : 0;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['lastvisit'] = $lastvisit;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['stats'] = $stats;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['cat_data'] = $cat_data;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['show_side_blocks'] = $show_side_blocks;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['side_blocks'] = $side_blocks;
     }
     $this->templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $this->__default__templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $IPBHTML .= "" . (($this->settings['hoverDescriptions'] = 'no') ? "" : "") . "\n" . (($this->settings['removeStatsColumn'] = 'no') ? "" : "") . "\n" . (($this->settings['customForumIcons'] = 'no') ? "" : "") . "\n" . (($this->settings['clickableRows'] = 'yes') ? "" : "") . "" . $this->registry->getClass('output')->addJSModule("board", "0") . "" . (true ? "" : "") . "\n<div id='board_index' class='ipsLayout " . ($this->templateVars['sidebar_enabled'] ? "ipsLayout_withleft" : "") . " ipsLayout_largeleft clearfix " . (IPSCookie::get('hide_sidebar') == '1' ? "no_sidebar" : "") . "'>\n\t" . ($this->templateVars['sidebar_enabled'] ? "<div id='index_stats' class='ipsLayout_left clearfix' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . ">\n" . ($this->settings['show_totals'] ? "\n  <div class='ipsSideBlock clearfix'>\n    <h3><span class='icon icon-span-text icon-block'></span>Статистика форума</h3>\n    <div class='_sbcollapsable'>\n      <ul class='ipsList_data csoStatistics clearfix'>\n        <li class='clearfix'>\n          <span class='value right'>" . $this->registry->getClass('class_localization')->formatNumber($this->caches['stats']['total_topics']) . "</span>\n          <span class='label left'><i class=\"fa fa-comment\"></i> Всего тем</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right'>{$stats['info']['total_posts']}</span>\n          <span class='label left'><i class=\"fa fa-pencil-square-o\"></i> {$this->lang->words['total_posts']}</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right'>{$stats['info']['mem_count']}</span>\n          <span class='label left'><i class=\"fa fa-users\"></i> {$this->lang->words['total_members']}</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right '>" . IPSMember::makeProfileLink($stats['info']['last_mem_name'], $stats['info']['last_mem_id'], $stats['info']['last_mem_seo'], 'value') . "</span>\n          <span class='label left'><i class=\"fa fa-user\"></i> {$this->lang->words['newest_member']}</span>\n        </li>\n        <li class='clearfix' data-tooltip='{$stats['info']['most_time']}'>\n          <span class='value right'>{$stats['info']['most_online']}</span>\n          <span class='label left'><i class=\"fa fa-signal\"></i> {$this->lang->words['online_at_once']}</span>\n        </li>                                                              \n      </ul>\n    </div>\n  </div>\n" : "") . "\n\t\t\t" . $this->__f__b29a9c9cce830e12603033197489dc70($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t</div>\n\t\t<a href='#' id='toggle_sidebar' title='{$this->lang->words['toggle_sidebar']}' data-closed=\"{$this->lang->words['_laquo']}\" data-open=\"&times;\">&nbsp;</a>" : "") . "\n\t<div id='categories' class='ipsLayout_content clearfix'>\n\t<!-- CATS AND FORUMS -->\n\t\t" . ((is_array($cat_data) and count($cat_data)) ? "\n\t\t\t" . $this->__f__5147475eaba97cbcedc3e8701382c4a7($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t" : "") . "\n\t</div>\n</div>\n<script type='text/javascript'>\n//<![CDATA[\n\tvar markerURL  = ipb.vars['base_url'] + \"app=forums&module=ajax&section=markasread&i=1\"; // Ajax URL so don't use &amp;\n\tvar unreadIcon = \"<img src='{$this->settings['img_url']}/f_icon_read.png' />\";\n\t\n\t" . ((is_array($cat_data) and count($cat_data)) ? "\n\t\t" . $this->__f__a75b64ad1448186d22b780ae5692d94a($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t" : "") . "\n//]]>\n</script>\n<div id='board_statistics' class='statistics clearfix'>\n\t<h4 class='statistics_head clearfix'><ul id='stat_links' class='ipsList_inline right ipsType_small'>\n\t\t" . (1 == 1 ? "<!-- Hook point -->\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats&amp;do=leaders", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_forum_leaders_title']}\">{$this->lang->words['sm_forum_leaders']}</a></li>\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_all_posters_title']}\">{$this->lang->words['sm_today_posters']}</a></li>\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=list&amp;max_results=20&amp;sort_key=posts&amp;sort_order=desc&amp;filter=ALL", "public", ''), "false", "") . "\" title=\"{$this->lang->words['sm_overall_posters_title']}\">{$this->lang->words['sm_overall_posters']}</a></li>\n            " . ($this->settings['reputation_enabled'] ? "<li>\n                    <a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=reputation&amp;section=most", "public", ''), "most_liked", "most_liked") . "\" title=\"" . ($this->settings['reputation_point_types'] == 'like' ? "{$this->lang->words['most_rep_likes']}" : "{$this->lang->words['most_rep_rep']}") . "\">\n                        " . ($this->settings['reputation_point_types'] == 'like' ? "\n                            {$this->lang->words['most_rep_likes']}\n                        " : "\n                            {$this->lang->words['most_rep_rep']}\n                        ") . "\n                    </a>\n                </li>" : "") . "" : "") . "\n\t</ul>\n" . ($this->settings['show_active'] && $this->memberData['gbw_view_online_lists'] ? "" . sprintf($this->lang->words['online_right_now'], $stats['TOTAL']) . " {$this->lang->words['active_users']}" : "") . "</h4>\n\t" . ($this->settings['show_active'] ? "<p class='statistics_brief desc'>\n\t\t" . sprintf($this->lang->words['active_users_detail'], $stats['MEMBERS'], $stats['GUESTS'], $stats['ANON']) . "\n\t\t" . ($this->settings['allow_online_list'] ? "&nbsp;&nbsp;<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_order=desc", "public", ''), "", "") . "' title='{$this->lang->words['online_link']}'>({$this->lang->words['online_link']})</a>" : "") . "\n\t</p>" : "") . "\n\t\n\t" . (count($stats['NAMES']) && $this->settings['show_active'] ? "\n\t\t<br />\n\t\t<p>\n\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $stats['NAMES']) . "</span>\t\t\t\t\t\n\t\t</p>\n\t" : "") . "\n</div>";
     return $IPBHTML;
 }
 function __f__cf1b28caa3911c5c1f729669dd7f19fb($friends = array(), $member = array(), $pagination = '')
 {
     $_ips___x_retval = '';
     $__iteratorCount = 0;
     foreach ($friends as $friend) {
         $__iteratorCount++;
         $_ips___x_retval .= "\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$friend['member_id']}", "public", ''), "{$friend['members_seo_name']}", "showuser") . "' title='{$this->lang->words['view_profile']}' class='ipsUserPhotoLink'>\n\t\t\t\t\t\t\t<img src='{$friend['pp_small_photo']}' alt='{$this->lang->words['photo']}' class='ipsUserPhoto ipsUserPhoto_medium' />\n\t\t\t\t\t\t</a><br />\n\t\t\t\t\t\t<span class='name'>\n\t\t\t\t\t\t\t" . IPSMember::makeProfileLink($friend['members_display_name_short'], $friend['member_id'], $friend['members_seo_name']) . "\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\n";
     }
     $_ips___x_retval .= '';
     unset($__iteratorCount);
     return $_ips___x_retval;
 }
 /**
  * Formats the Bob, Bill, Joe and 2038 Others Hate You
  * 
  * @param	array		$data		Likes data
  * @return	@e string	Formatted names
  */
 protected function _formatNameString(array $data)
 {
     $langString = '';
     $seeMoreLink = 'app=core&amp;module=global&amp;section=like&amp;do=more';
     if (!is_array($data['names']) or !count($data['names'])) {
         return false;
     }
     /* Format up the names */
     $i = 0;
     $_names = array();
     foreach ($data['names'] as $name) {
         if ($this->memberData['member_id'] and $this->memberData['member_id'] == $name['id']) {
             $_names[$i] = $name['name'];
         } else {
             $_names[$i] = IPSMember::makeProfileLink($name['name'], $name['id'], $name['seo']);
         }
         $i++;
     }
     /* More than one? */
     if ($data['totalCount'] > 1) {
         /* Joe and Matt love you */
         if ($data['totalCount'] == 2) {
             $_n = $_names[0] . ' ' . $this->lang->words['fave_and'] . ' ' . $_names[1];
             $langString = sprintf($this->lang->words['fave_formatted_many'], $_n);
         } else {
             if ($data['totalCount'] == 3) {
                 $_n = $_names[0] . ', ' . $_names[1] . ' ' . $this->lang->words['fave_and'] . ' ' . $_names[2];
                 $langString = sprintf($this->lang->words['fave_formatted_many'], $_n);
             } else {
                 if ($data['totalCount'] == 4) {
                     $_n = $_names[0] . ', ' . $_names[1] . ' ' . $this->lang->words['fave_and'] . ' ' . $_names[2];
                     $langString = sprintf($this->lang->words['fave_formatted_one_more'], $_n, $seeMoreLink);
                 } else {
                     $_n = $_names[0] . ', ' . $_names[1] . ', ' . $_names[2];
                     $langString = sprintf($this->lang->words['fave_formatted_more'], $_n, $seeMoreLink, $data['othersCount']);
                 }
             }
         }
     } else {
         /* Just the one and it might be you! */
         if ($data['names'][0]['id'] == $this->memberData['member_id']) {
             $langString = $this->lang->words['fave_formatted_me'];
         } else {
             $langString = sprintf($this->lang->words['fave_formatted_one'], $_names[0]);
         }
     }
     return $langString;
 }
 /**
  * Returns an array of active users
  *
  * @return	array
  */
 public function getActiveUserDetails()
 {
     $active = array('TOTAL' => 0, 'NAMES' => array(), 'GUESTS' => 0, 'MEMBERS' => 0, 'ANON' => 0);
     if ($this->settings['show_active'] && $this->memberData['gbw_view_online_lists']) {
         if (!$this->settings['au_cutoff']) {
             $this->settings['au_cutoff'] = 15;
         }
         //-----------------------------------------
         // Get the users from the DB
         //-----------------------------------------
         $cut_off = $this->settings['au_cutoff'] * 60;
         $time = time() - $cut_off;
         $rows = array();
         $ar_time = time();
         if ($this->memberData['member_id']) {
             $rows = array($ar_time . '.' . md5(microtime()) => array('id' => 0, 'login_type' => IPSMember::isLoggedInAnon($this->memberData), 'running_time' => $ar_time, 'seo_name' => $this->memberData['members_seo_name'], 'member_id' => $this->memberData['member_id'], 'member_name' => $this->memberData['members_display_name'], 'member_group' => $this->memberData['member_group_id']));
         }
         $this->DB->build(array('select' => 's.id, s.member_id, s.member_name, s.seo_name, s.login_type, s.running_time, s.member_group, s.uagent_type', 'from' => array('sessions' => 's'), 'where' => "running_time > {$time}", 'add_join' => array(array('select' => 'm.member_banned', 'from' => array('members' => 'm'), 'where' => 'm.member_id=s.member_id', 'type' => 'left'))));
         $this->DB->execute();
         //-----------------------------------------
         // FETCH...
         //-----------------------------------------
         while ($r = $this->DB->fetch()) {
             $rows[$r['running_time'] . '.' . $r['id']] = $r;
         }
         krsort($rows);
         //-----------------------------------------
         // cache all printed members so we
         // don't double print them
         //-----------------------------------------
         $cached = array();
         foreach ($rows as $result) {
             //-----------------------------------------
             // Skip Banned
             //-----------------------------------------
             if ($result['member_banned']) {
                 continue;
             }
             //-----------------------------------------
             // Bot?
             //-----------------------------------------
             if (isset($result['uagent_type']) && $result['uagent_type'] == 'search') {
                 /* Skipping bot? */
                 if (!$this->settings['spider_active']) {
                     continue;
                 }
                 //-----------------------------------------
                 // Seen bot of this type yet?
                 //-----------------------------------------
                 if (!$cached[$result['member_name']]) {
                     $active['NAMES'][] = IPSMember::makeNameFormatted($result['member_name'], $result['member_group']);
                     $cached[$result['member_name']] = 1;
                 } else {
                     //-----------------------------------------
                     // Yup, count others as guest
                     //-----------------------------------------
                     $active['GUESTS']++;
                 }
             } else {
                 if (!$result['member_id'] or !$result['member_name']) {
                     $active['GUESTS']++;
                 } else {
                     if (empty($cached[$result['member_id']])) {
                         $cached[$result['member_id']] = 1;
                         $result['member_name'] = IPSMember::makeNameFormatted($result['member_name'], $result['member_group']);
                         /* Reset login type in case the board/group setting got changed */
                         $result['login_type'] = IPSMember::isLoggedInAnon(array('login_anonymous' => $result['login_type']), $result['member_group']);
                         if ($result['login_type']) {
                             if ($this->memberData['g_access_cp'] || $this->memberData['member_id'] == $result['member_id']) {
                                 $active['NAMES'][] = IPSMember::makeProfileLink($result['member_name'], $result['member_id'], $result['seo_name']) . "*";
                                 $active['ANON']++;
                             } else {
                                 $active['ANON']++;
                             }
                         } else {
                             $active['MEMBERS']++;
                             $active['NAMES'][] = IPSMember::makeProfileLink($result['member_name'], $result['member_id'], $result['seo_name']);
                         }
                     }
                 }
             }
         }
         $active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
         $this->users_online = $active['TOTAL'];
     }
     $this->lang->words['active_users'] = sprintf($this->lang->words['active_users'], $this->settings['au_cutoff']);
     return $active;
 }
 /**
  * Parse search results
  *
  * @param	array 	$r			Search result
  * @return	array 	$html		Blocks of HTML
  */
 public function parseAndFetchHtmlBlocks($rows)
 {
     /* Forum stuff */
     $sub = false;
     $isVnc = false;
     $search_term = IPSSearchRegistry::get('in.clean_search_term');
     $noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
     $results = array();
     $attachPids = array();
     /* loop and process */
     foreach ($rows as $id => $data) {
         /* Reset */
         $pages = 0;
         /* Set up forum */
         $forum = $this->registry->getClass('class_forums')->forum_by_id[$data['forum_id']];
         $this->last_topic = $data['tid'];
         /* Various data */
         $data['_last_post'] = $data['last_post'];
         $data['_longTitle'] = $data['content_title'];
         $data['_shortTitle'] = IPSText::mbstrlen(strip_tags($data['content_title'])) > 60 ? IPSText::truncate($data['content_title'], 60) : $data['content_title'];
         $data['last_poster'] = $data['last_poster_id'] ? IPSMember::buildDisplayData($data['last_poster_id']) : IPSMember::buildDisplayData(IPSMember::setUpGuest($this->settings['guest_name_pre'] . $data['last_poster_name'] . $this->settings['guest_name_suf']));
         $data['starter'] = $data['starter_id'] ? IPSMember::makeProfileLink($data['starter_name'], $data['starter_id'], $data['seo_first_name']) : $this->settings['guest_name_pre'] . $data['starter_name'] . $this->settings['guest_name_suf'];
         //$data['last_post']   = $this->registry->getClass( 'class_localization')->getDate( $data['last_post'], 'SHORT' );
         if (isset($data['post_date'])) {
             $data['_post_date'] = $data['post_date'];
             //$data['post_date']	= $this->registry->getClass( 'class_localization')->getDate( $data['post_date'], 'SHORT' );
         }
         if ($this->registry->getClass('class_forums')->canQueuePosts($forum['id'])) {
             $data['posts'] += intval($data['topic_queuedposts']);
         }
         if ($this->registry->getClass('class_forums')->canSeeSoftDeletedPosts($forum['id'])) {
             $data['posts'] += intval($data['topic_deleted_posts']);
         }
         if ($data['posts']) {
             if (($data['posts'] + 1) % $this->settings['display_max_posts'] == 0) {
                 $pages = ($data['posts'] + 1) / $this->settings['display_max_posts'];
             } else {
                 $number = ($data['posts'] + 1) / $this->settings['display_max_posts'];
                 $pages = ceil($number);
             }
         }
         if ($pages > 1) {
             for ($i = 0; $i < $pages; ++$i) {
                 $real_no = $i * $this->settings['display_max_posts'];
                 $page_no = $i + 1;
                 if ($page_no == 4 and $pages > 4) {
                     $data['pages'][] = array('last' => 1, 'st' => ($pages - 1) * $this->settings['display_max_posts'], 'page' => $pages, 'total' => $pages);
                     break;
                 } else {
                     $data['pages'][] = array('last' => 0, 'st' => $real_no, 'page' => $page_no, 'total' => $pages);
                 }
             }
         }
         /* For-matt some stuffs */
         if (IPSSearchRegistry::get('opt.noPostPreview') != true) {
             if (!$data['cache_content']) {
                 IPSText::getTextClass('bbcode')->parse_smilies = $data['use_emo'];
                 IPSText::getTextClass('bbcode')->parse_html = ($forum['use_html'] and $this->caches['group_cache'][$data['member_group_id']]['g_dohtml'] and $data['post_htmlstate']) ? 1 : 0;
                 IPSText::getTextClass('bbcode')->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
                 IPSText::getTextClass('bbcode')->parse_bbcode = $forum['use_ibc'];
                 IPSText::getTextClass('bbcode')->parsing_section = 'topics';
                 IPSText::getTextClass('bbcode')->parsing_mgroup = $data['member_group_id'];
                 IPSText::getTextClass('bbcode')->parsing_mgroup_others = $data['mgroup_others'];
                 $data['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($data['post']);
             } else {
                 $data['post'] = '<!--cached-' . gmdate('r', $data['cache_updated']) . '-->' . $data['cache_content'];
             }
             $data['post'] = IPSText::searchHighlight($data['post'], $search_term);
         }
         /* Has attachments */
         if ($data['topic_hasattach']) {
             $attachPids[$data['pid']] = $data['post'];
         }
         $rows[$id] = $data;
     }
     /* Attachments */
     if (count($attachPids) and IPSSearchRegistry::get('set.returnType') != 'tids') {
         /* Load attachments class */
         if (!is_object($this->class_attach)) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
             $this->class_attach = new $classToLoad($this->registry);
             $this->class_attach->type = 'post';
             $this->class_attach->init();
         }
         $attachHTML = $this->class_attach->renderAttachments($attachPids, array_keys($attachPids));
         /* Now parse back in the rendered posts */
         if (is_array($attachHTML) and count($attachHTML)) {
             foreach ($attachHTML as $id => $_data) {
                 /* Get rid of any lingering attachment tags */
                 if (stristr($_data['html'], "[attachment=")) {
                     $_data['html'] = IPSText::stripAttachTag($_data['html']);
                 }
                 $rows[$id]['post'] = $_data['html'];
                 $rows[$id]['attachmentHtml'] = $_data['attachmentHtml'];
             }
         }
     }
     /* Go through and build HTML */
     foreach ($rows as $id => $data) {
         /* Format content */
         list($html, $sub) = $this->formatContent($data);
         $results[$id] = array('html' => $html, 'app' => $data['app'], 'type' => $data['type'], 'sub' => $sub, '_followData' => !empty($data['_followData']) ? $data['_followData'] : array());
     }
     return $results;
 }
 /**
  * Returns a list (with buildProfilePhoto set) of users in an application
  *
  * @param	string		$app		Application folder/key
  * @param	array		$options	Array of options to add/override checks for the query
  * @return	@e array Array of found sessions (members, guests, bots, anons)
  *
  * <b>Filters:</b>
  * - cutoff:		Specify a different cutoff time rather than using the default setting
  * - addJoins:		Add more joins for the query
  * - addWhere:		Add more checks for the 'where' part of the query (everything is joined with ' AND ')
  * - overrideWhere:	Specify manually the 'where' part of the query, the query must be already compiled
  * - overrideGroup:	if set to true the check against the 'gbw_view_online_lists' group setting is skipped
  * - skipParsing:	If set to true the parseOnlineEntries from coreExtensions is NOT executed
  * - includeErrors:	If set to true the in_error=1 lines are loaded as well from the table
  * - excludeViewer:	If set to true skips loading the row for the current session_id, it is required to load the current member viewing the page as sessions table is not updated at this point yet but only on destruct
  * 
  * <b>Example Usage:</b>
  * @code
  * $onlineUsers = $this->getUsersIn( 'forums', array( 'cutoff' => 90 ) );
  * $onlineUsers = $this->getUsersIn( 'forums', array( 'cutoff' => 90, 'addJoins' => array( ... ), 'addWhere' => array( ... ) ) );
  * $onlineUsers = $this->getUsersIn( 'forums', array( 'overrideWhere' => "s.current_appcomponent='forums' AND (s.running_time > TIME_A OR s.running_time < TIME_B)" ) );
  * @endcode
  */
 public function getUsersIn($app, $options = array())
 {
     /* App we're checking is not even installed? */
     if (!IPSLib::appIsInstalled($app, false)) {
         return array();
     }
     /* Can't view online lists? */
     if (empty($options['overrideGroup']) && !$this->memberData['gbw_view_online_lists']) {
         return array();
     }
     /* Init vars and check options */
     $return = array('stats' => array('total' => 0, 'members' => 0, 'guests' => 0, 'bots' => 0, 'anon' => 0), 'rows' => array('members' => array(), 'bots' => array(), 'guests' => array(), 'anon' => array()), 'names' => array());
     $cutoff = empty($options['cutoff']) ? $this->settings['au_cutoff'] : $options['cutoff'];
     $limit = time() - $cutoff * 60;
     $rows = array();
     $NOWJIM = IPS_UNIX_TIME_NOW;
     $cached = array();
     /* Sort joins */
     $_joins = array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=s.member_id', 'type' => 'left'));
     if (isset($options['addJoins']) && is_array($options['addJoins']) && count($options['addJoins'])) {
         $_joins = array_merge($_joins, $options['addJoins']);
     }
     /* Sort where.. override? */
     if (!empty($options['overrideWhere']) && is_string($options['overrideWhere'])) {
         $where = $options['overrideWhere'];
     } else {
         /* Normal where */
         $where = array("s.current_appcomponent='" . $this->DB->addSlashes($app) . "'", 's.running_time > ' . $limit);
         /* Load error rows? */
         if (empty($options['includeErrors'])) {
             $where[] = 's.in_error=0';
         }
         /* Add more where parts */
         if (isset($options['addWhere']) && is_array($options['addWhere']) && count($options['addWhere'])) {
             $where = array_merge($where, $options['addWhere']);
         }
         $where = implode(' AND ', $where);
     }
     /* We're a viewer too? Get our session separately */
     $_extraWhere = empty($options['excludeViewer']) ? "s.id='{$this->member->session_id}' OR " : '';
     /* Dee bee */
     $this->DB->build(array('select' => 's.*, s.id as row_session_id', 'from' => array('sessions' => 's'), 'where' => "{$_extraWhere}({$where})", 'add_join' => $_joins));
     $this->DB->execute();
     while ($session = $this->DB->fetch()) {
         /* Reset for possible bad joins */
         $session['id'] = $session['row_session_id'];
         /* Update our own session properly? */
         if ($session['id'] == $this->member->session_id) {
             $session = array_merge($session, $this->member->sessionClass()->returnCurrentSession());
         }
         $rows[$session['running_time'] . '.' . $session['id']] = $session;
     }
     /* No rows? */
     if (!count($rows)) {
         return $return;
     }
     krsort($rows);
     /* Are we parsing online entries or want only the names */
     if (empty($options['skipParsing'])) {
         /* Process them */
         $filename = IPSLib::getAppDir($app) . '/extensions/coreExtensions.php';
         if (is_file($filename)) {
             $classToLoad = IPSLib::loadLibrary($filename, 'publicSessions__' . $app, $app);
             $loader = new $classToLoad();
             if (method_exists($loader, 'parseOnlineEntries')) {
                 $rows = $loader->parseOnlineEntries($rows);
             }
         }
         /* No rows? */
         if (!count($rows)) {
             return $return;
         }
     }
     /* Sort through */
     foreach ($rows as $id => $result) {
         $last_date = $this->registry->getClass('class_localization')->getTime($result['running_time']);
         /* ROBOT - or DODOT! */
         if (strstr($result['id'], '_session')) {
             $botname = preg_replace('/^(.+?)=/', "\\1", $result['id']);
             if (!$cached['srch_' . $result['member_name']]) {
                 $result = IPSMember::buildProfilePhoto($result);
                 $result['parsedMemberName'] = $result['member_name'];
                 $return['rows']['bots'][$result['id']] = $result;
                 $return['names'][$result['id']] = $result['parsedMemberName'];
                 $cached['srch_' . $result['member_name']]['count'] = 1;
             } else {
                 $cached['srch_' . $result['member_name']]['count']++;
             }
             $return['stats']['bots']++;
         } else {
             if (!$result['member_id']) {
                 $result = IPSMember::buildProfilePhoto(0);
                 $result['parsedMemberName'] = $this->lang->words['global_guestname'];
                 $return['rows']['guests'][$result['id']] = $result;
                 $return['stats']['guests']++;
             } else {
                 if (empty($cached[$result['member_id']])) {
                     $cached[$result['member_id']] = 1;
                     $result = IPSMember::buildProfilePhoto($result);
                     $result['parsedMemberName'] = IPSMember::makeNameFormatted($result['member_name'], $result['member_group']);
                     /* Reset login type in case the board/group setting got changed */
                     $result['login_type'] = IPSMember::isLoggedInAnon(array('login_anonymous' => $result['login_type']), $result['member_group_id']);
                     if ($result['login_type']) {
                         if ($this->memberData['g_access_cp'] || $this->memberData['member_id'] == $result['member_id']) {
                             $result['parsedMemberName'] = IPSMember::makeProfileLink($result['parsedMemberName'], $result['member_id'], $result['seo_name']);
                             $result['parsedMemberName'] .= '*';
                             # Add anonymous asterisk
                             $return['rows']['anon'][$result['id']] = $result;
                             $return['names'][$result['id']] = $result['parsedMemberName'];
                         }
                         $return['stats']['anon']++;
                     } else {
                         $result['parsedMemberName'] = IPSMember::makeProfileLink($result['parsedMemberName'], $result['member_id'], $result['seo_name']);
                         $return['rows']['members'][$result['id']] = $result;
                         $return['names'][$result['id']] = $result['parsedMemberName'];
                         $return['stats']['members']++;
                     }
                 }
             }
         }
     }
     /* Process bots */
     foreach ($cached as $name => $val) {
         if ($val['count'] && substr($name, 0, 5) == 'srch_') {
             foreach ($return['rows']['bots'] as $row) {
                 if ($row['parsedMemberName'] == substr($name, 5)) {
                     $return['rows']['bots'][$row['id']]['parsedMemberName'] .= ' (' . $val['count'] . ')';
                     $return['rows']['bots'][$row['id']]['member_name'] = $return['rows']['bots'][$row['id']]['parsedMemberName'];
                     $return['names'][$row['id']] = $return['rows']['bots'][$row['id']]['parsedMemberName'];
                     break;
                 }
             }
         }
     }
     $return['stats']['total'] = intval($return['stats']['bots']) + intval($return['stats']['guests']) + intval($return['stats']['anon']) + intval($return['stats']['members']);
     return $return;
 }
 function topicHistory($topic, $avg_post, $mod_logs = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_mod', $this->_funcHooks['topicHistory'])) {
         $count_3801b14cb2a320bfc782b7f5d5435fe3 = is_array($this->functionData['topicHistory']) ? count($this->functionData['topicHistory']) : 0;
         $this->functionData['topicHistory'][$count_3801b14cb2a320bfc782b7f5d5435fe3]['topic'] = $topic;
         $this->functionData['topicHistory'][$count_3801b14cb2a320bfc782b7f5d5435fe3]['avg_post'] = $avg_post;
         $this->functionData['topicHistory'][$count_3801b14cb2a320bfc782b7f5d5435fe3]['mod_logs'] = $mod_logs;
     }
     if (!isset($this->registry->templateStriping['topicHistory'])) {
         $this->registry->templateStriping['topicHistory'] = array(FALSE, "row1", "row2");
     }
     if (!isset($this->registry->templateStriping['modlogs'])) {
         $this->registry->templateStriping['modlogs'] = array(FALSE, "row1", "row2");
     }
     $IPBHTML .= "<h1 class='ipsType_pagetitle'>{$this->lang->words['th_title']}</h1>\n<br />\n<div class='ipsBox'>\n\t<table class='ipb_table' summary=\"{$this->lang->words['topic_history_summary']} '{$topic['title']}'\">\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_topic']}</td>\n\t\t\t<td>{$topic['title']}</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_start_date']}</td>\n\t\t\t<td>" . IPSText::htmlspecialchars($this->registry->getClass('class_localization')->getDate($topic['start_date'], "long", 0)) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_start_name']}</td>\n\t\t\t<td>" . IPSMember::makeProfileLink($topic['starter_name'], $topic['starter_id'], $topic['seo_first_name']) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_last_date']}</td>\n\t\t\t<td>" . IPSText::htmlspecialchars($this->registry->getClass('class_localization')->getDate($topic['last_post'], "long", 0)) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_last_name']}</td>\n\t\t\t<td>" . IPSMember::makeProfileLink($topic['last_poster_name'], $topic['last_poster_id'], $topic['seo_last_name']) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_avg_post']}</td>\n\t\t\t<td>{$avg_post}</td>\n\t\t</tr>\n\t</table>\n</div>\n<br /><br />\n<h3 class='maintitle'>{$this->lang->words['ml_title']}</h3>\n<table class='ipb_table' summary=\"{$this->lang->words['mod_logs_topic_summary']} '{$topic['title']}'\">\n\t<tr class='header'>\n\t\t<th scope='col' style='width: 25%'>{$this->lang->words['ml_name']}</th>\n\t\t<th scope='col' style='width: 50%'>{$this->lang->words['ml_desc']}</th>\n\t\t<th scope='col' style='width: 25%'>{$this->lang->words['ml_date']}</th>\n\t</tr>\n\t" . ((!count($mod_logs) or !is_array($mod_logs)) ? "\n\t\t<tr>\n\t\t\t<td class=\"no_messages\" colspan=\"3\">{$this->lang->words['ml_none']}</td>\n\t\t</tr>\n\t" : "\n\t\t\t\t" . $this->__f__ea449a7c065707283e6cff85e531d03c($topic, $avg_post, $mod_logs) . "\t") . "\n</table>";
     return $IPBHTML;
 }
 function topicHistory($topic, $avg_post, $mod_logs = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_mod', $this->_funcHooks['topicHistory'])) {
         $count_1b50469704a7bbeb098e99d3bac16f0d = is_array($this->functionData['topicHistory']) ? count($this->functionData['topicHistory']) : 0;
         $this->functionData['topicHistory'][$count_1b50469704a7bbeb098e99d3bac16f0d]['topic'] = $topic;
         $this->functionData['topicHistory'][$count_1b50469704a7bbeb098e99d3bac16f0d]['avg_post'] = $avg_post;
         $this->functionData['topicHistory'][$count_1b50469704a7bbeb098e99d3bac16f0d]['mod_logs'] = $mod_logs;
     }
     if (!isset($this->registry->templateStriping['topicHistory'])) {
         $this->registry->templateStriping['topicHistory'] = array(FALSE, "row1", "row2");
     }
     if (!isset($this->registry->templateStriping['modlogs'])) {
         $this->registry->templateStriping['modlogs'] = array(FALSE, "row1", "row2");
     }
     $IPBHTML .= "<h1 class='ipsType_pagetitle'>{$this->lang->words['th_title']}</h1>\n<br />\n<div class='ipsBox'>\n\t<table class='ipb_table' summary=\"{$this->lang->words['topic_history_summary']} '{$topic['title']}'\">\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_topic']}</td>\n\t\t\t<td>{$topic['title']}</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_start_date']}</td>\n\t\t\t<td>" . IPSText::htmlspecialchars($this->registry->getClass('class_localization')->getDate($topic['start_date'], "long", 0)) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_start_name']}</td>\n\t\t\t<td>" . IPSMember::makeProfileLink($topic['starter_name'], $topic['starter_id'], $topic['seo_first_name']) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_last_date']}</td>\n\t\t\t<td>" . IPSText::htmlspecialchars($this->registry->getClass('class_localization')->getDate($topic['last_post'], "long", 0)) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_last_name']}</td>\n\t\t\t<td>" . IPSMember::makeProfileLink($topic['last_poster_name'], $topic['last_poster_id'], $topic['seo_last_name']) . "</td>\n\t\t</tr>\n\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["topicHistory"]) . "'>\n\t\t\t<td class='altrow'>{$this->lang->words['th_avg_post']}</td>\n\t\t\t<td>{$avg_post}</td>\n\t\t</tr>\n\t</table>\n</div>\n<br /><br />\n" . $this->registry->getClass('output')->getReplacement("header_start") . "<h3 class='maintitle'>{$this->lang->words['ml_title']}</h3>" . $this->registry->getClass('output')->getReplacement("header_end") . "\n<table class='ipb_table' summary=\"{$this->lang->words['mod_logs_topic_summary']} '{$topic['title']}'\">\n\t<tr class='header'>\n\t\t<th scope='col' style='width: 25%'>{$this->lang->words['ml_name']}</th>\n\t\t<th scope='col' style='width: 50%'>{$this->lang->words['ml_desc']}</th>\n\t\t<th scope='col' style='width: 25%'>{$this->lang->words['ml_date']}</th>\n\t</tr>\n\t" . ((!count($mod_logs) or !is_array($mod_logs)) ? "\n\t\t<tr>\n\t\t\t<td class=\"no_messages\" colspan=\"3\">{$this->lang->words['ml_none']}</td>\n\t\t</tr>\n\t" : "\n\t\t\t\t" . $this->__f__eb104f2455584e94510fb699d0d1cfd3($topic, $avg_post, $mod_logs) . "\t") . "\n</table>" . $this->registry->getClass('output')->getReplacement("box_end") . "";
     return $IPBHTML;
 }