} } } } } } } $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.dst, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, u.date_format, u.time_format, g.g_id, g.g_user_title, g.g_moderator FROM ' . $db->prefix . 'users AS u LEFT JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id WHERE u.id=' . $id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) { message($lang_common['Bad request']); } $user = $db->fetch_assoc($result); $last_post = format_time($user['last_post']); if ($user['signature'] != '') { require PUN_ROOT . 'include/parser.php'; $parsed_signature = parse_signature($user['signature']); } // View or edit? if ($pun_user['id'] != $id && (!$pun_user['is_admmod'] || $pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1'))) { $user_personal = array(); $user_personal[] = '<dt>' . $lang_common['Username'] . '</dt>'; $user_personal[] = '<dd>' . pun_htmlspecialchars($user['username']) . '</dd>'; $user_title_field = get_title($user); $user_personal[] = '<dt>' . $lang_common['Title'] . '</dt>'; $user_personal[] = '<dd>' . ($pun_config['o_censoring'] == '1' ? censor_words($user_title_field) : $user_title_field) . '</dd>'; if ($user['realname'] != '') { $user_personal[] = '<dt>' . $lang_profile['Realname'] . '</dt>'; $user_personal[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['realname']) : $user['realname']) . '</dd>'; } if ($user['location'] != '') { $user_personal[] = '<dt>' . $lang_profile['Location'] . '</dt>';
function draw_response_list() { global $result, $db, $luna_config, $id, $comment_ids, $is_admmod, $start_from, $comment_count, $admin_ids, $luna_user, $inbox; while ($cur_comment = $db->fetch_assoc($result)) { $comment_count++; $user_avatar = ''; $user_info = array(); $user_contacts = array(); $comment_actions = array(); $is_online = ''; $signature = ''; // If the commenter is a registered user if ($cur_comment['id']) { if ($luna_user['g_view_users'] == '1') { $username = '******' . $cur_comment['sender_id'] . '">' . luna_htmlspecialchars($cur_comment['sender']) . '</a>'; } else { $username = luna_htmlspecialchars($cur_comment['sender']); } $user_title = get_title($cur_comment); if ($luna_config['o_censoring'] == '1') { $user_title = censor_words($user_title); } // Format the online indicator $is_online = $cur_comment['is_online'] == $cur_comment['sender_id'] ? '<strong>' . __('Online:', 'luna') . '</strong>' : '<span>' . __('Offline', 'luna') . '</span>'; if ($luna_config['o_avatars'] == '1' && $luna_user['show_avatars'] != '0') { if (isset($user_avatar_cache[$cur_comment['sender_id']])) { $user_avatar = $user_avatar_cache[$cur_comment['sender_id']]; } else { $user_avatar = $user_avatar_cache[$cur_comment['sender_id']] = generate_avatar_markup($cur_comment['sender_id']); } } // We only show location, register date, comment count and the contact links if "Show user info" is enabled if ($luna_config['o_show_user_info'] == '1') { if ($cur_comment['location'] != '') { if ($luna_config['o_censoring'] == '1') { $cur_comment['location'] = censor_words($cur_comment['location']); } $user_info[] = '<dd><span>' . __('From:', 'luna') . ' ' . luna_htmlspecialchars($cur_comment['location']) . '</span></dd>'; } $user_info[] = '<dd><span>' . __('Registered since', 'luna') . ' ' . format_time($cur_comment['registered'], true) . '</span></dd>'; if ($luna_config['o_show_comment_count'] == '1' || $luna_user['is_admmod']) { $user_info[] = '<dd><span>' . __('Comments:', 'luna') . ' ' . forum_number_format($cur_comment['num_comments']) . '</span></dd>'; } // Now let's deal with the contact links (Email and URL) if (($cur_comment['email_setting'] == '0' && !$luna_user['is_guest'] || $luna_user['is_admmod']) && $luna_user['g_send_email'] == '1') { $user_contacts[] = '<span class="email"><a href="mailto:' . $cur_comment['email'] . '">' . __('Email', 'luna') . '</a></span>'; } elseif ($cur_comment['email_setting'] == '1' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') { $user_contacts[] = '<span class="email"><a href="misc.php?email=' . $cur_comment['sender_id'] . '">' . __('Email', 'luna') . '</a></span>'; } if ($luna_config['o_enable_inbox'] == '1' && !$luna_user['is_guest'] && $luna_user['g_inbox'] == '1' && $luna_user['use_inbox'] == '1' && $cur_comment['use_inbox'] == '1') { $pid = isset($cur_comment['sender_id']) ? $cur_comment['sender_id'] : $cur_comment['sender_id']; $user_contacts[] = '<span class="email"><a href="new_inbox.php?uid=' . $pid . '">' . __('PM', 'luna') . '</a></span>'; } if ($cur_comment['url'] != '') { $user_contacts[] = '<span class="website"><a href="' . luna_htmlspecialchars($cur_comment['url']) . '">' . __('Website', 'luna') . '</a></span>'; } } if ($luna_user['is_admmod']) { $user_info[] = '<dd><span><a href="backstage/moderate.php?get_host=' . $cur_comment['sender_ip'] . '" title="' . $cur_comment['sender_ip'] . '">' . __('IP log', 'luna') . '</a></span></dd>'; if ($cur_comment['admin_note'] != '') { $user_info[] = '<dd><span>' . __('Note:', 'luna') . ' <strong>' . luna_htmlspecialchars($cur_comment['admin_note']) . '</strong></span></dd>'; } } } else { // If the commenter is a guest (or a user that has been deleted) $username = luna_htmlspecialchars($cur_comment['username']); $user_title = get_title($cur_comment); if ($luna_user['is_admmod']) { $user_info[] = '<dd><span><a href="backstage/moderate.php?get_host=' . $cur_comment['sender_id'] . '" title="' . $cur_comment['sender_ip'] . '">' . __('IP log', 'luna') . '</a></span></dd>'; } if ($luna_config['o_show_user_info'] == '1' && $cur_comment['commenter_email'] != '' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') { $user_contacts[] = '<span class="email"><a href="mailto:' . $cur_comment['commenter_email'] . '">' . __('Email', 'luna') . '</a></span>'; } } $username_quickreply = luna_htmlspecialchars($cur_comment['username']); $comment_actions[] = '<a href="new_inbox.php?reply=' . $cur_comment['shared_id'] . '&quote=' . $cur_comment['mid'] . '">' . __('Quote', 'luna') . '</a>'; // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_comment['message'] = parse_message($cur_comment['message']); // Do signature parsing/caching if ($luna_config['o_signatures'] == '1' && $cur_comment['signature'] != '' && $luna_user['show_sig'] != '0') { if (isset($signature_cache[$cur_comment['id']])) { $signature = $signature_cache[$cur_comment['id']]; } else { $signature = parse_signature($cur_comment['signature']); $signature_cache[$cur_comment['id']] = $signature; } } require get_view_path('comment.php'); } }
$post_actions[] = '<li><a href="message_send.php?id=' . $cur_post['id'] . '&quote=' . $cur_post['mid'] . '">' . $lang_pms['Quote'] . '</a>'; } } else { $result = $db->query('SELECT id,sender,message,posted FROM ' . $db->prefix . 'messages WHERE id=' . $id) or error('Unable to fetch message and user info', __FILE__, __LINE__, $db->error()); $cur_post = $db->fetch_assoc($result); $username = pun_htmlspecialchars($cur_post['sender']); $user_title = 'Deleted User'; $post_actions[] = '<li><a href="message_delete.php?id=' . $cur_post['id'] . '&box=' . $box . '&p=' . $p . '">' . $lang_pms['Delete'] . '</a>'; $is_online = $lang_topic['Offline']; } // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['smileys'] = isset($cur_post['smileys']) ? $cur_post['smileys'] : $pun_user['show_smilies']; $cur_post['message'] = parse_message($cur_post['message'], !$cur_post['smileys']); // Do signature parsing/caching if (isset($cur_post['signature']) && $pun_user['show_sig']) { $signature = parse_signature($cur_post['signature']); } ?> <div id="p<?php echo $cur_post['id']; ?> " class="blockpost row_odd firstpost" style="margin-left: 14em;"> <h2><span><?php echo format_time($cur_post['posted']); ?> </span></h2> <div class="box"> <div class="inbox"> <div class="postleft"> <dl>
public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod) { global $lang_topic, $lang_common, $pd; $post_data = array(); $post_count = 0; // Keep track of post numbers // Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data $result = DB::for_table('posts')->select('id')->where('topic_id', $topic_id)->order_by('id')->limit($this->user->disp_topics)->offset($start_from)->find_many(); $post_ids = array(); foreach ($result as $cur_post_id) { $post_ids[] = $cur_post_id['id']; } if (empty($post_ids)) { error('The post table and topic table seem to be out of sync!', __FILE__, __LINE__); } // Retrieve the posts (and their respective poster/online status) $select_print_posts = array('u.email', 'u.title', 'u.url', 'u.location', 'u.signature', 'u.email_setting', 'u.num_posts', 'u.registered', 'u.admin_note', 'p.id', 'username' => 'p.poster', 'p.poster_id', 'p.poster_ip', 'p.poster_email', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by', 'g.g_id', 'g.g_user_title', 'g.g_promote_next_group', 'is_online' => 'o.user_id'); $result = DB::for_table('posts')->table_alias('p')->select_many($select_print_posts)->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->raw_join('LEFT OUTER JOIN ' . $this->feather->prefix . 'online', "o.user_id!=1 AND o.idle=0 AND o.user_id=u.id", 'o')->where_in('p.id', $post_ids)->order_by('p.id')->find_array(); foreach ($result as $cur_post) { $post_count++; $cur_post['user_avatar'] = ''; $cur_post['user_info'] = array(); $cur_post['user_contacts'] = array(); $cur_post['post_actions'] = array(); $cur_post['is_online_formatted'] = ''; $cur_post['signature_formatted'] = ''; // If the poster is a registered user if ($cur_post['poster_id'] > 1) { if ($this->user->g_view_users == '1') { $cur_post['username_formatted'] = '<a href="' . get_base_url() . '/user/' . $cur_post['poster_id'] . '/">' . feather_escape($cur_post['username']) . '</a>'; } else { $cur_post['username_formatted'] = feather_escape($cur_post['username']); } $cur_post['user_title_formatted'] = get_title($cur_post); if ($this->config['o_censoring'] == '1') { $cur_post['user_title_formatted'] = censor_words($cur_post['user_title_formatted']); } // Format the online indicator $cur_post['is_online_formatted'] = $cur_post['is_online'] == $cur_post['poster_id'] ? '<strong>' . $lang_topic['Online'] . '</strong>' : '<span>' . $lang_topic['Offline'] . '</span>'; if ($this->config['o_avatars'] == '1' && $this->user->show_avatars != '0') { if (isset($avatar_cache[$cur_post['poster_id']])) { $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']]; } else { $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['poster_id']); } } // We only show location, register date, post count and the contact links if "Show user info" is enabled if ($this->config['o_show_user_info'] == '1') { if ($cur_post['location'] != '') { if ($this->config['o_censoring'] == '1') { $cur_post['location'] = censor_words($cur_post['location']); } $cur_post['user_info'][] = '<dd><span>' . $lang_topic['From'] . ' ' . feather_escape($cur_post['location']) . '</span></dd>'; } $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Registered'] . ' ' . format_time($cur_post['registered'], true) . '</span></dd>'; if ($this->config['o_show_post_count'] == '1' || $this->user->is_admmod) { $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Posts'] . ' ' . forum_number_format($cur_post['num_posts']) . '</span></dd>'; } // Now let's deal with the contact links (Email and URL) if (($cur_post['email_setting'] == '0' && !$this->user->is_guest || $this->user->is_admmod) && $this->user->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . feather_escape($cur_post['email']) . '">' . $lang_common['Email'] . '</a></span>'; } elseif ($cur_post['email_setting'] == '1' && !$this->user->is_guest && $this->user->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="' . get_link('mail/' . $cur_post['poster_id'] . '/') . '">' . $lang_common['Email'] . '</a></span>'; } if ($cur_post['url'] != '') { if ($this->config['o_censoring'] == '1') { $cur_post['url'] = censor_words($cur_post['url']); } $cur_post['user_contacts'][] = '<span class="website"><a href="' . feather_escape($cur_post['url']) . '" rel="nofollow">' . $lang_topic['Website'] . '</a></span>'; } } if ($this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && $this->user->g_mod_promote_users == '1') { if ($cur_post['g_promote_next_group']) { $cur_post['user_info'][] = '<dd><span><a href="' . get_base_url() . '/user/' . $cur_post['poster_id'] . '/action/promote/pid/' . $cur_post['id'] . '">' . $lang_topic['Promote user'] . '</a></span></dd>'; } } if ($this->user->is_admmod) { $cur_post['user_info'][] = '<dd><span><a href="' . get_link('moderate/get-host/post/' . $cur_post['id'] . '/') . '" title="' . feather_escape($cur_post['poster_ip']) . '">' . $lang_topic['IP address logged'] . '</a></span></dd>'; if ($cur_post['admin_note'] != '') { $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Note'] . ' <strong>' . feather_escape($cur_post['admin_note']) . '</strong></span></dd>'; } } } else { $cur_post['username_formatted'] = feather_escape($cur_post['username']); $cur_post['user_title_formatted'] = get_title($cur_post); if ($this->user->is_admmod) { $cur_post['user_info'][] = '<dd><span><a href="moderate.php?get_host=' . $cur_post['id'] . '" title="' . feather_escape($cur_post['poster_ip']) . '">' . $lang_topic['IP address logged'] . '</a></span></dd>'; } if ($this->config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$this->user->is_guest && $this->user->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . feather_escape($cur_post['poster_email']) . '">' . $lang_common['Email'] . '</a></span>'; } } // Generation post action array (quote, edit, delete etc.) if (!$is_admmod) { if (!$this->user->is_guest) { $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . get_link('report/' . $cur_post['id'] . '/') . '">' . $lang_topic['Report'] . '</a></span></li>'; } if ($cur_topic['closed'] == '0') { if ($cur_post['poster_id'] == $this->user->id) { if ($start_from + $post_count == 1 && $this->user->g_delete_topics == '1' || $start_from + $post_count > 1 && $this->user->g_delete_posts == '1') { $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Delete'] . '</a></span></li>'; } if ($this->user->g_edit_posts == '1') { $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Edit'] . '</a></span></li>'; } } if ($cur_topic['post_replies'] == '' && $this->user->g_post_replies == '1' || $cur_topic['post_replies'] == '1') { $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . get_link('post/reply/' . $topic_id . '/quote/' . $cur_post['id'] . '/') . '">' . $lang_topic['Quote'] . '</a></span></li>'; } } } else { $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . get_link('report/' . $cur_post['id'] . '/') . '">' . $lang_topic['Report'] . '</a></span></li>'; if ($this->user->g_id == FEATHER_ADMIN || !in_array($cur_post['poster_id'], $admin_ids)) { $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . get_link('delete/' . $cur_post['id'] . '/') . '">' . $lang_topic['Delete'] . '</a></span></li>'; $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Edit'] . '</a></span></li>'; } $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . get_link('post/reply/' . $topic_id . '/quote/' . $cur_post['id'] . '/') . '">' . $lang_topic['Quote'] . '</a></span></li>'; } // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); // Do signature parsing/caching if ($this->config['o_signatures'] == '1' && $cur_post['signature'] != '' && $this->user->show_sig != '0') { if (isset($avatar_cache[$cur_post['poster_id']])) { $cur_post['signature_formatted'] = $avatar_cache[$cur_post['poster_id']]; } else { $cur_post['signature_formatted'] = parse_signature($cur_post['signature']); $avatar_cache[$cur_post['poster_id']] = $cur_post['signature_formatted']; } } $post_data[] = $cur_post; } return $post_data; }
// Generate the post title if ($cur_post['id'] == $cur_topic['first_post_id']) { $forum_page['item_subject'] = sprintf($lang_topic['Topic title'], $cur_topic['subject']); } else { $forum_page['item_subject'] = sprintf($lang_topic['Reply title'], $cur_topic['subject']); } $forum_page['item_subject'] = forum_htmlencode($forum_page['item_subject']); // Perform the main parsing of the message (BBCode, smilies, censor words etc) $forum_page['message']['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); if ($cur_post['edited'] != '') { $forum_page['message']['edited'] = '<p class="lastedit"><em>' . sprintf($lang_topic['Last edited'], forum_htmlencode($cur_post['edited_by']), format_time($cur_post['edited'])) . '</em></p>'; } // Do signature parsing/caching if ($cur_post['signature'] != '' && $forum_user['show_sig'] != '0' && $forum_config['o_signatures'] == '1') { if (!isset($signature_cache[$cur_post['poster_id']])) { $signature_cache[$cur_post['poster_id']] = parse_signature($cur_post['signature']); } $forum_page['message']['signature'] = '<div class="sig-content"><span class="sig-line"><!-- --></span>' . $signature_cache[$cur_post['poster_id']] . '</div>'; } ($hook = get_hook('vt_row_pre_display')) ? eval($hook) : null; // Do user data caching for the post if ($cur_post['poster_id'] > 1 && !isset($user_data_cache[$cur_post['poster_id']])) { $user_data_cache[$cur_post['poster_id']] = array('author_ident' => $forum_page['author_ident'], 'author_info' => $forum_page['author_info'], 'post_contacts' => $forum_page['post_contacts']); ($hook = get_hook('vt_row_add_user_data_cache')) ? eval($hook) : null; } ?> <div class="<?php echo implode(' ', $forum_page['item_status']); ?> "> <div id="p<?php
//Move Post Mod 1.2 row - Quick Quote } // Remove '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li>' because delete function occurs high server load. // To be put back when this function will be corrected. (bad english but titise fait expres !) } // Switch the background color for every message. $bg_switch = $bg_switch ? $bg_switch = false : ($bg_switch = true); $vtbg = $bg_switch ? ' roweven' : ' rowodd'; // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies'], $post_id_list); // Do signature parsing/caching if ($poster_data['signature'] != '' && $pun_user['show_sig'] != '0') { if (isset($signature_cache[$cur_post['poster_id']])) { $signature = $signature_cache[$cur_post['poster_id']]; } else { $signature = parse_signature($poster_data['signature']); $signature_cache[$cur_post['poster_id']] = $signature; } } ?> <div id="p<?php echo $cur_post['id']; ?> " class="blockpost<?php echo $vtbg; if (!$pun_user['is_guest'] && $cur_post['posted'] > $last_read && $cur_post['poster_id'] != $pun_user['id']) { echo ' new'; } if ($is_first_post) { echo ' firstpost'; }
} else { // multiquote mod and movepost mod $post_actions[] = '<li class="postreport"><a href="misc.php?report=' . $cur_post['id'] . '">' . $lang_topic['Report'] . '</a>' . $lang_topic['Link separator'] . '</li><li class="postdelete"><a href="delete.php?id=' . $cur_post['id'] . '">' . $lang_topic['Delete'] . '</a>' . $lang_topic['Link separator'] . '</li><li class="postquote"><a href="movepost.php?id=' . $cur_post['id'] . '">' . $lang_topic['Move'] . '</a>' . $lang_topic['Link separator'] . '</li><li class="postedit"><a href="edit.php?id=' . $cur_post['id'] . '">' . $lang_topic['Edit'] . '</a>' . $lang_topic['Link separator'] . '</li><li class="postquote">' . $quote_link . $lang_topic['Quote'] . '</a>'; } //$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_topic['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="movepost.php?id='.$cur_post['id'].'">'.$lang_topic['Move'].'</a>'.$lang_topic['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'; //Move Post Mod 1.1.1 row // Switch the background color for every message. $bg_switch = $bg_switch ? $bg_switch = false : ($bg_switch = true); $vtbg = $bg_switch ? ' roweven' : ' rowodd'; // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); // Do signature parsing/caching if ($cur_post['signature'] != '' && $pun_user['show_sig'] != '0' && !isset($signatures[$cur_post['poster_id']])) { if (isset($signature_cache[$cur_post['poster_id']])) { $signature = $signature_cache[$cur_post['poster_id']]; } else { $signature = '<br /><br />--------------------------------------------------------<br />' . parse_signature($cur_post['signature']); $signatures[$cur_post['poster_id']] = true; $signature_cache[$cur_post['poster_id']] = $signature; } } // Attachment Mod Block Start $attach_allow_download = false; $attach_output = ''; $attach_num = 0; // Check if this post has any attachments $result_attach = $db->query('SELECT af.id, af.filename, af.size, af.downloads FROM ' . $db->prefix . 'attach_2_files AS af WHERE af.post_id=' . $cur_post['id']) or error('Unable to fetch if there were any attachments to the post', __FILE__, __LINE__, $db->error()); $attach_num = $db->num_rows($result_attach); if ($attach_num > 0) { if ($pun_user['g_id'] == PUN_ADMIN) { $attach_allow_download = true; } else {
public function display($id, $section = null) { global $lang_common, $lang_prof_reg, $lang_profile, $pd, $forum_time_formats, $forum_date_formats; // Include UTF-8 function require FEATHER_ROOT . 'include/utf8/substr_replace.php'; require FEATHER_ROOT . 'include/utf8/ucwords.php'; // utf8_ucwords needs utf8_substr_replace require FEATHER_ROOT . 'include/utf8/strcasecmp.php'; // Load the prof_reg.php language file require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php'; // Load the profile.php language file require FEATHER_ROOT . 'lang/' . $this->user->language . '/profile.php'; if ($this->request->post('update_group_membership')) { if ($this->user->g_id > FEATHER_ADMIN) { message($lang_common['No permission'], '403'); } $this->model->update_group_membership($id, $this->feather); } elseif ($this->request->post('update_forums')) { if ($this->user->g_id > FEATHER_ADMIN) { message($lang_common['No permission'], '403'); } $this->model->update_mod_forums($id, $this->feather); } elseif ($this->request->post('ban')) { if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) { message($lang_common['No permission'], '403'); } $this->model->ban_user($id); } elseif ($this->request->post('delete_user') || $this->request->post('delete_user_comply')) { if ($this->user->g_id > FEATHER_ADMIN) { message($lang_common['No permission'], '403'); } $this->model->delete_user($id, $this->feather); $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Confirm delete user']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->feather->render('profile/delete_user.php', array('lang_common' => $lang_common, 'username' => $this->model->get_username($id), 'lang_profile' => $lang_profile, 'id' => $id)); $this->footer->display(); } elseif ($this->request->post('form_sent')) { // Fetch the user group of the user we are editing $info = $this->model->fetch_user_group($id); if ($this->user->id != $id && (!$this->user->is_admmod || $this->user->g_id != FEATHER_ADMIN && ($this->user->g_mod_edit_users == '0' || $info['group_id'] == FEATHER_ADMIN || $info['is_moderator']))) { // or the user is another mod message($lang_common['No permission'], '403'); } $this->model->update_profile($id, $info, $section, $this->feather); } $user = $this->model->get_user_info($id); $last_post = format_time($user['last_post']); if ($user['signature'] != '') { require FEATHER_ROOT . 'include/parser.php'; $parsed_signature = parse_signature($user['signature']); } // View or edit? if ($this->user->id != $id && (!$this->user->is_admmod || $this->user->g_id != FEATHER_ADMIN && ($this->user->g_mod_edit_users == '0' || $user['g_id'] == FEATHER_ADMIN || $user['g_moderator'] == '1'))) { // or the user is another mod $user_info = $this->model->parse_user_info($user); $page_title = array(feather_escape($this->config['o_board_title']), sprintf($lang_profile['Users profile'], feather_escape($user['username']))); define('FEATHER_ALLOW_INDEX', 1); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->feather->render('profile/view_profile.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user_info' => $user_info)); $this->footer->display(); } else { if (!$section || $section == 'essentials') { $user_disp = $this->model->edit_essentials($id, $user); $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section essentials']); $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['Email']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->setRequiredFields($required_fields)->display(); $this->model->generate_profile_menu('essentials', $id); $this->feather->render('profile/section_essentials.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'lang_prof_reg' => $lang_prof_reg, 'feather' => $this->feather, 'id' => $id, 'user' => $user, 'user_disp' => $user_disp, 'forum_time_formats' => $forum_time_formats, 'forum_date_formats' => $forum_date_formats)); } elseif ($section == 'personal') { if ($this->user->g_set_title == '1') { $title_field = '<label>' . $lang_common['Title'] . ' <em>(' . $lang_profile['Leave blank'] . ')</em><br /><input type="text" name="title" value="' . feather_escape($user['title']) . '" size="30" maxlength="50" /><br /></label>' . "\n"; } $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section personal']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('personal', $id); $this->feather->render('profile/section_personal.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user' => $user, 'feather' => $this->feather)); } elseif ($section == 'messaging') { $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section messaging']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('messaging', $id); $this->feather->render('profile/section_messaging.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user' => $user)); } elseif ($section == 'personality') { if ($this->config['o_avatars'] == '0' && $this->config['o_signatures'] == '0') { message($lang_common['Bad request'], '404'); } $avatar_field = '<span><a href="' . get_link('user/' . $id . '/action/upload_avatar/') . '">' . $lang_profile['Change avatar'] . '</a></span>'; $user_avatar = generate_avatar_markup($id); if ($user_avatar) { $avatar_field .= ' <span><a href="' . get_link('user/' . $id . '/action/delete_avatar/') . '">' . $lang_profile['Delete avatar'] . '</a></span>'; } else { $avatar_field = '<span><a href="' . get_link('user/' . $id . '/action/upload_avatar/') . '">' . $lang_profile['Upload avatar'] . '</a></span>'; } if ($user['signature'] != '') { $signature_preview = '<p>' . $lang_profile['Sig preview'] . '</p>' . "\n\t\t\t\t\t\t\t" . '<div class="postsignature postmsg">' . "\n\t\t\t\t\t\t\t\t" . '<hr />' . "\n\t\t\t\t\t\t\t\t" . $parsed_signature . "\n\t\t\t\t\t\t\t" . '</div>' . "\n"; } else { $signature_preview = '<p>' . $lang_profile['No sig'] . '</p>' . "\n"; } $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section personality']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('personality', $id); $this->feather->render('profile/section_personality.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user_avatar' => $user_avatar, 'avatar_field' => $avatar_field, 'signature_preview' => $signature_preview, 'user' => $user, 'feather' => $this->feather)); } elseif ($section == 'display') { $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section display']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('display', $id); $this->feather->render('profile/section_display.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user' => $user)); } elseif ($section == 'privacy') { $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section privacy']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('privacy', $id); $this->feather->render('profile/section_privacy.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'lang_prof_reg' => $lang_prof_reg, 'user' => $user)); } elseif ($section == 'admin') { if (!$this->user->is_admmod || $this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '0') { message($lang_common['Bad request'], false, '403 Forbidden'); } $page_title = array(feather_escape($this->config['o_board_title']), $lang_common['Profile'], $lang_profile['Section admin']); define('FEATHER_ACTIVE_PAGE', 'profile'); $this->header->setTitle($page_title)->display(); $this->model->generate_profile_menu('admin', $id); $this->feather->render('profile/section_admin.php', array('lang_common' => $lang_common, 'lang_profile' => $lang_profile, 'user' => $user, 'forum_list' => $this->model->get_forum_list($id), 'group_list' => $this->model->get_group_list($user), 'feather' => $this->feather)); } else { message($lang_common['Bad request'], '404'); } $this->footer->display(); } }