function output() { global $main, $construct, $vars, $lang; if ($this->hide) { return; } if (file_exists(ROOT_PATH . 'config/mylogo.png')) { $this->tpl['mylogo'] = TRUE; $this->tpl['mylogo_dir'] = ROOT_PATH . 'config/'; } $this->tpl['link_home'] = make_ref('/'); $this->tpl['link_login_form'] = make_ref('/users/loginform'); $this->tpl['link_logout'] = make_ref('/users', array('action' => 'logout')); $this->tpl['current_language'] = $vars['info']['current_language']; $this->tpl['search_url'] = make_ref('/search'); foreach ($vars['language']['enabled'] as $key => $value) { if ($value) { $this->tpl['languages'][$key]['name'] = $lang['languages'][$key] == '' ? $key : $lang['languages'][$key]; $this->tpl['languages'][$key]['link'] = self_ref(array("session_lang" => $key)); } } if ($main->userdata->logged) { $this->tpl['logged'] = $main->userdata->logged; $this->tpl['logged_username'] = isset($main->userdata->info['username']) ? $main->userdata->info['username'] : ""; $this->tpl['logged_title'] = get_user_title(); $this->tpl['link_user_profile'] = make_ref('/users', array("user" => $main->userdata->user)); } else { $this->tpl['link_register'] = make_ref('/users', array("user" => "add")); $this->tpl['link_restore_password'] = make_ref('/users', array("action" => "restore")); $this->tpl['link_register'] = make_ref('/users', array("user" => "add")); } return template($this->tpl, __FILE__); }
function user_title($id = 0) { echo apply_filters('user_title', get_user_title($id), bb_get_user_id($id)); }
function current() { $temp = parent::current(); $temp['posticon'] = @$temp['posticon'] != '' ? file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']) ? @$temp['posticon'] : 'clear.gif' : 'clear.gif'; $temp['post_id'] = 't' . $temp['post_id']; if ($temp['poster_id'] > 0) { $temp['post_display_user_ddmenu'] = 1; if (!isset($this->users[$temp['poster_id']])) { $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id'])); if (is_array($user) && !empty($user)) { $group = get_user_max_group($user, $this->groups); $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $user['group_nicename'] = isset($group['nicename']) ? $group['nicename'] : ''; $user['group_avatar'] = isset($group['avatar']) ? $group['avatar'] : ''; $user['online'] = time() - ini_get('session.gc_maxlifetime') > $user['seen'] ? 'offline' : 'online'; $this->users[$user['id']] = $user; } } else { $user = $this->users[$temp['poster_id']]; } if (is_array($user) && !empty($user)) { if ($user['flag_level'] > 0 && $_SESSION['user']->get('perms') >= MODERATOR) { $temp['post_user_background'] = 'background-color: #FFFF00;'; } foreach ($user as $key => $val) { $temp['post_user_' . $key] = $val; } $temp['profilefields'] =& new FAArrayIterator(get_profile_fields($this->fields, $temp)); $temp['post_user_title'] = $user['user_title']; $temp['post_user_user_title'] = get_user_title($user['user_title'], $user['num_posts']); } if (!isset($temp['post_user_online'])) { $temp['post_user_online'] = 'offline'; } /* This array holds all of the userinfo for users that post to this topic */ $this->users[$user['id']] = $user; } else { $temp['post_user_id'] = 0; $temp['post_user_name'] = $temp['poster_name']; } /* Deal with acronyms */ replace_acronyms($temp['body_text']); /* word censors */ replace_censors($temp['body_text']); replace_censors($temp['name']); /* Do any polls if they exist */ do_post_polls($temp, $this->dba); /* do we have any attachments? */ if (isset($temp['attachments']) && $temp['attachments'] > 0) { $temp['attachment_files'] = new K4AttachmentsIterator($this->dba, $this->user, $temp['post_id'], 0); } // url's $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']); $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['poster_id']); if ($this->sr && $temp['num_replies'] > 0) { $this->result = $this->dba->executeQuery("SELECT * FROM " . K4POSTS . " WHERE parent_id = " . intval($temp['post_id']) . " AND row_type=" . REPLY . " " . ($this->post_id ? "AND post_id = " . $this->post_id : "") . " AND created >= " . 3600 * 24 * intval($temp['daysprune']) . " ORDER BY " . $temp['sortedby'] . " " . $temp['sortorder'] . " LIMIT " . intval($temp['start']) . "," . intval($temp['postsperpage'])); $temp['replies'] = new RepliesIterator($this->user, $this->dba, $this->result, $this->qp, $this->users, $this->groups, $this->fields); } return $temp; }
function current() { $temp = parent::current(); $temp['posticon'] = isset($temp['posticon']) && @$temp['posticon'] != '' ? iif(file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']), @$temp['posticon'], 'clear.gif') : 'clear.gif'; $temp['post_id'] = 'r' . $temp['post_id']; if ($temp['poster_id'] > 0) { if (!isset($this->users[$temp['poster_id']])) { $temp['post_display_user_ddmenu'] = 1; // display a ddmenu $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id'])); if (is_array($user) && !empty($user)) { $group = get_user_max_group($user, $this->groups); $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color']; $user['group_nicename'] = $group['nicename']; $user['group_avatar'] = $group['avatar']; $user['online'] = time() - ini_get('session.gc_maxlifetime') > $user['seen'] ? 'offline' : 'online'; $this->users[$user['id']] = $user; } } else { $temp['post_display_user_ddmenu'] = $this->result->hasPrev() ? 0 : 1; // use a different ddmenu $user = $this->users[$temp['poster_id']]; } if (is_array($user) && !empty($user)) { if ($user['flag_level'] > 0 && $_SESSION['user']->get('perms') >= MODERATOR) { $temp['post_user_background'] = 'background-color: #FFFF00;'; } foreach ($user as $key => $val) { $temp['post_user_' . $key] = $val; } $temp['profilefields'] = new FAArrayIterator(get_profile_fields($this->fields, $temp)); $temp['post_user_title'] = $user['user_title']; $temp['post_user_user_title'] = get_user_title($user['user_title'], $user['num_posts']); } if (!isset($temp['post_user_online'])) { $temp['post_user_online'] = 'offline'; } } else { $temp['post_user_id'] = 0; $temp['post_user_name'] = $temp['poster_name']; } /* do we have any attachments? */ if (isset($temp['attachments']) && $temp['attachments'] > 0) { $temp['attachment_files'] = new K4AttachmentsIterator($this->dba, $this->user, $temp['post_id'], $temp['post_id']); } /* Deal with acronyms */ replace_acronyms($temp['body_text']); /* word censors!! */ replace_censors($temp['body_text']); replace_censors($temp['name']); /* Do any polls if they exist */ do_post_polls($temp, $this->dba); /* Should we free the result? */ if (!$this->hasNext()) { $this->result->free(); } return $temp; }