/**
  * Returns possible matches for the string input
  *
  * @access	private
  * @return	void		Outputs to screen
  */
 private function _getMemberNames()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $name = $this->convertAndMakeSafe(ipsRegistry::$request['name'], 0);
     //-----------------------------------------
     // Check length
     //-----------------------------------------
     if (IPSText::mbstrlen($name) < 3) {
         $this->returnJsonError('requestTooShort');
     }
     //-----------------------------------------
     // Try query...
     //-----------------------------------------
     $this->DB->build(array('select' => 'm.members_display_name, m.name, m.member_id, m.member_group_id', 'from' => array('members' => 'm'), 'where' => "LOWER(m.members_display_name) LIKE '" . $this->DB->addSlashes($name) . "%'", 'order' => $this->DB->buildLength('m.members_display_name') . ' ASC', 'limit' => array(0, 15), 'add_join' => array(array('select' => 'p.*', 'from' => array('profile_portal' => 'p'), 'where' => 'p.pp_member_id=m.member_id', 'type' => 'left'))));
     $this->DB->execute();
     //-----------------------------------------
     // Got any results?
     //-----------------------------------------
     if (!$this->DB->getTotalRows()) {
         $this->returnJsonArray(array());
     }
     $return = array();
     while ($r = $this->DB->fetch()) {
         $photo = IPSMember::buildProfilePhoto($r);
         $group = IPSLib::makeNameFormatted('', $r['member_group_id']);
         $return[$r['member_id']] = array('name' => $r['members_display_name'], 'showas' => '<strong>' . $r['members_display_name'] . '</strong> (' . $group . ')', 'img' => $photo['pp_thumb_photo'], 'img_w' => $photo['pp_mini_width'], 'img_h' => $photo['pp_mini_height']);
     }
     $this->returnJsonArray($return);
 }
 function __f__90e75c2e9e9f8c07c1637ee640ca3292($reports = array(), $acts = "", $pages = "", $active = array(), $statuses = array())
 {
     $_ips___x_retval = '';
     foreach ($reports as $report) {
         $_ips___x_retval .= "\n\t\t\t<tr class='" . IPSLib::next($this->registry->templateStriping["reportsTable"]) . "'>\n\t\t\t\t<td class='short altrow'>\n\t\t\t\t\t<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=reports&amp;section=reports&amp;do=process&amp;report_ids[{$report['id']}]={$report['id']}&amp;newstatus=2&amp;k={$this->member->form_hash}", 'public', ''), "", "") . "\" title='{$this->lang->words['change_current_status']}' class='ipbmenu' id='change_status-{$report['id']}'><span id=\"rstat-{$report['id']}\">{$report['status_icon']}</span></a>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"{$this->settings['base_url']}&amp;app=core&amp;module=reports&amp;do=show_report&amp;rid={$report['id']}\" title='{$this->lang->words['view_report']}'>{$report['title']}</a>\n\t\t\t\t\t" . (is_array($statuses) && count($statuses) ? "\n\t\t\t\t\t\t<ul class='ipbmenu_content' id='change_status-{$report['id']}_menucontent'>\n\t\t\t\t\t\t\t" . $this->__f__c1c6cfe46bdd613aa1d2b014bf4fb993($reports, $acts, $pages, $active, $statuses, $report) . "\t\t\t\t\t\t</ul>\n\t\t\t\t\t" : "") . "\n\t\t\t\t</td>\n\t\t\t\t<td class='altrow'>\n\t\t\t\t\t" . ($report['section']['url'] ? "\n\t\t\t\t\t\t<a href=\"{$report['section']['url']}\" title='{$this->lang->words['go_to_section']}'>{$report['section']['title']}</a>\n\t\t\t\t\t" : "\n\t\t\t\t\t\t{$report['section']['title']}\n\t\t\t\t\t") . "\n\t\t\t\t</td>\n\t\t\t\t<td class='short'>{$report['num_reports']}</td>\n\t\t\t\t<td class='short altrow'>{$report['num_comments']}</td>\n\t\t\t\t<td class=''>\n\t\t\t\t\t<ul class='last_post'>\n\t\t\t\t\t\t<li><strong>{$this->lang->words['report_updated']}</strong> " . $this->registry->getClass('class_localization')->getDate($report['date_updated'], "tiny", 0) . "</li>\n\t\t\t\t\t\t<li><strong>{$this->lang->words['report_by']}</strong> <a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$report['updated_by']}", 'public', ''), "{$report['n_updated_seoname']}", "showuser") . "\" title='{$this->lang->words['view_member']}'>" . IPSLib::makeNameFormatted($report['n_updated_by'], $report['member_group_id']) . "</a>" . $this->registry->getClass('output')->getTemplate('global')->user_popup($report['updated_by'], $report['n_updated_seoname']) . "</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</td>\n\t\t\t\t<td class='short altrow'>\n\t\t\t\t\t<input type='checkbox' id='report_check_{$report['id']}' class='input_check checkall' name='report_ids[]' value='{$report['id']}' />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\n";
     }
     $_ips___x_retval .= '';
     return $_ips___x_retval;
 }
 function __f__f518b38fad2c76372ddaf8934526cf8f($members, $pages = "", $dropdowns = array(), $defaults = array(), $custom_fields = null, $url = '')
 {
     $_ips___x_retval = '';
     foreach ($members as $member) {
         $_ips___x_retval .= "\n\t\t\t\t\t<li class='lofi_member'>\n\t\t\t\t\t\t<h3>\n\t\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$member['member_id']}", 'public', ''), "{$member['members_seo_name']}", "showuser") . "' title='{$this->lang->words['view_profile']}'>{$member['members_display_name']}</a>\n\t\t\t\t\t\t\t<span class='desc'>( {$this->lang->words['member_posts']}: " . $this->registry->getClass('class_localization')->formatNumber($member['posts']) . " )</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<span class='desc'><strong>" . IPSLib::makeNameFormatted($member['group'], $member['member_group_id']) . "</strong></span><br />\n\t\t\t\t\t\t<span class='desc'>{$this->lang->words['member_joined']} " . $this->registry->getClass('class_localization')->getDate($member['joined'], "joined", 0) . "</span> \n\t\t\t\t\t</li>\n\t\t\t\t\n";
     }
     $_ips___x_retval .= '';
     return $_ips___x_retval;
 }
 function __f__bbeb34120594dcbbf1392e3622a54dac($rows, $links = "", $defaults = array(), $our_mgroups = array())
 {
     $_ips___x_retval = '';
     foreach ($rows as $session) {
         $_ips___x_retval .= "\n\t\t\t<tr>\n\t\t\t\t<td class='row1'>\n\t\t\t\t\t<img src='{$session['_memberData']['pp_thumb_photo']}' alt=\"{$session['_memberData']['members_display_name']}{$this->lang->words['users_photo']}\" width='{$session['_memberData']['pp_thumb_width']}' height='{$session['_memberData']['pp_thumb_height']}' class='photo' />\n\t\t\t\t</td>\n\t\t\t\t<td class='" . IPSLib::next($this->registry->templateStriping["online"]) . "'>\n\t\t\t\t\t" . ($session['member_name'] ? "" . ($session['member_id'] ? "\n\t\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$session['member_id']}", 'public', ''), "{$session['seo_name']}", "showuser") . "' title='{$this->lang->words['view_profile']}'>" . IPSLib::makeNameFormatted($session['member_name'], $session['member_group']) . "</a>" . $this->registry->getClass('output')->getTemplate('global')->user_popup($session['member_id'], $session['seo_name']) . "\n\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t" . IPSLib::makeNameFormatted($session['member_name'], $session['member_group']) . "\n\t\t\t\t\t\t") . "" : "\n\t\t\t\t\t\t{$this->lang->words['global_guestname']}\n\t\t\t\t\t") . "\n\t\t\t\t\t" . (($session['is_bot'] and $this->settings['spider_anon']) ? "" . ($this->memberData['g_access_cp'] ? "\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t" : "") . "" : "" . ($session['login_type'] == 1 ? "" . ((!$this->settings['disable_admin_anon'] and $this->memberData['g_access_cp']) ? "\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t" : "") . "" : "") . "") . "\n\t\t\t\t\t" . (($this->memberData['g_access_cp'] and !$this->settings['disable_online_ip']) ? "\n\t\t\t\t\t\t<span class='ip'>( {$session['ip_address']} )</span>\n\t\t\t\t\t" : "") . "\n\t\t\t\t</td>\n\t\t\t\t<td class='" . IPSLib::next($this->registry->templateStriping["online"]) . "'>\n\t\t\t\t\t" . (!$session['where_line'] ? "\n\t\t\t\t\t\t{$this->lang->words['board_index']}\n\t\t\t\t\t" : "" . (($session['where_link'] and !$session['where_line_more']) ? "\n\t\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$session['where_link']}", 'public', ''), "", "") . "'>\n\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t{$session['where_line']} \n\t\t\t\t\t\t" . ($session['where_line_more'] ? "&nbsp;\n\t\t\t\t\t\t\t" . ($session['_whereLinkSeo'] ? "\n\t\t\t\t\t\t\t\t<a href='{$session['_whereLinkSeo']}'>\n\t\t\t\t\t\t\t" : "" . ($session['where_link'] ? "<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("{$session['where_link']}", 'public', ''), "", "") . "'>" : "") . "") . "\n\t\t\t\t\t\t\t{$session['where_line_more']}\n\t\t\t\t\t\t\t" . ($session['where_link'] ? "</a>" : "") . "" : "" . ($session['where_link'] ? "</a>" : "") . "") . "") . "\n\t\t\t\t</td>\n\t\t\t\t<td class='" . IPSLib::next($this->registry->templateStriping["online"]) . "'>\n\t\t\t\t\t" . $this->registry->getClass('class_localization')->getDate($session['running_time'], "long", 1) . "\n\t\t\t\t</td>\n\t\t\t\t<td class='" . IPSLib::next($this->registry->templateStriping["online"]) . "'>\n\t\t\t\t\t" . (($session['member_id'] and $session['member_name']) ? "<ul class='user_controls clear'>\n\t\t\t\t\t\t\t" . (($this->memberData['member_id'] and $this->memberData['member_id'] != $session['member_id'] && $this->settings['friends_enabled'] and $this->memberData['g_can_add_friends']) ? "" . (IPSMember::checkFriendStatus($session['member_id']) ? "\n\t\t\t\t\t\t\t\t\t<li class='mini_friend_toggle is_friend' id='friend_online_{$session['member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=friends&amp;do=remove&amp;member_id={$session['member_id']}&amp;secure_key={$this->member->form_hash}", 'public', ''), "", "") . "' title='{$this->lang->words['remove_friend']}'>" . $this->registry->getClass('output')->getReplacement("remove_friend") . "</a></li>\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\t\t<li class='mini_friend_toggle is_not_friend' id='friend_online_{$session['member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=friends&amp;do=add&amp;member_id={$session['member_id']}&amp;secure_key={$this->member->form_hash}", 'public', ''), "", "") . "' title='{$this->lang->words['add_friend']}'>" . $this->registry->getClass('output')->getReplacement("add_friend") . "</a></li>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t") . "" : "") . "\n\t\t\t\t\t\t\t" . (($this->memberData['member_id'] and $this->memberData['member_id'] != $session['member_id'] and $this->memberData['g_use_pm'] and $this->memberData['members_disable_pm'] == 0 and IPSLib::moduleIsEnabled('messaging', 'members')) ? "\n\t\t\t\t\t\t\t\t<li class='pm_button' id='pm_online_{$session['member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=messaging&amp;section=send&amp;do=form&amp;fromMemberID={$session['member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['pm_member']}'>" . $this->registry->getClass('output')->getReplacement("send_msg") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . (($session['memberData']['has_blog'] and IPSLib::appIsInstalled('blog')) ? "\n\t\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=blog&amp;module=display&amp;section=blog&amp;mid={$session['member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['view_blog']}'>" . $this->registry->getClass('output')->getReplacement("blog_link") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . (($session['memberData']['has_gallery'] and IPSLib::appIsInstalled('gallery')) ? "\n\t\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=gallery&amp;module=user&amp;section=user&amp;user={$session['member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['view_gallery']}'>" . $this->registry->getClass('output')->getReplacement("gallery_link") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t</ul>" : "\n\t\t\t\t\t\t<span class='desc'>{$this->lang->words['no_options_available']}</span>\n\t\t\t\t\t") . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\n";
     }
     $_ips___x_retval .= '';
     return $_ips___x_retval;
 }
 /**
  * Generate active user data
  *
  * @access	private
  * @return	array 	Array of data (not the most helpful description ever. Sorry
  * @author	Matt
  */
 private function _generateActiveUserData()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $ar_time = time();
     $cached = array();
     $guests = array();
     $cut_off = $this->settings['au_cutoff'] != "" ? $this->settings['au_cutoff'] * 60 : 900;
     $time = time() - $cut_off;
     $active = array('guests' => 0, 'anon' => 0, 'members' => 0, 'names' => array());
     $rows = array($ar_time => array('login_type' => substr($this->memberData['login_anonymous'], 0, 1), 'id' => $this->member->session_id, 'location' => 'sf', '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']));
     //-----------------------------------------
     // Get the users
     //-----------------------------------------
     $this->DB->build(array('select' => 's.member_id, s.member_name, s.member_group, s.id, s.login_type, s.location, s.running_time, s.uagent_type, s.seo_name', 'from' => array('sessions' => 's'), 'where' => "s.location_2_type='forum' AND s.location_2_id={$this->forum['id']} AND s.running_time > {$time}\tAND s.in_error=0", 'add_join' => array(array('type' => 'left', 'select' => 't.forum_id', 'where' => 't.tid=s.location_1_id', 'from' => array('topics' => 't')))));
     $this->DB->execute();
     //-----------------------------------------
     // FETCH...
     //-----------------------------------------
     while ($r = $this->DB->fetch()) {
         $rows[$r['running_time'] . '.' . $r['id']] = $r;
     }
     krsort($rows);
     //-----------------------------------------
     // PRINT...
     //-----------------------------------------
     foreach ($rows as $result) {
         $result['member_name'] = IPSLib::makeNameFormatted($result['member_name'], $result['member_group']);
         $last_date = $this->registry->getClass('class_localization')->getTime($result['running_time']);
         if ($result['member_id'] == 0 or !$result['member_name']) {
             if (in_array($result['id'], $guests)) {
                 continue;
             }
             //-----------------------------------------
             // Bot?
             //-----------------------------------------
             if ($result['uagent_type'] == 'search') {
                 /* Skipping bot? */
                 if (!$this->settings['spider_active']) {
                     continue;
                 }
                 //-----------------------------------------
                 // Seen bot of this type yet?
                 //-----------------------------------------
                 if (!$cached[$result['member_name']]) {
                     if ($this->settings['spider_anon']) {
                         if ($this->memberData['g_access_cp']) {
                             $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name']);
                         }
                     } else {
                         $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name']);
                     }
                     $cached[$result['member_name']] = 1;
                 } else {
                     $active['guests']++;
                     $guests[] = $result['id'];
                 }
             } else {
                 $active['guests']++;
                 $guests[] = $result['id'];
             }
         } else {
             if (empty($cached[$result['member_id']])) {
                 $cached[$result['member_id']] = 1;
                 $p_start = "";
                 $p_end = "";
                 $p_title = sprintf($this->lang->words['au_reading'], $last_date);
                 if (strstr($result['current_module'], 'post') and $result['member_id'] != $this->memberData['member_id']) {
                     $p_start = "<span class='activeuserposting'>";
                     $p_end = "</span>";
                     $p_title = sprintf($this->lang->words['au_posting'], $last_date);
                 }
                 if (!$this->settings['disable_anonymous'] and $result['login_type']) {
                     if ($this->memberData['g_access_cp'] and $this->settings['disable_admin_anon'] != 1) {
                         $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'] . '*', 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name']);
                         $active['anon']++;
                     } else {
                         $active['anon']++;
                     }
                 } else {
                     $active['members']++;
                     $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name']);
                 }
             }
         }
     }
     $active['_done'] = 1;
     return $active;
 }
 /**
  * Parse a member for display
  *
  * @access	public
  * @param	mixed	Either array of member data, or member ID to self load
  * @param	array 	Array of flags to parse: 'signature', 'customFields', 'avatar', 'warn'
  * @return	array 	Parsed member data
  */
 public static function buildDisplayData($member, $_parseFlags = array())
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     //-----------------------------------------
     // Figure out parse flags
     //-----------------------------------------
     $parseFlags = array('signature' => isset($_parseFlags['signature']) ? $_parseFlags['signature'] : 0, 'customFields' => isset($_parseFlags['customFields']) ? $_parseFlags['customFields'] : 0, 'avatar' => isset($_parseFlags['avatar']) ? $_parseFlags['avatar'] : 1, 'warn' => isset($_parseFlags['warn']) ? $_parseFlags['warn'] : 1, 'cfSkinGroup' => isset($_parseFlags['cfSkinGroup']) ? $_parseFlags['cfSkinGroup'] : '', 'cfGetGroupData' => isset($_parseFlags['cfGetGroupData']) ? $_parseFlags['cfGetGroupData'] : '', 'cfLocation' => isset($_parseFlags['cfLocation']) ? $_parseFlags['cfLocation'] : '', 'checkFormat' => isset($_parseFlags['checkFormat']) ? $_parseFlags['checkFormat'] : 0);
     if (isset($_parseFlags['__all__'])) {
         foreach ($parseFlags as $k => $v) {
             $parseFlags[$k] = 1;
         }
         $parseFlags['cfSkinGroup'] = '';
     }
     //-----------------------------------------
     // Load the member?
     //-----------------------------------------
     if (!is_array($member) and ($member == intval($member) and $member > 0)) {
         $member = self::load($member, 'all');
     }
     if (!$member['member_group_id']) {
         $member['member_group_id'] = ipsRegistry::$settings['guest_group'];
     }
     /* Unpack bitwise if required */
     if (!isset($member['bw_is_spammer'])) {
         $member = self::buildBitWiseOptions($member);
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $rank_cache = ipsRegistry::cache()->getCache('ranks');
     $group_cache = ipsRegistry::cache()->getCache('group_cache');
     $group_name = IPSLib::makeNameFormatted($group_cache[$member['member_group_id']]['g_title'], $member['member_group_id']);
     $pips = 0;
     $topic_id = intval(isset(ipsRegistry::$request['t']) ? ipsRegistry::$request['t'] : 0);
     $forum_id = intval(isset(ipsRegistry::$request['f']) ? ipsRegistry::$request['f'] : 0);
     //-----------------------------------------
     // SEO Name
     //-----------------------------------------
     $member['members_seo_name'] = self::fetchSeoName($member);
     //-----------------------------------------
     // Avatar
     //-----------------------------------------
     if ($parseFlags['avatar']) {
         $member['avatar'] = self::buildAvatar($member);
     }
     $member['_group_formatted'] = $group_name;
     //-----------------------------------------
     // Ranks
     //-----------------------------------------
     if (is_array($rank_cache) and count($rank_cache)) {
         foreach ($rank_cache as $k => $v) {
             if ($member['posts'] >= $v['POSTS']) {
                 if (!isset($member['title']) || $member['title'] === '' || is_null($member['title'])) {
                     $member['title'] = $v['TITLE'];
                 }
                 $pips = $v['PIPS'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Group image
     //-----------------------------------------
     $member['member_rank_img'] = '';
     $member['member_rank_img_i'] = '';
     if ($group_cache[$member['member_group_id']]['g_icon']) {
         $_img = $group_cache[$member['member_group_id']]['g_icon'];
         if (substr($_img, 0, 4) != 'http') {
             $_img = ipsRegistry::$settings['_original_base_url'] . '/' . ltrim($_img, '/');
         }
         $member['member_rank_img_i'] = 'img';
         $member['member_rank_img'] = $_img;
     } else {
         if ($pips) {
             if (is_numeric($pips)) {
                 for ($i = 1; $i <= $pips; ++$i) {
                     $member['member_rank_img_i'] = 'pips';
                     $member['member_rank_img'] .= ipsRegistry::getClass('output')->getReplacement('pip_pip');
                 }
             } else {
                 $member['member_rank_img_i'] = 'img';
                 $member['member_rank_img'] = ipsRegistry::$settings['public_dir'] . 'style_extra/team_icons/' . $pips;
             }
         }
     }
     //-----------------------------------------
     // Spammer status
     //-----------------------------------------
     $member['spamStatus'] = NULL;
     $member['spamImage'] = NULL;
     $moderator = ipsRegistry::member()->getProperty('forumsModeratorData');
     if (isset($moderator[$forum_id]['bw_flag_spammers']) and $moderator[$forum_id]['bw_flag_spammers'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1) {
         if (!ipsRegistry::$settings['warn_on'] or !strstr(',' . ipsRegistry::$settings['warn_protected'] . ',', ',' . $member['member_group_id'] . ',')) {
             if ($member['bw_is_spammer']) {
                 $member['spamStatus'] = TRUE;
             } else {
                 $member['spamStatus'] = FALSE;
             }
         }
     }
     //-----------------------------------------
     // Warny porny?
     //-----------------------------------------
     if ($parseFlags['warn'] and $member['member_id']) {
         $member['warn_percent'] = NULL;
         $member['can_edit_warn'] = false;
         $member['warn_img'] = NULL;
         if (ipsRegistry::$settings['warn_on'] and !strstr(',' . ipsRegistry::$settings['warn_protected'] . ',', ',' . $member['member_group_id'] . ',')) {
             /* Warnings */
             if (isset($moderator[$forum_id]['allow_warn']) and $moderator[$forum_id]['allow_warn'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1 or ipsRegistry::$settings['warn_show_own'] and ipsRegistry::member()->getProperty('member_id') == $member['member_id']) {
                 // Work out which image to show.
                 if ($member['warn_level'] <= ipsRegistry::$settings['warn_min']) {
                     $member['warn_img'] = '{parse replacement="warn_0"}';
                     $member['warn_percent'] = 0;
                 } else {
                     if ($member['warn_level'] >= ipsRegistry::$settings['warn_max']) {
                         $member['warn_img'] = '{parse replacement="warn_5"}';
                         $member['warn_percent'] = 100;
                     } else {
                         $member['warn_percent'] = $member['warn_level'] ? sprintf("%.0f", $member['warn_level'] / ipsRegistry::$settings['warn_max'] * 100) : 0;
                         if ($member['warn_percent'] > 100) {
                             $member['warn_percent'] = 100;
                         }
                         if ($member['warn_percent'] >= 81) {
                             $member['warn_img'] = '{parse replacement="warn_5"}';
                         } else {
                             if ($member['warn_percent'] >= 61) {
                                 $member['warn_img'] = '{parse replacement="warn_4"}';
                             } else {
                                 if ($member['warn_percent'] >= 41) {
                                     $member['warn_img'] = '{parse replacement="warn_3"}';
                                 } else {
                                     if ($member['warn_percent'] >= 21) {
                                         $member['warn_img'] = '{parse replacement="warn_2"}';
                                     } else {
                                         if ($member['warn_percent'] >= 1) {
                                             $member['warn_img'] = '{parse replacement="warn_1"}';
                                         } else {
                                             $member['warn_img'] = '{parse replacement="warn_0"}';
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($member['warn_percent'] < 1) {
                     $member['warn_percent'] = 0;
                 }
                 /* Bug 14770 - Change so you can't warn yourself */
                 if ((isset($moderator[$forum_id]['allow_warn']) and $moderator[$forum_id]['allow_warn'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1) and $member['member_id'] != ipsRegistry::member()->getProperty('member_id')) {
                     $member['can_edit_warn'] = true;
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile fields stuff
     //-----------------------------------------
     $member['custom_fields'] = "";
     if ($parseFlags['customFields'] == 1 and $member['member_id']) {
         if (isset(self::$_parsedCustomFields[$member['member_id']])) {
             $member['custom_fields'] = self::$_parsedCustomFields[$member['member_id']];
             if ($parseFlags['cfGetGroupData'] and isset(self::$_parsedCustomGroups[$member['member_id']]) and is_array(self::$_parsedCustomGroups[$member['member_id']])) {
                 $member['custom_field_groups'] = self::$_parsedCustomGroups[$member['member_id']];
             }
         } else {
             if (!is_object(self::$custom_fields_class)) {
                 require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
                 self::$custom_fields_class = new customProfileFields();
             }
             if (self::$custom_fields_class) {
                 self::$custom_fields_class->member_data = $member;
                 self::$custom_fields_class->skinGroup = $parseFlags['cfSkinGroup'];
                 self::$custom_fields_class->initData();
                 self::$custom_fields_class->parseToView($parseFlags['checkFormat'], $parseFlags['cfLocation']);
                 $member['custom_fields'] = self::$custom_fields_class->out_fields;
                 self::$_parsedCustomFields[$member['member_id']] = $member['custom_fields'];
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile photo
     //-----------------------------------------
     $member = self::buildProfilePhoto($member);
     //-----------------------------------------
     // Personal statement 'bbcode'
     //-----------------------------------------
     if (stripos($member['pp_bio_content'], '[b]') !== false) {
         if (stripos($member['pp_bio_content'], '[/b]') > stripos($member['pp_bio_content'], '[b]')) {
             $member['pp_bio_content'] = str_ireplace('[b]', '<strong>', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/b]', '</strong>', $member['pp_bio_content']);
         }
     }
     if (stripos($member['pp_bio_content'], '[i]') !== false) {
         if (stripos($member['pp_bio_content'], '[/i]') > stripos($member['pp_bio_content'], '[i]')) {
             $member['pp_bio_content'] = str_ireplace('[i]', '<em>', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/i]', '</em>', $member['pp_bio_content']);
         }
     }
     if (stripos($member['pp_bio_content'], '[u]') !== false) {
         if (stripos($member['pp_bio_content'], '[/u]') > stripos($member['pp_bio_content'], '[u]')) {
             $member['pp_bio_content'] = str_ireplace('[u]', '<span class="underscore">', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/u]', '</span>', $member['pp_bio_content']);
         }
     }
     //-----------------------------------------
     // Signature bbcode
     //-----------------------------------------
     if (isset($member['signature']) and $member['signature'] and $parseFlags['signature']) {
         if (isset(self::$_parsedSignatures[$member['member_id']])) {
             $member['signature'] = self::$_parsedSignatures[$member['member_id']];
         } else {
             if ($member['cache_content']) {
                 $member['signature'] = '<!--cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
             } else {
                 IPSText::getTextClass('bbcode')->parse_bbcode = ipsRegistry::$settings['sig_allow_ibc'];
                 IPSText::getTextClass('bbcode')->parse_smilies = 1;
                 IPSText::getTextClass('bbcode')->parse_html = ipsRegistry::$settings['sig_allow_html'];
                 IPSText::getTextClass('bbcode')->parse_nl2br = 1;
                 IPSText::getTextClass('bbcode')->parsing_section = 'signatures';
                 IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id'];
                 IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others'];
                 $member['signature'] = IPSText::getTextClass('bbcode')->preDisplayParse($member['signature']);
                 IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
             }
             self::$_parsedSignatures[$member['member_id']] = $member['signature'];
         }
     }
     //-----------------------------------------
     // If current session, reset last_activity
     //-----------------------------------------
     if (!empty($member['running_time'])) {
         $member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
     }
     //-----------------------------------------
     // Online?
     //-----------------------------------------
     $time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
     $member['_online'] = 0;
     if (!ipsRegistry::$settings['disable_anonymous'] and isset($member['login_anonymous'])) {
         list($be_anon, $loggedin) = explode('&', $member['login_anonymous']);
     } else {
         $be_anon = 0;
         $loggedin = $member['last_activity'] > $time_limit ? 1 : 0;
     }
     $bypass_anon = 0;
     $our_mgroups = array();
     if (ipsRegistry::member()->getProperty('mgroup_others')) {
         $our_mgroups = explode(",", IPSText::cleanPermString(ipsRegistry::member()->getProperty('mgroup_others')));
     }
     $our_mgroups[] = ipsRegistry::member()->getProperty('member_group_id');
     if (ipsRegistry::member()->getProperty('g_access_cp') and !ipsRegistry::$settings['disable_admin_anon']) {
         $bypass_anon = 1;
     }
     if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
         $member['_online'] = 1;
     }
     //-----------------------------------------
     // Last Active
     //-----------------------------------------
     $member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
     if ($be_anon == 1) {
         // Member last logged in anonymous
         if (!ipsRegistry::member()->getProperty('g_access_cp') or ipsRegistry::$settings['disable_admin_anon']) {
             $member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
         }
     }
     //-----------------------------------------
     // Rating
     //-----------------------------------------
     $member['_pp_rating_real'] = intval($member['pp_rating_real']);
     //-----------------------------------------
     // Long display names
     //-----------------------------------------
     $member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('repCache')) {
         require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
         ipsRegistry::setClass('repCache', new classReputationCache());
     }
     $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
     $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
     //-----------------------------------------
     // Other stuff not worthy of individual comments
     //-----------------------------------------
     $member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
     $member['_pp_profile_views'] = ipsRegistry::getClass('class_localization')->formatNumber($member['members_profile_views']);
     IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
     return $member;
 }
 /**
  * Modern profile
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _viewModern()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval($this->request['id']) ? intval($this->request['id']) : intval($this->request['MID']);
     $member_id = $member_id ? $member_id : $this->memberData['member_id'];
     $tab = substr(IPSText::alphanumericalClean(str_replace('..', '', trim($this->request['tab']))), 0, 20);
     $firsttab = '';
     $member = array();
     $comments = array();
     $comments_html = "";
     $friends = array();
     $visitors = array();
     $comment_perpage = 5;
     $pips = 0;
     $tabs = array();
     $_tabs = array();
     $_positions = array(0 => 0);
     $custom_path = IPSLib::getAppDir('members') . '/sources/tabs';
     $_member_ids = array();
     $sql_extra = '';
     $pass = 0;
     $mod = 0;
     $_todays_date = getdate();
     $time_adjust = $this->settings['time_adjust'] == "" ? 0 : $this->settings['time_adjust'];
     $board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
     //-----------------------------------------
     // Check input..
     //-----------------------------------------
     if (!$member_id) {
         $this->registry->output->silentRedirect($this->settings['base_url']);
     }
     //-----------------------------------------
     // Configure tabs
     //-----------------------------------------
     if (is_dir($custom_path)) {
         foreach (new DirectoryIterator($custom_path) as $f) {
             if (!$f->isDot() && !$f->isDir()) {
                 $file = $f->getFileName();
                 if ($file[0] == '.') {
                     continue;
                 }
                 if (preg_match("#\\.conf\\.php\$#i", $file)) {
                     $classname = str_replace(".conf.php", "", $file);
                     require $custom_path . '/' . $file;
                     //-------------------------------
                     // Allowed to use?
                     //-------------------------------
                     if ($CONFIG['plugin_enabled']) {
                         if (in_array($this->settings['search_method'], array('traditional', 'sphinx')) && $CONFIG['plugin_key'] == 'recentActivity') {
                             continue;
                         }
                         $_position = in_array($CONFIG['plugin_order'], $_positions) ? count($_positions) + 1 : $CONFIG['plugin_order'];
                         $_tabs[$_position] = $CONFIG;
                         $_positions[$_position] = $_position;
                     }
                 }
             }
         }
     }
     ksort($_tabs);
     foreach ($_tabs as $_pos => $data) {
         if (!$firsttab) {
             $firsttab = $data['plugin_key'];
         }
         $data['_lang'] = isset($this->lang->words[$data['plugin_lang_bit']]) ? $this->lang->words[$data['plugin_lang_bit']] : $data['plugin_name'];
         $tabs[$data['plugin_key']] = $data;
     }
     if ($tab != 'comments' and $tab != 'settings' and !file_exists($custom_path . '/' . $tab . '.php')) {
         $tab = $firsttab;
     }
     //-----------------------------------------
     // Grab all data...
     //-----------------------------------------
     $member = IPSMember::load($member_id, 'profile_portal,pfields_content,sessions,groups', 'id');
     if (!$member['member_id']) {
         $this->registry->output->showError('profiles_no_member', 10246);
     }
     /* Check USER permalink... */
     $this->registry->getClass('output')->checkPermalink($member['members_seo_name'] ? $member['members_seo_name'] : IPSText::makeSeoTitle($member['members_display_name']));
     /* Build data */
     $member = IPSMember::buildDisplayData($member, array('customFields' => 1, 'cfSkinGroup' => 'profile', 'checkFormat' => 1, 'cfGetGroupData' => 1, 'signature' => 1));
     //-----------------------------------------
     // Recent visitor?
     //-----------------------------------------
     if ($member['member_id'] != $this->memberData['member_id']) {
         list($be_anon, $loggedin) = explode('&', $this->memberData['login_anonymous']);
         if (!$be_anon) {
             $this->_addRecentVisitor($member, $this->memberData['member_id']);
         }
     }
     //-----------------------------------------
     // DST?
     //-----------------------------------------
     if ($member['dst_in_use'] == 1) {
         $member['time_offset'] += 1;
     }
     //-----------------------------------------
     // Format extra user data
     //-----------------------------------------
     $member['_age'] = $member['bday_year'] ? date('Y') - $member['bday_year'] : 0;
     if ($member['bday_month'] > date('n')) {
         $member['_age'] -= 1;
     } else {
         if ($member['bday_month'] == date('n')) {
             if ($member['bday_day'] > date('j')) {
                 $member['_age'] -= 1;
             }
         }
     }
     $member['_local_time'] = $member['time_offset'] != "" ? gmstrftime($this->settings['clock_long'], time() + $member['time_offset'] * 3600 + $time_adjust * 60) : '';
     $member['g_title'] = IPSLib::makeNameFormatted($member['g_title'], $member['g_id'], $member['prefix'], $member['suffix']);
     $member['_posts_day'] = 0;
     $member['_total_pct'] = 0;
     $member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month']] : 0;
     //-----------------------------------------
     // BIO
     //-----------------------------------------
     $member['pp_bio_content'] = IPSText::getTextClass('bbcode')->stripBadWords($member['pp_bio_content']);
     $member['pp_bio_content'] = IPSText::wordwrap($member['pp_bio_content'], '25', ' ');
     if (!$this->settings['disable_profile_stats']) {
         $posts = $this->DB->buildAndFetch(array('select' => "COUNT(*) as total_posts", 'from' => "posts", 'where' => "author_id=" . $member['member_id']));
         $member['posts'] = $posts['total_posts'];
         //-----------------------------------------
         // Total posts
         //-----------------------------------------
         if ($member['posts'] and $board_posts) {
             $member['_posts_day'] = round($member['posts'] / ((time() - $member['joined']) / 86400), 2);
             # Fix the issue when there is less than one day
             $member['_posts_day'] = $member['_posts_day'] > $member['posts'] ? $member['posts'] : $member['_posts_day'];
             $member['_total_pct'] = sprintf('%.2f', $member['posts'] / $board_posts * 100);
         }
         $member['_posts_day'] = floatval($member['_posts_day']);
         //-----------------------------------------
         // Most active in
         //-----------------------------------------
         $favorite = $this->DB->buildAndFetch(array('select' => 'COUNT(p.author_id) as f_posts', 'from' => array('posts' => 'p'), 'where' => 'p.author_id=' . $member['member_id'] . ' AND ' . $this->registry->permissions->buildPermQuery('i'), 'order' => 'f_posts DESC', 'group' => 't.forum_id', 'add_join' => array(array('select' => 't.forum_id', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id'), array('from' => array('permission_index' => 'i'), 'where' => "i.perm_type='forum' AND i.perm_type_id=t.forum_id"))));
         $member['favorite_id'] = $favorite['forum_id'];
         $member['_fav_posts'] = $favorite['f_posts'];
         if ($member['posts']) {
             $member['_fav_percent'] = round($favorite['f_posts'] / $member['posts'] * 100);
         }
     }
     //-----------------------------------------
     // Comments
     //-----------------------------------------
     if ($member['pp_setting_count_comments']) {
         require_once IPSLib::getAppDir('members') . '/sources/comments.php';
         $comment_lib = new profileCommentsLib($this->registry);
         $comment_html = $comment_lib->buildComments($member);
     }
     //-----------------------------------------
     // Visitors
     //-----------------------------------------
     if ($member['pp_setting_count_visitors']) {
         $_pp_last_visitors = unserialize($member['pp_last_visitors']);
         $_visitor_info = array();
         $_count = 1;
         if (is_array($_pp_last_visitors)) {
             krsort($_pp_last_visitors);
             $_members = IPSMember::load(array_values($_pp_last_visitors), 'extendedProfile');
             foreach ($_members as $_id => $_member) {
                 $_visitor_info[$_id] = IPSMember::buildDisplayData($_member, 0);
             }
             foreach ($_pp_last_visitors as $_time => $_id) {
                 if ($_count > $member['pp_setting_count_visitors']) {
                     break;
                 }
                 $_count++;
                 if (!$_visitor_info[$_id]['members_display_name_short']) {
                     $_visitor_info[$_id] = IPSMember::setUpGuest();
                 }
                 $_visitor_info[$_id]['_visited_date'] = ipsRegistry::getClass('class_localization')->getDate($_time, 'TINY');
                 $_visitor_info[$_id]['members_display_name_short'] = $_visitor_info[$_id]['members_display_name_short'] ? $_visitor_info[$_id]['members_display_name_short'] : $this->lang->words['global_guestname'];
                 $visitors[] = $_visitor_info[$_id];
             }
         }
     }
     //-----------------------------------------
     // Friends
     //-----------------------------------------
     # Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
     # also fall back on last 10 if no cache
     if ($member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled']) {
         $member['_cache'] = IPSMember::unpackMemberCache($member['members_cache']);
         if (is_array($member['_cache']['friends']) and count($member['_cache']['friends'])) {
             foreach ($member['_cache']['friends'] as $id => $approved) {
                 $id = intval($id);
                 if ($approved and $id) {
                     $_member_ids[] = $id;
                 }
             }
             $member['_total_approved_friends'] = count($_member_ids);
             if (is_array($_member_ids) and count($_member_ids)) {
                 $_max = count($_member_ids) > 50 ? 50 : count($_member_ids);
                 $_rand = array_rand($_member_ids, $_max);
                 $_final = array();
                 # If viewing member is in list, let's show em
                 if (in_array($this->memberData['member_id'], $_member_ids)) {
                     $_final[] = $this->memberData['member_id'];
                     $new_mids = array();
                     foreach ($_member_ids as $mid) {
                         if ($mid == $this->memberData['member_id']) {
                             continue;
                         }
                         $new_mids[] = $mid;
                     }
                     $_member_ids = $new_mids;
                     unset($new_mids);
                     if (is_array($_rand)) {
                         if (count($_rand) >= 50) {
                             array_pop($_rand);
                         }
                     }
                 }
                 if (is_array($_rand) and count($_rand)) {
                     foreach ($_rand as $_id) {
                         $_final[] = $_member_ids[$_id];
                     }
                 }
                 if (count($_final)) {
                     $sql_extra = ' AND pf.friends_friend_id IN (' . IPSText::cleanPermString(implode(',', $_final)) . ')';
                 }
             }
         }
         $this->DB->build(array('select' => 'pf.*', 'from' => array('profile_friends' => 'pf'), 'where' => 'pf.friends_member_id=' . $member_id . ' AND pf.friends_approved=1' . $sql_extra, 'limit' => array(0, 50), 'order' => 'm.members_display_name ASC', 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pf.friends_friend_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
         $outer = $this->DB->execute();
         while ($row = $this->DB->fetch($outer)) {
             $row['_friends_added'] = ipsRegistry::getClass('class_localization')->getDate($row['friends_added'], 'SHORT');
             $row['_location'] = $row['location'] ? $row['location'] : $this->lang->words['no_info'];
             $row = IPSMember::buildProfilePhoto($row);
             $row['members_display_name_short'] = IPSText::truncate($row['members_display_name'], 13);
             $friends[] = $row;
         }
     }
     $member['_total_displayed_friends'] = count($friends);
     //-----------------------------------------
     // Online location
     //-----------------------------------------
     $member = IPSMember::getLocation($member);
     //-----------------------------------------
     // Add profile view
     //-----------------------------------------
     $this->DB->insert('profile_portal_views', array('views_member_id' => $member['member_id']), true);
     //-----------------------------------------
     // Grab default tab...
     //-----------------------------------------
     $tab_html = '';
     if ($tab != 'comments' and $tab != 'settings') {
         if (file_exists($custom_path . '/' . $tab . '.php')) {
             require $custom_path . '/pluginParentClass.php';
             require $custom_path . '/' . $tab . '.php';
             $_func_name = 'profile_' . $tab;
             $plugin = new $_func_name($this->registry);
             $tab_html = $plugin->return_html_block($member);
         }
     }
     //-----------------------------------------
     // Set description tag
     //-----------------------------------------
     $_desc = $member['pp_about_me'] ? $member['pp_about_me'] : $member['signature'];
     if ($_desc) {
         $this->registry->output->addMetaTag('description', $member['members_display_name'] . ': ' . IPSText::getTextClass('bbcode')->stripAllTags($_desc));
     }
     //-----------------------------------------
     // Add to output
     //-----------------------------------------
     $this->member_name = $member['members_display_name'];
     $this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern($tabs, $member, $comment_html, $friends, $visitors, $tab, $tab_html, $fields);
 }
    /**
     * List of members
     *
     * @access	public
     * @param	array 		Members
     * @param	string		Pages
     * @return	string		HTML
     */
    public function members_list($members, $pages = '')
    {
        $IPBHTML = "";
        //--starthtml--//
        //-----------------------------------------
        // BADGE STYLEE
        //-----------------------------------------
        $IPBHTML .= <<<HTML
{$pages}
<br style='clear: both' />
<div class='acp-box'>
\t<h3>{$this->lang->words['sm_members']}</h3>
<table class='alternate_rows double_pad'>
\t<tr>
\t\t<th style='width: 5%'></th>
\t\t<th style='width: 30%'>{$this->lang->words['list__dn']}</th>
\t\t<th style='width: 25%'>{$this->lang->words['list__email']}</th>
\t\t<th style='width: 20%'>{$this->lang->words['list__group']}</th>
\t\t<th style='width: 20%'>{$this->lang->words['list__ip']}</th>
\t</tr>
HTML;
        if (count($members)) {
            foreach ($members as $member) {
                $member['group_title'] = IPSLib::makeNameFormatted($member['group_title'], $member['member_group_id']);
                if (trim($member['members_display_name']) == '') {
                    $member['members_display_name'] = "<em class='desctext'>{$this->lang->words['sm_nodisplayname']}</em>";
                }
                $_extraStyle = $member['member_banned'] ? ' class="_red"' : ($member['bw_is_spammer'] ? ' class="_amber"' : '');
                $_extraText = $member['member_banned'] ? '(' . $this->lang->words['m_f_showbanned'] . ')' : ($member['bw_is_spammer'] ? '(' . $this->lang->words['m_f_showspam'] . ')' : '');
                $IPBHTML .= <<<HTML
\t\t\t<tr id='member-{$member['member_id']}'{$_extraStyle}>
\t\t\t\t<td><a href='{$this->settings['base_url']}&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$member['member_id']}'><img src='{$member['pp_thumb_photo']}' style='width: 30px; height: 30px; border: 1px solid #d8d8d8' /></a></td>\t\t\t
\t\t\t\t<td class='member_name'><a href='{$this->settings['base_url']}&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$member['member_id']}'>{$member['members_display_name']}</a></td>
\t\t\t\t<td>{$member['email']}</td>
\t\t\t\t<td>{$member['group_title']} <span style='color:gray;font-size:0.8em'>{$_extraText}</span></td>
\t\t\t\t<td><a href='{$this->settings['base_url']}&amp;app=members&amp;module=members&amp;section=tools&amp;do=learn_ip&amp;ip={$member['ip_address']}'>{$member['ip_address']}</a></td>
\t\t\t</tr>
HTML;
            }
        } else {
            $IPBHTML .= <<<HTML
<td style='padding: 10px;' colspan='8'>
\t\t{$this->lang->words['sm_nomemfound']}
</td>
\t
HTML;
        }
        $IPBHTML .= <<<HTML
</table>
 </table>
</div>
<br style='clear: both' />
{$pages}
HTML;
        //--endhtml--//
        return $IPBHTML;
    }
 /**
  * View queues (validating, locked, banned)
  *
  * @access	private
  * @param 	string		Queue to view [validating, locked, banned]
  * @return	void		[Outputs to screen]
  */
 private function _viewQueue($type = 'validating')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['ord'] = $this->request['ord'] ? $this->request['ord'] : '';
     $st = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
     $ord = $this->request['ord'] == 'asc' ? 'asc' : 'desc';
     $new_ord = $ord == 'asc' ? 'desc' : 'asc';
     $filter = $this->request['filter'] ? $this->request['filter'] : '';
     $q_extra = "";
     $content = "";
     //-----------------------------------------
     // Run teh query
     //-----------------------------------------
     switch ($type) {
         case 'validating':
             switch ($filter) {
                 case 'reg_user_validate':
                     if ($this->settings['reg_auth_type'] != 'admin') {
                         $q_extra = " AND v.new_reg=1 AND v.user_verified=0";
                     }
                     break;
                 case 'reg_admin_validate':
                     if ($this->settings['reg_auth_type'] == 'admin') {
                         $q_extra = " AND v.new_reg=1";
                     } else {
                         $q_extra = " AND v.new_reg=1 AND v.user_verified=1";
                     }
                     break;
                 case 'email_chg':
                     $q_extra = " AND v.email_chg=1";
                     break;
                 case 'coppa':
                     $q_extra = " AND v.coppa_user=1";
                     break;
             }
             $row = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as queue', 'from' => array('validating' => 'v'), 'where' => "v.lost_pass=0 AND m.member_group_id=" . $this->settings['auth_group'] . $q_extra, 'add_join' => array(array('from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left'))));
             break;
         case 'locked':
             if ($this->settings['ipb_bruteforce_attempts']) {
                 $row = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as queue', 'from' => 'members', 'where' => "failed_login_count >= " . intval($this->settings['ipb_bruteforce_attempts'])));
             } else {
                 $row['queue'] = 0;
             }
             break;
         case 'banned':
             $row = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as queue', 'from' => 'members', 'where' => "member_banned=1"));
             break;
         case 'spam':
             $row = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as queue', 'from' => 'members', 'where' => IPSBWOptions::sql('bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has')));
             break;
     }
     $cnt = intval($row['queue']);
     //-----------------------------------------
     // Grab default sorting
     //-----------------------------------------
     switch ($type) {
         case 'validating':
             $col = 'v.entry_date';
             break;
         case 'locked':
             $col = 'm.members_display_name';
             break;
         case 'banned':
             $col = 'm.members_display_name';
             break;
         case 'spam':
             $col = 'm.joined';
             break;
     }
     //-----------------------------------------
     // And actual sorting..
     //-----------------------------------------
     switch ($this->request['sort']) {
         case 'mem':
             $col = 'm.members_display_name';
             break;
         case 'email':
             $col = 'm.email';
             break;
         case 'sent':
             if ($type == 'validating') {
                 $col = 'v.entry_date';
             }
             break;
         case 'failed':
             if ($type == 'locked') {
                 $col = 'm.failed_login_count';
             }
             break;
         case 'group':
             if ($type == 'banned') {
                 $col = 'g.g_title';
             }
             break;
         case 'posts':
             $col = 'm.posts';
             break;
         case 'joined':
             $col = 'm.joined';
             break;
     }
     //-----------------------------------------
     // Pages...
     //-----------------------------------------
     $links = $this->registry->output->generatePagination(array('totalItems' => $cnt, 'itemsPerPage' => 75, 'currentStartValue' => $st, 'baseUrl' => $this->settings['base_url'] . "&amp;{$this->form_code}&amp;do={$type}&amp;ord={$ord}&amp;filter={$filter}"));
     //-----------------------------------------
     // Print...
     //-----------------------------------------
     if ($cnt > 0) {
         switch ($type) {
             case 'validating':
                 $this->DB->build(array('select' => 'v.*', 'from' => array('validating' => 'v'), 'where' => "v.lost_pass=0 AND m.member_group_id=" . $this->settings['auth_group'] . $q_extra, 'order' => $col . ' ' . $ord, 'limit' => array($st, 75), 'add_join' => array(array('select' => 'm.name, m.member_group_id, m.members_display_name, m.ip_address, m.member_id, m.email, m.posts, m.joined', 'from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left'))));
                 break;
             case 'locked':
                 $this->DB->build(array('select' => 'm.member_group_id, m.members_display_name, m.ip_address, m.member_id, m.email, m.posts, m.joined, m.failed_logins, m.failed_login_count', 'from' => 'members m', 'where' => "m.failed_login_count >= " . intval($this->settings['ipb_bruteforce_attempts']), 'order' => $col . ' ' . $ord, 'limit' => array($st, 75)));
                 break;
             case 'banned':
                 $this->DB->build(array('select' => 'm.member_group_id, m.members_display_name, m.ip_address, m.member_id, m.email, m.posts, m.joined, m.failed_logins, m.failed_login_count', 'from' => array('members' => 'm'), 'where' => "m.member_banned=1", 'order' => $col . ' ' . $ord, 'limit' => array($st, 75), 'add_join' => array(array('select' => 'g.g_title', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.member_group_id', 'type' => 'left'))));
                 break;
             case 'spam':
                 $this->DB->build(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => IPSBWOptions::sql('bw_is_spammer', 'm.members_bitoptions', 'members', 'global', 'has'), 'order' => $col . ' ' . $ord, 'limit' => array($st, 75), 'add_join' => array(array('select' => 'g.g_title', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.member_group_id', 'type' => 'left'))));
                 break;
         }
         $this->DB->execute();
         while ($r = $this->DB->fetch()) {
             $r['_joined'] = ipsRegistry::getClass('class_localization')->getDate($r['joined'], 'TINY');
             $r['members_display_name'] = $r['members_display_name'] ? $r['members_display_name'] : $this->lang->words['t_deletedmem'];
             $r['group_title'] = IPSLib::makeNameFormatted($this->caches['group_cache'][$r['member_group_id']]['g_title'], $r['member_group_id']);
             switch ($type) {
                 case 'validating':
                     $r['_coppa'] = $r['coppa_user'] ? $this->lang->words['t_coppa'] : '';
                     //-----------------------------------------
                     // Sort out 'where'
                     //-----------------------------------------
                     $r['_where'] = $r['lost_pass'] ? $this->lang->words['t_lostpass'] : ($r['new_reg'] ? $this->lang->words['t_userval'] : ($r['email_chg'] ? $this->lang->words['t_emailchange'] : $this->lang->words['t_na']));
                     if (isset($r['email_chg']) and $r['email_chg']) {
                         $r['_where'] .= " (<a href='" . $this->settings['base_url'] . "{$this->form_code}&amp;do=unappemail&amp;mid={$r['member_id']}'>{$this->lang->words['t_unapprove']}</a>)";
                     }
                     if ($r['new_reg'] and ($r['user_verified'] == 1 or $this->settings['reg_auth_type'] == 'admin')) {
                         $r['_where'] = $this->lang->words['t_adminval'];
                     }
                     //-----------------------------------------
                     // How long ago did this start?
                     //-----------------------------------------
                     $r['_hours'] = floor((time() - $r['entry_date']) / 3600);
                     $r['_days'] = intval($r['_hours'] / 24);
                     $r['_rhours'] = intval($r['_hours'] - $r['_days'] * 24);
                     //-----------------------------------------
                     // Format time
                     //-----------------------------------------
                     $r['_entry'] = ipsRegistry::getClass('class_localization')->getDate($r['entry_date'], 'TINY');
                     break;
                 case 'locked':
                     //-----------------------------------------
                     // Sort out lovely locked info
                     //-----------------------------------------
                     $used_ips = array();
                     $this_attempt = array();
                     $oldest = 0;
                     $newest = 0;
                     if ($r['failed_logins']) {
                         $failed_logins = explode(",", IPSText::cleanPermString($r['failed_logins']));
                         if (is_array($failed_logins) and count($failed_logins)) {
                             sort($failed_logins);
                             foreach ($failed_logins as $attempt) {
                                 $this_attempt = explode("-", $attempt);
                                 $used_ips[] = $this_attempt[1];
                             }
                             $oldest = array_shift($failed_logins);
                             $newest = array_pop($failed_logins);
                         }
                     }
                     $newest = explode("-", $newest);
                     $oldest = explode("-", $oldest);
                     $r['oldest_fail'] = ipsRegistry::getClass('class_localization')->getDate($oldest[0], 'SHORT');
                     $r['newest_fail'] = ipsRegistry::getClass('class_localization')->getDate($newest[0], 'SHORT');
                     //-----------------------------------------
                     // Some nice IP address info
                     //-----------------------------------------
                     $r['ip_addresses'] = "";
                     $used_ips = array_unique($used_ips);
                     foreach ($used_ips as $ip_address) {
                         $r['ip_addresses'] .= "{$this->lang->words['t_ipcolon']} <a href='" . $this->settings['base_url'] . "&amp;module=members&amp;section=tools&amp;do=learn_ip&amp;ip={$ip_address}'>{$ip_address}</a><br />";
                     }
                     break;
             }
             //-----------------------------------------
             // Print row
             //-----------------------------------------
             $function = $type . 'Row';
             $content .= $this->html->{$function}($r);
         }
     } else {
         $content = $this->html->queueNoRows(sprintf($this->lang->words['t_notype'], $this->lang->words['t_rowtype_' . $type]));
     }
     //-----------------------------------------
     // Output
     //-----------------------------------------
     $this->registry->output->html .= $this->html->queueWrapper($type, $content, $st, $new_ord, $links);
     //-----------------------------------------
     // Extra navigation
     //-----------------------------------------
     switch ($type) {
         case 'validating':
             $this->registry->output->extra_nav[] = array('', $this->lang->words['t_validating']);
             break;
         case 'locked':
             $this->registry->output->extra_nav[] = array('', $this->lang->words['t_locked']);
             break;
         case 'banned':
             $this->registry->output->extra_nav[] = array('', $this->lang->words['t_banned']);
             break;
     }
 }
 /**
  * Returns an array of active users
  *
  * @access	public
  * @return	array
  **/
 public function getActiveUserDetails()
 {
     $active = array('TOTAL' => 0, 'NAMES' => array(), 'GUESTS' => 0, 'MEMBERS' => 0, 'ANON' => 0);
     if ($this->settings['show_active']) {
         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' => substr($this->memberData['login_anonymous'], 0, 1), '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' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type', 'from' => 'sessions', 'where' => "running_time > {$time}"));
         $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) {
             $last_date = $this->registry->getClass('class_localization')->getTime($result['running_time']);
             //-----------------------------------------
             // 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']]) {
                     if ($this->settings['spider_anon']) {
                         if ($this->memberData['g_access_cp']) {
                             $active['NAMES'][] = IPSLib::makeNameFormatted($result['member_name'], $result['member_group']);
                         }
                     } else {
                         $active['NAMES'][] = IPSLib::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'] = IPSLib::makeNameFormatted($result['member_name'], $result['member_group']);
                         if (!$this->settings['disable_anonymous'] and $result['login_type']) {
                             if ($this->memberData['g_access_cp'] and $this->settings['disable_admin_anon'] != 1) {
                                 $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser') . "' title='{$last_date}'>{$result['member_name']}</a>*";
                                 $active['ANON']++;
                             } else {
                                 $active['ANON']++;
                             }
                         } else {
                             $active['MEMBERS']++;
                             $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser') . "' title='{$last_date}'>{$result['member_name']}</a>";
                         }
                     }
                 }
             }
         }
         $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;
 }
 /**
  * Returns the list of online users
  * 
  * @access	public
  * @param	string  $api_key		Authentication Key
  * @param 	string  $api_module		Module
  * @param	string	$sep_character	Separator character
  * @return	string	xml
  **/
 public function fetchOnlineUsers($api_key, $api_module, $sep_character = ',')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $api_key = IPSText::md5Clean($api_key);
     $api_module = IPSText::parseCleanValue($api_module);
     //-----------------------------------------
     // Authenticate
     //-----------------------------------------
     if ($this->__authenticate($api_key, $api_module, 'fetchOnlineUsers') !== FALSE) {
         $cut_off = ipsRegistry::$settings['au_cutoff'] * 60;
         $time = time() - $cut_off;
         $rows = array();
         $ar_time = time();
         $this->registry->DB()->build(array('select' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type', 'from' => 'sessions', 'where' => "running_time > {$time}"));
         $this->registry->DB()->execute();
         //-----------------------------------------
         // FETCH...
         //-----------------------------------------
         while ($r = $this->registry->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) {
             $last_date = ipsRegistry::getClass('class_localization')->getTime($result['running_time']);
             //-----------------------------------------
             // Bot?
             //-----------------------------------------
             if (isset($result['uagent_type']) && $result['uagent_type'] == 'search') {
                 //-----------------------------------------
                 // Seen bot of this type yet?
                 //-----------------------------------------
                 if (!$cached[$result['member_name']]) {
                     if (ipsRegistry::$settings['spider_anon']) {
                         if ($this->registry->member()->getProperty('g_access_cp')) {
                             $active['NAMES'][] = $result['member_name'];
                         }
                     } else {
                         $active['NAMES'][] = $result['member_name'];
                     }
                     $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'] = IPSLib::makeNameFormatted($result['member_name'], $result['member_group']);
                         if (!ipsRegistry::$settings['disable_anonymous'] and $result['login_type']) {
                             if ($this->registry->member()->getProperty('g_access_cp') and ipsRegistry::$settings['disable_admin_anon'] != 1) {
                                 $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser') . "' title='{$last_date}'>{$result['member_name']}</a>*";
                                 $active['ANON']++;
                             } else {
                                 $active['ANON']++;
                             }
                         } else {
                             $active['MEMBERS']++;
                             $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser') . "' title='{$last_date}'>{$result['member_name']}</a>";
                         }
                     }
                 }
             }
         }
         $active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
         //-----------------------------------------
         // Return info
         //-----------------------------------------
         $this->classApiServer->apiSendReply($active);
         exit;
     }
 }
    /**
     * Group row
     *
     * @access	public
     * @param	array 		Group
     * @return	string		HTML
     */
    public function groupsOverviewRow($r = "")
    {
        $IPBHTML = "";
        //--starthtml--//
        $r['_can_acp_img'] = $r['_can_acp'] ? 'accept.png' : 'cross.png';
        $r['_can_supmod_img'] = $r['_can_supmod'] ? 'accept.png' : 'cross.png';
        $r['_title'] = IPSLib::makeNameFormatted($r['g_title'], $r['g_id']);
        $IPBHTML .= <<<HTML
<tr>
  <td><img src='{$this->settings['skin_acp_url']}/_newimages/icons/group.png' border='0' class='ipbmenu' /></td>
  <td style='font-weight:bold'><a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=edit&amp;id={$r['g_id']}'>{$r['_title']}</a></td>
  <td align='center'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/{$r['_can_acp_img']}' border='0' alt='-' class='ipd' /></td>
  <td align='center'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/{$r['_can_supmod_img']}' border='0' alt='-' class='ipd' /></td>
  <td align='center'>
HTML;
        if ($r['g_id'] != $this->settings['auth_group'] and $r['g_id'] != $this->settings['guest_group']) {
            $IPBHTML .= <<<HTML
\t<a href='{$this->settings['_base_url']}app=members&amp;section=members&amp;module=members&amp;__update=1&amp;f_primary_group={$r['g_id']}' title='{$this->lang->words['g_listusers']}'>{$r['count']}</a>
HTML;
        } else {
            $IPBHTML .= <<<HTML
    {$r['count']}
HTML;
        }
        $IPBHTML .= <<<HTML
  </td>\t\t\t\t\t\t\t\t\t\t\t\t
  <td align='right'>
  \t<img id="menu{$r['g_id']}" src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' border='0' alt='{$this->lang->words['a_options']}' class='ipbmenu' />
\t<ul class='acp-menu' id='menu{$r['g_id']}_menucontent'>
\t\t<li class='icon edit'><a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=edit&amp;id={$r['g_id']}'>{$this->lang->words['g_editg']}</a></li>
HTML;
        if (!in_array($r['g_id'], array($this->settings['auth_group'], $this->settings['guest_group'], $this->settings['member_group']))) {
            $IPBHTML .= <<<HTML
\t\t<li class='icon delete'><a href='#' onclick='return acp.confirmDelete("{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=delete&amp;_admin_auth_key={$this->registry->getClass('adminFunctions')->_admin_auth_key}&amp;id={$r['g_id']}");'>{$this->lang->words['g_deleteg']}</a></li>
HTML;
        } else {
            $IPBHTML .= <<<HTML
\t\t<li class='icon delete'>{$this->lang->words['g_cannotdel']}</li>
HTML;
        }
        $IPBHTML .= <<<HTML
\t\t
\t</ul>
  </td>
</tr>
HTML;
        //--endhtml--//
        return $IPBHTML;
    }
 /**
  * Execute the plugin and return the HTML to show on the page.  
  * Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
  *
  * @access	public
  * @param	array 				Block data
  * @return	string				Block HTML to display or cache
  */
 public function executePlugin($block)
 {
     $data = array();
     //-----------------------------------------
     // Reset login form lang if needed
     //-----------------------------------------
     if (!$this->memberData['member_id']) {
         $uses_name = $uses_email = false;
         foreach ($this->cache->getCache('login_methods') as $method) {
             if ($method['login_user_id'] == 'username') {
                 $uses_name = true;
             }
             if ($method['login_user_id'] == 'email') {
                 $uses_email = true;
             }
         }
         if ($uses_name and $uses_email) {
             $this->lang->words['enter_name'] = $this->lang->words['welcome_name_and_email'];
         } else {
             if ($uses_email) {
                 $this->lang->words['enter_name'] = $this->lang->words['welcome_useremail'];
             }
         }
     } else {
         $topics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'starter_id=' . $this->memberData['member_id']));
         $posts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'author_id=' . $this->memberData['member_id']));
         $newTopics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'start_date > ' . $this->memberData['last_visit']));
         $newPosts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'post_date > ' . $this->memberData['last_visit']));
         $newFriends = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_friends', 'where' => 'friends_approved=0 AND friends_friend_id=' . $this->memberData['member_id']));
         $newComments = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_comments', 'where' => 'comment_approved=0 AND comment_for_member_id=' . $this->memberData['member_id']));
         $board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
         $_posts_day = 0;
         if ($posts['total'] and $board_posts) {
             $_posts_day = round($posts['total'] / ((time() - $this->memberData['joined']) / 86400), 2);
             # Fix the issue when there is less than one day
             $_posts_day = $_posts_day > $posts['total'] ? $posts['total'] : $_posts_day;
         }
         $_posts_day = floatval($_posts_day);
         //-----------------------------------------
         // Get the data not already available...
         //-----------------------------------------
         $data = array('topics' => $topics['total'], 'posts' => $posts['total'], 'avg_posts' => $_posts_day, 'new_topics' => $newTopics['total'], 'new_posts' => $newPosts['total'], 'new_friends' => $newFriends['total'], 'new_comments' => $newComments['total']);
     }
     $group_cache = $this->cache->getCache('group_cache');
     $data['group'] = IPSLib::makeNameFormatted($group_cache[$this->memberData['member_group_id']]['g_title'], $this->memberData['member_group_id']);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('repCache')) {
         require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
         ipsRegistry::setClass('repCache', new classReputationCache());
     }
     $this->memberData['pp_reputation_points'] = $this->memberData['pp_reputation_points'] ? $this->memberData['pp_reputation_points'] : 0;
     $this->memberData['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($this->memberData['pp_reputation_points']);
     $pluginConfig = $this->returnPluginInfo();
     $templateBit = $pluginConfig['templateBit'] . '_' . $block['block_id'];
     return $this->registry->output->getTemplate('ccs')->{$templateBit}($block['block_name'], $data);
 }
 /**
  * Builds the "who's viewing" strip
  *
  * @access	private
  * @param	integer  Section ID
  * @return	string
  */
 private function _getStats($id = 1)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $ar_time = time();
     $cached = array();
     $guests = array();
     $active = array('guests' => 0, 'anon' => 0, 'members' => 0, 'names' => array());
     $rows = array($ar_time => array('login_type' => substr($this->memberData['login_anonymous'], 0, 1), 'running_time' => $ar_time, 'id' => $this->member->session_id, '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']));
     //-----------------------------------------
     // Process users active in this forum
     //-----------------------------------------
     if ($this->settings['no_au_topic'] != 1) {
         //-----------------------------------------
         // Get the users
         //-----------------------------------------
         $cut_off = $this->settings['au_cutoff'] != "" ? $this->settings['au_cutoff'] * 60 : 900;
         $this->DB->build(array('select' => 's.member_id, s.member_name, s.member_group, s.id, s.login_type, s.location, s.running_time, s.uagent_type, s.current_module, s.seo_name', 'from' => 'sessions s', 'where' => "current_appcomponent='core' AND current_module='reports' AND running_time > {$cut_off}"));
         $this->DB->execute();
         //-----------------------------------------
         // FETCH...
         //-----------------------------------------
         while ($r = $this->DB->fetch()) {
             $rows[$r['running_time'] . '.' . $r['id']] = $r;
         }
         krsort($rows);
         //-----------------------------------------
         // PRINT...
         //-----------------------------------------
         foreach ($rows as $result) {
             $result['member_name'] = IPSLib::makeNameFormatted($result['member_name'], $result['member_group']);
             $last_date = $this->registry->class_localization->getTime($result['running_time']);
             if ($result['member_id'] == 0 or !$result['member_name']) {
                 if (in_array($result['id'], $guests)) {
                     continue;
                 }
                 //-----------------------------------------
                 // Bot?
                 //-----------------------------------------
                 if ($result['uagent_type'] == 'search') {
                     //-----------------------------------------
                     // Seen bot of this type yet?
                     //-----------------------------------------
                     if (!$cached[$result['member_name']]) {
                         if ($this->settings['spider_anon']) {
                             if ($this->memberData['g_access_cp']) {
                                 $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name']);
                             }
                         } else {
                             $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'seo' => $result['seo_name']);
                         }
                         $cached[$result['member_name']] = 1;
                     } else {
                         $active['guests']++;
                         $guests[] = $result['id'];
                     }
                 } else {
                     $active['guests']++;
                     $guests[] = $result['id'];
                 }
             } else {
                 if (empty($cached[$result['member_id']])) {
                     $cached[$result['member_id']] = 1;
                     $p_start = "";
                     $p_end = "";
                     $p_title = sprintf($this->lang->words['au_reading'], $last_date);
                     if (strstr($result['current_module'], 'post') and $result['member_id'] != $this->memberData['member_id']) {
                         $p_start = "<span class='activeuserposting'>";
                         $p_end = "</span>";
                         $p_title = sprintf($this->lang->words['au_posting'], $last_date);
                     }
                     if (!$this->settings['disable_anonymous'] and $result['login_type']) {
                         if ($this->memberData['g_access_cp'] and $this->settings['disable_admin_anon'] != 1) {
                             $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'] . '*', 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name']);
                             $active['anon']++;
                         } else {
                             $active['anon']++;
                         }
                     } else {
                         $active['members']++;
                         $active['names'][] = array('id' => $result['member_id'], 'name' => $result['member_name'], 'p_start' => $p_start, 'p_title' => $p_title, 'p_end' => $p_end, 'seo' => $result['seo_name']);
                     }
                 }
             }
         }
         //$active['active_users_title']   = sprintf( $this->lang->words['active_users_title']  , ($active['members'] + $active['guests'] + $active['anon'] ) );
         //$active['active_users_detail']  = sprintf( $this->lang->words['active_users_detail'] , $active['guests'],$active['anon'] );
         $active['active_users_members'] = sprintf($this->lang->words['active_users_members'], $active['members']);
         return $active;
     }
 }
 /**
  * Show the ignored users
  *
  * @access	public
  * @author	Matt Mecham
  * @return	string		Processed HTML
  */
 public function formIgnoredUsers()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $final_users = array();
     $temp_users = array();
     $uid = intval($this->request['uid']);
     $ignoredUsers = array();
     //-----------------------------------------
     // Do we have incoming?
     //-----------------------------------------
     if ($uid) {
         $newmem = IPSMember::load($uid);
         $this->request['newbox_1'] = $newmem['members_display_name'];
     }
     //-----------------------------------------
     // Get ignored users
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'ignored_users', 'where' => 'ignore_owner_id=' . $this->memberData['member_id']));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $ignoredUsers[$row['ignore_ignore_id']] = $row;
     }
     //-----------------------------------------
     // Get members and check to see if they've
     // since been moved into a group that cannot
     // be ignored
     //-----------------------------------------
     foreach ($ignoredUsers as $_id => $data) {
         if (intval($_id)) {
             $temp_users[] = $_id;
         }
     }
     if (count($temp_users)) {
         $members = IPSMember::load($temp_users, 'all');
         foreach ($members as $m) {
             $m['g_title'] = IPSLib::makeNameFormatted($this->caches['group_cache'][$m['member_group_id']]['g_title'], $m['member_group_id']);
             $final_users[$m['member_id']] = IPSMember::buildDisplayData($m);
             $final_users[$m['member_id']]['ignoreData'] = $ignoredUsers[$m['member_id']];
         }
     }
     $this->request['newbox_1'] = $this->request['newbox_1'] ? $this->request['newbox_1'] : '';
     return $this->registry->getClass('output')->getTemplate('ucp')->membersIgnoredUsersForm($final_users);
 }
 public function getOutput()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_ids = array();
     $to_load = array();
     //-----------------------------------------
     // Check module/app
     //-----------------------------------------
     $module = '';
     if (!IPSLib::appIsInstalled('chat')) {
         return '';
     }
     if (IPSLib::moduleIsEnabled('addonchat', 'chat')) {
         $_hide_whoschatting = $this->settings['chat_hide_whoschatting'];
         $_who_on = $this->settings['chat_who_on'];
     } else {
         if (IPSLib::moduleIsEnabled('parachat', 'chat')) {
             $_hide_whoschatting = $this->settings['chat04_hide_whoschatting'];
             $_who_on = $this->settings['chat04_who_on'];
         } else {
             return '';
         }
     }
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!$_who_on) {
         return;
     }
     //-----------------------------------------
     // Sort and show :D
     //-----------------------------------------
     if (is_array($this->caches['chatting']) and count($this->caches['chatting'])) {
         foreach ($this->caches['chatting'] as $id => $data) {
             if ($data['updated'] < time() - 120) {
                 continue;
             }
             $to_load[$id] = $id;
         }
     }
     //-----------------------------------------
     // Got owt?
     //-----------------------------------------
     if (count($to_load)) {
         $this->DB->build(array('select' => 'm.member_id, m.members_display_name, m.member_group_id, m.members_seo_name', 'from' => array('members' => 'm'), 'where' => "m.member_id IN(" . implode(",", $to_load) . ")", 'add_join' => array(0 => array('select' => 's.login_type, s.current_appcomponent', 'from' => array('sessions' => 's'), 'where' => 's.member_id=m.member_id', 'type' => 'left')), 'order' => 'm.members_display_name'));
         $this->DB->execute();
         while ($m = $this->DB->fetch()) {
             if ($m['member_id'] == $this->memberData['member_id']) {
                 continue;
             }
             $m['members_display_name'] = IPSLib::makeNameFormatted($m['members_display_name'], $m['member_group_id']);
             if ($m['login_type']) {
                 if ($this->memberData['g_access_cp'] and $this->settings['disable_admin_anon'] != 1) {
                     $member_ids[] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$m['member_id']}", 'public', $m['seo_name'], 'showuser') . "'>{$m['members_display_name']}</a>";
                 }
             } else {
                 $member_ids[] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl("showuser={$m['member_id']}", 'public', $m['seo_name'], 'showuser') . "'>{$m['members_display_name']}</a>";
             }
         }
     }
     //-----------------------------------------
     // Got owt?
     //-----------------------------------------
     if (count($member_ids)) {
         $this->html = $this->registry->getClass('output')->getTemplate('boards')->whoschatting_show(intval(count($member_ids)), $member_ids);
     } else {
         if (!$_hide_whoschatting) {
             $this->html = $this->registry->getClass('output')->getTemplate('boards')->whoschatting_empty();
         }
     }
     return $this->html;
 }
 function __f__a0184cf37145c011239ee44f346febe0($members, $pages = "", $dropdowns = array(), $defaults = array(), $custom_fields = null, $url = '')
 {
     $_ips___x_retval = '';
     foreach ($members as $member) {
         $_ips___x_retval .= "\n\t\t\t\t\t<li id='member_id_{$member['member_id']}' class='general_box clear member_entry " . IPSLib::next($this->registry->templateStriping["memberStripe"]) . "'>\n\t\t\t\t\t\t<h3 class='bar'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$member['member_id']}", 'public', ''), "{$member['members_seo_name']}", "showuser") . "' title='{$this->lang->words['view_profile']}'>{$member['members_display_name']}</a>" . $this->registry->getClass('output')->getTemplate('global')->user_popup($member['member_id'], $member['members_seo_name']) . "</h3>\n\t\t\t\t\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showuser={$member['member_id']}", 'public', ''), "{$member['members_seo_name']}", "showuser") . "' title='{$this->lang->words['view_profile']}'><img src='{$member['pp_thumb_photo']}' width='{$member['pp_thumb_width']}' height='{$member['pp_thumb_height']}' alt=\"{$member['members_display_name']}{$this->lang->words['users_photo']}\" class='photo' /></a>\t\n\t\t\t\t\t\n\t\t\t\t\t\t<dl class='info'>\n\t\t\t\t\t\t\t<dt class='clear'>{$this->lang->words['member_joined']}:</dt>\n\t\t\t\t\t\t\t<dd>" . $this->registry->getClass('class_localization')->getDate($member['joined'], "joined", 0) . "</dd>\n\t\t\t\t\t\t\t<dt class='clear'>{$this->lang->words['member_group']}:</dt>\n\t\t\t\t\t\t\t<dd>" . IPSLib::makeNameFormatted($member['group'], $member['member_group_id']) . "</dd>\n\t\t\t\t\t\t\t<dt class='clear'>{$this->lang->words['member_posts']}:</dt>\n\t\t\t\t\t\t\t<dd>" . $this->registry->getClass('class_localization')->formatNumber($member['posts']) . "</dd>\n\t\t\t\t\t\t\t<dt class='clear'>{$this->lang->words['m_views']}:</dt>\n\t\t\t\t\t\t\t<dd>" . $this->registry->getClass('class_localization')->formatNumber($member['members_profile_views']) . "</dd>\n\t\t\t\t\t\t</dl>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<ul class='user_controls clear'>\n\t\t\t\t\t\t\t" . (($this->memberData['member_id'] and $this->memberData['member_id'] != $member['member_id'] && $this->settings['friends_enabled'] and $this->memberData['g_can_add_friends']) ? "" . (IPSMember::checkFriendStatus($member['member_id']) ? "\n\t\t\t\t\t\t\t\t\t<li class='mini_friend_toggle is_friend' id='friend_mlist_{$member['member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=friends&amp;do=remove&amp;member_id={$member['member_id']}&amp;secure_key={$this->member->form_hash}", 'public', ''), "", "") . "' title='{$this->lang->words['remove_friend']}'>" . $this->registry->getClass('output')->getReplacement("remove_friend") . "</a></li>\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\t\t<li class='mini_friend_toggle is_not_friend' id='friend_mlist_{$member['member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=friends&amp;do=add&amp;member_id={$member['member_id']}&amp;secure_key={$this->member->form_hash}", 'public', ''), "", "") . "' title='{$this->lang->words['add_friend']}'>" . $this->registry->getClass('output')->getReplacement("add_friend") . "</a></li>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t") . "" : "") . "\n\t\t\t\t\t\t\t" . (($this->memberData['g_use_pm'] and $this->memberData['members_disable_pm'] == 0 and IPSLib::moduleIsEnabled('messaging', 'members') && $member['member_id'] != $this->memberData['member_id']) ? "\n\t\t\t\t\t\t\t\t<li class='pm_button' id='pm_xxx_{$member['pp_member_id']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=messaging&amp;section=send&amp;do=form&amp;fromMemberID={$member['pp_member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['pm_member']}'>" . $this->registry->getClass('output')->getReplacement("send_msg") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search&amp;do=user_posts&amp;mid={$member['member_id']}&amp;view_by_title=1&amp;search_filter_app[forums]=1", 'public', ''), "", "") . "'>" . $this->registry->getClass('output')->getReplacement("find_topics_link") . " {$this->lang->words['find_topics']}</a></li>\n\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search&amp;do=user_posts&amp;mid={$member['member_id']}" . (!in_array($this->settings['search_method'], array('traditional', 'sphinx')) ? "&amp;search_filter_app[forums]=1" : "") . "", 'public', ''), "", "") . "'>" . $this->registry->getClass('output')->getReplacement("find_posts_link") . " {$this->lang->words['find_posts']}</a></li>\n\t\t\t\t\t\t\t" . (($member['has_blog'] and IPSLib::appIsInstalled('blog')) ? "\n\t\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=blog&amp;module=display&amp;section=blog&amp;mid={$member['member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['view_blog']}'>" . $this->registry->getClass('output')->getReplacement("blog_link") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . (($member['has_gallery'] and IPSLib::appIsInstalled('gallery')) ? "\n\t\t\t\t\t\t\t\t<li><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=gallery&amp;module=user&amp;section=user&amp;user={$member['member_id']}", 'public', ''), "", "") . "' title='{$this->lang->words['view_gallery']}'>" . $this->registry->getClass('output')->getReplacement("gallery_link") . "</a></li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t" . ($this->settings['pp_allow_member_rate'] ? "<p class='rating'> \n\t\t\t\t\t\t\t\t" . ($member['pp_rating_real'] >= 1 ? "" . $this->registry->getClass('output')->getReplacement("rate_on") . "" : "" . $this->registry->getClass('output')->getReplacement("rate_off") . "") . "" . ($member['pp_rating_real'] >= 2 ? "" . $this->registry->getClass('output')->getReplacement("rate_on") . "" : "" . $this->registry->getClass('output')->getReplacement("rate_off") . "") . "" . ($member['pp_rating_real'] >= 3 ? "" . $this->registry->getClass('output')->getReplacement("rate_on") . "" : "" . $this->registry->getClass('output')->getReplacement("rate_off") . "") . "" . ($member['pp_rating_real'] >= 4 ? "" . $this->registry->getClass('output')->getReplacement("rate_on") . "" : "" . $this->registry->getClass('output')->getReplacement("rate_off") . "") . "" . ($member['pp_rating_real'] >= 5 ? "" . $this->registry->getClass('output')->getReplacement("rate_on") . "" : "" . $this->registry->getClass('output')->getReplacement("rate_off") . "") . "\n\t\t\t\t\t\t\t</p>" : "") . "\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . ($this->settings['reputation_enabled'] && $this->settings['reputation_show_profile'] ? "" . ($member['pp_reputation_points'] == 0 || !$member['pp_reputation_points'] ? "\n\t\t\t\t\t\t\t\t<p class='reputation zero'>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . ($member['pp_reputation_points'] > 0 ? "\n\t\t\t\t\t\t\t\t<p class='reputation positive'>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . ($member['pp_reputation_points'] < 0 ? "\n\t\t\t\t\t\t\t\t<p class='reputation negative'>\n\t\t\t\t\t\t\t" : "") . "\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<span class='number'>{$this->lang->words['reputation']}: {$member['pp_reputation_points']}</span>\n\t\t\t\t\t\t\t\t</p>" : "") . "\t\t\t\t\t\t\n\t\t\t\t\t</li>\n\t\t\t\t\n";
     }
     $_ips___x_retval .= '';
     return $_ips___x_retval;
 }